CoE state machines raising error, if the slave does not support CoE.

This commit is contained in:
Florian Pose 2008-02-22 18:25:44 +00:00
parent d4ccd3a2b6
commit 7341a1973c
2 changed files with 21 additions and 6 deletions

View File

@ -249,6 +249,12 @@ void ec_fsm_coe_dict_start(ec_fsm_coe_t *fsm /**< finite state machine */)
ec_slave_t *slave = fsm->slave;
uint8_t *data;
if (!(slave->sii_mailbox_protocols & EC_MBOX_COE)) {
EC_ERR("Slave %u does not support CoE!\n", slave->ring_position);
fsm->state = ec_fsm_coe_error;
return;
}
if (!(data = ec_slave_mbox_prepare_send(slave, datagram, 0x03, 8))) {
fsm->state = ec_fsm_coe_error;
return;
@ -955,6 +961,12 @@ void ec_fsm_coe_down_start(ec_fsm_coe_t *fsm /**< finite state machine */)
EC_DBG("Downloading Sdo 0x%04X:%i to slave %i.\n",
sdodata->index, sdodata->subindex, slave->ring_position);
if (!(slave->sii_mailbox_protocols & EC_MBOX_COE)) {
EC_ERR("Slave %u does not support CoE!\n", slave->ring_position);
fsm->state = ec_fsm_coe_error;
return;
}
if (slave->sii_rx_mailbox_size < 6 + 10 + sdodata->size) {
EC_ERR("Sdo fragmenting not supported yet!\n");
fsm->state = ec_fsm_coe_error;
@ -1170,6 +1182,12 @@ void ec_fsm_coe_up_start(ec_fsm_coe_t *fsm /**< finite state machine */)
EC_DBG("Uploading Sdo 0x%04X:%i from slave %i.\n",
entry->sdo->index, entry->subindex, slave->ring_position);
if (!(slave->sii_mailbox_protocols & EC_MBOX_COE)) {
EC_ERR("Slave %u does not support CoE!\n", slave->ring_position);
fsm->state = ec_fsm_coe_error;
return;
}
if (!(data = ec_slave_mbox_prepare_send(slave, datagram, 0x03, 10))) {
fsm->state = ec_fsm_coe_error;
return;

View File

@ -51,12 +51,9 @@
typedef struct ec_fsm_coe ec_fsm_coe_t; /**< \see ec_fsm_coe */
/**
Finite state machine of an EtherCAT master.
*/
struct ec_fsm_coe
{
/** Finite state machines for the CANopen-over-EtherCAT protocol.
*/
struct ec_fsm_coe {
ec_slave_t *slave; /**< slave the FSM runs on */
ec_datagram_t *datagram; /**< datagram used in the state machine */
unsigned int retries; /**< retries upon datagram timeout */