EtherCAT slave structure.
More...
Go to the source code of this file.
|
| #define | EC_SLAVE_INFO(slave, fmt, args...) |
| | Convenience macro for printing slave-specific information to syslog.
|
| #define | EC_SLAVE_ERR(slave, fmt, args...) |
| | Convenience macro for printing slave-specific errors to syslog.
|
| #define | EC_SLAVE_WARN(slave, fmt, args...) |
| | Convenience macro for printing slave-specific warnings to syslog.
|
| #define | EC_SLAVE_DBG(slave, level, fmt, args...) |
| | Convenience macro for printing slave-specific debug messages to syslog.
|
|
| void | ec_slave_init (ec_slave_t *, ec_master_t *, ec_device_index_t, uint16_t, uint16_t) |
| | Slave constructor.
|
| void | ec_slave_clear (ec_slave_t *) |
| | Slave destructor.
|
| void | ec_slave_clear_sync_managers (ec_slave_t *) |
| | Clear the sync manager array.
|
| void | ec_slave_request_state (ec_slave_t *, ec_slave_state_t) |
| | Request a slave state and resets the error flag.
|
| void | ec_slave_set_state (ec_slave_t *, ec_slave_state_t) |
| | Sets the application state of a slave.
|
| int | ec_slave_analyze_sii_data (ec_slave_t *) |
| | Analyzes SII data.
|
| ec_sync_t * | ec_slave_get_sync (ec_slave_t *, uint8_t) |
| | Get the sync manager given an index.
|
| 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.
|
| ec_sdo_t * | ec_slave_get_sdo (ec_slave_t *, uint16_t) |
| | Get an SDO from the dictionary.
|
| const ec_sdo_t * | ec_slave_get_sdo_const (const ec_slave_t *, uint16_t) |
| | Get an SDO from the dictionary.
|
| 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.
|
| uint16_t | ec_slave_sdo_count (const ec_slave_t *) |
| | Get the number of SDOs in the dictionary.
|
| const ec_pdo_t * | ec_slave_find_pdo (const ec_slave_t *, uint16_t) |
| | Finds a mapped PDO.
|
| void | ec_slave_attach_pdo_names (ec_slave_t *) |
| | Attach PDO names.
|
| void | ec_slave_calc_port_delays (ec_slave_t *) |
| | Calculates the port transmission delays.
|
| void | ec_slave_calc_transmission_delays_rec (ec_slave_t *, ec_slave_t *, uint32_t *) |
| | Recursively calculates transmission delays.
|
| void | ec_read_mbox_lock_clear (ec_slave_t *) |
| | Clears the mailbox lock.
|
| int | ec_read_mbox_locked (ec_slave_t *) |
| | Return the current mailbox lock status and lock it if not locked.
|
EtherCAT slave structure.
Definition in file slave.h.
◆ EC_SLAVE_INFO
| #define EC_SLAVE_INFO |
( |
| slave, |
|
|
| fmt, |
|
|
| args... ) |
Value:printk(KERN_INFO "EtherCAT %u-%u: " fmt, slave->master->index, \
slave->ring_position, ##args)
Convenience macro for printing slave-specific information to syslog.
This will print the message in fmt with a prefixed "EtherCAT <INDEX>-<POSITION>: ", where INDEX is the master index and POSITION is the slave's ring position.
- Parameters
-
| slave | EtherCAT slave |
| fmt | format string (like in printf()) |
| args | arguments (optional) |
Definition at line 56 of file slave.h.
◆ EC_SLAVE_ERR
| #define EC_SLAVE_ERR |
( |
| slave, |
|
|
| fmt, |
|
|
| args... ) |
Value:printk(KERN_ERR "EtherCAT ERROR %u-%u: " fmt, slave->master->index, \
slave->ring_position, ##args)
Convenience macro for printing slave-specific errors to syslog.
This will print the message in fmt with a prefixed "EtherCAT <INDEX>-<POSITION>: ", where INDEX is the master index and POSITION is the slave's ring position.
- Parameters
-
| slave | EtherCAT slave |
| fmt | format string (like in printf()) |
| args | arguments (optional) |
Definition at line 70 of file slave.h.
◆ EC_SLAVE_WARN
| #define EC_SLAVE_WARN |
( |
| slave, |
|
|
| fmt, |
|
|
| args... ) |
Value:printk(KERN_WARNING "EtherCAT WARNING %u-%u: " fmt, \
slave->master->index, slave->ring_position, ##args)
Convenience macro for printing slave-specific warnings to syslog.
This will print the message in fmt with a prefixed "EtherCAT <INDEX>-<POSITION>: ", where INDEX is the master index and POSITION is the slave's ring position.
- Parameters
-
| slave | EtherCAT slave |
| fmt | format string (like in printf()) |
| args | arguments (optional) |
Definition at line 84 of file slave.h.
◆ EC_SLAVE_DBG
| #define EC_SLAVE_DBG |
( |
| slave, |
|
|
| level, |
|
|
| fmt, |
|
|
| args... ) |
Value:do { \
if (slave->master->debug_level >= level) { \
printk(KERN_DEBUG "EtherCAT DEBUG %u-%u: " fmt, \
slave->master->index, slave->ring_position, ##args); \
} \
} while (0)
Convenience macro for printing slave-specific debug messages to syslog.
This will print the message in fmt with a prefixed "EtherCAT <INDEX>-<POSITION>: ", where INDEX is the master index and POSITION is the slave's ring position.
- Parameters
-
| slave | EtherCAT slave |
| level | Debug level. Master's debug level must be >= level for output. |
| fmt | format string (like in printf()) |
| args | arguments (optional) |
Definition at line 100 of file slave.h.
◆ ec_slave_init()
Slave constructor.
- Returns
- 0 in case of success, else < 0
- Parameters
-
| slave | EtherCAT slave |
| master | EtherCAT master |
| dev_idx | Device index. |
| ring_position | ring position |
| station_address | station address to configure |
Definition at line 65 of file slave.c.
◆ ec_slave_clear()
Slave destructor.
Clears and frees a slave object.
- Parameters
-
Definition at line 213 of file slave.c.
◆ ec_slave_clear_sync_managers()
| void ec_slave_clear_sync_managers |
( |
ec_slave_t * | slave | ) |
|
Clear the sync manager array.
- Parameters
-
Definition at line 316 of file slave.c.
◆ ec_slave_request_state()
Request a slave state and resets the error flag.
- Parameters
-
| slave | EtherCAT slave |
| state | new state |
Definition at line 357 of file slave.c.
◆ ec_slave_set_state()
Sets the application state of a slave.
- Parameters
-
| slave | EtherCAT slave |
| new_state | new application state |
Definition at line 335 of file slave.c.
◆ ec_slave_analyze_sii_data()
| int ec_slave_analyze_sii_data |
( |
ec_slave_t * | slave | ) |
|
Analyzes SII data.
- Returns
- 0 in case of success, else < 0
- Parameters
-
Definition at line 372 of file slave.c.
◆ ec_slave_get_sync()
Get the sync manager given an index.
- Returns
- pointer to sync manager, or NULL.
- Parameters
-
| slave | EtherCAT slave. |
| sync_index | Sync manager index. |
Definition at line 864 of file slave.c.
◆ ec_slave_sdo_dict_info()
| void ec_slave_sdo_dict_info |
( |
const ec_slave_t * | slave, |
|
|
unsigned int * | sdo_count, |
|
|
unsigned int * | entry_count ) |
Counts the total number of SDOs and entries in the dictionary.
- Parameters
-
| slave | EtherCAT slave |
| sdo_count | number of SDOs |
| entry_count | total number of entries |
Definition at line 882 of file slave.c.
◆ ec_slave_get_sdo()
Get an SDO from the dictionary.
- Returns
- The desired SDO, or NULL.
- Parameters
-
| slave | EtherCAT slave |
| index | SDO index |
Definition at line 910 of file slave.c.
◆ ec_slave_get_sdo_const()
Get an SDO from the dictionary.
const version.
- Returns
- The desired SDO, or NULL.
- Parameters
-
| slave | EtherCAT slave |
| index | SDO index |
Definition at line 936 of file slave.c.
◆ ec_slave_get_sdo_by_pos_const()
| const ec_sdo_t * ec_slave_get_sdo_by_pos_const |
( |
const ec_slave_t * | slave, |
|
|
uint16_t | sdo_position ) |
Get an SDO from the dictionary, given its position in the list.
- Returns
- The desired SDO, or NULL.
- Parameters
-
| slave | EtherCAT slave. |
| sdo_position | SDO list position. |
Definition at line 958 of file slave.c.
◆ ec_slave_sdo_count()
| uint16_t ec_slave_sdo_count |
( |
const ec_slave_t * | slave | ) |
|
Get the number of SDOs in the dictionary.
- Returns
- SDO count.
- Parameters
-
Definition at line 980 of file slave.c.
◆ ec_slave_find_pdo()
Finds a mapped PDO.
- Returns
- The desired PDO object, or NULL.
- Parameters
-
| slave | Slave. |
| index | PDO index to find. |
Definition at line 999 of file slave.c.
◆ ec_slave_attach_pdo_names()
| void ec_slave_attach_pdo_names |
( |
ec_slave_t * | slave | ) |
|
Attach PDO names.
Definition at line 1055 of file slave.c.
◆ ec_slave_calc_port_delays()
| void ec_slave_calc_port_delays |
( |
ec_slave_t * | slave | ) |
|
Calculates the port transmission delays.
- Parameters
-
Definition at line 1196 of file slave.c.
◆ ec_slave_calc_transmission_delays_rec()
| void ec_slave_calc_transmission_delays_rec |
( |
ec_slave_t * | slave, |
|
|
ec_slave_t * | came_from, |
|
|
uint32_t * | delay ) |
Recursively calculates transmission delays.
- Parameters
-
| slave | Current slave. |
| came_from | DC slave we recursed in from (NULL at the reference clock). |
| delay | Sum of delays. |
Definition at line 1242 of file slave.c.
◆ ec_read_mbox_lock_clear()
| void ec_read_mbox_lock_clear |
( |
ec_slave_t * | slave | ) |
|
Clears the mailbox lock.
Lock-free, so that it can be called from any context (also from realtime context, e. g. via ecrt_voe_handler_execute()).
Definition at line 187 of file slave.c.
◆ ec_read_mbox_locked()
Return the current mailbox lock status and lock it if not locked.
Lock-free, see ec_read_mbox_lock_clear().
- Returns
- Non-zero, if the lock was already taken.
Definition at line 201 of file slave.c.