72 uint8 cnt, data_offset;
82 EOEp->mbxheader.address =
htoes(0x0000);
83 EOEp->mbxheader.priority = 0x00;
100 if (ipparam->mac_set)
112 if (ipparam->subnet_set)
118 if (ipparam->default_gateway_set)
124 if (ipparam->dns_ip_set)
130 if (ipparam->dns_name_set)
138 EOEp->data[0] = flags;
154 frameinfo1 =
etohs(aEOEp->frameinfo1);
155 result =
etohs(aEOEp->result);
185 uint16 frameinfo1, eoedatasize;
186 uint8 cnt, data_offset;
195 EOEp->mbxheader.address =
htoes(0x0000);
196 EOEp->mbxheader.priority = 0x00;
208 EOEp->frameinfo2 = 0;
210 EOEp->mbxheader.length =
htoes(0x0004);
211 EOEp->data[0] = flags;
226 frameinfo1 =
etohs(aEOEp->frameinfo1);
227 eoedatasize =
etohs(aEOEp->mbxheader.length) - 0x0004;
238 flags = aEOEp->data[0];
241 memcpy(ipparam->mac.addr,
242 &aEOEp->data[data_offset],
244 ipparam->mac_set = 1;
258 ipparam->subnet_set = 1;
264 &ipparam->default_gateway);
265 ipparam->default_gateway_set = 1;
272 ipparam->dns_ip_set = 1;
280 dns_len = (eoedatasize - data_offset);
287 memcpy(ipparam->dns_name, &aEOEp->data[data_offset], dns_len);
288 ipparam->dns_name_set = 1;
292 if(data_offset > eoedatasize)
326 uint16 frameinfo1, frameinfo2;
327 uint16 txframesize, txframeoffset;
328 uint8 cnt, txfragmentno;
331 const uint8 * buf = p;
336 EOEp->mbxheader.address =
htoes(0x0000);
337 EOEp->mbxheader.priority = 0x00;
347 txframesize = psize - txframeoffset;
348 if (txframesize > maxdata)
351 txframesize = ((maxdata >> 5) << 5);
354 if (txframesize == (psize - txframeoffset))
365 if (txfragmentno > 0)
380 EOEp->mbxheader.length =
htoes(4 + txframesize);
383 EOEp->frameinfo1 =
htoes(frameinfo1);
384 EOEp->frameinfo2 =
htoes(frameinfo2);
386 memcpy(EOEp->data, &buf[txframeoffset], txframesize);
390 if ((NotLast ==
TRUE) && (wkc > 0))
392 txframeoffset += txframesize;
395 }
while ((NotLast ==
TRUE) && (wkc > 0));
434 while ((wkc > 0) && (NotLast ==
TRUE))
440 eoedatasize =
etohs(aEOEp->mbxheader.length) - 0x00004;
441 frameinfo1 =
etohs(aEOEp->frameinfo1);
442 frameinfo2 =
etohs(aEOEp->frameinfo2);
454 if (rxfragmentno == 0)
459 if (rxframesize > buffersize)
488 if ((rxframeoffset + eoedatasize) <= buffersize)
490 memcpy(&buf[rxframeoffset], aEOEp->data, eoedatasize);
491 rxframeoffset += eoedatasize;
543 uint16 frameinfo1, frameinfo2, eoedatasize;
555 eoedatasize =
etohs(aEOEp->mbxheader.length) - 0x00004;
556 frameinfo1 =
etohs(aEOEp->frameinfo1);
557 frameinfo2 =
etohs(aEOEp->frameinfo2);
563 if (*rxfragmentno != 0)
580 if (*rxfragmentno == 0)
610 if (((*rxframeoffset + eoedatasize) <= *rxframesize) &&
611 ((*rxframeoffset + eoedatasize) <= *psize))
613 memcpy(&buf[*rxframeoffset], aEOEp->data, eoedatasize);
614 *rxframeoffset += eoedatasize;
int ecx_EOEsetIp(ecx_contextt *context, uint16 slave, uint8 port, eoe_param_t *ipparam, int timeout)
#define EOE_HDR_LAST_FRAGMENT_GET(x)
int ecx_EOEreadfragment(ec_mbxbuft *MbxIn, uint8 *rxfragmentno, uint16 *rxframesize, uint16 *rxframeoffset, uint16 *rxframeno, int *psize, void *p)
#define EOE_PARAM_MAC_INCLUDE
#define EOE_ETHADDR_LENGTH
#define EOE_GET_IP_PARAM_REQ
Headerfile for all ethercat headers.
#define EOE_HDR_LAST_FRAGMENT_SET(x)
#define EOE_IP4_ADDR_TO_U32(ipaddr, a, b, c, d)
int(* EOEhook)(ecx_contextt *context, uint16 slave, void *eoembx)
#define EOE_HDR_TIME_APPEND_GET(x)
#define EOE_HDR_LAST_FRAGMENT
void ec_clearmbx(ec_mbxbuft *Mbx)
#define EOE_RESULT_UNSUPPORTED_FRAME_TYPE
static void EOE_ip_byte_to_uint32(uint8_t *byte_ip, eoe_ip4_addr_t *ip)
#define EOE_HDR_FRAME_NO_SET(x)
#define EOE_GET_IP_PARAM_RESP
int ecx_EOEgetIp(ecx_contextt *context, uint16 slave, uint8 port, eoe_param_t *ipparam, int timeout)
int ecx_mbxsend(ecx_contextt *context, uint16 slave, ec_mbxbuft *mbx, int timeout)
#define EOE_PARAM_DNS_IP_INCLUDE
#define EOE_PARAM_DEFAULT_GATEWAY_INCLUDE
#define EOE_HDR_FRAG_NO_SET(x)
int ecx_mbxreceive(ecx_contextt *context, uint16 slave, ec_mbxbuft *mbx, int timeout)
#define EOE_HDR_FRAME_PORT_GET(x)
int ecx_EOEsend(ecx_contextt *context, uint16 slave, uint8 port, int psize, void *p, int timeout)
PACKED_BEGIN struct PACKED ec_EOEt
#define EOE_HDR_FRAG_NO_GET(x)
#define eoe_ip4_addr1(ipaddr)
#define EOE_RESULT_SUCCESS
#define EOE_HDR_FRAME_NO_GET(x)
#define EOE_PARAM_IP_INCLUDE
#define eoe_ip4_addr3(ipaddr)
#define EOE_HDR_FRAME_OFFSET_GET(x)
#define EOE_DNS_NAME_LENGTH
static void EOE_ip_uint32_to_byte(eoe_ip4_addr_t *ip, uint8_t *byte_ip)
#define eoe_ip4_addr2(ipaddr)
int ecx_EOErecv(ecx_contextt *context, uint16 slave, uint8 port, int *psize, void *p, int timeout)
#define EOE_PARAM_SUBNET_IP_INCLUDE
#define EOE_HDR_FRAME_TYPE_SET(x)
#define EOE_PARAM_DNS_NAME_INCLUDE
#define EOE_HDR_FRAME_OFFSET_SET(x)
PACKED_END struct eoe_param eoe_param_t
#define eoe_ip4_addr4(ipaddr)
#define EOE_HDR_FRAME_PORT_SET(x)
int ecx_EOEdefinehook(ecx_contextt *context, void *hook)
#define EOE_HDR_FRAME_TYPE_GET(x)
uint8 ec_mbxbuft[EC_MAXMBX+1]
uint8 ec_nextmbxcnt(uint8 cnt)