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 
1771  ec_slave_config_t *sc,
1772  uint16_t assign_activate,
1773  uint32_t sync0_cycle,
1774  int32_t sync0_shift,
1775  uint32_t sync1_cycle,
1776  int32_t sync1_shift
1777  );
1778 
1807  ec_slave_config_t *sc,
1808  uint16_t index,
1809  uint8_t subindex,
1810  const uint8_t *data,
1811  size_t size
1812  );
1813 
1827  ec_slave_config_t *sc,
1828  uint16_t sdo_index,
1829  uint8_t sdo_subindex,
1830  uint8_t value
1831  );
1832 
1846  ec_slave_config_t *sc,
1847  uint16_t sdo_index,
1848  uint8_t sdo_subindex,
1849  uint16_t value
1850  );
1851 
1865  ec_slave_config_t *sc,
1866  uint16_t sdo_index,
1867  uint8_t sdo_subindex,
1868  uint32_t value
1869  );
1870 
1887  ec_slave_config_t *sc,
1888  uint16_t index,
1889  const uint8_t *data,
1890  size_t size
1891  );
1892 
1906  ec_slave_config_t *sc,
1907  size_t elements
1908  );
1909 
1927  ec_slave_config_t *sc,
1928  uint8_t *target
1930  );
1931 
1943  ec_slave_config_t *sc
1944  );
1945 
1961  const ec_slave_config_t *sc
1962  );
1963 
1977  ec_slave_config_t *sc,
1978  uint16_t index,
1979  uint8_t subindex,
1980  size_t size
1981  );
1982 
1996  ec_slave_config_t *sc,
1997  uint8_t drive_no,
1998  uint16_t idn,
1999  size_t size
2000  );
2001 
2020  ec_slave_config_t *sc,
2021  size_t size
2022  );
2023 
2041  ec_slave_config_t *sc,
2042  size_t size
2043  );
2044 
2063  const ec_slave_config_t *sc,
2064  ec_slave_config_state_t *state
2065  );
2066 
2092  ec_slave_config_t *sc,
2093  uint8_t drive_no,
2094  uint16_t idn,
2095  ec_al_state_t state,
2097  const uint8_t *data,
2098  size_t size
2099  );
2100 
2126  ec_slave_config_t *sc,
2127  const char *key,
2128  int32_t value
2129  );
2130 
2145  ec_slave_config_t *sc,
2146  const unsigned char *mac_address
2147  );
2148 
2183  ec_slave_config_t *sc,
2184  struct in_addr ip_address
2185  );
2186 
2207  ec_slave_config_t *sc,
2208  struct in_addr subnet_mask
2209  );
2210 
2231  ec_slave_config_t *sc,
2232  struct in_addr gateway_address
2233  );
2234 
2256  ec_slave_config_t *sc,
2257  struct in_addr dns_address
2258  );
2259 
2277  ec_slave_config_t *sc,
2278  const char *name
2279  );
2280 
2298  ec_slave_config_t *sc,
2299  ec_al_state_t from_state,
2300  ec_al_state_t to_state,
2301  unsigned int timeout_ms
2302  );
2303 
2304 /*****************************************************************************
2305  * Domain methods
2306  ****************************************************************************/
2307 
2323  ec_domain_t *domain,
2324  const ec_pdo_entry_reg_t *pdo_entry_regs
2326  );
2327 
2337  const ec_domain_t *domain
2338  );
2339 
2340 #ifdef __KERNEL__
2341 
2356  ec_domain_t *domain,
2357  uint8_t *memory
2359  );
2360 
2361 #endif /* __KERNEL__ */
2362 
2379  const ec_domain_t *domain
2380  );
2381 
2394  ec_domain_t *domain
2395  );
2396 
2407  ec_domain_t *domain
2408  );
2409 
2421  const ec_domain_t *domain,
2422  ec_domain_state_t *state
2424  );
2425 
2426 /*****************************************************************************
2427  * SDO request methods.
2428  ****************************************************************************/
2429 
2445  ec_sdo_request_t *req,
2446  uint16_t index,
2447  uint8_t subindex
2448  );
2449 
2466  ec_sdo_request_t *req,
2467  uint32_t timeout
2469  );
2470 
2501  const ec_sdo_request_t *req
2502  );
2503 
2519  const ec_sdo_request_t *req
2520  );
2521 
2536 #ifdef __KERNEL__
2537  const
2538 #endif
2539  ec_sdo_request_t *req
2540  );
2541 
2558  ec_sdo_request_t *req
2559  );
2560 
2578  ec_sdo_request_t *req
2579  );
2580 
2581 /*****************************************************************************
2582  * SoE request methods.
2583  ****************************************************************************/
2584 
2600  ec_soe_request_t *req,
2601  uint8_t drive_no,
2602  uint16_t idn
2603  );
2604 
2621  ec_soe_request_t *req,
2622  uint32_t timeout
2624  );
2625 
2656  const ec_soe_request_t *req
2657  );
2658 
2670  const ec_soe_request_t *req
2671  );
2672 
2686 #ifdef __KERNEL__
2687  const
2688 #endif
2689  ec_soe_request_t *req
2690  );
2691 
2708  ec_soe_request_t *req
2709  );
2710 
2728  ec_soe_request_t *req
2729  );
2730 
2731 /*****************************************************************************
2732  * VoE handler methods.
2733  ****************************************************************************/
2734 
2751  ec_voe_handler_t *voe,
2752  uint32_t vendor_id,
2753  uint16_t vendor_type
2754  );
2755 
2772  const ec_voe_handler_t *voe,
2773  uint32_t *vendor_id,
2774  uint16_t *vendor_type
2775  );
2776 
2800  const ec_voe_handler_t *voe
2801  );
2802 
2818  const ec_voe_handler_t *voe
2819  );
2820 
2838  ec_voe_handler_t *voe,
2839  size_t size
2840  );
2841 
2865  ec_voe_handler_t *voe
2866  );
2867 
2892  ec_voe_handler_t *voe
2893  );
2894 
2909  ec_voe_handler_t *voe
2910  );
2911 
2912 /*****************************************************************************
2913  * Register request methods.
2914  ****************************************************************************/
2915 
2942  const ec_reg_request_t *req
2943  );
2944 
2956  const ec_reg_request_t *req
2957  );
2958 
2977  ec_reg_request_t *req,
2978  uint16_t address,
2979  size_t size
2980  );
2981 
3000  ec_reg_request_t *req,
3001  uint16_t address,
3002  size_t size
3003  );
3004 
3005 /*****************************************************************************
3006  * Bitwise read/write macros
3007  ****************************************************************************/
3008 
3014 #define EC_READ_BIT(DATA, POS) ((*((uint8_t *) (DATA)) >> (POS)) & 0x01)
3015 
3022 #define EC_WRITE_BIT(DATA, POS, VAL) \
3023  do { \
3024  if (VAL) *((uint8_t *) (DATA)) |= (1 << (POS)); \
3025  else *((uint8_t *) (DATA)) &= ~(1 << (POS)); \
3026  } while (0)
3027 
3028 /*****************************************************************************
3029  * Byte-swapping functions for user space
3030  ****************************************************************************/
3031 
3032 #ifndef __KERNEL__
3033 
3034 #if __BYTE_ORDER == __LITTLE_ENDIAN
3035 
3036 #define le16_to_cpu(x) x
3037 #define le32_to_cpu(x) x
3038 #define le64_to_cpu(x) x
3039 
3040 #define cpu_to_le16(x) x
3041 #define cpu_to_le32(x) x
3042 #define cpu_to_le64(x) x
3043 
3044 #elif __BYTE_ORDER == __BIG_ENDIAN
3045 
3046 #define swap16(x) \
3047  ((uint16_t)( \
3048  (((uint16_t)(x) & 0x00ffU) << 8) | \
3049  (((uint16_t)(x) & 0xff00U) >> 8) ))
3050 #define swap32(x) \
3051  ((uint32_t)( \
3052  (((uint32_t)(x) & 0x000000ffUL) << 24) | \
3053  (((uint32_t)(x) & 0x0000ff00UL) << 8) | \
3054  (((uint32_t)(x) & 0x00ff0000UL) >> 8) | \
3055  (((uint32_t)(x) & 0xff000000UL) >> 24) ))
3056 #define swap64(x) \
3057  ((uint64_t)( \
3058  (((uint64_t)(x) & 0x00000000000000ffULL) << 56) | \
3059  (((uint64_t)(x) & 0x000000000000ff00ULL) << 40) | \
3060  (((uint64_t)(x) & 0x0000000000ff0000ULL) << 24) | \
3061  (((uint64_t)(x) & 0x00000000ff000000ULL) << 8) | \
3062  (((uint64_t)(x) & 0x000000ff00000000ULL) >> 8) | \
3063  (((uint64_t)(x) & 0x0000ff0000000000ULL) >> 24) | \
3064  (((uint64_t)(x) & 0x00ff000000000000ULL) >> 40) | \
3065  (((uint64_t)(x) & 0xff00000000000000ULL) >> 56) ))
3066 
3067 #define le16_to_cpu(x) swap16(x)
3068 #define le32_to_cpu(x) swap32(x)
3069 #define le64_to_cpu(x) swap64(x)
3070 
3071 #define cpu_to_le16(x) swap16(x)
3072 #define cpu_to_le32(x) swap32(x)
3073 #define cpu_to_le64(x) swap64(x)
3074 
3075 #endif
3076 
3077 #define le16_to_cpup(x) le16_to_cpu(*((uint16_t *)(x)))
3078 #define le32_to_cpup(x) le32_to_cpu(*((uint32_t *)(x)))
3079 #define le64_to_cpup(x) le64_to_cpu(*((uint64_t *)(x)))
3080 
3081 #endif /* ifndef __KERNEL__ */
3082 
3083 /*****************************************************************************
3084  * Read macros
3085  ****************************************************************************/
3086 
3091 #define EC_READ_U8(DATA) \
3092  ((uint8_t) *((uint8_t *) (DATA)))
3093 
3099 #define EC_READ_S8(DATA) \
3100  ((int8_t) *((uint8_t *) (DATA)))
3101 
3107 #define EC_READ_U16(DATA) \
3108  ((uint16_t) le16_to_cpup((void *) (DATA)))
3109 
3115 #define EC_READ_S16(DATA) \
3116  ((int16_t) le16_to_cpup((void *) (DATA)))
3117 
3123 #define EC_READ_U32(DATA) \
3124  ((uint32_t) le32_to_cpup((void *) (DATA)))
3125 
3131 #define EC_READ_S32(DATA) \
3132  ((int32_t) le32_to_cpup((void *) (DATA)))
3133 
3139 #define EC_READ_U64(DATA) \
3140  ((uint64_t) le64_to_cpup((void *) (DATA)))
3141 
3147 #define EC_READ_S64(DATA) \
3148  ((int64_t) le64_to_cpup((void *) (DATA)))
3149 
3150 /*****************************************************************************
3151  * Floating-point read functions and macros (userspace only)
3152  ****************************************************************************/
3153 
3154 #ifndef __KERNEL__
3155 
3163 EC_PUBLIC_API float ecrt_read_real(const void *data);
3164 
3170 #define EC_READ_REAL(DATA) ecrt_read_real(DATA)
3171 
3179 EC_PUBLIC_API double ecrt_read_lreal(const void *data);
3180 
3186 #define EC_READ_LREAL(DATA) ecrt_read_lreal(DATA)
3187 
3188 #endif // ifndef __KERNEL__
3189 
3190 /*****************************************************************************
3191  * Write macros
3192  ****************************************************************************/
3193 
3199 #define EC_WRITE_U8(DATA, VAL) \
3200  do { \
3201  *((uint8_t *)(DATA)) = ((uint8_t) (VAL)); \
3202  } while (0)
3203 
3209 #define EC_WRITE_S8(DATA, VAL) EC_WRITE_U8(DATA, VAL)
3210 
3216 #define EC_WRITE_U16(DATA, VAL) \
3217  do { \
3218  *((uint16_t *) (DATA)) = cpu_to_le16((uint16_t) (VAL)); \
3219  } while (0)
3220 
3226 #define EC_WRITE_S16(DATA, VAL) EC_WRITE_U16(DATA, VAL)
3227 
3233 #define EC_WRITE_U32(DATA, VAL) \
3234  do { \
3235  *((uint32_t *) (DATA)) = cpu_to_le32((uint32_t) (VAL)); \
3236  } while (0)
3237 
3243 #define EC_WRITE_S32(DATA, VAL) EC_WRITE_U32(DATA, VAL)
3244 
3250 #define EC_WRITE_U64(DATA, VAL) \
3251  do { \
3252  *((uint64_t *) (DATA)) = cpu_to_le64((uint64_t) (VAL)); \
3253  } while (0)
3254 
3260 #define EC_WRITE_S64(DATA, VAL) EC_WRITE_U64(DATA, VAL)
3261 
3262 /*****************************************************************************
3263  * Floating-point write functions and macros (userspace only)
3264  ****************************************************************************/
3265 
3266 #ifndef __KERNEL__
3267 
3275 EC_PUBLIC_API void ecrt_write_real(void *data, float value);
3276 
3282 #define EC_WRITE_REAL(DATA, VAL) ecrt_write_real(DATA, VAL)
3283 
3291 EC_PUBLIC_API void ecrt_write_lreal(void *data, double value);
3292 
3298 #define EC_WRITE_LREAL(DATA, VAL) ecrt_write_lreal(DATA, VAL)
3299 
3300 #endif // ifndef __KERNEL__
3301 
3302 /****************************************************************************/
3303 
3304 #ifdef __cplusplus
3305 }
3306 #endif
3307 
3308 /****************************************************************************/
3309 
3312 #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:187
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