Improved multi-master capabilities of ethercat tool.
authorFlorian Pose <fp@igh-essen.com>
Wed, 24 Feb 2010 17:24:20 +0100
changeset 1827 489be2180f71
parent 1826 ec6223c3b7ec
child 1828 651e9cfb244b
Improved multi-master capabilities of ethercat tool.
TODO
tool/CommandCStruct.cpp
tool/CommandConfig.cpp
tool/CommandData.cpp
tool/CommandDomains.cpp
tool/CommandEoe.cpp
tool/CommandPdos.cpp
tool/CommandSdos.cpp
tool/CommandSlaves.cpp
--- a/TODO	Wed Feb 24 16:27:11 2010 +0100
+++ b/TODO	Wed Feb 24 17:24:20 2010 +0100
@@ -28,6 +28,9 @@
 * Output hexadecimal values in 'ethercat xml'.
 * Add native drivers from 2.6.24 up to 2.6.31.
 * Reset al_states on link down.
+* Implement indent in 'ethercat ma'
+* Add master index to log messages.
+* Implement 0xXXXX:YY format for specifying SDOs.
 
 Future issues:
 
--- a/tool/CommandCStruct.cpp	Wed Feb 24 16:27:11 2010 +0100
+++ b/tool/CommandCStruct.cpp	Wed Feb 24 17:24:20 2010 +0100
@@ -165,7 +165,7 @@
     }
 
     cout
-        << "/* Slave " << slave.position;
+        << "/* Master " << m.getIndex() << ", Slave " << slave.position;
     if (strlen(slave.order)) {
         cout << ", \"" << slave.order << "\"";
     }
--- a/tool/CommandConfig.cpp	Wed Feb 24 16:27:11 2010 +0100
+++ b/tool/CommandConfig.cpp	Wed Feb 24 17:24:20 2010 +0100
@@ -121,8 +121,8 @@
         m.open(MasterDevice::Read);
         configs = selectedConfigs(m);
 
-        if (doIndent) {
-            cout << "Master" << dec << *mi << endl;
+        if (configs.size() && doIndent) {
+            cout << "Master" << dec << m.getIndex() << endl;
         }
 
         if (getVerbosity() == Verbose) {
--- a/tool/CommandData.cpp	Wed Feb 24 16:27:11 2010 +0100
+++ b/tool/CommandData.cpp	Wed Feb 24 17:24:20 2010 +0100
@@ -75,17 +75,16 @@
         throwInvalidUsageException(err);
     }
 
-    if (getMasterIndices().size() != 1) {
-        stringstream err;
-        err << getName() << " requires to select a single master!";
-        throwInvalidUsageException(err);
-    }
-    MasterDevice m(getMasterIndices().front());
-    m.open(MasterDevice::Read);
-    domains = selectedDomains(m);
+    MasterIndexList::const_iterator mi;
+    for (mi = getMasterIndices().begin();
+            mi != getMasterIndices().end(); mi++) {
+        MasterDevice m(*mi);
+        m.open(MasterDevice::Read);
+        domains = selectedDomains(m);
 
-    for (di = domains.begin(); di != domains.end(); di++) {
-        outputDomainData(m, *di);
+        for (di = domains.begin(); di != domains.end(); di++) {
+            outputDomainData(m, *di);
+        }
     }
 }
 
--- a/tool/CommandDomains.cpp	Wed Feb 24 16:27:11 2010 +0100
+++ b/tool/CommandDomains.cpp	Wed Feb 24 17:24:20 2010 +0100
@@ -110,7 +110,7 @@
         m.open(MasterDevice::Read);
         domains = selectedDomains(m);
 
-        if (doIndent) {
+        if (domains.size() && doIndent) {
             cout << "Master" << dec << *mi << endl;
         }
 
--- a/tool/CommandEoe.cpp	Wed Feb 24 16:27:11 2010 +0100
+++ b/tool/CommandEoe.cpp	Wed Feb 24 17:24:20 2010 +0100
@@ -84,15 +84,17 @@
         m.open(MasterDevice::Read);
         m.getMaster(&master);
 
-        if (doIndent) {
-            cout << "Master" << dec << *mi << endl;
+        if (master.eoe_handler_count) {
+            if (doIndent) {
+                cout << "Master" << dec << *mi << endl;
+            }
+
+            cout << indent << "Interface  Slave  State  "
+                << "RxBytes  RxRate  "
+                << "TxBytes  TxRate  TxQueue"
+                << endl;
         }
 
-        cout << indent << "Interface  Slave  State  "
-            << "RxBytes  RxRate  "
-            << "TxBytes  TxRate  TxQueue"
-            << endl;
-
         for (i = 0; i < master.eoe_handler_count; i++) {
             stringstream queue;
 
--- a/tool/CommandPdos.cpp	Wed Feb 24 16:27:11 2010 +0100
+++ b/tool/CommandPdos.cpp	Wed Feb 24 17:24:20 2010 +0100
@@ -129,7 +129,7 @@
     ec_ioctl_slave_sync_pdo_entry_t entry;
     unsigned int i, j, k;
     
-    if (showHeader)
+    if (showHeader && slave.sync_count)
         cout << "=== Master " << m.getIndex()
             << ", Slave " << slave.position << " ===" << endl;
 
--- a/tool/CommandSdos.cpp	Wed Feb 24 16:27:11 2010 +0100
+++ b/tool/CommandSdos.cpp	Wed Feb 24 17:24:20 2010 +0100
@@ -127,7 +127,7 @@
     unsigned int i, j;
     const DataType *d;
     
-    if (showHeader)
+    if (showHeader && slave.sdo_count)
         cout << "=== Master " << m.getIndex()
             << ", Slave " << slave.position << " ===" << endl;
 
--- a/tool/CommandSlaves.cpp	Wed Feb 24 16:27:11 2010 +0100
+++ b/tool/CommandSlaves.cpp	Wed Feb 24 17:24:20 2010 +0100
@@ -125,10 +125,6 @@
         m.open(MasterDevice::Read);
         slaves = selectedSlaves(m);
 
-        if (doIndent) {
-            cout << "Master" << dec << *mi << endl;
-        }
-
         if (getVerbosity() == Verbose) {
             showSlaves(m, slaves);
         } else {
@@ -213,6 +209,10 @@
         aliasIndex++;
     }
 
+    if (infoList.size() && doIndent) {
+        cout << "Master" << dec << m.getIndex() << endl;
+    }
+
     for (iter = infoList.begin(); iter != infoList.end(); iter++) {
         cout << indent << setfill(' ') << right
             << setw(maxPosWidth) << iter->pos << "  "