diff options
| author | Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> | 2002-10-29 08:25:55 -0600 |
|---|---|---|
| committer | Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> | 2002-10-29 08:25:55 -0600 |
| commit | fa581f7120af893d256f62ffef394cdd59caa356 (patch) | |
| tree | 4f46ff0f9f91d368ec0bc90186721d4853dc1472 /include/linux | |
| parent | c892e27cf05d4224daba94ce333c4aa9f257028f (diff) | |
ISDN: Move drivers/isdn/i4l/isdn_fsm.h include/linux/isdn/fsm.h
Though I've been mostly moving stuff out of include/linux and into
drivers/isdn/i4l, the finite state machine definitions actually need
to be more wildly accessible, so they go the opposite way.
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 |
