Cut off category data on exceeding eeprom size limit.
authorFlorian Pose <fp@igh-essen.com>
Tue, 08 Jan 2008 15:18:30 +0000
changeset 771 9946a675f86e
parent 770 efa5af306318
child 772 6c29e74d6763
Cut off category data on exceeding eeprom size limit.
master/fsm_slave.c
--- a/master/fsm_slave.c	Fri Dec 21 16:12:30 2007 +0000
+++ b/master/fsm_slave.c	Tue Jan 08 15:18:30 2008 +0000
@@ -408,6 +408,7 @@
             EC_WARN("EEPROM size of slave %i exceeds"
                     " %u words (0xffff limiter missing?).\n",
                     slave->ring_position, EC_MAX_EEPROM_SIZE);
+            // cut off category data...
             slave->eeprom_size = EC_FIRST_EEPROM_CATEGORY_OFFSET * 2;
             goto alloc_eeprom;
         }
@@ -509,6 +510,12 @@
     slave->sii_mailbox_protocols =
         EC_READ_U16(slave->eeprom_data + 2 * 0x001C);
 
+    if (eeprom_word_size == EC_FIRST_EEPROM_CATEGORY_OFFSET) {
+        // eeprom does not contain category data
+        fsm->state = ec_fsm_slave_state_end;
+        return;
+    }
+
     if (eeprom_word_size < EC_FIRST_EEPROM_CATEGORY_OFFSET + 1) {
         EC_ERR("Unexpected end of EEPROM data in slave %u:"
                 " First category header missing.\n",