Removed configs_attached flag; changed return value of
authorFlorian Pose <fp@igh-essen.com>
Wed, 18 Jun 2008 12:49:11 +0000
changeset 1028 afdd4bdbb7ec
parent 1027 9d37c6d3c80b
child 1029 61ffe5f22306
Removed configs_attached flag; changed return value of
ec_master_attach_slave_configs() to void.
TODO
master/fsm_master.c
master/master.c
master/master.h
--- a/TODO	Wed Jun 18 11:24:31 2008 +0000
+++ b/TODO	Wed Jun 18 12:49:11 2008 +0000
@@ -16,8 +16,6 @@
 * Update documentation.
 * Check for sizes of uploaded Sdos when reading mapping from CoE.
 * Attach Pdo names from SII or Coe dictioary to Pdos read via CoE.
-* List of commands that require a slave.
-* Remove configs_attached flag.
 * Rename master MODE to STATE.
 * Remove the end state of the master state machine.
 * Add a -n (numeric) switch to ethercat command.
--- a/master/fsm_master.c	Wed Jun 18 11:24:31 2008 +0000
+++ b/master/fsm_master.c	Wed Jun 18 12:49:11 2008 +0000
@@ -233,7 +233,6 @@
             ec_master_clear_eoe_handlers(master);
 #endif
             ec_master_clear_slaves(master);
-            master->configs_attached = 0;
 
             master->slave_count = fsm->slaves_responding;
 
--- a/master/master.c	Wed Jun 18 11:24:31 2008 +0000
+++ b/master/master.c	Wed Jun 18 12:49:11 2008 +0000
@@ -1014,37 +1014,24 @@
 {
     ec_slave_config_t *sc;
 
-    if (!master->configs_attached)
-        return;
-
     list_for_each_entry(sc, &master->configs, list) {
         ec_slave_config_detach(sc); 
     }
-
-    master->configs_attached = 0;
 }
 
 /*****************************************************************************/
 
 /** Attaches the slave configurations to the slaves.
  */
-int ec_master_attach_slave_configs(
+void ec_master_attach_slave_configs(
         ec_master_t *master /**< EtherCAT master. */
         )
 {
     ec_slave_config_t *sc;
-    unsigned int errors = 0;
-
-    if (master->configs_attached)
-        return 0;
 
     list_for_each_entry(sc, &master->configs, list) {
-        if (ec_slave_config_attach(sc))
-            errors = 1;
-    }
-
-    master->configs_attached = !errors;
-    return errors ? -1 : 0;
+        ec_slave_config_attach(sc);
+    }
 }
 
 /*****************************************************************************/
--- a/master/master.h	Wed Jun 18 11:24:31 2008 +0000
+++ b/master/master.h	Wed Jun 18 12:49:11 2008 +0000
@@ -103,8 +103,7 @@
     ec_slave_t *slaves; /**< Array of slaves on the bus. */
     unsigned int slave_count; /**< Number of slaves on the bus. */
 
-    struct list_head configs; /**< Bus configuration list. */
-    unsigned int configs_attached; /**< Slave configurations were attached. */
+    struct list_head configs; /**< List of slave configurations. */
     
     unsigned int scan_busy; /**< Current scan state. */
     unsigned int allow_scan; /**< non-zero, if slave scanning is allowed */
@@ -188,7 +187,7 @@
 void ec_master_queue_datagram(ec_master_t *, ec_datagram_t *);
 
 // misc.
-int ec_master_attach_slave_configs(ec_master_t *);
+void ec_master_attach_slave_configs(ec_master_t *);
 ec_slave_t *ec_master_find_slave(ec_master_t *, uint16_t, uint16_t);
 void ec_master_output_stats(ec_master_t *);
 #ifdef EC_EOE