master/fsm_coe.h
changeset 2045 ff2a13a4603c
parent 1562 5c249f469b81
child 2589 2b9c78543663
equal deleted inserted replaced
2044:1ae0491b2f6b 2045:ff2a13a4603c
    37 #ifndef __EC_FSM_COE_H__
    37 #ifndef __EC_FSM_COE_H__
    38 #define __EC_FSM_COE_H__
    38 #define __EC_FSM_COE_H__
    39 
    39 
    40 #include "globals.h"
    40 #include "globals.h"
    41 #include "datagram.h"
    41 #include "datagram.h"
       
    42 #include "mailbox.h"
    42 #include "slave.h"
    43 #include "slave.h"
    43 #include "sdo.h"
    44 #include "sdo.h"
    44 #include "sdo_request.h"
    45 #include "sdo_request.h"
    45 
    46 
    46 /*****************************************************************************/
    47 /*****************************************************************************/
    49 
    50 
    50 /** Finite state machines for the CANopen over EtherCAT protocol.
    51 /** Finite state machines for the CANopen over EtherCAT protocol.
    51  */
    52  */
    52 struct ec_fsm_coe {
    53 struct ec_fsm_coe {
    53     ec_slave_t *slave; /**< slave the FSM runs on */
    54     ec_slave_t *slave; /**< slave the FSM runs on */
    54     ec_datagram_t *datagram; /**< datagram used in the state machine */
    55     ec_mailbox_t *mbox; /**< mailbox used in the state machine */
    55     unsigned int retries; /**< retries upon datagram timeout */
    56     unsigned int retries; /**< retries upon datagram timeout */
    56 
    57 
    57     void (*state)(ec_fsm_coe_t *); /**< CoE state function */
    58     void (*state)(ec_fsm_coe_t *); /**< CoE state function */
    58     unsigned long jiffies_start; /**< CoE timestamp. */
    59     unsigned long jiffies_start; /**< CoE timestamp. */
    59     ec_sdo_t *sdo; /**< current SDO */
    60     ec_sdo_t *sdo; /**< current SDO */
    65     uint32_t remaining; /**< Remaining bytes during segmented download. */
    66     uint32_t remaining; /**< Remaining bytes during segmented download. */
    66 };
    67 };
    67 
    68 
    68 /*****************************************************************************/
    69 /*****************************************************************************/
    69 
    70 
    70 void ec_fsm_coe_init(ec_fsm_coe_t *, ec_datagram_t *);
    71 void ec_fsm_coe_init(ec_fsm_coe_t *, ec_mailbox_t *);
    71 void ec_fsm_coe_clear(ec_fsm_coe_t *);
    72 void ec_fsm_coe_clear(ec_fsm_coe_t *);
    72 
    73 
    73 void ec_fsm_coe_dictionary(ec_fsm_coe_t *, ec_slave_t *);
    74 void ec_fsm_coe_dictionary(ec_fsm_coe_t *, ec_slave_t *);
    74 void ec_fsm_coe_transfer(ec_fsm_coe_t *, ec_slave_t *, ec_sdo_request_t *);
    75 void ec_fsm_coe_transfer(ec_fsm_coe_t *, ec_slave_t *, ec_sdo_request_t *);
    75 
    76