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;
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_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.
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.
struct list_head list
List item.