Removed configs_attached flag; changed return value of

ec_master_attach_slave_configs() to void.
This commit is contained in:
Florian Pose 2008-06-18 12:49:11 +00:00
parent 258ec19c99
commit d91aa97487
4 changed files with 4 additions and 21 deletions

2
TODO
View File

@ -16,8 +16,6 @@ Version 1.4.0:
* Update documentation.
* Check for sizes of uploaded Sdos when reading mapping from CoE.
* Attach Pdo names from SII or Coe dictioary to Pdos read via CoE.
* List of commands that require a slave.
* Remove configs_attached flag.
* Rename master MODE to STATE.
* Remove the end state of the master state machine.
* Add a -n (numeric) switch to ethercat command.

View File

@ -233,7 +233,6 @@ void ec_fsm_master_state_broadcast(
ec_master_clear_eoe_handlers(master);
#endif
ec_master_clear_slaves(master);
master->configs_attached = 0;
master->slave_count = fsm->slaves_responding;

View File

@ -1014,37 +1014,24 @@ void ec_master_detach_slave_configs(
{
ec_slave_config_t *sc;
if (!master->configs_attached)
return;
list_for_each_entry(sc, &master->configs, list) {
ec_slave_config_detach(sc);
}
master->configs_attached = 0;
}
/*****************************************************************************/
/** Attaches the slave configurations to the slaves.
*/
int ec_master_attach_slave_configs(
void ec_master_attach_slave_configs(
ec_master_t *master /**< EtherCAT master. */
)
{
ec_slave_config_t *sc;
unsigned int errors = 0;
if (master->configs_attached)
return 0;
list_for_each_entry(sc, &master->configs, list) {
if (ec_slave_config_attach(sc))
errors = 1;
ec_slave_config_attach(sc);
}
master->configs_attached = !errors;
return errors ? -1 : 0;
}
/*****************************************************************************/

View File

@ -103,8 +103,7 @@ struct ec_master {
ec_slave_t *slaves; /**< Array of slaves on the bus. */
unsigned int slave_count; /**< Number of slaves on the bus. */
struct list_head configs; /**< Bus configuration list. */
unsigned int configs_attached; /**< Slave configurations were attached. */
struct list_head configs; /**< List of slave configurations. */
unsigned int scan_busy; /**< Current scan state. */
unsigned int allow_scan; /**< non-zero, if slave scanning is allowed */
@ -188,7 +187,7 @@ void ec_master_receive_datagrams(ec_master_t *, const uint8_t *, size_t);
void ec_master_queue_datagram(ec_master_t *, ec_datagram_t *);
// misc.
int ec_master_attach_slave_configs(ec_master_t *);
void ec_master_attach_slave_configs(ec_master_t *);
ec_slave_t *ec_master_find_slave(ec_master_t *, uint16_t, uint16_t);
void ec_master_output_stats(ec_master_t *);
#ifdef EC_EOE