1 /****************************************************************************** |
|
2 * |
|
3 * Oeffentliche EtherCAT-Schnittstellen fuer Echtzeitprozesse. |
|
4 * |
|
5 * $Id$ |
|
6 * |
|
7 *****************************************************************************/ |
|
8 |
|
9 #ifndef _ETHERCAT_RT_H_ |
|
10 #define _ETHERCAT_RT_H_ |
|
11 |
|
12 /*****************************************************************************/ |
|
13 |
|
14 struct ec_master; |
|
15 typedef struct ec_master ec_master_t; |
|
16 |
|
17 struct ec_domain; |
|
18 typedef struct ec_domain ec_domain_t; |
|
19 |
|
20 struct ec_slave; |
|
21 typedef struct ec_slave ec_slave_t; |
|
22 |
|
23 typedef enum |
|
24 { |
|
25 ec_sync, |
|
26 ec_async |
|
27 } |
|
28 ec_domain_mode_t; |
|
29 |
|
30 typedef enum |
|
31 { |
|
32 ec_status, |
|
33 ec_control, |
|
34 ec_ipvalue, |
|
35 ec_opvalue |
|
36 } |
|
37 ec_field_type_t; |
|
38 |
|
39 typedef struct |
|
40 { |
|
41 void **data; |
|
42 const char *address; |
|
43 const char *vendor; |
|
44 const char *product; |
|
45 ec_field_type_t field_type; |
|
46 unsigned int field_index; |
|
47 unsigned int field_count; |
|
48 } |
|
49 ec_field_init_t; |
|
50 |
|
51 /*****************************************************************************/ |
|
52 // Master request functions |
|
53 |
|
54 ec_master_t *EtherCAT_rt_request_master(unsigned int master_index); |
|
55 |
|
56 void EtherCAT_rt_release_master(ec_master_t *master); |
|
57 |
|
58 /*****************************************************************************/ |
|
59 // Master methods |
|
60 |
|
61 ec_domain_t *EtherCAT_rt_master_register_domain(ec_master_t *master, |
|
62 ec_domain_mode_t mode, |
|
63 unsigned int timeout_us); |
|
64 |
|
65 int EtherCAT_rt_master_activate(ec_master_t *master); |
|
66 int EtherCAT_rt_master_deactivate(ec_master_t *master); |
|
67 |
|
68 void EtherCAT_rt_master_xio(ec_master_t *master); |
|
69 |
|
70 void EtherCAT_rt_master_debug(ec_master_t *master, int level); |
|
71 void EtherCAT_rt_master_print(const ec_master_t *master); |
|
72 |
|
73 /*****************************************************************************/ |
|
74 // Domain Methods |
|
75 |
|
76 ec_slave_t *EtherCAT_rt_register_slave_field(ec_domain_t *domain, |
|
77 const char *address, |
|
78 const char *vendor_name, |
|
79 const char *product_name, |
|
80 void **data_ptr, |
|
81 ec_field_type_t field_type, |
|
82 unsigned int field_index, |
|
83 unsigned int field_count); |
|
84 |
|
85 int EtherCAT_rt_register_domain_fields(ec_domain_t *domain, |
|
86 ec_field_init_t *fields); |
|
87 |
|
88 void EtherCAT_rt_domain_queue(ec_domain_t *domain); |
|
89 void EtherCAT_rt_domain_process(ec_domain_t *domain); |
|
90 |
|
91 /*****************************************************************************/ |
|
92 // Slave Methods |
|
93 |
|
94 int EtherCAT_rt_canopen_sdo_write(ec_slave_t *slave, |
|
95 uint16_t sdo_index, |
|
96 uint8_t sdo_subindex, |
|
97 uint32_t value, |
|
98 size_t size); |
|
99 |
|
100 int EtherCAT_rt_canopen_sdo_read(ec_slave_t *slave, |
|
101 uint16_t sdo_index, |
|
102 uint8_t sdo_subindex, |
|
103 uint32_t *value); |
|
104 |
|
105 int EtherCAT_rt_canopen_sdo_addr_write(ec_master_t *master, |
|
106 const char *addr, |
|
107 uint16_t sdo_index, |
|
108 uint8_t sdo_subindex, |
|
109 uint32_t value, |
|
110 size_t size); |
|
111 |
|
112 int EtherCAT_rt_canopen_sdo_addr_read(ec_master_t *master, |
|
113 const char *addr, |
|
114 uint16_t sdo_index, |
|
115 uint8_t sdo_subindex, |
|
116 uint32_t *value); |
|
117 |
|
118 /*****************************************************************************/ |
|
119 |
|
120 #endif |
|