28#ifndef __EC_FSM_MBOX_H__
29#define __EC_FSM_MBOX_H__
80 unsigned long,
unsigned long);
EtherCAT datagram structure.
void ec_fsm_mbox_clear(ec_fsm_mbox_t *fsm)
Destructor.
void ec_fsm_mbox_receive(ec_fsm_mbox_t *fsm, ec_slave_t *slave, ec_mbox_data_t *mbox_data, unsigned long jiffies_start, unsigned long timeout_ms)
Starts waiting for a mailbox response.
void ec_fsm_mbox_fetch_nosync(ec_fsm_mbox_t *fsm, ec_slave_t *slave, ec_mbox_data_t *mbox_data, unsigned long jiffies_start, unsigned long timeout_ms)
Starts a single mailbox fetch without a preceding check.
void ec_fsm_mbox_poll(ec_fsm_mbox_t *fsm, ec_slave_t *slave, ec_mbox_data_t *mbox_data)
Starts a single mailbox check without waiting.
int ec_fsm_mbox_exec(ec_fsm_mbox_t *fsm, ec_datagram_t *datagram)
Executes the current state of the state machine.
int ec_fsm_mbox_holds_lock(const ec_fsm_mbox_t *fsm)
Checks, if the state machine holds the slave's mailbox read lock.
int ec_fsm_mbox_result(const ec_fsm_mbox_t *fsm)
Returns the result of the terminated state machine.
void ec_fsm_mbox_abort(ec_fsm_mbox_t *fsm)
Aborts the state machine and releases the mailbox read lock, if held.
void ec_fsm_mbox_init(ec_fsm_mbox_t *fsm)
Constructor.
ec_fsm_mbox_mode_t
Mode of the mailbox receive state machine.
@ EC_FSM_MBOX_NOSYNC
Fetch the mailbox once without checking it.
@ EC_FSM_MBOX_WAIT
Wait for a response until the timeout elapsed.
@ EC_FSM_MBOX_POLL
Check the mailbox once, do not wait.
struct ec_fsm_mbox ec_fsm_mbox_t
Global definitions and macros.
struct ec_slave ec_slave_t
EtherCAT mailbox receive state machine.
ec_fsm_mbox_mode_t mode
Receive mode.
void(*) state(ec_fsm_mbox_t *, ec_datagram_t *)
State function.
unsigned int retries
Retries upon datagram timeout.
ec_slave_t * slave
Slave the FSM runs on.
ec_mbox_data_t * mbox_data
Response buffer of the protocol.
int result
Zero on success, otherwise a negative error code.
unsigned long jiffies_start
Reference time for the timeout.
ec_datagram_t * datagram
Datagram used in the last step.
unsigned long timeout_ms
Response timeout in [ms].
EtherCAT mailbox response data.