Lines Matching refs:state

15  * implement a state machine. In addition to including this header file, each
16 * file implementing a state machine must define STATE_MACHINE_DATA to be the
17 * data structure including state variables (enum machine_state,
20 * a group of state machines with shared data structure, STATE_MACHINE_ADDR
22 * SM_ENTRY_M macro can be used to define similar group of state machines
30 * SM_STATE - Declaration of a state machine function
32 * @state: State machine state
34 * This macro is used to declare a state machine function. It is used in place
35 * of a C function definition to declare functions to be run when the state is
38 #define SM_STATE(machine, state) \
39 static void sm_ ## machine ## _ ## state ## _Enter(STATE_MACHINE_DATA *sm, \
45 * @state: State machine state
47 * This macro is used inside each state machine function declared with
50 * information about state transition and update the state machine state.
52 #define SM_ENTRY(machine, state) \
53 if (!global || sm->machine ## _state != machine ## _ ## state) { \
56 " entering state " #state); \
58 sm->machine ## _state = machine ## _ ## state;
61 * SM_ENTRY_M - State machine function entry point for state machine group
63 * @_state: State machine state
66 * This macro is like SM_ENTRY, but for state machine groups that use a shared
67 * data structure for more than one state machine. Both machine and prefix
68 * parameters are set to "sub-state machine" name. prefix is used to allow more
69 * than one state variable to be stored in the same data structure.
72 if (!global || sm->data ## _ ## state != machine ## _ ## _state) { \
75 #machine " entering state " #_state); \
77 sm->data ## _ ## state = machine ## _ ## _state;
80 * SM_ENTRY_MA - State machine function entry point for state machine group
82 * @_state: State machine state
90 if (!global || sm->data ## _ ## state != machine ## _ ## _state) { \
93 #machine " entering state " #_state, \
96 sm->data ## _ ## state = machine ## _ ## _state;
99 * SM_ENTER - Enter a new state machine state
101 * @state: State machine state
103 * This macro expands to a function call to a state machine function defined
104 * with SM_STATE macro. SM_ENTER is used in a state machine step function to
105 * move the state machine to a new state.
107 #define SM_ENTER(machine, state) \
108 sm_ ## machine ## _ ## state ## _Enter(sm, 0)
111 * SM_ENTER_GLOBAL - Enter a new state machine state based on global rule
113 * @state: State machine state
115 * This macro is like SM_ENTER, but this is used when entering a new state
116 * based on a global (not specific to any particular state) rule. A separate
118 * rule is forcing a state machine to remain in on state.
120 #define SM_ENTER_GLOBAL(machine, state) \
121 sm_ ## machine ## _ ## state ## _Enter(sm, 1)
124 * SM_STEP - Declaration of a state machine step function
127 * This macro is used to declare a state machine step function. It is used in
129 * state machine to a new state based on state variables. This function uses
130 * SM_ENTER and SM_ENTER_GLOBAL macros to enter new state.
136 * SM_STEP_RUN - Call the state machine step function
139 * This macro expands to a function call to a state machine step function