35 #include <linux/module.h> 36 #include <linux/jiffies.h> 37 #include <linux/slab.h> 38 #include <linux/vmalloc.h> 47 #define EC_FOE_REQUEST_RESPONSE_TIMEOUT 3000 61 INIT_LIST_HEAD(&req->
list);
69 req->
state = EC_INT_REQUEST_INIT;
116 if (size <= req->buffer_size) {
122 if (!(req->
buffer = (uint8_t *) vmalloc(size))) {
123 EC_ERR(
"Failed to allocate %zu bytes of FoE memory.\n", size);
142 const uint8_t *source,
153 memcpy(req->
buffer, source, size);
219 req->
state = EC_INT_REQUEST_QUEUED;
233 req->
state = EC_INT_REQUEST_QUEUED;
ec_direction_t dir
Direction.
int ec_foe_request_timed_out(const ec_foe_request_t *req)
Checks, if the timeout was exceeded.
void ec_foe_request_write(ec_foe_request_t *req)
Prepares a write request (master to slave).
int ec_foe_request_alloc(ec_foe_request_t *req, size_t size)
Pre-allocates the data memory.
uint32_t result
FoE request abort code.
uint32_t response_timeout
Maximum time in ms, the transfer is retried, if the slave does not respond.
void ec_foe_request_timeout(ec_foe_request_t *req, uint32_t timeout)
Set the request timeout.
void ec_foe_request_clear_data(ec_foe_request_t *)
FoE request destructor.
void ec_foe_request_clear(ec_foe_request_t *req)
FoE request destructor.
size_t buffer_size
Size of FoE data memory.
#define EC_FOE_REQUEST_RESPONSE_TIMEOUT
Default timeout in ms to wait for FoE transfer responses.
uint8_t * buffer
Pointer to FoE data.
EtherCAT FoE request structure.
void ec_foe_request_init(ec_foe_request_t *req, uint8_t *file_name)
FoE request constructor.
int ec_foe_request_copy_data(ec_foe_request_t *req, const uint8_t *source, size_t size)
Copies FoE data from an external source.
uint8_t * ec_foe_request_data(ec_foe_request_t *req)
Returns a pointer to the request's data.
Values read by the master.
size_t data_size
Size of FoE data.
uint8_t * file_name
Pointer to the filename.
#define EC_ERR(fmt, args...)
Convenience macro for printing EtherCAT-specific errors to syslog.
unsigned long jiffies_start
Jiffies, when the request was issued.
void ec_foe_request_read(ec_foe_request_t *req)
Prepares a read request (slave to master).
uint32_t error_code
Error code from an FoE Error Request.
ec_internal_request_state_t state
FoE request state.
Values written by the master.
uint32_t issue_timeout
Maximum time in ms, the processing of the request may take.
size_t ec_foe_request_data_size(const ec_foe_request_t *req)
Returns the data size.
struct list_head list
List item.