Classes | Functions | Variables
erika/nicdrv.h File Reference

Headerfile for nicdrv.c. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ec_stackT
 
struct  ecx_portt
 
struct  ecx_redportt
 

Functions

void ec_setupheader (void *p)
 
int ecx_closenic (ecx_portt *port)
 
int ecx_getindex (ecx_portt *port)
 
int ecx_inframe (ecx_portt *port, int idx, int stacknumber)
 
int ecx_outframe (ecx_portt *port, int idx, int sock)
 
int ecx_outframe_red (ecx_portt *port, int idx)
 
void ecx_setbufstat (ecx_portt *port, int idx, int bufstat)
 
int ecx_setupnic (ecx_portt *port, const char *ifname, int secondary)
 
int ecx_srconfirm (ecx_portt *port, int idx, int timeout)
 
int ecx_waitinframe (ecx_portt *port, int idx, int timeout)
 

Variables

const uint16 priMAC [3]
 
const uint16 secMAC [3]
 

Detailed Description

Headerfile for nicdrv.c.

Definition in file erika/nicdrv.h.

Function Documentation

◆ ec_setupheader()

void ec_setupheader ( void *  p)

Fill buffer with ethernet header structure. Destination MAC is always broadcast. Ethertype is always ETH_P_ECAT.

Parameters
[out]p= buffer

Fill buffer with Ethernet header structure. Destination MAC is always broadcast. Ethertype is always ETH_P_ECAT.

Parameters
[out]p= buffer

Definition at line 151 of file erika/nicdrv.c.

◆ ecx_closenic()

int ecx_closenic ( ecx_portt port)
inline

Close sockets used

Parameters
[in]port= port context struct
Returns
0

Close sockets used

Returns
0

Definition at line 140 of file erika/nicdrv.c.

◆ ecx_getindex()

int ecx_getindex ( ecx_portt port)

Get new frame identifier index and allocate corresponding rx buffer.

Parameters
[in]port= port context struct
Returns
new index.

Get new frame identifier index and allocate corresponding rx buffer.

Returns
new index.

Definition at line 168 of file erika/nicdrv.c.

◆ ecx_inframe()

int ecx_inframe ( ecx_portt port,
int  idx,
int  stacknumber 
)

Non blocking receive frame function. Uses RX buffer and index to combine read frame with transmitted frame. To compensate for received frames that are out-of-order all frames are stored in their respective indexed buffer. If a frame was placed in the buffer previously, the function retrieves it from that buffer index without calling ec_recvpkt. If the requested index is not already in the buffer it calls ec_recvpkt to fetch it. There are three options now, 1 no frame read, so exit. 2 frame read but other than requested index, store in buffer and exit. 3 frame read with matching index, store in buffer, set completed flag in buffer status and exit.

Parameters
[in]port= port context struct
[in]idx= requested index of frame
[in]stacknumber= 0=primary 1=secondary stack
Returns
Workcounter if a frame is found with corresponding index, otherwise EC_NOFRAME or EC_OTHERFRAME.

Non blocking receive frame function. Uses RX buffer and index to combine read frame with transmitted frame. To compensate for received frames that are out-of-order all frames are stored in their respective indexed buffer. If a frame was placed in the buffer previously, the function retrieves it from that buffer index without calling ec_recvpkt. If the requested index is not already in the buffer it calls ec_recvpkt to fetch it. There are three options now, 1 no frame read, so exit. 2 frame read but other than requested index, store in buffer and exit. 3 frame read with matching index, store in buffer, set completed flag in buffer status and exit.

Parameters
[in]idx= requested index of frame
[in]stacknumber= 0=primary 1=secondary stack
Returns
Workcounter if a frame is found with corresponding index, otherwise EC_NOFRAME or EC_OTHERFRAME.

Definition at line 303 of file erika/nicdrv.c.

◆ ecx_outframe()

int ecx_outframe ( ecx_portt port,
int  idx,
int  stacknumber 
)

Transmit buffer over socket (non blocking).

Parameters
[in]port= port context struct
[in]idx= index in tx buffer array
[in]stacknumber= 0=Primary 1=Secondary stack
Returns
socket send result

Transmit buffer over socket (non blocking).

Parameters
[in]idx= index in tx buffer array
[in]stacknumber= 0=Primary 1=Secondary stack
Returns
socket send result

High level transmit buffer over mux layer 2 driver, passing buffer and packet device to send on as arguments

Parameters
[in]port= port context holding reference to packet device
[in]idx= index in tx buffer array
[in]stacknumber= 0=Primary 1=Secondary stack
Returns
socket send result

Definition at line 215 of file erika/nicdrv.c.

◆ ecx_outframe_red()

int ecx_outframe_red ( ecx_portt port,
int  idx 
)

Transmit buffer over socket (non blocking).

Parameters
[in]port= port context struct
[in]idx= index in tx buffer array
Returns
socket send result

Transmit buffer over socket (non blocking).

Parameters
[in]idx= index in tx buffer array
Returns
socket send result

High level transmit frame to send as index.

Parameters
[in]port= port context
[in]idx= index in tx buffer array
Returns
socket send result

Definition at line 237 of file erika/nicdrv.c.

◆ ecx_setbufstat()

void ecx_setbufstat ( ecx_portt port,
int  idx,
int  bufstat 
)

Set rx buffer status.

Parameters
[in]port= port context struct
[in]idx= index in buffer array
[in]bufstat= status to set

Set rx buffer status.

Parameters
[in]idx= index in buffer array
[in]bufstat= status to set

Definition at line 202 of file erika/nicdrv.c.

◆ ecx_setupnic()

int ecx_setupnic ( ecx_portt port,
const char *  ifname,
int  secondary 
)

Basic setup to connect NIC to socket.

Parameters
[in]port= port context struct
[in]ifname= Name of NIC device, f.e. "eth0"
[in]secondary= if >0 then use secondary stack instead of primary
Returns
>0 if succeeded

Basic setup to connect NIC to socket.

Parameters
[in]ifname= Name of NIC device, f.e. "eth0"
[in]secondary= if >0 then use secondary stack instead of primary
Returns
>0 if succeeded

Basic setup to connect NIC to socket.

Parameters
[in]port= port context struct
[in]ifname= Name of NIC device, f.e. "gei0"
[in]secondary= if >0 then use secondary stack instead of primary
Returns
>0 if succeeded

Definition at line 90 of file erika/nicdrv.c.

◆ ecx_srconfirm()

int ecx_srconfirm ( ecx_portt port,
int  idx,
int  timeout 
)

Blocking send and receive frame function. Used for non processdata frames. A datagram is build into a frame and transmitted via this function. It waits for an answer and returns the workcounter. The function retries if time is left and the result is WKC=0 or no frame received.

The function calls ec_outframe_red() and ec_waitinframe_red().

Parameters
[in]port= port context struct
[in]idx= index of frame
[in]timeout= timeout in us
Returns
Workcounter or EC_NOFRAME

Blocking send and receive frame function. Used for non processdata frames. A datagram is build into a frame and transmitted via this function. It waits for an answer and returns the workcounter. The function retries if time is left and the result is WKC=0 or no frame received.

The function calls ec_outframe_red() and ec_waitinframe_red().

Parameters
[in]idx= index of frame
[in]timeout= timeout in us
Returns
Workcounter or EC_NOFRAME

Definition at line 490 of file erika/nicdrv.c.

◆ ecx_waitinframe()

int ecx_waitinframe ( ecx_portt port,
int  idx,
int  timeout 
)

Blocking receive frame function. Calls ec_waitinframe_red().

Parameters
[in]port= port context struct
[in]idx= requested index of frame
[in]timeout= timeout in us
Returns
Workcounter if a frame is found with corresponding index, otherwise EC_NOFRAME.

Blocking receive frame function. Calls ec_waitinframe_red().

Parameters
[in]idx= requested index of frame
[in]timeout= timeout in us
Returns
Workcounter if a frame is found with corresponding index, otherwise EC_NOFRAME.

Definition at line 467 of file erika/nicdrv.c.

Variable Documentation

◆ priMAC

const uint16 priMAC[3]

Primary source MAC address used for EtherCAT. This address is not the MAC address used from the NIC. EtherCAT does not care about MAC addressing, but it is used here to differentiate the route the packet traverses through the EtherCAT segment. This is needed to find out the packet flow in redundant configurations.

Primary source MAC address used for EtherCAT. This address is not the MAC address used from the NIC. EtherCAT does not care about MAC addressing, but it is used here to differentiate the route the packet traverses through the EtherCAT segment. This is needed to fund out the packet flow in redundant configurations.

Definition at line 65 of file erika/nicdrv.c.

◆ secMAC

const uint16 secMAC[3]

Secondary source MAC address used for EtherCAT.

Definition at line 67 of file erika/nicdrv.c.



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