40#ifndef LIBETHERCAT_HW_H
41#define LIBETHERCAT_HW_H
43#include <libosal/task.h>
44#include <libosal/types.h>
45#include <libosal/mutex.h>
47#include <libethercat/config.h>
51#if LIBETHERCAT_BUILD_DEVICE_PIKEOS == 1
52#include <vm_file_types.h>
53#include <drv/sbuf_hdr.h>
56#define container_of(ptr, type, member) ({ \
57 __typeof__( ((type *)0)->member ) *__mptr = (void *)(ptr); \
58 (type *)( (char *)__mptr - offsetof(type,member) );})
67#define ETH_P_ECAT (0x88A4)
120#define ETH_FRAME_LEN 0x1518
void hw_process_rx_frame(struct hw_common *phw, ec_frame_t *pframe)
Process a received EtherCAT frame.
int(* hw_device_get_tx_buffer_t)(struct hw_common *phw, ec_frame_t **ppframe)
Get a free tx buffer from underlying hw device.
Definition hw.h:110
int hw_tx(struct hw_common *phw)
start sending queued ethercat datagrams
int hw_tx_low(struct hw_common *phw)
start sending queued ethercat datagrams
int hw_close(struct hw_common *phw)
destroys a hw
int(* hw_device_send_t)(struct hw_common *phw, ec_frame_t *pframe, pooltype_t pool_type)
Send a frame from an EtherCAT hw device.
Definition hw.h:95
pooltype
Flag to distinguish the pool types during processing.
Definition hw.h:74
int(* hw_device_close_t)(struct hw_common *phw)
Close hardware layer.
Definition hw.h:118
enum pooltype pooltype_t
Flag to distinguish the pool types during processing.
void(* hw_device_send_finished_t)(struct hw_common *phw)
Doing internal stuff when finished sending frames.
Definition hw.h:101
int hw_open(struct hw_common *phw, struct ec *pec)
open a new hw
struct hw_common hw_common_t
hardware structure
int(* hw_device_recv_t)(struct hw_common *phw)
Receive a frame from an EtherCAT hw device.
Definition hw.h:85
Data pool implementation.
ethercat master structure
Definition ec.h:188
struct hw_common * phw
pointer to hardware interface
Definition ec.h:189
hardware structure
Definition hw.h:123
pool_entry_t * tx_send[256]
sent datagrams
Definition hw.h:132
pool_t tx_low
low priority datagrams
Definition hw.h:130
osal_mutex_t hw_lock
transmit lock
Definition hw.h:127
hw_device_send_t send
Function to send frames via device.
Definition hw.h:139
osal_uint32_t mtu_size
mtu size
Definition hw.h:126
osal_size_t bytes_last_sent
Bytes last sent.
Definition hw.h:135
osal_timer_t next_cylce_start
Next cycle start time.
Definition hw.h:136
hw_device_close_t close
Function to close hw layer.
Definition hw.h:142
pool_t tx_high
high priority datagrams
Definition hw.h:129
struct ec * pec
Pointer to EtherCAT master structure.
Definition hw.h:124
osal_size_t bytes_sent
Bytes currently sent.
Definition hw.h:134
hw_device_get_tx_buffer_t get_tx_buffer
Function to retreave next TX buffer.
Definition hw.h:141
hw_device_recv_t recv
\biref Function to receive frame from device.
Definition hw.h:138
hw_device_send_finished_t send_finished
Function to be called after frames were sent.
Definition hw.h:140
Pool queue entry.
Definition pool.h:67
the datagram pool itself
Definition pool.h:81