[PATCH] g_file_storage: fix obscure race condition
[linux/fpc-iii.git] / drivers / isdn / hisax / fsm.h
blobf02f7da1688da64d8bd20b9c865339ccf84b7199
1 /* $Id: fsm.h,v 1.3.2.2 2001/09/23 22:24:47 kai Exp $
3 * Finite state machine
5 * Author Karsten Keil
6 * Copyright by Karsten Keil <keil@isdn4linux.de>
7 * by Kai Germaschewski <kai.germaschewski@gmx.de>
8 *
9 * This software may be used and distributed according to the terms
10 * of the GNU General Public License, incorporated herein by reference.
14 #ifndef __FSM_H__
15 #define __FSM_H__
17 #include <linux/timer.h>
19 struct FsmInst;
21 typedef void (* FSMFNPTR)(struct FsmInst *, int, void *);
23 struct Fsm {
24 FSMFNPTR *jumpmatrix;
25 int state_count, event_count;
26 char **strEvent, **strState;
29 struct FsmInst {
30 struct Fsm *fsm;
31 int state;
32 int debug;
33 void *userdata;
34 int userint;
35 void (*printdebug) (struct FsmInst *, char *, ...);
38 struct FsmNode {
39 int state, event;
40 void (*routine) (struct FsmInst *, int, void *);
43 struct FsmTimer {
44 struct FsmInst *fi;
45 struct timer_list tl;
46 int event;
47 void *arg;
50 int FsmNew(struct Fsm *fsm, struct FsmNode *fnlist, int fncount);
51 void FsmFree(struct Fsm *fsm);
52 int FsmEvent(struct FsmInst *fi, int event, void *arg);
53 void FsmChangeState(struct FsmInst *fi, int newstate);
54 void FsmInitTimer(struct FsmInst *fi, struct FsmTimer *ft);
55 int FsmAddTimer(struct FsmTimer *ft, int millisec, int event,
56 void *arg, int where);
57 void FsmRestartTimer(struct FsmTimer *ft, int millisec, int event,
58 void *arg, int where);
59 void FsmDelTimer(struct FsmTimer *ft, int where);
61 #endif