IgH EtherCAT Master
1.6.2
|
EtherCAT slave configuration methods. More...
Go to the source code of this file.
Data Structures | |
struct | ec_al_timeout_t |
EtherCAT application-layer transition timeout. More... | |
Functions | |
int | ec_slave_config_prepare_fmmu (ec_slave_config_t *sc, ec_domain_t *domain, uint8_t sync_index, ec_direction_t dir) |
Prepares an FMMU configuration. More... | |
void | ec_slave_config_load_default_mapping (const ec_slave_config_t *sc, ec_pdo_t *pdo) |
Loads the default mapping for a PDO from the slave object. | |
void | ec_slave_config_init (ec_slave_config_t *sc, ec_master_t *master, uint16_t alias, uint16_t position, uint32_t vendor_id, uint32_t product_code) |
Slave configuration constructor. More... | |
void | ec_slave_config_clear (ec_slave_config_t *sc) |
Slave configuration destructor. More... | |
int | ec_slave_config_attach (ec_slave_config_t *sc) |
Attaches the configuration to the addressed slave object. More... | |
void | ec_slave_config_detach (ec_slave_config_t *sc) |
Detaches the configuration from a slave object. More... | |
void | ec_slave_config_load_default_sync_config (ec_slave_config_t *sc) |
Loads the default PDO assignment from the slave object. | |
unsigned int | ec_slave_config_sdo_count (const ec_slave_config_t *sc) |
Get the number of SDO configurations. More... | |
const ec_sdo_request_t * | ec_slave_config_get_sdo_by_pos_const (const ec_slave_config_t *sc, unsigned int pos) |
Finds an SDO configuration via its position in the list. More... | |
unsigned int | ec_slave_config_idn_count (const ec_slave_config_t *sc) |
Get the number of IDN configurations. More... | |
const ec_soe_request_t * | ec_slave_config_get_idn_by_pos_const (const ec_slave_config_t *sc, unsigned int pos) |
Finds an IDN configuration via its position in the list. More... | |
unsigned int | ec_slave_config_flag_count (const ec_slave_config_t *sc) |
Get the number of feature flags. More... | |
const ec_flag_t * | ec_slave_config_get_flag_by_pos_const (const ec_slave_config_t *sc, unsigned int pos) |
Finds a flag via its position in the list. More... | |
ec_sdo_request_t * | ec_slave_config_find_sdo_request (ec_slave_config_t *sc, unsigned int pos) |
Finds a CoE SDO request via its position in the list. More... | |
ec_soe_request_t * | ec_slave_config_find_soe_request (ec_slave_config_t *sc, unsigned int pos) |
Finds a SoE request via its position in the list. More... | |
ec_reg_request_t * | ec_slave_config_find_reg_request (ec_slave_config_t *sc, unsigned int pos) |
Finds a register handler via its position in the list. More... | |
ec_voe_handler_t * | ec_slave_config_find_voe_handler (ec_slave_config_t *sc, unsigned int pos) |
Finds a VoE handler via its position in the list. More... | |
ec_flag_t * | ec_slave_config_find_flag (ec_slave_config_t *sc, const char *key) |
Finds a flag. More... | |
unsigned int | ec_slave_config_al_timeout (const ec_slave_config_t *sc, ec_slave_state_t from, ec_slave_state_t to) |
Return an AL state timeout. More... | |
int | ecrt_slave_config_sync_manager (ec_slave_config_t *sc, uint8_t sync_index, ec_direction_t dir, ec_watchdog_mode_t watchdog_mode) |
Configure a sync manager. More... | |
int | ecrt_slave_config_watchdog (ec_slave_config_t *sc, uint16_t divider, uint16_t intervals) |
Configure a slave's watchdog times. More... | |
int | ecrt_slave_config_pdo_assign_add (ec_slave_config_t *sc, uint8_t sync_index, uint16_t pdo_index) |
Add a PDO to a sync manager's PDO assignment. More... | |
int | ecrt_slave_config_pdo_assign_clear (ec_slave_config_t *sc, uint8_t sync_index) |
Clear a sync manager's PDO assignment. More... | |
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. More... | |
int | ecrt_slave_config_pdo_mapping_clear (ec_slave_config_t *sc, uint16_t pdo_index) |
Clear the mapping of a given PDO. More... | |
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. More... | |
int | ecrt_slave_config_reg_pdo_entry (ec_slave_config_t *sc, uint16_t index, uint8_t subindex, ec_domain_t *domain, unsigned int *bit_position) |
Registers a PDO entry for process data exchange in a domain. More... | |
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. More... | |
int | ecrt_slave_config_dc (ec_slave_config_t *sc, uint16_t assign_activate, uint32_t sync0_cycle_time, int32_t sync0_shift_time, uint32_t sync1_cycle_time, int32_t sync1_shift_time) |
Configure distributed clocks. More... | |
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. More... | |
int | ecrt_slave_config_sdo8 (ec_slave_config_t *sc, uint16_t index, uint8_t subindex, uint8_t value) |
Add a configuration value for an 8-bit SDO. More... | |
int | ecrt_slave_config_sdo16 (ec_slave_config_t *sc, uint16_t index, uint8_t subindex, uint16_t value) |
Add a configuration value for a 16-bit SDO. More... | |
int | ecrt_slave_config_sdo32 (ec_slave_config_t *sc, uint16_t index, uint8_t subindex, uint32_t value) |
Add a configuration value for a 32-bit SDO. More... | |
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. More... | |
int | ecrt_slave_config_emerg_size (ec_slave_config_t *sc, size_t elements) |
Set the size of the CoE emergency ring buffer. More... | |
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. More... | |
int | ecrt_slave_config_emerg_clear (ec_slave_config_t *sc) |
Clears CoE emergency ring buffer and the overrun counter. More... | |
int | ecrt_slave_config_emerg_overruns (const ec_slave_config_t *sc) |
Read the number of CoE emergency overruns. More... | |
ec_sdo_request_t * | ecrt_slave_config_create_sdo_request_err (ec_slave_config_t *sc, uint16_t index, uint8_t subindex, size_t size) |
Same as ecrt_slave_config_create_sdo_request(), but with ERR_PTR() return value. | |
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. More... | |
ec_soe_request_t * | ecrt_slave_config_create_soe_request_err (ec_slave_config_t *sc, uint8_t drive_no, uint16_t idn, size_t size) |
Same as ecrt_slave_config_create_soe_request(), but with ERR_PTR() return value. | |
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. More... | |
ec_reg_request_t * | ecrt_slave_config_create_reg_request_err (ec_slave_config_t *sc, size_t size) |
Same as ecrt_slave_config_create_reg_request(), but with ERR_PTR() return value. | |
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. More... | |
ec_voe_handler_t * | ecrt_slave_config_create_voe_handler_err (ec_slave_config_t *sc, size_t size) |
Same as ecrt_slave_config_create_voe_handler(), but with ERR_PTR() return value. | |
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. More... | |
int | ecrt_slave_config_state (const ec_slave_config_t *sc, ec_slave_config_state_t *state) |
Outputs the state of the slave configuration. More... | |
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. More... | |
int | ecrt_slave_config_flag (ec_slave_config_t *sc, const char *key, int32_t value) |
Adds a feature flag to a slave configuration. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
int | ecrt_slave_config_eoe_hostname (ec_slave_config_t *sc, const char *name) |
Sets the host name for Ethernet-over-EtherCAT (EoE) operation. More... | |
int | ecrt_slave_config_state_timeout (ec_slave_config_t *sc, ec_al_state_t from, ec_al_state_t to, unsigned int timeout_ms) |
Sets the application-layer state transition timeout in ms. More... | |
EtherCAT slave configuration methods.
Definition in file slave_config.c.
int ec_slave_config_prepare_fmmu | ( | ec_slave_config_t * | sc, |
ec_domain_t * | domain, | ||
uint8_t | sync_index, | ||
ec_direction_t | dir | ||
) |
Prepares an FMMU configuration.
Configuration data for the FMMU is saved in the slave config structure and is written to the slave during the configuration. The FMMU configuration is done in a way, that the complete data range of the corresponding sync manager is covered. Seperate FMMUs are configured for each domain. If the FMMU configuration is already prepared, the function does nothing and returns with success.
>=0 | Success, logical offset byte address. |
<0 | Error code. |
sc | Slave configuration. |
domain | Domain. |
sync_index | Sync manager index. |
dir | PDO direction. |
Definition at line 216 of file slave_config.c.
void ec_slave_config_init | ( | ec_slave_config_t * | sc, |
ec_master_t * | master, | ||
uint16_t | alias, | ||
uint16_t | position, | ||
uint32_t | vendor_id, | ||
uint32_t | product_code | ||
) |
Slave configuration constructor.
See ecrt_master_slave_config() for the usage of the alias and position parameters.
sc | Slave configuration. |
master | EtherCAT master. |
alias | Slave alias. |
position | Slave position. |
vendor_id | Expected vendor ID. |
product_code | Expected product code. |
Definition at line 72 of file slave_config.c.
void ec_slave_config_clear | ( | ec_slave_config_t * | sc | ) |
Slave configuration destructor.
Clears and frees a slave configuration object.
sc | Slave configuration. |
Definition at line 126 of file slave_config.c.
int ec_slave_config_attach | ( | ec_slave_config_t * | sc | ) |
Attaches the configuration to the addressed slave object.
0 | Success. |
<0 | Error code. |
sc | Slave configuration. |
Definition at line 254 of file slave_config.c.
void ec_slave_config_detach | ( | ec_slave_config_t * | sc | ) |
Detaches the configuration from a slave object.
sc | Slave configuration. |
Definition at line 312 of file slave_config.c.
unsigned int ec_slave_config_sdo_count | ( | const ec_slave_config_t * | sc | ) |
Get the number of SDO configurations.
sc | Slave configuration. |
Definition at line 418 of file slave_config.c.
const ec_sdo_request_t* ec_slave_config_get_sdo_by_pos_const | ( | const ec_slave_config_t * | sc, |
unsigned int | pos | ||
) |
Finds an SDO configuration via its position in the list.
Const version.
sc | Slave configuration. |
pos | Position in the list. |
Definition at line 440 of file slave_config.c.
unsigned int ec_slave_config_idn_count | ( | const ec_slave_config_t * | sc | ) |
Get the number of IDN configurations.
sc | Slave configuration. |
Definition at line 462 of file slave_config.c.
const ec_soe_request_t* ec_slave_config_get_idn_by_pos_const | ( | const ec_slave_config_t * | sc, |
unsigned int | pos | ||
) |
Finds an IDN configuration via its position in the list.
Const version.
sc | Slave configuration. |
pos | Position in the list. |
Definition at line 484 of file slave_config.c.
unsigned int ec_slave_config_flag_count | ( | const ec_slave_config_t * | sc | ) |
Get the number of feature flags.
sc | Slave configuration. |
Definition at line 506 of file slave_config.c.
const ec_flag_t* ec_slave_config_get_flag_by_pos_const | ( | const ec_slave_config_t * | sc, |
unsigned int | pos | ||
) |
Finds a flag via its position in the list.
Const version.
sc | Slave configuration. |
pos | Position in the list. |
Definition at line 528 of file slave_config.c.
ec_sdo_request_t* ec_slave_config_find_sdo_request | ( | ec_slave_config_t * | sc, |
unsigned int | pos | ||
) |
Finds a CoE SDO request via its position in the list.
sc | Slave configuration. |
pos | Position in the list. |
Definition at line 550 of file slave_config.c.
ec_soe_request_t* ec_slave_config_find_soe_request | ( | ec_slave_config_t * | sc, |
unsigned int | pos | ||
) |
Finds a SoE request via its position in the list.
sc | Slave configuration. |
pos | Position in the list. |
Definition at line 572 of file slave_config.c.
ec_reg_request_t* ec_slave_config_find_reg_request | ( | ec_slave_config_t * | sc, |
unsigned int | pos | ||
) |
Finds a register handler via its position in the list.
sc | Slave configuration. |
pos | Position in the list. |
Definition at line 594 of file slave_config.c.
ec_voe_handler_t* ec_slave_config_find_voe_handler | ( | ec_slave_config_t * | sc, |
unsigned int | pos | ||
) |
Finds a VoE handler via its position in the list.
sc | Slave configuration. |
pos | Position in the list. |
Definition at line 616 of file slave_config.c.
ec_flag_t* ec_slave_config_find_flag | ( | ec_slave_config_t * | sc, |
const char * | key | ||
) |
Finds a flag.
sc | Slave configuration. |
key | Flag key. |
Definition at line 638 of file slave_config.c.
unsigned int ec_slave_config_al_timeout | ( | const ec_slave_config_t * | sc, |
ec_slave_state_t | from, | ||
ec_slave_state_t | to | ||
) |
Return an AL state timeout.
Definition at line 661 of file slave_config.c.