IgH EtherCAT Master  1.5.3
slave_config.c File Reference

EtherCAT slave configuration methods. More...

Go to the source code of this file.

Functions

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_prepare_fmmu (ec_slave_config_t *sc, ec_domain_t *domain, uint8_t sync_index, ec_direction_t dir)
 Prepares an FMMU configuration. 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.
 
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.
 
unsigned int ec_slave_config_sdo_count (const ec_slave_config_t *sc)
 Get the number of SDO configurations. More...
 
const ec_sdo_request_tec_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_tec_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_tec_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_tec_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_tec_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_tec_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_tec_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_tec_slave_config_find_flag (ec_slave_config_t *sc, const char *key)
 Finds a flag. 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...
 
void 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...
 
void 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...
 
void 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...
 
void 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 (ec_slave_config_t *sc)
 Read the number of CoE emergency overruns. More...
 
ec_sdo_request_tecrt_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_tecrt_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_tecrt_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_tecrt_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_tecrt_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_tecrt_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_tecrt_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_tecrt_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...
 
void 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...
 

Detailed Description

EtherCAT slave configuration methods.

Definition in file slave_config.c.

Function Documentation

◆ ec_slave_config_init()

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.

Parameters
scSlave configuration.
masterEtherCAT master.
aliasSlave alias.
positionSlave position.
vendor_idExpected vendor ID.
product_codeExpected product code.

Definition at line 54 of file slave_config.c.

◆ ec_slave_config_clear()

void ec_slave_config_clear ( ec_slave_config_t sc)

Slave configuration destructor.

Clears and frees a slave configuration object.

Parameters
scSlave configuration.

Definition at line 103 of file slave_config.c.

◆ ec_slave_config_prepare_fmmu()

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.

Return values
>=0Success, logical offset byte address.
<0Error code.
Parameters
scSlave configuration.
domainDomain.
sync_indexSync manager index.
dirPDO direction.

Definition at line 186 of file slave_config.c.

◆ ec_slave_config_attach()

int ec_slave_config_attach ( ec_slave_config_t sc)

Attaches the configuration to the addressed slave object.

Return values
0Success.
<0Error code.
Parameters
scSlave configuration.

Definition at line 224 of file slave_config.c.

◆ ec_slave_config_detach()

void ec_slave_config_detach ( ec_slave_config_t sc)

Detaches the configuration from a slave object.

Parameters
scSlave configuration.

Definition at line 282 of file slave_config.c.

◆ ec_slave_config_sdo_count()

unsigned int ec_slave_config_sdo_count ( const ec_slave_config_t sc)

Get the number of SDO configurations.

Returns
Number of SDO configurations.
Parameters
scSlave configuration.

Definition at line 388 of file slave_config.c.

◆ ec_slave_config_get_sdo_by_pos_const()

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.

Returns
Search result, or NULL.
Parameters
scSlave configuration.
posPosition in the list.

Definition at line 410 of file slave_config.c.

◆ ec_slave_config_idn_count()

unsigned int ec_slave_config_idn_count ( const ec_slave_config_t sc)

Get the number of IDN configurations.

Returns
Number of SDO configurations.
Parameters
scSlave configuration.

Definition at line 432 of file slave_config.c.

◆ ec_slave_config_get_idn_by_pos_const()

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.

Returns
Search result, or NULL.
Parameters
scSlave configuration.
posPosition in the list.

Definition at line 454 of file slave_config.c.

◆ ec_slave_config_flag_count()

unsigned int ec_slave_config_flag_count ( const ec_slave_config_t sc)

Get the number of feature flags.

Returns
Number of feature flags.
Parameters
scSlave configuration.

Definition at line 476 of file slave_config.c.

◆ ec_slave_config_get_flag_by_pos_const()

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.

Returns
Search result, or NULL.
Parameters
scSlave configuration.
posPosition in the list.

Definition at line 498 of file slave_config.c.

◆ ec_slave_config_find_sdo_request()

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.

Returns
Search result, or NULL.
Parameters
scSlave configuration.
posPosition in the list.

Definition at line 520 of file slave_config.c.

◆ ec_slave_config_find_soe_request()

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.

Returns
Search result, or NULL.
Parameters
scSlave configuration.
posPosition in the list.

Definition at line 542 of file slave_config.c.

◆ ec_slave_config_find_reg_request()

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.

Returns
Search result, or NULL.
Parameters
scSlave configuration.
posPosition in the list.

Definition at line 564 of file slave_config.c.

◆ ec_slave_config_find_voe_handler()

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.

Returns
Search result, or NULL.
Parameters
scSlave configuration.
posPosition in the list.

Definition at line 586 of file slave_config.c.

◆ ec_slave_config_find_flag()

ec_flag_t* ec_slave_config_find_flag ( ec_slave_config_t sc,
const char *  key 
)

Finds a flag.

Returns
Search result, or NULL.
Parameters
scSlave configuration.
keyFlag key.

Definition at line 608 of file slave_config.c.