Replaced self_configured flag with force_config flag.

This commit is contained in:
Florian Pose 2008-04-25 14:32:56 +00:00
parent ff5dd7fe1c
commit 00d78d2566
5 changed files with 18 additions and 17 deletions

2
TODO
View File

@ -8,8 +8,6 @@ $Id$
Version 1.4.0:
* Remove self_configured flag to avoid unnecessary process data
interruptions.
* Replace Sysfs interface with cdev and a user space program
to replace lsec; move a few sysfs attributes to proc.
* Implement realtime interface via cdev.

View File

@ -261,6 +261,11 @@ void ec_fsm_master_state_broadcast(
return;
}
// do not force reconfiguration in operation mode to avoid
// unnecesssary process data interruptions
if (master->mode != EC_MASTER_MODE_OPERATION)
slave->force_config = 1;
list_add_tail(&slave->list, &master->slaves);
}
@ -514,7 +519,7 @@ void ec_fsm_master_action_configure(
// Does the slave have to be configured?
if (!slave->error_flag
&& (slave->current_state != slave->requested_state
|| !slave->self_configured)) {
|| slave->force_config)) {
// Start slave configuration, if it is allowed.
down(&master->config_sem);
if (!master->allow_config) {
@ -524,19 +529,19 @@ void ec_fsm_master_action_configure(
up(&master->config_sem);
if (master->debug_level) {
char old_state[EC_STATE_STRING_SIZE];
char old_state[EC_STATE_STRING_SIZE],
new_state[EC_STATE_STRING_SIZE];
ec_state_string(slave->current_state, old_state);
if (slave->current_state != slave->requested_state) {
char new_state[EC_STATE_STRING_SIZE];
ec_state_string(slave->requested_state, new_state);
EC_DBG("Changing state of slave %u (%s -> %s).\n",
slave->ring_position, old_state, new_state);
} else if (!slave->self_configured) {
EC_DBG("Reconfiguring slave %u (%s).\n",
slave->ring_position, old_state);
}
ec_state_string(slave->requested_state, new_state);
EC_DBG("Changing state of slave %u from %s to %s%s.\n",
slave->ring_position, old_state, new_state,
slave->force_config ? " (forced)" : "");
}
// configuration will be done immediately; therefore reset the
// force flag
slave->force_config = 0;
fsm->idle = 0;
fsm->state = ec_fsm_master_state_configure_slave;
ec_fsm_slave_config_start(&fsm->fsm_slave_config, slave);

View File

@ -197,8 +197,6 @@ void ec_fsm_slave_config_state_init(ec_fsm_slave_config_t *fsm /**< slave state
return;
}
slave->self_configured = 1;
if (master->debug_level) {
EC_DBG("Slave %i is now in INIT.\n", slave->ring_position);
}

View File

@ -118,8 +118,8 @@ int ec_slave_init(ec_slave_t *slave, /**< EtherCAT slave */
slave->config = NULL;
slave->requested_state = EC_SLAVE_STATE_PREOP;
slave->current_state = EC_SLAVE_STATE_UNKNOWN;
slave->self_configured = 0;
slave->error_flag = 0;
slave->force_config = 0;
slave->base_type = 0;
slave->base_revision = 0;

View File

@ -173,8 +173,8 @@ struct ec_slave
ec_slave_config_t *config; /**< Current configuration. */
ec_slave_state_t requested_state; /**< Requested application state. */
ec_slave_state_t current_state; /**< Current application state. */
unsigned int self_configured; /**< Slave was configured by this master. */
unsigned int error_flag; /**< Stop processing after an error. */
unsigned int force_config; /**< Force (re-)configuration. */
// base data
uint8_t base_type; /**< slave type */