65 #define RX_PRIM priMAC[1] 67 #define RX_SEC secMAC[1] 76 #define ECAT_PRINT_INFO printf 77 #define ECAT_PRINT_WARN printf 78 #define ECAT_PRINT_ERROR printf 96 int dontWaitForLink = 0;
98 HPE_CONFIG_OPTIONS conf = { 0, 0, NULL};
115 conf.option_flags |= OPT_PROMISC;
117 status = hpeConfigOptions(port->
handle, &conf,
sizeof(conf));
129 status = hpeGetMediaStatus(port->
handle, &mstat);
136 if (mstat.media_speed == SPEED_NONE)
141 }
while (mstat.media_speed == SPEED_NONE && t < (now+10));
145 mstat.media_speed, mstat.media_duplex);
150 status= hpeGetMacAddress(port->
handle, mac);
162 ECAT_PRINT_ERROR(
"hpeAllocateReceiveBufferSet failed with status %04x\n", status);
170 ECAT_PRINT_ERROR(
"hpeAttachReceiveBufferSet failed with status %04x\n", status);
189 port->
rx_region = CreateRtRegion (PRIORITY_QUEUING);
190 port->
tx_region = CreateRtRegion (PRIORITY_QUEUING);
206 port->
tx_buffers[i] = (HPETXBUFFERSET *)AllocateRtMemory(
sizeof(HPETXBUFFER) +
sizeof(HPETXBUFFERSET));
208 port->
tx_buffers[i]->buffers[0].fragment_count = 1;
212 port->
tx_buffers[i]->buffers[0].fragments[0].paddr = 0;
241 status= hpeClose(port->
handle);
335 stack = &(port->
stack);
343 port->
tx_buffers[idx]->buffers[0].fragments[0].size = lp;
348 result = hpeGetTransmitterState(port->
handle, &txstate) == E_OK && txstate == HPE_TXBUSY;
349 }
while (result && retries-- > 0);
357 log_RT_event(
'S',(WORD)2);
364 log_RT_event(
'S',(WORD)3);
367 status = hpeStartTransmitter(port->
handle);
375 log_RT_event(
'S',(WORD)4);
405 datagramP->index = idx;
437 stack = &(port->
stack);
444 log_RT_event(
'R',(WORD)2);
446 status = hpeGetReceiveBuffer(port->
handle, &rxbuffer);
449 memcpy(stack->
tempbuf,rxbuffer->ptr, rxbuffer->used);
450 bytesrx = rxbuffer->used;
454 log_RT_event(
'R',(WORD)3);
456 return (bytesrx > 0);
486 stack = &(port->
stack);
494 rxbuf = &(*stack->
rxbuf)[idx];
498 l = (*rxbuf)[0] + ((
uint16)((*rxbuf)[1] & 0x0f) << 8);
500 rval = ((*rxbuf)[l] + ((
uint16)(*rxbuf)[l + 1] << 8));
516 l =
etohs(ecp->elength) & 0x0fff;
524 rval = ((*rxbuf)[l] + ((
uint16)((*rxbuf)[l + 1]) << 8));
535 rxbuf = &(*stack->
rxbuf)[idxf];
611 if ( ((primrx == 0) && (secrx ==
RX_SEC)) ||
729 int ec_inframe(
int idx,
int stacknumber)
int ecx_srconfirm(ecx_portt *port, int idx, int timeout)
int ec_outframe(int idx, int sock)
int ecx_setupnic(ecx_portt *port, const char *ifname, int secondary)
boolean osal_timer_is_expired(osal_timert *self)
int txbuflength[EC_MAXBUF]
int ec_setupnic(const char *ifname, int secondary)
HPERXBUFFERSET * rx_buffers
int ecx_closenic(ecx_portt *port)
int(* txbuflength)[EC_MAXBUF]
PACKED_BEGIN struct PACKED ec_etherheadert
int ecx_outframe_red(ecx_portt *port, int idx)
uint16 oshw_ntohs(uint16 network)
const unsigned long phy_settings
int ecx_getindex(ecx_portt *port)
uint16 oshw_htons(uint16 host)
General typedefs and defines for EtherCAT.
HPETXBUFFERSET * tx_buffers[EC_MAXBUF]
void ec_setupheader(void *p)
ec_bufT(* rxbuf)[EC_MAXBUF]
int ec_srconfirm(int idx, int timeout)
const unsigned long interrupt_mode
ec_bufT(* txbuf)[EC_MAXBUF]
void ec_setbufstat(int idx, int bufstat)
PACKED_BEGIN struct PACKED ec_comt
void ecx_setbufstat(ecx_portt *port, int idx, int bufstat)
int ec_outframe_red(int idx)
uint8 ec_bufT[EC_BUFSIZE]
static int ecx_waitinframe_red(ecx_portt *port, int idx, osal_timert *timer)
int ecx_inframe(ecx_portt *port, int idx, int stacknumber)
int ec_waitinframe(int idx, int timeout)
void osal_timer_start(osal_timert *self, uint32 timeout_usec)
int(* rxbufstat)[EC_MAXBUF]
int ecx_outframe(ecx_portt *port, int idx, int stacknumber)
static int ecx_recvpkt(ecx_portt *port, int stacknumber)
int ecx_waitinframe(ecx_portt *port, int idx, int timeout)