32#include <linux/list.h>
33#include <linux/kobject.h>
56#define EC_SLAVE_INFO(slave, fmt, args...) \
57 printk(KERN_INFO "EtherCAT %u-%u: " fmt, slave->master->index, \
58 slave->ring_position, ##args)
70#define EC_SLAVE_ERR(slave, fmt, args...) \
71 printk(KERN_ERR "EtherCAT ERROR %u-%u: " fmt, slave->master->index, \
72 slave->ring_position, ##args)
84#define EC_SLAVE_WARN(slave, fmt, args...) \
85 printk(KERN_WARNING "EtherCAT WARNING %u-%u: " fmt, \
86 slave->master->index, slave->ring_position, ##args)
100#define EC_SLAVE_DBG(slave, level, fmt, args...) \
102 if (slave->master->debug_level >= level) { \
103 printk(KERN_DEBUG "EtherCAT DEBUG %u-%u: " fmt, \
104 slave->master->index, slave->ring_position, ##args); \
265 unsigned int *,
unsigned int *);
EtherCAT datagram structure.
EtherCAT slave request state machine.
struct ec_fsm_slave ec_fsm_slave_t
Global definitions and macros.
ec_slave_state_t
State of an EtherCAT slave.
ec_slave_dc_range_t
EtherCAT slave distributed clocks range.
struct ec_slave ec_slave_t
ec_device_index_t
Master devices.
ec_slave_port_desc_t
EtherCAT slave port descriptor.
#define EC_MAX_PORTS
Maximum number of slave ports.
struct ec_master ec_master_t
struct ec_slave_config ec_slave_config_t
EtherCAT Process data object structure.
EtherCAT CANopen SDO structure.
EtherCAT SII/Eeprom memory contents.
struct ec_sii_page ec_sii_page_t
Slave information interface memory page.
void ec_slave_calc_port_delays(ec_slave_t *slave)
Calculates the port transmission delays.
void ec_slave_request_state(ec_slave_t *slave, ec_slave_state_t state)
Request a slave state and resets the error flag.
const ec_pdo_t * ec_slave_find_pdo(const ec_slave_t *slave, uint16_t index)
Finds a mapped PDO.
const ec_sdo_t * ec_slave_get_sdo_const(const ec_slave_t *slave, uint16_t index)
Get an SDO from the dictionary.
int ec_slave_analyze_sii_data(ec_slave_t *slave)
Analyzes SII data.
void ec_slave_clear(ec_slave_t *slave)
Slave destructor.
void ec_slave_clear_sync_managers(ec_slave_t *slave)
Clear the sync manager array.
ec_sync_t * ec_slave_get_sync(ec_slave_t *slave, uint8_t sync_index)
Get the sync manager given an index.
void ec_slave_attach_pdo_names(ec_slave_t *slave)
Attach PDO names.
ec_sdo_t * ec_slave_get_sdo(ec_slave_t *slave, uint16_t index)
Get an SDO from the dictionary.
void ec_slave_calc_transmission_delays_rec(ec_slave_t *slave, ec_slave_t *came_from, uint32_t *delay)
Recursively calculates transmission delays.
void ec_slave_set_state(ec_slave_t *slave, ec_slave_state_t new_state)
Sets the application state of a slave.
void ec_slave_sdo_dict_info(const ec_slave_t *slave, unsigned int *sdo_count, unsigned int *entry_count)
Counts the total number of SDOs and entries in the dictionary.
int ec_read_mbox_locked(ec_slave_t *slave)
Return the current mailbox lock status and lock it if not locked.
void ec_read_mbox_lock_clear(ec_slave_t *slave)
Clears the mailbox lock.
void ec_slave_init(ec_slave_t *slave, ec_master_t *master, ec_device_index_t dev_idx, uint16_t ring_position, uint16_t station_address)
Slave constructor.
uint16_t ec_slave_sdo_count(const ec_slave_t *slave)
Get the number of SDOs in the dictionary.
const ec_sdo_t * ec_slave_get_sdo_by_pos_const(const ec_slave_t *slave, uint16_t sdo_position)
Get an SDO from the dictionary, given its position in the list.
EtherCAT mailbox response data.
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.
struct list_head pdos
SII [RT]XPDO 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 tx 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 rx mailbox address.
unsigned int has_general
General category present.
uint32_t vendor_id
Vendor ID.
unsigned int sync_count
Number of sync managers.
uint8_t physical_layer[EC_MAX_PORTS]
Port media.
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.
ec_sii_page_t sii_page
The SII contents, either fetched or taken from the cache.
unsigned int force_config
Force (re-)configuration.
ec_slave_port_t ports[EC_MAX_PORTS]
Ports.
unsigned int sii_parallel_words
How many SII words the slave can read at once.
uint32_t transmission_delay
DC system time transmission delay (offset from reference clock).
ec_mbox_data_t mbox_voe_data
Received mailbox data for VoE.
ec_mbox_data_t mbox_soe_data
Received mailbox data for SoE.
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 requests.
unsigned long read_mbox_busy
Bit 0 is set during a mailbox read request.
uint8_t base_fmmu_bit_operation
FMMU bit operation is supported.
ec_mbox_data_t mbox_foe_data
Received mailbox data for FoE.
ec_mbox_data_t mbox_eoe_data
Received mailbox data for EoE.
uint8_t base_fmmu_count
Number of supported FMMUs.
uint8_t base_revision
Revision.
ec_mbox_data_t mbox_coe_data
Received mailbox data for CoE.
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.
uint8_t valid_mbox_data
Received mailbox data is valid.
struct list_head eoe_requests
EoE set IP parameter requests.
struct list_head sdo_requests
SDO access requests.
uint16_t configured_tx_mailbox_size
Configured send mailbox size.
struct list_head soe_requests
SoE 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.
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.