Introduced effective_alias variable to separate reg12 alias from SII alias.
This commit is contained in:
parent
aba214160a
commit
6373e38ca3
|
|
@ -285,7 +285,7 @@ int ec_cdev_ioctl_slave(
|
|||
data.product_code = slave->sii.product_code;
|
||||
data.revision_number = slave->sii.revision_number;
|
||||
data.serial_number = slave->sii.serial_number;
|
||||
data.alias = slave->sii.alias;
|
||||
data.alias = slave->effective_alias;
|
||||
data.boot_rx_mailbox_offset = slave->sii.boot_rx_mailbox_offset;
|
||||
data.boot_rx_mailbox_size = slave->sii.boot_rx_mailbox_size;
|
||||
data.boot_tx_mailbox_offset = slave->sii.boot_tx_mailbox_offset;
|
||||
|
|
|
|||
|
|
@ -136,9 +136,9 @@ int ec_eoe_init(
|
|||
|
||||
/* device name eoe<MASTER>[as]<SLAVE>, because networking scripts don't
|
||||
* like hyphens etc. in interface names. */
|
||||
if (slave->sii.alias) {
|
||||
if (slave->effective_alias) {
|
||||
snprintf(name, EC_DATAGRAM_NAME_SIZE,
|
||||
"eoe%ua%u", slave->master->index, slave->sii.alias);
|
||||
"eoe%ua%u", slave->master->index, slave->effective_alias);
|
||||
} else {
|
||||
snprintf(name, EC_DATAGRAM_NAME_SIZE,
|
||||
"eoe%us%u", slave->master->index, slave->ring_position);
|
||||
|
|
|
|||
|
|
@ -877,6 +877,7 @@ void ec_fsm_master_state_write_sii(
|
|||
// alias was written
|
||||
slave->sii.alias = EC_READ_U16(request->words + 4);
|
||||
// TODO: read alias from register 0x0012
|
||||
slave->effective_alias = slave->sii.alias;
|
||||
}
|
||||
// TODO: Evaluate other SII contents!
|
||||
|
||||
|
|
|
|||
|
|
@ -609,6 +609,7 @@ void ec_fsm_slave_scan_state_sii_data(ec_fsm_slave_scan_t *fsm /**< slave state
|
|||
|
||||
slave->sii.alias =
|
||||
EC_READ_U16(slave->sii_words + 0x0004);
|
||||
slave->effective_alias = slave->sii.alias;
|
||||
slave->sii.vendor_id =
|
||||
EC_READ_U32(slave->sii_words + 0x0008);
|
||||
slave->sii.product_code =
|
||||
|
|
@ -738,9 +739,9 @@ void ec_fsm_slave_scan_enter_regalias(
|
|||
ec_datagram_t *datagram = fsm->datagram;
|
||||
ec_slave_t *slave = fsm->slave;
|
||||
|
||||
// read alias from register 0x0012
|
||||
// read alias from register
|
||||
if (slave->master->debug_level)
|
||||
EC_DBG("Reading alias from register 0x0012 of slave %u.\n",
|
||||
EC_DBG("Reading alias from register of slave %u.\n",
|
||||
slave->ring_position);
|
||||
ec_datagram_fprd(datagram, slave->station_address, 0x0012, 2);
|
||||
ec_datagram_zero(datagram);
|
||||
|
|
@ -775,10 +776,10 @@ void ec_fsm_slave_scan_state_regalias(
|
|||
EC_WARN("Failed to read reg alias of slave %u.\n",
|
||||
fsm->slave->ring_position);
|
||||
} else {
|
||||
slave->sii.alias = EC_READ_U16(datagram->data);
|
||||
slave->effective_alias = EC_READ_U16(datagram->data);
|
||||
if (slave->master->debug_level)
|
||||
EC_DBG("Alias of slave %u is %u.\n",
|
||||
slave->ring_position,slave->sii.alias);
|
||||
EC_DBG("Read alias %u from register of slave %u.\n",
|
||||
slave->effective_alias, slave->ring_position);
|
||||
}
|
||||
if (slave->sii.mailbox_protocols & EC_MBOX_COE) {
|
||||
ec_fsm_slave_scan_enter_preop(fsm);
|
||||
|
|
|
|||
|
|
@ -1526,7 +1526,7 @@ void ec_master_attach_slave_configs(
|
|||
if (alias) { \
|
||||
for (; slave < master->slaves + master->slave_count; \
|
||||
slave++) { \
|
||||
if (slave->sii.alias == alias) \
|
||||
if (slave->effective_alias == alias) \
|
||||
break; \
|
||||
} \
|
||||
if (slave == master->slaves + master->slave_count) \
|
||||
|
|
@ -2262,7 +2262,7 @@ int ecrt_master_get_slave(ec_master_t *master, uint16_t slave_position,
|
|||
slave_info->product_code = slave->sii.product_code;
|
||||
slave_info->revision_number = slave->sii.revision_number;
|
||||
slave_info->serial_number = slave->sii.serial_number;
|
||||
slave_info->alias = slave->sii.alias;
|
||||
slave_info->alias = slave->effective_alias;
|
||||
slave_info->current_on_ebus = slave->sii.current_on_ebus;
|
||||
slave_info->al_state = slave->current_state;
|
||||
slave_info->error_flag = slave->error_flag;
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ void ec_slave_init(
|
|||
slave->master = master;
|
||||
slave->ring_position = ring_position;
|
||||
slave->station_address = station_address;
|
||||
slave->effective_alias = 0x0000;
|
||||
|
||||
slave->config = NULL;
|
||||
slave->requested_state = EC_SLAVE_STATE_PREOP;
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ struct ec_slave
|
|||
// addresses
|
||||
uint16_t ring_position; /**< Ring position. */
|
||||
uint16_t station_address; /**< Configured station address. */
|
||||
uint16_t effective_alias; /**< Effective alias address. */
|
||||
|
||||
ec_slave_port_t ports[EC_MAX_PORTS]; /**< Ports. */
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue