IgH EtherCAT Master  1.6.1
fsm_pdo.c File Reference

EtherCAT PDO configuration state machine. More...

Go to the source code of this file.

Functions

void ec_fsm_pdo_print (const ec_fsm_pdo_t *fsm)
 Print the current and desired PDO assignment. More...
 
int ec_fsm_pdo_running (const ec_fsm_pdo_t *fsm)
 Get running state. More...
 
ec_pdo_tec_fsm_pdo_conf_action_next_pdo (const ec_fsm_pdo_t *fsm, const struct list_head *list)
 Assign next PDO. More...
 
void ec_fsm_pdo_read_state_start (ec_fsm_pdo_t *fsm, ec_datagram_t *datagram)
 Start reading PDO assignment. More...
 
void ec_fsm_pdo_read_state_pdo_count (ec_fsm_pdo_t *fsm, ec_datagram_t *datagram)
 Count assigned PDOs. More...
 
void ec_fsm_pdo_read_state_pdo (ec_fsm_pdo_t *fsm, ec_datagram_t *datagram)
 Fetch PDO information. More...
 
void ec_fsm_pdo_read_state_pdo_entries (ec_fsm_pdo_t *fsm, ec_datagram_t *datagram)
 Fetch PDO information. More...
 
void ec_fsm_pdo_read_action_next_sync (ec_fsm_pdo_t *fsm, ec_datagram_t *datagram)
 Read PDO assignment of next sync manager. More...
 
void ec_fsm_pdo_read_action_next_pdo (ec_fsm_pdo_t *fsm, ec_datagram_t *datagram)
 Read next PDO. More...
 
void ec_fsm_pdo_conf_state_start (ec_fsm_pdo_t *fsm, ec_datagram_t *datagram)
 Start PDO configuration. More...
 
void ec_fsm_pdo_conf_state_read_mapping (ec_fsm_pdo_t *fsm, ec_datagram_t *datagram)
 Execute the PDO entry state machine to read the current PDO's mapping. More...
 
void ec_fsm_pdo_conf_state_mapping (ec_fsm_pdo_t *fsm, ec_datagram_t *datagram)
 Let the PDO entry state machine configure the current PDO's mapping. More...
 
void ec_fsm_pdo_conf_state_zero_pdo_count (ec_fsm_pdo_t *fsm, ec_datagram_t *datagram)
 Set the number of assigned PDOs to zero. More...
 
void ec_fsm_pdo_conf_state_assign_pdo (ec_fsm_pdo_t *fsm, ec_datagram_t *datagram)
 Add a PDO to the sync managers PDO assignment. More...
 
void ec_fsm_pdo_conf_state_set_pdo_count (ec_fsm_pdo_t *fsm, ec_datagram_t *datagram)
 Set the number of assigned PDOs. More...
 
void ec_fsm_pdo_conf_action_next_sync (ec_fsm_pdo_t *fsm, ec_datagram_t *datagram)
 Get the next sync manager for a pdo configuration. More...
 
void ec_fsm_pdo_conf_action_pdo_mapping (ec_fsm_pdo_t *fsm, ec_datagram_t *datagram)
 Check if the mapping has to be read, otherwise start to configure it. More...
 
void ec_fsm_pdo_conf_action_check_mapping (ec_fsm_pdo_t *fsm, ec_datagram_t *datagram)
 Check if the mapping has to be re-configured. More...
 
void ec_fsm_pdo_conf_action_next_pdo_mapping (ec_fsm_pdo_t *fsm, ec_datagram_t *datagram)
 Check mapping of next PDO, otherwise configure assignment. More...
 
void ec_fsm_pdo_conf_action_check_assignment (ec_fsm_pdo_t *fsm, ec_datagram_t *datagram)
 Check if the PDO assignment of the current SM has to be re-configured. More...
 
void ec_fsm_pdo_conf_action_assign_pdo (ec_fsm_pdo_t *fsm, ec_datagram_t *datagram)
 Assign a PDO. More...
 
void ec_fsm_pdo_state_end (ec_fsm_pdo_t *fsm, ec_datagram_t *datagram)
 State: END. More...
 
void ec_fsm_pdo_state_error (ec_fsm_pdo_t *fsm, ec_datagram_t *datagram)
 State: ERROR. More...
 
void ec_fsm_pdo_init (ec_fsm_pdo_t *fsm, ec_fsm_coe_t *fsm_coe)
 Constructor. More...
 
void ec_fsm_pdo_clear (ec_fsm_pdo_t *fsm)
 Destructor. More...
 
void ec_fsm_pdo_start_reading (ec_fsm_pdo_t *fsm, ec_slave_t *slave)
 Start reading the PDO configuration. More...
 
void ec_fsm_pdo_start_configuration (ec_fsm_pdo_t *fsm, ec_slave_t *slave)
 Start writing the PDO configuration. More...
 
int ec_fsm_pdo_exec (ec_fsm_pdo_t *fsm, ec_datagram_t *datagram)
 Executes the current state of the state machine. More...
 
int ec_fsm_pdo_success (const ec_fsm_pdo_t *fsm)
 Get execution result. More...
 

Detailed Description

EtherCAT PDO configuration state machine.

Definition in file fsm_pdo.c.

Function Documentation

◆ ec_fsm_pdo_print()

void ec_fsm_pdo_print ( const ec_fsm_pdo_t fsm)

Print the current and desired PDO assignment.

Parameters
fsmPDO configuration state machine.

Definition at line 104 of file fsm_pdo.c.

◆ ec_fsm_pdo_running()

int ec_fsm_pdo_running ( const ec_fsm_pdo_t fsm)

Get running state.

Returns
false, if state machine has terminated
Parameters
fsmPDO configuration state machine.

Definition at line 147 of file fsm_pdo.c.

◆ ec_fsm_pdo_conf_action_next_pdo()

ec_pdo_t * ec_fsm_pdo_conf_action_next_pdo ( const ec_fsm_pdo_t fsm,
const struct list_head *  list 
)

Assign next PDO.

Returns
Next PDO, or NULL.
Parameters
fsmPDO configuration state machine.
listcurrent PDO list item

Definition at line 403 of file fsm_pdo.c.

◆ ec_fsm_pdo_read_state_start()

void ec_fsm_pdo_read_state_start ( ec_fsm_pdo_t fsm,
ec_datagram_t datagram 
)

Start reading PDO assignment.

Parameters
fsmFinite state machine.
datagramDatagram to use.

Definition at line 193 of file fsm_pdo.c.

◆ ec_fsm_pdo_read_state_pdo_count()

void ec_fsm_pdo_read_state_pdo_count ( ec_fsm_pdo_t fsm,
ec_datagram_t datagram 
)

Count assigned PDOs.

Parameters
fsmFinite state machine.
datagramDatagram to use.

Definition at line 243 of file fsm_pdo.c.

◆ ec_fsm_pdo_read_state_pdo()

void ec_fsm_pdo_read_state_pdo ( ec_fsm_pdo_t fsm,
ec_datagram_t datagram 
)

Fetch PDO information.

Parameters
fsmFinite state machine.
datagramDatagram to use.

Definition at line 307 of file fsm_pdo.c.

◆ ec_fsm_pdo_read_state_pdo_entries()

void ec_fsm_pdo_read_state_pdo_entries ( ec_fsm_pdo_t fsm,
ec_datagram_t datagram 
)

Fetch PDO information.

Parameters
fsmFinite state machine.
datagramDatagram to use.

Definition at line 356 of file fsm_pdo.c.

◆ ec_fsm_pdo_read_action_next_sync()

void ec_fsm_pdo_read_action_next_sync ( ec_fsm_pdo_t fsm,
ec_datagram_t datagram 
)

Read PDO assignment of next sync manager.

Parameters
fsmfinite state machine.
datagramDatagram to use.

Definition at line 207 of file fsm_pdo.c.

◆ ec_fsm_pdo_read_action_next_pdo()

void ec_fsm_pdo_read_action_next_pdo ( ec_fsm_pdo_t fsm,
ec_datagram_t datagram 
)

Read next PDO.

Parameters
fsmFinite state machine.
datagramDatagram to use.

Definition at line 279 of file fsm_pdo.c.

◆ ec_fsm_pdo_conf_state_start()

void ec_fsm_pdo_conf_state_start ( ec_fsm_pdo_t fsm,
ec_datagram_t datagram 
)

Start PDO configuration.

Parameters
fsmFinite state machine.
datagramDatagram to use.

Definition at line 383 of file fsm_pdo.c.

◆ ec_fsm_pdo_conf_state_read_mapping()

void ec_fsm_pdo_conf_state_read_mapping ( ec_fsm_pdo_t fsm,
ec_datagram_t datagram 
)

Execute the PDO entry state machine to read the current PDO's mapping.

Parameters
fsmFinite state machine.
datagramDatagram to use.

Definition at line 502 of file fsm_pdo.c.

◆ ec_fsm_pdo_conf_state_mapping()

void ec_fsm_pdo_conf_state_mapping ( ec_fsm_pdo_t fsm,
ec_datagram_t datagram 
)

Let the PDO entry state machine configure the current PDO's mapping.

Parameters
fsmFinite state machine.
datagramDatagram to use.

Definition at line 561 of file fsm_pdo.c.

◆ ec_fsm_pdo_conf_state_zero_pdo_count()

void ec_fsm_pdo_conf_state_zero_pdo_count ( ec_fsm_pdo_t fsm,
ec_datagram_t datagram 
)

Set the number of assigned PDOs to zero.

Parameters
fsmFinite state machine.
datagramDatagram to use.

Definition at line 648 of file fsm_pdo.c.

◆ ec_fsm_pdo_conf_state_assign_pdo()

void ec_fsm_pdo_conf_state_assign_pdo ( ec_fsm_pdo_t fsm,
ec_datagram_t datagram 
)

Add a PDO to the sync managers PDO assignment.

Parameters
fsmFinite state machine.
datagramDatagram to use.

Definition at line 710 of file fsm_pdo.c.

◆ ec_fsm_pdo_conf_state_set_pdo_count()

void ec_fsm_pdo_conf_state_set_pdo_count ( ec_fsm_pdo_t fsm,
ec_datagram_t datagram 
)

Set the number of assigned PDOs.

Parameters
fsmFinite state machine.
datagramDatagram to use.

Definition at line 755 of file fsm_pdo.c.

◆ ec_fsm_pdo_conf_action_next_sync()

void ec_fsm_pdo_conf_action_next_sync ( ec_fsm_pdo_t fsm,
ec_datagram_t datagram 
)

Get the next sync manager for a pdo configuration.

Parameters
fsmFinite state machine.
datagramDatagram to use.

Definition at line 418 of file fsm_pdo.c.

◆ ec_fsm_pdo_conf_action_pdo_mapping()

void ec_fsm_pdo_conf_action_pdo_mapping ( ec_fsm_pdo_t fsm,
ec_datagram_t datagram 
)

Check if the mapping has to be read, otherwise start to configure it.

Parameters
fsmFinite state machine.
datagramDatagram to use.

Definition at line 467 of file fsm_pdo.c.

◆ ec_fsm_pdo_conf_action_check_mapping()

void ec_fsm_pdo_conf_action_check_mapping ( ec_fsm_pdo_t fsm,
ec_datagram_t datagram 
)

Check if the mapping has to be re-configured.

Todo:
Display mapping differences.
Parameters
fsmFinite state machine.
datagramDatagram to use.

Definition at line 526 of file fsm_pdo.c.

◆ ec_fsm_pdo_conf_action_next_pdo_mapping()

void ec_fsm_pdo_conf_action_next_pdo_mapping ( ec_fsm_pdo_t fsm,
ec_datagram_t datagram 
)

Check mapping of next PDO, otherwise configure assignment.

Parameters
fsmFinite state machine.
datagramDatagram to use.

Definition at line 582 of file fsm_pdo.c.

◆ ec_fsm_pdo_conf_action_check_assignment()

void ec_fsm_pdo_conf_action_check_assignment ( ec_fsm_pdo_t fsm,
ec_datagram_t datagram 
)

Check if the PDO assignment of the current SM has to be re-configured.

Parameters
fsmFinite state machine.
datagramDatagram to use.

Definition at line 601 of file fsm_pdo.c.

◆ ec_fsm_pdo_conf_action_assign_pdo()

void ec_fsm_pdo_conf_action_assign_pdo ( ec_fsm_pdo_t fsm,
ec_datagram_t datagram 
)

Assign a PDO.

Parameters
fsmFinite state machine.
datagramDatagram to use.

Definition at line 687 of file fsm_pdo.c.

◆ ec_fsm_pdo_state_end()

void ec_fsm_pdo_state_end ( ec_fsm_pdo_t fsm,
ec_datagram_t datagram 
)

State: END.

Parameters
fsmFinite state machine.
datagramDatagram to use.

Definition at line 799 of file fsm_pdo.c.

◆ ec_fsm_pdo_state_error()

void ec_fsm_pdo_state_error ( ec_fsm_pdo_t fsm,
ec_datagram_t datagram 
)

State: ERROR.

Parameters
fsmFinite state machine.
datagramDatagram to use.

Definition at line 788 of file fsm_pdo.c.

◆ ec_fsm_pdo_init()

void ec_fsm_pdo_init ( ec_fsm_pdo_t fsm,
ec_fsm_coe_t fsm_coe 
)

Constructor.

Parameters
fsmPDO configuration state machine.
fsm_coeCoE state machine to use

Definition at line 74 of file fsm_pdo.c.

◆ ec_fsm_pdo_clear()

void ec_fsm_pdo_clear ( ec_fsm_pdo_t fsm)

Destructor.

Parameters
fsmPDO configuration state machine.

Definition at line 90 of file fsm_pdo.c.

◆ ec_fsm_pdo_start_reading()

void ec_fsm_pdo_start_reading ( ec_fsm_pdo_t fsm,
ec_slave_t slave 
)

Start reading the PDO configuration.

Parameters
fsmPDO configuration state machine.
slaveslave to configure

Definition at line 119 of file fsm_pdo.c.

◆ ec_fsm_pdo_start_configuration()

void ec_fsm_pdo_start_configuration ( ec_fsm_pdo_t fsm,
ec_slave_t slave 
)

Start writing the PDO configuration.

Parameters
fsmPDO configuration state machine.
slaveslave to configure

Definition at line 132 of file fsm_pdo.c.

◆ ec_fsm_pdo_exec()

int ec_fsm_pdo_exec ( ec_fsm_pdo_t fsm,
ec_datagram_t datagram 
)

Executes the current state of the state machine.

If the state machine's datagram is not sent or received yet, the execution of the state machine is delayed to the next cycle.

Returns
false, if state machine has terminated
Parameters
fsmPDO configuration state machine.
datagramDatagram to use.

Definition at line 164 of file fsm_pdo.c.

◆ ec_fsm_pdo_success()

int ec_fsm_pdo_success ( const ec_fsm_pdo_t fsm)

Get execution result.

Returns
true, if the state machine terminated gracefully
Parameters
fsmPDO configuration state machine.

Definition at line 180 of file fsm_pdo.c.