IgH EtherCAT Master  1.6.2
slave_config.h File Reference

EtherCAT slave configuration structure. More...

Go to the source code of this file.

Data Structures

struct  ec_slave_config
 EtherCAT slave configuration. More...
 

Macros

#define EC_CONFIG_INFO(sc, fmt, args...)
 Convenience macro for printing configuration-specific information to syslog. More...
 
#define EC_CONFIG_ERR(sc, fmt, args...)
 Convenience macro for printing configuration-specific errors to syslog. More...
 
#define EC_CONFIG_WARN(sc, fmt, args...)
 Convenience macro for printing configuration-specific warnings to syslog. More...
 
#define EC_CONFIG_DBG(sc, level, fmt, args...)
 Convenience macro for printing configuration-specific debug messages to syslog. More...
 

Functions

void ec_slave_config_init (ec_slave_config_t *, ec_master_t *, uint16_t, uint16_t, uint32_t, uint32_t)
 Slave configuration constructor. More...
 
void ec_slave_config_clear (ec_slave_config_t *)
 Slave configuration destructor. More...
 
int ec_slave_config_attach (ec_slave_config_t *)
 Attaches the configuration to the addressed slave object. More...
 
void ec_slave_config_detach (ec_slave_config_t *)
 Detaches the configuration from a slave object.
 
void ec_slave_config_load_default_sync_config (ec_slave_config_t *)
 Loads the default PDO assignment from the slave object.
 
unsigned int ec_slave_config_sdo_count (const ec_slave_config_t *)
 Get the number of SDO configurations. More...
 
const ec_sdo_request_tec_slave_config_get_sdo_by_pos_const (const ec_slave_config_t *, unsigned int)
 Finds an SDO configuration via its position in the list. More...
 
unsigned int ec_slave_config_idn_count (const ec_slave_config_t *)
 Get the number of IDN configurations. More...
 
const ec_soe_request_tec_slave_config_get_idn_by_pos_const (const ec_slave_config_t *, unsigned int)
 Finds an IDN configuration via its position in the list. More...
 
unsigned int ec_slave_config_flag_count (const ec_slave_config_t *)
 Get the number of feature flags. More...
 
const ec_flag_tec_slave_config_get_flag_by_pos_const (const ec_slave_config_t *, unsigned int)
 Finds a flag via its position in the list. More...
 
ec_sdo_request_tec_slave_config_find_sdo_request (ec_slave_config_t *, unsigned int)
 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 *, unsigned int)
 Finds a SoE request via its position in the list. More...
 
ec_reg_request_tec_slave_config_find_reg_request (ec_slave_config_t *, unsigned int)
 Finds a register handler via its position in the list. More...
 
ec_voe_handler_tec_slave_config_find_voe_handler (ec_slave_config_t *, unsigned int)
 Finds a VoE handler via its position in the list. More...
 
ec_flag_tec_slave_config_find_flag (ec_slave_config_t *, const char *)
 Finds a flag. More...
 
ec_sdo_request_tecrt_slave_config_create_sdo_request_err (ec_slave_config_t *, uint16_t, uint8_t, size_t)
 Same as ecrt_slave_config_create_sdo_request(), but with ERR_PTR() return value.
 
ec_soe_request_tecrt_slave_config_create_soe_request_err (ec_slave_config_t *, uint8_t, uint16_t, size_t)
 Same as ecrt_slave_config_create_soe_request(), but with ERR_PTR() return value.
 
ec_voe_handler_tecrt_slave_config_create_voe_handler_err (ec_slave_config_t *, size_t)
 Same as ecrt_slave_config_create_voe_handler(), but with ERR_PTR() return value.
 
ec_reg_request_tecrt_slave_config_create_reg_request_err (ec_slave_config_t *, size_t)
 Same as ecrt_slave_config_create_reg_request(), but with ERR_PTR() return value.
 
unsigned int ec_slave_config_al_timeout (const ec_slave_config_t *, ec_slave_state_t, ec_slave_state_t)
 Return an AL state timeout. More...
 

Detailed Description

EtherCAT slave configuration structure.

Definition in file slave_config.h.

Macro Definition Documentation

◆ EC_CONFIG_INFO

#define EC_CONFIG_INFO (   sc,
  fmt,
  args... 
)
Value:
printk(KERN_INFO "EtherCAT %u %u:%u: " fmt, sc->master->index, \
sc->alias, sc->position, ##args)

Convenience macro for printing configuration-specific information to syslog.

This will print the message in fmt with a prefixed "EtherCAT <INDEX> <ALIAS>:<POSITION>: ", where INDEX is the master index and ALIAS and POSITION identify the configuration.

Parameters
scEtherCAT slave configuration
fmtformat string (like in printf())
argsarguments (optional)

Definition at line 54 of file slave_config.h.

◆ EC_CONFIG_ERR

#define EC_CONFIG_ERR (   sc,
  fmt,
  args... 
)
Value:
printk(KERN_ERR "EtherCAT ERROR %u %u:%u: " fmt, sc->master->index, \
sc->alias, sc->position, ##args)

Convenience macro for printing configuration-specific errors to syslog.

This will print the message in fmt with a prefixed "EtherCAT <INDEX> <ALIAS>:<POSITION>: ", where INDEX is the master index and ALIAS and POSITION identify the configuration.

Parameters
scEtherCAT slave configuration
fmtformat string (like in printf())
argsarguments (optional)

Definition at line 68 of file slave_config.h.

◆ EC_CONFIG_WARN

#define EC_CONFIG_WARN (   sc,
  fmt,
  args... 
)
Value:
printk(KERN_WARNING "EtherCAT WARNING %u %u:%u: " fmt, \
sc->master->index, sc->alias, sc->position, ##args)

Convenience macro for printing configuration-specific warnings to syslog.

This will print the message in fmt with a prefixed "EtherCAT <INDEX> <ALIAS>:<POSITION>: ", where INDEX is the master index and ALIAS and POSITION identify the configuration.

Parameters
scEtherCAT slave configuration
fmtformat string (like in printf())
argsarguments (optional)

Definition at line 82 of file slave_config.h.

◆ EC_CONFIG_DBG

#define EC_CONFIG_DBG (   sc,
  level,
  fmt,
  args... 
)
Value:
do { \
if (sc->master->debug_level >= level) { \
printk(KERN_DEBUG "EtherCAT DEBUG %u %u:%u: " fmt, \
sc->master->index, sc->alias, sc->position, ##args); \
} \
} while (0)

Convenience macro for printing configuration-specific debug messages to syslog.

This will print the message in fmt with a prefixed "EtherCAT <INDEX> <ALIAS>:<POSITION>: ", where INDEX is the master index and ALIAS and POSITION identify the configuration.

Parameters
scEtherCAT slave configuration
levelDebug level. Master's debug level must be >= level for output.
fmtformat string (like in printf())
argsarguments (optional)

Definition at line 99 of file slave_config.h.

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 72 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 126 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 254 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 418 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 440 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 462 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 484 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 506 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 528 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 550 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 572 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 594 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 616 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 638 of file slave_config.c.

◆ ec_slave_config_al_timeout()

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.

Returns
Search result, or 0.

Definition at line 661 of file slave_config.c.