Fetch Sdo dictionaries and process SII requests in operation mode.
authorFlorian Pose <fp@igh-essen.com>
Fri, 25 Apr 2008 14:58:33 +0000
changeset 910 9fd31755f576
parent 909 3b3087d4cdc5
child 911 17c3b3aafbb9
Fetch Sdo dictionaries and process SII requests in operation mode.
NEWS
TODO
master/fsm_master.c
--- a/NEWS	Fri Apr 25 14:38:11 2008 +0000
+++ b/NEWS	Fri Apr 25 14:58:33 2008 +0000
@@ -50,6 +50,8 @@
       function.
     - Removed the bus_state and bus_tainted flags from ec_master_state_t.
 * Removed include/ecdb.h.
+* Sdo dictionaries will now also be fetched in operation mode.
+* SII write requests will now also be processed in operation mode.
 * Mapping of Pdo entries is now supported.
 * Current Pdo assignment/mapping is now read via CoE during bus scan, using
   direct Sdo access, independent of the dictionary.
--- a/TODO	Fri Apr 25 14:38:11 2008 +0000
+++ b/TODO	Fri Apr 25 14:58:33 2008 +0000
@@ -16,7 +16,6 @@
 * Mailbox protocol handlers.
 * Remove get_cycles() calls and references to cpu_khz to increase
   portability.
-* Scanning of Sdo dictionary / writing EEPROM in OPERATION state.
 * Remove the end state of the master state machine.
 * SDO write access in sysfs.
 * Update documentation.
--- a/master/fsm_master.c	Fri Apr 25 14:38:11 2008 +0000
+++ b/master/fsm_master.c	Fri Apr 25 14:58:33 2008 +0000
@@ -444,36 +444,33 @@
     if (ec_fsm_master_action_process_sdo(fsm))
         return;
 
-    if (master->mode == EC_MASTER_MODE_IDLE) {
-
-        // check, if slaves have an Sdo dictionary to read out.
-        list_for_each_entry(slave, &master->slaves, list) {
-            if (!(slave->sii.mailbox_protocols & EC_MBOX_COE)
+    // check, if slaves have an Sdo dictionary to read out.
+    list_for_each_entry(slave, &master->slaves, list) {
+        if (!(slave->sii.mailbox_protocols & EC_MBOX_COE)
                 || slave->sdo_dictionary_fetched
                 || slave->current_state == EC_SLAVE_STATE_INIT
                 || jiffies - slave->jiffies_preop < EC_WAIT_SDO_DICT * HZ
                 || slave->error_flag) continue;
 
-            if (master->debug_level) {
-                EC_DBG("Fetching Sdo dictionary from slave %u.\n",
-                       slave->ring_position);
-            }
-
-            slave->sdo_dictionary_fetched = 1;
-
-            // start fetching Sdo dictionary
-            fsm->idle = 0;
-            fsm->slave = slave;
-            fsm->state = ec_fsm_master_state_sdo_dictionary;
-            ec_fsm_coe_dictionary(&fsm->fsm_coe, slave);
-            ec_fsm_coe_exec(&fsm->fsm_coe); // execute immediately
-            return;
+        if (master->debug_level) {
+            EC_DBG("Fetching Sdo dictionary from slave %u.\n",
+                    slave->ring_position);
         }
 
-        // check for pending SII write operations.
-        if (ec_fsm_master_action_process_sii(fsm))
-            return; // SII write request found
-    }
+        slave->sdo_dictionary_fetched = 1;
+
+        // start fetching Sdo dictionary
+        fsm->idle = 0;
+        fsm->slave = slave;
+        fsm->state = ec_fsm_master_state_sdo_dictionary;
+        ec_fsm_coe_dictionary(&fsm->fsm_coe, slave);
+        ec_fsm_coe_exec(&fsm->fsm_coe); // execute immediately
+        return;
+    }
+
+    // check for pending SII write operations.
+    if (ec_fsm_master_action_process_sii(fsm))
+        return; // SII write request found
 
     fsm->state = ec_fsm_master_state_end;
 }
@@ -842,7 +839,7 @@
     if (master->debug_level) {
         unsigned int sdo_count, entry_count;
         ec_slave_sdo_dict_info(slave, &sdo_count, &entry_count);
-        EC_DBG("Fetched %i Sdos and %i entries from slave %i.\n",
+        EC_DBG("Fetched %u Sdos and %u entries from slave %u.\n",
                sdo_count, entry_count, slave->ring_position);
     }