40#include <linux/list.h>
41#include <linux/kobject.h>
62#define EC_SLAVE_INFO(slave, fmt, args...) \
63 printk(KERN_INFO "EtherCAT %u-%u: " fmt, slave->master->index, \
64 slave->ring_position, ##args)
76#define EC_SLAVE_ERR(slave, fmt, args...) \
77 printk(KERN_ERR "EtherCAT ERROR %u-%u: " fmt, slave->master->index, \
78 slave->ring_position, ##args)
90#define EC_SLAVE_WARN(slave, fmt, args...) \
91 printk(KERN_WARNING "EtherCAT WARNING %u-%u: " fmt, \
92 slave->master->index, slave->ring_position, ##args)
106#define EC_SLAVE_DBG(slave, level, fmt, args...) \
108 if (slave->master->debug_level >= level) { \
109 printk(KERN_DEBUG "EtherCAT DEBUG %u-%u: " fmt, \
110 slave->master->index, slave->ring_position, ##args); \
169 struct list_head pdos;
260 unsigned int *,
unsigned int *);
EtherCAT datagram structure.
EtherCAT slave request state machine.
Global definitions and macros.
ec_slave_state_t
State of an EtherCAT slave.
ec_slave_dc_range_t
EtherCAT slave distributed clocks range.
ec_device_index_t
Master devices.
ec_slave_port_desc_t
EtherCAT slave port descriptor.
#define EC_MAX_PORTS
Maximum number of slave ports.
ec_direction_t
Direction type for PDO assignment functions.
EtherCAT Process data object structure.
EtherCAT CANopen SDO structure.
int ec_slave_fetch_sii_pdos(ec_slave_t *, const uint8_t *, size_t, ec_direction_t)
Fetches data from a [RT]xPDO category.
void ec_slave_attach_pdo_names(ec_slave_t *)
Attach PDO names.
uint16_t ec_slave_sdo_count(const ec_slave_t *)
Get the number of SDOs in the dictionary.
int ec_slave_fetch_sii_syncs(ec_slave_t *, const uint8_t *, size_t)
Fetches data from a SYNC MANAGER category.
const ec_pdo_t * ec_slave_find_pdo(const ec_slave_t *, uint16_t)
Finds a mapped PDO.
const ec_sdo_t * ec_slave_get_sdo_const(const ec_slave_t *, uint16_t)
Get an SDO from the dictionary.
ec_sdo_t * ec_slave_get_sdo(ec_slave_t *, uint16_t)
Get an SDO from the dictionary.
void ec_slave_init(ec_slave_t *, ec_master_t *, ec_device_index_t, uint16_t, uint16_t)
Slave constructor.
void ec_slave_sdo_dict_info(const ec_slave_t *, unsigned int *, unsigned int *)
Counts the total number of SDOs and entries in the dictionary.
void ec_slave_clear_sync_managers(ec_slave_t *)
Clear the sync manager array.
void ec_slave_request_state(ec_slave_t *, ec_slave_state_t)
Request a slave state and resets the error flag.
int ec_slave_fetch_sii_strings(ec_slave_t *, const uint8_t *, size_t)
Fetches data from a STRING category.
void ec_slave_calc_transmission_delays_rec(ec_slave_t *, uint32_t *)
Recursively calculates transmission delays.
void ec_slave_set_state(ec_slave_t *, ec_slave_state_t)
Sets the application state of a slave.
int ec_slave_fetch_sii_general(ec_slave_t *, const uint8_t *, size_t)
Fetches data from a GENERAL category.
void ec_slave_calc_port_delays(ec_slave_t *)
Calculates the port transmission delays.
void ec_slave_clear(ec_slave_t *)
Slave destructor.
const ec_sdo_t * ec_slave_get_sdo_by_pos_const(const ec_slave_t *, uint16_t)
Get an SDO from the dictionary, given its position in the list.
ec_sync_t * ec_slave_get_sync(ec_slave_t *, uint8_t)
Get the sync manager given an index.
Finite state machine of an EtherCAT slave.
Slave information interface CANopen over EtherCAT details flags.
Slave information interface general flags.
Slave information interface data.
uint16_t std_rx_mailbox_offset
Standard receive mailbox address.
ec_sync_t * syncs
SYNC MANAGER categories.
uint16_t alias
Configured station alias.
char * order
Order number.
uint32_t serial_number
Serial number.
uint16_t std_tx_mailbox_size
Standard transmit mailbox size.
unsigned int string_count
Number of SII strings.
uint16_t boot_tx_mailbox_size
Bootstrap transmit mailbox size.
int16_t current_on_ebus
Power consumption in mA.
uint32_t product_code
Vendor-specific product code.
char ** strings
Strings in SII categories.
uint16_t mailbox_protocols
Supported mailbox protocols.
ec_sii_coe_details_t coe_details
CoE detail flags.
ec_sii_general_flags_t general_flags
General flags.
uint16_t boot_tx_mailbox_offset
Bootstrap transmit mailbox address.
uint16_t std_tx_mailbox_offset
Standard transmit mailbox address.
uint16_t boot_rx_mailbox_size
Bootstrap receive mailbox size.
uint32_t revision_number
Revision number.
uint16_t std_rx_mailbox_size
Standard receive mailbox size.
uint16_t boot_rx_mailbox_offset
Bootstrap receive mailbox address.
unsigned int has_general
General category present.
uint32_t vendor_id
Vendor ID.
unsigned int sync_count
Number of sync managers.
EtherCAT slave configuration.
EtherCAT slave port information.
uint32_t receive_time
Port receive times for delay measurement.
ec_slave_t * next_slave
Connected slaves.
ec_slave_port_link_t link
Port link status.
uint32_t delay_to_next_dc
Delay to next slave with DC support behind this port [ns].
ec_slave_port_desc_t desc
Port descriptors.
uint16_t configured_rx_mailbox_size
Configured receive mailbox size.
ec_sii_t sii
Extracted SII data.
unsigned int force_config
Force (re-)configuration.
ec_slave_port_t ports[EC_MAX_PORTS]
Ports.
uint32_t transmission_delay
DC system time transmission delay (offset from reference clock).
struct list_head sdo_dictionary
SDO dictionary list.
uint8_t base_dc_supported
Distributed clocks are supported.
uint16_t ring_position
Ring position.
ec_slave_config_t * config
Current configuration.
uint16_t configured_tx_mailbox_offset
Configured send mailbox offset.
struct list_head foe_requests
FoE write requests.
uint16_t * sii_words
Complete SII image.
uint8_t base_fmmu_bit_operation
FMMU bit operation is supported.
uint8_t base_fmmu_count
Number of supported FMMUs.
uint8_t base_revision
Revision.
struct list_head reg_requests
Register access requests.
ec_slave_state_t current_state
Current application state.
uint8_t has_dc_system_time
The slave supports the DC system time register.
struct list_head sdo_requests
SDO access requests.
uint16_t configured_tx_mailbox_size
Configured send mailbox size.
struct list_head soe_requests
SoE write requests.
uint16_t configured_rx_mailbox_offset
Configured receive mailbox offset.
ec_slave_dc_range_t base_dc_range
DC range.
uint8_t base_type
Slave type.
uint8_t sdo_dictionary_fetched
Dictionary has been fetched.
uint16_t effective_alias
Effective alias address.
size_t sii_nwords
Size of the SII contents in words.
uint8_t base_sync_count
Number of supported sync managers.
ec_device_index_t device_index
Index of device the slave responds on.
ec_master_t * master
Master owning the slave.
uint16_t station_address
Configured station address.
ec_fsm_slave_t fsm
Slave state machine.
unsigned int error_flag
Stop processing after an error.
unsigned long jiffies_preop
Time, the slave went to PREOP.
ec_slave_state_t requested_state
Requested application state.
uint16_t base_build
Build number.