IgH EtherCAT Master  1.5.3
sdo_request.c File Reference

Canopen over EtherCAT SDO request functions. More...

Go to the source code of this file.

Macros

#define EC_SDO_REQUEST_RESPONSE_TIMEOUT   1000
 Default timeout in ms to wait for SDO transfer responses.
 

Functions

void ec_sdo_request_clear_data (ec_sdo_request_t *req)
 SDO request destructor. More...
 
void ec_sdo_request_init (ec_sdo_request_t *req)
 SDO request constructor. More...
 
void ec_sdo_request_clear (ec_sdo_request_t *req)
 SDO request destructor. More...
 
int ec_sdo_request_copy (ec_sdo_request_t *req, const ec_sdo_request_t *other)
 Copy another SDO request. More...
 
int ec_sdo_request_alloc (ec_sdo_request_t *req, size_t size)
 Pre-allocates the data memory. More...
 
int ec_sdo_request_copy_data (ec_sdo_request_t *req, const uint8_t *source, size_t size)
 Copies SDO data from an external source. More...
 
int ec_sdo_request_timed_out (const ec_sdo_request_t *req)
 Checks, if the timeout was exceeded. More...
 
void ecrt_sdo_request_index (ec_sdo_request_t *req, uint16_t index, uint8_t subindex)
 Set the SDO index and subindex. More...
 
void ecrt_sdo_request_timeout (ec_sdo_request_t *req, uint32_t timeout)
 Set the timeout for an SDO request. More...
 
uint8_t * ecrt_sdo_request_data (ec_sdo_request_t *req)
 Access to the SDO request's data. More...
 
size_t ecrt_sdo_request_data_size (const ec_sdo_request_t *req)
 Returns the current SDO data size. More...
 
ec_request_state_t ecrt_sdo_request_state (const ec_sdo_request_t *req)
 Get the current state of the SDO request. More...
 
void ecrt_sdo_request_read (ec_sdo_request_t *req)
 Schedule an SDO read operation. More...
 
void ecrt_sdo_request_write (ec_sdo_request_t *req)
 Schedule an SDO write operation. More...
 

Detailed Description

Canopen over EtherCAT SDO request functions.

Definition in file sdo_request.c.

Function Documentation

◆ ec_sdo_request_clear_data()

void ec_sdo_request_clear_data ( ec_sdo_request_t req)

SDO request destructor.

Parameters
reqSDO request.

Definition at line 106 of file sdo_request.c.

◆ ec_sdo_request_init()

void ec_sdo_request_init ( ec_sdo_request_t req)

SDO request constructor.

Parameters
reqSDO request.

Definition at line 54 of file sdo_request.c.

◆ ec_sdo_request_clear()

void ec_sdo_request_clear ( ec_sdo_request_t req)

SDO request destructor.

Parameters
reqSDO request.

Definition at line 76 of file sdo_request.c.

◆ ec_sdo_request_copy()

int ec_sdo_request_copy ( ec_sdo_request_t req,
const ec_sdo_request_t other 
)

Copy another SDO request.

Attention
Only the index subindex and data are copied.
Returns
Zero on success, otherwise a negative error code.
Parameters
reqSDO request.
otherOther SDO request to copy from.

Definition at line 91 of file sdo_request.c.

◆ ec_sdo_request_alloc()

int ec_sdo_request_alloc ( ec_sdo_request_t req,
size_t  size 
)

Pre-allocates the data memory.

If the mem_size is already bigger than size, nothing is done.

Returns
0 on success, otherwise -ENOMEM.
Parameters
reqSDO request.
sizeData size to allocate.

Definition at line 127 of file sdo_request.c.

◆ ec_sdo_request_copy_data()

int ec_sdo_request_copy_data ( ec_sdo_request_t req,
const uint8_t *  source,
size_t  size 
)

Copies SDO data from an external source.

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

Return values
0Success.
<0Error code.
Parameters
reqSDO request.
sourceSource data.
sizeNumber of bytes in source.

Definition at line 156 of file sdo_request.c.

◆ ec_sdo_request_timed_out()

int ec_sdo_request_timed_out ( const ec_sdo_request_t req)

Checks, if the timeout was exceeded.

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

Definition at line 177 of file sdo_request.c.