IgH EtherCAT Master  1.7.0
ecrt.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * Copyright (C) 2006-2026 Florian Pose, Ingenieurgemeinschaft IgH
4  *
5  * This file is part of the IgH EtherCAT master userspace library.
6  *
7  * The IgH EtherCAT master userspace library is free software; you can
8  * redistribute it and/or modify it under the terms of the GNU Lesser General
9  * Public License as published by the Free Software Foundation; version 2.1
10  * of the License.
11  *
12  * The IgH EtherCAT master userspace library is distributed in the hope that
13  * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
14  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with the IgH EtherCAT master userspace library. If not, see
19  * <http://www.gnu.org/licenses/>.
20  *
21  ****************************************************************************/
22 
146 /****************************************************************************/
147 
148 #ifndef __ECRT_H__
149 #define __ECRT_H__
150 
151 #ifdef __KERNEL__
152 #include <asm/byteorder.h>
153 #include <linux/types.h>
154 #include <linux/time.h>
155 #include <linux/in.h> // struct in_addr
156 #else
157 #include <stdlib.h> // for size_t
158 #include <stdint.h>
159 #include <sys/time.h> // for struct timeval
160 #include <netinet/in.h> // struct in_addr
161 #endif
162 
163 /*****************************************************************************
164  * Global definitions
165  ****************************************************************************/
166 
169 #define ECRT_VER_MAJOR 1
170 
173 #define ECRT_VER_MINOR 6
174 
177 #define ECRT_VERSION(a, b) (((a) << 8) + (b))
178 
181 #define ECRT_VERSION_MAGIC ECRT_VERSION(ECRT_VER_MAJOR, ECRT_VER_MINOR)
182 
183 /*****************************************************************************
184  * Feature flags
185  ****************************************************************************/
186 
192 #define EC_HAVE_REDUNDANCY
193 
198 #define EC_HAVE_EMERGENCY
199 
206 #define EC_HAVE_REG_ACCESS
207 
210 #define EC_HAVE_SELECT_REF_CLOCK
211 
214 #define EC_HAVE_REF_CLOCK_TIME
215 
218 #define EC_HAVE_REG_BY_POS
219 
222 #define EC_HAVE_SYNC_TO
223 
226 #define EC_HAVE_FLAGS
227 
234 #define EC_HAVE_SOE_REQUESTS
235 
239 #define EC_HAVE_SCAN_PROGRESS
240 
247 #define EC_HAVE_SET_IP
248 
251 #define EC_HAVE_STATE_TIMEOUT
252 
256 #define EC_HAVE_SII_CACHING
257 
261 #define EC_HAVE_PDO_MODE
262 
263 /****************************************************************************/
264 
267 #ifndef EC_PUBLIC_API
268 # if defined(ethercat_EXPORTS) && !defined(__KERNEL__)
269 # define EC_PUBLIC_API __attribute__ ((visibility ("default")))
270 # else
271 # define EC_PUBLIC_API
272 # endif
273 #endif
274 
275 /****************************************************************************/
276 
281 #define EC_END ~0U
282 
285 #define EC_MAX_SYNC_MANAGERS 16
286 
291 #define EC_MAX_STRING_LENGTH 64
292 
294 #define EC_MAX_PORTS 4
295 
304 #define EC_TIMEVAL2NANO(TV) \
305  (((TV).tv_sec - 946684800ULL) * 1000000000ULL + (TV).tv_usec * 1000ULL)
306 
311 #define EC_COE_EMERGENCY_MSG_SIZE 8
312 
313 /*****************************************************************************
314  * Data types
315  ****************************************************************************/
316 
317 struct ec_master;
318 typedef struct ec_master ec_master_t;
320 struct ec_slave_config;
323 struct ec_domain;
324 typedef struct ec_domain ec_domain_t;
326 struct ec_sdo_request;
329 struct ec_soe_request;
332 struct ec_voe_handler;
335 struct ec_reg_request;
338 /****************************************************************************/
339 
346 typedef struct {
347  unsigned int slaves_responding;
349  unsigned int al_states : 4;
358  unsigned int link_up : 1;
361 
362 /****************************************************************************/
363 
370 typedef struct {
371  unsigned int slaves_responding;
373  unsigned int al_states : 4;
382  unsigned int link_up : 1;
385 
386 /****************************************************************************/
387 
394 typedef struct {
395  unsigned int online : 1;
396  unsigned int operational : 1;
398  unsigned int al_state : 4;
407 
408 /****************************************************************************/
409 
416 typedef struct {
417  unsigned int slave_count;
418  unsigned int link_up : 1;
419  uint8_t scan_busy;
421  uint64_t app_time;
423 
424 /****************************************************************************/
425 
432 typedef struct {
433  unsigned int slave_count;
434  unsigned int scan_index;
439 
440 /****************************************************************************/
441 
444 typedef enum {
450 
451 /****************************************************************************/
452 
455 typedef struct {
456  uint8_t link_up;
457  uint8_t loop_closed;
458  uint8_t signal_detected;
460 
461 /****************************************************************************/
462 
469 typedef struct {
470  uint16_t position;
471  uint32_t vendor_id;
472  uint32_t product_code;
473  uint32_t revision_number;
474  uint32_t serial_number;
475  uint16_t alias;
476  int16_t current_on_ebus;
477  struct {
480  uint32_t receive_time;
482  uint16_t next_slave;
484  uint32_t delay_to_next_dc;
485  } ports[EC_MAX_PORTS];
486  uint8_t al_state;
487  uint8_t error_flag;
488  uint8_t sync_count;
489  uint16_t sdo_count;
490  char name[EC_MAX_STRING_LENGTH];
492 
493 /****************************************************************************/
494 
499 typedef enum {
504 } ec_wc_state_t;
505 
506 /****************************************************************************/
507 
512 typedef struct {
513  unsigned int working_counter;
515  unsigned int redundancy_active;
517 
518 /****************************************************************************/
519 
522 typedef enum {
528 
529 /****************************************************************************/
530 
535 typedef enum {
540 
541 /****************************************************************************/
542 
551 typedef enum {
566 } ec_pdo_mode_t;
567 
575 #define EC_PDO_MODE_DEFAULT EC_PDO_MODE_READ_WRITE
576 
577 /****************************************************************************/
578 
585 typedef struct {
586  uint16_t index;
587  uint8_t subindex;
588  uint8_t bit_length;
590 
591 /****************************************************************************/
592 
599 typedef struct {
600  uint16_t index;
601  unsigned int n_entries;
608 } ec_pdo_info_t;
609 
610 /****************************************************************************/
611 
618 typedef struct {
619  uint8_t index;
623  unsigned int n_pdos;
628 
629 /****************************************************************************/
630 
636 typedef struct {
637  uint16_t alias;
638  uint16_t position;
639  uint32_t vendor_id;
640  uint32_t product_code;
641  uint16_t index;
642  uint8_t subindex;
643  unsigned int *offset;
645  unsigned int *bit_position;
650 
651 /****************************************************************************/
652 
658 typedef enum {
664 
665 /****************************************************************************/
666 
669 typedef enum {
674 } ec_al_state_t;
675 
676 /****************************************************************************/
677 
682 typedef enum {
683  EC_SII_DISABLE_CACHING = 0,
690 
691 /*****************************************************************************
692  * Global functions
693  ****************************************************************************/
694 
695 #ifdef __cplusplus
696 extern "C" {
697 #endif
698 
705 EC_PUBLIC_API unsigned int ecrt_version_magic(void);
706 
725  unsigned int master_index
726  );
727 
728 #ifndef __KERNEL__
729 
743 EC_PUBLIC_API ec_master_t *ecrt_open_master(
744  unsigned int master_index
745  );
746 
747 #endif // #ifndef __KERNEL__
748 
762  ec_master_t *master
763  );
764 
765 /*****************************************************************************
766  * Master methods
767  ****************************************************************************/
768 
769 #ifndef __KERNEL__
770 
780 EC_PUBLIC_API int ecrt_master_reserve(
781  ec_master_t *master
782  );
783 
784 #endif // #ifndef __KERNEL__
785 
786 #ifdef __KERNEL__
787 
808  ec_master_t *master,
809  void (*send_cb)(void *),
810  void (*receive_cb)(void *),
811  void *cb_data
813  );
814 
815 #endif /* __KERNEL__ */
816 
832  ec_master_t *master
833  );
834 
868  ec_master_t *master,
869  uint16_t alias,
870  uint16_t position,
871  uint32_t vendor_id,
872  uint32_t product_code
873  );
874 
895  ec_master_t *master,
896  ec_slave_config_t *sc
898  );
899 
911  ec_master_t *master,
912  ec_master_info_t *master_info
914  );
915 
927  ec_master_t *master,
928  ec_master_scan_progress_t *progress
930  );
931 
945  ec_master_t *master,
946  uint16_t slave_position,
947  ec_slave_info_t *slave_info
949  );
950 
951 #ifndef __KERNEL__
952 
963 EC_PUBLIC_API int ecrt_master_get_sync_manager(
964  ec_master_t *master,
965  uint16_t slave_position,
966  uint8_t sync_index,
968  ec_sync_info_t *sync
969  );
970 
982 EC_PUBLIC_API int ecrt_master_get_pdo(
983  ec_master_t *master,
984  uint16_t slave_position,
985  uint8_t sync_index,
987  uint16_t pos,
988  ec_pdo_info_t *pdo
989  );
990 
1000 EC_PUBLIC_API int ecrt_master_get_pdo_entry(
1001  ec_master_t *master,
1002  uint16_t slave_position,
1003  uint8_t sync_index,
1005  uint16_t pdo_pos,
1006  uint16_t entry_pos,
1007  ec_pdo_entry_info_t *entry
1008  );
1009 
1010 #endif /* #ifndef __KERNEL__ */
1011 
1024  ec_master_t *master,
1025  uint16_t slave_position,
1026  uint16_t index,
1027  uint8_t subindex,
1028  const uint8_t *data,
1029  size_t data_size,
1030  uint32_t *abort_code
1031  );
1032 
1046  ec_master_t *master,
1047  uint16_t slave_position,
1048  uint16_t index,
1049  const uint8_t *data,
1050  size_t data_size,
1051  uint32_t *abort_code
1052  );
1053 
1066  ec_master_t *master,
1067  uint16_t slave_position,
1068  uint16_t index,
1069  uint8_t subindex,
1070  uint8_t *target,
1071  size_t target_size,
1072  size_t *result_size,
1073  uint32_t *abort_code
1074  );
1075 
1087  ec_master_t *master,
1088  uint16_t slave_position,
1089  uint8_t drive_no,
1090  uint16_t idn,
1091  const uint8_t *data,
1092  size_t data_size,
1093  uint16_t *error_code
1095  );
1096 
1108  ec_master_t *master,
1109  uint16_t slave_position,
1110  uint8_t drive_no,
1111  uint16_t idn,
1112  uint8_t *target,
1114  size_t target_size,
1115  size_t *result_size,
1116  uint16_t *error_code
1118  );
1119 
1140  ec_master_t *master
1141  );
1142 
1159  ec_master_t *master
1160  );
1161 
1175  ec_master_t *master,
1176  size_t send_interval
1177  );
1178 
1192  ec_master_t *master
1193  );
1194 
1210  ec_master_t *master
1211  );
1212 
1213 #ifdef __KERNEL__
1214 
1225  ec_master_t *master
1226  );
1227 #endif
1228 
1241  const ec_master_t *master,
1242  ec_master_state_t *state
1243  );
1244 
1254  const ec_master_t *master,
1255  unsigned int dev_idx,
1257  ec_master_link_state_t *state
1259  );
1260 
1287  ec_master_t *master,
1288  uint64_t app_time
1289  );
1290 
1303  ec_master_t *master
1304  );
1305 
1325  ec_master_t *master,
1326  uint64_t sync_time
1327  );
1328 
1343  ec_master_t *master
1344  );
1345 
1369  const ec_master_t *master,
1370  uint32_t *time
1371  );
1372 
1384  ec_master_t *master
1385  );
1386 
1399  const ec_master_t *master
1400  );
1401 
1417  ec_master_t *master
1418  );
1419 
1454  ec_master_t *master,
1455  ec_sii_caching_fields_t fields
1456  );
1457 
1458 /*****************************************************************************
1459  * Slave configuration methods
1460  ****************************************************************************/
1461 
1475  ec_slave_config_t *sc,
1476  uint8_t sync_index,
1478  ec_direction_t direction,
1479  ec_watchdog_mode_t watchdog_mode
1480  );
1481 
1492  ec_slave_config_t *sc,
1493  uint16_t watchdog_divider,
1498  uint16_t watchdog_intervals
1502  );
1503 
1551  ec_slave_config_t *sc,
1552  ec_pdo_mode_t assign_mode,
1553  ec_pdo_mode_t config_mode
1554  );
1555 
1567  ec_slave_config_t *sc,
1568  uint8_t sync_index,
1570  uint16_t index
1571  );
1572 
1588  ec_slave_config_t *sc,
1589  uint8_t sync_index
1591  );
1592 
1604  ec_slave_config_t *sc,
1605  uint16_t pdo_index,
1606  uint16_t entry_index,
1608  uint8_t entry_subindex,
1610  uint8_t entry_bit_length
1611  );
1612 
1627  ec_slave_config_t *sc,
1628  uint16_t pdo_index
1629  );
1630 
1705  ec_slave_config_t *sc,
1706  unsigned int n_syncs,
1708  const ec_sync_info_t syncs[]
1710  );
1711 
1733  ec_slave_config_t *sc,
1734  uint16_t entry_index,
1735  uint8_t entry_subindex,
1736  ec_domain_t *domain,
1737  unsigned int *bit_position
1739  );
1740 
1757  ec_slave_config_t *sc,
1758  uint8_t sync_index,
1759  unsigned int pdo_pos,
1760  unsigned int entry_pos,
1761  ec_domain_t *domain,
1762  unsigned int *bit_position
1764  );
1765 
1839  ec_slave_config_t *sc,
1840  uint16_t assign_activate,
1841  uint32_t sync0_cycle,
1842  int32_t sync0_shift,
1843  uint32_t sync1_cycle,
1844  int32_t sync1_shift
1845  );
1846 
1875  ec_slave_config_t *sc,
1876  uint16_t index,
1877  uint8_t subindex,
1878  const uint8_t *data,
1879  size_t size
1880  );
1881 
1895  ec_slave_config_t *sc,
1896  uint16_t sdo_index,
1897  uint8_t sdo_subindex,
1898  uint8_t value
1899  );
1900 
1914  ec_slave_config_t *sc,
1915  uint16_t sdo_index,
1916  uint8_t sdo_subindex,
1917  uint16_t value
1918  );
1919 
1933  ec_slave_config_t *sc,
1934  uint16_t sdo_index,
1935  uint8_t sdo_subindex,
1936  uint32_t value
1937  );
1938 
1955  ec_slave_config_t *sc,
1956  uint16_t index,
1957  const uint8_t *data,
1958  size_t size
1959  );
1960 
1974  ec_slave_config_t *sc,
1975  size_t elements
1976  );
1977 
1995  ec_slave_config_t *sc,
1996  uint8_t *target
1998  );
1999 
2011  ec_slave_config_t *sc
2012  );
2013 
2029  const ec_slave_config_t *sc
2030  );
2031 
2045  ec_slave_config_t *sc,
2046  uint16_t index,
2047  uint8_t subindex,
2048  size_t size
2049  );
2050 
2064  ec_slave_config_t *sc,
2065  uint8_t drive_no,
2066  uint16_t idn,
2067  size_t size
2068  );
2069 
2088  ec_slave_config_t *sc,
2089  size_t size
2090  );
2091 
2109  ec_slave_config_t *sc,
2110  size_t size
2111  );
2112 
2131  const ec_slave_config_t *sc,
2132  ec_slave_config_state_t *state
2133  );
2134 
2160  ec_slave_config_t *sc,
2161  uint8_t drive_no,
2162  uint16_t idn,
2163  ec_al_state_t state,
2165  const uint8_t *data,
2166  size_t size
2167  );
2168 
2194  ec_slave_config_t *sc,
2195  const char *key,
2196  int32_t value
2197  );
2198 
2213  ec_slave_config_t *sc,
2214  const unsigned char *mac_address
2215  );
2216 
2251  ec_slave_config_t *sc,
2252  struct in_addr ip_address
2253  );
2254 
2275  ec_slave_config_t *sc,
2276  struct in_addr subnet_mask
2277  );
2278 
2299  ec_slave_config_t *sc,
2300  struct in_addr gateway_address
2301  );
2302 
2324  ec_slave_config_t *sc,
2325  struct in_addr dns_address
2326  );
2327 
2345  ec_slave_config_t *sc,
2346  const char *name
2347  );
2348 
2366  ec_slave_config_t *sc,
2367  ec_al_state_t from_state,
2368  ec_al_state_t to_state,
2369  unsigned int timeout_ms
2370  );
2371 
2372 /*****************************************************************************
2373  * Domain methods
2374  ****************************************************************************/
2375 
2391  ec_domain_t *domain,
2392  const ec_pdo_entry_reg_t *pdo_entry_regs
2394  );
2395 
2405  const ec_domain_t *domain
2406  );
2407 
2408 #ifdef __KERNEL__
2409 
2424  ec_domain_t *domain,
2425  uint8_t *memory
2427  );
2428 
2429 #endif /* __KERNEL__ */
2430 
2447  const ec_domain_t *domain
2448  );
2449 
2462  ec_domain_t *domain
2463  );
2464 
2475  ec_domain_t *domain
2476  );
2477 
2489  const ec_domain_t *domain,
2490  ec_domain_state_t *state
2492  );
2493 
2494 /*****************************************************************************
2495  * SDO request methods.
2496  ****************************************************************************/
2497 
2513  ec_sdo_request_t *req,
2514  uint16_t index,
2515  uint8_t subindex
2516  );
2517 
2534  ec_sdo_request_t *req,
2535  uint32_t timeout
2537  );
2538 
2569  const ec_sdo_request_t *req
2570  );
2571 
2587  const ec_sdo_request_t *req
2588  );
2589 
2604 #ifdef __KERNEL__
2605  const
2606 #endif
2607  ec_sdo_request_t *req
2608  );
2609 
2626  ec_sdo_request_t *req
2627  );
2628 
2646  ec_sdo_request_t *req
2647  );
2648 
2649 /*****************************************************************************
2650  * SoE request methods.
2651  ****************************************************************************/
2652 
2668  ec_soe_request_t *req,
2669  uint8_t drive_no,
2670  uint16_t idn
2671  );
2672 
2689  ec_soe_request_t *req,
2690  uint32_t timeout
2692  );
2693 
2724  const ec_soe_request_t *req
2725  );
2726 
2738  const ec_soe_request_t *req
2739  );
2740 
2754 #ifdef __KERNEL__
2755  const
2756 #endif
2757  ec_soe_request_t *req
2758  );
2759 
2776  ec_soe_request_t *req
2777  );
2778 
2796  ec_soe_request_t *req
2797  );
2798 
2799 /*****************************************************************************
2800  * VoE handler methods.
2801  ****************************************************************************/
2802 
2819  ec_voe_handler_t *voe,
2820  uint32_t vendor_id,
2821  uint16_t vendor_type
2822  );
2823 
2840  const ec_voe_handler_t *voe,
2841  uint32_t *vendor_id,
2842  uint16_t *vendor_type
2843  );
2844 
2868  const ec_voe_handler_t *voe
2869  );
2870 
2886  const ec_voe_handler_t *voe
2887  );
2888 
2906  ec_voe_handler_t *voe,
2907  size_t size
2908  );
2909 
2933  ec_voe_handler_t *voe
2934  );
2935 
2960  ec_voe_handler_t *voe
2961  );
2962 
2977  ec_voe_handler_t *voe
2978  );
2979 
2980 /*****************************************************************************
2981  * Register request methods.
2982  ****************************************************************************/
2983 
3010  const ec_reg_request_t *req
3011  );
3012 
3024  const ec_reg_request_t *req
3025  );
3026 
3045  ec_reg_request_t *req,
3046  uint16_t address,
3047  size_t size
3048  );
3049 
3068  ec_reg_request_t *req,
3069  uint16_t address,
3070  size_t size
3071  );
3072 
3073 /*****************************************************************************
3074  * Bitwise read/write macros
3075  ****************************************************************************/
3076 
3082 #define EC_READ_BIT(DATA, POS) ((*((uint8_t *) (DATA)) >> (POS)) & 0x01)
3083 
3090 #define EC_WRITE_BIT(DATA, POS, VAL) \
3091  do { \
3092  if (VAL) *((uint8_t *) (DATA)) |= (1 << (POS)); \
3093  else *((uint8_t *) (DATA)) &= ~(1 << (POS)); \
3094  } while (0)
3095 
3096 /*****************************************************************************
3097  * Byte-swapping functions for user space
3098  ****************************************************************************/
3099 
3100 #ifndef __KERNEL__
3101 
3102 #if __BYTE_ORDER == __LITTLE_ENDIAN
3103 
3104 #define le16_to_cpu(x) x
3105 #define le32_to_cpu(x) x
3106 #define le64_to_cpu(x) x
3107 
3108 #define cpu_to_le16(x) x
3109 #define cpu_to_le32(x) x
3110 #define cpu_to_le64(x) x
3111 
3112 #elif __BYTE_ORDER == __BIG_ENDIAN
3113 
3114 #define swap16(x) \
3115  ((uint16_t)( \
3116  (((uint16_t)(x) & 0x00ffU) << 8) | \
3117  (((uint16_t)(x) & 0xff00U) >> 8) ))
3118 #define swap32(x) \
3119  ((uint32_t)( \
3120  (((uint32_t)(x) & 0x000000ffUL) << 24) | \
3121  (((uint32_t)(x) & 0x0000ff00UL) << 8) | \
3122  (((uint32_t)(x) & 0x00ff0000UL) >> 8) | \
3123  (((uint32_t)(x) & 0xff000000UL) >> 24) ))
3124 #define swap64(x) \
3125  ((uint64_t)( \
3126  (((uint64_t)(x) & 0x00000000000000ffULL) << 56) | \
3127  (((uint64_t)(x) & 0x000000000000ff00ULL) << 40) | \
3128  (((uint64_t)(x) & 0x0000000000ff0000ULL) << 24) | \
3129  (((uint64_t)(x) & 0x00000000ff000000ULL) << 8) | \
3130  (((uint64_t)(x) & 0x000000ff00000000ULL) >> 8) | \
3131  (((uint64_t)(x) & 0x0000ff0000000000ULL) >> 24) | \
3132  (((uint64_t)(x) & 0x00ff000000000000ULL) >> 40) | \
3133  (((uint64_t)(x) & 0xff00000000000000ULL) >> 56) ))
3134 
3135 #define le16_to_cpu(x) swap16(x)
3136 #define le32_to_cpu(x) swap32(x)
3137 #define le64_to_cpu(x) swap64(x)
3138 
3139 #define cpu_to_le16(x) swap16(x)
3140 #define cpu_to_le32(x) swap32(x)
3141 #define cpu_to_le64(x) swap64(x)
3142 
3143 #endif
3144 
3145 #define le16_to_cpup(x) le16_to_cpu(*((uint16_t *)(x)))
3146 #define le32_to_cpup(x) le32_to_cpu(*((uint32_t *)(x)))
3147 #define le64_to_cpup(x) le64_to_cpu(*((uint64_t *)(x)))
3148 
3149 #endif /* ifndef __KERNEL__ */
3150 
3151 /*****************************************************************************
3152  * Read macros
3153  ****************************************************************************/
3154 
3159 #define EC_READ_U8(DATA) \
3160  ((uint8_t) *((uint8_t *) (DATA)))
3161 
3167 #define EC_READ_S8(DATA) \
3168  ((int8_t) *((uint8_t *) (DATA)))
3169 
3175 #define EC_READ_U16(DATA) \
3176  ((uint16_t) le16_to_cpup((void *) (DATA)))
3177 
3183 #define EC_READ_S16(DATA) \
3184  ((int16_t) le16_to_cpup((void *) (DATA)))
3185 
3191 #define EC_READ_U32(DATA) \
3192  ((uint32_t) le32_to_cpup((void *) (DATA)))
3193 
3199 #define EC_READ_S32(DATA) \
3200  ((int32_t) le32_to_cpup((void *) (DATA)))
3201 
3207 #define EC_READ_U64(DATA) \
3208  ((uint64_t) le64_to_cpup((void *) (DATA)))
3209 
3215 #define EC_READ_S64(DATA) \
3216  ((int64_t) le64_to_cpup((void *) (DATA)))
3217 
3218 /*****************************************************************************
3219  * Floating-point read functions and macros (userspace only)
3220  ****************************************************************************/
3221 
3222 #ifndef __KERNEL__
3223 
3231 EC_PUBLIC_API float ecrt_read_real(const void *data);
3232 
3238 #define EC_READ_REAL(DATA) ecrt_read_real(DATA)
3239 
3247 EC_PUBLIC_API double ecrt_read_lreal(const void *data);
3248 
3254 #define EC_READ_LREAL(DATA) ecrt_read_lreal(DATA)
3255 
3256 #endif // ifndef __KERNEL__
3257 
3258 /*****************************************************************************
3259  * Write macros
3260  ****************************************************************************/
3261 
3267 #define EC_WRITE_U8(DATA, VAL) \
3268  do { \
3269  *((uint8_t *)(DATA)) = ((uint8_t) (VAL)); \
3270  } while (0)
3271 
3277 #define EC_WRITE_S8(DATA, VAL) EC_WRITE_U8(DATA, VAL)
3278 
3284 #define EC_WRITE_U16(DATA, VAL) \
3285  do { \
3286  *((uint16_t *) (DATA)) = cpu_to_le16((uint16_t) (VAL)); \
3287  } while (0)
3288 
3294 #define EC_WRITE_S16(DATA, VAL) EC_WRITE_U16(DATA, VAL)
3295 
3301 #define EC_WRITE_U32(DATA, VAL) \
3302  do { \
3303  *((uint32_t *) (DATA)) = cpu_to_le32((uint32_t) (VAL)); \
3304  } while (0)
3305 
3311 #define EC_WRITE_S32(DATA, VAL) EC_WRITE_U32(DATA, VAL)
3312 
3318 #define EC_WRITE_U64(DATA, VAL) \
3319  do { \
3320  *((uint64_t *) (DATA)) = cpu_to_le64((uint64_t) (VAL)); \
3321  } while (0)
3322 
3328 #define EC_WRITE_S64(DATA, VAL) EC_WRITE_U64(DATA, VAL)
3329 
3330 /*****************************************************************************
3331  * Floating-point write functions and macros (userspace only)
3332  ****************************************************************************/
3333 
3334 #ifndef __KERNEL__
3335 
3343 EC_PUBLIC_API void ecrt_write_real(void *data, float value);
3344 
3350 #define EC_WRITE_REAL(DATA, VAL) ecrt_write_real(DATA, VAL)
3351 
3359 EC_PUBLIC_API void ecrt_write_lreal(void *data, double value);
3360 
3366 #define EC_WRITE_LREAL(DATA, VAL) ecrt_write_lreal(DATA, VAL)
3367 
3368 #endif // ifndef __KERNEL__
3369 
3370 /****************************************************************************/
3371 
3372 #ifdef __cplusplus
3373 }
3374 #endif
3375 
3376 /****************************************************************************/
3377 
3380 #endif
unsigned int working_counter
Value of the last working counter.
Definition: ecrt.h:513
uint32_t serial_number
Serial-Number stored on the slave.
Definition: ecrt.h:474
ec_slave_port_desc_t desc
Physical port type.
Definition: ecrt.h:478
uint8_t subindex
PDO entry subindex.
Definition: ecrt.h:642
EC_PUBLIC_API ec_request_state_t ecrt_sdo_request_state(const ec_sdo_request_t *req)
Get the current state of the SDO request.
Definition: sdo_request.c:213
Pre-operational.
Definition: ecrt.h:671
uint16_t position
Slave position.
Definition: ecrt.h:638
EC_PUBLIC_API int ecrt_master_deactivate(ec_master_t *master)
Deactivates the master.
Definition: master.c:2769
Neither read nor write via CoE.
Definition: ecrt.h:552
uint8_t sync_count
Number of sync managers.
Definition: ecrt.h:488
EC_PUBLIC_API int ecrt_master_sii_caching(ec_master_t *master, ec_sii_caching_fields_t fields)
Set the SII caching method.
Definition: master.c:3720
EC_PUBLIC_API int ecrt_sdo_request_write(ec_sdo_request_t *req)
Schedule an SDO write operation.
Definition: sdo_request.c:232
EC_PUBLIC_API int ecrt_slave_config_pdo_assign_clear(ec_slave_config_t *sc, uint8_t sync_index)
Clear a sync manager&#39;s PDO assignment.
Definition: slave_config.c:782
EC_PUBLIC_API int ecrt_master_link_state(const ec_master_t *master, unsigned int dev_idx, ec_master_link_state_t *state)
Reads the current state of a redundant link.
Definition: master.c:3180
unsigned int n_entries
Number of PDO entries in entries to map.
Definition: ecrt.h:601
#define EC_PUBLIC_API
Symbol visibility control macro.
Definition: ecrt.h:271
EC_PUBLIC_API int ecrt_voe_handler_read(ec_voe_handler_t *voe)
Start a VoE read operation.
Definition: voe_handler.c:172
uint8_t bit_length
Size of the PDO entry in bit.
Definition: ecrt.h:588
ec_direction_t dir
Sync manager direction.
Definition: ecrt.h:622
uint8_t error_flag
Error flag for that slave.
Definition: ecrt.h:487
ec_pdo_mode_t
PDO handling mode.
Definition: ecrt.h:551
ec_watchdog_mode_t
Watchdog mode for sync manager configuration.
Definition: ecrt.h:535
ec_slave_port_desc_t
EtherCAT slave port descriptor.
Definition: ecrt.h:444
ec_pdo_info_t const * pdos
Array with PDOs to assign.
Definition: ecrt.h:624
EC_PUBLIC_API int ecrt_slave_config_sdo32(ec_slave_config_t *sc, uint16_t sdo_index, uint8_t sdo_subindex, uint32_t value)
Add a configuration value for a 32-bit SDO.
EC_PUBLIC_API int ecrt_master_send(ec_master_t *master)
Sends all datagrams in the queue.
Definition: master.c:2839
ec_al_state_t
Application-layer state.
Definition: ecrt.h:669
Use vendor ID.
Definition: ecrt.h:685
EC_PUBLIC_API int ecrt_sdo_request_timeout(ec_sdo_request_t *req, uint32_t timeout)
Set the timeout for an SDO request.
Definition: sdo_request.c:191
EC_PUBLIC_API int ecrt_master_scan_progress(ec_master_t *master, ec_master_scan_progress_t *progress)
Obtains network scan progress information.
Definition: master.c:3067
EC_PUBLIC_API int ecrt_soe_request_timeout(ec_soe_request_t *req, uint32_t timeout)
Set the timeout for an SoE request.
Definition: soe_request.c:290
unsigned int redundancy_active
Redundant link is in use.
Definition: ecrt.h:515
EC_PUBLIC_API int ecrt_slave_config_watchdog(ec_slave_config_t *sc, uint16_t watchdog_divider, uint16_t watchdog_intervals)
Configure a slave&#39;s watchdog times.
Definition: slave_config.c:715
CANopen SDO request.
Definition: sdo_request.h:40
EC_PUBLIC_API uint8_t * ecrt_sdo_request_data(const ec_sdo_request_t *req)
Access to the SDO request&#39;s data.
Definition: sdo_request.c:199
unsigned int slave_count
Number of slaves in the network.
Definition: ecrt.h:417
EC_PUBLIC_API int ecrt_domain_reg_pdo_entry_list(ec_domain_t *domain, const ec_pdo_entry_reg_t *pdo_entry_regs)
Registers a bunch of PDO entries for a domain.
Definition: domain.c:442
EC_PUBLIC_API int ecrt_master_sdo_download_complete(ec_master_t *master, uint16_t slave_position, uint16_t index, const uint8_t *data, size_t data_size, uint32_t *abort_code)
Executes an SDO download request to write data to a slave via complete access.
Definition: master.c:3382
EC_PUBLIC_API ec_domain_t * ecrt_master_create_domain(ec_master_t *master)
Creates a new process data domain.
Definition: master.c:2685
uint16_t index
PDO entry index.
Definition: ecrt.h:641
EC_PUBLIC_API int ecrt_slave_config_reg_pdo_entry(ec_slave_config_t *sc, uint16_t entry_index, uint8_t entry_subindex, ec_domain_t *domain, unsigned int *bit_position)
Registers a PDO entry for process data exchange in a domain.
Definition: slave_config.c:930
Operational.
Definition: ecrt.h:673
uint32_t vendor_id
Vendor-ID stored on the slave.
Definition: ecrt.h:471
Register request.
Definition: reg_request.h:40
ec_slave_port_link_t link
Port link state.
Definition: ecrt.h:479
EC_PUBLIC_API int ecrt_master_sync_reference_clock(ec_master_t *master)
Queues the DC reference clock drift compensation datagram for sending.
Definition: master.c:3235
Safe-operational.
Definition: ecrt.h:672
EC_PUBLIC_API int ecrt_slave_config_sdo(ec_slave_config_t *sc, uint16_t index, uint8_t subindex, const uint8_t *data, size_t size)
Add an SDO configuration.
EC_PUBLIC_API int ecrt_domain_state(const ec_domain_t *domain, ec_domain_state_t *state)
Reads the state of a domain.
Definition: domain.c:723
EC_PUBLIC_API int ecrt_sdo_request_read(ec_sdo_request_t *req)
Schedule an SDO read operation.
Definition: sdo_request.c:220
void ecrt_master_callbacks(ec_master_t *master, void(*send_cb)(void *), void(*receive_cb)(void *), void *cb_data)
Sets the locking callbacks.
Definition: master.c:3142
EC_PUBLIC_API int ecrt_voe_handler_write(ec_voe_handler_t *voe, size_t size)
Start a VoE write operation.
Definition: voe_handler.c:194
EC_PUBLIC_API int ecrt_slave_config_sync_manager(ec_slave_config_t *sc, uint8_t sync_index, ec_direction_t direction, ec_watchdog_mode_t watchdog_mode)
Configure a sync manager.
Definition: slave_config.c:688
Master scan progress information.
Definition: ecrt.h:432
Disable the watchdog.
Definition: ecrt.h:538
EC_PUBLIC_API int ecrt_slave_config_emerg_overruns(const ec_slave_config_t *sc)
Read the number of CoE emergency overruns.
uint32_t delay_to_next_dc
Delay [ns] to next DC slave.
Definition: ecrt.h:484
EC_PUBLIC_API int ecrt_soe_request_idn(ec_soe_request_t *req, uint8_t drive_no, uint16_t idn)
Set the request&#39;s drive and Sercos ID numbers.
Definition: soe_request.c:280
EC_PUBLIC_API int ecrt_slave_config_idn(ec_slave_config_t *sc, uint8_t drive_no, uint16_t idn, ec_al_state_t state, const uint8_t *data, size_t size)
Add an SoE IDN configuration.
Enable the watchdog.
Definition: ecrt.h:537
ec_wc_state_t wc_state
Working counter interpretation.
Definition: ecrt.h:514
PDO configuration information.
Definition: ecrt.h:599
EC_PUBLIC_API int ecrt_slave_config_state_timeout(ec_slave_config_t *sc, ec_al_state_t from_state, ec_al_state_t to_state, unsigned int timeout_ms)
Sets the application-layer state transition timeout in ms.
Sync manager configuration information.
Definition: ecrt.h:618
EC_PUBLIC_API int ecrt_slave_config_eoe_dns_address(ec_slave_config_t *sc, struct in_addr dns_address)
Sets the IPv4 address of the DNS server for Ethernet-over-EtherCAT (EoE) operation.
ec_wc_state_t
Domain working counter interpretation.
Definition: ecrt.h:499
EC_PUBLIC_API uint8_t * ecrt_reg_request_data(const ec_reg_request_t *req)
Access to the register request&#39;s data.
Definition: reg_request.c:78
EC_PUBLIC_API int ecrt_slave_config_reg_pdo_entry_pos(ec_slave_config_t *sc, uint8_t sync_index, unsigned int pdo_pos, unsigned int entry_pos, ec_domain_t *domain, unsigned int *bit_position)
Registers a PDO entry using its position.
Definition: slave_config.c:985
unsigned int slaves_responding
Sum of responding slaves on all Ethernet devices.
Definition: ecrt.h:347
EC_PUBLIC_API int ecrt_slave_config_sdo8(ec_slave_config_t *sc, uint16_t sdo_index, uint8_t sdo_subindex, uint8_t value)
Add a configuration value for an 8-bit SDO.
void ecrt_domain_external_memory(ec_domain_t *domain, uint8_t *memory)
Provide external memory to store the domain&#39;s process data.
Definition: domain.c:478
EC_PUBLIC_API int ecrt_slave_config_state(const ec_slave_config_t *sc, ec_slave_config_state_t *state)
Outputs the state of the slave configuration.
EC_PUBLIC_API ec_voe_handler_t * ecrt_slave_config_create_voe_handler(ec_slave_config_t *sc, size_t size)
Create an VoE handler to exchange vendor-specific data during realtime operation. ...
unsigned int link_up
true, if the network link is up.
Definition: ecrt.h:418
EC_PUBLIC_API int ecrt_master_write_idn(ec_master_t *master, uint16_t slave_position, uint8_t drive_no, uint16_t idn, const uint8_t *data, size_t data_size, uint16_t *error_code)
Executes an SoE write request.
Definition: master.c:3546
Some of the registered process data were exchanged.
Definition: ecrt.h:501
EC_PUBLIC_API unsigned int ecrt_version_magic(void)
Returns the version magic of the realtime interface.
Definition: module.c:650
uint32_t revision_number
Revision-Number stored on the slave.
Definition: ecrt.h:473
Use the default setting of the sync manager.
Definition: ecrt.h:536
EC_PUBLIC_API ec_sdo_request_t * ecrt_slave_config_create_sdo_request(ec_slave_config_t *sc, uint16_t index, uint8_t subindex, size_t size)
Create an SDO request to exchange SDOs during realtime operation.
EC_PUBLIC_API uint8_t * ecrt_domain_data(const ec_domain_t *domain)
Returns the domain&#39;s process data.
Definition: domain.c:495
EC_PUBLIC_API int ecrt_domain_queue(ec_domain_t *domain)
(Re-)queues all domain datagrams in the master&#39;s datagram queue.
Definition: domain.c:693
uint16_t alias
Slave alias address.
Definition: ecrt.h:637
EC_PUBLIC_API int ecrt_master_reference_clock_time(const ec_master_t *master, uint32_t *time)
Get the lower 32 bit of the reference clock system time.
Definition: master.c:3208
Not requested.
Definition: ecrt.h:659
uint16_t index
PDO index.
Definition: ecrt.h:600
EC_PUBLIC_API int ecrt_slave_config_emerg_clear(ec_slave_config_t *sc)
Clears CoE emergency ring buffer and the overrun counter.
EC_PUBLIC_API int ecrt_master_sync_reference_clock_to(ec_master_t *master, uint64_t sync_time)
Queues the DC reference clock drift compensation datagram for sending.
Definition: master.c:3248
Read the current state via CoE while scanning the slave, and write it back only if it differs from th...
Definition: ecrt.h:562
EC_PUBLIC_API uint8_t * ecrt_soe_request_data(const ec_soe_request_t *req)
Access to the SoE request&#39;s data.
Definition: soe_request.c:298
Master state.
Definition: ecrt.h:346
EC_PUBLIC_API int ecrt_sdo_request_index(ec_sdo_request_t *req, uint16_t index, uint8_t subindex)
Set the SDO index and subindex.
Definition: sdo_request.c:181
Slave configuration state.
Definition: ecrt.h:394
Request is being processed.
Definition: ecrt.h:660
uint64_t app_time
Application time.
Definition: ecrt.h:421
ec_watchdog_mode_t watchdog_mode
Watchdog mode.
Definition: ecrt.h:626
unsigned int n_pdos
Number of PDOs in pdos.
Definition: ecrt.h:623
Domain state.
Definition: ecrt.h:512
uint32_t vendor_id
Slave vendor ID.
Definition: ecrt.h:639
unsigned int al_state
The application-layer state of the slave.
Definition: ecrt.h:398
unsigned int * bit_position
Pointer to a variable to store a bit position (0-7) within the offset.
Definition: ecrt.h:645
EC_PUBLIC_API size_t ecrt_domain_size(const ec_domain_t *domain)
Returns the current size of the domain&#39;s process data.
Definition: domain.c:471
Use revision number.
Definition: ecrt.h:687
EC_PUBLIC_API int ecrt_master_application_time(ec_master_t *master, uint64_t app_time)
Sets the application time.
Definition: master.c:3196
Port is an E-Bus.
Definition: ecrt.h:447
Read the current state via CoE while scanning the slave, and unconditionally (re-)write it every time...
Definition: ecrt.h:558
unsigned int operational
The slave was brought into OP state using the specified configuration.
Definition: ecrt.h:396
EC_PUBLIC_API int ecrt_voe_handler_received_header(const ec_voe_handler_t *voe, uint32_t *vendor_id, uint16_t *vendor_type)
Reads the header data of a received VoE message.
Definition: voe_handler.c:144
EC_PUBLIC_API int ecrt_master_read_idn(ec_master_t *master, uint16_t slave_position, uint8_t drive_no, uint16_t idn, uint8_t *target, size_t target_size, size_t *result_size, uint16_t *error_code)
Executes an SoE read request.
Definition: master.c:3622
ec_direction_t
Direction type for PDO assignment functions.
Definition: ecrt.h:522
EC_PUBLIC_API size_t ecrt_sdo_request_data_size(const ec_sdo_request_t *req)
Returns the current SDO data size.
Definition: sdo_request.c:206
EC_PUBLIC_API int ecrt_reg_request_write(ec_reg_request_t *req, uint16_t address, size_t size)
Schedule an register write operation.
Definition: reg_request.c:92
EC_PUBLIC_API ec_slave_config_t * ecrt_master_slave_config(ec_master_t *master, uint16_t alias, uint16_t position, uint32_t vendor_id, uint32_t product_code)
Obtains a slave configuration.
Definition: master.c:3018
Port is a MII.
Definition: ecrt.h:448
EC_PUBLIC_API int ecrt_slave_config_flag(ec_slave_config_t *sc, const char *key, int32_t value)
Adds a feature flag to a slave configuration.
Vendor specific over EtherCAT handler.
Definition: voe_handler.h:42
EC_PUBLIC_API size_t ecrt_soe_request_data_size(const ec_soe_request_t *req)
Returns the current IDN data size.
Definition: soe_request.c:305
EC_PUBLIC_API ec_request_state_t ecrt_soe_request_state(const ec_soe_request_t *req)
Get the current state of the SoE request.
Definition: soe_request.c:312
ec_pdo_entry_info_t const * entries
Array of PDO entries to map.
Definition: ecrt.h:605
EC_PUBLIC_API int ecrt_slave_config_pdo_assign_add(ec_slave_config_t *sc, uint8_t sync_index, uint16_t index)
Add a PDO to a sync manager&#39;s PDO assignment.
Definition: slave_config.c:752
EC_PUBLIC_API int ecrt_slave_config_dc(ec_slave_config_t *sc, uint16_t assign_activate, uint32_t sync0_cycle, int32_t sync0_shift, uint32_t sync1_cycle, int32_t sync1_shift)
Configure distributed clocks.
EC_PUBLIC_API ec_request_state_t ecrt_reg_request_state(const ec_reg_request_t *req)
Get the current state of the register request.
Definition: reg_request.c:85
EC_PUBLIC_API ec_reg_request_t * ecrt_slave_config_create_reg_request(ec_slave_config_t *sc, size_t size)
Create a register request to exchange EtherCAT register contents during realtime operation.
EC_PUBLIC_API int ecrt_slave_config_eoe_ip_address(ec_slave_config_t *sc, struct in_addr ip_address)
Sets the IP address for Ethernet-over-EtherCAT (EoE) operation.
int ecrt_master_send_ext(ec_master_t *master)
Sends non-application datagrams.
Definition: master.c:2940
EC_PUBLIC_API int ecrt_master_select_reference_clock(ec_master_t *master, ec_slave_config_t *sc)
Selects the reference clock for distributed clocks.
Definition: master.c:3029
Values read by the master.
Definition: ecrt.h:525
EC_PUBLIC_API int ecrt_master_sync_monitor_queue(ec_master_t *master)
Queues the DC synchrony monitoring datagram for sending.
Definition: master.c:3283
unsigned int online
The slave is online.
Definition: ecrt.h:395
Port is not configured.
Definition: ecrt.h:446
EC_PUBLIC_API int ecrt_master(ec_master_t *master, ec_master_info_t *master_info)
Obtains master information.
Definition: master.c:3053
Port is not implemented.
Definition: ecrt.h:445
Slave information.
Definition: ecrt.h:469
EC_PUBLIC_API int ecrt_slave_config_pdo_mapping_clear(ec_slave_config_t *sc, uint16_t pdo_index)
Clear the mapping of a given PDO.
Definition: slave_config.c:838
Write the configured state via CoE every time the slave is configured, without reading the current st...
Definition: ecrt.h:555
EC_PUBLIC_API int ecrt_master_get_slave(ec_master_t *master, uint16_t slave_position, ec_slave_info_t *slave_info)
Obtains slave information.
Definition: master.c:3080
uint16_t index
PDO entry index.
Definition: ecrt.h:586
uint8_t al_state
Current state of the slave.
Definition: ecrt.h:486
uint8_t scan_busy
true, while the master is scanning the network.
Definition: ecrt.h:419
EC_PUBLIC_API ec_master_t * ecrt_request_master(unsigned int master_index)
Requests an EtherCAT master for realtime operation.
Definition: module.c:616
int16_t current_on_ebus
Used current in mA.
Definition: ecrt.h:476
EC_PUBLIC_API int ecrt_domain_process(ec_domain_t *domain)
Determines the states of the domain&#39;s datagrams.
Definition: domain.c:502
EC_PUBLIC_API int ecrt_slave_config_eoe_default_gateway(ec_slave_config_t *sc, struct in_addr gateway_address)
Sets the gateway address for Ethernet-over-EtherCAT (EoE) operation.
Invalid direction.
Definition: ecrt.h:523
#define EC_MAX_PORTS
Maximum number of slave ports.
Definition: ecrt.h:294
EC_PUBLIC_API int ecrt_master_sdo_download(ec_master_t *master, uint16_t slave_position, uint16_t index, uint8_t subindex, const uint8_t *data, size_t data_size, uint32_t *abort_code)
Executes an SDO download request to write data to a slave.
Definition: master.c:3303
EC_PUBLIC_API uint8_t * ecrt_voe_handler_data(const ec_voe_handler_t *voe)
Access to the VoE handler&#39;s data.
Definition: voe_handler.c:158
Number of directions.
Definition: ecrt.h:526
EC_PUBLIC_API int ecrt_slave_config_emerg_pop(ec_slave_config_t *sc, uint8_t *target)
Read and remove one record from the CoE emergency ring buffer.
EC_PUBLIC_API ec_soe_request_t * ecrt_slave_config_create_soe_request(ec_slave_config_t *sc, uint8_t drive_no, uint16_t idn, size_t size)
Create an SoE request to exchange SoE IDNs during realtime operation.
EC_PUBLIC_API int ecrt_slave_config_complete_sdo(ec_slave_config_t *sc, uint16_t index, const uint8_t *data, size_t size)
Add configuration data for a complete SDO.
uint16_t sdo_count
Number of SDOs.
Definition: ecrt.h:489
#define EC_MAX_STRING_LENGTH
Maximum string length.
Definition: ecrt.h:291
Disable SII caching.
Definition: ecrt.h:684
List record type for PDO entry mass-registration.
Definition: ecrt.h:636
unsigned int link_up
true, if at least one Ethernet link is up.
Definition: ecrt.h:358
EC_PUBLIC_API int ecrt_slave_config_pdos(ec_slave_config_t *sc, unsigned int n_syncs, const ec_sync_info_t syncs[])
Specify a complete PDO configuration.
Definition: slave_config.c:864
EC_PUBLIC_API int ecrt_voe_handler_send_header(ec_voe_handler_t *voe, uint32_t vendor_id, uint16_t vendor_type)
Sets the VoE header for future send operations.
Definition: voe_handler.c:134
EC_PUBLIC_API int ecrt_slave_config_eoe_hostname(ec_slave_config_t *sc, const char *name)
Sets the host name for Ethernet-over-EtherCAT (EoE) operation.
EC_PUBLIC_API int ecrt_slave_config_pdo_mode(ec_slave_config_t *sc, ec_pdo_mode_t assign_mode, ec_pdo_mode_t config_mode)
Selects how a slave&#39;s PDO assignment and PDO configuration are read from resp.
Definition: slave_config.c:728
unsigned int scan_index
Index of the slave that is currently scanned.
Definition: ecrt.h:434
uint16_t next_slave
Ring position of next DC slave on that port.
Definition: ecrt.h:482
No registered process data were exchanged.
Definition: ecrt.h:500
All registered process data were exchanged.
Definition: ecrt.h:503
unsigned int al_states
Application-layer states of all slaves.
Definition: ecrt.h:349
EC_PUBLIC_API int ecrt_master_activate(ec_master_t *master)
Finishes the configuration phase and prepares for cyclic operation.
Definition: master.c:2695
EC_PUBLIC_API int ecrt_soe_request_read(ec_soe_request_t *req)
Schedule an SoE IDN read operation.
Definition: soe_request.c:319
EC_PUBLIC_API size_t ecrt_voe_handler_data_size(const ec_voe_handler_t *voe)
Returns the current data size.
Definition: voe_handler.c:165
EC_PUBLIC_API ec_request_state_t ecrt_voe_handler_execute(ec_voe_handler_t *voe)
Execute the handler.
Definition: voe_handler.c:206
uint16_t alias
The slaves alias if not equal to 0.
Definition: ecrt.h:475
EtherCAT slave configuration.
Definition: slave_config.h:111
uint32_t product_code
Product-Code stored on the slave.
Definition: ecrt.h:472
EC_PUBLIC_API int ecrt_master_receive(ec_master_t *master)
Fetches received frames from the hardware and processes the datagrams.
Definition: master.c:2887
unsigned int slave_count
Number of slaves detected.
Definition: ecrt.h:433
EC_PUBLIC_API uint32_t ecrt_master_sync_monitor_process(const ec_master_t *master)
Processes the DC synchrony monitoring datagram.
Definition: master.c:3292
Request was processed successfully.
Definition: ecrt.h:661
unsigned int * offset
Pointer to a variable to store the PDO entry&#39;s (byte-)offset in the process data. ...
Definition: ecrt.h:643
ec_request_state_t
Request state.
Definition: ecrt.h:658
Use product code.
Definition: ecrt.h:686
Master information.
Definition: ecrt.h:416
PDO entry configuration information.
Definition: ecrt.h:585
uint8_t index
Sync manager index.
Definition: ecrt.h:619
Values written by the master.
Definition: ecrt.h:524
EC_PUBLIC_API int ecrt_slave_config_eoe_mac_address(ec_slave_config_t *sc, const unsigned char *mac_address)
Sets the link/MAC address for Ethernet-over-EtherCAT (EoE) operation.
Init.
Definition: ecrt.h:670
EC_PUBLIC_API int ecrt_soe_request_write(ec_soe_request_t *req)
Schedule an SoE IDN write operation.
Definition: soe_request.c:326
Use serial number.
Definition: ecrt.h:688
EC_PUBLIC_API int ecrt_slave_config_sdo16(ec_slave_config_t *sc, uint16_t sdo_index, uint8_t sdo_subindex, uint16_t value)
Add a configuration value for a 16-bit SDO.
EC_PUBLIC_API int ecrt_slave_config_eoe_subnet_mask(ec_slave_config_t *sc, struct in_addr subnet_mask)
Sets the subnet mask for Ethernet-over-EtherCAT (EoE) operation.
EC_PUBLIC_API int ecrt_slave_config_pdo_mapping_add(ec_slave_config_t *sc, uint16_t pdo_index, uint16_t entry_index, uint8_t entry_subindex, uint8_t entry_bit_length)
Add a PDO entry to the given PDO&#39;s mapping.
Definition: slave_config.c:801
EC_PUBLIC_API int ecrt_slave_config_emerg_size(ec_slave_config_t *sc, size_t elements)
Set the size of the CoE emergency ring buffer.
uint16_t position
Offset of the slave in the ring.
Definition: ecrt.h:470
uint32_t receive_time
Receive time on DC transmission delay measurement.
Definition: ecrt.h:480
uint32_t product_code
Slave product code.
Definition: ecrt.h:640
EtherCAT master.
Definition: master.h:194
Request processing failed.
Definition: ecrt.h:662
EC_PUBLIC_API int ecrt_master_set_send_interval(ec_master_t *master, size_t send_interval)
Set interval between calls to ecrt_master_send().
ec_sii_caching_fields_t
Fields for SII caching.
Definition: ecrt.h:682
uint8_t subindex
PDO entry subindex.
Definition: ecrt.h:587
EC_PUBLIC_API int ecrt_reg_request_read(ec_reg_request_t *req, uint16_t address, size_t size)
Schedule a register read operation.
Definition: reg_request.c:104
EC_PUBLIC_API int ecrt_master_sync_slave_clocks(ec_master_t *master)
Queues the DC clock drift compensation datagram for sending.
Definition: master.c:3264
EC_PUBLIC_API int ecrt_master_state(const ec_master_t *master, ec_master_state_t *state)
Reads the current master state.
Definition: master.c:3156
Sercos-over-EtherCAT request.
Definition: soe_request.h:40
EC_PUBLIC_API void ecrt_release_master(ec_master_t *master)
Releases a requested EtherCAT master.
Definition: module.c:624
EC_PUBLIC_API int ecrt_master_reset(ec_master_t *master)
Retry configuring slaves.
Definition: master.c:3706
EtherCAT domain.
Definition: domain.h:46
EC_PUBLIC_API int ecrt_master_sdo_upload(ec_master_t *master, uint16_t slave_position, uint16_t index, uint8_t subindex, uint8_t *target, size_t target_size, size_t *result_size, uint32_t *abort_code)
Executes an SDO upload request to read data from a slave.
Definition: master.c:3463
EC_PUBLIC_API int ecrt_voe_handler_read_nosync(ec_voe_handler_t *voe)
Start a VoE read operation without querying the sync manager status.
Definition: voe_handler.c:183