37 #ifndef __EC_DATAGRAM_H__ 38 #define __EC_DATAGRAM_H__ 40 #include <linux/list.h> 41 #include <linux/time.h> 42 #include <linux/timex.h> 88 struct list_head queue;
89 struct list_head sent;
101 #ifdef EC_HAVE_CYCLES 102 cycles_t cycles_sent;
105 #ifdef EC_HAVE_CYCLES 106 cycles_t cycles_received;
unsigned long jiffies_sent
Jiffies, when the datagram was sent.
Auto Increment Physical Read Multiple Write.
#define EC_ADDR_LEN
Size of the EtherCAT address field.
#define EC_DATAGRAM_NAME_SIZE
Size of the datagram description string.
int ec_datagram_fprd(ec_datagram_t *, uint16_t, uint16_t, size_t)
Initializes an EtherCAT FPRD datagram.
Auto Increment Physical ReadWrite.
size_t data_size
Size of the data in data.
int ec_datagram_lrw_ext(ec_datagram_t *, uint32_t, size_t, uint8_t *)
Initializes an EtherCAT LRW datagram with external memory.
unsigned long stats_output_jiffies
Last statistics output.
ec_origin_t data_origin
Origin of the data memory.
uint16_t working_counter
Working counter.
Sent (still in the queue).
Configured Address Physical Read.
int ec_datagram_prealloc(ec_datagram_t *, size_t)
Allocates internal payload memory.
ec_datagram_type_t type
Datagram type (APRD, BWR, etc.).
Global definitions and macros.
Initial state of a new datagram.
void ec_datagram_clear(ec_datagram_t *)
Destructor.
int ec_datagram_aprd(ec_datagram_t *, uint16_t, uint16_t, size_t)
Initializes an EtherCAT APRD datagram.
void ec_datagram_zero(ec_datagram_t *)
Fills the datagram payload memory with zeros.
ec_datagram_state_t state
State.
void ec_datagram_print_state(const ec_datagram_t *)
Prints the state of a datagram.
const char * ec_datagram_type_string(const ec_datagram_t *)
Returns a string describing the datagram type.
ec_device_index_t
Master devices.
int ec_datagram_lwr(ec_datagram_t *, uint32_t, size_t)
Initializes an EtherCAT LWR datagram.
int ec_datagram_bwr(ec_datagram_t *, uint16_t, size_t)
Initializes an EtherCAT BWR datagram.
unsigned int skip_count
Number of requeues when not yet received.
int ec_datagram_armw(ec_datagram_t *, uint16_t, uint16_t, size_t)
Initializes an EtherCAT ARMW datagram.
ec_datagram_state_t
EtherCAT datagram state.
Auto Increment Physical Read.
int ec_datagram_lrw(ec_datagram_t *, uint32_t, size_t)
Initializes an EtherCAT LRW datagram.
int ec_datagram_fprw(ec_datagram_t *, uint16_t, uint16_t, size_t)
Initializes an EtherCAT FPRW datagram.
int ec_datagram_lwr_ext(ec_datagram_t *, uint32_t, size_t, uint8_t *)
Initializes an EtherCAT LWR datagram with external memory.
ec_device_index_t device_index
Device via which the datagram shall be / was sent.
void ec_datagram_unqueue(ec_datagram_t *)
Unqueue datagram.
Configured Address Physical Read Multiple Write.
int ec_datagram_brw(ec_datagram_t *, uint16_t, size_t)
Initializes an EtherCAT BRW datagram.
int ec_datagram_frmw(ec_datagram_t *, uint16_t, uint16_t, size_t)
Initializes an EtherCAT FRMW datagram.
int ec_datagram_lrd_ext(ec_datagram_t *, uint32_t, size_t, uint8_t *)
Initializes an EtherCAT LRD datagram with external memory.
uint8_t * data
Datagram payload.
Configured Address Physical ReadWrite.
void ec_datagram_print_wc_error(const ec_datagram_t *)
Evaluates the working counter of a single-cast datagram.
int ec_datagram_brd(ec_datagram_t *, uint16_t, size_t)
Initializes an EtherCAT BRD datagram.
int ec_datagram_apwr(ec_datagram_t *, uint16_t, uint16_t, size_t)
Initializes an EtherCAT APWR datagram.
int ec_datagram_lrd(ec_datagram_t *, uint32_t, size_t)
Initializes an EtherCAT LRD datagram.
size_t mem_size
Datagram data memory size.
Error while sending/receiving (dequeued).
Auto Increment Physical Write.
void ec_datagram_output_stats(ec_datagram_t *)
Outputs datagram statistics at most every second.
ec_datagram_type_t
EtherCAT datagram type.
Configured Address Physical Write.
uint8_t index
Index (set by master).
unsigned long jiffies_received
Jiffies, when the datagram was received.
void ec_datagram_init(ec_datagram_t *)
Constructor.
int ec_datagram_fpwr(ec_datagram_t *, uint16_t, uint16_t, size_t)
Initializes an EtherCAT FPWR datagram.
int ec_datagram_aprw(ec_datagram_t *, uint16_t, uint16_t, size_t)
Initializes an EtherCAT APRW datagram.