IgH EtherCAT Master  1.5.3
pdo_list.c File Reference

EtherCAT PDO list methods. More...

Go to the source code of this file.

Functions

void ec_pdo_list_init (ec_pdo_list_t *pl)
 PDO list constructor. More...
 
void ec_pdo_list_clear (ec_pdo_list_t *pl)
 PDO list destructor. More...
 
void ec_pdo_list_clear_pdos (ec_pdo_list_t *pl)
 Clears the list of mapped PDOs. More...
 
uint16_t ec_pdo_list_total_size (const ec_pdo_list_t *pl)
 Calculates the total size of the mapped PDO entries. More...
 
ec_pdo_tec_pdo_list_add_pdo (ec_pdo_list_t *pl, uint16_t index)
 Add a new PDO to the list. More...
 
int ec_pdo_list_add_pdo_copy (ec_pdo_list_t *pl, const ec_pdo_t *pdo)
 Add the copy of an existing PDO to the list. More...
 
int ec_pdo_list_copy (ec_pdo_list_t *pl, const ec_pdo_list_t *other)
 Makes a deep copy of another PDO list. More...
 
int ec_pdo_list_equal (const ec_pdo_list_t *pl1, const ec_pdo_list_t *pl2)
 Compares two PDO lists. More...
 
ec_pdo_tec_pdo_list_find_pdo (const ec_pdo_list_t *pl, uint16_t index)
 Finds a PDO with the given index. More...
 
const ec_pdo_tec_pdo_list_find_pdo_const (const ec_pdo_list_t *pl, uint16_t index)
 Finds a PDO with the given index and returns a const pointer. More...
 
const ec_pdo_tec_pdo_list_find_pdo_by_pos_const (const ec_pdo_list_t *pl, unsigned int pos)
 Finds a PDO via its position in the list. More...
 
unsigned int ec_pdo_list_count (const ec_pdo_list_t *pl)
 Get the number of PDOs in the list. More...
 
void ec_pdo_list_print (const ec_pdo_list_t *pl)
 Outputs the PDOs in the list. More...
 

Detailed Description

EtherCAT PDO list methods.

Definition in file pdo_list.c.

Function Documentation

◆ ec_pdo_list_init()

void ec_pdo_list_init ( ec_pdo_list_t pl)

PDO list constructor.

Parameters
plPDO list.

Definition at line 50 of file pdo_list.c.

◆ ec_pdo_list_clear()

void ec_pdo_list_clear ( ec_pdo_list_t pl)

PDO list destructor.

Parameters
plPDO list.

Definition at line 61 of file pdo_list.c.

◆ ec_pdo_list_clear_pdos()

void ec_pdo_list_clear_pdos ( ec_pdo_list_t pl)

Clears the list of mapped PDOs.

Parameters
plPDO list.

Definition at line 70 of file pdo_list.c.

◆ ec_pdo_list_total_size()

uint16_t ec_pdo_list_total_size ( const ec_pdo_list_t pl)

Calculates the total size of the mapped PDO entries.

Return values
Datasize in byte.
Parameters
plPDO list.

Definition at line 87 of file pdo_list.c.

◆ ec_pdo_list_add_pdo()

ec_pdo_t* ec_pdo_list_add_pdo ( ec_pdo_list_t pl,
uint16_t  index 
)

Add a new PDO to the list.

Returns
Pointer to new PDO, otherwise an ERR_PTR() code.
Parameters
plPDO list.
indexPDO index.

Definition at line 117 of file pdo_list.c.

◆ ec_pdo_list_add_pdo_copy()

int ec_pdo_list_add_pdo_copy ( ec_pdo_list_t pl,
const ec_pdo_t pdo 
)

Add the copy of an existing PDO to the list.

Returns
0 on success, else < 0
Parameters
plPDO list.
pdoPDO to add.

Definition at line 141 of file pdo_list.c.

◆ ec_pdo_list_copy()

int ec_pdo_list_copy ( ec_pdo_list_t pl,
const ec_pdo_list_t other 
)

Makes a deep copy of another PDO list.

Returns
0 on success, else < 0
Parameters
plPDO list.
otherPDO list to copy from.

Definition at line 177 of file pdo_list.c.

◆ ec_pdo_list_equal()

int ec_pdo_list_equal ( const ec_pdo_list_t pl1,
const ec_pdo_list_t pl2 
)

Compares two PDO lists.

Only the list is compared, not the PDO entries (i. e. the PDO mapping).

Return values
1The given PDO lists are equal.
0The given PDO lists differ.
Parameters
pl1First list.
pl2Second list.

Definition at line 207 of file pdo_list.c.

◆ ec_pdo_list_find_pdo()

ec_pdo_t* ec_pdo_list_find_pdo ( const ec_pdo_list_t pl,
uint16_t  index 
)

Finds a PDO with the given index.

Returns
Search result, or NULL.
Parameters
plPDO list.
indexPDO index.

Definition at line 243 of file pdo_list.c.

◆ ec_pdo_list_find_pdo_const()

const ec_pdo_t* ec_pdo_list_find_pdo_const ( const ec_pdo_list_t pl,
uint16_t  index 
)

Finds a PDO with the given index and returns a const pointer.

Returns
Search result, or NULL.
Parameters
plPDO list.
indexPDO index.

Definition at line 265 of file pdo_list.c.

◆ ec_pdo_list_find_pdo_by_pos_const()

const ec_pdo_t* ec_pdo_list_find_pdo_by_pos_const ( const ec_pdo_list_t pl,
unsigned int  pos 
)

Finds a PDO via its position in the list.

Const version.

Returns
Zero on success, otherwise a negative error code.
Parameters
plPDO list.
posPosition in the list.

Definition at line 289 of file pdo_list.c.

◆ ec_pdo_list_count()

unsigned int ec_pdo_list_count ( const ec_pdo_list_t pl)

Get the number of PDOs in the list.

Returns
Number of PDOs.
Parameters
plPDO list.

Definition at line 311 of file pdo_list.c.

◆ ec_pdo_list_print()

void ec_pdo_list_print ( const ec_pdo_list_t pl)

Outputs the PDOs in the list.

Parameters
plPDO list.

Definition at line 329 of file pdo_list.c.