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