Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  *
0004  * Author       Karsten Keil <kkeil@novell.com>
0005  *
0006  * Thanks to    Jan den Ouden
0007  *              Fritz Elfert
0008  * Copyright 2008  by Karsten Keil <kkeil@novell.com>
0009  */
0010 
0011 #ifndef _MISDN_FSM_H
0012 #define _MISDN_FSM_H
0013 
0014 #include <linux/timer.h>
0015 
0016 /* Statemachine */
0017 
0018 struct FsmInst;
0019 
0020 typedef void (*FSMFNPTR)(struct FsmInst *, int, void *);
0021 
0022 struct Fsm {
0023     FSMFNPTR *jumpmatrix;
0024     int state_count, event_count;
0025     char **strEvent, **strState;
0026 };
0027 
0028 struct FsmInst {
0029     struct Fsm *fsm;
0030     int state;
0031     int debug;
0032     void *userdata;
0033     int userint;
0034     void (*printdebug) (struct FsmInst *, char *, ...);
0035 };
0036 
0037 struct FsmNode {
0038     int state, event;
0039     void (*routine) (struct FsmInst *, int, void *);
0040 };
0041 
0042 struct FsmTimer {
0043     struct FsmInst *fi;
0044     struct timer_list tl;
0045     int event;
0046     void *arg;
0047 };
0048 
0049 extern int mISDN_FsmNew(struct Fsm *, struct FsmNode *, int);
0050 extern void mISDN_FsmFree(struct Fsm *);
0051 extern int mISDN_FsmEvent(struct FsmInst *, int , void *);
0052 extern void mISDN_FsmChangeState(struct FsmInst *, int);
0053 extern void mISDN_FsmInitTimer(struct FsmInst *, struct FsmTimer *);
0054 extern int mISDN_FsmAddTimer(struct FsmTimer *, int, int, void *, int);
0055 extern void mISDN_FsmRestartTimer(struct FsmTimer *, int, int, void *, int);
0056 extern void mISDN_FsmDelTimer(struct FsmTimer *, int);
0057 
0058 #endif