Attach Pdo names from dictionary.
This commit is contained in:
parent
3ed38e1dc2
commit
e647297b12
2
TODO
2
TODO
|
|
@ -8,9 +8,9 @@ $Id$
|
|||
|
||||
Version 1.4.0:
|
||||
|
||||
* Attach Pdo names from SII or Coe dictionary to Pdos read via CoE.
|
||||
* Update documentation.
|
||||
* Check for possible race condition in jiffy-based frame timeout calculation.
|
||||
* Use down_interruptible() for cdev calls.
|
||||
|
||||
Future issues:
|
||||
|
||||
|
|
|
|||
|
|
@ -818,6 +818,9 @@ void ec_fsm_master_state_sdo_dictionary(
|
|||
sdo_count, entry_count, slave->ring_position);
|
||||
}
|
||||
|
||||
// attach pdo names from dictionary
|
||||
ec_slave_attach_pdo_names(slave);
|
||||
|
||||
ec_fsm_master_restart(fsm);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -119,6 +119,9 @@ int ec_pdo_set_name(
|
|||
{
|
||||
unsigned int len;
|
||||
|
||||
if (pdo->name && name && !strcmp(pdo->name, name))
|
||||
return 0;
|
||||
|
||||
if (pdo->name)
|
||||
kfree(pdo->name);
|
||||
|
||||
|
|
|
|||
|
|
@ -94,6 +94,9 @@ int ec_pdo_entry_set_name(
|
|||
{
|
||||
unsigned int len;
|
||||
|
||||
if (entry->name && name && !strcmp(entry->name, name))
|
||||
return 0;
|
||||
|
||||
if (entry->name)
|
||||
kfree(entry->name);
|
||||
|
||||
|
|
|
|||
|
|
@ -667,3 +667,54 @@ const ec_pdo_t *ec_slave_find_pdo(
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Find name for a Pdo and its entries.
|
||||
*/
|
||||
void ec_slave_find_names_for_pdo(
|
||||
ec_slave_t *slave,
|
||||
ec_pdo_t *pdo
|
||||
)
|
||||
{
|
||||
const ec_sdo_t *sdo;
|
||||
ec_pdo_entry_t *pdo_entry;
|
||||
const ec_sdo_entry_t *sdo_entry;
|
||||
|
||||
list_for_each_entry(sdo, &slave->sdo_dictionary, list) {
|
||||
if (sdo->index == pdo->index) {
|
||||
ec_pdo_set_name(pdo, sdo->name);
|
||||
} else {
|
||||
list_for_each_entry(pdo_entry, &pdo->entries, list) {
|
||||
if (sdo->index == pdo_entry->index) {
|
||||
sdo_entry = ec_sdo_get_entry_const(
|
||||
sdo, pdo_entry->subindex);
|
||||
if (sdo_entry) {
|
||||
ec_pdo_entry_set_name(pdo_entry,
|
||||
sdo_entry->description);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Attach Pdo names.
|
||||
*/
|
||||
void ec_slave_attach_pdo_names(
|
||||
ec_slave_t *slave
|
||||
)
|
||||
{
|
||||
unsigned int i;
|
||||
ec_sync_t *sync;
|
||||
ec_pdo_t *pdo;
|
||||
|
||||
for (i = 0; i < slave->sii.sync_count; i++) {
|
||||
sync = slave->sii.syncs + i;
|
||||
list_for_each_entry(pdo, &sync->pdos.list, list) {
|
||||
ec_slave_find_names_for_pdo(slave, pdo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@ const ec_sdo_t *ec_slave_get_sdo_const(const ec_slave_t *, uint16_t);
|
|||
const ec_sdo_t *ec_slave_get_sdo_by_pos_const(const ec_slave_t *, uint16_t);
|
||||
uint16_t ec_slave_sdo_count(const ec_slave_t *);
|
||||
const ec_pdo_t *ec_slave_find_pdo(const ec_slave_t *, uint16_t);
|
||||
void ec_slave_attach_pdo_names(ec_slave_t *);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue