IgH EtherCAT Master  1.6.2
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 41 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 158 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 195 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 242 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 312 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 342 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 381 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 476 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 464 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 66 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 80 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 90 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 108 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 129 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 144 of file fsm_sii.c.