diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/isdn.h | 4 | ||||
| -rw-r--r-- | include/linux/isdn/fsm.h | 58 |
2 files changed, 59 insertions, 3 deletions
diff --git a/include/linux/isdn.h b/include/linux/isdn.h index 42baf99a835a..5055fbe6b687 100644 --- a/include/linux/isdn.h +++ b/include/linux/isdn.h @@ -14,9 +14,7 @@ #define __ISDN_H__ #include <linux/ioctl.h> - -// FIXME!!! -#include <../drivers/isdn/i4l/isdn_fsm.h> +#include <linux/isdn/fsm.h> #ifdef CONFIG_COBALT_MICRO_SERVER /* Save memory */ diff --git a/include/linux/isdn/fsm.h b/include/linux/isdn/fsm.h new file mode 100644 index 000000000000..95beb142b392 --- /dev/null +++ b/include/linux/isdn/fsm.h @@ -0,0 +1,58 @@ +/* Linux ISDN subsystem, finite state machine + * + * Author Karsten Keil + * Copyright by Karsten Keil <keil@isdn4linux.de> + * 2001-2002 by Kai Germaschewski <kai@germaschewski.name> + * + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + */ + +#ifndef __ISDN_FSM_H__ +#define __ISDN_FSM_H__ + +#include <linux/kernel.h> +#include <linux/timer.h> + +struct fsm_inst; + +typedef int (*fsm_fn)(struct fsm_inst *, int, void *); + +struct fsm { + fsm_fn *jumpmatrix; + int st_cnt, ev_cnt, fn_cnt; + char **st_str, **ev_str; + struct fsm_node *fn_tbl; +}; + +struct fsm_inst { + struct fsm *fsm; + int state; + int debug; + void *userdata; + int userint; + void (*printdebug) (struct fsm_inst *, char *, ...); +}; + +struct fsm_node { + int st, ev; + fsm_fn fn; +}; + +struct fsm_timer { + struct fsm_inst *fi; + struct timer_list tl; + int ev; + void *arg; +}; + +int fsm_new(struct fsm *fsm); +void fsm_free(struct fsm *fsm); +int fsm_event(struct fsm_inst *fi, int event, void *arg); +void fsm_change_state(struct fsm_inst *fi, int newstate); +void fsm_init_timer(struct fsm_inst *fi, struct fsm_timer *ft); +int fsm_add_timer(struct fsm_timer *ft, int timeout, int event); +void fsm_mod_timer(struct fsm_timer *ft, int timeout, int event); +void fsm_del_timer(struct fsm_timer *ft); + +#endif |
