master/fsm.c
changeset 254 986afccca9ea
parent 251 c1d0b63a9302
child 255 6b916cce7f27
equal deleted inserted replaced
253:6dd3e49dbb85 254:986afccca9ea
   149 
   149 
   150 void ec_fsm_master_start(ec_fsm_t *fsm)
   150 void ec_fsm_master_start(ec_fsm_t *fsm)
   151 {
   151 {
   152     ec_command_brd(&fsm->command, 0x0130, 2);
   152     ec_command_brd(&fsm->command, 0x0130, 2);
   153     ec_master_queue_command(fsm->master, &fsm->command);
   153     ec_master_queue_command(fsm->master, &fsm->command);
   154 
       
   155     fsm->master_state = ec_fsm_master_wait;
   154     fsm->master_state = ec_fsm_master_wait;
   156 }
   155 }
   157 
   156 
   158 /*****************************************************************************/
   157 /*****************************************************************************/
   159 
   158 
   162     ec_command_t *command = &fsm->command;
   161     ec_command_t *command = &fsm->command;
   163     unsigned int topology_change, i, eoe_slaves_active;
   162     unsigned int topology_change, i, eoe_slaves_active;
   164     ec_slave_t *slave;
   163     ec_slave_t *slave;
   165 
   164 
   166     if (command->state != EC_CMD_RECEIVED) {
   165     if (command->state != EC_CMD_RECEIVED) {
       
   166         if (!fsm->master->device->link_state)
       
   167             // treat link down as topology change
       
   168             fsm->master_slaves_responding = 0;
   167         fsm->master_state = ec_fsm_master_start;
   169         fsm->master_state = ec_fsm_master_start;
   168         fsm->master_state(fsm); // execute immediately
   170         fsm->master_state(fsm); // execute immediately
   169         return;
   171         return;
   170     }
   172     }
   171 
   173