ethercateoe.h
Go to the documentation of this file.
1 /*
2  * Licensed under the GNU General Public License version 2 with exceptions. See
3  * LICENSE file in the project root for full license information
4  */
5 
11 #ifndef _ethercateoe_
12 #define _ethercateoe_
13 
14 #ifdef __cplusplus
15 extern "C"
16 {
17 #endif
18 
19 #include <ethercattype.h>
20 
22 #define EOE_DNS_NAME_LENGTH 32
23 
24 #define EOE_ETHADDR_LENGTH 6
25 
26 #define EOE_MAKEU32(a,b,c,d) (((uint32_t)((a) & 0xff) << 24) | \
27  ((uint32_t)((b) & 0xff) << 16) | \
28  ((uint32_t)((c) & 0xff) << 8) | \
29  (uint32_t)((d) & 0xff))
30 
31 #if !defined(EC_BIG_ENDIAN) && defined(EC_LITTLE_ENDIAN)
32 
33 #define EOE_HTONS(x) ((((x) & 0x00ffUL) << 8) | (((x) & 0xff00UL) >> 8))
34 #define EOE_NTOHS(x) EOE_HTONS(x)
35 #define EOE_HTONL(x) ((((x) & 0x000000ffUL) << 24) | \
36  (((x) & 0x0000ff00UL) << 8) | \
37  (((x) & 0x00ff0000UL) >> 8) | \
38  (((x) & 0xff000000UL) >> 24))
39 #define EOE_NTOHL(x) EOE_HTONL(x)
40 #else
41 #define EOE_HTONS(x) (x)
42 #define EOE_NTOHS(x) (x)
43 #define EOE_HTONL(x) (x)
44 #define EOE_NTOHL(x) (x)
45 #endif /* !defined(EC_BIG_ENDIAN) && defined(EC_LITTLE_ENDIAN) */
46 
48 #define eoe_ip4_addr1(ipaddr) (((const uint8_t*)(&(ipaddr)->addr))[0])
49 #define eoe_ip4_addr2(ipaddr) (((const uint8_t*)(&(ipaddr)->addr))[1])
50 #define eoe_ip4_addr3(ipaddr) (((const uint8_t*)(&(ipaddr)->addr))[2])
51 #define eoe_ip4_addr4(ipaddr) (((const uint8_t*)(&(ipaddr)->addr))[3])
52 
54 #define EOE_IP4_ADDR_TO_U32(ipaddr,a,b,c,d) \
55  (ipaddr)->addr = EOE_HTONL(EOE_MAKEU32(a,b,c,d))
56 
58 #define EOE_HDR_FRAME_TYPE_OFFSET 0
59 #define EOE_HDR_FRAME_TYPE (0xF << 0)
60 #define EOE_HDR_FRAME_TYPE_SET(x) (((x) & 0xF) << 0)
61 #define EOE_HDR_FRAME_TYPE_GET(x) (((x) >> 0) & 0xF)
62 #define EOE_HDR_FRAME_PORT_OFFSET 4
63 #define EOE_HDR_FRAME_PORT (0xF << 4)
64 #define EOE_HDR_FRAME_PORT_SET(x) (((x) & 0xF) << 4)
65 #define EOE_HDR_FRAME_PORT_GET(x) (((x) >> 4) & 0xF)
66 #define EOE_HDR_LAST_FRAGMENT_OFFSET 8
67 #define EOE_HDR_LAST_FRAGMENT (0x1 << 8)
68 #define EOE_HDR_LAST_FRAGMENT_SET(x) (((x) & 0x1) << 8)
69 #define EOE_HDR_LAST_FRAGMENT_GET(x) (((x) >> 8) & 0x1)
70 #define EOE_HDR_TIME_APPEND_OFFSET 9
71 #define EOE_HDR_TIME_APPEND (0x1 << 9)
72 #define EOE_HDR_TIME_APPEND_SET(x) (((x) & 0x1) << 9)
73 #define EOE_HDR_TIME_APPEND_GET(x) (((x) >> 9) & 0x1)
74 #define EOE_HDR_TIME_REQUEST_OFFSET 10
75 #define EOE_HDR_TIME_REQUEST (0x1 << 10)
76 #define EOE_HDR_TIME_REQUEST_SET(x) (((x) & 0x1) << 10)
77 #define EOE_HDR_TIME_REQUEST_GET(x) (((x) >> 10) & 0x1)
78 
80 #define EOE_HDR_FRAG_NO_OFFSET 0
81 #define EOE_HDR_FRAG_NO (0x3F << 0)
82 #define EOE_HDR_FRAG_NO_SET(x) (((x) & 0x3F) << 0)
83 #define EOE_HDR_FRAG_NO_GET(x) (((x) >> 0) & 0x3F)
84 #define EOE_HDR_FRAME_OFFSET_OFFSET 6
85 #define EOE_HDR_FRAME_OFFSET (0x3F << 6)
86 #define EOE_HDR_FRAME_OFFSET_SET(x) (((x) & 0x3F) << 6)
87 #define EOE_HDR_FRAME_OFFSET_GET(x) (((x) >> 6) & 0x3F)
88 #define EOE_HDR_FRAME_NO_OFFSET 12
89 #define EOE_HDR_FRAME_NO (0xF << 12)
90 #define EOE_HDR_FRAME_NO_SET(x) (((x) & 0xF) << 12)
91 #define EOE_HDR_FRAME_NO_GET(x) (((x) >> 12) & 0xF)
92 
94 #define EOE_PARAM_OFFSET 4
95 #define EOE_PARAM_MAC_INCLUDE (0x1 << 0)
96 #define EOE_PARAM_IP_INCLUDE (0x1 << 1)
97 #define EOE_PARAM_SUBNET_IP_INCLUDE (0x1 << 2)
98 #define EOE_PARAM_DEFAULT_GATEWAY_INCLUDE (0x1 << 3)
99 #define EOE_PARAM_DNS_IP_INCLUDE (0x1 << 4)
100 #define EOE_PARAM_DNS_NAME_INCLUDE (0x1 << 5)
101 
103 #define EOE_FRAG_DATA 0
104 #define EOE_INIT_RESP_TIMESTAMP 1
105 #define EOE_INIT_REQ 2 /* Spec SET IP REQ */
106 #define EOE_INIT_RESP 3 /* Spec SET IP RESP */
107 #define EOE_SET_ADDR_FILTER_REQ 4
108 #define EOE_SET_ADDR_FILTER_RESP 5
109 #define EOE_GET_IP_PARAM_REQ 6
110 #define EOE_GET_IP_PARAM_RESP 7
111 #define EOE_GET_ADDR_FILTER_REQ 8
112 #define EOE_GET_ADDR_FILTER_RESP 9
113 
115 #define EOE_RESULT_SUCCESS 0x0000
116 #define EOE_RESULT_UNSPECIFIED_ERROR 0x0001
117 #define EOE_RESULT_UNSUPPORTED_FRAME_TYPE 0x0002
118 #define EOE_RESULT_NO_IP_SUPPORT 0x0201
119 #define EOE_RESULT_NO_DHCP_SUPPORT 0x0202
120 #define EOE_RESULT_NO_FILTER_SUPPORT 0x0401
121 
122 
124 typedef struct eoe_ip4_addr {
127 
130 typedef struct PACKED eoe_ethaddr
131 {
133 } eoe_ethaddr_t;
135 
137 typedef struct eoe_param
138 {
151 } eoe_param_t;
152 
157 typedef struct PACKED
158 {
161  union
162  {
165  };
167 } ec_EOEt;
169 
170 int ecx_EOEdefinehook(ecx_contextt *context, void *hook);
171 int ecx_EOEsetIp(ecx_contextt *context,
172  uint16 slave,
173  uint8 port,
174  eoe_param_t * ipparam,
175  int timeout);
176 int ecx_EOEgetIp(ecx_contextt *context,
177  uint16 slave,
178  uint8 port,
179  eoe_param_t * ipparam,
180  int timeout);
181 int ecx_EOEsend(ecx_contextt *context,
182  uint16 slave,
183  uint8 port,
184  int psize,
185  void *p,
186  int timeout);
187 int ecx_EOErecv(ecx_contextt *context,
188  uint16 slave,
189  uint8 port,
190  int * psize,
191  void *p,
192  int timeout);
194  ec_mbxbuft * MbxIn,
198  uint16 * rxframeno,
199  int * psize,
200  void *p);
201 
202 #ifdef __cplusplus
203 }
204 #endif
205 
206 #endif
eoe_param::default_gateway_set
uint8_t default_gateway_set
Definition: ethercateoe.h:142
uint8_t
unsigned char uint8_t
Definition: stdint.h:78
slave
int slave
Definition: aliastool.c:44
eoe_param::dns_name
char dns_name[EOE_DNS_NAME_LENGTH]
Definition: ethercateoe.h:150
uint16_t
unsigned short uint16_t
Definition: stdint.h:79
ecx_EOEreadfragment
int ecx_EOEreadfragment(ec_mbxbuft *MbxIn, uint8 *rxfragmentno, uint16 *rxframesize, uint16 *rxframeoffset, uint16 *rxframeno, int *psize, void *p)
Definition: ethercateoe.c:534
ec_mbxbuft
uint8 ec_mbxbuft[EC_MAXMBX+1]
Definition: ethercatmain.h:312
PACKED::data
uint8 data[0]
Definition: ethercateoe.h:166
eoe_param::subnet_set
uint8_t subnet_set
Definition: ethercateoe.h:141
eoe_ip4_addr
Definition: ethercateoe.h:124
rxframeno
uint16_t rxframeno
Definition: eoe_test.c:49
PACKED::result
uint16_t result
Definition: ethercateoe.h:164
ecx_EOEsend
int ecx_EOEsend(ecx_contextt *context, uint16 slave, uint8 port, int psize, void *p, int timeout)
Definition: ethercateoe.c:322
ec_mbxheadert
PACKED_BEGIN struct PACKED ec_mbxheader ec_mbxheadert
uint8
uint8_t uint8
Definition: osal.h:28
eoe_ip4_addr::addr
uint32_t addr
Definition: ethercateoe.h:125
eoe_param::mac_set
uint8_t mac_set
Definition: ethercateoe.h:139
PACKED_END
#define PACKED_END
Definition: erika/osal_defs.h:30
eoe_param::ip
eoe_ip4_addr_t ip
Definition: ethercateoe.h:146
PACKED_BEGIN
#define PACKED_BEGIN
Definition: erika/osal_defs.h:28
eoe_param::dns_ip
eoe_ip4_addr_t dns_ip
Definition: ethercateoe.h:149
PACKED
Definition: ethercatcoe.c:24
uint32_t
unsigned int uint32_t
Definition: stdint.h:80
eoe_param::ip_set
uint8_t ip_set
Definition: ethercateoe.h:140
ec_EOEt
PACKED_BEGIN struct PACKED ec_EOEt
rxfragmentno
uint8_t rxfragmentno
Definition: eoe_test.c:43
ecx_EOErecv
int ecx_EOErecv(ecx_contextt *context, uint16 slave, uint8 port, int *psize, void *p, int timeout)
Definition: ethercateoe.c:415
ecx_EOEdefinehook
PACKED_END int ecx_EOEdefinehook(ecx_contextt *context, void *hook)
Definition: ethercateoe.c:52
eoe_ethaddr
Definition: ethercateoe.h:130
rxframesize
uint16_t rxframesize
Definition: eoe_test.c:45
eoe_param::default_gateway
eoe_ip4_addr_t default_gateway
Definition: ethercateoe.h:148
eoe_param::dns_ip_set
uint8_t dns_ip_set
Definition: ethercateoe.h:143
PACKED::addr
uint16 addr
Definition: ethercatmain.c:33
rxframeoffset
uint16_t rxframeoffset
Definition: eoe_test.c:47
ecx_EOEsetIp
int ecx_EOEsetIp(ecx_contextt *context, uint16 slave, uint8 port, eoe_param_t *ipparam, int timeout)
Definition: ethercateoe.c:67
uint16
uint16_t uint16
Definition: osal.h:29
PACKED::mbxheader
ec_mbxheadert mbxheader
Definition: ethercateoe.h:159
eoe_ethaddr_t
PACKED_BEGIN struct PACKED eoe_ethaddr eoe_ethaddr_t
ecx_EOEgetIp
int ecx_EOEgetIp(ecx_contextt *context, uint16 slave, uint8 port, eoe_param_t *ipparam, int timeout)
Definition: ethercateoe.c:181
eoe_param::dns_name_set
uint8_t dns_name_set
Definition: ethercateoe.h:144
eoe_param::subnet
eoe_ip4_addr_t subnet
Definition: ethercateoe.h:147
ecx_context
Definition: ethercatmain.h:384
eoe_param_t
PACKED_END struct eoe_param eoe_param_t
EOE_ETHADDR_LENGTH
#define EOE_ETHADDR_LENGTH
Definition: ethercateoe.h:24
eoe_param::mac
eoe_ethaddr_t mac
Definition: ethercateoe.h:145
eoe_param
Definition: ethercateoe.h:137
EOE_DNS_NAME_LENGTH
#define EOE_DNS_NAME_LENGTH
Definition: ethercateoe.h:22
eoe_ip4_addr_t
struct eoe_ip4_addr eoe_ip4_addr_t
ethercattype.h
General typedefs and defines for EtherCAT.
PACKED::frameinfo2
uint16_t frameinfo2
Definition: ethercateoe.h:163
PACKED::frameinfo1
uint16_t frameinfo1
Definition: ethercateoe.h:160


soem
Author(s): Arthur Ketels and M.J.G. van den Molengraft
autogenerated on Wed Mar 2 2022 01:01:48