--- a/master/fsm_pdo_config.c Wed Feb 27 15:24:00 2008 +0000
+++ b/master/fsm_pdo_config.c Thu Feb 28 10:58:43 2008 +0000
@@ -189,6 +189,16 @@
return;
}
+ // Pdo configuration has to be changed. Does the slave support this?
+ if (fsm->slave->sii.mailbox_protocols & EC_MBOX_COE
+ || (fsm->slave->sii.has_general
+ && !fsm->slave->sii.coe_details.enable_pdo_configuration)) {
+ EC_ERR("Slave %u does not support changing the Pdo configuration!\n",
+ fsm->slave->ring_position);
+ fsm->state = ec_fsm_pdo_config_state_error;
+ return;
+ }
+
if (fsm->slave->master->debug_level) {
EC_DBG("Changing configuration of Pdo 0x%04X of slave %u.\n",
fsm->pdo->index, fsm->slave->ring_position);
--- a/master/fsm_pdo_mapping.c Wed Feb 27 15:24:00 2008 +0000
+++ b/master/fsm_pdo_mapping.c Thu Feb 28 10:58:43 2008 +0000
@@ -180,6 +180,16 @@
if (ec_pdo_mapping_equal(&fsm->sync->mapping, fsm->mapping))
continue;
+ // Pdo mapping has to be changed. Does the slave support this?
+ if (!fsm->slave->sii.mailbox_protocols & EC_MBOX_COE
+ || (fsm->slave->sii.has_general
+ && !fsm->slave->sii.coe_details.enable_pdo_assign)) {
+ EC_ERR("Slave %u does not support changing the Pdo mapping!\n",
+ fsm->slave->ring_position);
+ fsm->state = ec_fsm_pdo_mapping_state_error;
+ return;
+ }
+
if (fsm->slave->master->debug_level) {
EC_DBG("Changing Pdo mapping for SM%u of slave %u.\n",
fsm->sync->index, fsm->slave->ring_position);
--- a/master/slave.c Wed Feb 27 15:24:00 2008 +0000
+++ b/master/slave.c Thu Feb 28 10:58:43 2008 +0000
@@ -140,17 +140,23 @@
slave->sii.tx_mailbox_offset = 0;
slave->sii.tx_mailbox_size = 0;
slave->sii.mailbox_protocols = 0;
+
+ slave->sii.strings = NULL;
+ slave->sii.string_count = 0;
+
+ slave->sii.has_general = 0;
slave->sii.group = NULL;
slave->sii.image = NULL;
slave->sii.order = NULL;
slave->sii.name = NULL;
+ memset(&slave->sii.coe_details, 0x00, sizeof(ec_sii_coe_details_t));
slave->sii.current_on_ebus = 0;
- slave->sii.strings = NULL;
- slave->sii.string_count = 0;
slave->sii.syncs = NULL;
slave->sii.sync_count = 0;
+
INIT_LIST_HEAD(&slave->sii.pdos);
+
INIT_LIST_HEAD(&slave->sdo_dictionary);
slave->sdo_dictionary_fetched = 0;
@@ -434,8 +440,9 @@
slave->sii.physical_layer[i] =
(data[4] & (0x03 << (i * 2))) >> (i * 2);
+ memcpy(&slave->sii.coe_details, data + 5, 1);
slave->sii.current_on_ebus = EC_READ_S16(data + 0x0C);
-
+ slave->sii.has_general = 1;
return 0;
}
@@ -701,11 +708,7 @@
buf += sprintf(buf, "\n\n");
}
- buf += sprintf(buf, "Current consumption: %i mA\n\n",
- slave->sii.current_on_ebus);
-
- if (slave->sii.group || slave->sii.image || slave->sii.order
- || slave->sii.name) {
+ if (slave->sii.has_general) {
buf += sprintf(buf, "General:\n");
if (slave->sii.group)
@@ -717,7 +720,27 @@
slave->sii.order);
if (slave->sii.name)
buf += sprintf(buf, " Name: %s\n", slave->sii.name);
- buf += sprintf(buf, "\n");
+ if (slave->sii.mailbox_protocols & EC_MBOX_COE) {
+ buf += sprintf(buf, " CoE details:\n");
+ buf += sprintf(buf, " Enable Sdo: %s\n",
+ slave->sii.coe_details.enable_sdo ? "yes" : "no");
+ buf += sprintf(buf, " Enable Sdo Info: %s\n",
+ slave->sii.coe_details.enable_sdo_info ? "yes" : "no");
+ buf += sprintf(buf, " Enable Pdo Assign: %s\n",
+ slave->sii.coe_details.enable_pdo_assign ? "yes" : "no");
+ buf += sprintf(buf, " Enable Pdo Configuration: %s\n",
+ slave->sii.coe_details.enable_pdo_configuration ?
+ "yes" : "no");
+ buf += sprintf(buf, " Enable Upload at startup: %s\n",
+ slave->sii.coe_details.enable_upload_at_startup ?
+ "yes" : "no");
+ buf += sprintf(buf, " Enable Sdo complete access: %s\n",
+ slave->sii.coe_details.enable_sdo_complete_access
+ ? "yes" : "no");
+ }
+
+ buf += sprintf(buf, " Current consumption: %i mA\n\n",
+ slave->sii.current_on_ebus);
}
if (slave->sii.sync_count) {
--- a/master/slave.h Wed Feb 27 15:24:00 2008 +0000
+++ b/master/slave.h Thu Feb 28 10:58:43 2008 +0000
@@ -103,6 +103,19 @@
/*****************************************************************************/
+/** Slave information interface CAnopen-over-EtherCAT details flags.
+ */
+typedef struct {
+ uint8_t enable_sdo : 1; /**< Enable Sdo access. */
+ uint8_t enable_sdo_info : 1; /**< SDO information service available. */
+ uint8_t enable_pdo_assign : 1; /**< Pdo mapping configurable. */
+ uint8_t enable_pdo_configuration : 1; /**< Pdo configuration possible. */
+ uint8_t enable_upload_at_startup : 1; /**< ? */
+ uint8_t enable_sdo_complete_access : 1; /**< Complete access possible. */
+} ec_sii_coe_details_t;
+
+/*****************************************************************************/
+
/** Slave information interface data.
*/
typedef struct {
@@ -123,11 +136,13 @@
unsigned int string_count; /**< number of EEPROM strings */
// General
- uint8_t physical_layer[4]; /**< port media */
+ unsigned int has_general; /**< General category present. */
char *group; /**< slave group acc. to EEPROM */
char *image; /**< slave image name acc. to EEPROM */
char *order; /**< slave order number acc. to EEPROM */
char *name; /**< slave name acc. to EEPROM */
+ uint8_t physical_layer[4]; /**< port media */
+ ec_sii_coe_details_t coe_details; /**< CoE detail flags. */
int16_t current_on_ebus; /**< power consumption */
// SyncM
--- a/script/lsec Wed Feb 27 15:24:00 2008 +0000
+++ b/script/lsec Thu Feb 28 10:58:43 2008 +0000
@@ -83,6 +83,7 @@
next unless $entry =~ /^slave(\d+)$/;
$slave = {};
+ $slave->{'current'} = 0;
$slave_info_file = "$master_dir/$entry/info";
open INFO, $slave_info_file or die
"ERROR: Failed to open $slave_info_file.";
@@ -103,8 +104,6 @@
$slave->{'state'} = $1;
} elsif ($line =~ /^Configured station alias: .* \((\d+)\)$/) {
$slave->{'alias'} = $1;
- } elsif ($line =~ /^Current consumption: (-?\d+) mA$/) {
- $slave->{'current'} = $1;
}
} elsif ($category eq "Identity") {
if ($line =~ /Vendor ID: .* \((\d+)\)$/) {
@@ -115,6 +114,8 @@
} elsif ($category eq "General") {
if ($line =~ /Name: (.*)$/) {
$slave->{'name'} = $1;
+ } elsif ($line =~ /Current consumption: (-?\d+) mA$/) {
+ $slave->{'current'} = $1;
}
}
}