fsm_foe.c File Reference

EtherCAT FoE state machines. More...

Go to the source code of this file.

Defines

#define EC_FSM_FOE_TIMEOUT   3000
 Maximum time in ms to wait for responses when reading out the dictionary.
#define EC_MBOX_TYPE_FILEACCESS   0x04
 Mailbox type FoE.
#define EC_FOE_HEADER_SIZE   6
 Size of the FoE header.

Enumerations

enum  {
  EC_FOE_OPCODE_RRQ = 1, EC_FOE_OPCODE_WRQ = 2, EC_FOE_OPCODE_DATA = 3, EC_FOE_OPCODE_ACK = 4,
  EC_FOE_OPCODE_ERR = 5, EC_FOE_OPCODE_BUSY = 6
}
 FoE OpCodes. More...

Functions

int ec_foe_prepare_data_send (ec_fsm_foe_t *fsm,ec_datagram_t *datagram)
 Sends a file or the next fragment.
int ec_foe_prepare_wrq_send (ec_fsm_foe_t *fsm,ec_datagram_t *datagram)
 Prepare a write request (WRQ) with filename.
int ec_foe_prepare_rrq_send (ec_fsm_foe_t *fsm,ec_datagram_t *datagram)
 Prepare a read request (RRQ) with filename.
int ec_foe_prepare_send_ack (ec_fsm_foe_t *fsm,ec_datagram_t *datagram)
 Prepare to send an acknowledge.
void ec_foe_set_tx_error (ec_fsm_foe_t *fsm,uint32_t errorcode)
 Set an error code and go to the send error state.
void ec_foe_set_rx_error (ec_fsm_foe_t *fsm,uint32_t errorcode)
 Set an error code and go to the receive error state.
void ec_fsm_foe_end (ec_fsm_foe_t *fsm,ec_datagram_t *datagram)
 State: END.
void ec_fsm_foe_error (ec_fsm_foe_t *fsm,ec_datagram_t *datagram)
 State: ERROR.
void ec_fsm_foe_state_wrq_sent (ec_fsm_foe_t *fsm,ec_datagram_t *datagram)
 State: WRQ SENT.
void ec_fsm_foe_state_rrq_sent (ec_fsm_foe_t *fsm,ec_datagram_t *datagram)
 State: RRQ SENT.
void ec_fsm_foe_state_ack_check (ec_fsm_foe_t *fsm,ec_datagram_t *datagram)
 Check for acknowledge.
void ec_fsm_foe_state_ack_read (ec_fsm_foe_t *fsm,ec_datagram_t *datagram)
 Acknowledge a read operation.
void ec_fsm_foe_state_data_sent (ec_fsm_foe_t *fsm,ec_datagram_t *datagram)
 State: WRQ SENT.
void ec_fsm_foe_state_data_check (ec_fsm_foe_t *fsm,ec_datagram_t *datagram)
 Check for data.
void ec_fsm_foe_state_data_read (ec_fsm_foe_t *fsm,ec_datagram_t *datagram)
 Start reading data.
void ec_fsm_foe_state_sent_ack (ec_fsm_foe_t *fsm,ec_datagram_t *datagram)
 Sent an acknowledge.
void ec_fsm_foe_write_start (ec_fsm_foe_t *fsm,ec_datagram_t *datagram)
 Initializes the FoE write state machine.
void ec_fsm_foe_read_start (ec_fsm_foe_t *fsm,ec_datagram_t *datagram)
 Starting state for read operations.
void ec_fsm_foe_init (ec_fsm_foe_t *fsm)
 Constructor.
void ec_fsm_foe_clear (ec_fsm_foe_t *fsm)
 Destructor.
int ec_fsm_foe_exec (ec_fsm_foe_t *fsm, ec_datagram_t *datagram)
 Executes the current state of the state machine.
int ec_fsm_foe_success (const ec_fsm_foe_t *fsm)
 Returns, if the state machine terminated with success.
void ec_fsm_foe_transfer (ec_fsm_foe_t *fsm, ec_slave_t *slave, ec_foe_request_t *request)
 Prepares an FoE transfer.

Variables

enum { ... }  ec_foe_opcode_t
 FoE OpCodes.


Detailed Description

EtherCAT FoE state machines.

Definition in file fsm_foe.c.


Enumeration Type Documentation

anonymous enum

FoE OpCodes.

Enumerator:
EC_FOE_OPCODE_RRQ  Read request.

EC_FOE_OPCODE_WRQ  Write request.

EC_FOE_OPCODE_DATA  Data.

EC_FOE_OPCODE_ACK  Acknowledge.

EC_FOE_OPCODE_ERR  Error.

EC_FOE_OPCODE_BUSY  Busy.

Definition at line 66 of file fsm_foe.c.


Function Documentation

int ec_foe_prepare_data_send ( ec_fsm_foe_t fsm,
ec_datagram_t datagram 
)

Sends a file or the next fragment.

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

Definition at line 236 of file fsm_foe.c.

int ec_foe_prepare_wrq_send ( ec_fsm_foe_t fsm,
ec_datagram_t datagram 
)

Prepare a write request (WRQ) with filename.

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

Definition at line 278 of file fsm_foe.c.

int ec_foe_prepare_rrq_send ( ec_fsm_foe_t fsm,
ec_datagram_t datagram 
)

Prepare a read request (RRQ) with filename.

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

Definition at line 555 of file fsm_foe.c.

int ec_foe_prepare_send_ack ( ec_fsm_foe_t fsm,
ec_datagram_t datagram 
)

Prepare to send an acknowledge.

Returns:
Zero on success, otherwise a negative error code.
Parameters:
fsm  FoE statemachine.
datagram  Datagram to use.

Definition at line 589 of file fsm_foe.c.

void ec_foe_set_tx_error ( ec_fsm_foe_t fsm,
uint32_t  errorcode 
)

Set an error code and go to the send error state.

Parameters:
fsm  FoE statemachine.
errorcode  FoE error code.

Definition at line 905 of file fsm_foe.c.

void ec_foe_set_rx_error ( ec_fsm_foe_t fsm,
uint32_t  errorcode 
)

Set an error code and go to the receive error state.

Parameters:
fsm  FoE statemachine.
errorcode  FoE error code.

Definition at line 918 of file fsm_foe.c.

void ec_fsm_foe_end ( ec_fsm_foe_t fsm,
ec_datagram_t datagram 
)

State: END.

Parameters:
fsm  finite state machine
datagram  Datagram to use.

Definition at line 220 of file fsm_foe.c.

void ec_fsm_foe_error ( ec_fsm_foe_t fsm,
ec_datagram_t datagram 
)

State: ERROR.

Parameters:
fsm  finite state machine
datagram  Datagram to use.

Definition at line 206 of file fsm_foe.c.

void ec_fsm_foe_state_wrq_sent ( ec_fsm_foe_t fsm,
ec_datagram_t datagram 
)

State: WRQ SENT.

Checks is the previous transmit datagram succeded and sends the next fragment, if necessary.

Parameters:
fsm  FoE statemachine.
datagram  Datagram to use.

Definition at line 477 of file fsm_foe.c.

void ec_fsm_foe_state_rrq_sent ( ec_fsm_foe_t fsm,
ec_datagram_t datagram 
)

State: RRQ SENT.

Checks is the previous transmit datagram succeeded and sends the next fragment, if necessary.

Parameters:
fsm  FoE statemachine.
datagram  Datagram to use.

Definition at line 615 of file fsm_foe.c.

void ec_fsm_foe_state_ack_check ( ec_fsm_foe_t fsm,
ec_datagram_t datagram 
)

Check for acknowledge.

Parameters:
fsm  FoE statemachine.
datagram  Datagram to use.

Definition at line 345 of file fsm_foe.c.

void ec_fsm_foe_state_ack_read ( ec_fsm_foe_t fsm,
ec_datagram_t datagram 
)

Acknowledge a read operation.

Parameters:
fsm  FoE statemachine.
datagram  Datagram to use.

Definition at line 397 of file fsm_foe.c.

void ec_fsm_foe_state_data_sent ( ec_fsm_foe_t fsm,
ec_datagram_t datagram 
)

State: WRQ SENT.

Checks is the previous transmit datagram succeded and sends the next fragment, if necessary.

Parameters:
fsm  Foe statemachine.
datagram  Datagram to use.

Definition at line 518 of file fsm_foe.c.

void ec_fsm_foe_state_data_check ( ec_fsm_foe_t fsm,
ec_datagram_t datagram 
)

Check for data.

Parameters:
fsm  FoE statemachine.
datagram  Datagram to use.

Definition at line 686 of file fsm_foe.c.

void ec_fsm_foe_state_data_read ( ec_fsm_foe_t fsm,
ec_datagram_t datagram 
)

Start reading data.

Parameters:
fsm  FoE statemachine.
datagram  Datagram to use.

Definition at line 736 of file fsm_foe.c.

void ec_fsm_foe_state_sent_ack ( ec_fsm_foe_t fsm,
ec_datagram_t datagram 
)

Sent an acknowledge.

Parameters:
fsm  FoE statemachine.
datagram  Datagram to use.

Definition at line 859 of file fsm_foe.c.

void ec_fsm_foe_write_start ( ec_fsm_foe_t fsm,
ec_datagram_t datagram 
)

Initializes the FoE write state machine.

Parameters:
fsm  finite state machine
datagram  Datagram to use.

Definition at line 311 of file fsm_foe.c.

void ec_fsm_foe_read_start ( ec_fsm_foe_t fsm,
ec_datagram_t datagram 
)

Starting state for read operations.

Parameters:
fsm  FoE statemachine.
datagram  Datagram to use.

Definition at line 653 of file fsm_foe.c.

void ec_fsm_foe_init ( ec_fsm_foe_t fsm  ) 

Constructor.

Parameters:
fsm  finite state machine

Definition at line 107 of file fsm_foe.c.

void ec_fsm_foe_clear ( ec_fsm_foe_t fsm  ) 

Destructor.

Parameters:
fsm  finite state machine

Definition at line 119 of file fsm_foe.c.

int ec_fsm_foe_exec ( ec_fsm_foe_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 129 of file fsm_foe.c.

int ec_fsm_foe_success ( const ec_fsm_foe_t fsm  ) 

Returns, if the state machine terminated with success.

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

Definition at line 163 of file fsm_foe.c.

void ec_fsm_foe_transfer ( ec_fsm_foe_t fsm,
ec_slave_t slave,
ec_foe_request_t request 
)

Prepares an FoE transfer.

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

Definition at line 172 of file fsm_foe.c.


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