- Kai Germaschewski: ISDN update (including Makefiles)
[davej-history.git] / include / linux / cyclomx.h
blob555d38fbeed65e42afbdc7272606cb23cf6b1a17
1 /*
2 * cyclomx.h Cyclom 2X WAN Link Driver.
3 * User-level API definitions.
5 * Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
7 * Copyright: (c) 1998-2000 Arnaldo Carvalho de Melo
9 * Based on wanpipe.h by Gene Kozin <genek@compuserve.com>
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
15 * ============================================================================
16 * 2000/07/13 acme remove crap #if KERNEL_VERSION > blah
17 * 2000/01/21 acme rename cyclomx_open to cyclomx_mod_inc_use_count
18 * and cyclomx_close to cyclomx_mod_dec_use_count
19 * 1999/05/19 acme wait_queue_head_t wait_stats(support for 2.3.*)
20 * 1999/01/03 acme judicious use of data types
21 * 1998/12/27 acme cleanup: PACKED not needed
22 * 1998/08/08 acme Version 0.0.1
24 #ifndef _CYCLOMX_H
25 #define _CYCLOMX_H
27 #include <linux/config.h>
28 #include <linux/wanrouter.h>
29 #include <linux/spinlock.h>
31 #ifdef __KERNEL__
32 /* Kernel Interface */
34 #include <linux/cycx_drv.h> /* Cyclom 2X support module API definitions */
35 #include <linux/cycx_cfm.h> /* Cyclom 2X firmware module definitions */
36 #ifdef CONFIG_CYCLOMX_X25
37 #include <linux/cycx_x25.h>
38 #endif
40 #ifndef min
41 #define min(a,b) (((a)<(b))?(a):(b))
42 #endif
43 #ifndef max
44 #define max(a,b) (((a)>(b))?(a):(b))
45 #endif
47 #define is_digit(ch) (((ch)>=(unsigned)'0'&&(ch)<=(unsigned)'9')?1:0)
49 /* Adapter Data Space.
50 * This structure is needed because we handle multiple cards, otherwise
51 * static data would do it.
53 typedef struct cycx {
54 char devname[WAN_DRVNAME_SZ+1]; /* card name */
55 cycxhw_t hw; /* hardware configuration */
56 wan_device_t wandev; /* WAN device data space */
57 u32 open_cnt; /* number of open interfaces */
58 u32 state_tick; /* link state timestamp */
59 spinlock_t lock;
60 char in_isr; /* interrupt-in-service flag */
61 char buff_int_mode_unbusy; /* flag for carrying out dev_tint */
62 wait_queue_head_t wait_stats; /* to wait for the STATS indication */
63 u32 mbox; /* -> mailbox */
64 void (*isr)(struct cycx* card); /* interrupt service routine */
65 int (*exec)(struct cycx* card, void* u_cmd, void* u_data);
66 union {
67 #ifdef CONFIG_CYCLOMX_X25
68 struct { /* X.25 specific data */
69 u32 lo_pvc;
70 u32 hi_pvc;
71 u32 lo_svc;
72 u32 hi_svc;
73 TX25Stats stats;
74 spinlock_t lock;
75 u32 connection_keys;
76 } x;
77 #endif
78 } u;
79 } cycx_t;
81 /* Public Functions */
82 void cyclomx_mod_inc_use_count (cycx_t *card); /* cycx_main.c */
83 void cyclomx_mod_dec_use_count (cycx_t *card); /* cycx_main.c */
84 void cyclomx_set_state (cycx_t *card, int state); /* cycx_main.c */
86 #ifdef CONFIG_CYCLOMX_X25
87 int cyx_init (cycx_t *card, wandev_conf_t *conf); /* cycx_x25.c */
88 #endif
89 #endif /* __KERNEL__ */
90 #endif /* _CYCLOMX_H */