46 #include "globals.h" |
46 #include "globals.h" |
47 #include "slave.h" |
47 #include "slave.h" |
48 #include "datagram.h" |
48 #include "datagram.h" |
49 #include "fsm_change.h" |
49 #include "fsm_change.h" |
50 #include "fsm_coe.h" |
50 #include "fsm_coe.h" |
51 #include "fsm_pdo_assign.h" |
51 #include "fsm_pdo.h" |
52 #include "fsm_pdo_mapping.h" |
|
53 |
52 |
54 /*****************************************************************************/ |
53 /*****************************************************************************/ |
55 |
54 |
56 /** \see ec_fsm_slave_config */ |
55 /** \see ec_fsm_slave_config */ |
57 typedef struct ec_fsm_slave_config ec_fsm_slave_config_t; |
56 typedef struct ec_fsm_slave_config ec_fsm_slave_config_t; |
58 |
57 |
59 /** Finite state machine to configure an EtherCAT slave. |
58 /** Finite state machine to configure an EtherCAT slave. |
60 */ |
59 */ |
61 struct ec_fsm_slave_config |
60 struct ec_fsm_slave_config |
62 { |
61 { |
|
62 ec_datagram_t *datagram; /**< Datagram used in the state machine. */ |
|
63 ec_fsm_change_t *fsm_change; /**< State change state machine. */ |
|
64 ec_fsm_coe_t *fsm_coe; /**< CoE state machine. */ |
|
65 ec_fsm_pdo_t *fsm_pdo; /**< Pdo configuration state machine. */ |
|
66 |
63 ec_slave_t *slave; /**< Slave the FSM runs on. */ |
67 ec_slave_t *slave; /**< Slave the FSM runs on. */ |
64 ec_datagram_t *datagram; /**< Datagram used in the state machine. */ |
68 void (*state)(ec_fsm_slave_config_t *); /**< State function. */ |
65 unsigned int retries; /**< Retries on datagram timeout. */ |
69 unsigned int retries; /**< Retries on datagram timeout. */ |
66 |
|
67 void (*state)(ec_fsm_slave_config_t *); /**< State function. */ |
|
68 ec_sdo_request_t *request; /**< Sdo request for Sdo configuration. */ |
70 ec_sdo_request_t *request; /**< Sdo request for Sdo configuration. */ |
69 ec_fsm_change_t fsm_change; /**< State change state machine. */ |
|
70 ec_fsm_coe_t fsm_coe; /**< CoE state machine. */ |
|
71 ec_fsm_pdo_assign_t fsm_pdo_assign; /**< Pdo assignment state machine. */ |
|
72 ec_fsm_pdo_mapping_t fsm_pdo_mapping; /**< Pdo mapping state machine. */ |
|
73 }; |
71 }; |
74 |
72 |
75 /*****************************************************************************/ |
73 /*****************************************************************************/ |
76 |
74 |
77 void ec_fsm_slave_config_init(ec_fsm_slave_config_t *, ec_datagram_t *); |
75 void ec_fsm_slave_config_init(ec_fsm_slave_config_t *, ec_datagram_t *, |
|
76 ec_fsm_change_t *, ec_fsm_coe_t *, ec_fsm_pdo_t *); |
78 void ec_fsm_slave_config_clear(ec_fsm_slave_config_t *); |
77 void ec_fsm_slave_config_clear(ec_fsm_slave_config_t *); |
79 |
78 |
80 void ec_fsm_slave_config_start(ec_fsm_slave_config_t *, ec_slave_t *); |
79 void ec_fsm_slave_config_start(ec_fsm_slave_config_t *, ec_slave_t *); |
81 |
80 |
82 int ec_fsm_slave_config_exec(ec_fsm_slave_config_t *); |
81 int ec_fsm_slave_config_exec(ec_fsm_slave_config_t *); |