Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[linux/fpc-iii.git] / drivers / isdn / mISDN / fsm.h
blob928f5be192c1fd4a5c8197160efb9dad21e1141d
1 /*
3 * Author Karsten Keil <kkeil@novell.com>
5 * Thanks to Jan den Ouden
6 * Fritz Elfert
7 * Copyright 2008 by Karsten Keil <kkeil@novell.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
20 #ifndef _MISDN_FSM_H
21 #define _MISDN_FSM_H
23 #include <linux/timer.h>
25 /* Statemachine */
27 struct FsmInst;
29 typedef void (*FSMFNPTR)(struct FsmInst *, int, void *);
31 struct Fsm {
32 FSMFNPTR *jumpmatrix;
33 int state_count, event_count;
34 char **strEvent, **strState;
37 struct FsmInst {
38 struct Fsm *fsm;
39 int state;
40 int debug;
41 void *userdata;
42 int userint;
43 void (*printdebug) (struct FsmInst *, char *, ...);
46 struct FsmNode {
47 int state, event;
48 void (*routine) (struct FsmInst *, int, void *);
51 struct FsmTimer {
52 struct FsmInst *fi;
53 struct timer_list tl;
54 int event;
55 void *arg;
58 extern void mISDN_FsmNew(struct Fsm *, struct FsmNode *, int);
59 extern void mISDN_FsmFree(struct Fsm *);
60 extern int mISDN_FsmEvent(struct FsmInst *, int , void *);
61 extern void mISDN_FsmChangeState(struct FsmInst *, int);
62 extern void mISDN_FsmInitTimer(struct FsmInst *, struct FsmTimer *);
63 extern int mISDN_FsmAddTimer(struct FsmTimer *, int, int, void *, int);
64 extern void mISDN_FsmRestartTimer(struct FsmTimer *, int, int, void *, int);
65 extern void mISDN_FsmDelTimer(struct FsmTimer *, int);
67 #endif