From 58ce06f714d7d8b55775c55a1328860c826e9b3a Mon Sep 17 00:00:00 2001 From: Florian Pose <fp@igh-essen.com> Date: Fri, 16 Sep 2011 14:10:23 +0200 Subject: [PATCH] Removed allow_config flag and obsolete request to OP. --HG-- branch : stable-1.5 --- master/fsm_master.c | 41 +++++++++++++++++++---------------------- master/master.c | 5 ----- master/master.h | 2 -- master/slave_config.c | 3 --- 4 files changed, 19 insertions(+), 32 deletions(-) diff --git a/master/fsm_master.c b/master/fsm_master.c index dca3a976..3a5e8e58 100644 --- a/master/fsm_master.c +++ b/master/fsm_master.c @@ -583,30 +583,26 @@ void ec_fsm_master_action_configure( if ((slave->current_state != slave->requested_state || slave->force_config) && !slave->error_flag) { - // Start slave configuration, if it is allowed. + // Start slave configuration down(&master->config_sem); - if (!master->allow_config) { - up(&master->config_sem); - } else { - master->config_busy = 1; - up(&master->config_sem); - - if (master->debug_level) { - char old_state[EC_STATE_STRING_SIZE], - new_state[EC_STATE_STRING_SIZE]; - ec_state_string(slave->current_state, old_state, 0); - ec_state_string(slave->requested_state, new_state, 0); - EC_SLAVE_DBG(slave, 1, "Changing state from %s to %s%s.\n", - old_state, new_state, - slave->force_config ? " (forced)" : ""); - } - - fsm->idle = 0; - fsm->state = ec_fsm_master_state_configure_slave; - ec_fsm_slave_config_start(&fsm->fsm_slave_config, slave); - fsm->state(fsm); // execute immediately - return; + master->config_busy = 1; + up(&master->config_sem); + + if (master->debug_level) { + char old_state[EC_STATE_STRING_SIZE], + new_state[EC_STATE_STRING_SIZE]; + ec_state_string(slave->current_state, old_state, 0); + ec_state_string(slave->requested_state, new_state, 0); + EC_SLAVE_DBG(slave, 1, "Changing state from %s to %s%s.\n", + old_state, new_state, + slave->force_config ? " (forced)" : ""); } + + fsm->idle = 0; + fsm->state = ec_fsm_master_state_configure_slave; + ec_fsm_slave_config_start(&fsm->fsm_slave_config, slave); + fsm->state(fsm); // execute immediately + return; } // slave has error flag set; process next one @@ -899,6 +895,7 @@ void ec_fsm_master_enter_write_system_times( } } + // scanning and setting system times complete ec_master_request_op(master); ec_fsm_master_restart(fsm); } diff --git a/master/master.c b/master/master.c index 034e4350..c689b97f 100644 --- a/master/master.c +++ b/master/master.c @@ -158,7 +158,6 @@ int ec_master_init(ec_master_t *master, /**< EtherCAT master */ init_waitqueue_head(&master->scan_queue); master->config_busy = 0; - master->allow_config = 1; sema_init(&master->config_sem, 1); init_waitqueue_head(&master->config_queue); @@ -594,7 +593,6 @@ int ec_master_enter_operation_phase(ec_master_t *master /**< EtherCAT master */) EC_MASTER_DBG(master, 1, "IDLE -> OPERATION.\n"); down(&master->config_sem); - master->allow_config = 0; // temporarily disable slave configuration if (master->config_busy) { up(&master->config_sem); @@ -655,7 +653,6 @@ int ec_master_enter_operation_phase(ec_master_t *master /**< EtherCAT master */) out_allow: master->allow_scan = 1; - master->allow_config = 1; return ret; } @@ -2013,7 +2010,6 @@ int ecrt_master_activate(ec_master_t *master) return ret; } - master->allow_config = 1; // request the current configuration master->allow_scan = 1; // allow re-scanning on topology change master->active = 1; @@ -2087,7 +2083,6 @@ void ecrt_master_deactivate(ec_master_t *master) EC_MASTER_WARN(master, "Failed to restart master thread!\n"); master->allow_scan = 1; - master->allow_config = 1; master->active = 0; } diff --git a/master/master.h b/master/master.h index d0cd7b8a..919b3cfe 100644 --- a/master/master.h +++ b/master/master.h @@ -196,8 +196,6 @@ struct ec_master { slave scanning. */ unsigned int config_busy; /**< State of slave configuration. */ - unsigned int allow_config; /**< \a True, if slave configuration is - allowed. */ struct semaphore config_sem; /**< Semaphore protecting the \a config_busy variable and the allow_config flag. */ wait_queue_head_t config_queue; /**< Queue for processes that wait for diff --git a/master/slave_config.c b/master/slave_config.c index 4b24792e..b8569bee 100644 --- a/master/slave_config.c +++ b/master/slave_config.c @@ -227,10 +227,7 @@ int ec_slave_config_attach( slave->config = sc; sc->slave = slave; - ec_slave_request_state(slave, EC_SLAVE_STATE_OP); - EC_CONFIG_DBG(sc, 1, "Attached slave %u.\n", slave->ring_position); - return 0; } -- GitLab