IgH EtherCAT Master  1.6.2
soe_request.c File Reference

Sercos-over-EtherCAT request functions. More...

Go to the source code of this file.

Macros

#define EC_SOE_REQUEST_RESPONSE_TIMEOUT   1000
 Default timeout in ms to wait for SoE responses.
 

Functions

void ec_soe_request_clear_data (ec_soe_request_t *req)
 Free allocated memory. More...
 
void ec_soe_request_init (ec_soe_request_t *req)
 SoE request constructor. More...
 
void ec_soe_request_clear (ec_soe_request_t *req)
 SoE request destructor. More...
 
int ec_soe_request_copy (ec_soe_request_t *req, const ec_soe_request_t *other)
 Copy another SoE request. More...
 
void ec_soe_request_set_drive_no (ec_soe_request_t *req, uint8_t drive_no)
 Set drive number. More...
 
void ec_soe_request_set_idn (ec_soe_request_t *req, uint16_t idn)
 Set IDN. More...
 
int ec_soe_request_alloc (ec_soe_request_t *req, size_t size)
 Pre-allocates the data memory. More...
 
int ec_soe_request_copy_data (ec_soe_request_t *req, const uint8_t *source, size_t size)
 Copies SoE data from an external source. More...
 
int ec_soe_request_append_data (ec_soe_request_t *req, const uint8_t *source, size_t size)
 Copies SoE data from an external source. More...
 
int ec_soe_request_read (ec_soe_request_t *req)
 Request a read operation. More...
 
int ec_soe_request_write (ec_soe_request_t *req)
 Request a write operation. More...
 
int ec_soe_request_timed_out (const ec_soe_request_t *req)
 Checks, if the timeout was exceeded. More...
 
int ecrt_soe_request_idn (ec_soe_request_t *req, uint8_t drive_no, uint16_t idn)
 Set the request's drive and Sercos ID numbers. More...
 
int ecrt_soe_request_timeout (ec_soe_request_t *req, uint32_t timeout)
 Set the timeout for an SoE request. More...
 
uint8_t * ecrt_soe_request_data (const ec_soe_request_t *req)
 Access to the SoE request's data. More...
 
size_t ecrt_soe_request_data_size (const ec_soe_request_t *req)
 Returns the current IDN data size. More...
 
ec_request_state_t ecrt_soe_request_state (const ec_soe_request_t *req)
 Get the current state of the SoE request. More...
 
int ecrt_soe_request_read (ec_soe_request_t *req)
 Schedule an SoE IDN read operation. More...
 
int ecrt_soe_request_write (ec_soe_request_t *req)
 Schedule an SoE IDN write operation. More...
 

Detailed Description

Sercos-over-EtherCAT request functions.

Definition in file soe_request.c.

Function Documentation

◆ ec_soe_request_clear_data()

void ec_soe_request_clear_data ( ec_soe_request_t req)

Free allocated memory.

Parameters
reqSoE request.

Definition at line 123 of file soe_request.c.

◆ ec_soe_request_init()

void ec_soe_request_init ( ec_soe_request_t req)

SoE request constructor.

Parameters
reqSoE request.

Definition at line 48 of file soe_request.c.

◆ ec_soe_request_clear()

void ec_soe_request_clear ( ec_soe_request_t req)

SoE request destructor.

Parameters
reqSoE request.

Definition at line 71 of file soe_request.c.

◆ ec_soe_request_copy()

int ec_soe_request_copy ( ec_soe_request_t req,
const ec_soe_request_t other 
)

Copy another SoE request.

Returns
Zero on success, otherwise a negative error code.
Parameters
reqSoE request.
otherOther SoE request to copy from.

Definition at line 84 of file soe_request.c.

◆ ec_soe_request_set_drive_no()

void ec_soe_request_set_drive_no ( ec_soe_request_t req,
uint8_t  drive_no 
)

Set drive number.

Parameters
reqSoE request.
drive_noDrive Number.

Definition at line 99 of file soe_request.c.

◆ ec_soe_request_set_idn()

void ec_soe_request_set_idn ( ec_soe_request_t req,
uint16_t  idn 
)

Set IDN.

Parameters
reqSoE request.
idnIDN.

Definition at line 111 of file soe_request.c.

◆ ec_soe_request_alloc()

int ec_soe_request_alloc ( ec_soe_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
reqSoE request.
sizeData size to allocate.

Definition at line 144 of file soe_request.c.

◆ ec_soe_request_copy_data()

int ec_soe_request_copy_data ( ec_soe_request_t req,
const uint8_t *  source,
size_t  size 
)

Copies SoE data from an external source.

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

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

Definition at line 173 of file soe_request.c.

◆ ec_soe_request_append_data()

int ec_soe_request_append_data ( ec_soe_request_t req,
const uint8_t *  source,
size_t  size 
)

Copies SoE data from an external source.

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

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

Definition at line 197 of file soe_request.c.

◆ ec_soe_request_read()

int ec_soe_request_read ( ec_soe_request_t req)

Request a read operation.

Parameters
reqSoE request.

Definition at line 226 of file soe_request.c.

◆ ec_soe_request_write()

int ec_soe_request_write ( ec_soe_request_t req)

Request a write operation.

Parameters
reqSoE request.

Definition at line 241 of file soe_request.c.

◆ ec_soe_request_timed_out()

int ec_soe_request_timed_out ( const ec_soe_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 258 of file soe_request.c.