36 #include <linux/module.h> 37 #include <linux/jiffies.h> 38 #include <linux/slab.h> 46 #define EC_SOE_REQUEST_RESPONSE_TIMEOUT 1000 60 INIT_LIST_HEAD(&req->
list);
68 req->
state = EC_INT_REQUEST_INIT;
155 if (size <= req->mem_size)
160 if (!(req->
data = (uint8_t *) kmalloc(size, GFP_KERNEL))) {
161 EC_ERR(
"Failed to allocate %zu bytes of SoE memory.\n", size);
181 const uint8_t *source,
189 memcpy(req->
data, source, size);
205 const uint8_t *source,
211 uint8_t *new_data = (uint8_t *) kmalloc(new_size, GFP_KERNEL);
213 EC_ERR(
"Failed to allocate %zu bytes of SoE memory.\n",
219 req->
data = new_data;
237 req->
state = EC_INT_REQUEST_QUEUED;
250 req->
state = EC_INT_REQUEST_QUEUED;
unsigned long jiffies_sent
Jiffies, when the upload/download request was sent.
void ec_soe_request_set_idn(ec_soe_request_t *req, uint16_t idn)
Set IDN.
uint8_t * data
Pointer to SDO data.
struct list_head list
List item.
void ec_soe_request_read(ec_soe_request_t *req)
Request a read operation.
ec_internal_request_state_t state
Request state.
uint16_t error_code
SoE error code.
uint8_t drive_no
Drive number.
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.
void ec_soe_request_set_drive_no(ec_soe_request_t *req, uint8_t drive_no)
Set drive number.
size_t data_size
Size of SDO data.
void ec_soe_request_clear(ec_soe_request_t *req)
SoE request destructor.
ec_direction_t dir
Direction.
void ec_soe_request_clear_data(ec_soe_request_t *)
Free allocated memory.
Values read by the master.
int ec_soe_request_append_data(ec_soe_request_t *req, const uint8_t *source, size_t size)
Copies SoE data from an external source.
int ec_soe_request_alloc(ec_soe_request_t *req, size_t size)
Pre-allocates the data memory.
ec_al_state_t al_state
AL state (only valid for IDN config).
size_t mem_size
Size of SDO data memory.
#define EC_ERR(fmt, args...)
Convenience macro for printing EtherCAT-specific errors to syslog.
EtherCAT SoE request structure.
void ec_soe_request_write(ec_soe_request_t *req)
Request a write operation.
void ec_soe_request_init(ec_soe_request_t *req)
SoE request constructor.
uint16_t idn
Sercos ID-Number.
Values written by the master.
int ec_soe_request_copy(ec_soe_request_t *req, const ec_soe_request_t *other)
Copy another SoE request.
Sercos-over-EtherCAT request.