Partial WC output in domains command. redundancy
authorFlorian Pose <fp@igh-essen.com>
Fri, 16 Mar 2012 18:44:59 +0100
branchredundancy
changeset 2369 2536d60dea6e
parent 2368 dd84ef164869
child 2370 18e1e8b30ff7
Partial WC output in domains command.
master/cdev.c
master/ioctl.h
tool/CommandDomains.cpp
--- a/master/cdev.c	Fri Mar 16 18:24:29 2012 +0100
+++ b/master/cdev.c	Fri Mar 16 18:44:59 2012 +0100
@@ -537,6 +537,7 @@
 {
     ec_ioctl_domain_t data;
     const ec_domain_t *domain;
+    unsigned int dev_idx;
 
     if (copy_from_user(&data, (void __user *) arg, sizeof(data))) {
         return -EFAULT;
@@ -553,9 +554,9 @@
 
     data.data_size = domain->data_size;
     data.logical_base_address = domain->logical_base_address;
-    data.working_counter =
-        domain->working_counter[EC_DEVICE_MAIN]
-        + domain->working_counter[EC_DEVICE_BACKUP];
+    for (dev_idx = 0; dev_idx < EC_NUM_DEVICES; dev_idx++) {
+        data.working_counter[dev_idx] = domain->working_counter[dev_idx];
+    }
     data.expected_working_counter = domain->expected_working_counter;
     data.fmmu_count = ec_domain_fmmu_count(domain);
 
--- a/master/ioctl.h	Fri Mar 16 18:24:29 2012 +0100
+++ b/master/ioctl.h	Fri Mar 16 18:44:59 2012 +0100
@@ -56,7 +56,7 @@
  *
  * Increment this when changing the ioctl interface!
  */
-#define EC_IOCTL_VERSION_MAGIC 14
+#define EC_IOCTL_VERSION_MAGIC 15
 
 // Command-line tool
 #define EC_IOCTL_MODULE                EC_IOR(0x00, ec_ioctl_module_t)
@@ -290,7 +290,7 @@
     // outputs
     uint32_t data_size;
     uint32_t logical_base_address;
-    uint16_t working_counter;
+    uint16_t working_counter[EC_NUM_DEVICES];
     uint16_t expected_working_counter;
     uint32_t fmmu_count;
 } ec_ioctl_domain_t;
--- a/tool/CommandDomains.cpp	Fri Mar 16 18:24:29 2012 +0100
+++ b/tool/CommandDomains.cpp	Fri Mar 16 18:44:59 2012 +0100
@@ -136,6 +136,11 @@
     ec_ioctl_domain_fmmu_t fmmu;
     unsigned int dataOffset;
     string indent(doIndent ? "  " : "");
+    unsigned int wc_sum = 0, dev_idx;
+
+    for (dev_idx = 0; dev_idx < EC_NUM_DEVICES; dev_idx++) {
+        wc_sum += domain.working_counter[dev_idx];
+    }
 
     cout << indent << "Domain" << dec << domain.index << ":"
         << " LogBaseAddr 0x"
@@ -144,8 +149,14 @@
         << ", Size " << dec << setfill(' ')
         << setw(3) << domain.data_size
         << ", WorkingCounter "
-        << domain.working_counter << "/"
-        << domain.expected_working_counter << endl;
+        << wc_sum << "/"
+        << domain.expected_working_counter;
+    if (EC_NUM_DEVICES == 2) {
+        cout << " (" << domain.working_counter[EC_DEVICE_MAIN]
+            << "+" << domain.working_counter[EC_DEVICE_BACKUP]
+            << ")";
+    }
+    cout << endl;
 
     if (!domain.data_size || getVerbosity() != Verbose)
         return;