From e1c59c7c96490fe9f8b401afde84d1fa3e07d03c Mon Sep 17 00:00:00 2001 From: Florian Pose Date: Fri, 16 Mar 2012 18:44:59 +0100 Subject: [PATCH] Partial WC output in domains command. --- master/cdev.c | 7 ++++--- master/ioctl.h | 4 ++-- tool/CommandDomains.cpp | 15 +++++++++++++-- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/master/cdev.c b/master/cdev.c index 2cb583a9..a3418eee 100644 --- a/master/cdev.c +++ b/master/cdev.c @@ -537,6 +537,7 @@ int ec_cdev_ioctl_domain( { 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 @@ int ec_cdev_ioctl_domain( 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); diff --git a/master/ioctl.h b/master/ioctl.h index d2e142b8..aa01a35b 100644 --- a/master/ioctl.h +++ b/master/ioctl.h @@ -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 @@ typedef struct { // 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; diff --git a/tool/CommandDomains.cpp b/tool/CommandDomains.cpp index 1ebece6c..e8e25e5d 100644 --- a/tool/CommandDomains.cpp +++ b/tool/CommandDomains.cpp @@ -136,6 +136,11 @@ void CommandDomains::showDomain( 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 @@ void CommandDomains::showDomain( << ", 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;