198 << hex << setw(8) << config.vendor_id << endl |
198 << hex << setw(8) << config.vendor_id << endl |
199 << "Product code: 0x" |
199 << "Product code: 0x" |
200 << hex << setw(8) << config.product_code << endl |
200 << hex << setw(8) << config.product_code << endl |
201 << "Attached: " << (config.attached ? "yes" : "no") << endl; |
201 << "Attached: " << (config.attached ? "yes" : "no") << endl; |
202 |
202 |
203 for (j = 0; j < 2; j++) { |
203 for (j = 0; j < 16; j++) { |
204 if (config.pdo_count[j]) { |
204 if (config.syncs[j].pdo_count) { |
205 cout << (j ? "Input" : "Output") |
205 cout << "SM" << dec << j << " (" |
206 << " Pdo assignment / mapping " << endl; |
206 << (config.syncs[j].dir == EC_DIR_INPUT |
207 for (k = 0; k < config.pdo_count[j]; k++) { |
207 ? "Input" : "Output") << ")" << endl; |
|
208 for (k = 0; k < config.syncs[j].pdo_count; k++) { |
208 getConfigPdo(&pdo, i, j, k); |
209 getConfigPdo(&pdo, i, j, k); |
209 |
210 |
210 cout << " Pdo 0x" |
211 cout << " Pdo 0x" |
211 << hex << setfill('0') << setw(4) << pdo.index |
212 << hex << setfill('0') << setw(4) << pdo.index |
212 << " \"" << pdo.name << "\"" << endl; |
213 << " \"" << pdo.name << "\"" << endl; |
1188 getFmmu(&fmmu, domainIndex, i); |
1189 getFmmu(&fmmu, domainIndex, i); |
1189 |
1190 |
1190 cout << " SlaveConfig " |
1191 cout << " SlaveConfig " |
1191 << fmmu.slave_config_alias << ":" << fmmu.slave_config_position |
1192 << fmmu.slave_config_alias << ":" << fmmu.slave_config_position |
1192 << ", Dir " |
1193 << ", Dir " |
1193 << setfill(' ') << setw(3) << (fmmu.fmmu_dir ? "In" : "Out") |
1194 << setfill(' ') << setw(3) << (fmmu.dir == EC_DIR_INPUT ? "In" : "Out") |
1194 << ", LogAddr 0x" |
1195 << ", LogAddr 0x" |
1195 << hex << setfill('0') << setw(8) << fmmu.logical_address |
1196 << hex << setfill('0') << setw(8) << fmmu.logical_address |
1196 << ", Size " << dec << fmmu.data_size << endl; |
1197 << ", Size " << dec << fmmu.data_size << endl; |
1197 |
1198 |
1198 dataOffset = fmmu.logical_address - domain.logical_base_address; |
1199 dataOffset = fmmu.logical_address - domain.logical_base_address; |
1248 << endl; |
1249 << endl; |
1249 |
1250 |
1250 for (j = 0; j < sync.pdo_count; j++) { |
1251 for (j = 0; j < sync.pdo_count; j++) { |
1251 getPdo(&pdo, slavePosition, i, j); |
1252 getPdo(&pdo, slavePosition, i, j); |
1252 |
1253 |
1253 cout << " " << (pdo.dir ? "T" : "R") << "xPdo 0x" |
1254 cout << " " << (sync.control_register & 0x04 ? "R" : "T") |
|
1255 << "xPdo 0x" |
1254 << hex << setfill('0') << setw(4) << pdo.index |
1256 << hex << setfill('0') << setw(4) << pdo.index |
1255 << " \"" << pdo.name << "\"" << endl; |
1257 << " \"" << pdo.name << "\"" << endl; |
1256 |
1258 |
1257 if (quiet) |
1259 if (quiet) |
1258 continue; |
1260 continue; |
1421 void Master::generateSlaveXml(uint16_t slavePosition) |
1423 void Master::generateSlaveXml(uint16_t slavePosition) |
1422 { |
1424 { |
1423 ec_ioctl_slave_t slave; |
1425 ec_ioctl_slave_t slave; |
1424 ec_ioctl_sync_t sync; |
1426 ec_ioctl_sync_t sync; |
1425 ec_ioctl_pdo_t pdo; |
1427 ec_ioctl_pdo_t pdo; |
|
1428 string pdoType; |
1426 ec_ioctl_pdo_entry_t entry; |
1429 ec_ioctl_pdo_entry_t entry; |
1427 unsigned int i, j, k; |
1430 unsigned int i, j, k; |
1428 |
1431 |
1429 getSlave(&slave, slavePosition); |
1432 getSlave(&slave, slavePosition); |
1430 |
1433 |
1447 for (i = 0; i < slave.sync_count; i++) { |
1450 for (i = 0; i < slave.sync_count; i++) { |
1448 getSync(&sync, slavePosition, i); |
1451 getSync(&sync, slavePosition, i); |
1449 |
1452 |
1450 for (j = 0; j < sync.pdo_count; j++) { |
1453 for (j = 0; j < sync.pdo_count; j++) { |
1451 getPdo(&pdo, slavePosition, i, j); |
1454 getPdo(&pdo, slavePosition, i, j); |
|
1455 pdoType = (sync.control_register & 0x04 ? "R" : "T"); |
|
1456 pdoType += "xPdo"; |
1452 |
1457 |
1453 cout |
1458 cout |
1454 << " <" << (pdo.dir ? "T" : "R") << "xPdo>" << endl |
1459 << " <" << pdoType << ">" << endl |
1455 << " <Index>#x" |
1460 << " <Index>#x" |
1456 << hex << setfill('0') << setw(4) << pdo.index |
1461 << hex << setfill('0') << setw(4) << pdo.index |
1457 << "</Index>" << endl |
1462 << "</Index>" << endl |
1458 << " <Name>" << pdo.name << "</Name>" << endl; |
1463 << " <Name>" << pdo.name << "</Name>" << endl; |
1459 |
1464 |
1551 /****************************************************************************/ |
1556 /****************************************************************************/ |
1552 |
1557 |
1553 void Master::getConfigPdo( |
1558 void Master::getConfigPdo( |
1554 ec_ioctl_config_pdo_t *data, |
1559 ec_ioctl_config_pdo_t *data, |
1555 unsigned int index, |
1560 unsigned int index, |
1556 unsigned int dir, |
1561 uint8_t sync_index, |
1557 unsigned int pdo_pos |
1562 uint16_t pdo_pos |
1558 ) |
1563 ) |
1559 { |
1564 { |
1560 data->config_index = index; |
1565 data->config_index = index; |
1561 data->direction = dir; |
1566 data->sync_index = sync_index; |
1562 data->pdo_pos = pdo_pos; |
1567 data->pdo_pos = pdo_pos; |
1563 |
1568 |
1564 if (ioctl(fd, EC_IOCTL_CONFIG_PDO, data) < 0) { |
1569 if (ioctl(fd, EC_IOCTL_CONFIG_PDO, data) < 0) { |
1565 stringstream err; |
1570 stringstream err; |
1566 err << "Failed to get slave config Pdo: " << strerror(errno); |
1571 err << "Failed to get slave config Pdo: " << strerror(errno); |
1571 /****************************************************************************/ |
1576 /****************************************************************************/ |
1572 |
1577 |
1573 void Master::getConfigPdoEntry( |
1578 void Master::getConfigPdoEntry( |
1574 ec_ioctl_config_pdo_entry_t *data, |
1579 ec_ioctl_config_pdo_entry_t *data, |
1575 unsigned int index, |
1580 unsigned int index, |
1576 unsigned int dir, |
1581 uint8_t sync_index, |
1577 unsigned int pdo_pos, |
1582 uint16_t pdo_pos, |
1578 unsigned int entry_pos |
1583 uint8_t entry_pos |
1579 ) |
1584 ) |
1580 { |
1585 { |
1581 data->config_index = index; |
1586 data->config_index = index; |
1582 data->direction = dir; |
1587 data->sync_index = sync_index; |
1583 data->pdo_pos = pdo_pos; |
1588 data->pdo_pos = pdo_pos; |
1584 data->entry_pos = entry_pos; |
1589 data->entry_pos = entry_pos; |
1585 |
1590 |
1586 if (ioctl(fd, EC_IOCTL_CONFIG_PDO_ENTRY, data) < 0) { |
1591 if (ioctl(fd, EC_IOCTL_CONFIG_PDO_ENTRY, data) < 0) { |
1587 stringstream err; |
1592 stringstream err; |