#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/timer.h>
#include <linux/time.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/string.h>
#include <linux/atomic.h>
Go to the source code of this file.
|
fsm_instance * | init_fsm (char *name, const char **state_names, const char **event_names, int nr_states, int nr_events, const fsm_node *tmpl, int tmpl_len, gfp_t order) |
|
void | kfree_fsm (fsm_instance *fi) |
|
const char * | fsm_getstate_str (fsm_instance *fi) |
|
void | fsm_settimer (fsm_instance *fi, fsm_timer *) |
|
void | fsm_deltimer (fsm_timer *timer) |
|
int | fsm_addtimer (fsm_timer *timer, int millisec, int event, void *arg) |
|
void | fsm_modtimer (fsm_timer *timer, int millisec, int event, void *arg) |
|
Define this to get debugging messages.
Definition at line 16 of file fsm.h.
#define FSM_DEBUG_HISTORY 0 |
Define these to record a history of Events/Statechanges and print it if a action_function is not found.
Definition at line 29 of file fsm.h.
#define FSM_HISTORY_SIZE 40 |
Definition at line 30 of file fsm.h.
#define FSM_TIMER_DEBUG 0 |
Define this to get debugging massages for timer handling.
Definition at line 22 of file fsm.h.
Definition of an action function, called by a FSM
Definition at line 37 of file fsm.h.
Adds and starts a timer to an FSM instance.
- Parameters
-
timer | The timer to be added. The field fi of that timer must have been set to point to the instance. |
millisec | Duration, after which the timer should expire. |
event | Event, to trigger if timer expires. |
arg | Generic argument, provided to expiry function. |
- Returns
- 0 on success, -1 if timer is already active.
Definition at line 165 of file fsm.c.
Clears a pending timer of an FSM instance.
- Parameters
-
Definition at line 155 of file fsm.c.
Retrieves the name of the state of an FSM
- Parameters
-
- Returns
- The current state of the FSM in a human readable form.
Definition at line 123 of file fsm.c.
Modifies a timer of an FSM.
- Parameters
-
timer | The timer to modify. |
millisec | Duration, after which the timer should expire. |
event | Event, to trigger if timer expires. |
arg | Generic argument, provided to expiry function. |
Definition at line 185 of file fsm.c.
Initializes a timer for an FSM. This prepares an fsm_timer for usage with fsm_addtimer.
- Parameters
-
fi | Pointer to FSM |
timer | The timer to be initialized. |
Definition at line 142 of file fsm.c.
Creates an FSM
- Parameters
-
name | Name of this instance for logging purposes. |
state_names | An array of names for all states for logging purposes. |
event_names | An array of names for all events for logging purposes. |
nr_states | Number of states for this instance. |
nr_events | Number of events for this instance. |
tmpl | An array of fsm_nodes, describing this FSM. |
tmpl_len | Length of the describing array. |
order | Parameter for allocation of the FSM data structs. |
Definition at line 16 of file fsm.c.
Releases an FSM
- Parameters
-
fi | Pointer to an FSM, previously created with init_fsm. |
Definition at line 72 of file fsm.c.