Removed additional loop in coe_down FSM; renamed mbox_type to mbox_prot.
authorFlorian Pose <fp@igh-essen.com>
Fri, 13 Oct 2006 09:05:45 +0000
changeset 391 7d67195702dd
parent 390 685c267d80d8
child 392 eaee3c8d6ae0
Removed additional loop in coe_down FSM; renamed mbox_type to mbox_prot.
master/ethernet.c
master/fsm.c
--- a/master/ethernet.c	Thu Oct 12 13:49:01 2006 +0000
+++ b/master/ethernet.c	Fri Oct 13 09:05:45 2006 +0000
@@ -362,7 +362,7 @@
 void ec_eoe_state_rx_fetch(ec_eoe_t *eoe /**< EoE handler */)
 {
     size_t rec_size, data_size;
-    uint8_t *data, frame_type, last_fragment, time_appended, mbox_type;
+    uint8_t *data, frame_type, last_fragment, time_appended, mbox_prot;
     uint8_t frame_number, fragment_offset, fragment_number;
     off_t offset;
 #if EOE_DEBUG_LEVEL > 1
@@ -376,13 +376,13 @@
     }
 
     if (!(data = ec_slave_mbox_fetch(eoe->slave, &eoe->datagram,
-                                     &mbox_type, &rec_size))) {
+                                     &mbox_prot, &rec_size))) {
         eoe->stats.rx_errors++;
         eoe->state = ec_eoe_state_tx_start;
         return;
     }
 
-    if (mbox_type != 0x02) {
+    if (mbox_prot != 0x02) { // EoE
         eoe->stats.rx_errors++;
         eoe->state = ec_eoe_state_tx_start;
         return;
--- a/master/fsm.c	Thu Oct 12 13:49:01 2006 +0000
+++ b/master/fsm.c	Fri Oct 13 09:05:45 2006 +0000
@@ -2142,7 +2142,7 @@
 {
     ec_datagram_t *datagram = &fsm->datagram;
     ec_slave_t *slave = fsm->slave;
-    uint8_t *data, mbox_type;
+    uint8_t *data, mbox_prot;
     size_t rec_size;
     ec_sdo_data_t *sdodata = fsm->sdodata;
 
@@ -2154,18 +2154,14 @@
     }
 
     if (!(data = ec_slave_mbox_fetch(slave, datagram,
-				     &mbox_type, &rec_size))) {
+				     &mbox_prot, &rec_size))) {
         fsm->coe_state = ec_fsm_error;
         return;
     }
 
-    if (mbox_type != 0x03) {
-        EC_WARN("Received mailbox protocol 0x%02X as a response."
-	      " Trying again.\n", mbox_type);
-        fsm->coe_start = get_cycles();
-        ec_slave_mbox_prepare_check(slave, datagram); // can not fail.
-	ec_master_queue_datagram(fsm->master, datagram);
-	fsm->coe_state = ec_fsm_coe_down_check;
+    if (mbox_prot != 0x03) { // CoE
+        EC_WARN("Received mailbox protocol 0x%02X as response.\n", mbox_prot);
+        fsm->coe_state = ec_fsm_error;
 	return;
     }