50 * handler creation. |
50 * handler creation. |
51 * - Added interface for retrieving CoE emergency messages, i. e. |
51 * - Added interface for retrieving CoE emergency messages, i. e. |
52 * ecrt_slave_config_emerg_size(), ecrt_slave_config_emerg_pop(), |
52 * ecrt_slave_config_emerg_size(), ecrt_slave_config_emerg_pop(), |
53 * ecrt_slave_config_emerg_clear(), ecrt_slave_config_emerg_overruns() and |
53 * ecrt_slave_config_emerg_clear(), ecrt_slave_config_emerg_overruns() and |
54 * the defines EC_HAVE_EMERGENCY and EC_COE_EMERGENCY_MSG_SIZE. |
54 * the defines EC_HAVE_EMERGENCY and EC_COE_EMERGENCY_MSG_SIZE. |
|
55 * - Added interface for direct EtherCAT register access: Added data type |
|
56 * ec_reg_request_t and methods ecrt_slave_config_create_reg_request(), |
|
57 * ecrt_reg_request_data(), ecrt_reg_request_state(), |
|
58 * ecrt_reg_request_write() and ecrt_reg_request_read(). |
55 * |
59 * |
56 * Changes in version 1.5: |
60 * Changes in version 1.5: |
57 * |
61 * |
58 * - Added the distributed clocks feature and the respective method |
62 * - Added the distributed clocks feature and the respective method |
59 * ecrt_slave_config_dc() to configure a slave for cyclic operation, and |
63 * ecrt_slave_config_dc() to configure a slave for cyclic operation, and |
205 typedef struct ec_sdo_request ec_sdo_request_t; /**< \see ec_sdo_request. */ |
209 typedef struct ec_sdo_request ec_sdo_request_t; /**< \see ec_sdo_request. */ |
206 |
210 |
207 struct ec_voe_handler; |
211 struct ec_voe_handler; |
208 typedef struct ec_voe_handler ec_voe_handler_t; /**< \see ec_voe_handler. */ |
212 typedef struct ec_voe_handler ec_voe_handler_t; /**< \see ec_voe_handler. */ |
209 |
213 |
|
214 struct ec_reg_request; |
|
215 typedef struct ec_reg_request ec_reg_request_t; /**< \see ec_sdo_request. */ |
|
216 |
210 /*****************************************************************************/ |
217 /*****************************************************************************/ |
211 |
218 |
212 /** Master state. |
219 /** Master state. |
213 * |
220 * |
214 * This is used for the output parameter of ecrt_master_state(). |
221 * This is used for the output parameter of ecrt_master_state(). |
1373 ec_voe_handler_t *ecrt_slave_config_create_voe_handler( |
1380 ec_voe_handler_t *ecrt_slave_config_create_voe_handler( |
1374 ec_slave_config_t *sc, /**< Slave configuration. */ |
1381 ec_slave_config_t *sc, /**< Slave configuration. */ |
1375 size_t size /**< Data size to reserve. */ |
1382 size_t size /**< Data size to reserve. */ |
1376 ); |
1383 ); |
1377 |
1384 |
|
1385 /** Create a register request to exchange EtherCAT register contents during |
|
1386 * realtime operation. |
|
1387 * |
|
1388 * This interface should not be used to take over master functionality, |
|
1389 * instead it is intended for debugging and monitoring reasons. |
|
1390 * |
|
1391 * The created register request object is freed automatically when the master |
|
1392 * is released. |
|
1393 */ |
|
1394 ec_reg_request_t *ecrt_slave_config_create_reg_request( |
|
1395 ec_slave_config_t *sc, /**< Slave configuration. */ |
|
1396 size_t size /**< Data size to reserve. */ |
|
1397 ); |
|
1398 |
1378 /** Outputs the state of the slave configuration. |
1399 /** Outputs the state of the slave configuration. |
1379 * |
1400 * |
1380 * Stores the state information in the given \a state structure. The state |
1401 * Stores the state information in the given \a state structure. The state |
1381 * information is updated by the master state machine, so it may take a few |
1402 * information is updated by the master state machine, so it may take a few |
1382 * cycles, until it changes. |
1403 * cycles, until it changes. |
1742 * \return Handler state. |
1763 * \return Handler state. |
1743 */ |
1764 */ |
1744 ec_request_state_t ecrt_voe_handler_execute( |
1765 ec_request_state_t ecrt_voe_handler_execute( |
1745 ec_voe_handler_t *voe /**< VoE handler. */ |
1766 ec_voe_handler_t *voe /**< VoE handler. */ |
1746 ); |
1767 ); |
|
1768 |
|
1769 /***************************************************************************** |
|
1770 * Register request methods. |
|
1771 ****************************************************************************/ |
|
1772 |
|
1773 /** Access to the register request's data. |
|
1774 * |
|
1775 * This function returns a pointer to the request's internal memory. |
|
1776 * |
|
1777 * - After a read operation was successful, integer data can be evaluated using |
|
1778 * the EC_READ_*() macros as usual. Example: |
|
1779 * \code |
|
1780 * uint16_t value = EC_READ_U16(ecrt_reg_request_data(reg_request))); |
|
1781 * \endcode |
|
1782 * - If a write operation shall be triggered, the data have to be written to |
|
1783 * the internal memory. Use the EC_WRITE_*() macros, if you are writing |
|
1784 * integer data. Be sure, that the data fit into the memory. The memory size |
|
1785 * is a parameter of ecrt_slave_config_create_reg_request(). |
|
1786 * \code |
|
1787 * EC_WRITE_U16(ecrt_reg_request_data(reg_request), 0xFFFF); |
|
1788 * \endcode |
|
1789 * |
|
1790 * \return Pointer to the internal memory. |
|
1791 */ |
|
1792 uint8_t *ecrt_reg_request_data( |
|
1793 ec_reg_request_t *req /**< Register request. */ |
|
1794 ); |
|
1795 |
|
1796 /** Get the current state of the register request. |
|
1797 * |
|
1798 * \return Request state. |
|
1799 */ |
|
1800 #ifdef __KERNEL__ |
|
1801 ec_request_state_t ecrt_reg_request_state( |
|
1802 const ec_reg_request_t *req /**< Register request. */ |
|
1803 ); |
|
1804 #else |
|
1805 ec_request_state_t ecrt_reg_request_state( |
|
1806 ec_reg_request_t *req /**< Register request. */ |
|
1807 ); |
|
1808 #endif |
|
1809 |
|
1810 /** Schedule an register write operation. |
|
1811 * |
|
1812 * \attention This method may not be called while ecrt_reg_request_state() |
|
1813 * returns EC_REQUEST_BUSY. |
|
1814 * |
|
1815 * \attention The \a size parameter is truncated to the size given at request |
|
1816 * creation. |
|
1817 */ |
|
1818 void ecrt_reg_request_write( |
|
1819 ec_reg_request_t *req, /**< Register request. */ |
|
1820 uint16_t address, /**< Register address. */ |
|
1821 size_t size /**< Size to write. */ |
|
1822 ); |
|
1823 |
|
1824 /** Schedule a register read operation. |
|
1825 * |
|
1826 * \attention This method may not be called while ecrt_reg_request_state() |
|
1827 * returns EC_REQUEST_BUSY. |
|
1828 * |
|
1829 * \attention The \a size parameter is truncated to the size given at request |
|
1830 * creation. |
|
1831 */ |
|
1832 void ecrt_reg_request_read( |
|
1833 ec_reg_request_t *req, /**< Register request. */ |
|
1834 uint16_t address, /**< Register address. */ |
|
1835 size_t size /**< Size to write. */ |
|
1836 ); |
1747 |
1837 |
1748 /*****************************************************************************/ |
1838 /*****************************************************************************/ |
1749 |
1839 |
1750 #ifdef __cplusplus |
1840 #ifdef __cplusplus |
1751 } |
1841 } |