152 #include <asm/byteorder.h> 153 #include <linux/types.h> 154 #include <linux/time.h> 155 #include <linux/in.h> 159 #include <sys/time.h> 160 #include <netinet/in.h> 169 #define ECRT_VER_MAJOR 1 173 #define ECRT_VER_MINOR 6 177 #define ECRT_VERSION(a, b) (((a) << 8) + (b)) 181 #define ECRT_VERSION_MAGIC ECRT_VERSION(ECRT_VER_MAJOR, ECRT_VER_MINOR) 192 #define EC_HAVE_REDUNDANCY 198 #define EC_HAVE_EMERGENCY 206 #define EC_HAVE_REG_ACCESS 210 #define EC_HAVE_SELECT_REF_CLOCK 214 #define EC_HAVE_REF_CLOCK_TIME 218 #define EC_HAVE_REG_BY_POS 222 #define EC_HAVE_SYNC_TO 226 #define EC_HAVE_FLAGS 234 #define EC_HAVE_SOE_REQUESTS 239 #define EC_HAVE_SCAN_PROGRESS 247 #define EC_HAVE_SET_IP 251 #define EC_HAVE_STATE_TIMEOUT 256 #define EC_HAVE_SII_CACHING 261 #define EC_HAVE_PDO_MODE 267 #ifndef EC_PUBLIC_API 268 # if defined(ethercat_EXPORTS) && !defined(__KERNEL__) 269 # define EC_PUBLIC_API __attribute__ ((visibility ("default"))) 271 # define EC_PUBLIC_API 285 #define EC_MAX_SYNC_MANAGERS 16 291 #define EC_MAX_STRING_LENGTH 64 294 #define EC_MAX_PORTS 4 304 #define EC_TIMEVAL2NANO(TV) \ 305 (((TV).tv_sec - 946684800ULL) * 1000000000ULL + (TV).tv_usec * 1000ULL) 311 #define EC_COE_EMERGENCY_MSG_SIZE 8 575 #define EC_PDO_MODE_DEFAULT EC_PDO_MODE_READ_WRITE 683 EC_SII_DISABLE_CACHING = 0,
725 unsigned int master_index
744 unsigned int master_index
747 #endif // #ifndef __KERNEL__ 784 #endif // #ifndef __KERNEL__ 809 void (*send_cb)(
void *),
810 void (*receive_cb)(
void *),
872 uint32_t product_code
937 uint16_t slave_position,
956 uint16_t slave_position,
975 uint16_t slave_position,
993 uint16_t slave_position,
1016 uint16_t slave_position,
1019 const uint8_t *data,
1021 uint32_t *abort_code
1038 uint16_t slave_position,
1040 const uint8_t *data,
1042 uint32_t *abort_code
1058 uint16_t slave_position,
1063 size_t *result_size,
1064 uint32_t *abort_code
1079 uint16_t slave_position,
1082 const uint8_t *data,
1084 uint16_t *error_code
1100 uint16_t slave_position,
1106 size_t *result_size,
1107 uint16_t *error_code
1167 size_t send_interval
1246 unsigned int dev_idx,
1480 uint16_t watchdog_divider,
1485 uint16_t watchdog_intervals
1593 uint16_t entry_index,
1595 uint8_t entry_subindex,
1597 uint8_t entry_bit_length
1693 unsigned int n_syncs,
1721 uint16_t entry_index,
1722 uint8_t entry_subindex,
1724 unsigned int *bit_position
1746 unsigned int pdo_pos,
1747 unsigned int entry_pos,
1749 unsigned int *bit_position
1772 uint16_t assign_activate,
1773 uint32_t sync0_cycle,
1774 int32_t sync0_shift,
1775 uint32_t sync1_cycle,
1810 const uint8_t *data,
1829 uint8_t sdo_subindex,
1848 uint8_t sdo_subindex,
1867 uint8_t sdo_subindex,
1889 const uint8_t *data,
2097 const uint8_t *data,
2146 const unsigned char *mac_address
2184 struct in_addr ip_address
2208 struct in_addr subnet_mask
2232 struct in_addr gateway_address
2257 struct in_addr dns_address
2301 unsigned int timeout_ms
2753 uint16_t vendor_type
2773 uint32_t *vendor_id,
2774 uint16_t *vendor_type
3014 #define EC_READ_BIT(DATA, POS) ((*((uint8_t *) (DATA)) >> (POS)) & 0x01) 3022 #define EC_WRITE_BIT(DATA, POS, VAL) \ 3024 if (VAL) *((uint8_t *) (DATA)) |= (1 << (POS)); \ 3025 else *((uint8_t *) (DATA)) &= ~(1 << (POS)); \ 3034 #if __BYTE_ORDER == __LITTLE_ENDIAN 3036 #define le16_to_cpu(x) x 3037 #define le32_to_cpu(x) x 3038 #define le64_to_cpu(x) x 3040 #define cpu_to_le16(x) x 3041 #define cpu_to_le32(x) x 3042 #define cpu_to_le64(x) x 3044 #elif __BYTE_ORDER == __BIG_ENDIAN 3048 (((uint16_t)(x) & 0x00ffU) << 8) | \ 3049 (((uint16_t)(x) & 0xff00U) >> 8) )) 3052 (((uint32_t)(x) & 0x000000ffUL) << 24) | \ 3053 (((uint32_t)(x) & 0x0000ff00UL) << 8) | \ 3054 (((uint32_t)(x) & 0x00ff0000UL) >> 8) | \ 3055 (((uint32_t)(x) & 0xff000000UL) >> 24) )) 3058 (((uint64_t)(x) & 0x00000000000000ffULL) << 56) | \ 3059 (((uint64_t)(x) & 0x000000000000ff00ULL) << 40) | \ 3060 (((uint64_t)(x) & 0x0000000000ff0000ULL) << 24) | \ 3061 (((uint64_t)(x) & 0x00000000ff000000ULL) << 8) | \ 3062 (((uint64_t)(x) & 0x000000ff00000000ULL) >> 8) | \ 3063 (((uint64_t)(x) & 0x0000ff0000000000ULL) >> 24) | \ 3064 (((uint64_t)(x) & 0x00ff000000000000ULL) >> 40) | \ 3065 (((uint64_t)(x) & 0xff00000000000000ULL) >> 56) )) 3067 #define le16_to_cpu(x) swap16(x) 3068 #define le32_to_cpu(x) swap32(x) 3069 #define le64_to_cpu(x) swap64(x) 3071 #define cpu_to_le16(x) swap16(x) 3072 #define cpu_to_le32(x) swap32(x) 3073 #define cpu_to_le64(x) swap64(x) 3077 #define le16_to_cpup(x) le16_to_cpu(*((uint16_t *)(x))) 3078 #define le32_to_cpup(x) le32_to_cpu(*((uint32_t *)(x))) 3079 #define le64_to_cpup(x) le64_to_cpu(*((uint64_t *)(x))) 3091 #define EC_READ_U8(DATA) \ 3092 ((uint8_t) *((uint8_t *) (DATA))) 3099 #define EC_READ_S8(DATA) \ 3100 ((int8_t) *((uint8_t *) (DATA))) 3107 #define EC_READ_U16(DATA) \ 3108 ((uint16_t) le16_to_cpup((void *) (DATA))) 3115 #define EC_READ_S16(DATA) \ 3116 ((int16_t) le16_to_cpup((void *) (DATA))) 3123 #define EC_READ_U32(DATA) \ 3124 ((uint32_t) le32_to_cpup((void *) (DATA))) 3131 #define EC_READ_S32(DATA) \ 3132 ((int32_t) le32_to_cpup((void *) (DATA))) 3139 #define EC_READ_U64(DATA) \ 3140 ((uint64_t) le64_to_cpup((void *) (DATA))) 3147 #define EC_READ_S64(DATA) \ 3148 ((int64_t) le64_to_cpup((void *) (DATA))) 3170 #define EC_READ_REAL(DATA) ecrt_read_real(DATA) 3186 #define EC_READ_LREAL(DATA) ecrt_read_lreal(DATA) 3188 #endif // ifndef __KERNEL__ 3199 #define EC_WRITE_U8(DATA, VAL) \ 3201 *((uint8_t *)(DATA)) = ((uint8_t) (VAL)); \ 3209 #define EC_WRITE_S8(DATA, VAL) EC_WRITE_U8(DATA, VAL) 3216 #define EC_WRITE_U16(DATA, VAL) \ 3218 *((uint16_t *) (DATA)) = cpu_to_le16((uint16_t) (VAL)); \ 3226 #define EC_WRITE_S16(DATA, VAL) EC_WRITE_U16(DATA, VAL) 3233 #define EC_WRITE_U32(DATA, VAL) \ 3235 *((uint32_t *) (DATA)) = cpu_to_le32((uint32_t) (VAL)); \ 3243 #define EC_WRITE_S32(DATA, VAL) EC_WRITE_U32(DATA, VAL) 3250 #define EC_WRITE_U64(DATA, VAL) \ 3252 *((uint64_t *) (DATA)) = cpu_to_le64((uint64_t) (VAL)); \ 3260 #define EC_WRITE_S64(DATA, VAL) EC_WRITE_U64(DATA, VAL) 3275 EC_PUBLIC_API void ecrt_write_real(
void *data,
float value);
3282 #define EC_WRITE_REAL(DATA, VAL) ecrt_write_real(DATA, VAL) 3291 EC_PUBLIC_API void ecrt_write_lreal(
void *data,
double value);
3298 #define EC_WRITE_LREAL(DATA, VAL) ecrt_write_lreal(DATA, VAL) 3300 #endif // ifndef __KERNEL__ unsigned int working_counter
Value of the last working counter.
uint32_t serial_number
Serial-Number stored on the slave.
ec_slave_port_desc_t desc
Physical port type.
uint8_t subindex
PDO entry subindex.
EC_PUBLIC_API ec_request_state_t ecrt_sdo_request_state(const ec_sdo_request_t *req)
Get the current state of the SDO request.
uint16_t position
Slave position.
EC_PUBLIC_API int ecrt_master_deactivate(ec_master_t *master)
Deactivates the master.
Neither read nor write via CoE.
uint8_t sync_count
Number of sync managers.
EC_PUBLIC_API int ecrt_master_sii_caching(ec_master_t *master, ec_sii_caching_fields_t fields)
Set the SII caching method.
EC_PUBLIC_API int ecrt_sdo_request_write(ec_sdo_request_t *req)
Schedule an SDO write operation.
EC_PUBLIC_API int ecrt_slave_config_pdo_assign_clear(ec_slave_config_t *sc, uint8_t sync_index)
Clear a sync manager's PDO assignment.
EC_PUBLIC_API int ecrt_master_link_state(const ec_master_t *master, unsigned int dev_idx, ec_master_link_state_t *state)
Reads the current state of a redundant link.
unsigned int n_entries
Number of PDO entries in entries to map.
#define EC_PUBLIC_API
Symbol visibility control macro.
EC_PUBLIC_API int ecrt_voe_handler_read(ec_voe_handler_t *voe)
Start a VoE read operation.
uint8_t bit_length
Size of the PDO entry in bit.
ec_direction_t dir
Sync manager direction.
uint8_t error_flag
Error flag for that slave.
ec_pdo_mode_t
PDO handling mode.
ec_watchdog_mode_t
Watchdog mode for sync manager configuration.
ec_slave_port_desc_t
EtherCAT slave port descriptor.
ec_pdo_info_t const * pdos
Array with PDOs to assign.
EC_PUBLIC_API int ecrt_slave_config_sdo32(ec_slave_config_t *sc, uint16_t sdo_index, uint8_t sdo_subindex, uint32_t value)
Add a configuration value for a 32-bit SDO.
EC_PUBLIC_API int ecrt_master_send(ec_master_t *master)
Sends all datagrams in the queue.
ec_al_state_t
Application-layer state.
EC_PUBLIC_API int ecrt_sdo_request_timeout(ec_sdo_request_t *req, uint32_t timeout)
Set the timeout for an SDO request.
EC_PUBLIC_API int ecrt_master_scan_progress(ec_master_t *master, ec_master_scan_progress_t *progress)
Obtains network scan progress information.
EC_PUBLIC_API int ecrt_soe_request_timeout(ec_soe_request_t *req, uint32_t timeout)
Set the timeout for an SoE request.
unsigned int redundancy_active
Redundant link is in use.
EC_PUBLIC_API int ecrt_slave_config_watchdog(ec_slave_config_t *sc, uint16_t watchdog_divider, uint16_t watchdog_intervals)
Configure a slave's watchdog times.
EC_PUBLIC_API uint8_t * ecrt_sdo_request_data(const ec_sdo_request_t *req)
Access to the SDO request's data.
unsigned int slave_count
Number of slaves in the network.
EC_PUBLIC_API int ecrt_domain_reg_pdo_entry_list(ec_domain_t *domain, const ec_pdo_entry_reg_t *pdo_entry_regs)
Registers a bunch of PDO entries for a domain.
EC_PUBLIC_API int ecrt_master_sdo_download_complete(ec_master_t *master, uint16_t slave_position, uint16_t index, const uint8_t *data, size_t data_size, uint32_t *abort_code)
Executes an SDO download request to write data to a slave via complete access.
EC_PUBLIC_API ec_domain_t * ecrt_master_create_domain(ec_master_t *master)
Creates a new process data domain.
uint16_t index
PDO entry index.
EC_PUBLIC_API int ecrt_slave_config_reg_pdo_entry(ec_slave_config_t *sc, uint16_t entry_index, uint8_t entry_subindex, ec_domain_t *domain, unsigned int *bit_position)
Registers a PDO entry for process data exchange in a domain.
uint32_t vendor_id
Vendor-ID stored on the slave.
ec_slave_port_link_t link
Port link state.
unsigned int slaves_responding
Sum of responding slaves on the given link.
EC_PUBLIC_API int ecrt_master_sync_reference_clock(ec_master_t *master)
Queues the DC reference clock drift compensation datagram for sending.
EC_PUBLIC_API int ecrt_slave_config_sdo(ec_slave_config_t *sc, uint16_t index, uint8_t subindex, const uint8_t *data, size_t size)
Add an SDO configuration.
EC_PUBLIC_API int ecrt_domain_state(const ec_domain_t *domain, ec_domain_state_t *state)
Reads the state of a domain.
EC_PUBLIC_API int ecrt_sdo_request_read(ec_sdo_request_t *req)
Schedule an SDO read operation.
void ecrt_master_callbacks(ec_master_t *master, void(*send_cb)(void *), void(*receive_cb)(void *), void *cb_data)
Sets the locking callbacks.
EC_PUBLIC_API int ecrt_voe_handler_write(ec_voe_handler_t *voe, size_t size)
Start a VoE write operation.
EC_PUBLIC_API int ecrt_slave_config_sync_manager(ec_slave_config_t *sc, uint8_t sync_index, ec_direction_t direction, ec_watchdog_mode_t watchdog_mode)
Configure a sync manager.
Master scan progress information.
EC_PUBLIC_API int ecrt_slave_config_emerg_overruns(const ec_slave_config_t *sc)
Read the number of CoE emergency overruns.
uint32_t delay_to_next_dc
Delay [ns] to next DC slave.
unsigned int link_up
true, if the given Ethernet link is up.
EC_PUBLIC_API int ecrt_soe_request_idn(ec_soe_request_t *req, uint8_t drive_no, uint16_t idn)
Set the request's drive and Sercos ID numbers.
EC_PUBLIC_API int ecrt_slave_config_idn(ec_slave_config_t *sc, uint8_t drive_no, uint16_t idn, ec_al_state_t state, const uint8_t *data, size_t size)
Add an SoE IDN configuration.
ec_wc_state_t wc_state
Working counter interpretation.
PDO configuration information.
EC_PUBLIC_API int ecrt_slave_config_state_timeout(ec_slave_config_t *sc, ec_al_state_t from_state, ec_al_state_t to_state, unsigned int timeout_ms)
Sets the application-layer state transition timeout in ms.
Sync manager configuration information.
EC_PUBLIC_API int ecrt_slave_config_eoe_dns_address(ec_slave_config_t *sc, struct in_addr dns_address)
Sets the IPv4 address of the DNS server for Ethernet-over-EtherCAT (EoE) operation.
ec_wc_state_t
Domain working counter interpretation.
uint8_t signal_detected
Detected signal on RX port.
EC_PUBLIC_API uint8_t * ecrt_reg_request_data(const ec_reg_request_t *req)
Access to the register request's data.
EtherCAT slave port information.
EC_PUBLIC_API int ecrt_slave_config_reg_pdo_entry_pos(ec_slave_config_t *sc, uint8_t sync_index, unsigned int pdo_pos, unsigned int entry_pos, ec_domain_t *domain, unsigned int *bit_position)
Registers a PDO entry using its position.
unsigned int slaves_responding
Sum of responding slaves on all Ethernet devices.
EC_PUBLIC_API int ecrt_slave_config_sdo8(ec_slave_config_t *sc, uint16_t sdo_index, uint8_t sdo_subindex, uint8_t value)
Add a configuration value for an 8-bit SDO.
void ecrt_domain_external_memory(ec_domain_t *domain, uint8_t *memory)
Provide external memory to store the domain's process data.
EC_PUBLIC_API int ecrt_slave_config_state(const ec_slave_config_t *sc, ec_slave_config_state_t *state)
Outputs the state of the slave configuration.
EC_PUBLIC_API ec_voe_handler_t * ecrt_slave_config_create_voe_handler(ec_slave_config_t *sc, size_t size)
Create an VoE handler to exchange vendor-specific data during realtime operation. ...
unsigned int link_up
true, if the network link is up.
EC_PUBLIC_API int ecrt_master_write_idn(ec_master_t *master, uint16_t slave_position, uint8_t drive_no, uint16_t idn, const uint8_t *data, size_t data_size, uint16_t *error_code)
Executes an SoE write request.
Some of the registered process data were exchanged.
EC_PUBLIC_API unsigned int ecrt_version_magic(void)
Returns the version magic of the realtime interface.
uint32_t revision_number
Revision-Number stored on the slave.
Use the default setting of the sync manager.
EC_PUBLIC_API ec_sdo_request_t * ecrt_slave_config_create_sdo_request(ec_slave_config_t *sc, uint16_t index, uint8_t subindex, size_t size)
Create an SDO request to exchange SDOs during realtime operation.
EC_PUBLIC_API uint8_t * ecrt_domain_data(const ec_domain_t *domain)
Returns the domain's process data.
EC_PUBLIC_API int ecrt_domain_queue(ec_domain_t *domain)
(Re-)queues all domain datagrams in the master's datagram queue.
uint16_t alias
Slave alias address.
EC_PUBLIC_API int ecrt_master_reference_clock_time(const ec_master_t *master, uint32_t *time)
Get the lower 32 bit of the reference clock system time.
EC_PUBLIC_API int ecrt_slave_config_emerg_clear(ec_slave_config_t *sc)
Clears CoE emergency ring buffer and the overrun counter.
uint8_t loop_closed
Loop closed.
EC_PUBLIC_API int ecrt_master_sync_reference_clock_to(ec_master_t *master, uint64_t sync_time)
Queues the DC reference clock drift compensation datagram for sending.
Read the current state via CoE while scanning the slave, and write it back only if it differs from th...
EC_PUBLIC_API uint8_t * ecrt_soe_request_data(const ec_soe_request_t *req)
Access to the SoE request's data.
EC_PUBLIC_API int ecrt_sdo_request_index(ec_sdo_request_t *req, uint16_t index, uint8_t subindex)
Set the SDO index and subindex.
Slave configuration state.
Request is being processed.
uint64_t app_time
Application time.
ec_watchdog_mode_t watchdog_mode
Watchdog mode.
unsigned int n_pdos
Number of PDOs in pdos.
uint32_t vendor_id
Slave vendor ID.
unsigned int al_state
The application-layer state of the slave.
unsigned int * bit_position
Pointer to a variable to store a bit position (0-7) within the offset.
EC_PUBLIC_API size_t ecrt_domain_size(const ec_domain_t *domain)
Returns the current size of the domain's process data.
EC_PUBLIC_API int ecrt_master_application_time(ec_master_t *master, uint64_t app_time)
Sets the application time.
Read the current state via CoE while scanning the slave, and unconditionally (re-)write it every time...
unsigned int operational
The slave was brought into OP state using the specified configuration.
EC_PUBLIC_API int ecrt_voe_handler_received_header(const ec_voe_handler_t *voe, uint32_t *vendor_id, uint16_t *vendor_type)
Reads the header data of a received VoE message.
EC_PUBLIC_API int ecrt_master_read_idn(ec_master_t *master, uint16_t slave_position, uint8_t drive_no, uint16_t idn, uint8_t *target, size_t target_size, size_t *result_size, uint16_t *error_code)
Executes an SoE read request.
ec_direction_t
Direction type for PDO assignment functions.
EC_PUBLIC_API size_t ecrt_sdo_request_data_size(const ec_sdo_request_t *req)
Returns the current SDO data size.
EC_PUBLIC_API int ecrt_reg_request_write(ec_reg_request_t *req, uint16_t address, size_t size)
Schedule an register write operation.
EC_PUBLIC_API ec_slave_config_t * ecrt_master_slave_config(ec_master_t *master, uint16_t alias, uint16_t position, uint32_t vendor_id, uint32_t product_code)
Obtains a slave configuration.
EC_PUBLIC_API int ecrt_slave_config_flag(ec_slave_config_t *sc, const char *key, int32_t value)
Adds a feature flag to a slave configuration.
Vendor specific over EtherCAT handler.
EC_PUBLIC_API size_t ecrt_soe_request_data_size(const ec_soe_request_t *req)
Returns the current IDN data size.
EC_PUBLIC_API ec_request_state_t ecrt_soe_request_state(const ec_soe_request_t *req)
Get the current state of the SoE request.
ec_pdo_entry_info_t const * entries
Array of PDO entries to map.
EC_PUBLIC_API int ecrt_slave_config_pdo_assign_add(ec_slave_config_t *sc, uint8_t sync_index, uint16_t index)
Add a PDO to a sync manager's PDO assignment.
EC_PUBLIC_API int ecrt_slave_config_dc(ec_slave_config_t *sc, uint16_t assign_activate, uint32_t sync0_cycle, int32_t sync0_shift, uint32_t sync1_cycle, int32_t sync1_shift)
Configure distributed clocks.
EC_PUBLIC_API ec_request_state_t ecrt_reg_request_state(const ec_reg_request_t *req)
Get the current state of the register request.
EC_PUBLIC_API ec_reg_request_t * ecrt_slave_config_create_reg_request(ec_slave_config_t *sc, size_t size)
Create a register request to exchange EtherCAT register contents during realtime operation.
EC_PUBLIC_API int ecrt_slave_config_eoe_ip_address(ec_slave_config_t *sc, struct in_addr ip_address)
Sets the IP address for Ethernet-over-EtherCAT (EoE) operation.
int ecrt_master_send_ext(ec_master_t *master)
Sends non-application datagrams.
EC_PUBLIC_API int ecrt_master_select_reference_clock(ec_master_t *master, ec_slave_config_t *sc)
Selects the reference clock for distributed clocks.
Values read by the master.
EC_PUBLIC_API int ecrt_master_sync_monitor_queue(ec_master_t *master)
Queues the DC synchrony monitoring datagram for sending.
unsigned int online
The slave is online.
EC_PUBLIC_API int ecrt_master(ec_master_t *master, ec_master_info_t *master_info)
Obtains master information.
EC_PUBLIC_API int ecrt_slave_config_pdo_mapping_clear(ec_slave_config_t *sc, uint16_t pdo_index)
Clear the mapping of a given PDO.
Write the configured state via CoE every time the slave is configured, without reading the current st...
EC_PUBLIC_API int ecrt_master_get_slave(ec_master_t *master, uint16_t slave_position, ec_slave_info_t *slave_info)
Obtains slave information.
uint16_t index
PDO entry index.
uint8_t al_state
Current state of the slave.
uint8_t scan_busy
true, while the master is scanning the network.
EC_PUBLIC_API ec_master_t * ecrt_request_master(unsigned int master_index)
Requests an EtherCAT master for realtime operation.
int16_t current_on_ebus
Used current in mA.
EC_PUBLIC_API int ecrt_domain_process(ec_domain_t *domain)
Determines the states of the domain's datagrams.
EC_PUBLIC_API int ecrt_slave_config_eoe_default_gateway(ec_slave_config_t *sc, struct in_addr gateway_address)
Sets the gateway address for Ethernet-over-EtherCAT (EoE) operation.
#define EC_MAX_PORTS
Maximum number of slave ports.
EC_PUBLIC_API int ecrt_master_sdo_download(ec_master_t *master, uint16_t slave_position, uint16_t index, uint8_t subindex, const uint8_t *data, size_t data_size, uint32_t *abort_code)
Executes an SDO download request to write data to a slave.
EC_PUBLIC_API uint8_t * ecrt_voe_handler_data(const ec_voe_handler_t *voe)
Access to the VoE handler's data.
EC_PUBLIC_API int ecrt_slave_config_emerg_pop(ec_slave_config_t *sc, uint8_t *target)
Read and remove one record from the CoE emergency ring buffer.
EC_PUBLIC_API ec_soe_request_t * ecrt_slave_config_create_soe_request(ec_slave_config_t *sc, uint8_t drive_no, uint16_t idn, size_t size)
Create an SoE request to exchange SoE IDNs during realtime operation.
EC_PUBLIC_API int ecrt_slave_config_complete_sdo(ec_slave_config_t *sc, uint16_t index, const uint8_t *data, size_t size)
Add configuration data for a complete SDO.
uint16_t sdo_count
Number of SDOs.
#define EC_MAX_STRING_LENGTH
Maximum string length.
List record type for PDO entry mass-registration.
unsigned int link_up
true, if at least one Ethernet link is up.
EC_PUBLIC_API int ecrt_slave_config_pdos(ec_slave_config_t *sc, unsigned int n_syncs, const ec_sync_info_t syncs[])
Specify a complete PDO configuration.
EC_PUBLIC_API int ecrt_voe_handler_send_header(ec_voe_handler_t *voe, uint32_t vendor_id, uint16_t vendor_type)
Sets the VoE header for future send operations.
EC_PUBLIC_API int ecrt_slave_config_eoe_hostname(ec_slave_config_t *sc, const char *name)
Sets the host name for Ethernet-over-EtherCAT (EoE) operation.
EC_PUBLIC_API int ecrt_slave_config_pdo_mode(ec_slave_config_t *sc, ec_pdo_mode_t assign_mode, ec_pdo_mode_t config_mode)
Selects how a slave's PDO assignment and PDO configuration are read from resp.
unsigned int scan_index
Index of the slave that is currently scanned.
uint16_t next_slave
Ring position of next DC slave on that port.
No registered process data were exchanged.
All registered process data were exchanged.
unsigned int al_states
Application-layer states of all slaves.
EC_PUBLIC_API int ecrt_master_activate(ec_master_t *master)
Finishes the configuration phase and prepares for cyclic operation.
EC_PUBLIC_API int ecrt_soe_request_read(ec_soe_request_t *req)
Schedule an SoE IDN read operation.
EC_PUBLIC_API size_t ecrt_voe_handler_data_size(const ec_voe_handler_t *voe)
Returns the current data size.
EC_PUBLIC_API ec_request_state_t ecrt_voe_handler_execute(ec_voe_handler_t *voe)
Execute the handler.
uint16_t alias
The slaves alias if not equal to 0.
EtherCAT slave configuration.
uint32_t product_code
Product-Code stored on the slave.
EC_PUBLIC_API int ecrt_master_receive(ec_master_t *master)
Fetches received frames from the hardware and processes the datagrams.
unsigned int slave_count
Number of slaves detected.
EC_PUBLIC_API uint32_t ecrt_master_sync_monitor_process(const ec_master_t *master)
Processes the DC synchrony monitoring datagram.
Request was processed successfully.
unsigned int * offset
Pointer to a variable to store the PDO entry's (byte-)offset in the process data. ...
ec_request_state_t
Request state.
PDO entry configuration information.
uint8_t index
Sync manager index.
Values written by the master.
EC_PUBLIC_API int ecrt_slave_config_eoe_mac_address(ec_slave_config_t *sc, const unsigned char *mac_address)
Sets the link/MAC address for Ethernet-over-EtherCAT (EoE) operation.
EC_PUBLIC_API int ecrt_soe_request_write(ec_soe_request_t *req)
Schedule an SoE IDN write operation.
EC_PUBLIC_API int ecrt_slave_config_sdo16(ec_slave_config_t *sc, uint16_t sdo_index, uint8_t sdo_subindex, uint16_t value)
Add a configuration value for a 16-bit SDO.
EC_PUBLIC_API int ecrt_slave_config_eoe_subnet_mask(ec_slave_config_t *sc, struct in_addr subnet_mask)
Sets the subnet mask for Ethernet-over-EtherCAT (EoE) operation.
unsigned int al_states
Application-layer states of the slaves on the given link.
EC_PUBLIC_API int ecrt_slave_config_pdo_mapping_add(ec_slave_config_t *sc, uint16_t pdo_index, uint16_t entry_index, uint8_t entry_subindex, uint8_t entry_bit_length)
Add a PDO entry to the given PDO's mapping.
EC_PUBLIC_API int ecrt_slave_config_emerg_size(ec_slave_config_t *sc, size_t elements)
Set the size of the CoE emergency ring buffer.
uint16_t position
Offset of the slave in the ring.
uint32_t receive_time
Receive time on DC transmission delay measurement.
uint32_t product_code
Slave product code.
Request processing failed.
EC_PUBLIC_API int ecrt_master_set_send_interval(ec_master_t *master, size_t send_interval)
Set interval between calls to ecrt_master_send().
uint8_t link_up
Link detected.
ec_sii_caching_fields_t
Fields for SII caching.
uint8_t subindex
PDO entry subindex.
EC_PUBLIC_API int ecrt_reg_request_read(ec_reg_request_t *req, uint16_t address, size_t size)
Schedule a register read operation.
EC_PUBLIC_API int ecrt_master_sync_slave_clocks(ec_master_t *master)
Queues the DC clock drift compensation datagram for sending.
EC_PUBLIC_API int ecrt_master_state(const ec_master_t *master, ec_master_state_t *state)
Reads the current master state.
Sercos-over-EtherCAT request.
EC_PUBLIC_API void ecrt_release_master(ec_master_t *master)
Releases a requested EtherCAT master.
EC_PUBLIC_API int ecrt_master_reset(ec_master_t *master)
Retry configuring slaves.
EC_PUBLIC_API int ecrt_master_sdo_upload(ec_master_t *master, uint16_t slave_position, uint16_t index, uint8_t subindex, uint8_t *target, size_t target_size, size_t *result_size, uint32_t *abort_code)
Executes an SDO upload request to read data from a slave.
EC_PUBLIC_API int ecrt_voe_handler_read_nosync(ec_voe_handler_t *voe)
Start a VoE read operation without querying the sync manager status.