# HG changeset patch # User Florian Pose # Date 1153314902 0 # Node ID 45886de3db87210a062ca6734176cf774405ef67 # Parent 03aab3068f083fed999e7767ff91ab44944cd01f Renamed FREERUN mode to IDLE mode. diff -r 03aab3068f08 -r 45886de3db87 master/fsm.c --- a/master/fsm.c Wed Jul 19 13:08:21 2006 +0000 +++ b/master/fsm.c Wed Jul 19 13:15:02 2006 +0000 @@ -219,8 +219,8 @@ printk(".\n"); } - // topology change in free-run mode: clear all slaves and scan the bus - if (topology_change && master->mode == EC_MASTER_MODE_FREERUN) { + // topology change in idle mode: clear all slaves and scan the bus + if (topology_change && master->mode == EC_MASTER_MODE_IDLE) { EC_INFO("Scanning bus.\n"); ec_master_eoe_stop(master); @@ -311,7 +311,7 @@ return; } - if (master->mode == EC_MASTER_MODE_FREERUN) { + if (master->mode == EC_MASTER_MODE_IDLE) { // nothing to configure. check for pending EEPROM write operations. list_for_each_entry(slave, &master->slaves, list) { if (!slave->new_eeprom_data) continue; @@ -670,7 +670,7 @@ coupler_subindex++; } - if (master->mode == EC_MASTER_MODE_FREERUN) { + if (master->mode == EC_MASTER_MODE_IDLE) { // start EoE processing ec_master_eoe_start(master); } diff -r 03aab3068f08 -r 45886de3db87 master/master.c --- a/master/master.c Wed Jul 19 13:08:21 2006 +0000 +++ b/master/master.c Wed Jul 19 13:15:02 2006 +0000 @@ -55,7 +55,7 @@ /*****************************************************************************/ -void ec_master_freerun(void *); +void ec_master_idle(void *); void ec_master_eoe_run(unsigned long); ssize_t ec_show_master_attribute(struct kobject *, struct attribute *, char *); ssize_t ec_store_master_attribute(struct kobject *, struct attribute *, @@ -116,7 +116,7 @@ INIT_LIST_HEAD(&master->domains); INIT_LIST_HEAD(&master->eoe_handlers); ec_datagram_init(&master->simple_datagram); - INIT_WORK(&master->freerun_work, ec_master_freerun, (void *) master); + INIT_WORK(&master->idle_work, ec_master_idle, (void *) master); init_timer(&master->eoe_timer); master->eoe_timer.function = ec_master_eoe_run; master->eoe_timer.data = (unsigned long) master; @@ -218,7 +218,7 @@ ec_domain_t *domain, *next_d; ec_master_eoe_stop(master); - ec_master_freerun_stop(master); + ec_master_idle_stop(master); ec_master_clear_slaves(master); // empty datagram queue @@ -675,41 +675,43 @@ /*****************************************************************************/ /** - Starts the Free-Run mode. -*/ - -void ec_master_freerun_start(ec_master_t *master /**< EtherCAT master */) -{ - if (master->mode == EC_MASTER_MODE_FREERUN) return; + Starts the Idle mode. +*/ + +void ec_master_idle_start(ec_master_t *master /**< EtherCAT master */) +{ + if (master->mode == EC_MASTER_MODE_IDLE) return; if (master->mode == EC_MASTER_MODE_RUNNING) { - EC_ERR("ec_master_freerun_start: Master already running!\n"); + EC_ERR("ec_master_idle_start: Master already running!\n"); return; } - EC_INFO("Starting Free-Run mode.\n"); - - master->mode = EC_MASTER_MODE_FREERUN; + EC_INFO("Starting Idle mode.\n"); + + master->mode = EC_MASTER_MODE_IDLE; ec_fsm_reset(&master->fsm); - queue_delayed_work(master->workqueue, &master->freerun_work, 1); -} - -/*****************************************************************************/ - -/** - Stops the Free-Run mode. -*/ - -void ec_master_freerun_stop(ec_master_t *master /**< EtherCAT master */) -{ - if (master->mode != EC_MASTER_MODE_FREERUN) return; + queue_delayed_work(master->workqueue, &master->idle_work, 1); +} + +/*****************************************************************************/ + +/** + Stops the Idle mode. +*/ + +void ec_master_idle_stop(ec_master_t *master /**< EtherCAT master */) +{ + if (master->mode != EC_MASTER_MODE_IDLE) return; ec_master_eoe_stop(master); - EC_INFO("Stopping Free-Run mode.\n"); - master->mode = EC_MASTER_MODE_ORPHANED; - - if (!cancel_delayed_work(&master->freerun_work)) { + EC_INFO("Stopping Idle mode.\n"); + master->mode = EC_MASTER_MODE_ORPHANED; // this is important for the + // IDLE work function to not + // queue itself again + + if (!cancel_delayed_work(&master->idle_work)) { flush_workqueue(master->workqueue); } @@ -719,10 +721,10 @@ /*****************************************************************************/ /** - Free-Run mode function. -*/ - -void ec_master_freerun(void *data /**< master pointer */) + Idle mode function. +*/ + +void ec_master_idle(void *data /**< master pointer */) { ec_master_t *master = (ec_master_t *) data; @@ -739,8 +741,8 @@ // release master lock spin_unlock_bh(&master->internal_lock); - if (master->mode == EC_MASTER_MODE_FREERUN) - queue_delayed_work(master->workqueue, &master->freerun_work, 1); + if (master->mode == EC_MASTER_MODE_IDLE) + queue_delayed_work(master->workqueue, &master->idle_work, 1); } /*****************************************************************************/ @@ -845,8 +847,8 @@ switch (master->mode) { case EC_MASTER_MODE_ORPHANED: return sprintf(buffer, "ORPHANED\n"); - case EC_MASTER_MODE_FREERUN: - return sprintf(buffer, "FREERUN\n"); + case EC_MASTER_MODE_IDLE: + return sprintf(buffer, "IDLE\n"); case EC_MASTER_MODE_RUNNING: return sprintf(buffer, "RUNNING\n"); } @@ -1026,7 +1028,7 @@ if (master->request_cb(master->cb_data)) goto queue_timer; } - else if (master->mode == EC_MASTER_MODE_FREERUN) { + else if (master->mode == EC_MASTER_MODE_IDLE) { spin_lock(&master->internal_lock); } else @@ -1043,7 +1045,7 @@ if (master->mode == EC_MASTER_MODE_RUNNING) { master->release_cb(master->cb_data); } - else if (master->mode == EC_MASTER_MODE_FREERUN) { + else if (master->mode == EC_MASTER_MODE_IDLE) { spin_unlock(&master->internal_lock); } diff -r 03aab3068f08 -r 45886de3db87 master/master.h --- a/master/master.h Wed Jul 19 13:08:21 2006 +0000 +++ b/master/master.h Wed Jul 19 13:15:02 2006 +0000 @@ -58,7 +58,7 @@ typedef enum { EC_MASTER_MODE_ORPHANED, - EC_MASTER_MODE_FREERUN, + EC_MASTER_MODE_IDLE, EC_MASTER_MODE_RUNNING } ec_master_mode_t; @@ -104,21 +104,22 @@ struct list_head domains; /**< list of domains */ - ec_datagram_t simple_datagram; /**< datagram structure for initialization */ + ec_datagram_t simple_datagram; /**< datagram structure for + initialization */ unsigned int timeout; /**< timeout in synchronous IO */ int debug_level; /**< master debug level */ ec_stats_t stats; /**< cyclic statistics */ struct workqueue_struct *workqueue; /**< master workqueue */ - struct work_struct freerun_work; /**< free run work object */ + struct work_struct idle_work; /**< free run work object */ ec_fsm_t fsm; /**< master state machine */ ec_master_mode_t mode; /**< master mode */ struct timer_list eoe_timer; /**< EoE timer object */ unsigned int eoe_running; /**< non-zero, if EoE processing is active. */ struct list_head eoe_handlers; /**< Ethernet-over-EtherCAT handlers */ - spinlock_t internal_lock; /**< spinlock used in freerun mode */ + spinlock_t internal_lock; /**< spinlock used in idle mode */ int (*request_cb)(void *); /**< lock request callback */ void (*release_cb)(void *); /**< lock release callback */ void *cb_data; /**< data parameter of locking callbacks */ @@ -134,8 +135,8 @@ void ec_master_reset(ec_master_t *); // free run -void ec_master_freerun_start(ec_master_t *); -void ec_master_freerun_stop(ec_master_t *); +void ec_master_idle_start(ec_master_t *); +void ec_master_idle_stop(ec_master_t *); // EoE void ec_master_eoe_start(ec_master_t *); diff -r 03aab3068f08 -r 45886de3db87 master/module.c --- a/master/module.c Wed Jul 19 13:08:21 2006 +0000 +++ b/master/module.c Wed Jul 19 13:15:02 2006 +0000 @@ -350,7 +350,7 @@ Starts the master associated with the device. This function has to be called by the network device driver to tell the master that the device is ready to send and receive data. The master - will enter the free-run mode then. + will enter the idle mode then. \ingroup DeviceInterface */ @@ -364,7 +364,7 @@ return -1; } - ec_master_freerun_start(master); + ec_master_idle_start(master); return 0; } @@ -382,7 +382,7 @@ ec_master_t *master; if (!(master = ec_find_master(master_index))) return; - ec_master_freerun_stop(master); + ec_master_idle_stop(master); if (ec_device_close(master->device)) EC_WARN("Failed to close device!\n"); @@ -424,7 +424,7 @@ goto out_release; } - ec_master_freerun_stop(master); + ec_master_idle_stop(master); ec_master_reset(master); master->mode = EC_MASTER_MODE_RUNNING; @@ -441,7 +441,7 @@ out_module_put: module_put(master->device->module); ec_master_reset(master); - ec_master_freerun_start(master); + ec_master_idle_start(master); out_release: master->reserved = 0; out_return: @@ -466,7 +466,7 @@ } ec_master_reset(master); - ec_master_freerun_start(master); + ec_master_idle_start(master); module_put(master->device->module); master->reserved = 0; diff -r 03aab3068f08 -r 45886de3db87 master/slave.c --- a/master/slave.c Wed Jul 19 13:08:21 2006 +0000 +++ b/master/slave.c Wed Jul 19 13:15:02 2006 +0000 @@ -1281,8 +1281,8 @@ return -1; } - if (slave->master->mode != EC_MASTER_MODE_FREERUN) { - EC_ERR("Writing EEPROMs only allowed in freerun mode!\n"); + if (slave->master->mode != EC_MASTER_MODE_IDLE) { + EC_ERR("Writing EEPROMs only allowed in idle mode!\n"); return -1; }