Moved configuration of Pdo mapping before Pdo assignment.
authorFlorian Pose <fp@igh-essen.com>
Mon, 07 Apr 2008 15:12:43 +0000
changeset 889 661b61ca86ed
parent 888 f0db19108bba
child 890 1115793a76ed
Moved configuration of Pdo mapping before Pdo assignment.
documentation/graphs/fsm_slave_conf.dot
master/fsm_slave_config.c
--- a/documentation/graphs/fsm_slave_conf.dot	Mon Apr 07 13:57:41 2008 +0000
+++ b/documentation/graphs/fsm_slave_conf.dot	Mon Apr 07 15:12:43 2008 +0000
@@ -53,17 +53,17 @@
     pdo_sync [fontname="Helvetica"]
     //pdo_sync -> pdo_sync
     //pdo_sync -> error
-    pdo_sync -> pdo_assign [weight=10]
+    pdo_sync -> pdo_mapping [weight=10]
+
+    pdo_mapping [fontname="Helvetica"]
+    //pdo_mapping -> pdo_mapping
+    //pdo_mapping -> error
+    pdo_mapping -> pdo_assign [weight=10]
 
     pdo_assign [fontname="Helvetica"]
     //pdo_assign -> pdo_assign
     //pdo_assign -> error
-    pdo_assign -> pdo_mapping [weight=10]
-
-    pdo_mapping [fontname="Helvetica"]
-    //pdo_mapping -> pdo_mapping
-    //pdo_mapping -> error
-    pdo_mapping -> enter_fmmu [weight=10]
+    pdo_assign -> enter_fmmu [weight=10]
 
     enter_fmmu [shape=point,label=""]
     enter_fmmu -> enter_safeop [fontname="Helvetica",label="No FMMUs\nto configure"]
--- a/master/fsm_slave_config.c	Mon Apr 07 13:57:41 2008 +0000
+++ b/master/fsm_slave_config.c	Mon Apr 07 15:12:43 2008 +0000
@@ -63,7 +63,6 @@
 void ec_fsm_slave_config_enter_preop(ec_fsm_slave_config_t *);
 void ec_fsm_slave_config_enter_sdo_conf(ec_fsm_slave_config_t *);
 void ec_fsm_slave_config_enter_pdo_sync(ec_fsm_slave_config_t *);
-void ec_fsm_slave_config_enter_pdo_assign(ec_fsm_slave_config_t *);
 void ec_fsm_slave_config_enter_fmmu(ec_fsm_slave_config_t *);
 void ec_fsm_slave_config_enter_safeop(ec_fsm_slave_config_t *);
 
@@ -568,19 +567,32 @@
         return;
     }
 
-    ec_fsm_slave_config_enter_pdo_assign(fsm);
-}
-
-/*****************************************************************************/
-
-/**
- * Check for alternate Pdo assignments to be applied.
- */
-
-void ec_fsm_slave_config_enter_pdo_assign(
+    // Start configuring Pdo mapping
+    fsm->state = ec_fsm_slave_config_state_pdo_mapping;
+    ec_fsm_pdo_mapping_start(&fsm->fsm_pdo_mapping, fsm->slave);
+    ec_fsm_pdo_mapping_exec(&fsm->fsm_pdo_mapping); // execute immediately
+}
+
+/*****************************************************************************/
+
+/**
+   Slave configuration state: PDO_MAPPING.
+*/
+
+void ec_fsm_slave_config_state_pdo_mapping(
         ec_fsm_slave_config_t *fsm /**< slave state machine */
         )
 {
+    if (ec_fsm_pdo_mapping_exec(&fsm->fsm_pdo_mapping)) return;
+
+    if (!ec_fsm_pdo_mapping_success(&fsm->fsm_pdo_mapping)) {
+        EC_ERR("Configuration of Pdo mapping failed for slave %u.\n",
+                fsm->slave->ring_position);
+        fsm->slave->error_flag = 1;
+        fsm->state = ec_fsm_slave_config_state_error;
+        return;
+    }
+
     // start applying alternate Pdo assignments
     fsm->state = ec_fsm_slave_config_state_pdo_assign;
     ec_fsm_pdo_assign_start(&fsm->fsm_pdo_assign, fsm->slave);
@@ -607,32 +619,6 @@
         return;
     }
 
-    // Start configuring Pdo mapping
-    fsm->state = ec_fsm_slave_config_state_pdo_mapping;
-    ec_fsm_pdo_mapping_start(&fsm->fsm_pdo_mapping, fsm->slave);
-    ec_fsm_pdo_mapping_exec(&fsm->fsm_pdo_mapping); // execute immediately
-}
-
-/*****************************************************************************/
-
-/**
-   Slave configuration state: PDO_MAPPING.
-*/
-
-void ec_fsm_slave_config_state_pdo_mapping(
-        ec_fsm_slave_config_t *fsm /**< slave state machine */
-        )
-{
-    if (ec_fsm_pdo_mapping_exec(&fsm->fsm_pdo_mapping)) return;
-
-    if (!ec_fsm_pdo_mapping_success(&fsm->fsm_pdo_mapping)) {
-        EC_ERR("Configuration of Pdo mapping failed for slave %u.\n",
-                fsm->slave->ring_position);
-        fsm->slave->error_flag = 1;
-        fsm->state = ec_fsm_slave_config_state_error;
-        return;
-    }
-
     ec_fsm_slave_config_enter_fmmu(fsm);
 }