1
2
3
4
5
6
7
8
9
10
11
12
13
14 #ifndef HYSDN_DEFS_H
15 #define HYSDN_DEFS_H
16
17 #include <linux/hysdn_if.h>
18 #include <linux/interrupt.h>
19 #include <linux/workqueue.h>
20 #include <linux/skbuff.h>
21
22 #include "ince1pc.h"
23
24 #ifdef CONFIG_HYSDN_CAPI
25 #include <linux/capi.h>
26 #include <linux/isdn/capicmd.h>
27 #include <linux/isdn/capiutil.h>
28 #include <linux/isdn/capilli.h>
29
30
31
32
33
34 #define GLOBAL_OPTION_INTERNAL_CONTROLLER 0x0001
35 #define GLOBAL_OPTION_EXTERNAL_CONTROLLER 0x0002
36 #define GLOBAL_OPTION_HANDSET 0x0004
37 #define GLOBAL_OPTION_DTMF 0x0008
38 #define GLOBAL_OPTION_SUPPL_SERVICES 0x0010
39 #define GLOBAL_OPTION_CHANNEL_ALLOCATION 0x0020
40 #define GLOBAL_OPTION_B_CHANNEL_OPERATION 0x0040
41
42 #define B1_PROT_64KBIT_HDLC 0x0001
43 #define B1_PROT_64KBIT_TRANSPARENT 0x0002
44 #define B1_PROT_V110_ASYNCH 0x0004
45 #define B1_PROT_V110_SYNCH 0x0008
46 #define B1_PROT_T30 0x0010
47 #define B1_PROT_64KBIT_INV_HDLC 0x0020
48 #define B1_PROT_56KBIT_TRANSPARENT 0x0040
49
50 #define B2_PROT_ISO7776 0x0001
51 #define B2_PROT_TRANSPARENT 0x0002
52 #define B2_PROT_SDLC 0x0004
53 #define B2_PROT_LAPD 0x0008
54 #define B2_PROT_T30 0x0010
55 #define B2_PROT_PPP 0x0020
56 #define B2_PROT_TRANSPARENT_IGNORE_B1_FRAMING_ERRORS 0x0040
57
58 #define B3_PROT_TRANSPARENT 0x0001
59 #define B3_PROT_T90NL 0x0002
60 #define B3_PROT_ISO8208 0x0004
61 #define B3_PROT_X25_DCE 0x0008
62 #define B3_PROT_T30 0x0010
63 #define B3_PROT_T30EXT 0x0020
64
65 #define HYSDN_MAXVERSION 8
66
67
68 #define HYSDN_MAX_CAPI_SKB 20
69
70 #endif
71
72
73
74
75 #define LOG_MAX_LINELEN 120
76 #define DEB_OUT_SYSLOG 0x80000000
77 #define LOG_MEM_ERR 0x00000001
78 #define LOG_POF_OPEN 0x00000010
79 #define LOG_POF_RECORD 0x00000020
80 #define LOG_POF_WRITE 0x00000040
81 #define LOG_POF_CARD 0x00000080
82 #define LOG_CNF_LINE 0x00000100
83 #define LOG_CNF_DATA 0x00000200
84 #define LOG_CNF_MISC 0x00000400
85 #define LOG_SCHED_ASYN 0x00001000
86 #define LOG_PROC_OPEN 0x00100000
87 #define LOG_PROC_ALL 0x00200000
88 #define LOG_NET_INIT 0x00010000
89
90 #define DEF_DEB_FLAGS 0x7fff000f
91
92
93
94
95 #define PROC_SUBDIR_NAME "hysdn"
96 #define PROC_CONF_BASENAME "cardconf"
97 #define PROC_LOG_BASENAME "cardlog"
98
99
100
101
102 #define PCI_REG_PLX_MEM_BASE 0
103 #define PCI_REG_PLX_IO_BASE 1
104 #define PCI_REG_MEMORY_BASE 3
105
106
107
108
109 #define BD_NONE 0U
110 #define BD_PERFORMANCE 1U
111 #define BD_VALUE 2U
112 #define BD_PCCARD 3U
113 #define BD_ERGO 4U
114 #define BD_METRO 5U
115 #define BD_CHAMP2 6U
116 #define BD_PLEXUS 7U
117
118
119
120
121 #define CARD_STATE_UNUSED 0
122 #define CARD_STATE_BOOTING 1
123 #define CARD_STATE_BOOTERR 2
124 #define CARD_STATE_RUN 3
125
126
127
128
129 #define ERRLOG_STATE_OFF 0
130 #define ERRLOG_STATE_ON 1
131 #define ERRLOG_STATE_START 2
132 #define ERRLOG_STATE_STOP 3
133
134
135
136
137 typedef struct HYSDN_CARD {
138
139
140 int myid;
141 unsigned char bus;
142 unsigned char devfn;
143 unsigned short subsysid;
144 unsigned char brdtype;
145 unsigned int bchans;
146 unsigned int faxchans;
147 unsigned char mac_addr[6];
148 unsigned int irq;
149 unsigned int iobase;
150 unsigned long plxbase;
151 unsigned long membase;
152 unsigned long memend;
153 void *dpram;
154 int state;
155 struct HYSDN_CARD *next;
156
157
158 void *proclog;
159 void *procconf;
160
161
162 unsigned char err_log_state;
163 unsigned long debug_flags;
164 void (*set_errlog_state) (struct HYSDN_CARD *, int);
165
166
167 struct work_struct irq_queue;
168 unsigned char volatile irq_enabled;
169 unsigned char volatile hw_lock;
170
171
172 void *boot;
173 int (*writebootimg) (struct HYSDN_CARD *, unsigned char *, unsigned long);
174 int (*writebootseq) (struct HYSDN_CARD *, unsigned char *, int);
175 int (*waitpofready) (struct HYSDN_CARD *);
176 int (*testram) (struct HYSDN_CARD *);
177
178
179 unsigned char async_data[256];
180 unsigned short volatile async_len;
181 unsigned short volatile async_channel;
182 int volatile async_busy;
183 int volatile net_tx_busy;
184
185
186 void *netif;
187
188
189 void (*stopcard) (struct HYSDN_CARD *);
190 void (*releasehardware) (struct HYSDN_CARD *);
191
192 spinlock_t hysdn_lock;
193 #ifdef CONFIG_HYSDN_CAPI
194 struct hycapictrl_info {
195 char cardname[32];
196 spinlock_t lock;
197 int versionlen;
198 char versionbuf[1024];
199 char *version[HYSDN_MAXVERSION];
200
201 char infobuf[128];
202
203 struct HYSDN_CARD *card;
204 struct capi_ctr capi_ctrl;
205 struct sk_buff *skbs[HYSDN_MAX_CAPI_SKB];
206 int in_idx, out_idx;
207 int sk_count;
208 struct sk_buff *tx_skb;
209
210 struct list_head ncci_head;
211 } *hyctrlinfo;
212 #endif
213 } hysdn_card;
214
215 #ifdef CONFIG_HYSDN_CAPI
216 typedef struct hycapictrl_info hycapictrl_info;
217 #endif
218
219
220
221
222
223 extern hysdn_card *card_root;
224
225
226
227
228
229
230
231
232 extern int hysdn_procconf_init(void);
233 extern void hysdn_procconf_release(void);
234
235
236 extern int hysdn_proclog_init(hysdn_card *);
237 extern void hysdn_proclog_release(hysdn_card *);
238 extern void hysdn_addlog(hysdn_card *, char *, ...);
239 extern void hysdn_card_errlog(hysdn_card *, tErrLogEntry *, int);
240
241
242 extern int ergo_inithardware(hysdn_card *card);
243
244
245 extern int pof_write_close(hysdn_card *);
246 extern int pof_write_open(hysdn_card *, unsigned char **);
247 extern int pof_write_buffer(hysdn_card *, int);
248 extern int EvalSysrTokData(hysdn_card *, unsigned char *, int);
249
250
251 extern int hysdn_sched_tx(hysdn_card *, unsigned char *,
252 unsigned short volatile *, unsigned short volatile *,
253 unsigned short);
254 extern int hysdn_sched_rx(hysdn_card *, unsigned char *, unsigned short,
255 unsigned short);
256 extern int hysdn_tx_cfgline(hysdn_card *, unsigned char *,
257 unsigned short);
258
259
260 extern unsigned int hynet_enable;
261 extern int hysdn_net_create(hysdn_card *);
262 extern int hysdn_net_release(hysdn_card *);
263 extern char *hysdn_net_getname(hysdn_card *);
264 extern void hysdn_tx_netack(hysdn_card *);
265 extern struct sk_buff *hysdn_tx_netget(hysdn_card *);
266 extern void hysdn_rx_netpkt(hysdn_card *, unsigned char *,
267 unsigned short);
268
269 #ifdef CONFIG_HYSDN_CAPI
270 extern unsigned int hycapi_enable;
271 extern int hycapi_capi_create(hysdn_card *);
272 extern int hycapi_capi_release(hysdn_card *);
273 extern int hycapi_capi_stop(hysdn_card *card);
274 extern void hycapi_rx_capipkt(hysdn_card *card, unsigned char *buf,
275 unsigned short len);
276 extern void hycapi_tx_capiack(hysdn_card *card);
277 extern struct sk_buff *hycapi_tx_capiget(hysdn_card *card);
278 extern int hycapi_init(void);
279 extern void hycapi_cleanup(void);
280 #endif
281
282 #endif