IgH EtherCAT Master  1.5.3
foe_request.c File Reference

File-over-EtherCAT request functions. More...

Go to the source code of this file.

Macros

#define EC_FOE_REQUEST_RESPONSE_TIMEOUT   3000
 Default timeout in ms to wait for FoE transfer responses.
 

Functions

void ec_foe_request_clear_data (ec_foe_request_t *req)
 FoE request destructor. More...
 
void ec_foe_request_init (ec_foe_request_t *req, uint8_t *file_name)
 FoE request constructor. More...
 
void ec_foe_request_clear (ec_foe_request_t *req)
 FoE request destructor. More...
 
int ec_foe_request_alloc (ec_foe_request_t *req, size_t size)
 Pre-allocates the data memory. More...
 
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. More...
 
int ec_foe_request_timed_out (const ec_foe_request_t *req)
 Checks, if the timeout was exceeded. More...
 
void ec_foe_request_timeout (ec_foe_request_t *req, uint32_t timeout)
 Set the request timeout. More...
 
uint8_t * ec_foe_request_data (ec_foe_request_t *req)
 Returns a pointer to the request's data. More...
 
size_t ec_foe_request_data_size (const ec_foe_request_t *req)
 Returns the data size. More...
 
void ec_foe_request_read (ec_foe_request_t *req)
 Prepares a read request (slave to master). More...
 
void ec_foe_request_write (ec_foe_request_t *req)
 Prepares a write request (master to slave). More...
 

Detailed Description

File-over-EtherCAT request functions.

Definition in file foe_request.c.

Function Documentation

◆ ec_foe_request_clear_data()

void ec_foe_request_clear_data ( ec_foe_request_t req)

FoE request destructor.

Parameters
reqFoE request.

Definition at line 89 of file foe_request.c.

◆ ec_foe_request_init()

void ec_foe_request_init ( ec_foe_request_t req,
uint8_t *  file_name 
)

FoE request constructor.

Parameters
reqFoE request.
file_namefilename

Definition at line 57 of file foe_request.c.

◆ ec_foe_request_clear()

void ec_foe_request_clear ( ec_foe_request_t req)

FoE request destructor.

Parameters
reqFoE request.

Definition at line 78 of file foe_request.c.

◆ ec_foe_request_alloc()

int ec_foe_request_alloc ( ec_foe_request_t req,
size_t  size 
)

Pre-allocates the data memory.

If the internal buffer_size is already bigger than size, nothing is done.

Returns
Zero on success, otherwise a negative error code.
Parameters
reqFoE request.
sizeData size to allocate.

Definition at line 111 of file foe_request.c.

◆ ec_foe_request_copy_data()

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.

If the buffer_size is to small, new memory is allocated.

Returns
Zero on success, otherwise a negative error code.
Parameters
reqFoE request.
sourceSource data.
sizeNumber of bytes in source.

Definition at line 140 of file foe_request.c.

◆ ec_foe_request_timed_out()

int ec_foe_request_timed_out ( const ec_foe_request_t req)

Checks, if the timeout was exceeded.

Returns
non-zero if the timeout was exceeded, else zero.
Parameters
reqFoE request.

Definition at line 164 of file foe_request.c.

◆ ec_foe_request_timeout()

void ec_foe_request_timeout ( ec_foe_request_t req,
uint32_t  timeout 
)

Set the request timeout.

Parameters
reqFoE request.
timeoutTimeout in ms.

Definition at line 176 of file foe_request.c.

◆ ec_foe_request_data()

uint8_t* ec_foe_request_data ( ec_foe_request_t req)

Returns a pointer to the request's data.

Returns
Data pointer.
Parameters
reqFoE request.

Definition at line 190 of file foe_request.c.

◆ ec_foe_request_data_size()

size_t ec_foe_request_data_size ( const ec_foe_request_t req)

Returns the data size.

Returns
Data size.
Parameters
reqFoE request.

Definition at line 203 of file foe_request.c.

◆ ec_foe_request_read()

void ec_foe_request_read ( ec_foe_request_t req)

Prepares a read request (slave to master).

Parameters
reqFoE request.

Definition at line 214 of file foe_request.c.

◆ ec_foe_request_write()

void ec_foe_request_write ( ec_foe_request_t req)

Prepares a write request (master to slave).

Parameters
reqFoE request.

Definition at line 228 of file foe_request.c.