41 const struct list_head *);
96 printk(KERN_CONT
"Currently mapped PDO entries: ");
98 printk(KERN_CONT
". Entries to map: ");
100 printk(KERN_CONT
"\n");
137 EC_SLAVE_DBG(slave, 1,
"Changing mapping of PDO 0x%04X.\n",
170 fsm->
state(fsm, datagram);
222 "Failed to read number of mapped PDO entries.\n");
229 " SDO 0x%04X:%02X.\n",
289 " uploading SDO 0x%04X:%02X.\n",
294 uint32_t pdo_entry_info;
307 pdo_entry->
index = pdo_entry_info >> 16;
308 pdo_entry->
subindex = (pdo_entry_info >> 8) & 0xFF;
309 pdo_entry->
bit_length = pdo_entry_info & 0xFF;
321 "PDO entry 0x%04X:%02X, %u bit, \"%s\".\n",
324 pdo_entry->
name ? pdo_entry->
name :
"???");
371 const struct list_head *list
427 " at position %u.\n",
459 " 0x%04X:%02X (%u bit) to position %u.\n",
ec_pdo_t * target_pdo
PDO to read the mapping for.
void(* state)(ec_fsm_pdo_entry_t *, ec_datagram_t *)
state function
unsigned int entry_pos
Position in PDO mapping.
int ecrt_sdo_request_write(ec_sdo_request_t *req)
Schedule an SDO write operation.
#define EC_SLAVE_DBG(slave, level, fmt, args...)
Convenience macro for printing slave-specific debug messages to syslog.
void ec_fsm_pdo_entry_conf_state_set_entry_count(ec_fsm_pdo_entry_t *, ec_datagram_t *)
Set the number of entries.
#define EC_SLAVE_WARN(slave, fmt, args...)
Convenience macro for printing slave-specific warnings to syslog.
int ecrt_sdo_request_read(ec_sdo_request_t *req)
Schedule an SDO read operation.
#define EC_WRITE_U8(DATA, VAL)
Write an 8-bit unsigned value to EtherCAT data.
const ec_pdo_entry_t * entry
Current entry.
void ec_fsm_pdo_entry_read_state_entry(ec_fsm_pdo_entry_t *, ec_datagram_t *)
Read PDO entry information.
void ec_fsm_pdo_entry_start_reading(ec_fsm_pdo_entry_t *fsm, ec_slave_t *slave, ec_pdo_t *pdo)
Start reading a PDO's entries.
void ec_pdo_clear_entries(ec_pdo_t *pdo)
Clear PDO entry list.
uint8_t * data
Pointer to SDO data.
int ec_fsm_coe_success(const ec_fsm_coe_t *fsm)
Returns, if the state machine terminated with success.
void ec_fsm_pdo_entry_state_end(ec_fsm_pdo_entry_t *, ec_datagram_t *)
State: END.
void ec_fsm_pdo_entry_start_configuration(ec_fsm_pdo_entry_t *fsm, ec_slave_t *slave, const ec_pdo_t *pdo, const ec_pdo_t *cur_pdo)
Start PDO mapping state machine.
unsigned int entry_count
Number of entries.
Global definitions and macros.
EtherCAT master structure.
const ec_pdo_t * source_pdo
PDO with desired mapping.
uint16_t index
PDO entry index.
void ec_sdo_request_clear(ec_sdo_request_t *req)
SDO request destructor.
int ecrt_sdo_request_index(ec_sdo_request_t *req, uint16_t index, uint8_t subindex)
Set the SDO index and subindex.
EtherCAT PDO entry configuration state machine structures.
const ec_pdo_t * cur_pdo
PDO with current mapping (display only).
void ec_fsm_pdo_entry_state_error(ec_fsm_pdo_entry_t *, ec_datagram_t *)
State: ERROR.
#define EC_WRITE_U32(DATA, VAL)
Write a 32-bit unsigned value to EtherCAT data.
ec_fsm_coe_t * fsm_coe
CoE state machine to use.
void ec_pdo_entry_clear(ec_pdo_entry_t *entry)
PDO entry destructor.
void ec_fsm_pdo_entry_conf_action_map(ec_fsm_pdo_entry_t *, ec_datagram_t *)
Starts to add a PDO entry.
int ec_fsm_pdo_entry_success(const ec_fsm_pdo_entry_t *fsm)
Get execution result.
unsigned int debug_level
Master debug level.
#define EC_SLAVE_ERR(slave, fmt, args...)
Convenience macro for printing slave-specific errors to syslog.
void ec_fsm_pdo_entry_read_state_start(ec_fsm_pdo_entry_t *, ec_datagram_t *)
Request reading the number of mapped PDO entries.
uint8_t bit_length
entry length in bit
int ec_fsm_pdo_entry_exec(ec_fsm_pdo_entry_t *fsm, ec_datagram_t *datagram)
Executes the current state.
void ec_fsm_pdo_entry_conf_state_map_entry(ec_fsm_pdo_entry_t *, ec_datagram_t *)
Add a PDO entry.
void ec_fsm_pdo_entry_conf_state_start(ec_fsm_pdo_entry_t *, ec_datagram_t *)
Start PDO mapping.
#define EC_READ_U32(DATA)
Read a 32-bit unsigned value from EtherCAT data.
struct list_head entries
List of PDO entries.
ec_master_t * master
Master owning the slave.
void ec_pdo_entry_init(ec_pdo_entry_t *entry)
PDO entry constructor.
uint8_t subindex
PDO entry subindex.
void ec_fsm_pdo_entry_print(const ec_fsm_pdo_entry_t *)
Print the current and desired PDO mapping.
uint8_t subindex
SDO subindex.
void ec_fsm_pdo_entry_init(ec_fsm_pdo_entry_t *fsm, ec_fsm_coe_t *fsm_coe)
Constructor.
size_t data_size
Size of SDO data.
void ec_sdo_request_init(ec_sdo_request_t *req)
SDO request constructor.
ec_pdo_entry_t * ec_fsm_pdo_entry_conf_next_entry(const ec_fsm_pdo_entry_t *, const struct list_head *)
Process next PDO entry.
int ec_fsm_coe_exec(ec_fsm_coe_t *fsm, ec_datagram_t *datagram)
Executes the current state of the state machine.
ec_slave_t * slave
Slave the FSM runs on.
void ec_pdo_print_entries(const ec_pdo_t *pdo)
Outputs the PDOs in the list.
struct list_head list
list item
#define EC_READ_U8(DATA)
Read an 8-bit unsigned value from EtherCAT data.
void ec_fsm_pdo_entry_read_state_count(ec_fsm_pdo_entry_t *, ec_datagram_t *)
Read number of mapped PDO entries.
PDO configuration state machine.
EtherCAT slave configuration structure.
void ec_fsm_pdo_entry_clear(ec_fsm_pdo_entry_t *fsm)
Destructor.
void ec_fsm_coe_transfer(ec_fsm_coe_t *fsm, ec_slave_t *slave, ec_sdo_request_t *request)
Starts to transfer an SDO to/from a slave.
int ec_sdo_request_alloc(ec_sdo_request_t *req, size_t size)
Pre-allocates the data memory.
int ec_fsm_pdo_entry_running(const ec_fsm_pdo_entry_t *)
Get running state.
int ec_pdo_entry_set_name(ec_pdo_entry_t *entry, const char *name)
Set PDO entry name.
void ec_fsm_pdo_entry_read_action_next(ec_fsm_pdo_entry_t *, ec_datagram_t *)
Read next PDO entry.
void ec_fsm_pdo_entry_conf_state_zero_entry_count(ec_fsm_pdo_entry_t *, ec_datagram_t *)
Set the number of mapped entries to zero.
Finite state machines for the CANopen over EtherCAT protocol.
ec_sdo_request_t request
SDO request.