Fixed bug that caused the configuration not to be cleared when reserved but

not activated and then releasing.
This commit is contained in:
Florian Pose 2010-06-02 22:54:08 +02:00
parent c442beaa02
commit 8b6d5f8af3
3 changed files with 23 additions and 13 deletions

1
TODO
View File

@ -42,7 +42,6 @@ Version 1.5.0:
* Output SoE IDN configurations in 'ethercat config'.
* Fix casting away constness during expected WC calculation.
* Read AL status code on spontaneous state change.
* Fix clearing domains etc. when not activated and releasing.
* Only output watchdog config if not default.
Future issues:

View File

@ -439,6 +439,20 @@ void ec_master_clear_domains(ec_master_t *master)
/*****************************************************************************/
/** Clear the configuration applied by the application.
*/
void ec_master_clear_config(
ec_master_t *master /**< EtherCAT master. */
)
{
down(&master->master_sem);
ec_master_clear_domains(master);
ec_master_clear_slave_configs(master);
up(&master->master_sem);
}
/*****************************************************************************/
/** Internal sending callback.
*/
void ec_master_internal_send_cb(
@ -653,15 +667,17 @@ void ec_master_leave_operation_phase(
ec_master_t *master /**< EtherCAT master */
)
{
if (master->active)
ecrt_master_deactivate(master);
if (master->active) {
ecrt_master_deactivate(master); // also clears config
} else {
ec_master_clear_config(master);
}
EC_MASTER_DBG(master, 1, "OPERATION -> IDLE.\n");
master->phase = EC_IDLE;
}
/*****************************************************************************/
/** Injects external datagrams that fit into the datagram queue.
@ -1989,8 +2005,7 @@ void ecrt_master_deactivate(ec_master_t *master)
int eoe_was_running;
#endif
EC_MASTER_DBG(master, 1, "ecrt_master_deactivate(master = 0x%p)\n",
master);
EC_MASTER_DBG(master, 1, "%s(master = 0x%p)\n", __func__, master);
if (!master->active) {
EC_MASTER_WARN(master, "%s: Master not active.\n", __func__);
@ -2007,10 +2022,7 @@ void ecrt_master_deactivate(ec_master_t *master)
master->receive_cb = ec_master_internal_receive_cb;
master->cb_data = master;
down(&master->master_sem);
ec_master_clear_domains(master);
ec_master_clear_slave_configs(master);
up(&master->master_sem);
ec_master_clear_config(master);
for (slave = master->slaves;
slave < master->slaves + master->slave_count;

View File

@ -170,11 +170,12 @@ struct ec_master {
unsigned int injection_seq_rt; /**< Datagram injection sequence number
for the realtime side. */
ec_slave_t *slaves; /**< Array of slaves on the bus. */
unsigned int slave_count; /**< Number of slaves on the bus. */
/* Configuration applied by the application. */
struct list_head configs; /**< List of slave configurations. */
struct list_head domains; /**< List of domains. */
u64 app_time; /**< Time of the last ecrt_master_sync() call. */
u64 app_start_time; /**< Application start time. */
@ -213,7 +214,6 @@ struct ec_master {
struct list_head external_datagram_queue; /**< External Datagram queue. */
unsigned int send_interval; /**< Interval between calls to ecrt_master_send */
size_t max_queue_size; /**< Maximum size of datagram queue */
struct list_head domains; /**< List of domains. */
unsigned int debug_level; /**< Master debug level. */
ec_stats_t stats; /**< Cyclic statistics. */
@ -242,7 +242,6 @@ struct ec_master {
struct list_head reg_requests; /**< Register requests. */
wait_queue_head_t reg_queue; /**< Wait queue for register requests. */
};
/*****************************************************************************/