From fa581f7120af893d256f62ffef394cdd59caa356 Mon Sep 17 00:00:00 2001 From: Kai Germaschewski Date: Tue, 29 Oct 2002 08:25:55 -0600 Subject: 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. --- include/linux/isdn.h | 4 +--- include/linux/isdn/fsm.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 include/linux/isdn/fsm.h (limited to 'include/linux') 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 - -// FIXME!!! -#include <../drivers/isdn/i4l/isdn_fsm.h> +#include #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 + * 2001-2002 by Kai Germaschewski + * + * 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 +#include + +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 -- cgit v1.2.3