1555 } |
1555 } |
1556 |
1556 |
1557 /*****************************************************************************/ |
1557 /*****************************************************************************/ |
1558 |
1558 |
1559 /** |
1559 /** |
|
1560 * Obtains a slave pointer by its ring position. |
|
1561 * A valid slave pointer is only returned, if vendor ID and product code are |
|
1562 * matching. |
|
1563 * \return pointer to the slave on success, else NULL |
|
1564 * \ingroup RealtimeInterface |
|
1565 */ |
|
1566 |
|
1567 ec_slave_t *ecrt_master_get_slave_by_pos( |
|
1568 const ec_master_t *master, /**< EtherCAT master */ |
|
1569 uint16_t ring_position, /**< ring position */ |
|
1570 uint32_t vendor_id, /**< vendor ID */ |
|
1571 uint32_t product_code /**< product code */ |
|
1572 ) |
|
1573 { |
|
1574 ec_slave_t *slave; |
|
1575 unsigned int found = 0; |
|
1576 |
|
1577 list_for_each_entry(slave, &master->slaves, list) { |
|
1578 if (slave->ring_position == ring_position) { |
|
1579 found = 1; |
|
1580 break; |
|
1581 } |
|
1582 } |
|
1583 |
|
1584 if (!found) { |
|
1585 EC_ERR("Slave index out of range!\n"); |
|
1586 return NULL; |
|
1587 } |
|
1588 |
|
1589 return ec_slave_validate(slave, vendor_id, product_code) ? NULL : slave; |
|
1590 } |
|
1591 |
|
1592 /*****************************************************************************/ |
|
1593 |
|
1594 /** |
1560 Sets the locking callbacks. |
1595 Sets the locking callbacks. |
1561 The request_cb function must return zero, to allow another instance |
1596 The request_cb function must return zero, to allow another instance |
1562 (the EoE process for example) to access the master. Non-zero means, |
1597 (the EoE process for example) to access the master. Non-zero means, |
1563 that access is forbidden at this time. |
1598 that access is forbidden at this time. |
1564 \ingroup RealtimeInterface |
1599 \ingroup RealtimeInterface |
1600 EXPORT_SYMBOL(ecrt_master_activate); |
1635 EXPORT_SYMBOL(ecrt_master_activate); |
1601 EXPORT_SYMBOL(ecrt_master_send); |
1636 EXPORT_SYMBOL(ecrt_master_send); |
1602 EXPORT_SYMBOL(ecrt_master_receive); |
1637 EXPORT_SYMBOL(ecrt_master_receive); |
1603 EXPORT_SYMBOL(ecrt_master_callbacks); |
1638 EXPORT_SYMBOL(ecrt_master_callbacks); |
1604 EXPORT_SYMBOL(ecrt_master_get_slave); |
1639 EXPORT_SYMBOL(ecrt_master_get_slave); |
|
1640 EXPORT_SYMBOL(ecrt_master_get_slave_by_pos); |
1605 EXPORT_SYMBOL(ecrt_master_get_status); |
1641 EXPORT_SYMBOL(ecrt_master_get_status); |
1606 |
1642 |
1607 /** \endcond */ |
1643 /** \endcond */ |
1608 |
1644 |
1609 /*****************************************************************************/ |
1645 /*****************************************************************************/ |