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