~ubuntu-branches/ubuntu/jaunty/isdnutils/jaunty-proposed

« back to all changes in this revision

Viewing changes to eicon/include/eicon.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2004-09-04 08:20:20 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040904082020-g641px056lshw203
Tags: 1:3.3.0.20040728-2
* Put libcapi20 development files into new libcapi20-dev package,
  change libcapi20 soname to libcapi20-3, conflict with existing
  versions of packages depending on libcapi20-3 (closes: #268767).
* Update debconf translation strings (closes: #268716).
* Update french debconf translation (closes: #269666).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: eicon.h,v 1.1 2002/07/19 18:42:02 armin Exp $
 
2
 *
 
3
 * ISDN low-level module for Eicon active ISDN-Cards.
 
4
 *
 
5
 * Copyright 1998       by Fritz Elfert (fritz@isdn4linux.de)
 
6
 * Copyright 1998-2000  by Armin Schindler (mac@melware.de) 
 
7
 * Copyright 1999,2000  Cytronics & Melware (info@melware.de)
 
8
 *
 
9
 * This software may be used and distributed according to the terms
 
10
 * of the GNU General Public License, incorporated herein by reference.
 
11
 *
 
12
 */
 
13
 
 
14
#ifndef eicon_h
 
15
#define eicon_h
 
16
 
 
17
#define EICON_IOCTL_SETMMIO   0
 
18
#define EICON_IOCTL_GETMMIO   1
 
19
#define EICON_IOCTL_SETIRQ    2
 
20
#define EICON_IOCTL_GETIRQ    3
 
21
#define EICON_IOCTL_LOADBOOT  4
 
22
#define EICON_IOCTL_ADDCARD   5
 
23
#define EICON_IOCTL_GETTYPE   6
 
24
#define EICON_IOCTL_LOADPCI   7 
 
25
#define EICON_IOCTL_LOADISA   8 
 
26
#define EICON_IOCTL_GETVER    9 
 
27
#define EICON_IOCTL_GETXLOG  10 
 
28
 
 
29
#define EICON_IOCTL_MANIF    90 
 
30
 
 
31
#define EICON_IOCTL_FREEIT   97
 
32
#define EICON_IOCTL_TEST     98
 
33
#define EICON_IOCTL_DEBUGVAR 99
 
34
 
 
35
#define EICON_IOCTL_DIA_OFFSET  100
 
36
 
 
37
/* Bus types */
 
38
#define EICON_BUS_ISA          1
 
39
#define EICON_BUS_MCA          2
 
40
#define EICON_BUS_PCI          3
 
41
 
 
42
/* Constants for describing Card-Type */
 
43
#define EICON_CTYPE_S            0
 
44
#define EICON_CTYPE_SX           1
 
45
#define EICON_CTYPE_SCOM         2
 
46
#define EICON_CTYPE_QUADRO       3
 
47
#define EICON_CTYPE_S2M          4
 
48
#define EICON_CTYPE_MAESTRA      5
 
49
#define EICON_CTYPE_MAESTRAQ     6
 
50
#define EICON_CTYPE_MAESTRAQ_U   7
 
51
#define EICON_CTYPE_MAESTRAP     8
 
52
#define EICON_CTYPE_ISABRI       0x10
 
53
#define EICON_CTYPE_ISAPRI       0x20
 
54
#define EICON_CTYPE_MASK         0x0f
 
55
#define EICON_CTYPE_QUADRO_NR(n) (n<<4)
 
56
 
 
57
#define MAX_HEADER_LEN 10
 
58
 
 
59
#define MAX_STATUS_BUFFER       150
 
60
 
 
61
/* Struct for adding new cards */
 
62
typedef struct eicon_cdef {
 
63
        int membase;
 
64
        int irq;
 
65
        char id[10];
 
66
} eicon_cdef;
 
67
 
 
68
#define EICON_ISA_BOOT_MEMCHK 1
 
69
#define EICON_ISA_BOOT_NORMAL 2
 
70
 
 
71
/* Struct for downloading protocol via ioctl for ISA cards */
 
72
/* same struct for downloading protocol via ioctl for MCA cards */
 
73
typedef struct {
 
74
        /* start-up parameters */
 
75
        unsigned char tei;
 
76
        unsigned char nt2;
 
77
        unsigned char skip1;
 
78
        unsigned char WatchDog;
 
79
        unsigned char Permanent;
 
80
        unsigned char XInterface;
 
81
        unsigned char StableL2;
 
82
        unsigned char NoOrderCheck;
 
83
        unsigned char HandsetType;
 
84
        unsigned char skip2;
 
85
        unsigned char LowChannel;
 
86
        unsigned char ProtVersion;
 
87
        unsigned char Crc4;
 
88
        unsigned char Loopback;
 
89
        unsigned char oad[32];
 
90
        unsigned char osa[32];
 
91
        unsigned char spid[32];
 
92
        unsigned char boot_opt;
 
93
        unsigned long bootstrap_len;
 
94
        unsigned long firmware_len;
 
95
        unsigned char code[1]; /* Rest (bootstrap- and firmware code) will be allocated */
 
96
} eicon_isa_codebuf;
 
97
 
 
98
/* Data for downloading protocol via ioctl */
 
99
typedef union {
 
100
        eicon_isa_codebuf isa;
 
101
        eicon_isa_codebuf mca;
 
102
} eicon_codebuf;
 
103
 
 
104
/* Data for Management interface */
 
105
typedef struct {
 
106
        int count;
 
107
        int pos;
 
108
        int length[50];
 
109
        unsigned char data[700]; 
 
110
} eicon_manifbuf;
 
111
 
 
112
#define TRACE_OK                 (1)
 
113
 
 
114
#ifdef __KERNEL__
 
115
 
 
116
/* Kernel includes */
 
117
#include <linux/config.h>
 
118
#include <linux/sched.h>
 
119
#include <linux/string.h>
 
120
#include <linux/tqueue.h>
 
121
#include <linux/interrupt.h>
 
122
#include <linux/skbuff.h>
 
123
#include <linux/errno.h>
 
124
#include <linux/fs.h>
 
125
#include <linux/major.h>
 
126
#include <asm/segment.h>
 
127
#include <asm/io.h>
 
128
#include <linux/kernel.h>
 
129
#include <linux/signal.h>
 
130
#include <linux/slab.h>
 
131
#include <linux/mm.h>
 
132
#include <linux/mman.h>
 
133
#include <linux/ioport.h>
 
134
#include <linux/timer.h>
 
135
#include <linux/wait.h>
 
136
#include <linux/delay.h>
 
137
#include <linux/ctype.h>
 
138
#include <linux/pci.h>
 
139
 
 
140
#include <linux/isdn.h>
 
141
#include <linux/isdnif.h>
 
142
 
 
143
 
 
144
typedef struct {
 
145
  __u16 length __attribute__ ((packed)); /* length of data/parameter field */
 
146
  __u8  P[1];                          /* data/parameter field */
 
147
} eicon_PBUFFER;
 
148
 
 
149
#include "eicon_isa.h"
 
150
 
 
151
#include "idi.h"
 
152
 
 
153
typedef struct {
 
154
  __u16 NextReq  __attribute__ ((packed));  /* pointer to next Req Buffer */
 
155
  __u16 NextRc   __attribute__ ((packed));  /* pointer to next Rc Buffer  */
 
156
  __u16 NextInd  __attribute__ ((packed));  /* pointer to next Ind Buffer */
 
157
  __u8 ReqInput  __attribute__ ((packed));  /* number of Req Buffers sent */
 
158
  __u8 ReqOutput  __attribute__ ((packed)); /* number of Req Buffers returned */
 
159
  __u8 ReqReserved  __attribute__ ((packed));/*number of Req Buffers reserved */
 
160
  __u8 Int  __attribute__ ((packed));       /* ISDN-P interrupt           */
 
161
  __u8 XLock  __attribute__ ((packed));     /* Lock field for arbitration */
 
162
  __u8 RcOutput  __attribute__ ((packed));  /* number of Rc buffers received */
 
163
  __u8 IndOutput  __attribute__ ((packed)); /* number of Ind buffers received */
 
164
  __u8 IMask  __attribute__ ((packed));     /* Interrupt Mask Flag        */
 
165
  __u8 Reserved1[2]  __attribute__ ((packed)); /* reserved field, do not use */
 
166
  __u8 ReadyInt  __attribute__ ((packed));  /* request field for ready int */
 
167
  __u8 Reserved2[12]  __attribute__ ((packed)); /* reserved field, do not use */
 
168
  __u8 InterfaceType  __attribute__ ((packed)); /* interface type 1=16K    */
 
169
  __u16 Signature  __attribute__ ((packed));    /* ISDN-P initialized ind  */
 
170
  __u8 B[1];                            /* buffer space for Req,Ind and Rc */
 
171
} eicon_pr_ram;
 
172
 
 
173
/* Macro for delay via schedule() */
 
174
#define SLEEP(j) {                     \
 
175
  set_current_state(TASK_UNINTERRUPTIBLE); \
 
176
  schedule_timeout(j);                 \
 
177
}
 
178
 
 
179
typedef struct {
 
180
  __u8                  Req;            /* pending request          */
 
181
  __u8                  Rc;             /* return code received     */
 
182
  __u8                  Ind;            /* indication received      */
 
183
  __u8                  ReqCh;          /* channel of current Req   */
 
184
  __u8                  RcCh;           /* channel of current Rc    */
 
185
  __u8                  IndCh;          /* channel of current Ind   */
 
186
  __u8                  D3Id;           /* ID used by this entity   */
 
187
  __u8                  B2Id;           /* ID used by this entity   */
 
188
  __u8                  GlobalId;       /* reserved field           */
 
189
  __u8                  XNum;           /* number of X-buffers      */
 
190
  __u8                  RNum;           /* number of R-buffers      */
 
191
  struct sk_buff_head   X;              /* X-buffer queue           */
 
192
  struct sk_buff_head   R;              /* R-buffer queue           */
 
193
  __u8                  RNR;            /* receive not ready flag   */
 
194
  __u8                  complete;       /* receive complete status  */
 
195
  __u8                  busy;           /* busy flag                */
 
196
  __u16                 ref;            /* saved reference          */
 
197
} entity;
 
198
 
 
199
#define FAX_MAX_SCANLINE 256
 
200
 
 
201
typedef struct {
 
202
        __u8            PrevObject;
 
203
        __u8            NextObject;
 
204
        __u8            abLine[FAX_MAX_SCANLINE];
 
205
        __u8            abFrame[FAX_MAX_SCANLINE];
 
206
        unsigned int    LineLen;
 
207
        unsigned int    LineDataLen;
 
208
        __u32           LineData;
 
209
        unsigned int    NullBytesPos;
 
210
        __u8            NullByteExist;
 
211
        int             PageCount;
 
212
        __u8            Dle;
 
213
        __u8            Eop;
 
214
} eicon_ch_fax_buf;
 
215
 
 
216
typedef struct {
 
217
        int            No;               /* Channel Number              */
 
218
        unsigned short fsm_state;        /* Current D-Channel state     */
 
219
        unsigned short statectrl;        /* State controling bits       */
 
220
        unsigned short eazmask;          /* EAZ-Mask for this Channel   */
 
221
        int             queued;          /* User-Data Bytes in TX queue */
 
222
        int             pqueued;         /* User-Data Packets in TX queue */
 
223
        int             waitq;           /* User-Data Bytes in wait queue */
 
224
        int             waitpq;          /* User-Data Bytes in packet queue */
 
225
        struct sk_buff *tskb1;           /* temp skb 1                  */
 
226
        struct sk_buff *tskb2;           /* temp skb 2                  */
 
227
        unsigned char  l2prot;           /* Layer 2 protocol            */
 
228
        unsigned char  l3prot;           /* Layer 3 protocol            */
 
229
#ifdef CONFIG_ISDN_TTY_FAX
 
230
        T30_s           *fax;            /* pointer to fax data in LL   */
 
231
        eicon_ch_fax_buf fax2;           /* fax related struct          */
 
232
#endif
 
233
        entity          e;               /* Native Entity               */
 
234
        ENTITY          de;              /* Divas D Entity              */
 
235
        ENTITY          be;              /* Divas B Entity              */
 
236
        char            cpn[32];         /* remember cpn                */
 
237
        char            oad[32];         /* remember oad                */
 
238
        char            dsa[32];         /* remember dsa                */
 
239
        char            osa[32];         /* remember osa                */
 
240
        unsigned char   cause[2];        /* Last Cause                  */
 
241
        unsigned char   si1;
 
242
        unsigned char   si2;
 
243
        unsigned char   plan;
 
244
        unsigned char   screen;
 
245
} eicon_chan;
 
246
 
 
247
typedef struct {
 
248
        eicon_chan *ptr;
 
249
} eicon_chan_ptr;
 
250
 
 
251
#include "eicon_pci.h"
 
252
 
 
253
#define EICON_FLAGS_RUNNING  1 /* Cards driver activated */
 
254
#define EICON_FLAGS_PVALID   2 /* Cards port is valid    */
 
255
#define EICON_FLAGS_IVALID   4 /* Cards irq is valid     */
 
256
#define EICON_FLAGS_MVALID   8 /* Cards membase is valid */
 
257
#define EICON_FLAGS_LOADED   8 /* Firmware loaded        */
 
258
 
 
259
/* D-Channel states */
 
260
#define EICON_STATE_NULL     0
 
261
#define EICON_STATE_ICALL    1
 
262
#define EICON_STATE_OCALL    2
 
263
#define EICON_STATE_IWAIT    3
 
264
#define EICON_STATE_OWAIT    4
 
265
#define EICON_STATE_IBWAIT   5
 
266
#define EICON_STATE_OBWAIT   6
 
267
#define EICON_STATE_BWAIT    7
 
268
#define EICON_STATE_BHWAIT   8
 
269
#define EICON_STATE_BHWAIT2  9
 
270
#define EICON_STATE_DHWAIT  10
 
271
#define EICON_STATE_DHWAIT2 11
 
272
#define EICON_STATE_BSETUP  12
 
273
#define EICON_STATE_ACTIVE  13
 
274
#define EICON_STATE_ICALLW  14
 
275
#define EICON_STATE_LISTEN  15
 
276
#define EICON_STATE_WMCONN  16
 
277
 
 
278
#define EICON_MAX_QUEUE  2138
 
279
 
 
280
typedef union {
 
281
        eicon_isa_card isa;
 
282
        eicon_pci_card pci;
 
283
        eicon_isa_card mca;
 
284
} eicon_hwif;
 
285
 
 
286
typedef struct {
 
287
        __u8 ret;
 
288
        __u8 id;
 
289
        __u8 ch;
 
290
} eicon_ack;
 
291
 
 
292
typedef struct {
 
293
        __u8 code;
 
294
        __u8 id;
 
295
        __u8 ch;
 
296
} eicon_req;
 
297
 
 
298
typedef struct {
 
299
        __u8 ret;
 
300
        __u8 id;
 
301
        __u8 ch;
 
302
        __u8 more;
 
303
} eicon_indhdr;
 
304
 
 
305
/*
 
306
 * Per card driver data
 
307
 */
 
308
typedef struct eicon_card {
 
309
        eicon_hwif hwif;                 /* Hardware dependant interface     */
 
310
        DESCRIPTOR *d;                   /* IDI Descriptor                   */
 
311
        u_char ptype;                    /* Protocol type (1TR6 or Euro)     */
 
312
        u_char bus;                      /* Bustype (ISA, MCA, PCI)          */
 
313
        u_char type;                     /* Cardtype (EICON_CTYPE_...)       */
 
314
        struct eicon_card *qnext;        /* Pointer to next quadro adapter   */
 
315
        int Feature;                     /* Protocol Feature Value           */
 
316
        struct eicon_card *next;         /* Pointer to next device struct    */
 
317
        int myid;                        /* Driver-Nr. assigned by linklevel */
 
318
        unsigned long flags;             /* Statusflags                      */
 
319
        struct sk_buff_head rcvq;        /* Receive-Message queue            */
 
320
        struct sk_buff_head sndq;        /* Send-Message queue               */
 
321
        struct sk_buff_head rackq;       /* Req-Ack-Message queue            */
 
322
        struct sk_buff_head sackq;       /* Data-Ack-Message queue           */
 
323
        struct sk_buff_head statq;       /* Status-Message queue             */
 
324
        int statq_entries;
 
325
        struct tq_struct snd_tq;         /* Task struct for xmit bh          */
 
326
        struct tq_struct rcv_tq;         /* Task struct for rcv bh           */
 
327
        struct tq_struct ack_tq;         /* Task struct for ack bh           */
 
328
        eicon_chan*     IdTable[256];    /* Table to find entity   */
 
329
        __u16  ref_in;
 
330
        __u16  ref_out;
 
331
        int    nchannels;                /* Number of B-Channels             */
 
332
        int    ReadyInt;                 /* Ready Interrupt                  */
 
333
        eicon_chan *bch;                 /* B-Channel status/control         */
 
334
        DBUFFER *dbuf;                   /* Dbuffer for Diva Server          */
 
335
        BUFFERS *sbuf;                   /* Buffer for Diva Server           */
 
336
        char *sbufp;                     /* Data Buffer for Diva Server      */
 
337
        isdn_if interface;               /* Interface to upper layer         */
 
338
        char regname[35];                /* Drivers card name                */
 
339
#ifdef CONFIG_MCA
 
340
        int     mca_slot;                /* # of cards MCA slot              */
 
341
        int     mca_io;                  /* MCA cards IO port                */
 
342
#endif /* CONFIG_MCA */
 
343
} eicon_card;
 
344
 
 
345
#include "eicon_idi.h"
 
346
 
 
347
extern eicon_card *cards;
 
348
extern char *eicon_ctype_name[];
 
349
 
 
350
 
 
351
extern __inline__ void eicon_schedule_tx(eicon_card *card)
 
352
{
 
353
        queue_task(&card->snd_tq, &tq_immediate);
 
354
        mark_bh(IMMEDIATE_BH);
 
355
}
 
356
 
 
357
extern __inline__ void eicon_schedule_rx(eicon_card *card)
 
358
{
 
359
        queue_task(&card->rcv_tq, &tq_immediate);
 
360
        mark_bh(IMMEDIATE_BH);
 
361
}
 
362
 
 
363
extern __inline__ void eicon_schedule_ack(eicon_card *card)
 
364
{
 
365
        queue_task(&card->ack_tq, &tq_immediate);
 
366
        mark_bh(IMMEDIATE_BH);
 
367
}
 
368
 
 
369
extern int eicon_addcard(int, int, int, char *, int);
 
370
extern void eicon_io_transmit(eicon_card *card);
 
371
extern void eicon_irq(int irq, void *dev_id, struct pt_regs *regs);
 
372
extern void eicon_io_rcv_dispatch(eicon_card *ccard);
 
373
extern void eicon_io_ack_dispatch(eicon_card *ccard);
 
374
#ifdef CONFIG_MCA
 
375
extern int eicon_mca_find_card(int, int, int, char *);
 
376
extern int eicon_mca_probe(int, int, int, int, char *);
 
377
extern int eicon_info(char *, int , void *);
 
378
#endif /* CONFIG_MCA */
 
379
 
 
380
extern ulong DebugVar;
 
381
extern void eicon_log(eicon_card * card, int level, const char *fmt, ...);
 
382
extern void eicon_putstatus(eicon_card * card, char * buf);
 
383
 
 
384
extern spinlock_t eicon_lock;
 
385
 
 
386
#endif  /* __KERNEL__ */
 
387
 
 
388
#endif  /* eicon_h */