34 #include <linux/module.h> 35 #include <linux/jiffies.h> 36 #include <linux/slab.h> 44 #define EC_SDO_REQUEST_RESPONSE_TIMEOUT 1000 65 req->
state = EC_INT_REQUEST_INIT;
132 if (size <= req->mem_size)
137 if (!(req->
data = (uint8_t *) kmalloc(size, GFP_KERNEL))) {
138 EC_ERR(
"Failed to allocate %zu bytes of SDO memory.\n", size);
158 const uint8_t *source,
166 memcpy(req->
data, source, size);
227 req->
state = EC_INT_REQUEST_QUEUED;
238 req->
state = EC_INT_REQUEST_QUEUED;
ec_internal_request_state_t state
SDO request state.
uint32_t response_timeout
Maximum time in ms, the transfer is retried, if the slave does not respond.
size_t mem_size
Size of SDO data memory.
uint32_t abort_code
SDO request abort code.
void ec_sdo_request_clear_data(ec_sdo_request_t *)
SDO request destructor.
int ec_sdo_request_timed_out(const ec_sdo_request_t *req)
Checks, if the timeout was exceeded.
uint8_t * data
Pointer to SDO data.
void ecrt_sdo_request_timeout(ec_sdo_request_t *req, uint32_t timeout)
Set the timeout for an SDO request.
uint8_t * ecrt_sdo_request_data(ec_sdo_request_t *req)
Access to the SDO request's data.
ec_direction_t dir
Direction.
void ecrt_sdo_request_read(ec_sdo_request_t *req)
Schedule an SDO read operation.
void ec_sdo_request_clear(ec_sdo_request_t *req)
SDO request destructor.
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.
EtherCAT CANopen SDO request structure.
unsigned long jiffies_sent
Jiffies, when the upload/download request was sent.
int ec_sdo_request_copy(ec_sdo_request_t *req, const ec_sdo_request_t *other)
Copy another SDO request.
#define EC_SDO_REQUEST_RESPONSE_TIMEOUT
Default timeout in ms to wait for SDO transfer responses.
Values read by the master.
ec_request_state_t ecrt_sdo_request_state(const ec_sdo_request_t *req)
Get the current state of the SDO request.
uint8_t subindex
SDO subindex.
size_t data_size
Size of SDO data.
size_t ecrt_sdo_request_data_size(const ec_sdo_request_t *req)
Returns the current SDO data size.
void ec_sdo_request_init(ec_sdo_request_t *req)
SDO request constructor.
#define EC_ERR(fmt, args...)
Convenience macro for printing EtherCAT-specific errors to syslog.
ec_request_state_t
Request state.
int ec_sdo_request_alloc(ec_sdo_request_t *req, size_t size)
Pre-allocates the data memory.
Values written by the master.
const ec_request_state_t ec_request_state_translation_table[]
Global request state type translation table.
uint32_t issue_timeout
Maximum time in ms, the processing of the request may take.
void ecrt_sdo_request_write(ec_sdo_request_t *req)
Schedule an SDO write operation.
unsigned long jiffies_start
Jiffies, when the request was issued.
uint8_t complete_access
SDO shall be transferred completely.
void ecrt_sdo_request_index(ec_sdo_request_t *req, uint16_t index, uint8_t subindex)
Set the SDO index and subindex.