Fixed bug with ec_master_eoe_start() does new coupling all the time.
authorFlorian Pose <fp@igh-essen.com>
Thu, 03 Aug 2006 16:14:26 +0000
changeset 326 ddb48b173680
parent 325 7833cf70c4f2
child 327 9668891c1924
Fixed bug with ec_master_eoe_start() does new coupling all the time.
master/master.c
master/master.h
--- a/master/master.c	Thu Aug 03 12:51:17 2006 +0000
+++ b/master/master.c	Thu Aug 03 16:14:26 2006 +0000
@@ -121,6 +121,7 @@
     master->eoe_timer.data = (unsigned long) master;
     master->internal_lock = SPIN_LOCK_UNLOCKED;
     master->eoe_running = 0;
+    master->eoe_checked = 0;
 
     // create workqueue
     if (!(master->workqueue = create_singlethread_workqueue("EtherCAT"))) {
@@ -773,7 +774,7 @@
 /*****************************************************************************/
 
 /**
-   Starts/Stops Ethernet-over-EtherCAT processing on demand.
+   Starts Ethernet-over-EtherCAT processing on demand.
 */
 
 void ec_master_eoe_start(ec_master_t *master /**< EtherCAT master */)
@@ -782,12 +783,17 @@
     ec_slave_t *slave;
     unsigned int coupled, found;
 
-    if (master->eoe_running) return;
+    if (master->eoe_running || master->eoe_checked) return;
+
+    master->eoe_checked = 1;
 
     // if the locking callbacks are not set in operation mode,
     // the EoE timer my not be started.
     if (master->mode == EC_MASTER_MODE_OPERATION
-        && (!master->request_cb || !master->release_cb)) return;
+        && (!master->request_cb || !master->release_cb)) {
+        EC_INFO("No EoE processing because of missing locking callbacks.\n");
+        return;
+    }
 
     // decouple all EoE handlers
     list_for_each_entry(eoe, &master->eoe_handlers, list)
@@ -843,6 +849,8 @@
 {
     ec_eoe_t *eoe;
 
+    master->eoe_checked = 0;
+
     if (!master->eoe_running) return;
 
     EC_INFO("Stopping EoE processing.\n");
--- a/master/master.h	Thu Aug 03 12:51:17 2006 +0000
+++ b/master/master.h	Thu Aug 03 16:14:26 2006 +0000
@@ -114,6 +114,8 @@
 
     struct timer_list eoe_timer; /**< EoE timer object */
     unsigned int eoe_running; /**< non-zero, if EoE processing is active. */
+    unsigned int eoe_checked; /**< non-zero, if EoE processing is not
+                                 necessary. */
     struct list_head eoe_handlers; /**< Ethernet-over-EtherCAT handlers */
     spinlock_t internal_lock; /**< spinlock used in idle mode */
     int (*request_cb)(void *); /**< lock request callback */