Clear slave list on link down.

This commit is contained in:
Florian Pose 2009-04-17 12:41:57 +00:00
parent 4694cde027
commit 515a66aa8e
4 changed files with 13 additions and 1 deletions

1
NEWS
View File

@ -32,6 +32,7 @@ Changes since 1.4.0:
* Added 64-bit data access macros to application header.
* Added debug level for all masters as a module parameter. Thanks to Erwin
Burgstaller.
* Clear slave list on link down.
Changes in 1.4.0:

1
TODO
View File

@ -19,7 +19,6 @@ Version 1.5.0:
* Re-work EoE code.
* Replace locking callbacks.
* Implement EoE callbacks for library.
* Clear slave list on link down.
* Rescan command.
* Override sync manager size?
* Remove ecrt_domain_state()?

View File

@ -73,6 +73,7 @@ void ec_fsm_master_init(
fsm->datagram = datagram;
fsm->state = ec_fsm_master_state_start;
fsm->idle = 0;
fsm->link_state = 0;
fsm->slaves_responding = 0;
fsm->topology_change_pending = 0;
fsm->slave_states = EC_SLAVE_STATE_UNKNOWN;
@ -194,6 +195,16 @@ void ec_fsm_master_state_broadcast(
EC_INFO("%u slave(s) responding.\n", fsm->slaves_responding);
}
if (fsm->link_state && !master->main_device.link_state) { // link went down
// clear slave list
#ifdef EC_EOE
ec_master_eoe_stop(master);
ec_master_clear_eoe_handlers(master);
#endif
ec_master_clear_slaves(master);
}
fsm->link_state = master->main_device.link_state;
if (datagram->state != EC_DATAGRAM_RECEIVED) { // link is down
ec_fsm_master_restart(fsm);
return;

View File

@ -107,6 +107,7 @@ struct ec_fsm_master {
void (*state)(ec_fsm_master_t *); /**< master state function */
int idle; /**< state machine is in idle phase */
unsigned long scan_jiffies; /**< beginning of slave scanning */
uint8_t link_state; /**< Last main device link state. */
unsigned int slaves_responding; /**< number of responding slaves */
unsigned int topology_change_pending; /**< bus topology changed */
ec_slave_state_t slave_states; /**< states of responding slaves */