37 #ifndef __EC_DEVICE_H__ 38 #define __EC_DEVICE_H__ 40 #include <linux/interrupt.h> 42 #include "../devices/ecdev.h" 51 #define EC_TX_RING_SIZE 2 58 #define EC_DEBUG_RING_SIZE 10 62 } ec_debug_frame_dir_t;
65 ec_debug_frame_dir_t dir;
68 unsigned int data_size;
84 struct net_device *
dev;
95 struct timeval timeval_poll;
126 ec_debug_frame_t debug_frames[EC_DEBUG_RING_SIZE];
127 unsigned int debug_frame_index;
128 unsigned int debug_frame_count;
151 void ec_device_debug_ring_append(
ec_device_t *, ec_debug_frame_dir_t,
152 const void *,
size_t);
153 void ec_device_debug_ring_print(
const ec_device_t *);
struct sk_buff * tx_skb[EC_TX_RING_SIZE]
transmit skb ring
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
s32 tx_frame_rates[EC_RATE_COUNT]
Transmit rates in frames/s for different statistics cycle periods.
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.
s32 rx_frame_rates[EC_RATE_COUNT]
Receive rates in frames/s for different statistics cycle periods.
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.
s32 rx_byte_rates[EC_RATE_COUNT]
Receive rates in byte/s for different statistics cycle periods.
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.
s32 tx_byte_rates[EC_RATE_COUNT]
Transmit rates in byte/s for different statistics cycle periods.
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.