37 #ifndef __EC_DEVICE_H__ 38 #define __EC_DEVICE_H__ 40 #include <linux/interrupt.h> 41 #include <linux/version.h> 43 #include "../devices/ecdev.h" 52 #define EC_TX_RING_SIZE 0x10 58 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) 60 __kernel_old_time_t tv_sec;
61 __kernel_suseconds_t tv_usec;
67 #define EC_DEBUG_RING_SIZE 10 71 } ec_debug_frame_dir_t;
74 ec_debug_frame_dir_t dir;
77 unsigned int data_size;
93 struct net_device *
dev;
100 #ifdef EC_HAVE_CYCLES 101 cycles_t cycles_poll;
103 #if defined(EC_DEBUG_RING) || !defined(EC_RTDM) 135 ec_debug_frame_t debug_frames[EC_DEBUG_RING_SIZE];
136 unsigned int debug_frame_index;
137 unsigned int debug_frame_count;
189 void ec_device_debug_ring_append(
ec_device_t *, ec_debug_frame_dir_t,
190 const void *,
size_t);
191 void ec_device_debug_ring_print(
const ec_device_t *);
void ec_device_attach(ec_device_t *, struct net_device *, ec_pollfunc_t, struct module *)
Associate with net_device.
ec_pollfunc_t poll
pointer to the device's poll function
unsigned long jiffies_poll
jiffies of last poll
Network interface for debugging purposes.
u64 last_tx_count
Number of frames sent of last statistics cycle.
#define EC_RATE_COUNT
Number of statistic rate intervals to maintain.
uint8_t * ec_device_tx_data(ec_device_t *)
Returns a pointer to the device's transmit memory.
struct module * module
pointer to the device's owning module
Debugging network interface.
uint8_t link_state
device link state
u64 rx_count
Number of frames received.
u64 last_tx_bytes
Number of bytes sent of last statistics cycle.
Global definitions and macros.
void ec_device_detach(ec_device_t *)
Disconnect from net_device.
#define EC_TX_RING_SIZE
Size of the transmit ring.
u64 last_rx_count
Number of frames received of last statistics cycle.
void(* ec_pollfunc_t)(struct net_device *)
Device poll function type.
unsigned int tx_ring_index
last ring entry used to transmit
void ec_device_poll(ec_device_t *)
Calls the poll function of the assigned net_device.
void ec_device_clear_stats(ec_device_t *)
Clears the frame statistics.
ec_master_t * master
EtherCAT master.
u64 rx_bytes
Number of bytes received.
u64 tx_count
Number of frames sent.
int ec_device_init(ec_device_t *, ec_master_t *)
Constructor.
uint8_t open
true, if the net_device has been opened
u64 tx_errors
Number of transmit errors.
u64 last_rx_bytes
Number of bytes received of last statistics cycle.
void ec_device_update_stats(ec_device_t *)
Update device statistics.
void ec_device_clear(ec_device_t *)
Destructor.
void ec_device_send(ec_device_t *, size_t)
Sends the content of the transmit socket buffer.
int ec_device_open(ec_device_t *)
Opens the EtherCAT device.
int ec_device_close(ec_device_t *)
Stops the EtherCAT device.
struct net_device * dev
pointer to the assigned net_device
u64 tx_bytes
Number of bytes sent.
#define EC_MAX_DATA_SIZE
Resulting maximum data size of a single datagram in a frame.