Added ecrt_master_get_slave_by_pos().
This commit is contained in:
parent
1c2ac14987
commit
808ad3e2f1
2
NEWS
2
NEWS
|
|
@ -26,6 +26,8 @@ Changes in version 1.3.0:
|
|||
- ecrt_master_get_slave() got additional parameters to check for vendor ID
|
||||
and product code.
|
||||
- Removed addressing scheme "X:Y" for ecrt_master_get_slave().
|
||||
- Added ecrt_master_get_slave_by_pos() to avoid the string handling of
|
||||
ecrt_master_get_slave().
|
||||
- Added ecrt_master_get_status() to get status information about the bus.
|
||||
- Added functions to set up an alternative PDO mapping for a slave, i. e.
|
||||
ec_slave_pdo_mapping_clear(), ec_slave_pdo_mapping_add() and
|
||||
|
|
|
|||
1
TODO
1
TODO
|
|
@ -8,7 +8,6 @@ $Id$
|
|||
|
||||
* Issues for release 1.3.0:
|
||||
- Take broadcast MAC address to register the first ethernet device.
|
||||
- Implement ecrt_get_slave() with integer argument as ring position.
|
||||
- Handle missing rc_status in init script.
|
||||
|
||||
* Future features:
|
||||
|
|
|
|||
|
|
@ -147,6 +147,8 @@ ec_domain_t *ecrt_master_create_domain(ec_master_t *master);
|
|||
|
||||
ec_slave_t *ecrt_master_get_slave(const ec_master_t *, const char *,
|
||||
uint32_t vendor_id, uint32_t product_code);
|
||||
ec_slave_t *ecrt_master_get_slave_by_pos(const ec_master_t *, uint16_t,
|
||||
uint32_t vendor_id, uint32_t product_code);
|
||||
|
||||
int ecrt_master_activate(ec_master_t *master);
|
||||
|
||||
|
|
|
|||
|
|
@ -1556,6 +1556,41 @@ ec_slave_t *ecrt_master_get_slave(
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Obtains a slave pointer by its ring position.
|
||||
* A valid slave pointer is only returned, if vendor ID and product code are
|
||||
* matching.
|
||||
* \return pointer to the slave on success, else NULL
|
||||
* \ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
ec_slave_t *ecrt_master_get_slave_by_pos(
|
||||
const ec_master_t *master, /**< EtherCAT master */
|
||||
uint16_t ring_position, /**< ring position */
|
||||
uint32_t vendor_id, /**< vendor ID */
|
||||
uint32_t product_code /**< product code */
|
||||
)
|
||||
{
|
||||
ec_slave_t *slave;
|
||||
unsigned int found = 0;
|
||||
|
||||
list_for_each_entry(slave, &master->slaves, list) {
|
||||
if (slave->ring_position == ring_position) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
EC_ERR("Slave index out of range!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ec_slave_validate(slave, vendor_id, product_code) ? NULL : slave;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Sets the locking callbacks.
|
||||
The request_cb function must return zero, to allow another instance
|
||||
|
|
@ -1602,6 +1637,7 @@ EXPORT_SYMBOL(ecrt_master_send);
|
|||
EXPORT_SYMBOL(ecrt_master_receive);
|
||||
EXPORT_SYMBOL(ecrt_master_callbacks);
|
||||
EXPORT_SYMBOL(ecrt_master_get_slave);
|
||||
EXPORT_SYMBOL(ecrt_master_get_slave_by_pos);
|
||||
EXPORT_SYMBOL(ecrt_master_get_status);
|
||||
|
||||
/** \endcond */
|
||||
|
|
|
|||
Loading…
Reference in New Issue