Now fetching port physical layer from EEPROM
authorFlorian Pose <fp@igh-essen.com>
Tue, 11 Apr 2006 14:39:17 +0000
changeset 190 4e32bcc6b361
parent 189 aabbfdacc2cc
child 191 ca805255a935
Now fetching port physical layer from EEPROM
master/slave.c
master/slave.h
--- a/master/slave.c	Tue Apr 11 14:38:34 2006 +0000
+++ b/master/slave.c	Tue Apr 11 14:39:17 2006 +0000
@@ -124,6 +124,7 @@
         slave->dl_link[i] = 0;
         slave->dl_loop[i] = 0;
         slave->dl_signal[i] = 0;
+        slave->sii_physical_layer[i] = 0xFF;
     }
 
     return 0;
@@ -619,6 +620,8 @@
                            const uint8_t *data /**< Kategorie-Daten */
                            )
 {
+    unsigned int i;
+
     if (ec_slave_locate_string(slave, data[0], &slave->eeprom_group))
         return -1;
     if (ec_slave_locate_string(slave, data[1], &slave->eeprom_name))
@@ -626,6 +629,9 @@
     if (ec_slave_locate_string(slave, data[3], &slave->eeprom_desc))
         return -1;
 
+    for (i = 0; i < 4; i++)
+        slave->sii_physical_layer[i] = (data[4] & (0x03 << (i * 2))) >> (i * 2);
+
     return 0;
 }
 
@@ -1011,7 +1017,22 @@
 
     EC_INFO("  Data link status:\n");
     for (i = 0; i < 4; i++) {
-        EC_INFO("    Port %i: link %s, loop %s, %s\n", i,
+        EC_INFO("    Port %i (", i);
+        switch (slave->sii_physical_layer[i]) {
+            case 0x00:
+                printk("EBUS");
+                break;
+            case 0x01:
+                printk("100BASE-TX");
+                break;
+            case 0x02:
+                printk("100BASE-FX");
+                break;
+            default:
+                printk("unknown");
+        }
+        printk(")\n");
+        EC_INFO("      link %s, loop %s, %s\n",
                 slave->dl_link[i] ? "up" : "down",
                 slave->dl_loop[i] ? "closed" : "open",
                 slave->dl_signal[i] ? "signal detected" : "no signal");
--- a/master/slave.h	Tue Apr 11 14:38:34 2006 +0000
+++ b/master/slave.h	Tue Apr 11 14:39:17 2006 +0000
@@ -222,6 +222,7 @@
     uint16_t sii_tx_mailbox_offset; /**< Adresse der Mailbox (Slave->Master) */
     uint16_t sii_tx_mailbox_size; /**< Adresse der Mailbox (Slave->Master) */
     uint16_t sii_mailbox_protocols; /**< Unterstützte Mailbox-Protokolle */
+    uint8_t sii_physical_layer[4]; /**< Uebertragungsarten der Ports */
 
     const ec_slave_type_t *type; /**< Zeiger auf die Beschreibung
                                     des Slave-Typs */