Verbosity level in ecrt_master_print().
This commit is contained in:
parent
0bea90e379
commit
d919deed4b
|
|
@ -62,7 +62,7 @@ void ecrt_master_async_receive(ec_master_t *master);
|
|||
void ecrt_master_prepare_async_io(ec_master_t *master);
|
||||
|
||||
void ecrt_master_debug(ec_master_t *master, int level);
|
||||
void ecrt_master_print(const ec_master_t *master);
|
||||
void ecrt_master_print(const ec_master_t *master, unsigned int verbosity);
|
||||
|
||||
ec_slave_t *ecrt_master_get_slave(const ec_master_t *, const char *);
|
||||
|
||||
|
|
|
|||
|
|
@ -1169,15 +1169,22 @@ void ecrt_master_debug(ec_master_t *master, /**< EtherCAT-Master */
|
|||
|
||||
/**
|
||||
Gibt alle Informationen zum Master aus.
|
||||
|
||||
Verbosity:
|
||||
0 - Nur Slavetypen und Adressen
|
||||
1 - mit EEPROM-Informationen
|
||||
>1 - mit SDO-Dictionaries
|
||||
*/
|
||||
|
||||
void ecrt_master_print(const ec_master_t *master /**< EtherCAT-Master */)
|
||||
void ecrt_master_print(const ec_master_t *master, /**< EtherCAT-Master */
|
||||
unsigned int verbosity /**< Geschwätzigkeit */
|
||||
)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
EC_INFO("*** Begin master information ***\n");
|
||||
for (i = 0; i < master->slave_count; i++)
|
||||
ec_slave_print(&master->slaves[i]);
|
||||
ec_slave_print(&master->slaves[i], verbosity);
|
||||
EC_INFO("*** End master information ***\n");
|
||||
}
|
||||
|
||||
|
|
|
|||
191
master/slave.c
191
master/slave.c
|
|
@ -853,9 +853,16 @@ int ec_slave_set_fmmu(ec_slave_t *slave, /**< EtherCAT-Slave */
|
|||
|
||||
/**
|
||||
Gibt alle Informationen über einen EtherCAT-Slave aus.
|
||||
|
||||
Verbosity:
|
||||
0 - Nur Slavetypen und Adressen
|
||||
1 - mit EEPROM-Informationen
|
||||
>1 - mit SDO-Dictionaries
|
||||
*/
|
||||
|
||||
void ec_slave_print(const ec_slave_t *slave /**< EtherCAT-Slave */)
|
||||
void ec_slave_print(const ec_slave_t *slave, /**< EtherCAT-Slave */
|
||||
unsigned int verbosity /**< Geschwätzigkeit */
|
||||
)
|
||||
{
|
||||
ec_eeprom_sync_t *sync;
|
||||
ec_eeprom_pdo_t *pdo;
|
||||
|
|
@ -878,105 +885,111 @@ void ec_slave_print(const ec_slave_t *slave /**< EtherCAT-Slave */)
|
|||
EC_INFO("| Ring position: %i, Station address: 0x%04X\n",
|
||||
slave->ring_position, slave->station_address);
|
||||
|
||||
EC_INFO("| Base information:\n");
|
||||
EC_INFO("| Type %u, Revision %i, Build %i\n",
|
||||
slave->base_type, slave->base_revision, slave->base_build);
|
||||
EC_INFO("| Supported FMMUs: %i, Sync managers: %i\n",
|
||||
slave->base_fmmu_count, slave->base_sync_count);
|
||||
if (verbosity > 0) // Etwas geschwätziger
|
||||
{
|
||||
EC_INFO("| Base information:\n");
|
||||
EC_INFO("| Type %u, Revision %i, Build %i\n",
|
||||
slave->base_type, slave->base_revision, slave->base_build);
|
||||
EC_INFO("| Supported FMMUs: %i, Sync managers: %i\n",
|
||||
slave->base_fmmu_count, slave->base_sync_count);
|
||||
|
||||
if (slave->sii_mailbox_protocols) {
|
||||
EC_INFO("| Mailbox communication:\n");
|
||||
EC_INFO("| RX mailbox: 0x%04X/%i, TX mailbox: 0x%04X/%i\n",
|
||||
slave->sii_rx_mailbox_offset, slave->sii_rx_mailbox_size,
|
||||
slave->sii_tx_mailbox_offset, slave->sii_tx_mailbox_size);
|
||||
EC_INFO("| Supported protocols: ");
|
||||
if (slave->sii_mailbox_protocols) {
|
||||
EC_INFO("| Mailbox communication:\n");
|
||||
EC_INFO("| RX mailbox: 0x%04X/%i, TX mailbox: 0x%04X/%i\n",
|
||||
slave->sii_rx_mailbox_offset, slave->sii_rx_mailbox_size,
|
||||
slave->sii_tx_mailbox_offset, slave->sii_tx_mailbox_size);
|
||||
EC_INFO("| Supported protocols: ");
|
||||
|
||||
first = 1;
|
||||
if (slave->sii_mailbox_protocols & EC_MBOX_AOE) {
|
||||
printk("AoE");
|
||||
first = 0;
|
||||
first = 1;
|
||||
if (slave->sii_mailbox_protocols & EC_MBOX_AOE) {
|
||||
printk("AoE");
|
||||
first = 0;
|
||||
}
|
||||
if (slave->sii_mailbox_protocols & EC_MBOX_EOE) {
|
||||
if (!first) printk(", ");
|
||||
printk("EoE");
|
||||
first = 0;
|
||||
}
|
||||
if (slave->sii_mailbox_protocols & EC_MBOX_COE) {
|
||||
if (!first) printk(", ");
|
||||
printk("CoE");
|
||||
first = 0;
|
||||
}
|
||||
if (slave->sii_mailbox_protocols & EC_MBOX_FOE) {
|
||||
if (!first) printk(", ");
|
||||
printk("FoE");
|
||||
first = 0;
|
||||
}
|
||||
if (slave->sii_mailbox_protocols & EC_MBOX_SOE) {
|
||||
if (!first) printk(", ");
|
||||
printk("SoE");
|
||||
first = 0;
|
||||
}
|
||||
if (slave->sii_mailbox_protocols & EC_MBOX_VOE) {
|
||||
if (!first) printk(", ");
|
||||
printk("VoE");
|
||||
}
|
||||
printk("\n");
|
||||
}
|
||||
if (slave->sii_mailbox_protocols & EC_MBOX_EOE) {
|
||||
if (!first) printk(", ");
|
||||
printk("EoE");
|
||||
first = 0;
|
||||
}
|
||||
if (slave->sii_mailbox_protocols & EC_MBOX_COE) {
|
||||
if (!first) printk(", ");
|
||||
printk("CoE");
|
||||
first = 0;
|
||||
}
|
||||
if (slave->sii_mailbox_protocols & EC_MBOX_FOE) {
|
||||
if (!first) printk(", ");
|
||||
printk("FoE");
|
||||
first = 0;
|
||||
}
|
||||
if (slave->sii_mailbox_protocols & EC_MBOX_SOE) {
|
||||
if (!first) printk(", ");
|
||||
printk("SoE");
|
||||
first = 0;
|
||||
}
|
||||
if (slave->sii_mailbox_protocols & EC_MBOX_VOE) {
|
||||
if (!first) printk(", ");
|
||||
printk("VoE");
|
||||
}
|
||||
printk("\n");
|
||||
}
|
||||
|
||||
EC_INFO("| EEPROM data:\n");
|
||||
EC_INFO("| EEPROM data:\n");
|
||||
|
||||
if (slave->sii_alias)
|
||||
EC_INFO("| Configured station alias: 0x%04X (%i)\n",
|
||||
slave->sii_alias, slave->sii_alias);
|
||||
if (slave->sii_alias)
|
||||
EC_INFO("| Configured station alias: 0x%04X (%i)\n",
|
||||
slave->sii_alias, slave->sii_alias);
|
||||
|
||||
EC_INFO("| Vendor-ID: 0x%08X, Product code: 0x%08X\n",
|
||||
slave->sii_vendor_id, slave->sii_product_code);
|
||||
EC_INFO("| Revision number: 0x%08X, Serial number: 0x%08X\n",
|
||||
slave->sii_revision_number, slave->sii_serial_number);
|
||||
EC_INFO("| Vendor-ID: 0x%08X, Product code: 0x%08X\n",
|
||||
slave->sii_vendor_id, slave->sii_product_code);
|
||||
EC_INFO("| Revision number: 0x%08X, Serial number: 0x%08X\n",
|
||||
slave->sii_revision_number, slave->sii_serial_number);
|
||||
|
||||
if (slave->eeprom_name)
|
||||
EC_INFO("| Name: %s\n", slave->eeprom_name);
|
||||
if (slave->eeprom_group)
|
||||
EC_INFO("| Group: %s\n", slave->eeprom_group);
|
||||
if (slave->eeprom_desc)
|
||||
EC_INFO("| Description: %s\n", slave->eeprom_desc);
|
||||
if (slave->eeprom_name)
|
||||
EC_INFO("| Name: %s\n", slave->eeprom_name);
|
||||
if (slave->eeprom_group)
|
||||
EC_INFO("| Group: %s\n", slave->eeprom_group);
|
||||
if (slave->eeprom_desc)
|
||||
EC_INFO("| Description: %s\n", slave->eeprom_desc);
|
||||
|
||||
if (!list_empty(&slave->eeprom_syncs)) {
|
||||
EC_INFO("| Sync-Managers:\n");
|
||||
list_for_each_entry(sync, &slave->eeprom_syncs, list) {
|
||||
EC_INFO("| %i: 0x%04X, length %i, control 0x%02X, %s\n",
|
||||
sync->index, sync->physical_start_address, sync->length,
|
||||
sync->control_register,
|
||||
sync->enable ? "enable" : "disable");
|
||||
if (!list_empty(&slave->eeprom_syncs)) {
|
||||
EC_INFO("| Sync-Managers:\n");
|
||||
list_for_each_entry(sync, &slave->eeprom_syncs, list) {
|
||||
EC_INFO("| %i: 0x%04X, length %i, control 0x%02X, %s\n",
|
||||
sync->index, sync->physical_start_address,
|
||||
sync->length, sync->control_register,
|
||||
sync->enable ? "enable" : "disable");
|
||||
}
|
||||
}
|
||||
|
||||
list_for_each_entry(pdo, &slave->eeprom_pdos, list) {
|
||||
EC_INFO("| %s \"%s\" (0x%04X), -> Sync-Manager %i\n",
|
||||
pdo->type == EC_RX_PDO ? "RXPDO" : "TXPDO",
|
||||
pdo->name ? pdo->name : "???",
|
||||
pdo->index, pdo->sync_manager);
|
||||
|
||||
list_for_each_entry(pdo_entry, &pdo->entries, list) {
|
||||
EC_INFO("| \"%s\" 0x%04X:%X, %i Bit\n",
|
||||
pdo_entry->name ? pdo_entry->name : "???",
|
||||
pdo_entry->index, pdo_entry->subindex,
|
||||
pdo_entry->bit_length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
list_for_each_entry(pdo, &slave->eeprom_pdos, list) {
|
||||
EC_INFO("| %s \"%s\" (0x%04X), -> Sync-Manager %i\n",
|
||||
pdo->type == EC_RX_PDO ? "RXPDO" : "TXPDO",
|
||||
pdo->name ? pdo->name : "???",
|
||||
pdo->index, pdo->sync_manager);
|
||||
|
||||
list_for_each_entry(pdo_entry, &pdo->entries, list) {
|
||||
EC_INFO("| \"%s\" 0x%04X:%X, %i Bit\n",
|
||||
pdo_entry->name ? pdo_entry->name : "???",
|
||||
pdo_entry->index, pdo_entry->subindex,
|
||||
pdo_entry->bit_length);
|
||||
}
|
||||
}
|
||||
|
||||
if (!list_empty(&slave->sdo_dictionary)) {
|
||||
EC_INFO("| SDO-Dictionary:\n");
|
||||
list_for_each_entry(sdo, &slave->sdo_dictionary, list) {
|
||||
EC_INFO("| 0x%04X \"%s\"\n", sdo->index,
|
||||
sdo->name ? sdo->name : "");
|
||||
EC_INFO("| Type 0x%04X, features: 0x%02X\n",
|
||||
sdo->type, sdo->features);
|
||||
list_for_each_entry(sdo_entry, &sdo->entries, list) {
|
||||
EC_INFO("| 0x%04X:%i \"%s\", type 0x%04X, %i bits\n",
|
||||
sdo->index, sdo_entry->subindex,
|
||||
sdo_entry->name ? sdo_entry->name : "",
|
||||
sdo_entry->data_type, sdo_entry->bit_length);
|
||||
if (verbosity > 1) // sehr geschwätzig
|
||||
{
|
||||
if (!list_empty(&slave->sdo_dictionary)) {
|
||||
EC_INFO("| SDO-Dictionary:\n");
|
||||
list_for_each_entry(sdo, &slave->sdo_dictionary, list) {
|
||||
EC_INFO("| 0x%04X \"%s\"\n", sdo->index,
|
||||
sdo->name ? sdo->name : "");
|
||||
EC_INFO("| Type 0x%04X, features: 0x%02X\n",
|
||||
sdo->type, sdo->features);
|
||||
list_for_each_entry(sdo_entry, &sdo->entries, list) {
|
||||
EC_INFO("| 0x%04X:%i \"%s\", type 0x%04X, %i bits\n",
|
||||
sdo->index, sdo_entry->subindex,
|
||||
sdo_entry->name ? sdo_entry->name : "",
|
||||
sdo_entry->data_type, sdo_entry->bit_length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ int ec_slave_mailbox_receive(ec_slave_t *, uint8_t, uint8_t *, size_t *);
|
|||
int ec_slave_fetch_sdo_list(ec_slave_t *);
|
||||
|
||||
// Misc
|
||||
void ec_slave_print(const ec_slave_t *);
|
||||
void ec_slave_print(const ec_slave_t *, unsigned int);
|
||||
int ec_slave_check_crc(ec_slave_t *);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
14
mini/mini.c
14
mini/mini.c
|
|
@ -98,10 +98,7 @@ int __init init_mini_module(void)
|
|||
goto out_return;
|
||||
}
|
||||
|
||||
ecrt_master_print(master);
|
||||
|
||||
printk(KERN_INFO "Registering domain...\n");
|
||||
|
||||
if (!(domain1 = ecrt_master_create_domain(master)))
|
||||
{
|
||||
printk(KERN_ERR "Domain creation failed!\n");
|
||||
|
|
@ -109,25 +106,27 @@ int __init init_mini_module(void)
|
|||
}
|
||||
|
||||
printk(KERN_INFO "Registering domain fields...\n");
|
||||
|
||||
if (ecrt_domain_register_field_list(domain1, domain1_fields)) {
|
||||
printk(KERN_ERR "Field registration failed!\n");
|
||||
goto out_release_master;
|
||||
}
|
||||
|
||||
printk(KERN_INFO "Activating master...\n");
|
||||
|
||||
if (ecrt_master_activate(master)) {
|
||||
printk(KERN_ERR "Failed to activate master!\n");
|
||||
goto out_release_master;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (ecrt_master_fetch_sdo_lists(master)) {
|
||||
printk(KERN_ERR "Failed to fetch SDO lists!\n");
|
||||
goto out_deactivate;
|
||||
}
|
||||
ecrt_master_print(master, 2);
|
||||
#else
|
||||
ecrt_master_print(master, 0);
|
||||
#endif
|
||||
|
||||
//ecrt_master_debug(master, 2);
|
||||
|
||||
#if 0
|
||||
if (!(slave = ecrt_master_get_slave(master, "5"))) {
|
||||
|
|
@ -149,8 +148,6 @@ int __init init_mini_module(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
//ecrt_master_debug(master, 0);
|
||||
|
||||
#if 0
|
||||
printk(KERN_INFO "Writing alias...\n");
|
||||
if (ecrt_slave_sdo_write_exp16(slave, 0xBEEF)) {
|
||||
|
|
@ -165,7 +162,6 @@ int __init init_mini_module(void)
|
|||
#endif
|
||||
|
||||
printk("Starting cyclic sample thread.\n");
|
||||
|
||||
init_timer(&timer);
|
||||
timer.function = run;
|
||||
timer.expires = jiffies + 10; // Das erste Mal sofort feuern
|
||||
|
|
|
|||
|
|
@ -200,36 +200,33 @@ int __init init_rt_module(void)
|
|||
}
|
||||
|
||||
printk(KERN_INFO "Registering domains...\n");
|
||||
|
||||
if (!(domain1 = ecrt_master_create_domain(master))) {
|
||||
printk(KERN_ERR "Could not register domain!\n");
|
||||
goto out_release_master;
|
||||
}
|
||||
|
||||
printk(KERN_INFO "Registering domain fields...\n");
|
||||
|
||||
if (ecrt_domain_register_field_list(domain1, domain1_fields)) {
|
||||
printk(KERN_ERR "Failed to register domain fields.\n");
|
||||
goto out_release_master;
|
||||
}
|
||||
|
||||
printk(KERN_INFO "Activating master...\n");
|
||||
|
||||
if (ecrt_master_activate(master)) {
|
||||
printk(KERN_ERR "Could not activate master!\n");
|
||||
goto out_release_master;
|
||||
}
|
||||
|
||||
ecrt_master_print(master);
|
||||
|
||||
//ecrt_master_debug(master, 2);
|
||||
#if 0
|
||||
if (ecrt_master_fetch_sdo_lists(master)) {
|
||||
printk(KERN_ERR "Failed to fetch SDO lists!\n");
|
||||
goto out_deactivate;
|
||||
}
|
||||
//ecrt_master_debug(master, 0);
|
||||
ecrt_master_print(master, 2);
|
||||
#else
|
||||
ecrt_master_print(master, 0);
|
||||
#endif
|
||||
|
||||
ecrt_master_print(master);
|
||||
|
||||
#ifdef BLOCK1
|
||||
if (!(slave = ecrt_master_get_slave(master, "1"))) {
|
||||
|
|
@ -287,7 +284,6 @@ int __init init_rt_module(void)
|
|||
attr.priority = IPIPE_ROOT_PRIO + 1;
|
||||
attr.entry = &domain_entry;
|
||||
ipipe_register_domain(&this_domain, &attr);
|
||||
|
||||
return 0;
|
||||
|
||||
out_deactivate:
|
||||
|
|
|
|||
Loading…
Reference in New Issue