libethercat - an embeddable realtime EtherCAT-master library
Communicate with EtherCAT slaves attached to a Network interface.
Loading...
Searching...
No Matches
Ethernet over Ethercat (EoE)

Data Structures

struct  ec_eoe_slave_config
 
struct  ec_eoe
 

Macros

#define LEC_EOE_MAC_LEN   (6u)
 
#define LEC_EOE_IP_ADDRESS_LEN   (4u)
 
#define LEC_EOE_SUBNET_LEN   (4u)
 
#define LEC_EOE_GATEWAY_LEN   (4u)
 
#define LEC_EOE_DNS_LEN   (4u)
 
#define LEC_EOE_DNS_NAME_LEN   (128u)
 

Typedefs

typedef struct ec_eoe_slave_config ec_eoe_slave_config_t
 
typedef struct ec_eoe ec_eoe_t
 

Functions

void ec_eoe_init (ec_t *pec, osal_uint16_t slave)
 initialize EoE structure
 
void ec_eoe_deinit (ec_t *pec, osal_uint16_t slave)
 deinitialize EoE structure
 
void ec_eoe_enqueue (ec_t *pec, osal_uint16_t slave, pool_entry_t *p_entry)
 Enqueue EoE message received from slave.
 
int ec_eoe_set_ip_parameter (ec_t *pec, osal_uint16_t slave, osal_uint8_t *mac, osal_uint8_t *ip_address, osal_uint8_t *subnet, osal_uint8_t *gateway, osal_uint8_t *dns, osal_char_t *dns_name)
 Set IP parameters to slave with EoE support.
 
int ec_eoe_send_frame (ec_t *pec, osal_uint16_t slave, osal_uint8_t *frame, osal_size_t frame_len)
 
int ec_eoe_setup_tun (ec_t *pec)
 
void ec_eoe_destroy_tun (ec_t *pec)
 

Variables

int ec_eoe_slave_config::use_eoe
 Using EoE on actual slave.
 
osal_uint8_t ec_eoe_slave_config::mac [LEC_EOE_MAC_LEN]
 MAC address to configure (mandatory)
 
osal_uint8_t ec_eoe_slave_config::ip_address [LEC_EOE_IP_ADDRESS_LEN]
 IP address to configure (optional, maybe NULL).
 
osal_uint8_t ec_eoe_slave_config::subnet [LEC_EOE_SUBNET_LEN]
 Subnet to configure (optional, maybe NULL).
 
osal_uint8_t ec_eoe_slave_config::gateway [LEC_EOE_GATEWAY_LEN]
 Gateway to configure (optional, maybe NULL).
 
osal_uint8_t ec_eoe_slave_config::dns [LEC_EOE_DNS_LEN]
 DNS to configure (optional, maybe NULL).
 
osal_char_t ec_eoe_slave_config::dns_name [LEC_EOE_DNS_NAME_LEN]
 DNS name to configure (optional, maybe NULL).
 
pool_t ec_eoe::recv_pool
 Mailbox message with EoE fragments received.
 
pool_t ec_eoe::response_pool
 
pool_entry_t ec_eoe::free_frames [128]
 Static Ethernet frames for Pool, do not use directly.
 
pool_t ec_eoe::eth_frames_free_pool
 Pool with Ethernet frames currently unused.
 
pool_t ec_eoe::eth_frames_recv_pool
 Pool where to store Ethernet frames nobody cared so far.
 
osal_mutex_t ec_eoe::lock
 
osal_semaphore_t ec_eoe::send_sync
 

Detailed Description

This modules contains functions on how to communicate via Ethernet over EtherCAT mailbox.

Function Documentation

◆ ec_eoe_deinit()

void ec_eoe_deinit ( ec_t pec,
osal_uint16_t  slave 
)

deinitialize EoE structure

Parameters
[in]pecPointer to ethercat master structure, which you got from ec_open.
[in]slaveNumber of ethercat slave. this depends on the physical order of the ethercat slaves (usually the n'th slave attached).

◆ ec_eoe_destroy_tun()

void ec_eoe_destroy_tun ( ec_t pec)
Parameters
[in]pecPointer to ethercat master structure, which you got from ec_open.

◆ ec_eoe_enqueue()

void ec_eoe_enqueue ( ec_t pec,
osal_uint16_t  slave,
pool_entry_t p_entry 
)

Enqueue EoE message received from slave.

Parameters
[in]pecPointer to ethercat master structure, which you got from ec_open.
[in]slaveNumber of ethercat slave. this depends on the physical order of the ethercat slaves (usually the n'th slave attached).
[in]p_entryPointer to pool entry containing received mailbox message from slave.

◆ ec_eoe_init()

void ec_eoe_init ( ec_t pec,
osal_uint16_t  slave 
)

initialize EoE structure

Parameters
[in]pecPointer to ethercat master structure, which you got from ec_open.
[in]slaveNumber of ethercat slave. this depends on the physical order of the ethercat slaves (usually the n'th slave attached).

◆ ec_eoe_send_frame()

int ec_eoe_send_frame ( ec_t pec,
osal_uint16_t  slave,
osal_uint8_t *  frame,
osal_size_t  frame_len 
)
Parameters
[in]pecPointer to ethercat master structure, which you got from ec_open.
[in]slaveNumber of ethercat slave. this depends on the physical order of the ethercat slaves (usually the n'th slave attached).
[in]frameEthernet frame buffer to be sent.
[in]frame_lenLength of Ethernet frame buffer.
Return values
EC_OKEoE transfer was successfull.
EC_ERROR_MAILBOX_NOT_SUPPORTED_EOENo EoE support on slave's mailbox.
EC_ERROR_MAILBOX_TIMEOUTGot timeout waiting for message.

◆ ec_eoe_set_ip_parameter()

int ec_eoe_set_ip_parameter ( ec_t pec,
osal_uint16_t  slave,
osal_uint8_t *  mac,
osal_uint8_t *  ip_address,
osal_uint8_t *  subnet,
osal_uint8_t *  gateway,
osal_uint8_t *  dns,
osal_char_t *  dns_name 
)

Set IP parameters to slave with EoE support.

Parameters
[in]pecPointer to ethercat master structure, which you got from ec_open.
[in]slaveNumber of ethercat slave. this depends on the physical order of the ethercat slaves (usually the n'th slave attached).
[in]macMAC address to be set (6 byte) or NULL.
[in]ip_addressIP address to be set (4 byte) or NULL.
[in]subnetSubnet mask to be set (4 byte) or NULL.
[in]gatewayDefault gateway ip address (4 byte) or NULL.
[in]dnsNameserver to set (4 byte) or NULL.
[in]dns_nameHostname to be set (null-teminating) or NULL.
Return values
EC_OKEoE transfer was successfull.
EC_ERROR_MAILBOX_OUT_OF_SEND_BUFFERSNo more free send buffer available.
EC_ERROR_MAILBOX_NOT_SUPPORTED_EOENo EoE support on slave's mailbox.
EC_ERROR_MAILBOX_TIMEOUTGot timeout waiting for message.

◆ ec_eoe_setup_tun()

int ec_eoe_setup_tun ( ec_t pec)
Parameters
[in]pecPointer to ethercat master structure, which you got from ec_open.
Return values
EC_OKEoE transfer was successfull.
EC_ERROR_UNAVAILABLESetting up tun failed for some reason.