fsm_soe.c File Reference

EtherCAT SoE state machines. More...

Go to the source code of this file.

Defines

#define EC_MBOX_TYPE_SOE   0x05
 Mailbox type for SoE.
#define EC_SOE_SIZE   0x04
 Size of all SoE headers.
#define EC_SOE_HEADER_SIZE   (EC_MBOX_HEADER_SIZE + EC_SOE_SIZE)
 SoE header size.
#define EC_SOE_RESPONSE_TIMEOUT   1000
 SoE response timeout [ms].

Enumerations

enum  ec_soe_opcodes { OPCODE_READ_REQUEST = 0x01, OPCODE_READ_RESPONSE = 0x02, OPCODE_WRITE_REQUEST = 0x03, OPCODE_WRITE_RESPONSE = 0x04 }
 SoE operations. More...

Functions

void ec_fsm_soe_read_start (ec_fsm_soe_t *fsm,ec_datagram_t *datagram)
 SoE state: READ START.
void ec_fsm_soe_read_request (ec_fsm_soe_t *fsm,ec_datagram_t *datagram)
 SoE state: READ REQUEST.
void ec_fsm_soe_read_check (ec_fsm_soe_t *fsm,ec_datagram_t *datagram)
 CoE state: READ CHECK.
void ec_fsm_soe_read_response (ec_fsm_soe_t *fsm,ec_datagram_t *datagram)
 SoE state: READ RESPONSE.
void ec_fsm_soe_write_start (ec_fsm_soe_t *fsm,ec_datagram_t *datagram)
 SoE state: WRITE START.
void ec_fsm_soe_write_request (ec_fsm_soe_t *fsm,ec_datagram_t *datagram)
 SoE state: WRITE REQUEST.
void ec_fsm_soe_write_check (ec_fsm_soe_t *fsm,ec_datagram_t *datagram)
 CoE state: WRITE CHECK.
void ec_fsm_soe_write_response (ec_fsm_soe_t *fsm,ec_datagram_t *datagram)
 SoE state: WRITE RESPONSE.
void ec_fsm_soe_end (ec_fsm_soe_t *fsm,ec_datagram_t *datagram)
 State: END.
void ec_fsm_soe_error (ec_fsm_soe_t *fsm,ec_datagram_t *datagram)
 State: ERROR.
void ec_print_soe_error (const ec_slave_t *slave, uint16_t error_code)
 Outputs an SoE error code.
void ec_fsm_soe_init (ec_fsm_soe_t *fsm)
 Constructor.
void ec_fsm_soe_clear (ec_fsm_soe_t *fsm)
 Destructor.
void ec_fsm_soe_transfer (ec_fsm_soe_t *fsm, ec_slave_t *slave, ec_soe_request_t *request)
 Starts to transfer an IDN to/from a slave.
int ec_fsm_soe_exec (ec_fsm_soe_t *fsm, ec_datagram_t *datagram)
 Executes the current state of the state machine.
int ec_fsm_soe_success (const ec_fsm_soe_t *fsm)
 Returns, if the state machine terminated with success.
void ec_fsm_soe_print_error (ec_fsm_soe_t *fsm)
 Output information about a failed SoE transfer.
int ec_fsm_soe_prepare_read (ec_fsm_soe_t *fsm, ec_datagram_t *datagram)
 Prepare a read operation.
void ec_fsm_soe_write_next_fragment (ec_fsm_soe_t *fsm, ec_datagram_t *datagram)
 Write next fragment.

Variables

const ec_code_msg_t soe_error_codes []
 SoE error codes.


Detailed Description

EtherCAT SoE state machines.

Definition in file fsm_soe.c.


Enumeration Type Documentation

SoE operations.

Enumerator:
OPCODE_READ_REQUEST  Read request.

OPCODE_READ_RESPONSE  Read response.

OPCODE_WRITE_REQUEST  Write request.

OPCODE_WRITE_RESPONSE  Write response.

Definition at line 50 of file fsm_soe.c.


Function Documentation

void ec_fsm_soe_read_start ( ec_fsm_soe_t fsm,
ec_datagram_t datagram 
)

SoE state: READ START.

Parameters:
fsm  finite state machine
datagram  Datagram to use.

Definition at line 258 of file fsm_soe.c.

void ec_fsm_soe_read_request ( ec_fsm_soe_t fsm,
ec_datagram_t datagram 
)

SoE state: READ REQUEST.

Parameters:
fsm  finite state machine
datagram  Datagram to use.

Definition at line 289 of file fsm_soe.c.

void ec_fsm_soe_read_check ( ec_fsm_soe_t fsm,
ec_datagram_t datagram 
)

CoE state: READ CHECK.

Parameters:
fsm  finite state machine
datagram  Datagram to use.

Definition at line 344 of file fsm_soe.c.

void ec_fsm_soe_read_response ( ec_fsm_soe_t fsm,
ec_datagram_t datagram 
)

SoE state: READ RESPONSE.

Parameters:
fsm  finite state machine
datagram  Datagram to use.

Definition at line 400 of file fsm_soe.c.

void ec_fsm_soe_write_start ( ec_fsm_soe_t fsm,
ec_datagram_t datagram 
)

SoE state: WRITE START.

Parameters:
fsm  finite state machine
datagram  Datagram to use.

Definition at line 574 of file fsm_soe.c.

void ec_fsm_soe_write_request ( ec_fsm_soe_t fsm,
ec_datagram_t datagram 
)

SoE state: WRITE REQUEST.

Parameters:
fsm  finite state machine
datagram  Datagram to use.

Definition at line 609 of file fsm_soe.c.

void ec_fsm_soe_write_check ( ec_fsm_soe_t fsm,
ec_datagram_t datagram 
)

CoE state: WRITE CHECK.

Parameters:
fsm  finite state machine
datagram  Datagram to use.

Definition at line 668 of file fsm_soe.c.

void ec_fsm_soe_write_response ( ec_fsm_soe_t fsm,
ec_datagram_t datagram 
)

SoE state: WRITE RESPONSE.

Parameters:
fsm  finite state machine
datagram  Datagram to use.

Definition at line 722 of file fsm_soe.c.

void ec_fsm_soe_end ( ec_fsm_soe_t fsm,
ec_datagram_t datagram 
)

State: END.

Parameters:
fsm  finite state machine
datagram  Datagram to use.

Definition at line 840 of file fsm_soe.c.

void ec_fsm_soe_error ( ec_fsm_soe_t fsm,
ec_datagram_t datagram 
)

State: ERROR.

Parameters:
fsm  finite state machine
datagram  Datagram to use.

Definition at line 829 of file fsm_soe.c.

void ec_fsm_soe_init ( ec_fsm_soe_t fsm  ) 

Constructor.

Parameters:
fsm  finite state machine

Definition at line 111 of file fsm_soe.c.

void ec_fsm_soe_clear ( ec_fsm_soe_t fsm  ) 

Destructor.

Parameters:
fsm  finite state machine

Definition at line 124 of file fsm_soe.c.

void ec_fsm_soe_transfer ( ec_fsm_soe_t fsm,
ec_slave_t slave,
ec_soe_request_t request 
)

Starts to transfer an IDN to/from a slave.

Parameters:
fsm  State machine.
slave  EtherCAT slave.
request  SoE request.

Definition at line 134 of file fsm_soe.c.

int ec_fsm_soe_exec ( ec_fsm_soe_t fsm,
ec_datagram_t datagram 
)

Executes the current state of the state machine.

Returns:
1 if the datagram was used, else 0.
Parameters:
fsm  finite state machine
datagram  Datagram to use.

Definition at line 156 of file fsm_soe.c.

int ec_fsm_soe_success ( const ec_fsm_soe_t fsm  ) 

Returns, if the state machine terminated with success.

Returns:
non-zero if successful.
Parameters:
fsm  Finite state machine

Definition at line 191 of file fsm_soe.c.

void ec_fsm_soe_print_error ( ec_fsm_soe_t fsm  ) 

Output information about a failed SoE transfer.

Parameters:
fsm  Finite state machine

Definition at line 200 of file fsm_soe.c.

int ec_fsm_soe_prepare_read ( ec_fsm_soe_t fsm,
ec_datagram_t datagram 
)

Prepare a read operation.

Returns:
0 on success, otherwise a negative error code.
Parameters:
fsm  finite state machine
datagram  Datagram to use.

Definition at line 223 of file fsm_soe.c.

void ec_fsm_soe_write_next_fragment ( ec_fsm_soe_t fsm,
ec_datagram_t datagram 
)

Write next fragment.

Parameters:
fsm  finite state machine
datagram  Datagram to use.

Definition at line 526 of file fsm_soe.c.


Generated on Mon Jun 20 09:31:30 2016 for IgH EtherCAT Master by  doxygen 1.5.6