Import 2.3.41pre2
[davej-history.git] / include / linux / cyclomx.h
blob983295c1835778ce7c72411f6927d834014229f7
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/01/21 acme rename cyclomx_open to cyclomx_mod_inc_use_count
17 * and cyclomx_close to cyclomx_mod_dec_use_count
18 * 1999/05/19 acme wait_queue_head_t wait_stats(support for 2.3.*)
19 * 1999/01/03 acme judicious use of data types
20 * 1998/12/27 acme cleanup: PACKED not needed
21 * 1998/08/08 acme Version 0.0.1
23 #ifndef _CYCLOMX_H
24 #define _CYCLOMX_H
26 #include <linux/config.h>
27 #include <linux/wanrouter.h>
28 #include <linux/spinlock.h>
30 #ifdef __KERNEL__
31 /* Kernel Interface */
33 #include <linux/cycx_drv.h> /* Cyclom 2X support module API definitions */
34 #include <linux/cycx_cfm.h> /* Cyclom 2X firmware module definitions */
35 #ifdef CONFIG_CYCLOMX_X25
36 #include <linux/cycx_x25.h>
37 #endif
39 #ifndef min
40 #define min(a,b) (((a)<(b))?(a):(b))
41 #endif
42 #ifndef max
43 #define max(a,b) (((a)>(b))?(a):(b))
44 #endif
46 #define is_digit(ch) (((ch)>=(unsigned)'0'&&(ch)<=(unsigned)'9')?1:0)
48 /* Adapter Data Space.
49 * This structure is needed because we handle multiple cards, otherwise
50 * static data would do it.
52 typedef struct cycx {
53 char devname[WAN_DRVNAME_SZ+1]; /* card name */
54 cycxhw_t hw; /* hardware configuration */
55 wan_device_t wandev; /* WAN device data space */
56 u32 open_cnt; /* number of open interfaces */
57 u32 state_tick; /* link state timestamp */
58 spinlock_t lock;
59 char in_isr; /* interrupt-in-service flag */
60 char buff_int_mode_unbusy; /* flag for carrying out dev_tint */
61 #if (LINUX_VERSION_CODE >= 0x20300)
62 wait_queue_head_t wait_stats; /* to wait for the STATS indication */
63 #else
64 struct wait_queue* wait_stats; /* to wait for the STATS indication */
65 #endif
66 u32 mbox; /* -> mailbox */
67 void (*isr)(struct cycx* card); /* interrupt service routine */
68 int (*exec)(struct cycx* card, void* u_cmd, void* u_data);
69 union {
70 #ifdef CONFIG_CYCLOMX_X25
71 struct { /* X.25 specific data */
72 u32 lo_pvc;
73 u32 hi_pvc;
74 u32 lo_svc;
75 u32 hi_svc;
76 TX25Stats stats;
77 spinlock_t lock;
78 u32 connection_keys;
79 } x;
80 #endif
81 } u;
82 } cycx_t;
84 /* Public Functions */
85 void cyclomx_mod_inc_use_count (cycx_t *card); /* cycx_main.c */
86 void cyclomx_mod_dec_use_count (cycx_t *card); /* cycx_main.c */
87 void cyclomx_set_state (cycx_t *card, int state); /* cycx_main.c */
89 #ifdef CONFIG_CYCLOMX_X25
90 int cyx_init (cycx_t *card, wandev_conf_t *conf); /* cycx_x25.c */
91 #endif
92 #endif /* __KERNEL__ */
93 #endif /* _CYCLOMX_H */