Master interface for EtherCAT-capable network device drivers.
More...
Master interface for EtherCAT-capable network device drivers.
Through the EtherCAT device interface, EtherCAT-capable network device drivers are able to connect their device(s) to the master, pass received frames and notify the master about status changes. The master on his part, can send his frames through connected devices.
◆ ecdev_withdraw()
Withdraws an EtherCAT device from the master.
The device is disconnected from the master and all device ressources are freed.
- Attention
- Before calling this function, the ecdev_stop() function has to be called, to be sure that the master does not use the device any more.
- Parameters
-
Definition at line 528 of file device.c.
◆ ecdev_open()
Opens the network device and makes the master enter IDLE phase.
- Returns
- 0 on success, else < 0
- Parameters
-
Definition at line 559 of file device.c.
◆ ecdev_close()
Makes the master leave IDLE phase and closes the network device.
- Returns
- 0 on success, else < 0
- Parameters
-
Definition at line 597 of file device.c.
◆ ecdev_receive()
void ecdev_receive |
( |
ec_device_t * |
device, |
|
|
const void * |
data, |
|
|
size_t |
size |
|
) |
| |
Accepts a received frame.
Forwards the received data to the master. The master will analyze the frame and dispatch the received commands to the sending instances.
The data have to begin with the Ethernet header (target MAC address).
- Parameters
-
device | EtherCAT device |
data | pointer to received data |
size | number of bytes received |
Definition at line 621 of file device.c.
◆ ecdev_set_link()
void ecdev_set_link |
( |
ec_device_t * |
device, |
|
|
uint8_t |
state |
|
) |
| |
Sets a new link state.
If the device notifies the master about the link being down, the master will not try to send frames using this device.
- Parameters
-
device | EtherCAT device |
state | new link state |
Definition at line 665 of file device.c.
◆ ecdev_get_link()
Reads the link state.
- Returns
- Link state.
- Parameters
-
Definition at line 691 of file device.c.
◆ ecdev_offer()
Offers an EtherCAT device to a certain master.
The master decides, if it wants to use the device for EtherCAT operation, or not. It is important, that the offered net_device is not used by the kernel IP stack. If the master, accepted the offer, the address of the newly created EtherCAT device is returned, else NULL is returned.
- Returns
- Pointer to device, if accepted, or NULL if declined.
- Parameters
-
net_dev | net_device to offer |
poll | device poll function |
module | pointer to the module |
Definition at line 480 of file module.c.