IgH EtherCAT Master  1.6.2
EtherCAT Device Interface

Master interface for EtherCAT-capable network device drivers. More...

Functions

void ecdev_withdraw (ec_device_t *device)
 Withdraws an EtherCAT device from the master. More...
 
int ecdev_open (ec_device_t *device)
 Opens the network device and makes the master enter IDLE phase. More...
 
void ecdev_close (ec_device_t *device)
 Makes the master leave IDLE phase and closes the network device. More...
 
void ecdev_receive (ec_device_t *device, const void *data, size_t size)
 Accepts a received frame. More...
 
void ecdev_set_link (ec_device_t *device, uint8_t state)
 Sets a new link state. More...
 
uint8_t ecdev_get_link (const ec_device_t *device)
 Reads the link state. More...
 
ec_device_tecdev_offer (struct net_device *net_dev, ec_pollfunc_t poll, struct module *module)
 Offers an EtherCAT device to a certain master. More...
 

Detailed Description

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.

Function Documentation

◆ ecdev_withdraw()

void ecdev_withdraw ( ec_device_t device)

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
deviceEtherCAT device

Definition at line 528 of file device.c.

◆ ecdev_open()

int ecdev_open ( ec_device_t device)

Opens the network device and makes the master enter IDLE phase.

Returns
0 on success, else < 0
Parameters
deviceEtherCAT device

Definition at line 559 of file device.c.

◆ ecdev_close()

void ecdev_close ( ec_device_t device)

Makes the master leave IDLE phase and closes the network device.

Returns
0 on success, else < 0
Parameters
deviceEtherCAT device

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
deviceEtherCAT device
datapointer to received data
sizenumber 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
deviceEtherCAT device
statenew link state

Definition at line 665 of file device.c.

◆ ecdev_get_link()

uint8_t ecdev_get_link ( const ec_device_t device)

Reads the link state.

Returns
Link state.
Parameters
deviceEtherCAT device

Definition at line 691 of file device.c.

◆ ecdev_offer()

ec_device_t* ecdev_offer ( struct net_device *  net_dev,
ec_pollfunc_t  poll,
struct module *  module 
)

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_devnet_device to offer
polldevice poll function
modulepointer to the module

Definition at line 480 of file module.c.