46 * the state of a redundant link. |
46 * the state of a redundant link. |
47 * - Added the EC_HAVE_REDUNDANCY define, to check, if the interface contains |
47 * - Added the EC_HAVE_REDUNDANCY define, to check, if the interface contains |
48 * redundancy features. |
48 * redundancy features. |
49 * - Added ecrt_sdo_request_index() to change SDO index and subindex after |
49 * - Added ecrt_sdo_request_index() to change SDO index and subindex after |
50 * handler creation. |
50 * handler creation. |
|
51 * - Added interface for retrieving CoE emergency messages, i. e. |
|
52 * ecrt_slave_config_emerg_size(), ecrt_slave_config_emerg_pop(), |
|
53 * ecrt_slave_config_emerg_clear(), ecrt_slave_config_emerg_overruns() and |
|
54 * the defines EC_HAVE_EMERGENCY and EC_COE_EMERGENCY_MSG_SIZE. |
51 * |
55 * |
52 * Changes in version 1.5: |
56 * Changes in version 1.5: |
53 * |
57 * |
54 * - Added the distributed clocks feature and the respective method |
58 * - Added the distributed clocks feature and the respective method |
55 * ecrt_slave_config_dc() to configure a slave for cyclic operation, and |
59 * ecrt_slave_config_dc() to configure a slave for cyclic operation, and |
138 * I. e. if the \a redundancy_active flag in ec_domain_state_t and the |
142 * I. e. if the \a redundancy_active flag in ec_domain_state_t and the |
139 * ecrt_master_link_state() method are available. |
143 * ecrt_master_link_state() method are available. |
140 */ |
144 */ |
141 #define EC_HAVE_REDUNDANCY |
145 #define EC_HAVE_REDUNDANCY |
142 |
146 |
|
147 /** Defined, if the CoE emergency ring feature is available. |
|
148 * |
|
149 * I. e. if the ecrt_slave_config_emerg_*() methods are available. |
|
150 */ |
|
151 #define EC_HAVE_EMERGENCY |
|
152 |
143 /*****************************************************************************/ |
153 /*****************************************************************************/ |
144 |
154 |
145 /** End of list marker. |
155 /** End of list marker. |
146 * |
156 * |
147 * This can be used with ecrt_slave_config_pdos(). |
157 * This can be used with ecrt_slave_config_pdos(). |
169 * |
179 * |
170 * \param TV struct timeval containing epoch time. |
180 * \param TV struct timeval containing epoch time. |
171 */ |
181 */ |
172 #define EC_TIMEVAL2NANO(TV) \ |
182 #define EC_TIMEVAL2NANO(TV) \ |
173 (((TV).tv_sec - 946684800ULL) * 1000000000ULL + (TV).tv_usec * 1000ULL) |
183 (((TV).tv_sec - 946684800ULL) * 1000000000ULL + (TV).tv_usec * 1000ULL) |
|
184 |
|
185 /** Size of a CoE emergency message in byte. |
|
186 * |
|
187 * \see ecrt_slave_config_emerg_pop(). |
|
188 */ |
|
189 #define EC_COE_EMERGENCY_MSG_SIZE 8 |
174 |
190 |
175 /****************************************************************************** |
191 /****************************************************************************** |
176 * Data types |
192 * Data types |
177 *****************************************************************************/ |
193 *****************************************************************************/ |
178 |
194 |
1281 uint16_t index, /**< Index of the SDO to configure. */ |
1297 uint16_t index, /**< Index of the SDO to configure. */ |
1282 const uint8_t *data, /**< Pointer to the data. */ |
1298 const uint8_t *data, /**< Pointer to the data. */ |
1283 size_t size /**< Size of the \a data. */ |
1299 size_t size /**< Size of the \a data. */ |
1284 ); |
1300 ); |
1285 |
1301 |
|
1302 /** Set the size of the CoE emergency ring buffer. |
|
1303 * |
|
1304 * The initial size is zero, so all messages will be dropped. This method can |
|
1305 * be called even after master activation, but it will clear the ring buffer! |
|
1306 * |
|
1307 * \return 0 on success, or negative error code. |
|
1308 */ |
|
1309 int ecrt_slave_config_emerg_size( |
|
1310 ec_slave_config_t *sc, /**< Slave configuration. */ |
|
1311 size_t elements /**< Number of records of the CoE emergency ring. */ |
|
1312 ); |
|
1313 |
|
1314 /** Read and remove one record from the CoE emergency ring buffer. |
|
1315 * |
|
1316 * A record consists of 8 bytes: |
|
1317 * |
|
1318 * Byte 0-1: Error code (little endian) |
|
1319 * Byte 2: Error register |
|
1320 * Byte 3-7: Data |
|
1321 * |
|
1322 * \return 0 on success (record popped), or negative error code (i. e. |
|
1323 * -ENOENT, if ring is empty). |
|
1324 */ |
|
1325 int ecrt_slave_config_emerg_pop( |
|
1326 ec_slave_config_t *sc, /**< Slave configuration. */ |
|
1327 uint8_t *target /**< Pointer to target memory (at least |
|
1328 EC_COE_EMERGENCY_MSG_SIZE bytes). */ |
|
1329 ); |
|
1330 |
|
1331 /** Clears CoE emergency ring buffer and the overrun counter. |
|
1332 * |
|
1333 * \return 0 on success, or negative error code. |
|
1334 */ |
|
1335 int ecrt_slave_config_emerg_clear( |
|
1336 ec_slave_config_t *sc /**< Slave configuration. */ |
|
1337 ); |
|
1338 |
|
1339 /** Read the number of CoE emergency overruns. |
|
1340 * |
|
1341 * The overrun counter will be incremented when a CoE emergency message could |
|
1342 * not be stored in the ring buffer and had to be dropped. Call |
|
1343 * ecrt_slave_config_emerg_clear() to reset the counter. |
|
1344 * |
|
1345 * \return Number of overruns since last clear, or negative error code. |
|
1346 */ |
|
1347 int ecrt_slave_config_emerg_overruns( |
|
1348 ec_slave_config_t *sc /**< Slave configuration. */ |
|
1349 ); |
|
1350 |
1286 /** Create an SDO request to exchange SDOs during realtime operation. |
1351 /** Create an SDO request to exchange SDOs during realtime operation. |
1287 * |
1352 * |
1288 * The created SDO request object is freed automatically when the master is |
1353 * The created SDO request object is freed automatically when the master is |
1289 * released. |
1354 * released. |
1290 */ |
1355 */ |