39 #include <linux/module.h> 40 #include <linux/slab.h> 122 list_for_each_entry_safe(req, next_req, &sc->
sdo_configs, list) {
123 list_del(&req->
list);
129 list_for_each_entry_safe(req, next_req, &sc->
sdo_requests, list) {
130 list_del(&req->
list);
136 list_for_each_entry_safe(foe, next_foe, &sc->
foe_requests, list) {
137 list_del(&foe->
list);
143 list_for_each_entry_safe(reg, next_reg, &sc->
reg_requests, list) {
144 list_del(®->
list);
150 list_for_each_entry_safe(voe, next_voe, &sc->
voe_handlers, list) {
151 list_del(&voe->
list);
157 list_for_each_entry_safe(soe, next_soe, &sc->
soe_configs, list) {
158 list_del(&soe->
list);
207 #if 0 //TODO overlapping PDOs 212 fmmu_logical_start_address = domain->tx_size;
221 if (fmmu->
dir != prev_fmmu->dir && prev_fmmu->tx_size != 0) {
224 old_prev_tx_size = prev_fmmu->tx_size;
225 prev_fmmu->tx_size = max(fmmu->
data_size, prev_fmmu->data_size);
226 domain->tx_size += prev_fmmu->tx_size - old_prev_tx_size;
228 fmmu_logical_start_address = prev_fmmu->logical_domain_offset;
232 ec_fmmu_config_domain(fmmu, domain, fmmu_logical_start_address, tx_size);
260 EC_CONFIG_DBG(sc, 1,
"Failed to find slave for configuration.\n");
265 EC_CONFIG_DBG(sc, 1,
"Failed to attach configuration. Slave %s-%u" 266 " already has a configuration!\n",
277 #ifdef EC_IDENT_WILDCARDS
282 EC_CONFIG_DBG(sc, 1,
"Slave %s-%u has no matching vendor ID (0x%08X)" 283 " for configuration (0x%08X).\n",
290 #ifdef EC_IDENT_WILDCARDS
295 EC_CONFIG_DBG(sc, 1,
"Slave %s-%u has no matching product code (0x%08X)" 296 " for configuration (0x%08X).\n",
329 " slave is detaching.\n");
330 reg->
state = EC_INT_REQUEST_FAILURE;
359 "SM%u has an invalid direction field!\n", sync_index);
381 EC_CONFIG_DBG(sc, 1,
"Loading default mapping for PDO 0x%04X.\n",
393 list_for_each_entry(default_pdo, &sync->
pdos.
list, list) {
397 if (default_pdo->
name) {
411 list_for_each_entry(entry, &pdo->
entries, list) {
435 unsigned int count = 0;
479 unsigned int count = 0;
612 if (sc->
slave) {
return; }
615 if (sdo_req->
state == EC_INT_REQUEST_QUEUED ||
616 sdo_req->
state == EC_INT_REQUEST_BUSY) {
617 EC_CONFIG_DBG(sc, 1,
"Aborting SDO request; no slave attached.\n");
618 sdo_req->
state = EC_INT_REQUEST_FAILURE;
623 if (foe_req->
state == EC_INT_REQUEST_QUEUED ||
624 foe_req->
state == EC_INT_REQUEST_BUSY) {
625 EC_CONFIG_DBG(sc, 1,
"Aborting FoE request; no slave attached.\n");
626 foe_req->
state = EC_INT_REQUEST_FAILURE;
631 if (reg_req->
state == EC_INT_REQUEST_QUEUED ||
632 reg_req->
state == EC_INT_REQUEST_BUSY) {
633 EC_CONFIG_DBG(sc, 1,
"Aborting register request; no slave attached.\n");
634 reg_req->
state = EC_INT_REQUEST_FAILURE;
648 EC_CONFIG_DBG(sc, 1,
"ecrt_slave_config_sync_manager(sc = 0x%p," 649 " sync_index = %u, dir = %i, watchdog_mode = %i)\n",
650 sc, sync_index, dir, watchdog_mode);
653 EC_CONFIG_ERR(sc,
"Invalid sync manager index %u!\n", sync_index);
658 EC_CONFIG_ERR(sc,
"Invalid direction %u!\n", (
unsigned int) dir);
663 sync_config->
dir = dir;
671 uint16_t divider, uint16_t intervals)
673 EC_CONFIG_DBG(sc, 1,
"%s(sc = 0x%p, divider = %u, intervals = %u)\n",
674 __func__, sc, divider, intervals);
683 uint8_t allow_overlapping_pdos )
685 EC_CONFIG_DBG(sc, 1,
"%s(sc = 0x%p, allow_overlapping_pdos = %u)\n",
686 __func__, sc, allow_overlapping_pdos);
694 uint8_t sync_index, uint16_t pdo_index)
699 "pdo_index = 0x%04X)\n", __func__, sc, sync_index, pdo_index);
702 EC_CONFIG_ERR(sc,
"Invalid sync manager index %u!\n", sync_index);
727 __func__, sc, sync_index);
730 EC_CONFIG_ERR(sc,
"Invalid sync manager index %u!\n", sync_index);
742 uint16_t pdo_index, uint16_t entry_index, uint8_t entry_subindex,
743 uint8_t entry_bit_length)
751 "pdo_index = 0x%04X, entry_index = 0x%04X, " 752 "entry_subindex = 0x%02X, entry_bit_length = %u)\n",
753 __func__, sc, pdo_index, entry_index, entry_subindex,
767 retval = PTR_ERR(entry);
769 EC_CONFIG_ERR(sc,
"PDO 0x%04X is not assigned.\n", pdo_index);
785 __func__, sc, pdo_index);
807 unsigned int i, j, k;
812 EC_CONFIG_DBG(sc, 1,
"%s(sc = 0x%p, n_syncs = %u, syncs = 0x%p)\n",
813 __func__, sc, n_syncs, syncs);
818 for (i = 0; i < n_syncs; i++) {
819 sync_info = &syncs[i];
839 for (j = 0; j < sync_info->
n_pdos; j++) {
840 pdo_info = &sync_info->
pdos[j];
850 for (k = 0; k < pdo_info->
n_entries; k++) {
851 entry_info = &pdo_info->
entries[k];
875 unsigned int *bit_position
880 unsigned int bit_offset, bit_pos;
886 "subindex = 0x%02X, domain = 0x%p, bit_position = 0x%p)\n",
887 __func__, sc, index, subindex, domain, bit_position);
893 list_for_each_entry(pdo, &sync_config->
pdos.
list, list) {
894 list_for_each_entry(entry, &pdo->
entries, list) {
898 bit_pos = bit_offset % 8;
900 *bit_position = bit_pos;
901 }
else if (bit_pos) {
903 " not byte-align.\n", index, subindex);
908 sc, domain, sync_index, sync_config->
dir);
912 return sync_offset + bit_offset / 8;
928 unsigned int pdo_pos,
929 unsigned int entry_pos,
931 unsigned int *bit_position
935 unsigned int bit_offset, pp, ep;
939 EC_CONFIG_DBG(sc, 1,
"%s(sc = 0x%p, sync_index = %u, pdo_pos = %u," 940 " entry_pos = %u, domain = 0x%p, bit_position = 0x%p)\n",
941 __func__, sc, sync_index, pdo_pos, entry_pos,
942 domain, bit_position);
945 EC_CONFIG_ERR(sc,
"Invalid syncmanager position %u.\n", sync_index);
953 list_for_each_entry(pdo, &sync_config->
pdos.
list, list) {
955 list_for_each_entry(entry, &pdo->
entries, list) {
956 if (pp != pdo_pos || ep != entry_pos) {
959 unsigned int bit_pos = bit_offset % 8;
963 *bit_position = bit_pos;
964 }
else if (bit_pos) {
966 " not byte-align.\n",
972 sc, domain, sync_index, sync_config->
dir);
976 return sync_offset + bit_offset / 8;
983 EC_CONFIG_ERR(sc,
"PDO entry specification %u/%u/%u out of range.\n",
984 sync_index, pdo_pos, entry_pos);
991 uint32_t sync0_cycle_time, int32_t sync0_shift_time,
992 uint32_t sync1_cycle_time, int32_t sync1_shift_time)
994 EC_CONFIG_DBG(sc, 1,
"%s(sc = 0x%p, assign_activate = 0x%04X," 995 " sync0_cycle = %u, sync0_shift = %i," 996 " sync1_cycle = %u, sync1_shift = %i\n",
997 __func__, sc, assign_activate, sync0_cycle_time, sync0_shift_time,
998 sync1_cycle_time, sync1_shift_time);
1003 if (sync0_cycle_time > 0)
1010 "sync1 cycle. Resetting to zero cycle and shift time\n");
1027 uint8_t subindex,
const uint8_t *data,
size_t size)
1034 "subindex = 0x%02X, data = 0x%p, size = %zu)\n",
1035 __func__, sc, index, subindex, data, size);
1044 " SDO configuration!\n");
1067 uint8_t subindex, uint8_t value)
1072 "subindex = 0x%02X, value = %u)\n",
1073 __func__, sc, index, subindex, (
unsigned int) value);
1082 uint8_t subindex, uint16_t value)
1087 "subindex = 0x%02X, value = %u)\n",
1088 __func__, sc, index, subindex, value);
1097 uint8_t subindex, uint32_t value)
1102 "subindex = 0x%02X, value = %u)\n",
1103 __func__, sc, index, subindex, value);
1112 const uint8_t *data,
size_t size)
1119 "data = 0x%p, size = %zu)\n", __func__, sc, index, data, size);
1128 " SDO configuration!\n");
1182 ec_slave_config_t *sc, uint16_t index, uint8_t subindex, uint8_t complete,
size_t size)
1188 "index = 0x%04X, subindex = 0x%02X, complete = %u, size = %zu)\n",
1189 __func__, sc, index, subindex, complete, size);
1193 EC_CONFIG_ERR(sc,
"Failed to allocate SDO request memory!\n");
1194 return ERR_PTR(-ENOMEM);
1208 return ERR_PTR(ret);
1212 memset(req->
data, 0x00, size);
1229 return IS_ERR(s) ? NULL : s;
1239 return IS_ERR(s) ? NULL : s;
1254 __func__, sc, size);
1258 EC_CONFIG_ERR(sc,
"Failed to allocate FoE request memory!\n");
1259 return ERR_PTR(-ENOMEM);
1269 "memory (size=%zu)!\n", size);
1270 return ERR_PTR(ret);
1274 memset(req->
buffer, 0x00, size);
1290 return IS_ERR(s) ? NULL : s;
1305 __func__, sc, size);
1309 EC_CONFIG_ERR(sc,
"Failed to allocate register request memory!\n");
1310 return ERR_PTR(-ENOMEM);
1316 return ERR_PTR(ret);
1333 return IS_ERR(reg) ? NULL : reg;
1347 EC_CONFIG_DBG(sc, 1,
"%s(sc = 0x%p, size = %zu)\n", __func__, sc, size);
1351 EC_CONFIG_ERR(sc,
"Failed to allocate VoE request memory!\n");
1352 return ERR_PTR(-ENOMEM);
1358 return ERR_PTR(ret);
1375 return IS_ERR(voe) ? NULL : voe;
1411 EC_CONFIG_DBG(sc, 1,
"%s(sc = 0x%p, drive_no = %u, idn = 0x%04X, " 1412 "state = %u, data = 0x%p, size = %zu)\n",
1413 __func__, sc, drive_no, idn, state, data, size);
1417 (
unsigned int) drive_no);
1423 " must be PREOP or SAFEOP!\n");
1434 " IDN configuration!\n");
ec_internal_request_state_t state
Request state.
uint16_t ring_position
Ring position.
struct list_head sdo_configs
List of SDO configurations.
void ecrt_sdo_request_index_complete(ec_sdo_request_t *req, uint16_t index)
Set the SDO index and prepare for complete-access.
int ecrt_slave_config_emerg_size(ec_slave_config_t *sc, size_t elements)
Set the size of the CoE emergency ring buffer.
void ec_soe_request_set_idn(ec_soe_request_t *req, uint16_t idn)
Set IDN.
ec_foe_request_t * ecrt_slave_config_create_foe_request(ec_slave_config_t *sc, size_t size)
Create an FoE request to exchange files during realtime operation.
ec_sdo_request_t * ecrt_slave_config_create_sdo_request_err(ec_slave_config_t *sc, uint16_t index, uint8_t subindex, uint8_t complete, size_t size)
Same as ecrt_slave_config_create_sdo_request(), but with ERR_PTR() return value.
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.
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.
uint32_t logical_domain_offset
Logical offset address relative to domain->logical_base_address.
unsigned int n_entries
Number of PDO entries in entries to map.
uint8_t bit_length
Size of the PDO entry in bit.
ec_direction_t dir
Sync manager direction.
ec_watchdog_mode_t
Watchdog mode for sync manager configuration.
struct list_head list
List item.
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.
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_al_state_t
Application-layer state.
Servo-Profile over EtherCAT.
int32_t shift_time
Shift time [ns].
OP (mailbox communication and input/output update)
ec_reg_request_t * reg_request
Register request to process.
ec_pdo_info_t * pdos
Array with PDOs to assign.
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.
struct list_head foe_requests
List of FoE requests.
int ec_pdo_list_copy(ec_pdo_list_t *pl, const ec_pdo_list_t *other)
Makes a deep copy of another PDO list.
void ec_foe_request_init(ec_foe_request_t *req)
FoE request constructor.
int ec_fsm_slave_is_ready(const ec_fsm_slave_t *fsm)
Returns, if the FSM is currently not busy and ready to execute.
ec_slave_state_t current_state
Current application state.
ec_internal_request_state_t state
SDO request state.
uint8_t used_fmmus
Number of FMMUs used.
uint32_t product_code
Slave product code.
uint16_t position
Index after alias.
#define EC_SLAVE_WARN(slave, fmt, args...)
Convenience macro for printing slave-specific warnings to syslog.
void ec_sync_config_clear(ec_sync_config_t *sync_config)
Destructor.
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.
void ec_fmmu_config_init(ec_fmmu_config_t *fmmu, ec_slave_config_t *sc, ec_domain_t *domain, uint8_t sync_index, ec_direction_t dir)
FMMU configuration constructor.
struct list_head list
List of PDOs.
int ec_foe_request_alloc(ec_foe_request_t *req, size_t size)
Pre-allocates the data memory.
ec_master_t * master
Master owning the slave configuration.
int ec_reg_request_init(ec_reg_request_t *reg, size_t size)
Register request constructor.
int ec_pdo_set_name(ec_pdo_t *pdo, const char *name)
Set PDO name.
#define EC_WRITE_U8(DATA, VAL)
Write an 8-bit unsigned value to EtherCAT data.
unsigned int data_size
Covered PDO size.
size_t data_size
Size of FoE data.
uint16_t alias
Slave alias.
void ec_pdo_list_clear_pdos(ec_pdo_list_t *pl)
Clears the list of mapped PDOs.
void ec_pdo_clear_entries(ec_pdo_t *pdo)
Clear PDO entry list.
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.
uint32_t cycle_time
Cycle time [ns].
ec_fsm_slave_t fsm
Slave state machine.
PDO configuration information.
#define EC_CONFIG_ERR(sc, fmt, args...)
Convenience macro for printing configuration-specific errors to syslog.
unsigned int ready
The slave is ready for external requests.
uint8_t * data
Pointer to SDO data.
ec_slave_t * ec_master_find_slave(ec_master_t *master, uint16_t alias, uint16_t position)
Finds a slave in the bus, given the alias and position.
Sync manager configuration information.
struct list_head list
List item.
wait_queue_head_t request_queue
Wait queue for external requests from user space.
int ecrt_slave_config_emerg_clear(ec_slave_config_t *sc)
Clears CoE emergency ring buffer and the overrun counter.
ec_direction_t ec_sync_default_direction(const ec_sync_t *sync)
Determines the default direction from the control register.
const char * ec_device_names[2]
Device names.
unsigned int sync_count
Number of sync managers.
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. ...
#define EC_MAX_FMMUS
Maximum number of FMMUs per slave.
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.
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.
Global definitions and macros.
void ec_coe_emerg_ring_init(ec_coe_emerg_ring_t *ring, ec_slave_config_t *sc)
Emergency ring buffer constructor.
ec_pdo_entry_t * ec_pdo_add_entry(ec_pdo_t *pdo, uint16_t index, uint8_t subindex, uint8_t bit_length)
Add a new PDO entry to the configuration.
EtherCAT master structure.
ec_fmmu_config_t fmmu_configs[EC_MAX_FMMUS]
FMMU configurations.
ec_sync_signal_t dc_sync[EC_SYNC_SIGNAL_COUNT]
DC sync signals.
int8_t sync_index
Assigned sync manager.
int ec_soe_request_copy_data(ec_soe_request_t *req, const uint8_t *source, size_t size)
Copies SoE data from an external source.
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.
ec_sdo_request_t * ecrt_slave_config_create_sdo_request_complete(ec_slave_config_t *sc, uint16_t index, size_t size)
Create an SDO request to exchange SDOs during realtime operation using complete access.
uint16_t index
PDO entry index.
void ec_foe_request_clear(ec_foe_request_t *req)
FoE request destructor.
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_sdo_request_clear(ec_sdo_request_t *req)
SDO request destructor.
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.
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.
const ec_domain_t * domain
Domain.
int ec_sdo_request_copy_data(ec_sdo_request_t *req, const uint8_t *source, size_t size)
Copies SDO data from an external source.
Slave configuration state.
ec_sii_image_t * sii_image
Current complete SII image.
ec_watchdog_mode_t watchdog_mode
Watchdog mode.
ec_sync_config_t sync_configs[EC_MAX_SYNC_MANAGERS]
Sync manager configurations.
unsigned int n_pdos
Number of PDOs in pdos.
ec_slave_config_t * config
Current configuration.
struct list_head reg_requests
List of register requests.
#define EC_WRITE_U32(DATA, VAL)
Write a 32-bit unsigned value to EtherCAT data.
unsigned int al_state
The application-layer state of the slave.
uint8_t * buffer
Pointer to FoE data.
uint8_t sync_index
Index of sync manager to use.
void ec_soe_request_set_drive_no(ec_soe_request_t *req, uint8_t drive_no)
Set drive number.
struct list_head sdo_requests
List of SDO requests.
uint16_t mailbox_protocols
Supported mailbox protocols.
unsigned int error_flag
The slave has an unrecoverable error.
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.
unsigned int debug_level
Master debug level.
uint8_t bit_length
entry length in bit
unsigned int operational
The slave was brought into OP state using the specified configuration.
int ec_coe_emerg_ring_clear_ring(ec_coe_emerg_ring_t *ring)
Clear the ring.
void ec_soe_request_clear(ec_soe_request_t *req)
SoE request destructor.
ec_pdo_list_t pdos
Current PDO assignment.
struct list_head voe_handlers
List of VoE handlers.
uint16_t dc_assign_activate
Vendor-specific AssignActivate word.
#define EC_CONFIG_WARN(sc, fmt, args...)
Convenience macro for printing configuration-specific warnings to syslog.
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.
#define EC_WRITE_U16(DATA, VAL)
Write a 16-bit unsigned value to EtherCAT data.
#define EC_CONFIG_DBG(sc, level, fmt, args...)
Convenience macro for printing configuration-specific debug messages to syslog.
ec_direction_t
Direction type for PDO assignment functions.
struct list_head entries
List of PDO entries.
uint16_t watchdog_intervals
Process data watchdog intervals (see spec.
Vendor specific over EtherCAT handler.
ec_master_t * master
Master owning the slave.
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.
unsigned int ec_slave_config_sdo_count(const ec_slave_config_t *sc)
Get the number of SDO configurations.
ec_pdo_t * ec_pdo_list_add_pdo(ec_pdo_list_t *pl, uint16_t index)
Add a new PDO to the list.
uint16_t position
Offset of the slave in the ring.
uint8_t subindex
PDO entry subindex.
struct list_head list
List item.
Values read by the master.
int ec_slave_config_attach(ec_slave_config_t *sc)
Attaches the configuration to the addressed slave object.
ec_direction_t dir
Sync manager direction.
int ec_voe_handler_init(ec_voe_handler_t *voe, ec_slave_config_t *sc, size_t size)
VoE handler constructor.
ec_slave_t * slave
Slave pointer.
int ec_coe_emerg_ring_overruns(ec_coe_emerg_ring_t *ring)
Read the number of overruns.
unsigned int online
The slave is online.
uint16_t watchdog_divider
Watchdog divider as a number of 40ns intervals (see spec.
ec_sdo_request_t * ec_slave_config_find_sdo_request(ec_slave_config_t *sc, unsigned int pos)
Finds a CoE handler via its position in the list.
ec_al_state_t al_state
AL state (only valid for IDN config).
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_foe_request_t * ec_slave_config_find_foe_request(ec_slave_config_t *sc, unsigned int pos)
Finds an FoE handler via its position in the list.
struct list_head soe_configs
List of SoE configurations.
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.
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_watchdog_mode_t watchdog_mode
Watchdog mode.
int ec_pdo_copy_entries(ec_pdo_t *pdo, const ec_pdo_t *other)
Copy PDO entries from another PDO.
uint8_t allow_overlapping_pdos
Allow input PDOs use the same frame space as output PDOs.
unsigned int ec_slave_config_idn_count(const ec_slave_config_t *sc)
Get the number of IDN configurations.
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.
uint16_t index
PDO entry index.
size_t data_size
Size of SDO data.
ec_lock_t master_sem
Master semaphore.
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.
#define EC_END
End of list marker.
ec_coe_emerg_ring_t emerg_ring
CoE emergency ring buffer.
ec_foe_request_t * ecrt_slave_config_create_foe_request_err(ec_slave_config_t *sc, size_t size)
Same as ecrt_slave_config_create_foe_request(), but with ERR_PTR() return value.
void ecrt_slave_config_pdo_mapping_clear(ec_slave_config_t *sc, uint16_t pdo_index)
Clear the mapping of a given PDO.
Vendor specific over EtherCAT protocol handler.
void ec_sdo_request_init(ec_sdo_request_t *req)
SDO request constructor.
Sync manager configuration.
struct list_head list
List item.
void ec_coe_emerg_ring_clear(ec_coe_emerg_ring_t *ring)
Emergency ring buffer destructor.
uint32_t vendor_id
Slave vendor ID.
ec_pdo_list_t pdos
Current PDO assignment.
void ec_sync_config_init(ec_sync_config_t *sync_config)
Constructor.
void ecrt_slave_config_watchdog(ec_slave_config_t *sc, uint16_t divider, uint16_t intervals)
Configure a slave's watchdog times.
void ecrt_slave_config_overlapping_pdos(ec_slave_config_t *sc, uint8_t allow_overlapping_pdos)
Configure whether a slave allows overlapping PDOs.
void ec_reg_request_clear(ec_reg_request_t *reg)
Register request destructor.
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.
EtherCAT slave configuration.
void ec_soe_request_init(ec_soe_request_t *req)
SoE request constructor.
EtherCAT slave configuration structure.
ec_sii_t sii
Extracted SII data.
ec_device_index_t device_index
Index of device the slave responds on.
void ec_slave_config_detach(ec_slave_config_t *sc)
Detaches the configuration from a slave object.
PDO entry configuration information.
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.
void ecrt_slave_config_pdo_assign_clear(ec_slave_config_t *sc, uint8_t sync_index)
Clear a sync manager's PDO assignment.
int ec_sdo_request_alloc(ec_sdo_request_t *req, size_t size)
Pre-allocates the data memory.
uint32_t product_code
Vendor-specific product code.
uint8_t index
Sync manager index.
ec_direction_t dir
FMMU direction.
void ecrt_slave_config_state(const ec_slave_config_t *sc, ec_slave_config_state_t *state)
Outputs the state of the slave configuration.
void ec_slave_config_clear(ec_slave_config_t *sc)
Slave configuration destructor.
Values written by the master.
ec_pdo_t * ec_pdo_list_find_pdo(const ec_pdo_list_t *pl, uint16_t index)
Finds a PDO with the given index.
unsigned int error_flag
Stop processing after an error.
ec_sync_t * syncs
SYNC MANAGER categories.
struct list_head list
List item.
uint8_t subindex
PDO entry subindex.
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.
#define EC_MAX_SYNC_MANAGERS
Maximum number of sync managers per slave.
void ec_slave_config_load_default_sync_config(ec_slave_config_t *sc)
Loads the default PDO assignment from the slave object.
int ecrt_slave_config_emerg_overruns(ec_slave_config_t *sc)
Read the number of CoE emergency overruns.
int ec_coe_emerg_ring_size(ec_coe_emerg_ring_t *ring, size_t size)
Set the ring size.
void ec_slave_config_expire_disconnected_requests(ec_slave_config_t *sc)
Expires any requests that have been started on a detached slave.
uint32_t vendor_id
Vendor ID.
int ec_coe_emerg_ring_pop(ec_coe_emerg_ring_t *ring, u8 *msg)
Remove an emergency message from the ring.
void ecrt_sdo_request_index(ec_sdo_request_t *req, uint16_t index, uint8_t subindex)
Set the SDO index and subindex and prepare for non-complete-access.
unsigned int force_config
Force (re-)configuration.
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.
ec_internal_request_state_t state
FoE request state.
ec_pdo_entry_info_t * entries
Array of PDO entries to map.
void ec_voe_handler_clear(ec_voe_handler_t *voe)
VoE handler destructor.
Sercos-over-EtherCAT request.
ec_sync_t * ec_slave_get_sync(ec_slave_t *slave, uint8_t sync_index)
Get the sync manager given an index.