Removed EC_IOCTL_DOMAIN_COUNT.
--- a/TODO Thu Jun 12 09:32:25 2008 +0000
+++ b/TODO Thu Jun 12 09:44:18 2008 +0000
@@ -23,7 +23,6 @@
* Make scanning and configuration run parallel (each).
* List of commands that require a slave.
* Remove configs_attached flag.
-* Remove EC_IOCTL_DOMAIN_COUNT.
* Rename master MODE to STATE.
Future issues:
--- a/master/cdev.c Thu Jun 12 09:32:25 2008 +0000
+++ b/master/cdev.c Thu Jun 12 09:44:18 2008 +0000
@@ -149,6 +149,7 @@
data.slave_count = master->slave_count;
data.config_count = ec_master_config_count(master);
+ data.domain_count = ec_master_domain_count(master);
data.mode = (uint8_t) master->mode;
memcpy(data.devices[0].address, master->main_mac, ETH_ALEN);
@@ -368,10 +369,6 @@
break;
}
- case EC_IOCTL_DOMAIN_COUNT:
- retval = ec_master_domain_count(master);
- break;
-
case EC_IOCTL_DOMAIN:
{
ec_ioctl_domain_t data;
--- a/master/ioctl.h Thu Jun 12 09:32:25 2008 +0000
+++ b/master/ioctl.h Thu Jun 12 09:44:18 2008 +0000
@@ -59,20 +59,19 @@
#define EC_IOCTL_SYNC EC_IOWR(0x02, ec_ioctl_sync_t)
#define EC_IOCTL_PDO EC_IOWR(0x03, ec_ioctl_pdo_t)
#define EC_IOCTL_PDO_ENTRY EC_IOWR(0x04, ec_ioctl_pdo_entry_t)
-#define EC_IOCTL_DOMAIN_COUNT EC_IO(0x05)
-#define EC_IOCTL_DOMAIN EC_IOWR(0x06, ec_ioctl_domain_t)
-#define EC_IOCTL_DOMAIN_FMMU EC_IOWR(0x07, ec_ioctl_domain_fmmu_t)
-#define EC_IOCTL_DATA EC_IOWR(0x08, ec_ioctl_data_t)
-#define EC_IOCTL_SET_DEBUG EC_IO(0x09)
-#define EC_IOCTL_SLAVE_STATE EC_IOW(0x0a, ec_ioctl_slave_state_t)
-#define EC_IOCTL_SDO EC_IOWR(0x0b, ec_ioctl_sdo_t)
-#define EC_IOCTL_SDO_ENTRY EC_IOWR(0x0c, ec_ioctl_sdo_entry_t)
-#define EC_IOCTL_SDO_UPLOAD EC_IOWR(0x0d, ec_ioctl_sdo_upload_t)
-#define EC_IOCTL_SDO_DOWNLOAD EC_IOW(0x0e, ec_ioctl_sdo_download_t)
-#define EC_IOCTL_SII_READ EC_IOWR(0x0f, ec_ioctl_sii_t)
-#define EC_IOCTL_SII_WRITE EC_IOW(0x10, ec_ioctl_sii_t)
-#define EC_IOCTL_CONFIG EC_IOWR(0x11, ec_ioctl_config_t)
-#define EC_IOCTL_CONFIG_PDO EC_IOWR(0x12, ec_ioctl_config_pdo_t)
+#define EC_IOCTL_DOMAIN EC_IOWR(0x05, ec_ioctl_domain_t)
+#define EC_IOCTL_DOMAIN_FMMU EC_IOWR(0x06, ec_ioctl_domain_fmmu_t)
+#define EC_IOCTL_DATA EC_IOWR(0x07, ec_ioctl_data_t)
+#define EC_IOCTL_SET_DEBUG EC_IO(0x08)
+#define EC_IOCTL_SLAVE_STATE EC_IOW(0x09, ec_ioctl_slave_state_t)
+#define EC_IOCTL_SDO EC_IOWR(0x0a, ec_ioctl_sdo_t)
+#define EC_IOCTL_SDO_ENTRY EC_IOWR(0x0b, ec_ioctl_sdo_entry_t)
+#define EC_IOCTL_SDO_UPLOAD EC_IOWR(0x0c, ec_ioctl_sdo_upload_t)
+#define EC_IOCTL_SDO_DOWNLOAD EC_IOW(0x0d, ec_ioctl_sdo_download_t)
+#define EC_IOCTL_SII_READ EC_IOWR(0x0e, ec_ioctl_sii_t)
+#define EC_IOCTL_SII_WRITE EC_IOW(0x0f, ec_ioctl_sii_t)
+#define EC_IOCTL_CONFIG EC_IOWR(0x10, ec_ioctl_config_t)
+#define EC_IOCTL_CONFIG_PDO EC_IOWR(0x11, ec_ioctl_config_pdo_t)
#define EC_IOCTL_CONFIG_PDO_ENTRY EC_IOWR(0x12, ec_ioctl_config_pdo_entry_t)
#define EC_IOCTL_CONFIG_SDO EC_IOWR(0x13, ec_ioctl_config_sdo_t)
@@ -83,6 +82,7 @@
typedef struct {
uint32_t slave_count;
uint32_t config_count;
+ uint32_t domain_count;
uint8_t mode;
struct {
uint8_t address[6];
--- a/tools/Master.cpp Thu Jun 12 09:32:25 2008 +0000
+++ b/tools/Master.cpp Thu Jun 12 09:44:18 2008 +0000
@@ -266,9 +266,12 @@
open(Read);
if (domainIndex == -1) {
- unsigned int numDomains = domainCount(), i;
-
- for (i = 0; i < numDomains; i++) {
+ unsigned int i;
+ ec_ioctl_master_t master;
+
+ getMaster(&master);
+
+ for (i = 0; i < master.domain_count; i++) {
outputDomainData(i);
}
} else {
@@ -314,9 +317,12 @@
open(Read);
if (domainIndex == -1) {
- unsigned int numDomains = domainCount(), i;
-
- for (i = 0; i < numDomains; i++) {
+ unsigned int i;
+ ec_ioctl_master_t master;
+
+ getMaster(&master);
+
+ for (i = 0; i < master.domain_count; i++) {
showDomain(i);
}
} else {
@@ -1498,21 +1504,6 @@
/****************************************************************************/
-unsigned int Master::domainCount()
-{
- int ret;
-
- if ((ret = ioctl(fd, EC_IOCTL_DOMAIN_COUNT, 0)) < 0) {
- stringstream err;
- err << "Failed to get number of domains: " << strerror(errno);
- throw MasterException(err.str());
- }
-
- return ret;
-}
-
-/****************************************************************************/
-
unsigned int Master::slaveCount()
{
ec_ioctl_master_t data;
--- a/tools/Master.h Thu Jun 12 09:32:25 2008 +0000
+++ b/tools/Master.h Thu Jun 12 09:44:18 2008 +0000
@@ -70,7 +70,6 @@
void listSlaveSdos(uint16_t, bool = false, bool = false);
void showSlave(uint16_t);
void generateSlaveXml(uint16_t);
- unsigned int domainCount();
unsigned int slaveCount();
void getMaster(ec_ioctl_master_t *);
void getConfig(ec_ioctl_config_t *, unsigned int);