Go to the documentation of this file.
35 #include <sys/types.h>
64 #define RX_PRIM priMAC[1]
66 #define RX_SEC secMAC[1]
118 pthread_mutex_init(&(port->
tx_mutex), NULL);
119 pthread_mutex_init(&(port->
rx_mutex), NULL);
168 pthread_mutex_destroy(&(port->
tx_mutex));
169 pthread_mutex_destroy(&(port->
rx_mutex));
191 bp->da0 = htons(0xffff);
192 bp->da1 = htons(0xffff);
193 bp->da2 = htons(0xffff);
194 bp->sa0 = htons(
priMAC[0]);
195 bp->sa1 = htons(
priMAC[1]);
196 bp->sa2 = htons(
priMAC[2]);
263 stack = &(port->
stack);
293 ehp->sa1 = htons(
priMAC[1]);
298 pthread_mutex_lock( &(port->
tx_mutex) );
303 datagramP->index = idx;
305 ehp->sa1 = htons(
secMAC[1]);
312 pthread_mutex_unlock( &(port->
tx_mutex) );
328 unsigned char const * pkt_data;
333 stack = &(port->
stack);
348 bytesrx = header->
len;
353 memcpy(*stack->
tempbuf, pkt_data, bytesrx);
355 return (bytesrx > 0);
386 stack = &(port->
stack);
397 l = (*rxbuf)[0] + ((
uint16)((*
rxbuf)[1] & 0x0f) << 8);
399 rval = ((*rxbuf)[l] + ((
uint16)(*
rxbuf)[l + 1] << 8));
405 pthread_mutex_lock(&(port->
rx_mutex));
415 l =
etohs(ecp->elength) & 0x0fff;
423 rval = ((*rxbuf)[l] + ((
uint16)((*
rxbuf)[l + 1]) << 8));
427 (*stack->
rxsa)[idx] = ntohs(ehp->sa1);
439 (*stack->
rxsa)[idxf] = ntohs(ehp->sa1);
449 pthread_mutex_unlock( &(port->
rx_mutex) );
513 if ( ((primrx == 0) && (secrx ==
RX_SEC)) ||
635 int ec_inframe(
int idx,
int stacknumber)
uint8 ec_bufT[EC_BUFSIZE]
int ec_waitinframe(int idx, int timeout)
void pcap_close(pcap_t *)
int ecx_inframe(ecx_portt *port, int idx, int stacknumber)
int ec_setupnic(const char *ifname, int secondary)
int txbuflength[EC_MAXBUF]
int ecx_outframe_red(ecx_portt *port, int idx)
int ecx_outframe(ecx_portt *port, int idx, int stacknumber)
void ec_setbufstat(int idx, int bufstat)
boolean osal_timer_is_expired(osal_timert *self)
int ec_outframe(int idx, int sock)
pcap_t * pcap_open_live(const char *, int, int, int, char *)
int pcap_setnonblock(pcap_t *, int, char *)
int pcap_next_ex(pcap_t *, struct pcap_pkthdr **, const u_char **)
int ecx_waitinframe(ecx_portt *port, int idx, int timeout)
int ec_srconfirm(int idx, int timeout)
int ec_outframe_red(int idx)
int ecx_closenic(ecx_portt *port)
PACKED_BEGIN struct PACKED ec_comt
int(* txbuflength)[EC_MAXBUF]
ec_bufT(* rxbuf)[EC_MAXBUF]
int ecx_setupnic(ecx_portt *port, const char *ifname, int secondary)
int pcap_sendpacket(pcap_t *, const u_char *, int)
static int ecx_recvpkt(ecx_portt *port, int stacknumber)
pthread_mutex_t getindex_mutex
void osal_timer_start(osal_timert *self, uint32 timeout_usec)
static char errbuf[PCAP_ERRBUF_SIZE]
ec_bufT(* txbuf)[EC_MAXBUF]
PACKED_BEGIN struct PACKED ec_etherheadert
void ecx_setbufstat(ecx_portt *port, int idx, int bufstat)
static int ecx_waitinframe_red(ecx_portt *port, int idx, osal_timert *timer)
General typedefs and defines for EtherCAT.
static void ecx_clear_rxbufstat(int *rxbufstat)
int(* rxbufstat)[EC_MAXBUF]
int ecx_getindex(ecx_portt *port)
int ecx_srconfirm(ecx_portt *port, int idx, int timeout)
void ec_setupheader(void *p)
int pcap_setdirection(pcap_t *, pcap_direction_t)
soem
Author(s): Arthur Ketels and M.J.G. van den Molengraft
autogenerated on Wed Mar 2 2022 01:01:49