29#include <linux/module.h>
30#include <linux/jiffies.h>
31#include <linux/slab.h>
32#include <linux/vmalloc.h>
41#define EC_FOE_REQUEST_RESPONSE_TIMEOUT 3000
56 INIT_LIST_HEAD(&req->
list);
64 req->
state = EC_INT_REQUEST_INIT;
111 if (size <= req->buffer_size) {
117 if (!(req->
buffer = (uint8_t *) vmalloc(size))) {
118 EC_ERR(
"Failed to allocate %zu bytes of FoE memory.\n", size);
137 const uint8_t *source,
148 memcpy(req->
buffer, source, size);
176 req->
state = EC_INT_REQUEST_QUEUED;
190 req->
state = EC_INT_REQUEST_QUEUED;
void ec_foe_request_write(ec_foe_request_t *req)
Prepares a write request (master to slave).
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.
int ec_foe_request_timed_out(const ec_foe_request_t *req)
Checks, if the timeout was exceeded.
void ec_foe_request_read(ec_foe_request_t *req)
Prepares a read request (slave to master).
int ec_foe_request_alloc(ec_foe_request_t *req, size_t size)
Pre-allocates the data memory.
void ec_foe_request_init(ec_foe_request_t *req, uint8_t *file_name)
FoE request constructor.
#define EC_FOE_REQUEST_RESPONSE_TIMEOUT
Default timeout in ms to wait for FoE transfer responses.
void ec_foe_request_clear(ec_foe_request_t *req)
FoE request destructor.
void ec_foe_request_clear_data(ec_foe_request_t *)
FoE request destructor.
EtherCAT FoE request structure.
#define EC_ERR(fmt, args...)
Convenience macro for printing EtherCAT-specific errors to syslog.
@ EC_DIR_INVALID
Invalid direction.
@ EC_DIR_INPUT
Values read by the master.
@ EC_DIR_OUTPUT
Values written by the master.
ec_direction_t dir
Direction.
uint32_t issue_timeout
Maximum time in ms, the processing of the request may take.
uint32_t response_timeout
Maximum time in ms, the transfer is retried, if the slave does not respond.
uint32_t result
FoE request abort code.
struct list_head list
List item.
unsigned long jiffies_start
Jiffies, when the request was issued.
size_t buffer_size
Size of FoE data memory.
uint32_t error_code
Error code from an FoE Error Request.
uint8_t * buffer
Pointer to FoE data.
uint8_t * file_name
Pointer to the filename.
size_t data_size
Size of FoE data.
ec_internal_request_state_t state
FoE request state.