diff -r 399ef727bf62 -r e206f4485f60 master/fsm_coe.c --- a/master/fsm_coe.c Mon Dec 29 14:10:27 2008 +0000 +++ b/master/fsm_coe.c Mon Dec 29 15:19:16 2008 +0000 @@ -74,24 +74,24 @@ /*****************************************************************************/ /** - Sdo abort messages. - The "abort Sdo transfer request" supplies an abort code, + SDO abort messages. + The "abort SDO transfer request" supplies an abort code, which can be translated to clear text. This table does the mapping of the codes and messages. */ const ec_code_msg_t sdo_abort_messages[] = { {0x05030000, "Toggle bit not changed"}, - {0x05040000, "Sdo protocol timeout"}, + {0x05040000, "SDO protocol timeout"}, {0x05040001, "Client/Server command specifier not valid or unknown"}, {0x05040005, "Out of memory"}, {0x06010000, "Unsupported access to an object"}, {0x06010001, "Attempt to read a write-only object"}, {0x06010002, "Attempt to write a read-only object"}, {0x06020000, "This object does not exist in the object directory"}, - {0x06040041, "The object cannot be mapped into the Pdo"}, + {0x06040041, "The object cannot be mapped into the PDO"}, {0x06040042, "The number and length of the objects to be mapped would" - " exceed the Pdo length"}, + " exceed the PDO length"}, {0x06040043, "General parameter incompatibility reason"}, {0x06040047, "Gerneral internal incompatibility in device"}, {0x06060000, "Access failure due to a hardware error"}, @@ -120,7 +120,7 @@ /*****************************************************************************/ /** - Outputs an Sdo abort message. + Outputs an SDO abort message. */ void ec_canopen_abort_msg(uint32_t abort_code) @@ -129,13 +129,13 @@ for (abort_msg = sdo_abort_messages; abort_msg->code; abort_msg++) { if (abort_msg->code == abort_code) { - EC_ERR("Sdo abort message 0x%08X: \"%s\".\n", + EC_ERR("SDO abort message 0x%08X: \"%s\".\n", abort_msg->code, abort_msg->message); return; } } - EC_ERR("Unknown Sdo abort code 0x%08X.\n", abort_code); + EC_ERR("Unknown SDO abort code 0x%08X.\n", abort_code); } /*****************************************************************************/ @@ -165,7 +165,7 @@ /*****************************************************************************/ /** - Starts reading a slaves' Sdo dictionary. + Starts reading a slaves' SDO dictionary. */ void ec_fsm_coe_dictionary(ec_fsm_coe_t *fsm, /**< finite state machine */ @@ -179,13 +179,13 @@ /*****************************************************************************/ /** - Starts to transfer an Sdo to/from a slave. + Starts to transfer an SDO to/from a slave. */ void ec_fsm_coe_transfer( ec_fsm_coe_t *fsm, /**< State machine. */ ec_slave_t *slave, /**< EtherCAT slave. */ - ec_sdo_request_t *request /**< Sdo request. */ + ec_sdo_request_t *request /**< SDO request. */ ) { fsm->slave = slave; @@ -275,7 +275,7 @@ } if (slave->sii.has_general && !slave->sii.coe_details.enable_sdo_info) { - EC_ERR("Slave %u does not support Sdo information service!\n", + EC_ERR("Slave %u does not support SDO information service!\n", slave->ring_position); fsm->state = ec_fsm_coe_error; return; @@ -286,11 +286,11 @@ return; } - EC_WRITE_U16(data, 0x8 << 12); // Sdo information + EC_WRITE_U16(data, 0x8 << 12); // SDO information EC_WRITE_U8 (data + 2, 0x01); // Get OD List Request EC_WRITE_U8 (data + 3, 0x00); EC_WRITE_U16(data + 4, 0x0000); - EC_WRITE_U16(data + 6, 0x0001); // deliver all Sdos! + EC_WRITE_U16(data + 6, 0x0001); // deliver all SDOs! fsm->retries = EC_FSM_RETRIES; fsm->state = ec_fsm_coe_dict_request; @@ -369,7 +369,7 @@ (datagram->jiffies_received - fsm->jiffies_start) * 1000 / HZ; if (diff_ms >= EC_FSM_COE_DICT_TIMEOUT) { fsm->state = ec_fsm_coe_error; - EC_ERR("Timeout while waiting for Sdo dictionary list response " + EC_ERR("Timeout while waiting for SDO dictionary list response " "on slave %u.\n", slave->ring_position); return; } @@ -442,18 +442,18 @@ } if (rec_size < 3) { - EC_ERR("Received corrupted Sdo dictionary response (size %u).\n", + EC_ERR("Received corrupted SDO dictionary response (size %u).\n", rec_size); fsm->state = ec_fsm_coe_error; return; } - if (EC_READ_U16(data) >> 12 == 0x8 && // Sdo information + if (EC_READ_U16(data) >> 12 == 0x8 && // SDO information (EC_READ_U8(data + 2) & 0x7F) == 0x07) { // error response - EC_ERR("Sdo information error response at slave %u!\n", + EC_ERR("SDO information error response at slave %u!\n", slave->ring_position); if (rec_size < 10) { - EC_ERR("Incomplete Sdo information error response:\n"); + EC_ERR("Incomplete SDO information error response:\n"); ec_print_data(data, rec_size); } else { ec_canopen_abort_msg(EC_READ_U32(data + 6)); @@ -462,10 +462,10 @@ return; } - if (EC_READ_U16(data) >> 12 != 0x8 || // Sdo information + if (EC_READ_U16(data) >> 12 != 0x8 || // SDO information (EC_READ_U8 (data + 2) & 0x7F) != 0x02) { // Get OD List response if (fsm->slave->master->debug_level) { - EC_DBG("Invalid Sdo list response at slave %u! Retrying...\n", + EC_DBG("Invalid SDO list response at slave %u! Retrying...\n", slave->ring_position); ec_print_data(data, rec_size); } @@ -488,13 +488,13 @@ sdo_index = EC_READ_U16(data + 8 + i * 2); if (!sdo_index) { if (slave->master->debug_level) - EC_WARN("Sdo dictionary of slave %u contains index 0x0000.\n", + EC_WARN("SDO dictionary of slave %u contains index 0x0000.\n", slave->ring_position); continue; } if (!(sdo = (ec_sdo_t *) kmalloc(sizeof(ec_sdo_t), GFP_KERNEL))) { - EC_ERR("Failed to allocate memory for Sdo!\n"); + EC_ERR("Failed to allocate memory for SDO!\n"); fsm->state = ec_fsm_coe_error; return; } @@ -505,7 +505,7 @@ fragments_left = EC_READ_U16(data + 4); if (slave->master->debug_level && fragments_left) { - EC_DBG("Sdo list fragments left: %u\n", fragments_left); + EC_DBG("SDO list fragments left: %u\n", fragments_left); } if (EC_READ_U8(data + 2) & 0x80 || fragments_left) { // more messages waiting. check again. @@ -517,12 +517,12 @@ } if (list_empty(&slave->sdo_dictionary)) { - // no Sdos in dictionary. finished. + // no SDOs in dictionary. finished. fsm->state = ec_fsm_coe_end; // success return; } - // fetch Sdo descriptions + // fetch SDO descriptions fsm->sdo = list_entry(slave->sdo_dictionary.next, ec_sdo_t, list); if (!(data = ec_slave_mbox_prepare_send(slave, datagram, 0x03, 8))) { @@ -530,11 +530,11 @@ return; } - EC_WRITE_U16(data, 0x8 << 12); // Sdo information + EC_WRITE_U16(data, 0x8 << 12); // SDO information EC_WRITE_U8 (data + 2, 0x03); // Get object description request EC_WRITE_U8 (data + 3, 0x00); EC_WRITE_U16(data + 4, 0x0000); - EC_WRITE_U16(data + 6, fsm->sdo->index); // Sdo index + EC_WRITE_U16(data + 6, fsm->sdo->index); // SDO index fsm->retries = EC_FSM_RETRIES; fsm->state = ec_fsm_coe_dict_desc_request; @@ -557,7 +557,7 @@ if (datagram->state != EC_DATAGRAM_RECEIVED) { fsm->state = ec_fsm_coe_error; - EC_ERR("Failed to receive CoE Sdo description request datagram for" + EC_ERR("Failed to receive CoE SDO description request datagram for" " slave %u (datagram state %u).\n", slave->ring_position, datagram->state); return; @@ -565,7 +565,7 @@ if (datagram->working_counter != 1) { fsm->state = ec_fsm_coe_error; - EC_ERR("Reception of CoE Sdo description" + EC_ERR("Reception of CoE SDO description" " request failed on slave %u: ", slave->ring_position); ec_datagram_print_wc_error(datagram); return; @@ -613,7 +613,7 @@ (datagram->jiffies_received - fsm->jiffies_start) * 1000 / HZ; if (diff_ms >= EC_FSM_COE_DICT_TIMEOUT) { fsm->state = ec_fsm_coe_error; - EC_ERR("Timeout while waiting for Sdo object description " + EC_ERR("Timeout while waiting for SDO object description " "response on slave %u.\n", slave->ring_position); return; } @@ -650,7 +650,7 @@ if (datagram->state != EC_DATAGRAM_RECEIVED) { fsm->state = ec_fsm_coe_error; - EC_ERR("Failed to receive CoE Sdo description response datagram from" + EC_ERR("Failed to receive CoE SDO description response datagram from" " slave %u (datagram state %u).\n", slave->ring_position, datagram->state); return; @@ -658,7 +658,7 @@ if (datagram->working_counter != 1) { fsm->state = ec_fsm_coe_error; - EC_ERR("Reception of CoE Sdo description" + EC_ERR("Reception of CoE SDO description" " response failed on slave %u: ", slave->ring_position); ec_datagram_print_wc_error(datagram); return; @@ -685,16 +685,16 @@ } if (rec_size < 3) { - EC_ERR("Received corrupted Sdo description response (size %u).\n", + EC_ERR("Received corrupted SDO description response (size %u).\n", rec_size); fsm->state = ec_fsm_coe_error; return; } - if (EC_READ_U16(data) >> 12 == 0x8 && // Sdo information + if (EC_READ_U16(data) >> 12 == 0x8 && // SDO information (EC_READ_U8 (data + 2) & 0x7F) == 0x07) { // error response - EC_ERR("Sdo information error response at slave %u while" - " fetching Sdo 0x%04X!\n", slave->ring_position, + EC_ERR("SDO information error response at slave %u while" + " fetching SDO 0x%04X!\n", slave->ring_position, sdo->index); ec_canopen_abort_msg(EC_READ_U32(data + 6)); fsm->state = ec_fsm_coe_error; @@ -702,18 +702,18 @@ } if (rec_size < 8) { - EC_ERR("Received corrupted Sdo description response (size %u).\n", + EC_ERR("Received corrupted SDO description response (size %u).\n", rec_size); fsm->state = ec_fsm_coe_error; return; } - if (EC_READ_U16(data) >> 12 != 0x8 || // Sdo information + if (EC_READ_U16(data) >> 12 != 0x8 || // SDO information (EC_READ_U8 (data + 2) & 0x7F) != 0x04 || // Object desc. response - EC_READ_U16(data + 6) != sdo->index) { // Sdo index + EC_READ_U16(data + 6) != sdo->index) { // SDO index if (fsm->slave->master->debug_level) { EC_DBG("Invalid object description response at slave %u while" - " fetching Sdo 0x%04X!\n", slave->ring_position, + " fetching SDO 0x%04X!\n", slave->ring_position, sdo->index); ec_print_data(data, rec_size); } @@ -737,7 +737,7 @@ name_size = rec_size - 12; if (name_size) { if (!(sdo->name = kmalloc(name_size + 1, GFP_KERNEL))) { - EC_ERR("Failed to allocate Sdo name!\n"); + EC_ERR("Failed to allocate SDO name!\n"); fsm->state = ec_fsm_coe_error; return; } @@ -761,12 +761,12 @@ return; } - EC_WRITE_U16(data, 0x8 << 12); // Sdo information + EC_WRITE_U16(data, 0x8 << 12); // SDO information EC_WRITE_U8 (data + 2, 0x05); // Get entry description request EC_WRITE_U8 (data + 3, 0x00); EC_WRITE_U16(data + 4, 0x0000); - EC_WRITE_U16(data + 6, sdo->index); // Sdo index - EC_WRITE_U8 (data + 8, fsm->subindex); // Sdo subindex + EC_WRITE_U16(data + 6, sdo->index); // SDO index + EC_WRITE_U8 (data + 8, fsm->subindex); // SDO subindex EC_WRITE_U8 (data + 9, 0x00); // value info (no values) fsm->retries = EC_FSM_RETRIES; @@ -791,7 +791,7 @@ if (datagram->state != EC_DATAGRAM_RECEIVED) { fsm->state = ec_fsm_coe_error; - EC_ERR("Failed to receive CoE Sdo entry request datagram for" + EC_ERR("Failed to receive CoE SDO entry request datagram for" " slave %u (datagram state %u).\n", slave->ring_position, datagram->state); return; @@ -799,7 +799,7 @@ if (datagram->working_counter != 1) { fsm->state = ec_fsm_coe_error; - EC_ERR("Reception of CoE Sdo entry request failed on slave %u: ", + EC_ERR("Reception of CoE SDO entry request failed on slave %u: ", slave->ring_position); ec_datagram_print_wc_error(datagram); return; @@ -848,7 +848,7 @@ (datagram->jiffies_received - fsm->jiffies_start) * 1000 / HZ; if (diff_ms >= EC_FSM_COE_DICT_TIMEOUT) { fsm->state = ec_fsm_coe_error; - EC_ERR("Timeout while waiting for Sdo entry description response " + EC_ERR("Timeout while waiting for SDO entry description response " "on slave %u.\n", slave->ring_position); return; } @@ -886,7 +886,7 @@ if (datagram->state != EC_DATAGRAM_RECEIVED) { fsm->state = ec_fsm_coe_error; - EC_ERR("Failed to receive CoE Sdo description response datagram from" + EC_ERR("Failed to receive CoE SDO description response datagram from" " slave %u (datagram state %u).\n", slave->ring_position, datagram->state); return; @@ -894,7 +894,7 @@ if (datagram->working_counter != 1) { fsm->state = ec_fsm_coe_error; - EC_ERR("Reception of CoE Sdo description" + EC_ERR("Reception of CoE SDO description" " response failed on slave %u: ", slave->ring_position); ec_datagram_print_wc_error(datagram); return; @@ -921,16 +921,16 @@ } if (rec_size < 3) { - EC_ERR("Received corrupted Sdo entry description response " + EC_ERR("Received corrupted SDO entry description response " "(size %u).\n", rec_size); fsm->state = ec_fsm_coe_error; return; } - if (EC_READ_U16(data) >> 12 == 0x8 && // Sdo information + if (EC_READ_U16(data) >> 12 == 0x8 && // SDO information (EC_READ_U8 (data + 2) & 0x7F) == 0x07) { // error response - EC_ERR("Sdo information error response at slave %u while" - " fetching Sdo entry 0x%04X:%02X!\n", slave->ring_position, + EC_ERR("SDO information error response at slave %u while" + " fetching SDO entry 0x%04X:%02X!\n", slave->ring_position, sdo->index, fsm->subindex); ec_canopen_abort_msg(EC_READ_U32(data + 6)); fsm->state = ec_fsm_coe_error; @@ -938,19 +938,19 @@ } if (rec_size < 9) { - EC_ERR("Received corrupted Sdo entry description response " + EC_ERR("Received corrupted SDO entry description response " "(size %u).\n", rec_size); fsm->state = ec_fsm_coe_error; return; } - if (EC_READ_U16(data) >> 12 != 0x8 || // Sdo information + if (EC_READ_U16(data) >> 12 != 0x8 || // SDO information (EC_READ_U8(data + 2) & 0x7F) != 0x06 || // Entry desc. response - EC_READ_U16(data + 6) != sdo->index || // Sdo index - EC_READ_U8(data + 8) != fsm->subindex) { // Sdo subindex + EC_READ_U16(data + 6) != sdo->index || // SDO index + EC_READ_U8(data + 8) != fsm->subindex) { // SDO subindex if (fsm->slave->master->debug_level) { EC_DBG("Invalid entry description response at slave %u while" - " fetching Sdo entry 0x%04X:%02X!\n", slave->ring_position, + " fetching SDO entry 0x%04X:%02X!\n", slave->ring_position, sdo->index, fsm->subindex); ec_print_data(data, rec_size); } @@ -984,7 +984,7 @@ if (data_size) { uint8_t *desc; if (!(desc = kmalloc(data_size + 1, GFP_KERNEL))) { - EC_ERR("Failed to allocate Sdo entry name!\n"); + EC_ERR("Failed to allocate SDO entry name!\n"); fsm->state = ec_fsm_coe_error; return; } @@ -1003,12 +1003,12 @@ return; } - EC_WRITE_U16(data, 0x8 << 12); // Sdo information + EC_WRITE_U16(data, 0x8 << 12); // SDO information EC_WRITE_U8 (data + 2, 0x05); // Get entry description request EC_WRITE_U8 (data + 3, 0x00); EC_WRITE_U16(data + 4, 0x0000); - EC_WRITE_U16(data + 6, sdo->index); // Sdo index - EC_WRITE_U8 (data + 8, fsm->subindex); // Sdo subindex + EC_WRITE_U16(data + 6, sdo->index); // SDO index + EC_WRITE_U8 (data + 8, fsm->subindex); // SDO subindex EC_WRITE_U8 (data + 9, 0x00); // value info (no values) fsm->retries = EC_FSM_RETRIES; @@ -1016,7 +1016,7 @@ return; } - // another Sdo description to fetch? + // another SDO description to fetch? if (fsm->sdo->list.next != &slave->sdo_dictionary) { fsm->sdo = list_entry(fsm->sdo->list.next, ec_sdo_t, list); @@ -1025,11 +1025,11 @@ return; } - EC_WRITE_U16(data, 0x8 << 12); // Sdo information + EC_WRITE_U16(data, 0x8 << 12); // SDO information EC_WRITE_U8 (data + 2, 0x03); // Get object description request EC_WRITE_U8 (data + 3, 0x00); EC_WRITE_U16(data + 4, 0x0000); - EC_WRITE_U16(data + 6, fsm->sdo->index); // Sdo index + EC_WRITE_U16(data + 6, fsm->sdo->index); // SDO index fsm->retries = EC_FSM_RETRIES; fsm->state = ec_fsm_coe_dict_desc_request; @@ -1056,7 +1056,7 @@ uint8_t size; if (fsm->slave->master->debug_level) { - EC_DBG("Downloading Sdo 0x%04X:%02X to slave %u.\n", + EC_DBG("Downloading SDO 0x%04X:%02X to slave %u.\n", request->index, request->subindex, slave->ring_position); ec_print_data(request->data, request->data_size); } @@ -1075,7 +1075,7 @@ size = 4 - request->data_size; - EC_WRITE_U16(data, 0x2 << 12); // Sdo request + EC_WRITE_U16(data, 0x2 << 12); // SDO request EC_WRITE_U8 (data + 2, (0x3 // size specified, expedited | size << 2 | 0x1 << 5)); // Download request @@ -1090,7 +1090,7 @@ } else { // request->data_size > 4, use normal transfer type if (slave->sii.rx_mailbox_size < 6 + 10 + request->data_size) { - EC_ERR("Sdo fragmenting not supported yet!\n"); + EC_ERR("SDO fragmenting not supported yet!\n"); fsm->state = ec_fsm_coe_error; return; } @@ -1101,7 +1101,7 @@ return; } - EC_WRITE_U16(data, 0x2 << 12); // Sdo request + EC_WRITE_U16(data, 0x2 << 12); // SDO request EC_WRITE_U8 (data + 2, (0x1 // size indicator, normal | 0x1 << 5)); // Download request EC_WRITE_U16(data + 3, request->index); @@ -1149,7 +1149,7 @@ (jiffies - fsm->request->jiffies_sent) * 1000 / HZ; if (diff_ms < fsm->request->response_timeout) { if (fsm->slave->master->debug_level) { - EC_DBG("Slave %u did not respond to Sdo download request. " + EC_DBG("Slave %u did not respond to SDO download request. " "Retrying after %u ms...\n", slave->ring_position, (u32) diff_ms); } @@ -1206,7 +1206,7 @@ (datagram->jiffies_received - fsm->jiffies_start) * 1000 / HZ; if (diff_ms >= fsm->request->response_timeout) { fsm->state = ec_fsm_coe_error; - EC_ERR("Timeout while waiting for Sdo download response on " + EC_ERR("Timeout while waiting for SDO download response on " "slave %u.\n", slave->ring_position); return; } @@ -1288,10 +1288,10 @@ return; } - if (EC_READ_U16(data) >> 12 == 0x2 && // Sdo request - EC_READ_U8 (data + 2) >> 5 == 0x4) { // abort Sdo transfer request - fsm->state = ec_fsm_coe_error; - EC_ERR("Sdo download 0x%04X:%02X (%u bytes) aborted on slave %u.\n", + if (EC_READ_U16(data) >> 12 == 0x2 && // SDO request + EC_READ_U8 (data + 2) >> 5 == 0x4) { // abort SDO transfer request + fsm->state = ec_fsm_coe_error; + EC_ERR("SDO download 0x%04X:%02X (%u bytes) aborted on slave %u.\n", request->index, request->subindex, request->data_size, slave->ring_position); if (rec_size < 10) { @@ -1304,12 +1304,12 @@ return; } - if (EC_READ_U16(data) >> 12 != 0x3 || // Sdo response + if (EC_READ_U16(data) >> 12 != 0x3 || // SDO response EC_READ_U8 (data + 2) >> 5 != 0x3 || // Download response EC_READ_U16(data + 3) != request->index || // index EC_READ_U8 (data + 5) != request->subindex) { // subindex if (slave->master->debug_level) { - EC_DBG("Invalid Sdo download response at slave %u! Retrying...\n", + EC_DBG("Invalid SDO download response at slave %u! Retrying...\n", slave->ring_position); ec_print_data(data, rec_size); } @@ -1338,7 +1338,7 @@ uint8_t *data; if (master->debug_level) - EC_DBG("Uploading Sdo 0x%04X:%02X from slave %u.\n", + EC_DBG("Uploading SDO 0x%04X:%02X from slave %u.\n", request->index, request->subindex, slave->ring_position); if (!(slave->sii.mailbox_protocols & EC_MBOX_COE)) { @@ -1352,7 +1352,7 @@ return; } - EC_WRITE_U16(data, 0x2 << 12); // Sdo request + EC_WRITE_U16(data, 0x2 << 12); // SDO request EC_WRITE_U8 (data + 2, 0x2 << 5); // initiate upload request EC_WRITE_U16(data + 3, request->index); EC_WRITE_U8 (data + 5, request->subindex); @@ -1397,7 +1397,7 @@ (jiffies - fsm->request->jiffies_sent) * 1000 / HZ; if (diff_ms < fsm->request->response_timeout) { if (fsm->slave->master->debug_level) { - EC_DBG("Slave %u did not respond to Sdo upload request. " + EC_DBG("Slave %u did not respond to SDO upload request. " "Retrying after %u ms...\n", slave->ring_position, (u32) diff_ms); } @@ -1454,7 +1454,7 @@ (datagram->jiffies_received - fsm->jiffies_start) * 1000 / HZ; if (diff_ms >= fsm->request->response_timeout) { fsm->state = ec_fsm_coe_error; - EC_ERR("Timeout while waiting for Sdo upload response on " + EC_ERR("Timeout while waiting for SDO upload response on " "slave %u.\n", slave->ring_position); return; } @@ -1534,14 +1534,14 @@ if (rec_size < 3) { fsm->state = ec_fsm_coe_error; - EC_ERR("Received currupted Sdo upload response (%u bytes)!\n", rec_size); + EC_ERR("Received currupted SDO upload response (%u bytes)!\n", rec_size); ec_print_data(data, rec_size); return; } - if (EC_READ_U16(data) >> 12 == 0x2 && // Sdo request - EC_READ_U8 (data + 2) >> 5 == 0x4) { // abort Sdo transfer request - EC_ERR("Sdo upload 0x%04X:%02X aborted on slave %u.\n", + if (EC_READ_U16(data) >> 12 == 0x2 && // SDO request + EC_READ_U8 (data + 2) >> 5 == 0x4) { // abort SDO transfer request + EC_ERR("SDO upload 0x%04X:%02X aborted on slave %u.\n", request->index, request->subindex, slave->ring_position); if (rec_size >= 10) { request->abort_code = EC_READ_U32(data + 6); @@ -1559,18 +1559,18 @@ if (expedited) { if (rec_size < 7) { fsm->state = ec_fsm_coe_error; - EC_ERR("Received currupted Sdo expedited upload" + EC_ERR("Received currupted SDO expedited upload" " response (only %u bytes)!\n", rec_size); ec_print_data(data, rec_size); return; } - if (EC_READ_U16(data) >> 12 != 0x3 || // Sdo response + if (EC_READ_U16(data) >> 12 != 0x3 || // SDO response EC_READ_U8 (data + 2) >> 5 != 0x2 || // upload response EC_READ_U16(data + 3) != request->index || // index EC_READ_U8 (data + 5) != request->subindex) { // subindex if (fsm->slave->master->debug_level) { - EC_DBG("Invalid Sdo upload expedited response at slave %u!\n", + EC_DBG("Invalid SDO upload expedited response at slave %u!\n", slave->ring_position); ec_print_data(data, rec_size); } @@ -1590,7 +1590,7 @@ if (rec_size < 6 + complete_size) { fsm->state = ec_fsm_coe_error; - EC_ERR("Received currupted Sdo expedited upload" + EC_ERR("Received currupted SDO expedited upload" " response (only %u bytes)!\n", rec_size); ec_print_data(data, rec_size); return; @@ -1603,18 +1603,18 @@ } else { // normal if (rec_size < 10) { fsm->state = ec_fsm_coe_error; - EC_ERR("Received currupted Sdo normal upload" + EC_ERR("Received currupted SDO normal upload" " response (only %u bytes)!\n", rec_size); ec_print_data(data, rec_size); return; } - if (EC_READ_U16(data) >> 12 != 0x3 || // Sdo response + if (EC_READ_U16(data) >> 12 != 0x3 || // SDO response EC_READ_U8 (data + 2) >> 5 != 0x2 || // upload response EC_READ_U16(data + 3) != request->index || // index EC_READ_U8 (data + 5) != request->subindex) { // subindex if (fsm->slave->master->debug_level) { - EC_DBG("Invalid Sdo normal upload response at slave %u!\n", + EC_DBG("Invalid SDO normal upload response at slave %u!\n", slave->ring_position); ec_print_data(data, rec_size); } @@ -1648,7 +1648,7 @@ fsm->toggle = 0; if (data_size < complete_size) { - EC_WARN("Sdo data incomplete (%u / %u).\n", + EC_WARN("SDO data incomplete (%u / %u).\n", data_size, complete_size); if (!(data = ec_slave_mbox_prepare_send(slave, datagram, @@ -1657,7 +1657,7 @@ return; } - EC_WRITE_U16(data, 0x2 << 12); // Sdo request + EC_WRITE_U16(data, 0x2 << 12); // SDO request EC_WRITE_U8 (data + 2, (fsm->toggle << 4 // toggle | 0x3 << 5)); // upload segment request @@ -1753,7 +1753,7 @@ (datagram->jiffies_received - fsm->jiffies_start) * 1000 / HZ; if (diff_ms >= fsm->request->response_timeout) { fsm->state = ec_fsm_coe_error; - EC_ERR("Timeout while waiting for Sdo upload segment response " + EC_ERR("Timeout while waiting for SDO upload segment response " "on slave %u.\n", slave->ring_position); return; } @@ -1833,15 +1833,15 @@ } if (rec_size < 10) { - EC_ERR("Received currupted Sdo upload segment response!\n"); + EC_ERR("Received currupted SDO upload segment response!\n"); ec_print_data(data, rec_size); fsm->state = ec_fsm_coe_error; return; } - if (EC_READ_U16(data) >> 12 == 0x2 && // Sdo request - EC_READ_U8 (data + 2) >> 5 == 0x4) { // abort Sdo transfer request - EC_ERR("Sdo upload 0x%04X:%02X aborted on slave %u.\n", + if (EC_READ_U16(data) >> 12 == 0x2 && // SDO request + EC_READ_U8 (data + 2) >> 5 == 0x4) { // abort SDO transfer request + EC_ERR("SDO upload 0x%04X:%02X aborted on slave %u.\n", request->index, request->subindex, slave->ring_position); request->abort_code = EC_READ_U32(data + 6); ec_canopen_abort_msg(request->abort_code); @@ -1849,10 +1849,10 @@ return; } - if (EC_READ_U16(data) >> 12 != 0x3 || // Sdo response + if (EC_READ_U16(data) >> 12 != 0x3 || // SDO response EC_READ_U8 (data + 2) >> 5 != 0x0) { // upload segment response if (fsm->slave->master->debug_level) { - EC_DBG("Invalid Sdo upload segment response at slave %u!\n", + EC_DBG("Invalid SDO upload segment response at slave %u!\n", slave->ring_position); ec_print_data(data, rec_size); } @@ -1868,7 +1868,7 @@ data_size = rec_size - 10; if (data_size != seg_size) { - EC_WARN("Sdo segment data invalid (%u / %u)" + EC_WARN("SDO segment data invalid (%u / %u)" " - Fragmenting not implemented.\n", data_size, seg_size); } @@ -1884,7 +1884,7 @@ return; } - EC_WRITE_U16(data, 0x2 << 12); // Sdo request + EC_WRITE_U16(data, 0x2 << 12); // SDO request EC_WRITE_U8 (data + 2, (fsm->toggle << 4 // toggle | 0x3 << 5)); // upload segment request