Added ec_slave_get_sdo() and ec_sdo_get_entry().
This commit is contained in:
parent
0fe3931b47
commit
2a9c3f1fd2
|
|
@ -171,6 +171,23 @@ void ec_sdo_clear(struct kobject *kobj /**< SDO's kobject */)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
ec_sdo_entry_t *ec_sdo_get_entry(
|
||||
ec_sdo_t *sdo,
|
||||
uint8_t subindex
|
||||
)
|
||||
{
|
||||
ec_sdo_entry_t *entry;
|
||||
|
||||
list_for_each_entry(entry, &sdo->entries, list) {
|
||||
if (entry->subindex != subindex) continue;
|
||||
return entry;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
ssize_t ec_sdo_info(ec_sdo_t *sdo, /**< SDO */
|
||||
char *buffer /**< target buffer */
|
||||
)
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
CANopen SDO.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
struct ec_sdo
|
||||
{
|
||||
struct kobject kobj; /**< kobject */
|
||||
struct list_head list; /**< list item */
|
||||
|
|
@ -63,8 +63,7 @@ typedef struct
|
|||
char *name; /**< SDO name */
|
||||
uint8_t subindices; /**< subindices */
|
||||
struct list_head entries; /**< entry list */
|
||||
}
|
||||
ec_sdo_t;
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -120,6 +119,7 @@ ec_sdo_request_t;
|
|||
|
||||
int ec_sdo_init(ec_sdo_t *, uint16_t, ec_slave_t *);
|
||||
void ec_sdo_destroy(ec_sdo_t *);
|
||||
ec_sdo_entry_t *ec_sdo_get_entry(ec_sdo_t *, uint8_t);
|
||||
|
||||
int ec_sdo_entry_init(ec_sdo_entry_t *, uint8_t, ec_sdo_t *);
|
||||
void ec_sdo_entry_destroy(ec_sdo_entry_t *);
|
||||
|
|
|
|||
|
|
@ -201,4 +201,8 @@ ec_request_state_t;
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct ec_sdo ec_sdo_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1270,6 +1270,28 @@ void ec_slave_sdo_dict_info(const ec_slave_t *slave, /**< EtherCAT slave */
|
|||
*entry_count = entries;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Get an SDO from the dictionary.
|
||||
* \returns The desired SDO, of NULL.
|
||||
*/
|
||||
|
||||
ec_sdo_t *ec_slave_get_sdo(
|
||||
ec_slave_t *slave /**< EtherCAT slave */,
|
||||
uint16_t index /**< SDO index */
|
||||
)
|
||||
{
|
||||
ec_sdo_t *sdo;
|
||||
|
||||
list_for_each_entry(sdo, &slave->sdo_dictionary, list) {
|
||||
if (sdo->index != index) continue;
|
||||
return sdo;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* Realtime interface
|
||||
*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -205,6 +205,7 @@ ec_sync_t *ec_slave_get_pdo_sync(ec_slave_t *, ec_direction_t);
|
|||
int ec_slave_validate(const ec_slave_t *, uint32_t, uint32_t);
|
||||
void ec_slave_sdo_dict_info(const ec_slave_t *,
|
||||
unsigned int *, unsigned int *);
|
||||
ec_sdo_t *ec_slave_get_sdo(ec_slave_t *, uint16_t);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue