nicdrv.h File Reference
Headerfile for nicdrv.c.
More...
Go to the source code of this file.
Detailed Description
Headerfile for nicdrv.c.
Definition in file nicdrv.h.
Function Documentation
Close sockets used.
- Returns:
- 0
Definition at line 255 of file nicdrv.c.
uint8 ec_getindex |
( |
void |
|
) |
|
Get new frame identifier index and allocate corresponding rx buffer.
- Returns:
- new index.
Definition at line 284 of file nicdrv.c.
int ec_outframe |
( |
uint8 |
idx, |
|
|
int |
stacknumber | |
|
) |
| | |
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
Definition at line 332 of file nicdrv.c.
int ec_outframe_red |
( |
uint8 |
idx |
) |
|
Transmit buffer over socket (non blocking).
- Parameters:
-
[in] | idx | = index in tx buffer array |
- Returns:
- socket send result
Definition at line 349 of file nicdrv.c.
void ec_setbufstat |
( |
uint8 |
idx, |
|
|
int |
bufstat | |
|
) |
| | |
Set rx buffer status.
- Parameters:
-
[in] | idx | = index in buffer array |
[in] | bufstat | = status to set |
Definition at line 321 of file nicdrv.c.
void ec_setupheader |
( |
void * |
p |
) |
|
Fill buffer with ethernet header structure.
Destination MAC is allways broadcast. Ethertype is allways ETH_P_ECAT.
- Parameters:
-
Definition at line 268 of file nicdrv.c.
int ec_setupnic |
( |
const char * |
ifname, |
|
|
int |
secondary | |
|
) |
| | |
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
Definition at line 189 of file nicdrv.c.
int ec_srconfirm |
( |
uint8 |
idx, |
|
|
int |
timeout | |
|
) |
| | |
Blocking send and recieve 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 619 of file nicdrv.c.
int ec_waitinframe |
( |
uint8 |
idx, |
|
|
int |
timeout | |
|
) |
| | |
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 589 of file nicdrv.c.
Variable Documentation
global error packet counter, ie non EtherCAT packets
Definition at line 157 of file nicdrv.c.
global rx packet counter, counts only EtherCAT packets
Definition at line 155 of file nicdrv.c.
current redundancy state
Definition at line 159 of file nicdrv.c.
primary rx buffers
Definition at line 114 of file nicdrv.c.
transmit buffers
Definition at line 134 of file nicdrv.c.
temporary tx buffer
Definition at line 138 of file nicdrv.c.
transmit buffer lenghts
Definition at line 136 of file nicdrv.c.
temporary tx buffer length
Definition at line 140 of file nicdrv.c.
global helper var ri count time used in rx socket
Definition at line 164 of file nicdrv.c.
global helper var to count time used in tx socket
Definition at line 162 of file nicdrv.c.
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.
Definition at line 171 of file nicdrv.c.
Secondary source MAC address used for EtherCAT.
Definition at line 173 of file nicdrv.c.
primary socket handle
Definition at line 143 of file nicdrv.c.
secondary socket handle
Definition at line 145 of file nicdrv.c.