IgH EtherCAT Master  1.5.3
fsm_sii.c File Reference

EtherCAT slave information interface FSM. More...

Go to the source code of this file.

Macros

#define SII_TIMEOUT   20
 Read/write timeout [ms]. More...
 
#define SII_INHIBIT   5
 Time before evaluating answer at writing [ms].
 

Functions

void ec_fsm_sii_state_start_reading (ec_fsm_sii_t *fsm)
 SII state: START READING. More...
 
void ec_fsm_sii_state_read_check (ec_fsm_sii_t *fsm)
 SII state: READ CHECK. More...
 
void ec_fsm_sii_state_read_fetch (ec_fsm_sii_t *fsm)
 SII state: READ FETCH. More...
 
void ec_fsm_sii_state_start_writing (ec_fsm_sii_t *fsm)
 SII state: START WRITING. More...
 
void ec_fsm_sii_state_write_check (ec_fsm_sii_t *fsm)
 SII state: WRITE CHECK. More...
 
void ec_fsm_sii_state_write_check2 (ec_fsm_sii_t *fsm)
 SII state: WRITE CHECK 2. More...
 
void ec_fsm_sii_state_end (ec_fsm_sii_t *fsm)
 State: END. More...
 
void ec_fsm_sii_state_error (ec_fsm_sii_t *fsm)
 State: ERROR. More...
 
void ec_fsm_sii_init (ec_fsm_sii_t *fsm, ec_datagram_t *datagram)
 Constructor. More...
 
void ec_fsm_sii_clear (ec_fsm_sii_t *fsm)
 Destructor. More...
 
void ec_fsm_sii_read (ec_fsm_sii_t *fsm, ec_slave_t *slave, uint16_t word_offset, ec_fsm_sii_addressing_t mode)
 Initializes the SII read state machine. More...
 
void ec_fsm_sii_write (ec_fsm_sii_t *fsm, ec_slave_t *slave, uint16_t word_offset, const uint16_t *value, ec_fsm_sii_addressing_t mode)
 Initializes the SII write state machine. More...
 
int ec_fsm_sii_exec (ec_fsm_sii_t *fsm)
 Executes the SII state machine. More...
 
int ec_fsm_sii_success (ec_fsm_sii_t *fsm)
 Returns, if the master startup state machine terminated with success. More...
 

Detailed Description

EtherCAT slave information interface FSM.

Definition in file fsm_sii.c.

Macro Definition Documentation

◆ SII_TIMEOUT

#define SII_TIMEOUT   20

Read/write timeout [ms].

Used to calculate timeouts bsed on the jiffies counter.

Attention
Must be more than 10 to avoid problems on kernels that run with a timer interupt frequency of 100 Hz.

Definition at line 49 of file fsm_sii.c.

Function Documentation

◆ ec_fsm_sii_state_start_reading()

void ec_fsm_sii_state_start_reading ( ec_fsm_sii_t fsm)

SII state: START READING.

Starts reading the slave information interface.

Parameters
fsmfinite state machine

Definition at line 166 of file fsm_sii.c.

◆ ec_fsm_sii_state_read_check()

void ec_fsm_sii_state_read_check ( ec_fsm_sii_t fsm)

SII state: READ CHECK.

Checks, if the SII-read-datagram has been sent and issues a fetch datagram.

Parameters
fsmfinite state machine

Definition at line 203 of file fsm_sii.c.

◆ ec_fsm_sii_state_read_fetch()

void ec_fsm_sii_state_read_fetch ( ec_fsm_sii_t fsm)

SII state: READ FETCH.

Fetches the result of an SII-read datagram.

Parameters
fsmfinite state machine

Definition at line 250 of file fsm_sii.c.

◆ ec_fsm_sii_state_start_writing()

void ec_fsm_sii_state_start_writing ( ec_fsm_sii_t fsm)

SII state: START WRITING.

Starts writing a word through the slave information interface.

Parameters
fsmfinite state machine

Definition at line 320 of file fsm_sii.c.

◆ ec_fsm_sii_state_write_check()

void ec_fsm_sii_state_write_check ( ec_fsm_sii_t fsm)

SII state: WRITE CHECK.

Parameters
fsmfinite state machine

Definition at line 350 of file fsm_sii.c.

◆ ec_fsm_sii_state_write_check2()

void ec_fsm_sii_state_write_check2 ( ec_fsm_sii_t fsm)

SII state: WRITE CHECK 2.

Parameters
fsmfinite state machine

Definition at line 389 of file fsm_sii.c.

◆ ec_fsm_sii_state_end()

void ec_fsm_sii_state_end ( ec_fsm_sii_t fsm)

State: END.

Parameters
fsmfinite state machine

Definition at line 484 of file fsm_sii.c.

◆ ec_fsm_sii_state_error()

void ec_fsm_sii_state_error ( ec_fsm_sii_t fsm)

State: ERROR.

Parameters
fsmfinite state machine

Definition at line 472 of file fsm_sii.c.

◆ ec_fsm_sii_init()

void ec_fsm_sii_init ( ec_fsm_sii_t fsm,
ec_datagram_t datagram 
)

Constructor.

Parameters
fsmfinite state machine
datagramdatagram structure to use

Definition at line 74 of file fsm_sii.c.

◆ ec_fsm_sii_clear()

void ec_fsm_sii_clear ( ec_fsm_sii_t fsm)

Destructor.

Parameters
fsmfinite state machine

Definition at line 88 of file fsm_sii.c.

◆ ec_fsm_sii_read()

void ec_fsm_sii_read ( ec_fsm_sii_t fsm,
ec_slave_t slave,
uint16_t  word_offset,
ec_fsm_sii_addressing_t  mode 
)

Initializes the SII read state machine.

Parameters
fsmfinite state machine
slaveslave to read from
word_offsetoffset to read from
modeaddressing scheme

Definition at line 98 of file fsm_sii.c.

◆ ec_fsm_sii_write()

void ec_fsm_sii_write ( ec_fsm_sii_t fsm,
ec_slave_t slave,
uint16_t  word_offset,
const uint16_t *  value,
ec_fsm_sii_addressing_t  mode 
)

Initializes the SII write state machine.

Parameters
fsmfinite state machine
slaveslave to read from
word_offsetoffset to read from
valuepointer to 2 bytes of data
modeaddressing scheme

Definition at line 116 of file fsm_sii.c.

◆ ec_fsm_sii_exec()

int ec_fsm_sii_exec ( ec_fsm_sii_t fsm)

Executes the SII state machine.

Returns
false, if the state machine has terminated
Parameters
fsmfinite state machine

Definition at line 137 of file fsm_sii.c.

◆ ec_fsm_sii_success()

int ec_fsm_sii_success ( ec_fsm_sii_t fsm)

Returns, if the master startup state machine terminated with success.

Returns
non-zero if successful.
Parameters
fsmFinite state machine

Definition at line 152 of file fsm_sii.c.