Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
fsm.c File Reference
#include "fsm.h"
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/timer.h>

Go to the source code of this file.

Functions

 MODULE_AUTHOR ("(C) 2000 IBM Corp. by Fritz Elfert ([email protected])")
 
 MODULE_DESCRIPTION ("Finite state machine helper functions")
 
 MODULE_LICENSE ("GPL")
 
fsm_instanceinit_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 *this)
 
const charfsm_getstate_str (fsm_instance *fi)
 
void fsm_settimer (fsm_instance *fi, fsm_timer *this)
 
void fsm_deltimer (fsm_timer *this)
 
int fsm_addtimer (fsm_timer *this, int millisec, int event, void *arg)
 
void fsm_modtimer (fsm_timer *this, int millisec, int event, void *arg)
 
 EXPORT_SYMBOL (init_fsm)
 
 EXPORT_SYMBOL (kfree_fsm)
 
 EXPORT_SYMBOL (fsm_settimer)
 
 EXPORT_SYMBOL (fsm_deltimer)
 
 EXPORT_SYMBOL (fsm_addtimer)
 
 EXPORT_SYMBOL (fsm_modtimer)
 
 EXPORT_SYMBOL (fsm_getstate_str)
 

Function Documentation

EXPORT_SYMBOL ( init_fsm  )
EXPORT_SYMBOL ( kfree_fsm  )
EXPORT_SYMBOL ( fsm_settimer  )
EXPORT_SYMBOL ( fsm_deltimer  )
EXPORT_SYMBOL ( fsm_addtimer  )
EXPORT_SYMBOL ( fsm_modtimer  )
EXPORT_SYMBOL ( fsm_getstate_str  )
int fsm_addtimer ( fsm_timer timer,
int  millisec,
int  event,
void arg 
)

Adds and starts a timer to an FSM instance.

Parameters
timerThe timer to be added. The field fi of that timer must have been set to point to the instance.
millisecDuration, after which the timer should expire.
eventEvent, to trigger if timer expires.
argGeneric argument, provided to expiry function.
Returns
0 on success, -1 if timer is already active.

Definition at line 165 of file fsm.c.

void fsm_deltimer ( fsm_timer timer)

Clears a pending timer of an FSM instance.

Parameters
timerThe timer to clear.

Definition at line 155 of file fsm.c.

const char* fsm_getstate_str ( fsm_instance fi)

Retrieves the name of the state of an FSM

Parameters
fiPointer to FSM
Returns
The current state of the FSM in a human readable form.

Definition at line 123 of file fsm.c.

void fsm_modtimer ( fsm_timer timer,
int  millisec,
int  event,
void arg 
)

Modifies a timer of an FSM.

Parameters
timerThe timer to modify.
millisecDuration, after which the timer should expire.
eventEvent, to trigger if timer expires.
argGeneric argument, provided to expiry function.

Definition at line 185 of file fsm.c.

void fsm_settimer ( fsm_instance fi,
fsm_timer  
)

Initializes a timer for an FSM. This prepares an fsm_timer for usage with fsm_addtimer.

Parameters
fiPointer to FSM
timerThe timer to be initialized.

Definition at line 142 of file fsm.c.

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 
)

Creates an FSM

Parameters
nameName of this instance for logging purposes.
state_namesAn array of names for all states for logging purposes.
event_namesAn array of names for all events for logging purposes.
nr_statesNumber of states for this instance.
nr_eventsNumber of events for this instance.
tmplAn array of fsm_nodes, describing this FSM.
tmpl_lenLength of the describing array.
orderParameter for allocation of the FSM data structs.

Definition at line 16 of file fsm.c.

void kfree_fsm ( fsm_instance fi)

Releases an FSM

Parameters
fiPointer to an FSM, previously created with init_fsm.

Definition at line 72 of file fsm.c.

MODULE_AUTHOR ( "(C) 2000 IBM Corp. by Fritz Elfert ([email protected])"  )

A generic FSM based on fsm used in isdn4linux

MODULE_DESCRIPTION ( "Finite state machine helper functions"  )
MODULE_LICENSE ( "GPL"  )