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 
886  ec_master_t *master,
887  ec_slave_config_t *sc
889  );
890 
902  ec_master_t *master,
903  ec_master_info_t *master_info
905  );
906 
918  ec_master_t *master,
919  ec_master_scan_progress_t *progress
921  );
922 
936  ec_master_t *master,
937  uint16_t slave_position,
938  ec_slave_info_t *slave_info
940  );
941 
942 #ifndef __KERNEL__
943 
954 EC_PUBLIC_API int ecrt_master_get_sync_manager(
955  ec_master_t *master,
956  uint16_t slave_position,
957  uint8_t sync_index,
959  ec_sync_info_t *sync
960  );
961 
973 EC_PUBLIC_API int ecrt_master_get_pdo(
974  ec_master_t *master,
975  uint16_t slave_position,
976  uint8_t sync_index,
978  uint16_t pos,
979  ec_pdo_info_t *pdo
980  );
981 
991 EC_PUBLIC_API int ecrt_master_get_pdo_entry(
992  ec_master_t *master,
993  uint16_t slave_position,
994  uint8_t sync_index,
996  uint16_t pdo_pos,
997  uint16_t entry_pos,
998  ec_pdo_entry_info_t *entry
999  );
1000 
1001 #endif /* #ifndef __KERNEL__ */
1002 
1015  ec_master_t *master,
1016  uint16_t slave_position,
1017  uint16_t index,
1018  uint8_t subindex,
1019  const uint8_t *data,
1020  size_t data_size,
1021  uint32_t *abort_code
1022  );
1023 
1037  ec_master_t *master,
1038  uint16_t slave_position,
1039  uint16_t index,
1040  const uint8_t *data,
1041  size_t data_size,
1042  uint32_t *abort_code
1043  );
1044 
1057  ec_master_t *master,
1058  uint16_t slave_position,
1059  uint16_t index,
1060  uint8_t subindex,
1061  uint8_t *target,
1062  size_t target_size,
1063  size_t *result_size,
1064  uint32_t *abort_code
1065  );
1066 
1078  ec_master_t *master,
1079  uint16_t slave_position,
1080  uint8_t drive_no,
1081  uint16_t idn,
1082  const uint8_t *data,
1083  size_t data_size,
1084  uint16_t *error_code
1086  );
1087 
1099  ec_master_t *master,
1100  uint16_t slave_position,
1101  uint8_t drive_no,
1102  uint16_t idn,
1103  uint8_t *target,
1105  size_t target_size,
1106  size_t *result_size,
1107  uint16_t *error_code
1109  );
1110 
1131  ec_master_t *master
1132  );
1133 
1150  ec_master_t *master
1151  );
1152 
1166  ec_master_t *master,
1167  size_t send_interval
1168  );
1169 
1183  ec_master_t *master
1184  );
1185 
1201  ec_master_t *master
1202  );
1203 
1204 #ifdef __KERNEL__
1205 
1216  ec_master_t *master
1217  );
1218 #endif
1219 
1232  const ec_master_t *master,
1233  ec_master_state_t *state
1234  );
1235 
1245  const ec_master_t *master,
1246  unsigned int dev_idx,
1248  ec_master_link_state_t *state
1250  );
1251 
1278  ec_master_t *master,
1279  uint64_t app_time
1280  );
1281 
1294  ec_master_t *master
1295  );
1296 
1312  ec_master_t *master,
1313  uint64_t sync_time
1314  );
1315 
1330  ec_master_t *master
1331  );
1332 
1356  const ec_master_t *master,
1357  uint32_t *time
1358  );
1359 
1371  ec_master_t *master
1372  );
1373 
1386  const ec_master_t *master
1387  );
1388 
1404  ec_master_t *master
1405  );
1406 
1441  ec_master_t *master,
1442  ec_sii_caching_fields_t fields
1443  );
1444 
1445 /*****************************************************************************
1446  * Slave configuration methods
1447  ****************************************************************************/
1448 
1462  ec_slave_config_t *sc,
1463  uint8_t sync_index,
1465  ec_direction_t direction,
1466  ec_watchdog_mode_t watchdog_mode
1467  );
1468 
1479  ec_slave_config_t *sc,
1480  uint16_t watchdog_divider,
1485  uint16_t watchdog_intervals
1489  );
1490 
1538  ec_slave_config_t *sc,
1539  ec_pdo_mode_t assign_mode,
1540  ec_pdo_mode_t config_mode
1541  );
1542 
1554  ec_slave_config_t *sc,
1555  uint8_t sync_index,
1557  uint16_t index
1558  );
1559 
1575  ec_slave_config_t *sc,
1576  uint8_t sync_index
1578  );
1579 
1591  ec_slave_config_t *sc,
1592  uint16_t pdo_index,
1593  uint16_t entry_index,
1595  uint8_t entry_subindex,
1597  uint8_t entry_bit_length
1598  );
1599 
1614  ec_slave_config_t *sc,
1615  uint16_t pdo_index
1616  );
1617 
1692  ec_slave_config_t *sc,
1693  unsigned int n_syncs,
1695  const ec_sync_info_t syncs[]
1697  );
1698 
1720  ec_slave_config_t *sc,
1721  uint16_t entry_index,
1722  uint8_t entry_subindex,
1723  ec_domain_t *domain,
1724  unsigned int *bit_position
1726  );
1727 
1744  ec_slave_config_t *sc,
1745  uint8_t sync_index,
1746  unsigned int pdo_pos,
1747  unsigned int entry_pos,
1748  ec_domain_t *domain,
1749  unsigned int *bit_position
1751  );
1752 
1826  ec_slave_config_t *sc,
1827  uint16_t assign_activate,
1828  uint32_t sync0_cycle,
1829  int32_t sync0_shift,
1830  uint32_t sync1_cycle,
1831  int32_t sync1_shift
1832  );
1833 
1862  ec_slave_config_t *sc,
1863  uint16_t index,
1864  uint8_t subindex,
1865  const uint8_t *data,
1866  size_t size
1867  );
1868 
1882  ec_slave_config_t *sc,
1883  uint16_t sdo_index,
1884  uint8_t sdo_subindex,
1885  uint8_t value
1886  );
1887 
1901  ec_slave_config_t *sc,
1902  uint16_t sdo_index,
1903  uint8_t sdo_subindex,
1904  uint16_t value
1905  );
1906 
1920  ec_slave_config_t *sc,
1921  uint16_t sdo_index,
1922  uint8_t sdo_subindex,
1923  uint32_t value
1924  );
1925 
1942  ec_slave_config_t *sc,
1943  uint16_t index,
1944  const uint8_t *data,
1945  size_t size
1946  );
1947 
1961  ec_slave_config_t *sc,
1962  size_t elements
1963  );
1964 
1982  ec_slave_config_t *sc,
1983  uint8_t *target
1985  );
1986 
1998  ec_slave_config_t *sc
1999  );
2000 
2016  const ec_slave_config_t *sc
2017  );
2018 
2032  ec_slave_config_t *sc,
2033  uint16_t index,
2034  uint8_t subindex,
2035  size_t size
2036  );
2037 
2051  ec_slave_config_t *sc,
2052  uint8_t drive_no,
2053  uint16_t idn,
2054  size_t size
2055  );
2056 
2075  ec_slave_config_t *sc,
2076  size_t size
2077  );
2078 
2096  ec_slave_config_t *sc,
2097  size_t size
2098  );
2099 
2118  const ec_slave_config_t *sc,
2119  ec_slave_config_state_t *state
2120  );
2121 
2147  ec_slave_config_t *sc,
2148  uint8_t drive_no,
2149  uint16_t idn,
2150  ec_al_state_t state,
2152  const uint8_t *data,
2153  size_t size
2154  );
2155 
2181  ec_slave_config_t *sc,
2182  const char *key,
2183  int32_t value
2184  );
2185 
2200  ec_slave_config_t *sc,
2201  const unsigned char *mac_address
2202  );
2203 
2238  ec_slave_config_t *sc,
2239  struct in_addr ip_address
2240  );
2241 
2262  ec_slave_config_t *sc,
2263  struct in_addr subnet_mask
2264  );
2265 
2286  ec_slave_config_t *sc,
2287  struct in_addr gateway_address
2288  );
2289 
2311  ec_slave_config_t *sc,
2312  struct in_addr dns_address
2313  );
2314 
2332  ec_slave_config_t *sc,
2333  const char *name
2334  );
2335 
2353  ec_slave_config_t *sc,
2354  ec_al_state_t from_state,
2355  ec_al_state_t to_state,
2356  unsigned int timeout_ms
2357  );
2358 
2359 /*****************************************************************************
2360  * Domain methods
2361  ****************************************************************************/
2362 
2378  ec_domain_t *domain,
2379  const ec_pdo_entry_reg_t *pdo_entry_regs
2381  );
2382 
2392  const ec_domain_t *domain
2393  );
2394 
2395 #ifdef __KERNEL__
2396 
2411  ec_domain_t *domain,
2412  uint8_t *memory
2414  );
2415 
2416 #endif /* __KERNEL__ */
2417 
2434  const ec_domain_t *domain
2435  );
2436 
2449  ec_domain_t *domain
2450  );
2451 
2462  ec_domain_t *domain
2463  );
2464 
2476  const ec_domain_t *domain,
2477  ec_domain_state_t *state
2479  );
2480 
2481 /*****************************************************************************
2482  * SDO request methods.
2483  ****************************************************************************/
2484 
2500  ec_sdo_request_t *req,
2501  uint16_t index,
2502  uint8_t subindex
2503  );
2504 
2521  ec_sdo_request_t *req,
2522  uint32_t timeout
2524  );
2525 
2556  const ec_sdo_request_t *req
2557  );
2558 
2574  const ec_sdo_request_t *req
2575  );
2576 
2591 #ifdef __KERNEL__
2592  const
2593 #endif
2594  ec_sdo_request_t *req
2595  );
2596 
2613  ec_sdo_request_t *req
2614  );
2615 
2633  ec_sdo_request_t *req
2634  );
2635 
2636 /*****************************************************************************
2637  * SoE request methods.
2638  ****************************************************************************/
2639 
2655  ec_soe_request_t *req,
2656  uint8_t drive_no,
2657  uint16_t idn
2658  );
2659 
2676  ec_soe_request_t *req,
2677  uint32_t timeout
2679  );
2680 
2711  const ec_soe_request_t *req
2712  );
2713 
2725  const ec_soe_request_t *req
2726  );
2727 
2741 #ifdef __KERNEL__
2742  const
2743 #endif
2744  ec_soe_request_t *req
2745  );
2746 
2763  ec_soe_request_t *req
2764  );
2765 
2783  ec_soe_request_t *req
2784  );
2785 
2786 /*****************************************************************************
2787  * VoE handler methods.
2788  ****************************************************************************/
2789 
2806  ec_voe_handler_t *voe,
2807  uint32_t vendor_id,
2808  uint16_t vendor_type
2809  );
2810 
2827  const ec_voe_handler_t *voe,
2828  uint32_t *vendor_id,
2829  uint16_t *vendor_type
2830  );
2831 
2855  const ec_voe_handler_t *voe
2856  );
2857 
2873  const ec_voe_handler_t *voe
2874  );
2875 
2893  ec_voe_handler_t *voe,
2894  size_t size
2895  );
2896 
2920  ec_voe_handler_t *voe
2921  );
2922 
2947  ec_voe_handler_t *voe
2948  );
2949 
2964  ec_voe_handler_t *voe
2965  );
2966 
2967 /*****************************************************************************
2968  * Register request methods.
2969  ****************************************************************************/
2970 
2997  const ec_reg_request_t *req
2998  );
2999 
3011  const ec_reg_request_t *req
3012  );
3013 
3032  ec_reg_request_t *req,
3033  uint16_t address,
3034  size_t size
3035  );
3036 
3055  ec_reg_request_t *req,
3056  uint16_t address,
3057  size_t size
3058  );
3059 
3060 /*****************************************************************************
3061  * Bitwise read/write macros
3062  ****************************************************************************/
3063 
3069 #define EC_READ_BIT(DATA, POS) ((*((uint8_t *) (DATA)) >> (POS)) & 0x01)
3070 
3077 #define EC_WRITE_BIT(DATA, POS, VAL) \
3078  do { \
3079  if (VAL) *((uint8_t *) (DATA)) |= (1 << (POS)); \
3080  else *((uint8_t *) (DATA)) &= ~(1 << (POS)); \
3081  } while (0)
3082 
3083 /*****************************************************************************
3084  * Byte-swapping functions for user space
3085  ****************************************************************************/
3086 
3087 #ifndef __KERNEL__
3088 
3089 #if __BYTE_ORDER == __LITTLE_ENDIAN
3090 
3091 #define le16_to_cpu(x) x
3092 #define le32_to_cpu(x) x
3093 #define le64_to_cpu(x) x
3094 
3095 #define cpu_to_le16(x) x
3096 #define cpu_to_le32(x) x
3097 #define cpu_to_le64(x) x
3098 
3099 #elif __BYTE_ORDER == __BIG_ENDIAN
3100 
3101 #define swap16(x) \
3102  ((uint16_t)( \
3103  (((uint16_t)(x) & 0x00ffU) << 8) | \
3104  (((uint16_t)(x) & 0xff00U) >> 8) ))
3105 #define swap32(x) \
3106  ((uint32_t)( \
3107  (((uint32_t)(x) & 0x000000ffUL) << 24) | \
3108  (((uint32_t)(x) & 0x0000ff00UL) << 8) | \
3109  (((uint32_t)(x) & 0x00ff0000UL) >> 8) | \
3110  (((uint32_t)(x) & 0xff000000UL) >> 24) ))
3111 #define swap64(x) \
3112  ((uint64_t)( \
3113  (((uint64_t)(x) & 0x00000000000000ffULL) << 56) | \
3114  (((uint64_t)(x) & 0x000000000000ff00ULL) << 40) | \
3115  (((uint64_t)(x) & 0x0000000000ff0000ULL) << 24) | \
3116  (((uint64_t)(x) & 0x00000000ff000000ULL) << 8) | \
3117  (((uint64_t)(x) & 0x000000ff00000000ULL) >> 8) | \
3118  (((uint64_t)(x) & 0x0000ff0000000000ULL) >> 24) | \
3119  (((uint64_t)(x) & 0x00ff000000000000ULL) >> 40) | \
3120  (((uint64_t)(x) & 0xff00000000000000ULL) >> 56) ))
3121 
3122 #define le16_to_cpu(x) swap16(x)
3123 #define le32_to_cpu(x) swap32(x)
3124 #define le64_to_cpu(x) swap64(x)
3125 
3126 #define cpu_to_le16(x) swap16(x)
3127 #define cpu_to_le32(x) swap32(x)
3128 #define cpu_to_le64(x) swap64(x)
3129 
3130 #endif
3131 
3132 #define le16_to_cpup(x) le16_to_cpu(*((uint16_t *)(x)))
3133 #define le32_to_cpup(x) le32_to_cpu(*((uint32_t *)(x)))
3134 #define le64_to_cpup(x) le64_to_cpu(*((uint64_t *)(x)))
3135 
3136 #endif /* ifndef __KERNEL__ */
3137 
3138 /*****************************************************************************
3139  * Read macros
3140  ****************************************************************************/
3141 
3146 #define EC_READ_U8(DATA) \
3147  ((uint8_t) *((uint8_t *) (DATA)))
3148 
3154 #define EC_READ_S8(DATA) \
3155  ((int8_t) *((uint8_t *) (DATA)))
3156 
3162 #define EC_READ_U16(DATA) \
3163  ((uint16_t) le16_to_cpup((void *) (DATA)))
3164 
3170 #define EC_READ_S16(DATA) \
3171  ((int16_t) le16_to_cpup((void *) (DATA)))
3172 
3178 #define EC_READ_U32(DATA) \
3179  ((uint32_t) le32_to_cpup((void *) (DATA)))
3180 
3186 #define EC_READ_S32(DATA) \
3187  ((int32_t) le32_to_cpup((void *) (DATA)))
3188 
3194 #define EC_READ_U64(DATA) \
3195  ((uint64_t) le64_to_cpup((void *) (DATA)))
3196 
3202 #define EC_READ_S64(DATA) \
3203  ((int64_t) le64_to_cpup((void *) (DATA)))
3204 
3205 /*****************************************************************************
3206  * Floating-point read functions and macros (userspace only)
3207  ****************************************************************************/
3208 
3209 #ifndef __KERNEL__
3210 
3218 EC_PUBLIC_API float ecrt_read_real(const void *data);
3219 
3225 #define EC_READ_REAL(DATA) ecrt_read_real(DATA)
3226 
3234 EC_PUBLIC_API double ecrt_read_lreal(const void *data);
3235 
3241 #define EC_READ_LREAL(DATA) ecrt_read_lreal(DATA)
3242 
3243 #endif // ifndef __KERNEL__
3244 
3245 /*****************************************************************************
3246  * Write macros
3247  ****************************************************************************/
3248 
3254 #define EC_WRITE_U8(DATA, VAL) \
3255  do { \
3256  *((uint8_t *)(DATA)) = ((uint8_t) (VAL)); \
3257  } while (0)
3258 
3264 #define EC_WRITE_S8(DATA, VAL) EC_WRITE_U8(DATA, VAL)
3265 
3271 #define EC_WRITE_U16(DATA, VAL) \
3272  do { \
3273  *((uint16_t *) (DATA)) = cpu_to_le16((uint16_t) (VAL)); \
3274  } while (0)
3275 
3281 #define EC_WRITE_S16(DATA, VAL) EC_WRITE_U16(DATA, VAL)
3282 
3288 #define EC_WRITE_U32(DATA, VAL) \
3289  do { \
3290  *((uint32_t *) (DATA)) = cpu_to_le32((uint32_t) (VAL)); \
3291  } while (0)
3292 
3298 #define EC_WRITE_S32(DATA, VAL) EC_WRITE_U32(DATA, VAL)
3299 
3305 #define EC_WRITE_U64(DATA, VAL) \
3306  do { \
3307  *((uint64_t *) (DATA)) = cpu_to_le64((uint64_t) (VAL)); \
3308  } while (0)
3309 
3315 #define EC_WRITE_S64(DATA, VAL) EC_WRITE_U64(DATA, VAL)
3316 
3317 /*****************************************************************************
3318  * Floating-point write functions and macros (userspace only)
3319  ****************************************************************************/
3320 
3321 #ifndef __KERNEL__
3322 
3330 EC_PUBLIC_API void ecrt_write_real(void *data, float value);
3331 
3337 #define EC_WRITE_REAL(DATA, VAL) ecrt_write_real(DATA, VAL)
3338 
3346 EC_PUBLIC_API void ecrt_write_lreal(void *data, double value);
3347 
3353 #define EC_WRITE_LREAL(DATA, VAL) ecrt_write_lreal(DATA, VAL)
3354 
3355 #endif // ifndef __KERNEL__
3356 
3357 /****************************************************************************/
3358 
3359 #ifdef __cplusplus
3360 }
3361 #endif
3362 
3363 /****************************************************************************/
3364 
3367 #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:2584
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:3519
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:776
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:2992
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:153
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:2654
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:2879
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:709
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:397
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:3181
EC_PUBLIC_API ec_domain_t * ecrt_master_create_domain(ec_master_t *master)
Creates a new process data domain.
Definition: master.c:2500
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:924
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:3040
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:679
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:2954
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:173
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:682
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:979
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:433
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:3345
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:450
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:648
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:3020
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:3053
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:426
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:3008
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:125
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:3421
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:2834
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:41
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:746
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:2755
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:2845
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:3082
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:2865
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:832
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:2892
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:457
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:3102
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:139
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:858
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:115
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:722
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:2510
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:146
EC_PUBLIC_API ec_request_state_t ecrt_voe_handler_execute(ec_voe_handler_t *voe)
Execute the handler.
Definition: voe_handler.c:184
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:2702
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:3091
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:795
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:3069
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:2968
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:3505
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:3262
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:163