IgH EtherCAT Master  1.6.1
ecrt.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * Copyright (C) 2006-2024 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 
138 /****************************************************************************/
139 
140 #ifndef __ECRT_H__
141 #define __ECRT_H__
142 
143 #ifdef __KERNEL__
144 #include <asm/byteorder.h>
145 #include <linux/types.h>
146 #include <linux/time.h>
147 #include <linux/in.h> // struct in_addr
148 #else
149 #include <stdlib.h> // for size_t
150 #include <stdint.h>
151 #include <sys/time.h> // for struct timeval
152 #include <netinet/in.h> // struct in_addr
153 #endif
154 
155 /*****************************************************************************
156  * Global definitions
157  ****************************************************************************/
158 
161 #define ECRT_VER_MAJOR 1
162 
165 #define ECRT_VER_MINOR 6
166 
169 #define ECRT_VERSION(a, b) (((a) << 8) + (b))
170 
173 #define ECRT_VERSION_MAGIC ECRT_VERSION(ECRT_VER_MAJOR, ECRT_VER_MINOR)
174 
175 /*****************************************************************************
176  * Feature flags
177  ****************************************************************************/
178 
184 #define EC_HAVE_REDUNDANCY
185 
190 #define EC_HAVE_EMERGENCY
191 
198 #define EC_HAVE_REG_ACCESS
199 
202 #define EC_HAVE_SELECT_REF_CLOCK
203 
206 #define EC_HAVE_REF_CLOCK_TIME
207 
210 #define EC_HAVE_REG_BY_POS
211 
214 #define EC_HAVE_SYNC_TO
215 
218 #define EC_HAVE_FLAGS
219 
226 #define EC_HAVE_SOE_REQUESTS
227 
231 #define EC_HAVE_SCAN_PROGRESS
232 
239 #define EC_HAVE_SET_IP
240 
243 #define EC_HAVE_STATE_TIMEOUT
244 
245 /****************************************************************************/
246 
249 #ifndef EC_PUBLIC_API
250 # if defined(ethercat_EXPORTS) && !defined(__KERNEL__)
251 # define EC_PUBLIC_API __attribute__ ((visibility ("default")))
252 # else
253 # define EC_PUBLIC_API
254 # endif
255 #endif
256 
257 /****************************************************************************/
258 
263 #define EC_END ~0U
264 
267 #define EC_MAX_SYNC_MANAGERS 16
268 
273 #define EC_MAX_STRING_LENGTH 64
274 
276 #define EC_MAX_PORTS 4
277 
286 #define EC_TIMEVAL2NANO(TV) \
287  (((TV).tv_sec - 946684800ULL) * 1000000000ULL + (TV).tv_usec * 1000ULL)
288 
293 #define EC_COE_EMERGENCY_MSG_SIZE 8
294 
295 /*****************************************************************************
296  * Data types
297  ****************************************************************************/
298 
299 struct ec_master;
300 typedef struct ec_master ec_master_t;
302 struct ec_slave_config;
305 struct ec_domain;
306 typedef struct ec_domain ec_domain_t;
308 struct ec_sdo_request;
311 struct ec_soe_request;
314 struct ec_voe_handler;
317 struct ec_reg_request;
320 /****************************************************************************/
321 
328 typedef struct {
329  unsigned int slaves_responding;
331  unsigned int al_states : 4;
340  unsigned int link_up : 1;
343 
344 /****************************************************************************/
345 
352 typedef struct {
353  unsigned int slaves_responding;
355  unsigned int al_states : 4;
364  unsigned int link_up : 1;
367 
368 /****************************************************************************/
369 
376 typedef struct {
377  unsigned int online : 1;
378  unsigned int operational : 1;
380  unsigned int al_state : 4;
389 
390 /****************************************************************************/
391 
398 typedef struct {
399  unsigned int slave_count;
400  unsigned int link_up : 1;
401  uint8_t scan_busy;
403  uint64_t app_time;
405 
406 /****************************************************************************/
407 
414 typedef struct {
415  unsigned int slave_count;
416  unsigned int scan_index;
421 
422 /****************************************************************************/
423 
426 typedef enum {
432 
433 /****************************************************************************/
434 
437 typedef struct {
438  uint8_t link_up;
439  uint8_t loop_closed;
440  uint8_t signal_detected;
442 
443 /****************************************************************************/
444 
451 typedef struct {
452  uint16_t position;
453  uint32_t vendor_id;
454  uint32_t product_code;
455  uint32_t revision_number;
456  uint32_t serial_number;
457  uint16_t alias;
458  int16_t current_on_ebus;
459  struct {
462  uint32_t receive_time;
464  uint16_t next_slave;
466  uint32_t delay_to_next_dc;
467  } ports[EC_MAX_PORTS];
468  uint8_t al_state;
469  uint8_t error_flag;
470  uint8_t sync_count;
471  uint16_t sdo_count;
472  char name[EC_MAX_STRING_LENGTH];
474 
475 /****************************************************************************/
476 
481 typedef enum {
486 } ec_wc_state_t;
487 
488 /****************************************************************************/
489 
494 typedef struct {
495  unsigned int working_counter;
497  unsigned int redundancy_active;
499 
500 /****************************************************************************/
501 
504 typedef enum {
510 
511 /****************************************************************************/
512 
517 typedef enum {
522 
523 /****************************************************************************/
524 
531 typedef struct {
532  uint16_t index;
533  uint8_t subindex;
534  uint8_t bit_length;
536 
537 /****************************************************************************/
538 
545 typedef struct {
546  uint16_t index;
547  unsigned int n_entries;
554 } ec_pdo_info_t;
555 
556 /****************************************************************************/
557 
564 typedef struct {
565  uint8_t index;
569  unsigned int n_pdos;
574 
575 /****************************************************************************/
576 
582 typedef struct {
583  uint16_t alias;
584  uint16_t position;
585  uint32_t vendor_id;
586  uint32_t product_code;
587  uint16_t index;
588  uint8_t subindex;
589  unsigned int *offset;
591  unsigned int *bit_position;
596 
597 /****************************************************************************/
598 
604 typedef enum {
610 
611 /****************************************************************************/
612 
615 typedef enum {
620 } ec_al_state_t;
621 
622 /*****************************************************************************
623  * Global functions
624  ****************************************************************************/
625 
626 #ifdef __cplusplus
627 extern "C" {
628 #endif
629 
636 EC_PUBLIC_API unsigned int ecrt_version_magic(void);
637 
656  unsigned int master_index
657  );
658 
659 #ifndef __KERNEL__
660 
674 EC_PUBLIC_API ec_master_t *ecrt_open_master(
675  unsigned int master_index
676  );
677 
678 #endif // #ifndef __KERNEL__
679 
693  ec_master_t *master
694  );
695 
696 /*****************************************************************************
697  * Master methods
698  ****************************************************************************/
699 
700 #ifndef __KERNEL__
701 
711 EC_PUBLIC_API int ecrt_master_reserve(
712  ec_master_t *master
713  );
714 
715 #endif // #ifndef __KERNEL__
716 
717 #ifdef __KERNEL__
718 
739  ec_master_t *master,
740  void (*send_cb)(void *),
741  void (*receive_cb)(void *),
742  void *cb_data
744  );
745 
746 #endif /* __KERNEL__ */
747 
763  ec_master_t *master
764  );
765 
799  ec_master_t *master,
800  uint16_t alias,
801  uint16_t position,
802  uint32_t vendor_id,
803  uint32_t product_code
804  );
805 
817  ec_master_t *master,
818  ec_slave_config_t *sc
820  );
821 
833  ec_master_t *master,
834  ec_master_info_t *master_info
836  );
837 
849  ec_master_t *master,
850  ec_master_scan_progress_t *progress
852  );
853 
867  ec_master_t *master,
868  uint16_t slave_position,
869  ec_slave_info_t *slave_info
871  );
872 
873 #ifndef __KERNEL__
874 
885 EC_PUBLIC_API int ecrt_master_get_sync_manager(
886  ec_master_t *master,
887  uint16_t slave_position,
888  uint8_t sync_index,
890  ec_sync_info_t *sync
891  );
892 
904 EC_PUBLIC_API int ecrt_master_get_pdo(
905  ec_master_t *master,
906  uint16_t slave_position,
907  uint8_t sync_index,
909  uint16_t pos,
910  ec_pdo_info_t *pdo
911  );
912 
922 EC_PUBLIC_API int ecrt_master_get_pdo_entry(
923  ec_master_t *master,
924  uint16_t slave_position,
925  uint8_t sync_index,
927  uint16_t pdo_pos,
928  uint16_t entry_pos,
929  ec_pdo_entry_info_t *entry
930  );
931 
932 #endif /* #ifndef __KERNEL__ */
933 
946  ec_master_t *master,
947  uint16_t slave_position,
948  uint16_t index,
949  uint8_t subindex,
950  const uint8_t *data,
951  size_t data_size,
952  uint32_t *abort_code
953  );
954 
968  ec_master_t *master,
969  uint16_t slave_position,
970  uint16_t index,
971  const uint8_t *data,
972  size_t data_size,
973  uint32_t *abort_code
974  );
975 
988  ec_master_t *master,
989  uint16_t slave_position,
990  uint16_t index,
991  uint8_t subindex,
992  uint8_t *target,
993  size_t target_size,
994  size_t *result_size,
995  uint32_t *abort_code
996  );
997 
1009  ec_master_t *master,
1010  uint16_t slave_position,
1011  uint8_t drive_no,
1012  uint16_t idn,
1013  const uint8_t *data,
1014  size_t data_size,
1015  uint16_t *error_code
1017  );
1018 
1030  ec_master_t *master,
1031  uint16_t slave_position,
1032  uint8_t drive_no,
1033  uint16_t idn,
1034  uint8_t *target,
1036  size_t target_size,
1037  size_t *result_size,
1038  uint16_t *error_code
1040  );
1041 
1062  ec_master_t *master
1063  );
1064 
1081  ec_master_t *master
1082  );
1083 
1097  ec_master_t *master,
1098  size_t send_interval
1099  );
1100 
1114  ec_master_t *master
1115  );
1116 
1132  ec_master_t *master
1133  );
1134 
1135 #ifdef __KERNEL__
1136 
1147  ec_master_t *master
1148  );
1149 #endif
1150 
1163  const ec_master_t *master,
1164  ec_master_state_t *state
1165  );
1166 
1176  const ec_master_t *master,
1177  unsigned int dev_idx,
1179  ec_master_link_state_t *state
1181  );
1182 
1209  ec_master_t *master,
1210  uint64_t app_time
1211  );
1212 
1225  ec_master_t *master
1226  );
1227 
1243  ec_master_t *master,
1244  uint64_t sync_time
1245  );
1246 
1261  ec_master_t *master
1262  );
1263 
1287  const ec_master_t *master,
1288  uint32_t *time
1289  );
1290 
1302  ec_master_t *master
1303  );
1304 
1317  const ec_master_t *master
1318  );
1319 
1335  ec_master_t *master
1336  );
1337 
1338 /*****************************************************************************
1339  * Slave configuration methods
1340  ****************************************************************************/
1341 
1355  ec_slave_config_t *sc,
1356  uint8_t sync_index,
1358  ec_direction_t direction,
1359  ec_watchdog_mode_t watchdog_mode
1360  );
1361 
1372  ec_slave_config_t *sc,
1373  uint16_t watchdog_divider,
1378  uint16_t watchdog_intervals
1382  );
1383 
1395  ec_slave_config_t *sc,
1396  uint8_t sync_index,
1398  uint16_t index
1399  );
1400 
1416  ec_slave_config_t *sc,
1417  uint8_t sync_index
1419  );
1420 
1432  ec_slave_config_t *sc,
1433  uint16_t pdo_index,
1434  uint16_t entry_index,
1436  uint8_t entry_subindex,
1438  uint8_t entry_bit_length
1439  );
1440 
1455  ec_slave_config_t *sc,
1456  uint16_t pdo_index
1457  );
1458 
1533  ec_slave_config_t *sc,
1534  unsigned int n_syncs,
1536  const ec_sync_info_t syncs[]
1538  );
1539 
1561  ec_slave_config_t *sc,
1562  uint16_t entry_index,
1563  uint8_t entry_subindex,
1564  ec_domain_t *domain,
1565  unsigned int *bit_position
1567  );
1568 
1585  ec_slave_config_t *sc,
1586  uint8_t sync_index,
1587  unsigned int pdo_pos,
1588  unsigned int entry_pos,
1589  ec_domain_t *domain,
1590  unsigned int *bit_position
1592  );
1593 
1612  ec_slave_config_t *sc,
1613  uint16_t assign_activate,
1614  uint32_t sync0_cycle,
1615  int32_t sync0_shift,
1616  uint32_t sync1_cycle,
1617  int32_t sync1_shift
1618  );
1619 
1648  ec_slave_config_t *sc,
1649  uint16_t index,
1650  uint8_t subindex,
1651  const uint8_t *data,
1652  size_t size
1653  );
1654 
1668  ec_slave_config_t *sc,
1669  uint16_t sdo_index,
1670  uint8_t sdo_subindex,
1671  uint8_t value
1672  );
1673 
1687  ec_slave_config_t *sc,
1688  uint16_t sdo_index,
1689  uint8_t sdo_subindex,
1690  uint16_t value
1691  );
1692 
1706  ec_slave_config_t *sc,
1707  uint16_t sdo_index,
1708  uint8_t sdo_subindex,
1709  uint32_t value
1710  );
1711 
1728  ec_slave_config_t *sc,
1729  uint16_t index,
1730  const uint8_t *data,
1731  size_t size
1732  );
1733 
1747  ec_slave_config_t *sc,
1748  size_t elements
1749  );
1750 
1768  ec_slave_config_t *sc,
1769  uint8_t *target
1771  );
1772 
1784  ec_slave_config_t *sc
1785  );
1786 
1802  const ec_slave_config_t *sc
1803  );
1804 
1818  ec_slave_config_t *sc,
1819  uint16_t index,
1820  uint8_t subindex,
1821  size_t size
1822  );
1823 
1837  ec_slave_config_t *sc,
1838  uint8_t drive_no,
1839  uint16_t idn,
1840  size_t size
1841  );
1842 
1861  ec_slave_config_t *sc,
1862  size_t size
1863  );
1864 
1882  ec_slave_config_t *sc,
1883  size_t size
1884  );
1885 
1904  const ec_slave_config_t *sc,
1905  ec_slave_config_state_t *state
1906  );
1907 
1933  ec_slave_config_t *sc,
1934  uint8_t drive_no,
1935  uint16_t idn,
1936  ec_al_state_t state,
1938  const uint8_t *data,
1939  size_t size
1940  );
1941 
1967  ec_slave_config_t *sc,
1968  const char *key,
1969  int32_t value
1970  );
1971 
1986  ec_slave_config_t *sc,
1987  const unsigned char *mac_address
1988  );
1989 
2024  ec_slave_config_t *sc,
2025  struct in_addr ip_address
2026  );
2027 
2048  ec_slave_config_t *sc,
2049  struct in_addr subnet_mask
2050  );
2051 
2072  ec_slave_config_t *sc,
2073  struct in_addr gateway_address
2074  );
2075 
2097  ec_slave_config_t *sc,
2098  struct in_addr dns_address
2099  );
2100 
2118  ec_slave_config_t *sc,
2119  const char *name
2120  );
2121 
2139  ec_slave_config_t *sc,
2140  ec_al_state_t from_state,
2141  ec_al_state_t to_state,
2142  unsigned int timeout_ms
2143  );
2144 
2145 /*****************************************************************************
2146  * Domain methods
2147  ****************************************************************************/
2148 
2164  ec_domain_t *domain,
2165  const ec_pdo_entry_reg_t *pdo_entry_regs
2167  );
2168 
2178  const ec_domain_t *domain
2179  );
2180 
2181 #ifdef __KERNEL__
2182 
2197  ec_domain_t *domain,
2198  uint8_t *memory
2200  );
2201 
2202 #endif /* __KERNEL__ */
2203 
2220  const ec_domain_t *domain
2221  );
2222 
2235  ec_domain_t *domain
2236  );
2237 
2248  ec_domain_t *domain
2249  );
2250 
2262  const ec_domain_t *domain,
2263  ec_domain_state_t *state
2265  );
2266 
2267 /*****************************************************************************
2268  * SDO request methods.
2269  ****************************************************************************/
2270 
2286  ec_sdo_request_t *req,
2287  uint16_t index,
2288  uint8_t subindex
2289  );
2290 
2307  ec_sdo_request_t *req,
2308  uint32_t timeout
2310  );
2311 
2342  const ec_sdo_request_t *req
2343  );
2344 
2360  const ec_sdo_request_t *req
2361  );
2362 
2377 #ifdef __KERNEL__
2378  const
2379 #endif
2380  ec_sdo_request_t *req
2381  );
2382 
2399  ec_sdo_request_t *req
2400  );
2401 
2419  ec_sdo_request_t *req
2420  );
2421 
2422 /*****************************************************************************
2423  * SoE request methods.
2424  ****************************************************************************/
2425 
2441  ec_soe_request_t *req,
2442  uint8_t drive_no,
2443  uint16_t idn
2444  );
2445 
2462  ec_soe_request_t *req,
2463  uint32_t timeout
2465  );
2466 
2497  const ec_soe_request_t *req
2498  );
2499 
2511  const ec_soe_request_t *req
2512  );
2513 
2527 #ifdef __KERNEL__
2528  const
2529 #endif
2530  ec_soe_request_t *req
2531  );
2532 
2549  ec_soe_request_t *req
2550  );
2551 
2569  ec_soe_request_t *req
2570  );
2571 
2572 /*****************************************************************************
2573  * VoE handler methods.
2574  ****************************************************************************/
2575 
2592  ec_voe_handler_t *voe,
2593  uint32_t vendor_id,
2594  uint16_t vendor_type
2595  );
2596 
2613  const ec_voe_handler_t *voe,
2614  uint32_t *vendor_id,
2615  uint16_t *vendor_type
2616  );
2617 
2641  const ec_voe_handler_t *voe
2642  );
2643 
2659  const ec_voe_handler_t *voe
2660  );
2661 
2679  ec_voe_handler_t *voe,
2680  size_t size
2681  );
2682 
2706  ec_voe_handler_t *voe
2707  );
2708 
2733  ec_voe_handler_t *voe
2734  );
2735 
2750  ec_voe_handler_t *voe
2751  );
2752 
2753 /*****************************************************************************
2754  * Register request methods.
2755  ****************************************************************************/
2756 
2783  const ec_reg_request_t *req
2784  );
2785 
2797  const ec_reg_request_t *req
2798  );
2799 
2818  ec_reg_request_t *req,
2819  uint16_t address,
2820  size_t size
2821  );
2822 
2841  ec_reg_request_t *req,
2842  uint16_t address,
2843  size_t size
2844  );
2845 
2846 /*****************************************************************************
2847  * Bitwise read/write macros
2848  ****************************************************************************/
2849 
2855 #define EC_READ_BIT(DATA, POS) ((*((uint8_t *) (DATA)) >> (POS)) & 0x01)
2856 
2863 #define EC_WRITE_BIT(DATA, POS, VAL) \
2864  do { \
2865  if (VAL) *((uint8_t *) (DATA)) |= (1 << (POS)); \
2866  else *((uint8_t *) (DATA)) &= ~(1 << (POS)); \
2867  } while (0)
2868 
2869 /*****************************************************************************
2870  * Byte-swapping functions for user space
2871  ****************************************************************************/
2872 
2873 #ifndef __KERNEL__
2874 
2875 #if __BYTE_ORDER == __LITTLE_ENDIAN
2876 
2877 #define le16_to_cpu(x) x
2878 #define le32_to_cpu(x) x
2879 #define le64_to_cpu(x) x
2880 
2881 #define cpu_to_le16(x) x
2882 #define cpu_to_le32(x) x
2883 #define cpu_to_le64(x) x
2884 
2885 #elif __BYTE_ORDER == __BIG_ENDIAN
2886 
2887 #define swap16(x) \
2888  ((uint16_t)( \
2889  (((uint16_t)(x) & 0x00ffU) << 8) | \
2890  (((uint16_t)(x) & 0xff00U) >> 8) ))
2891 #define swap32(x) \
2892  ((uint32_t)( \
2893  (((uint32_t)(x) & 0x000000ffUL) << 24) | \
2894  (((uint32_t)(x) & 0x0000ff00UL) << 8) | \
2895  (((uint32_t)(x) & 0x00ff0000UL) >> 8) | \
2896  (((uint32_t)(x) & 0xff000000UL) >> 24) ))
2897 #define swap64(x) \
2898  ((uint64_t)( \
2899  (((uint64_t)(x) & 0x00000000000000ffULL) << 56) | \
2900  (((uint64_t)(x) & 0x000000000000ff00ULL) << 40) | \
2901  (((uint64_t)(x) & 0x0000000000ff0000ULL) << 24) | \
2902  (((uint64_t)(x) & 0x00000000ff000000ULL) << 8) | \
2903  (((uint64_t)(x) & 0x000000ff00000000ULL) >> 8) | \
2904  (((uint64_t)(x) & 0x0000ff0000000000ULL) >> 24) | \
2905  (((uint64_t)(x) & 0x00ff000000000000ULL) >> 40) | \
2906  (((uint64_t)(x) & 0xff00000000000000ULL) >> 56) ))
2907 
2908 #define le16_to_cpu(x) swap16(x)
2909 #define le32_to_cpu(x) swap32(x)
2910 #define le64_to_cpu(x) swap64(x)
2911 
2912 #define cpu_to_le16(x) swap16(x)
2913 #define cpu_to_le32(x) swap32(x)
2914 #define cpu_to_le64(x) swap64(x)
2915 
2916 #endif
2917 
2918 #define le16_to_cpup(x) le16_to_cpu(*((uint16_t *)(x)))
2919 #define le32_to_cpup(x) le32_to_cpu(*((uint32_t *)(x)))
2920 #define le64_to_cpup(x) le64_to_cpu(*((uint64_t *)(x)))
2921 
2922 #endif /* ifndef __KERNEL__ */
2923 
2924 /*****************************************************************************
2925  * Read macros
2926  ****************************************************************************/
2927 
2932 #define EC_READ_U8(DATA) \
2933  ((uint8_t) *((uint8_t *) (DATA)))
2934 
2940 #define EC_READ_S8(DATA) \
2941  ((int8_t) *((uint8_t *) (DATA)))
2942 
2948 #define EC_READ_U16(DATA) \
2949  ((uint16_t) le16_to_cpup((void *) (DATA)))
2950 
2956 #define EC_READ_S16(DATA) \
2957  ((int16_t) le16_to_cpup((void *) (DATA)))
2958 
2964 #define EC_READ_U32(DATA) \
2965  ((uint32_t) le32_to_cpup((void *) (DATA)))
2966 
2972 #define EC_READ_S32(DATA) \
2973  ((int32_t) le32_to_cpup((void *) (DATA)))
2974 
2980 #define EC_READ_U64(DATA) \
2981  ((uint64_t) le64_to_cpup((void *) (DATA)))
2982 
2988 #define EC_READ_S64(DATA) \
2989  ((int64_t) le64_to_cpup((void *) (DATA)))
2990 
2991 /*****************************************************************************
2992  * Floating-point read functions and macros (userspace only)
2993  ****************************************************************************/
2994 
2995 #ifndef __KERNEL__
2996 
3004 EC_PUBLIC_API float ecrt_read_real(const void *data);
3005 
3011 #define EC_READ_REAL(DATA) ecrt_read_real(DATA)
3012 
3020 EC_PUBLIC_API double ecrt_read_lreal(const void *data);
3021 
3027 #define EC_READ_LREAL(DATA) ecrt_read_lreal(DATA)
3028 
3029 #endif // ifndef __KERNEL__
3030 
3031 /*****************************************************************************
3032  * Write macros
3033  ****************************************************************************/
3034 
3040 #define EC_WRITE_U8(DATA, VAL) \
3041  do { \
3042  *((uint8_t *)(DATA)) = ((uint8_t) (VAL)); \
3043  } while (0)
3044 
3050 #define EC_WRITE_S8(DATA, VAL) EC_WRITE_U8(DATA, VAL)
3051 
3057 #define EC_WRITE_U16(DATA, VAL) \
3058  do { \
3059  *((uint16_t *) (DATA)) = cpu_to_le16((uint16_t) (VAL)); \
3060  } while (0)
3067 #define EC_WRITE_S16(DATA, VAL) EC_WRITE_U16(DATA, VAL)
3068 
3074 #define EC_WRITE_U32(DATA, VAL) \
3075  do { \
3076  *((uint32_t *) (DATA)) = cpu_to_le32((uint32_t) (VAL)); \
3077  } while (0)
3078 
3084 #define EC_WRITE_S32(DATA, VAL) EC_WRITE_U32(DATA, VAL)
3091 #define EC_WRITE_U64(DATA, VAL) \
3092  do { \
3093  *((uint64_t *) (DATA)) = cpu_to_le64((uint64_t) (VAL)); \
3094  } while (0)
3095 
3101 #define EC_WRITE_S64(DATA, VAL) EC_WRITE_U64(DATA, VAL)
3102 
3103 /*****************************************************************************
3104  * Floating-point write functions and macros (userspace only)
3105  ****************************************************************************/
3106 
3107 #ifndef __KERNEL__
3108 
3116 EC_PUBLIC_API void ecrt_write_real(void *data, float value);
3117 
3123 #define EC_WRITE_REAL(DATA, VAL) ecrt_write_real(DATA, VAL)
3124 
3132 EC_PUBLIC_API void ecrt_write_lreal(void *data, double value);
3133 
3139 #define EC_WRITE_LREAL(DATA, VAL) ecrt_write_lreal(DATA, VAL)
3140 
3141 #endif // ifndef __KERNEL__
3142 
3143 /****************************************************************************/
3144 
3145 #ifdef __cplusplus
3146 }
3147 #endif
3148 
3149 /****************************************************************************/
3150 
3153 #endif
unsigned int working_counter
Value of the last working counter.
Definition: ecrt.h:495
uint32_t serial_number
Serial-Number stored on the slave.
Definition: ecrt.h:456
ec_slave_port_desc_t desc
Physical port type.
Definition: ecrt.h:460
uint8_t subindex
PDO entry subindex.
Definition: ecrt.h:588
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:617
uint16_t position
Slave position.
Definition: ecrt.h:584
EC_PUBLIC_API int ecrt_master_deactivate(ec_master_t *master)
Deactivates the master.
Definition: master.c:2372
uint8_t sync_count
Number of sync managers.
Definition: ecrt.h:470
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:749
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:2778
unsigned int n_entries
Number of PDO entries in entries to map.
Definition: ecrt.h:547
#define EC_PUBLIC_API
Symbol visibility control macro.
Definition: ecrt.h:253
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:534
ec_direction_t dir
Sync manager direction.
Definition: ecrt.h:568
uint8_t error_flag
Error flag for that slave.
Definition: ecrt.h:469
ec_watchdog_mode_t
Watchdog mode for sync manager configuration.
Definition: ecrt.h:517
ec_slave_port_desc_t
EtherCAT slave port descriptor.
Definition: ecrt.h:426
ec_pdo_info_t const * pdos
Array with PDOs to assign.
Definition: ecrt.h:570
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:2443
ec_al_state_t
Application-layer state.
Definition: ecrt.h:615
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:2665
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:278
unsigned int redundancy_active
Redundant link is in use.
Definition: ecrt.h:497
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:706
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:399
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:2967
EC_PUBLIC_API ec_domain_t * ecrt_master_create_domain(ec_master_t *master)
Creates a new process data domain.
Definition: master.c:2288
uint16_t index
PDO entry index.
Definition: ecrt.h:587
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:898
Operational.
Definition: ecrt.h:619
uint32_t vendor_id
Vendor-ID stored on the slave.
Definition: ecrt.h:453
Register request.
Definition: reg_request.h:40
ec_slave_port_link_t link
Port link state.
Definition: ecrt.h:461
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:2826
Safe-operational.
Definition: ecrt.h:618
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:2740
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:679
Master scan progress information.
Definition: ecrt.h:414
Disable the watchdog.
Definition: ecrt.h:520
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:466
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:268
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:519
ec_wc_state_t wc_state
Working counter interpretation.
Definition: ecrt.h:496
PDO configuration information.
Definition: ecrt.h:545
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:564
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:481
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:953
unsigned int slaves_responding
Sum of responding slaves on all Ethernet devices.
Definition: ecrt.h:329
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:400
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:3131
Some of the registered process data were exchanged.
Definition: ecrt.h:483
EC_PUBLIC_API unsigned int ecrt_version_magic(void)
Returns the version magic of the realtime interface.
Definition: module.c:647
uint32_t revision_number
Revision-Number stored on the slave.
Definition: ecrt.h:455
Use the default setting of the sync manager.
Definition: ecrt.h:518
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:583
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:2806
Not requested.
Definition: ecrt.h:605
uint16_t index
PDO index.
Definition: ecrt.h:546
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:2839
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:286
Master state.
Definition: ecrt.h:328
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:376
Request is being processed.
Definition: ecrt.h:606
uint64_t app_time
Application time.
Definition: ecrt.h:403
ec_watchdog_mode_t watchdog_mode
Watchdog mode.
Definition: ecrt.h:572
unsigned int n_pdos
Number of PDOs in pdos.
Definition: ecrt.h:569
Domain state.
Definition: ecrt.h:494
uint32_t vendor_id
Slave vendor ID.
Definition: ecrt.h:585
unsigned int al_state
The application-layer state of the slave.
Definition: ecrt.h:380
unsigned int * bit_position
Pointer to a variable to store a bit position (0-7) within the offset.
Definition: ecrt.h:591
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
EC_PUBLIC_API int ecrt_master_application_time(ec_master_t *master, uint64_t app_time)
Sets the application time.
Definition: master.c:2794
Port is an E-Bus.
Definition: ecrt.h:429
unsigned int operational
The slave was brought into OP state using the specified configuration.
Definition: ecrt.h:378
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:3207
ec_direction_t
Direction type for PDO assignment functions.
Definition: ecrt.h:504
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:2620
Port is a MII.
Definition: ecrt.h:430
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:293
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:300
ec_pdo_entry_info_t const * entries
Array of PDO entries to map.
Definition: ecrt.h:551
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:719
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:2541
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:2631
Values read by the master.
Definition: ecrt.h:507
EC_PUBLIC_API int ecrt_master_sync_monitor_queue(ec_master_t *master)
Queues the DC synchrony monitoring datagram for sending.
Definition: master.c:2868
unsigned int online
The slave is online.
Definition: ecrt.h:377
Port is not configured.
Definition: ecrt.h:428
EC_PUBLIC_API int ecrt_master(ec_master_t *master, ec_master_info_t *master_info)
Obtains master information.
Definition: master.c:2651
Port is not implemented.
Definition: ecrt.h:427
Slave information.
Definition: ecrt.h:451
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:805
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:2678
uint16_t index
PDO entry index.
Definition: ecrt.h:532
uint8_t al_state
Current state of the slave.
Definition: ecrt.h:468
uint8_t scan_busy
true, while the master is scanning the network.
Definition: ecrt.h:401
EC_PUBLIC_API ec_master_t * ecrt_request_master(unsigned int master_index)
Requests an EtherCAT master for realtime operation.
Definition: module.c:613
int16_t current_on_ebus
Used current in mA.
Definition: ecrt.h:458
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:505
#define EC_MAX_PORTS
Maximum number of slave ports.
Definition: ecrt.h:276
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:2888
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:508
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:471
#define EC_MAX_STRING_LENGTH
Maximum string length.
Definition: ecrt.h:273
List record type for PDO entry mass-registration.
Definition: ecrt.h:582
unsigned int link_up
true, if at least one Ethernet link is up.
Definition: ecrt.h:340
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:831
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.
unsigned int scan_index
Index of the slave that is currently scanned.
Definition: ecrt.h:416
uint16_t next_slave
Ring position of next DC slave on that port.
Definition: ecrt.h:464
No registered process data were exchanged.
Definition: ecrt.h:482
All registered process data were exchanged.
Definition: ecrt.h:485
unsigned int al_states
Application-layer states of all slaves.
Definition: ecrt.h:331
EC_PUBLIC_API int ecrt_master_activate(ec_master_t *master)
Finishes the configuration phase and prepares for cyclic operation.
Definition: master.c:2298
EC_PUBLIC_API int ecrt_soe_request_read(ec_soe_request_t *req)
Schedule an SoE IDN read operation.
Definition: soe_request.c:307
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:457
EtherCAT slave configuration.
Definition: slave_config.h:111
uint32_t product_code
Product-Code stored on the slave.
Definition: ecrt.h:454
EC_PUBLIC_API int ecrt_master_receive(ec_master_t *master)
Fetches received frames from the hardware and processes the datagrams.
Definition: master.c:2488
unsigned int slave_count
Number of slaves detected.
Definition: ecrt.h:415
EC_PUBLIC_API uint32_t ecrt_master_sync_monitor_process(const ec_master_t *master)
Processes the DC synchrony monitoring datagram.
Definition: master.c:2877
Request was processed successfully.
Definition: ecrt.h:607
unsigned int * offset
Pointer to a variable to store the PDO entry&#39;s (byte-)offset in the process data. ...
Definition: ecrt.h:589
ec_request_state_t
Request state.
Definition: ecrt.h:604
Master information.
Definition: ecrt.h:398
PDO entry configuration information.
Definition: ecrt.h:531
uint8_t index
Sync manager index.
Definition: ecrt.h:565
Values written by the master.
Definition: ecrt.h:506
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:616
EC_PUBLIC_API int ecrt_soe_request_write(ec_soe_request_t *req)
Schedule an SoE IDN write operation.
Definition: soe_request.c:314
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:768
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:452
uint32_t receive_time
Receive time on DC transmission delay measurement.
Definition: ecrt.h:462
uint32_t product_code
Slave product code.
Definition: ecrt.h:586
EtherCAT master.
Definition: master.h:187
Request processing failed.
Definition: ecrt.h:608
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().
uint8_t subindex
PDO entry subindex.
Definition: ecrt.h:533
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:2855
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:2754
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:621
EC_PUBLIC_API int ecrt_master_reset(ec_master_t *master)
Retry configuring slaves.
Definition: master.c:3291
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:3048
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