IgH EtherCAT Master  1.6.2
fsm_eoe.c File Reference

EtherCAT EoE state machines. More...

Go to the source code of this file.

Macros

#define EC_EOE_RESPONSE_TIMEOUT   3000
 Maximum time to wait for a set IP parameter response.
 

Functions

void memcpy_swap32 (void *dst, const void *src)
 Host-architecture-independent 32-bit swap function. More...
 
int ec_fsm_eoe_prepare_set (ec_fsm_eoe_t *fsm, ec_datagram_t *datagram)
 Prepare a set IP parameters operation. More...
 
void ec_fsm_eoe_set_ip_start (ec_fsm_eoe_t *fsm, ec_datagram_t *datagram)
 EoE state: SET IP START. More...
 
void ec_fsm_eoe_set_ip_request (ec_fsm_eoe_t *fsm, ec_datagram_t *datagram)
 EoE state: SET IP REQUEST. More...
 
void ec_fsm_eoe_set_ip_check (ec_fsm_eoe_t *fsm, ec_datagram_t *datagram)
 EoE state: SET IP CHECK. More...
 
void ec_fsm_eoe_set_ip_response (ec_fsm_eoe_t *fsm, ec_datagram_t *datagram)
 EoE state: SET IP RESPONSE. More...
 
void ec_fsm_eoe_end (ec_fsm_eoe_t *fsm, ec_datagram_t *datagram)
 State: END. More...
 
void ec_fsm_eoe_error (ec_fsm_eoe_t *fsm, ec_datagram_t *datagram)
 State: ERROR. More...
 
void ec_fsm_eoe_init (ec_fsm_eoe_t *fsm)
 Constructor. More...
 
void ec_fsm_eoe_clear (ec_fsm_eoe_t *fsm)
 Destructor. More...
 
void ec_fsm_eoe_set_ip_param (ec_fsm_eoe_t *fsm, ec_slave_t *slave, ec_eoe_request_t *request)
 Starts to set the EoE IP partameters of a slave. More...
 
int ec_fsm_eoe_exec (ec_fsm_eoe_t *fsm, ec_datagram_t *datagram)
 Executes the current state of the state machine. More...
 
int ec_fsm_eoe_success (const ec_fsm_eoe_t *fsm)
 Returns, if the state machine terminated with success. More...
 

Detailed Description

EtherCAT EoE state machines.

Definition in file fsm_eoe.c.

Function Documentation

◆ memcpy_swap32()

void memcpy_swap32 ( void *  dst,
const void *  src 
)

Host-architecture-independent 32-bit swap function.

The internal storage of struct in_addr is always big-endian. The mailbox protocol format to supply IPv4 adresses is little-endian (Yuck!). So we need a swap function, that is independent of the CPU architecture. ntohl()/htonl() can not be used, because they evaluate to NOPs if the host architecture matches the target architecture!

Definition at line 65 of file fsm_eoe.c.

◆ ec_fsm_eoe_prepare_set()

int ec_fsm_eoe_prepare_set ( ec_fsm_eoe_t fsm,
ec_datagram_t datagram 
)

Prepare a set IP parameters operation.

Returns
0 on success, otherwise a negative error code.
Parameters
fsmfinite state machine
datagramDatagram to use.

Definition at line 169 of file fsm_eoe.c.

◆ ec_fsm_eoe_set_ip_start()

void ec_fsm_eoe_set_ip_start ( ec_fsm_eoe_t fsm,
ec_datagram_t datagram 
)

EoE state: SET IP START.

Parameters
fsmfinite state machine
datagramDatagram to use.

Definition at line 262 of file fsm_eoe.c.

◆ ec_fsm_eoe_set_ip_request()

void ec_fsm_eoe_set_ip_request ( ec_fsm_eoe_t fsm,
ec_datagram_t datagram 
)

EoE state: SET IP REQUEST.

Parameters
fsmfinite state machine
datagramDatagram to use.

Definition at line 290 of file fsm_eoe.c.

◆ ec_fsm_eoe_set_ip_check()

void ec_fsm_eoe_set_ip_check ( ec_fsm_eoe_t fsm,
ec_datagram_t datagram 
)

EoE state: SET IP CHECK.

Parameters
fsmfinite state machine
datagramDatagram to use.

Definition at line 343 of file fsm_eoe.c.

◆ ec_fsm_eoe_set_ip_response()

void ec_fsm_eoe_set_ip_response ( ec_fsm_eoe_t fsm,
ec_datagram_t datagram 
)

EoE state: SET IP RESPONSE.

Parameters
fsmfinite state machine
datagramDatagram to use.

Definition at line 396 of file fsm_eoe.c.

◆ ec_fsm_eoe_end()

void ec_fsm_eoe_end ( ec_fsm_eoe_t fsm,
ec_datagram_t datagram 
)

State: END.

Parameters
fsmfinite state machine
datagramDatagram to use.

Definition at line 502 of file fsm_eoe.c.

◆ ec_fsm_eoe_error()

void ec_fsm_eoe_error ( ec_fsm_eoe_t fsm,
ec_datagram_t datagram 
)

State: ERROR.

Parameters
fsmfinite state machine
datagramDatagram to use.

Definition at line 491 of file fsm_eoe.c.

◆ ec_fsm_eoe_init()

void ec_fsm_eoe_init ( ec_fsm_eoe_t fsm)

Constructor.

Parameters
fsmfinite state machine

Definition at line 77 of file fsm_eoe.c.

◆ ec_fsm_eoe_clear()

void ec_fsm_eoe_clear ( ec_fsm_eoe_t fsm)

Destructor.

Parameters
fsmfinite state machine

Definition at line 94 of file fsm_eoe.c.

◆ ec_fsm_eoe_set_ip_param()

void ec_fsm_eoe_set_ip_param ( ec_fsm_eoe_t fsm,
ec_slave_t slave,
ec_eoe_request_t request 
)

Starts to set the EoE IP partameters of a slave.

Parameters
fsmState machine.
slaveEtherCAT slave.
requestEoE request.

Definition at line 104 of file fsm_eoe.c.

◆ ec_fsm_eoe_exec()

int ec_fsm_eoe_exec ( ec_fsm_eoe_t fsm,
ec_datagram_t datagram 
)

Executes the current state of the state machine.

Returns
1 if the datagram was used, else 0.
Parameters
fsmfinite state machine
datagramDatagram to use.

Definition at line 121 of file fsm_eoe.c.

◆ ec_fsm_eoe_success()

int ec_fsm_eoe_success ( const ec_fsm_eoe_t fsm)

Returns, if the state machine terminated with success.

Returns
non-zero if successful.
Parameters
fsmFinite state machine

Definition at line 156 of file fsm_eoe.c.