Output subindices with %02X.

This commit is contained in:
Florian Pose 2008-05-30 09:39:29 +00:00
parent e6f758b4de
commit 85e8f72c68
7 changed files with 31 additions and 30 deletions

View File

@ -880,7 +880,7 @@ void ec_fsm_coe_dict_entry_response(ec_fsm_coe_t *fsm
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:%i!\n", slave->ring_position,
" 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;
@ -892,7 +892,7 @@ void ec_fsm_coe_dict_entry_response(ec_fsm_coe_t *fsm
EC_READ_U16(data + 6) != sdo->index || // Sdo index
EC_READ_U8(data + 8) != fsm->subindex) { // Sdo subindex
EC_ERR("Invalid entry description response at slave %u while"
" fetching Sdo entry 0x%04X:%u!\n", slave->ring_position,
" fetching Sdo entry 0x%04X:%02X!\n", slave->ring_position,
sdo->index, fsm->subindex);
ec_print_data(data, rec_size);
fsm->state = ec_fsm_coe_error;
@ -998,7 +998,7 @@ void ec_fsm_coe_down_start(ec_fsm_coe_t *fsm /**< finite state machine */)
uint8_t *data;
if (fsm->slave->master->debug_level) {
EC_DBG("Downloading Sdo 0x%04X:%u 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);
}
@ -1185,7 +1185,7 @@ void ec_fsm_coe_down_response(ec_fsm_coe_t *fsm /**< finite state machine */)
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:%X (%u bytes) aborted on slave %u.\n",
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) {
@ -1202,7 +1202,7 @@ void ec_fsm_coe_down_response(ec_fsm_coe_t *fsm /**< finite state machine */)
EC_READ_U16(data + 3) != request->index || // index
EC_READ_U8 (data + 5) != request->subindex) { // subindex
fsm->state = ec_fsm_coe_error;
EC_ERR("Sdo download 0x%04X:%X (%u bytes) failed:\n",
EC_ERR("Sdo download 0x%04X:%02X (%u bytes) failed:\n",
request->index, request->subindex, request->data_size);
EC_ERR("Invalid Sdo download response at slave %u!\n",
slave->ring_position);
@ -1228,7 +1228,7 @@ void ec_fsm_coe_up_start(ec_fsm_coe_t *fsm /**< finite state machine */)
uint8_t *data;
if (master->debug_level)
EC_DBG("Uploading Sdo 0x%04X:%u 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)) {
@ -1416,7 +1416,7 @@ void ec_fsm_coe_up_response(ec_fsm_coe_t *fsm /**< finite state machine */)
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:%X aborted on slave %u.\n",
EC_ERR("Sdo upload 0x%04X:%02X aborted on slave %u.\n",
request->index, request->subindex, slave->ring_position);
if (rec_size >= 10)
ec_canopen_abort_msg(EC_READ_U32(data + 6));
@ -1443,7 +1443,7 @@ void ec_fsm_coe_up_response(ec_fsm_coe_t *fsm /**< finite state machine */)
EC_READ_U16(data + 3) != request->index || // index
EC_READ_U8 (data + 5) != request->subindex) { // subindex
fsm->state = ec_fsm_coe_error;
EC_ERR("Sdo upload 0x%04X:%X failed:\n",
EC_ERR("Sdo upload 0x%04X:%02X failed:\n",
request->index, request->subindex);
EC_ERR("Invalid Sdo upload expedited response at slave %u!\n",
slave->ring_position);
@ -1484,7 +1484,7 @@ void ec_fsm_coe_up_response(ec_fsm_coe_t *fsm /**< finite state machine */)
EC_READ_U16(data + 3) != request->index || // index
EC_READ_U8 (data + 5) != request->subindex) { // subindex
fsm->state = ec_fsm_coe_error;
EC_ERR("Sdo upload 0x%04X:%X failed:\n",
EC_ERR("Sdo upload 0x%04X:%02X failed:\n",
request->index, request->subindex);
EC_ERR("Invalid Sdo normal upload response at slave %u!\n",
slave->ring_position);
@ -1707,7 +1707,7 @@ void ec_fsm_coe_up_seg_response(ec_fsm_coe_t *fsm /**< finite state machine */)
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:%X aborted on slave %u.\n",
EC_ERR("Sdo upload 0x%04X:%02X aborted on slave %u.\n",
request->index, request->subindex, slave->ring_position);
ec_canopen_abort_msg(EC_READ_U32(data + 6));
fsm->state = ec_fsm_coe_error;
@ -1716,7 +1716,7 @@ void ec_fsm_coe_up_seg_response(ec_fsm_coe_t *fsm /**< finite state machine */)
if (EC_READ_U16(data) >> 12 != 0x3 || // Sdo response
EC_READ_U8 (data + 2) >> 5 != 0x0) { // upload segment response
EC_ERR("Sdo upload 0x%04X:%X failed:\n", request->index, request->subindex);
EC_ERR("Sdo upload 0x%04X:%02X failed:\n", request->index, request->subindex);
EC_ERR("Invalid Sdo upload segment response at slave %u!\n",
slave->ring_position);
ec_print_data(data, rec_size);

View File

@ -401,9 +401,10 @@ void ec_fsm_coe_map_state_pdo_entry(
}
if (fsm->slave->master->debug_level) {
EC_DBG(" Pdo entry 0x%04X \"%s\" (%u bit).\n", pdo_entry->index,
pdo_entry->name ? pdo_entry->name : "???",
pdo_entry->bit_length);
EC_DBG(" Pdo entry 0x%04X:%02X, %u bit, \"%s\".\n",
pdo_entry->index, pdo_entry->subindex,
pdo_entry->bit_length,
pdo_entry->name ? pdo_entry->name : "???");
}
// next Pdo entry

View File

@ -309,7 +309,7 @@ void ec_fsm_pdo_mapping_state_add_entry(
if (ec_fsm_coe_exec(fsm->fsm_coe)) return;
if (!ec_fsm_coe_success(fsm->fsm_coe)) {
EC_ERR("Failed to add entry 0x%04X:%u for slave %u.\n",
EC_ERR("Failed to add entry 0x%04X:%02X for slave %u.\n",
fsm->entry->index, fsm->entry->subindex,
fsm->slave->ring_position);
fsm->state = ec_fsm_pdo_mapping_state_error;

View File

@ -1317,7 +1317,7 @@ int ecrt_master_activate(ec_master_t *master)
domain_offset = 0;
list_for_each_entry(domain, &master->domains, list) {
if (ec_domain_finish(domain, domain_offset)) {
EC_ERR("Failed to finish domain %X!\n", (u32) domain);
EC_ERR("Failed to finish domain 0x%08X!\n", (u32) domain);
return -1;
}
domain_offset += domain->data_size;

View File

@ -101,7 +101,7 @@ int ec_sdo_entry_init(
kobject_init(&entry->kobj);
entry->kobj.ktype = &ktype_ec_sdo_entry;
entry->kobj.parent = &sdo->kobj;
if (kobject_set_name(&entry->kobj, "%i", entry->subindex)) {
if (kobject_set_name(&entry->kobj, "%02X", entry->subindex)) {
EC_ERR("Failed to set kobj name.\n");
kobject_put(&entry->kobj);
return -1;

View File

@ -800,10 +800,10 @@ ssize_t ec_slave_info(const ec_slave_t *slave, /**< EtherCAT slave */
list_for_each_entry(pdo_entry, &pdo->entries, list) {
buf += sprintf(buf,
" 0x%04X:%X \"%s\", %u bit\n",
" 0x%04X:%02X, %u bit, \"%s\"\n",
pdo_entry->index, pdo_entry->subindex,
pdo_entry->name ? pdo_entry->name : "???",
pdo_entry->bit_length);
pdo_entry->bit_length,
pdo_entry->name ? pdo_entry->name : "???");
}
}
}
@ -825,10 +825,10 @@ ssize_t ec_slave_info(const ec_slave_t *slave, /**< EtherCAT slave */
buf += sprintf(buf, ", no default assignment.\n");
list_for_each_entry(pdo_entry, &pdo->entries, list) {
buf += sprintf(buf, " 0x%04X:%X \"%s\", %u bit\n",
buf += sprintf(buf, " 0x%04X:%02X, %u bit, \"%s\"\n",
pdo_entry->index, pdo_entry->subindex,
pdo_entry->name ? pdo_entry->name : "???",
pdo_entry->bit_length);
pdo_entry->bit_length,
pdo_entry->name ? pdo_entry->name : "???");
}
}
buf += sprintf(buf, "\n");

View File

@ -259,7 +259,7 @@ ssize_t ec_slave_config_info(
pdo->index, pdo->name ? pdo->name : "???");
list_for_each_entry(entry, &pdo->entries, list) {
buf += sprintf(buf, " 0x%04X:%X \"%s\", %u bit\n",
buf += sprintf(buf, " 0x%04X:%02X \"%s\", %u bit\n",
entry->index, entry->subindex,
entry->name ? entry->name : "???",
entry->bit_length);
@ -279,7 +279,7 @@ ssize_t ec_slave_config_info(
case 4: sprintf(str, "%u", EC_READ_U32(req->data)); break;
default: sprintf(str, "(invalid size)"); break;
}
buf += sprintf(buf, " 0x%04X:%-3i -> %s\n",
buf += sprintf(buf, " 0x%04X:%02X -> %s\n",
req->index, req->subindex, str);
}
buf += sprintf(buf, "\n");
@ -290,7 +290,7 @@ ssize_t ec_slave_config_info(
buf += sprintf(buf, "\nSdo requests:\n");
list_for_each_entry(req, &sc->sdo_requests, list) {
buf += sprintf(buf, " 0x%04X:%u\n", req->index, req->subindex);
buf += sprintf(buf, " 0x%04X:%02X\n", req->index, req->subindex);
}
buf += sprintf(buf, "\n");
}
@ -462,7 +462,7 @@ void ec_slave_config_load_default_mapping(
if (sc->master->debug_level) {
const ec_pdo_entry_t *entry;
list_for_each_entry(entry, &pdo->entries, list) {
EC_DBG(" Entry 0x%04X:%u.\n",
EC_DBG(" Entry 0x%04X:%02X.\n",
entry->index, entry->subindex);
}
}
@ -512,7 +512,7 @@ int ecrt_slave_config_pdo_mapping_add(ec_slave_config_t *sc,
ec_pdo_t *pdo;
if (sc->master->debug_level)
EC_DBG("Adding Pdo entry 0x%04X:%u (%u bit) to mapping of Pdo"
EC_DBG("Adding Pdo entry 0x%04X:%02X (%u bit) to mapping of Pdo"
" 0x%04X, config %u:%u.\n", entry_index, entry_subindex,
entry_bit_length, pdo_index, sc->alias, sc->position);
@ -632,7 +632,7 @@ int ecrt_slave_config_reg_pdo_entry(
}
}
EC_ERR("Pdo entry 0x%04X:%u is not mapped in slave config %u:%u.\n",
EC_ERR("Pdo entry 0x%04X:%02X is not mapped in slave config %u:%u.\n",
index, subindex, sc->alias, sc->position);
return -1;
@ -645,7 +645,7 @@ found:
if (bit_position) {
*bit_position = bit_pos;
} else if (bit_pos) {
EC_ERR("Pdo entry 0x%04X:%X does not byte-align in config %u:%u.\n",
EC_ERR("Pdo entry 0x%04X:%02X does not byte-align in config %u:%u.\n",
index, subindex, sc->alias, sc->position);
return -3;
}