* the table entry is defined by the state + event (curr_entry). * so cs_fsm_process() sets the entry and cs_fsm_state_set() * sets the new state. */
| 78 | * sets the new state. |
| 79 | */ |
| 80 | static inline void cs_fsm_process (struct cs_fsm *fsm, int32_t new_event, void * data, cs_fsm_cb cb) |
| 81 | { |
| 82 | int32_t i; |
| 83 | |
| 84 | for (i = 0; i < fsm->entries; i++) { |
| 85 | if (fsm->table[i].event == new_event && |
| 86 | fsm->table[i].curr_state == fsm->curr_state) { |
| 87 | |
| 88 | assert (fsm->table[i].handler_fn != NULL); |
| 89 | /* set current entry */ |
| 90 | fsm->curr_entry = i; |
| 91 | fsm->table[i].handler_fn (fsm, new_event, data); |
| 92 | return; |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | if (cb != NULL) { |
| 97 | cb(fsm, CS_FSM_CB_EVENT_PROCESS_NF, fsm->curr_state, CS_FSM_STATE_NONE, new_event, data); |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | static inline void cs_fsm_state_set (struct cs_fsm* fsm, int32_t next_state, void* data, cs_fsm_cb cb) |
| 102 | { |
no outgoing calls
no test coverage detected