Output link state in 'ethercat master'.
authorFlorian Pose <fp@igh-essen.com>
Fri, 17 Apr 2009 12:55:55 +0000
changeset 1401 96baef8a3162
parent 1400 3c4923051e43
child 1402 4c1203ec569d
Output link state in 'ethercat master'.
NEWS
TODO
master/cdev.c
master/ioctl.h
tool/CommandMaster.cpp
--- a/NEWS	Fri Apr 17 12:41:57 2009 +0000
+++ b/NEWS	Fri Apr 17 12:55:55 2009 +0000
@@ -33,6 +33,7 @@
 * Added debug level for all masters as a module parameter. Thanks to Erwin
   Burgstaller.
 * Clear slave list on link down.
+* Output device link state in 'ethercat master'.
 
 Changes in 1.4.0:
 
--- a/TODO	Fri Apr 17 12:41:57 2009 +0000
+++ b/TODO	Fri Apr 17 12:55:55 2009 +0000
@@ -14,7 +14,6 @@
     - Delay calculation.
     - Synchronize the reference clock to the master clock.
 * Read alias from register 0x0012 instead of SII.
-* Output link state in 'ethercat master'.
 * Finish library implementation.
 * Re-work EoE code.
 * Replace locking callbacks.
--- a/master/cdev.c	Fri Apr 17 12:41:57 2009 +0000
+++ b/master/cdev.c	Fri Apr 17 12:55:55 2009 +0000
@@ -180,6 +180,7 @@
         memcpy(data.devices[0].address, master->main_mac, ETH_ALEN); 
     }
     data.devices[0].attached = master->main_device.dev ? 1 : 0;
+    data.devices[0].link_state = master->main_device.link_state ? 1 : 0;
     data.devices[0].tx_count = master->main_device.tx_count;
     data.devices[0].rx_count = master->main_device.rx_count;
 
@@ -190,6 +191,7 @@
         memcpy(data.devices[1].address, master->backup_mac, ETH_ALEN); 
     }
     data.devices[1].attached = master->backup_device.dev ? 1 : 0;
+    data.devices[1].link_state = master->backup_device.link_state ? 1 : 0;
     data.devices[1].tx_count = master->backup_device.tx_count;
     data.devices[1].rx_count = master->backup_device.rx_count;
     up(&master->device_sem);
--- a/master/ioctl.h	Fri Apr 17 12:41:57 2009 +0000
+++ b/master/ioctl.h	Fri Apr 17 12:55:55 2009 +0000
@@ -127,6 +127,7 @@
     struct {
         uint8_t address[6];
         uint8_t attached;
+        uint8_t link_state;
         uint32_t tx_count;
         uint32_t rx_count;
     } devices[2];
--- a/tool/CommandMaster.cpp	Fri Apr 17 12:41:57 2009 +0000
+++ b/tool/CommandMaster.cpp	Fri Apr 17 12:55:55 2009 +0000
@@ -107,6 +107,7 @@
                 << setw(2) << (unsigned int) data.devices[i].address[5] << " ("
                 << (data.devices[i].attached ? "attached" : "waiting...")
                 << ")" << endl << dec
+                << "    Link: " << (data.devices[i].link_state ? "UP" : "DOWN") << endl
                 << "    Tx count: " << data.devices[i].tx_count << endl
                 << "    Rx count: " << data.devices[i].rx_count;
         }