pre-2.3.4..
[davej-history.git] / drivers / isdn / hisax / hisax.h
blob36cd82ee12d3e4105ad4e24e83a6f27805a80724
1 /* $Id: hisax.h,v 2.26 1998/11/15 23:54:45 keil Exp $
3 * Basic declarations, defines and prototypes
5 * $Log: hisax.h,v $
6 * Revision 2.26 1998/11/15 23:54:45 keil
7 * changes from 2.0
9 * Revision 2.25 1998/09/30 22:28:42 keil
10 * More work for ISAR support
12 * Revision 2.24 1998/08/20 13:50:39 keil
13 * More support for hybrid modem (not working yet)
15 * Revision 2.23 1998/08/13 23:36:31 keil
16 * HiSax 3.1 - don't work stable with current LinkLevel
18 * Revision 2.22 1998/07/15 15:01:28 calle
19 * Support for AVM passive PCMCIA cards:
20 * A1 PCMCIA, FRITZ!Card PCMCIA and FRITZ!Card PCMCIA 2.0
22 * Revision 2.21 1998/05/25 14:10:05 keil
23 * HiSax 3.0
24 * X.75 and leased are working again.
26 * Revision 2.20 1998/05/25 12:57:57 keil
27 * HiSax golden code from certification, Don't use !!!
28 * No leased lines, no X75, but many changes.
30 * Revision 2.19 1998/04/15 16:39:15 keil
31 * Add S0Box and Teles PCI support
33 * Revision 2.18 1998/03/26 07:10:04 paul
34 * The jumpmatrix table in struct Fsm was an array of "int". This is not
35 * large enough for pointers to functions on Linux/Alpha (instant crash
36 * on "insmod hisax). Now there is a typedef for the pointer to function.
37 * This also prevents warnings about "incompatible pointer types".
39 * Revision 2.17 1998/03/19 13:18:43 keil
40 * Start of a CAPI like interface for supplementary Service
41 * first service: SUSPEND
43 * Revision 2.16 1998/03/09 23:19:25 keil
44 * Changes for PCMCIA
46 * Revision 2.14 1998/02/11 17:28:04 keil
47 * Niccy PnP/PCI support
49 * Revision 2.13 1998/02/09 18:46:02 keil
50 * Support for Sedlbauer PCMCIA (Marcus Niemann)
52 * Revision 2.12 1998/02/03 23:31:30 keil
53 * add AMD7930 support
55 * Revision 2.11 1998/02/02 13:33:00 keil
56 * New card support
58 * Revision 2.10 1997/11/08 21:37:52 keil
59 * new l1 init;new Compaq card
61 * Revision 2.9 1997/11/06 17:09:09 keil
62 * New 2.1 init code
64 * Revision 2.8 1997/10/29 19:04:13 keil
65 * new L1; changes for 2.1
67 * Revision 2.7 1997/10/10 20:56:47 fritz
68 * New HL interface.
70 * Revision 2.6 1997/09/11 17:25:51 keil
71 * Add new cards
73 * Revision 2.5 1997/08/03 14:36:31 keil
74 * Implement RESTART procedure
76 * Revision 2.4 1997/07/31 19:25:20 keil
77 * PTP_DATA_LINK support
79 * Revision 2.3 1997/07/31 11:50:17 keil
80 * ONE TEI and FIXED TEI handling
82 * Revision 2.2 1997/07/30 17:13:02 keil
83 * more changes for 'One TEI per card'
85 * Revision 2.1 1997/07/27 21:45:13 keil
86 * new main structures
88 * Revision 2.0 1997/06/26 11:06:27 keil
89 * New card and L1 interface.
90 * Eicon.Diehl Diva and Dynalink IS64PH support
92 * old changes removed KKe
95 #include <linux/config.h>
96 #include <linux/module.h>
97 #include <linux/version.h>
98 #include <linux/errno.h>
99 #include <linux/fs.h>
100 #include <linux/major.h>
101 #include <asm/segment.h>
102 #include <asm/io.h>
103 #include <linux/delay.h>
104 #include <linux/kernel.h>
105 #include <linux/signal.h>
106 #include <linux/malloc.h>
107 #include <linux/mm.h>
108 #include <linux/mman.h>
109 #include <linux/ioport.h>
110 #include <linux/timer.h>
111 #include <linux/wait.h>
112 #include <linux/isdnif.h>
113 #include <linux/tty.h>
114 #include <linux/init.h>
115 #include <linux/serialP.h>
117 #define REQUEST 0
118 #define CONFIRM 1
119 #define INDICATION 2
120 #define RESPONSE 3
122 #define HW_ENABLE 0x0000
123 #define HW_RESET 0x0004
124 #define HW_POWERUP 0x0008
125 #define HW_ACTIVATE 0x0010
126 #define HW_DEACTIVATE 0x0018
127 #define HW_INFO2 0x0020
128 #define HW_INFO3 0x0030
129 #define HW_INFO4_P8 0x0040
130 #define HW_INFO4_P10 0x0048
131 #define HW_RSYNC 0x0060
132 #define HW_TESTLOOP 0x0070
133 #define CARD_RESET 0x00F0
134 #define CARD_SETIRQ 0x00F1
135 #define CARD_INIT 0x00F2
136 #define CARD_RELEASE 0x00F3
137 #define CARD_TEST 0x00F4
138 #define CARD_AUX_IND 0x00F5
139 #define CARD_LOAD_FIRM 0x00F6
141 #define PH_ACTIVATE 0x0100
142 #define PH_DEACTIVATE 0x0110
143 #define PH_DATA 0x0120
144 #define PH_PULL 0x0130
145 #define PH_TESTLOOP 0x0140
146 #define PH_PAUSE 0x0150
147 #define MPH_ACTIVATE 0x0180
148 #define MPH_DEACTIVATE 0x0190
149 #define MPH_INFORMATION 0x01A0
151 #define DL_ESTABLISH 0x0200
152 #define DL_RELEASE 0x0210
153 #define DL_DATA 0x0220
154 #define DL_FLUSH 0x0224
155 #define DL_UNIT_DATA 0x0230
156 #define MDL_ASSIGN 0x0280
157 #define MDL_REMOVE 0x0284
158 #define MDL_ERROR 0x0288
159 #define MDL_INFO_SETUP 0x02E0
160 #define MDL_INFO_CONN 0x02E4
161 #define MDL_INFO_REL 0x02E8
163 #define CC_SETUP 0x0300
164 #define CC_RESUME 0x0304
165 #define CC_MORE_INFO 0x0310
166 #define CC_IGNORE 0x0320
167 #define CC_REJECT 0x0324
168 #define CC_SETUP_COMPL 0x0330
169 #define CC_PROCEEDING 0x0340
170 #define CC_ALERTING 0x0344
171 #define CC_CONNECT 0x0350
172 #define CC_CHARGE 0x0354
173 #define CC_DISCONNECT 0x0360
174 #define CC_RELEASE 0x0368
175 #define CC_SUSPEND 0x0370
176 #define CC_T303 0x0383
177 #define CC_T304 0x0384
178 #define CC_T305 0x0385
179 #define CC_T308_1 0x0388
180 #define CC_T308_2 0x0389
181 #define CC_T310 0x0390
182 #define CC_T313 0x0393
183 #define CC_T318 0x0398
184 #define CC_T319 0x0399
185 #define CC_NOSETUP_RSP 0x03E0
186 #define CC_SETUP_ERR 0x03E1
187 #define CC_SUSPEND_ERR 0x03E2
188 #define CC_RESUME_ERR 0x03E3
189 #define CC_CONNECT_ERR 0x03E4
190 #define CC_RELEASE_ERR 0x03E5
191 #define CC_DLRL 0x03F0
192 #define CC_RESTART 0x03F4
195 #ifdef __KERNEL__
197 #define MAX_DFRAME_LEN 260
198 #define MAX_DFRAME_LEN_L1 300
199 #define HSCX_BUFMAX 4096
200 #define MAX_DATA_SIZE (HSCX_BUFMAX - 4)
201 #define MAX_DATA_MEM (HSCX_BUFMAX + 64)
202 #define RAW_BUFMAX (((HSCX_BUFMAX*6)/5) + 5)
203 #define MAX_HEADER_LEN 4
204 #define MAX_WINDOW 8
205 #define MAX_MON_FRAME 32
206 #define MAX_DLOG_SPACE 2048
207 #define MAX_BLOG_SPACE 256
209 /* #define I4L_IRQ_FLAG SA_INTERRUPT */
210 #define I4L_IRQ_FLAG 0
213 * Statemachine
216 struct FsmInst;
218 typedef void (* FSMFNPTR)(struct FsmInst *, int, void *);
220 struct Fsm {
221 FSMFNPTR *jumpmatrix;
222 int state_count, event_count;
223 char **strEvent, **strState;
226 struct FsmInst {
227 struct Fsm *fsm;
228 int state;
229 int debug;
230 void *userdata;
231 int userint;
232 void (*printdebug) (struct FsmInst *, char *, ...);
235 struct FsmNode {
236 int state, event;
237 void (*routine) (struct FsmInst *, int, void *);
240 struct FsmTimer {
241 struct FsmInst *fi;
242 struct timer_list tl;
243 int event;
244 void *arg;
247 struct L3Timer {
248 struct l3_process *pc;
249 struct timer_list tl;
250 int event;
253 #define FLG_L1_ACTIVATING 1
254 #define FLG_L1_ACTIVATED 2
255 #define FLG_L1_DEACTTIMER 3
256 #define FLG_L1_ACTTIMER 4
257 #define FLG_L1_T3RUN 5
258 #define FLG_L1_PULL_REQ 6
260 struct Layer1 {
261 void *hardware;
262 struct BCState *bcs;
263 struct PStack **stlistp;
264 int Flags;
265 struct FsmInst l1m;
266 struct FsmTimer timer;
267 void (*l1l2) (struct PStack *, int, void *);
268 void (*l1hw) (struct PStack *, int, void *);
269 void (*l1tei) (struct PStack *, int, void *);
270 int mode, bc;
271 int delay;
274 #define GROUP_TEI 127
275 #define TEI_SAPI 63
276 #define CTRL_SAPI 0
277 #define PACKET_NOACK 250
279 /* Layer2 Flags */
281 #define FLG_LAPB 0
282 #define FLG_LAPD 1
283 #define FLG_ORIG 2
284 #define FLG_MOD128 3
285 #define FLG_PEND_REL 4
286 #define FLG_L3_INIT 5
287 #define FLG_T200_RUN 6
288 #define FLG_ACK_PEND 7
289 #define FLG_REJEXC 8
290 #define FLG_OWN_BUSY 9
291 #define FLG_PEER_BUSY 10
292 #define FLG_DCHAN_BUSY 11
293 #define FLG_L1_ACTIV 12
294 #define FLG_ESTAB_PEND 13
295 #define FLG_PTP 14
296 #define FLG_FIXED_TEI 15
298 struct Layer2 {
299 int tei;
300 int sap;
301 int maxlen;
302 unsigned int flag;
303 int vs, va, vr;
304 int rc;
305 int window;
306 int sow;
307 struct sk_buff *windowar[MAX_WINDOW];
308 struct sk_buff_head i_queue;
309 struct sk_buff_head ui_queue;
310 void (*l2l1) (struct PStack *, int, void *);
311 void (*l2l3) (struct PStack *, int, void *);
312 void (*l2tei) (struct PStack *, int, void *);
313 struct FsmInst l2m;
314 struct FsmTimer t200, t203;
315 int T200, N200, T203;
316 int debug;
317 char debug_id[16];
320 struct Layer3 {
321 void (*l3l4) (struct PStack *, int, void *);
322 void (*l3l2) (struct PStack *, int, void *);
323 struct FsmInst l3m;
324 struct sk_buff_head squeue;
325 struct l3_process *proc;
326 struct l3_process *global;
327 int N303;
328 int debug;
329 char debug_id[8];
332 struct LLInterface {
333 void (*l4l3) (struct PStack *, int, void *);
334 void *userdata;
335 void (*l1writewakeup) (struct PStack *, int);
336 void (*l2writewakeup) (struct PStack *, int);
340 struct Management {
341 int ri;
342 struct FsmInst tei_m;
343 struct FsmTimer t202;
344 int T202, N202, debug;
345 void (*layer) (struct PStack *, int, void *);
349 struct Param {
350 int cause;
351 int loc;
352 int bchannel;
353 setup_parm setup; /* from isdnif.h numbers and Serviceindicator */
354 int chargeinfo; /* Charge Info - only for 1tr6 in
355 * the moment
357 int spv; /* SPV Flag */
361 struct PStack {
362 struct PStack *next;
363 struct Layer1 l1;
364 struct Layer2 l2;
365 struct Layer3 l3;
366 struct LLInterface lli;
367 struct Management ma;
368 int protocol; /* EDSS1 or 1TR6 */
371 struct l3_process {
372 int callref;
373 int state;
374 struct L3Timer timer;
375 int N303;
376 int debug;
377 struct Param para;
378 struct Channel *chan;
379 struct PStack *st;
380 struct l3_process *next;
383 struct hscx_hw {
384 int hscx;
385 int rcvidx;
386 int count; /* Current skb sent count */
387 u_char *rcvbuf; /* B-Channel receive Buffer */
390 struct isar_reg {
391 unsigned int Flags;
392 volatile u_char bstat;
393 volatile u_char iis;
394 volatile u_char cmsb;
395 volatile u_char clsb;
396 volatile u_char par[8];
399 struct isar_hw {
400 int dpath;
401 int rcvidx;
402 int txcnt;
403 int mml;
404 u_char *rcvbuf; /* B-Channel receive Buffer */
405 struct isar_reg *reg;
408 struct hdlc_stat_reg {
409 u_char cmd __attribute__((packed));
410 u_char xml __attribute__((packed));
411 u_char mode __attribute__((packed));
412 u_char fill __attribute__((packed));
415 struct hdlc_hw {
416 union {
417 u_int ctrl;
418 struct hdlc_stat_reg sr;
419 } ctrl;
420 u_int stat;
421 int rcvidx;
422 int count; /* Current skb sent count */
423 u_char *rcvbuf; /* B-Channel receive Buffer */
426 struct hfcB_hw {
427 unsigned int *send;
428 int f1;
429 int f2;
432 struct tiger_hw {
433 u_int *send;
434 u_int *s_irq;
435 u_int *s_end;
436 u_int *sendp;
437 u_int *rec;
438 int free;
439 u_char *rcvbuf;
440 u_char *sendbuf;
441 u_char *sp;
442 int sendcnt;
443 u_int s_tot;
444 u_int r_bitcnt;
445 u_int r_tot;
446 u_int r_err;
447 u_int r_fcs;
448 u_char r_state;
449 u_char r_one;
450 u_char r_val;
451 u_char s_state;
454 struct amd7930_hw {
455 u_char *tx_buff;
456 u_char *rv_buff;
457 int rv_buff_in;
458 int rv_buff_out;
459 struct sk_buff *rv_skb;
460 struct hdlc_state *hdlc_state;
461 struct tq_struct tq_rcv;
462 struct tq_struct tq_xmt;
466 #define BC_FLG_INIT 1
467 #define BC_FLG_ACTIV 2
468 #define BC_FLG_BUSY 3
469 #define BC_FLG_NOFRAME 4
470 #define BC_FLG_HALF 5
471 #define BC_FLG_EMPTY 6
473 #define L1_MODE_NULL 0
474 #define L1_MODE_TRANS 1
475 #define L1_MODE_HDLC 2
476 #define L1_MODE_MODEM 7
478 struct BCState {
479 int channel;
480 int mode;
481 int Flag;
482 struct IsdnCardState *cs;
483 int tx_cnt; /* B-Channel transmit counter */
484 struct sk_buff *tx_skb; /* B-Channel transmit Buffer */
485 struct sk_buff_head rqueue; /* B-Channel receive Queue */
486 struct sk_buff_head squeue; /* B-Channel send Queue */
487 struct PStack *st;
488 u_char *blog;
489 struct timer_list transbusy;
490 struct tq_struct tqueue;
491 int event;
492 int (*BC_SetStack) (struct PStack *, struct BCState *);
493 void (*BC_Close) (struct BCState *);
494 union {
495 struct hscx_hw hscx;
496 struct hdlc_hw hdlc;
497 struct isar_hw isar;
498 struct hfcB_hw hfc;
499 struct tiger_hw tiger;
500 struct amd7930_hw amd7930;
501 } hw;
504 struct Channel {
505 struct PStack *b_st, *d_st;
506 struct IsdnCardState *cs;
507 struct BCState *bcs;
508 int chan;
509 int incoming;
510 struct FsmInst fi;
511 struct FsmTimer drel_timer, dial_timer;
512 int debug;
513 int l2_protocol, l2_active_protocol;
514 int l3_protocol;
515 int data_open;
516 struct l3_process *proc;
517 setup_parm setup; /* from isdnif.h numbers and Serviceindicator */
518 int Flags; /* for remembering action done in l4 */
519 int leased;
522 struct elsa_hw {
523 unsigned int base;
524 unsigned int cfg;
525 unsigned int ctrl;
526 unsigned int ale;
527 unsigned int isac;
528 unsigned int itac;
529 unsigned int hscx;
530 unsigned int trig;
531 unsigned int timer;
532 unsigned int counter;
533 unsigned int status;
534 struct timer_list tl;
535 unsigned int MFlag;
536 struct BCState *bcs;
537 u_char *transbuf;
538 u_char *rcvbuf;
539 unsigned int transp;
540 unsigned int rcvp;
541 unsigned int transcnt;
542 unsigned int rcvcnt;
543 u_char IER;
544 u_char FCR;
545 u_char LCR;
546 u_char MCR;
547 u_char ctrl_reg;
550 struct teles3_hw {
551 unsigned int cfg_reg;
552 signed int isac;
553 signed int hscx[2];
554 signed int isacfifo;
555 signed int hscxfifo[2];
558 struct teles0_hw {
559 unsigned int cfg_reg;
560 unsigned int membase;
563 struct avm_hw {
564 unsigned int cfg_reg;
565 unsigned int isac;
566 unsigned int hscx[2];
567 unsigned int isacfifo;
568 unsigned int hscxfifo[2];
569 unsigned int counter;
572 struct ix1_hw {
573 unsigned int cfg_reg;
574 unsigned int isac_ale;
575 unsigned int isac;
576 unsigned int hscx_ale;
577 unsigned int hscx;
580 struct diva_hw {
581 unsigned int cfg_reg;
582 unsigned int ctrl;
583 unsigned int isac_adr;
584 unsigned int isac;
585 unsigned int hscx_adr;
586 unsigned int hscx;
587 unsigned int status;
588 struct timer_list tl;
589 u_char ctrl_reg;
592 struct asus_hw {
593 unsigned int cfg_reg;
594 unsigned int adr;
595 unsigned int isac;
596 unsigned int hscx;
597 unsigned int u7;
598 unsigned int pots;
602 struct hfc_hw {
603 unsigned int addr;
604 unsigned int fifosize;
605 unsigned char cirm;
606 unsigned char ctmt;
607 unsigned char cip;
608 u_char isac_spcr;
609 struct timer_list timer;
612 struct sedl_hw {
613 unsigned int cfg_reg;
614 unsigned int adr;
615 unsigned int isac;
616 unsigned int hscx;
617 unsigned int reset_on;
618 unsigned int reset_off;
619 struct isar_reg isar;
620 unsigned int chip;
621 unsigned int bus;
624 struct spt_hw {
625 unsigned int cfg_reg;
626 unsigned int isac;
627 unsigned int hscx[2];
628 unsigned char res_irq;
631 struct mic_hw {
632 unsigned int cfg_reg;
633 unsigned int adr;
634 unsigned int isac;
635 unsigned int hscx;
638 struct njet_hw {
639 unsigned int base;
640 unsigned int isac;
641 unsigned int auxa;
642 unsigned char auxd;
643 unsigned char dmactrl;
644 unsigned char ctrl_reg;
645 unsigned char irqmask0;
646 unsigned char irqstat0;
647 unsigned char last_is0;
650 struct hfcD_hw {
651 unsigned int addr;
652 unsigned int bfifosize;
653 unsigned int dfifosize;
654 unsigned char cirm;
655 unsigned char ctmt;
656 unsigned char cip;
657 unsigned char conn;
658 unsigned char mst_m;
659 unsigned char int_m1;
660 unsigned char int_m2;
661 unsigned char int_s1;
662 unsigned char sctrl;
663 unsigned char stat;
664 unsigned char fifo;
665 unsigned char f1;
666 unsigned char f2;
667 unsigned int *send;
668 struct timer_list timer;
671 #define HW_IOM1 0
672 #define HW_IPAC 1
673 #define HW_ISAR 2
674 #define FLG_TWO_DCHAN 4
675 #define FLG_L1_DBUSY 5
676 #define FLG_DBUSY_TIMER 6
677 #define FLG_LOCK_ATOMIC 7
678 #define HW_MON0_RX_END 8
679 #define HW_MON1_RX_END 9
680 #define HW_MON0_TX_END 10
681 #define HW_MON1_TX_END 11
683 struct IsdnCardState {
684 unsigned char typ;
685 unsigned char subtyp;
686 int protocol;
687 unsigned int irq;
688 int HW_Flags;
689 int *busy_flag;
690 union {
691 struct elsa_hw elsa;
692 struct teles0_hw teles0;
693 struct teles3_hw teles3;
694 struct avm_hw avm;
695 struct ix1_hw ix1;
696 struct diva_hw diva;
697 struct asus_hw asus;
698 struct hfc_hw hfc;
699 struct sedl_hw sedl;
700 struct spt_hw spt;
701 struct mic_hw mic;
702 struct njet_hw njet;
703 struct hfcD_hw hfcD;
704 struct ix1_hw niccy;
705 } hw;
706 int myid;
707 isdn_if iif;
708 u_char *status_buf;
709 u_char *status_read;
710 u_char *status_write;
711 u_char *status_end;
712 u_char (*readisac) (struct IsdnCardState *, u_char);
713 void (*writeisac) (struct IsdnCardState *, u_char, u_char);
714 void (*readisacfifo) (struct IsdnCardState *, u_char *, int);
715 void (*writeisacfifo) (struct IsdnCardState *, u_char *, int);
716 u_char (*BC_Read_Reg) (struct IsdnCardState *, int, u_char);
717 void (*BC_Write_Reg) (struct IsdnCardState *, int, u_char, u_char);
718 void (*BC_Send_Data) (struct BCState *);
719 int (*cardmsg) (struct IsdnCardState *, int, void *);
720 struct Channel channel[2];
721 struct BCState bcs[2];
722 struct PStack *stlist;
723 u_char *rcvbuf;
724 int rcvidx;
725 struct sk_buff *tx_skb;
726 int tx_cnt;
727 int event;
728 struct tq_struct tqueue;
729 struct timer_list dbusytimer;
730 struct sk_buff_head rq, sq; /* D-channel queues */
731 int ph_state;
732 int cardnr;
733 char *dlog;
734 int debug;
735 u_char *mon_tx;
736 u_char *mon_rx;
737 int mon_txp;
738 int mon_txc;
739 int mon_rxp;
740 u_char mocr;
741 void (*setstack_d) (struct PStack *, struct IsdnCardState *);
744 #define MON0_RX 1
745 #define MON1_RX 2
746 #define MON0_TX 4
747 #define MON1_TX 8
749 #define HISAX_MAX_CARDS 8
751 #define ISDN_CTYPE_16_0 1
752 #define ISDN_CTYPE_8_0 2
753 #define ISDN_CTYPE_16_3 3
754 #define ISDN_CTYPE_PNP 4
755 #define ISDN_CTYPE_A1 5
756 #define ISDN_CTYPE_ELSA 6
757 #define ISDN_CTYPE_ELSA_PNP 7
758 #define ISDN_CTYPE_TELESPCMCIA 8
759 #define ISDN_CTYPE_IX1MICROR2 9
760 #define ISDN_CTYPE_ELSA_PCMCIA 10
761 #define ISDN_CTYPE_DIEHLDIVA 11
762 #define ISDN_CTYPE_ASUSCOM 12
763 #define ISDN_CTYPE_TELEINT 13
764 #define ISDN_CTYPE_TELES3C 14
765 #define ISDN_CTYPE_SEDLBAUER 15
766 #define ISDN_CTYPE_SPORTSTER 16
767 #define ISDN_CTYPE_MIC 17
768 #define ISDN_CTYPE_ELSA_PCI 18
769 #define ISDN_CTYPE_COMPAQ_ISA 19
770 #define ISDN_CTYPE_NETJET 20
771 #define ISDN_CTYPE_TELESPCI 21
772 #define ISDN_CTYPE_SEDLBAUER_PCMCIA 22
773 #define ISDN_CTYPE_AMD7930 23
774 #define ISDN_CTYPE_NICCY 24
775 #define ISDN_CTYPE_S0BOX 25
776 #define ISDN_CTYPE_A1_PCMCIA 26
777 #define ISDN_CTYPE_FRITZPCI 27
778 #define ISDN_CTYPE_SEDLBAUER_FAX 28
780 #define ISDN_CTYPE_COUNT 28
782 #ifdef ISDN_CHIP_ISAC
783 #undef ISDN_CHIP_ISAC
784 #endif
786 #define HISAX_INITFUNC(__arginit) __initfunc(__arginit)
787 #define HISAX_INITDATA __initdata
789 #ifdef CONFIG_HISAX_16_0
790 #define CARD_TELES0 (1<< ISDN_CTYPE_16_0) | (1<< ISDN_CTYPE_8_0)
791 #ifndef ISDN_CHIP_ISAC
792 #define ISDN_CHIP_ISAC 1
793 #endif
794 #else
795 #define CARD_TELES0 0
796 #endif
798 #ifdef CONFIG_HISAX_16_3
799 #define CARD_TELES3 (1<< ISDN_CTYPE_16_3) | (1<< ISDN_CTYPE_PNP) | \
800 (1<< ISDN_CTYPE_TELESPCMCIA) | (1<< ISDN_CTYPE_COMPAQ_ISA)
801 #ifndef ISDN_CHIP_ISAC
802 #define ISDN_CHIP_ISAC 1
803 #endif
804 #else
805 #define CARD_TELES3 0
806 #endif
808 #ifdef CONFIG_HISAX_TELESPCI
809 #define CARD_TELESPCI (1<< ISDN_CTYPE_TELESPCI)
810 #ifndef ISDN_CHIP_ISAC
811 #define ISDN_CHIP_ISAC 1
812 #endif
813 #else
814 #define CARD_TELESPCI 0
815 #endif
817 #ifdef CONFIG_HISAX_AVM_A1
818 #define CARD_AVM_A1 (1<< ISDN_CTYPE_A1)
819 #ifndef ISDN_CHIP_ISAC
820 #define ISDN_CHIP_ISAC 1
821 #endif
822 #else
823 #define CARD_AVM_A1 0
824 #endif
826 #ifdef CONFIG_HISAX_AVM_A1_PCMCIA
827 #define CARD_AVM_A1_PCMCIA (1<< ISDN_CTYPE_A1_PCMCIA)
828 #ifndef ISDN_CHIP_ISAC
829 #define ISDN_CHIP_ISAC 1
830 #endif
831 #else
832 #define CARD_AVM_A1_PCMCIA 0
833 #endif
835 #ifdef CONFIG_HISAX_FRITZPCI
836 #define CARD_FRITZPCI (1<< ISDN_CTYPE_FRITZPCI)
837 #ifndef ISDN_CHIP_ISAC
838 #define ISDN_CHIP_ISAC 1
839 #endif
840 #else
841 #define CARD_FRITZPCI 0
842 #endif
844 #ifdef CONFIG_HISAX_ELSA
845 #define CARD_ELSA (1<< ISDN_CTYPE_ELSA) | (1<< ISDN_CTYPE_ELSA_PNP) | \
846 (1<< ISDN_CTYPE_ELSA_PCMCIA) | (1<< ISDN_CTYPE_ELSA_PCI)
847 #ifndef ISDN_CHIP_ISAC
848 #define ISDN_CHIP_ISAC 1
849 #endif
850 #undef HISAX_INITFUNC
851 #define HISAX_INITFUNC(__arginit) __arginit
852 #undef HISAX_INITDATA
853 #define HISAX_INITDATA
854 #else
855 #define CARD_ELSA 0
856 #endif
859 #ifdef CONFIG_HISAX_IX1MICROR2
860 #define CARD_IX1MICROR2 (1 << ISDN_CTYPE_IX1MICROR2)
861 #ifndef ISDN_CHIP_ISAC
862 #define ISDN_CHIP_ISAC 1
863 #endif
864 #else
865 #define CARD_IX1MICROR2 0
866 #endif
868 #ifdef CONFIG_HISAX_DIEHLDIVA
869 #define CARD_DIEHLDIVA (1 << ISDN_CTYPE_DIEHLDIVA)
870 #ifndef ISDN_CHIP_ISAC
871 #define ISDN_CHIP_ISAC 1
872 #endif
873 #else
874 #define CARD_DIEHLDIVA 0
875 #endif
877 #ifdef CONFIG_HISAX_ASUSCOM
878 #define CARD_ASUSCOM (1 << ISDN_CTYPE_ASUSCOM)
879 #ifndef ISDN_CHIP_ISAC
880 #define ISDN_CHIP_ISAC 1
881 #endif
882 #else
883 #define CARD_ASUSCOM 0
884 #endif
886 #ifdef CONFIG_HISAX_TELEINT
887 #define CARD_TELEINT (1 << ISDN_CTYPE_TELEINT)
888 #ifndef ISDN_CHIP_ISAC
889 #define ISDN_CHIP_ISAC 1
890 #endif
891 #else
892 #define CARD_TELEINT 0
893 #endif
895 #ifdef CONFIG_HISAX_SEDLBAUER
896 #define CARD_SEDLBAUER (1 << ISDN_CTYPE_SEDLBAUER) | (1 << ISDN_CTYPE_SEDLBAUER_PCMCIA) | ( 1 << ISDN_CTYPE_SEDLBAUER_FAX)
897 #ifndef ISDN_CHIP_ISAC
898 #define ISDN_CHIP_ISAC 1
899 #endif
900 #else
901 #define CARD_SEDLBAUER 0
902 #endif
904 #ifdef CONFIG_HISAX_SPORTSTER
905 #define CARD_SPORTSTER (1 << ISDN_CTYPE_SPORTSTER)
906 #ifndef ISDN_CHIP_ISAC
907 #define ISDN_CHIP_ISAC 1
908 #endif
909 #else
910 #define CARD_SPORTSTER 0
911 #endif
913 #ifdef CONFIG_HISAX_MIC
914 #define CARD_MIC (1 << ISDN_CTYPE_MIC)
915 #ifndef ISDN_CHIP_ISAC
916 #define ISDN_CHIP_ISAC 1
917 #endif
918 #else
919 #define CARD_MIC 0
920 #endif
922 #ifdef CONFIG_HISAX_NETJET
923 #define CARD_NETJET (1 << ISDN_CTYPE_NETJET)
924 #ifndef ISDN_CHIP_ISAC
925 #define ISDN_CHIP_ISAC 1
926 #endif
927 #else
928 #define CARD_NETJET 0
929 #endif
931 #ifdef CONFIG_HISAX_TELES3C
932 #define CARD_TELES3C (1<< ISDN_CTYPE_TELES3C)
933 #else
934 #define CARD_TELES3C 0
935 #endif
937 #ifdef CONFIG_HISAX_AMD7930
938 #define CARD_AMD7930 (1 << ISDN_CTYPE_AMD7930)
939 #else
940 #define CARD_AMD7930 0
941 #endif
943 #ifdef CONFIG_HISAX_NICCY
944 #define CARD_NICCY (1 << ISDN_CTYPE_NICCY)
945 #ifndef ISDN_CHIP_ISAC
946 #define ISDN_CHIP_ISAC 1
947 #endif
948 #else
949 #define CARD_NICCY 0
950 #endif
952 #ifdef CONFIG_HISAX_S0BOX
953 #define CARD_S0BOX (1 << ISDN_CTYPE_S0BOX)
954 #ifndef ISDN_CHIP_ISAC
955 #define ISDN_CHIP_ISAC 1
956 #endif
957 #else
958 #define CARD_S0BOX 0
959 #endif
961 #define SUPORTED_CARDS (CARD_TELES0 | CARD_TELES3 | CARD_AVM_A1 | CARD_ELSA \
962 | CARD_IX1MICROR2 | CARD_DIEHLDIVA | CARD_ASUSCOM \
963 | CARD_TELEINT | CARD_SEDLBAUER | CARD_SPORTSTER \
964 | CARD_MIC | CARD_NETJET | CARD_TELES3C | CARD_AMD7930 \
965 | CARD_AVM_A1_PCMCIA | CARD_FRITZPCI\
966 | CARD_NICCY | CARD_S0BOX | CARD_TELESPCI)
968 #define TEI_PER_CARD 0
970 #ifdef CONFIG_HISAX_1TR6
971 #undef TEI_PER_CARD
972 #define TEI_PER_CARD 1
973 #endif
975 #ifdef CONFIG_HISAX_EURO
976 #undef TEI_PER_CARD
977 #define TEI_PER_CARD 1
978 #define HISAX_EURO_SENDCOMPLETE 1
979 #define EXT_BEARER_CAPS 1
980 #define HISAX_SEND_STD_LLC_IE 1
981 #ifdef CONFIG_HISAX_NO_SENDCOMPLETE
982 #undef HISAX_EURO_SENDCOMPLETE
983 #endif
984 #ifdef CONFIG_HISAX_NO_LLC
985 #undef HISAX_SEND_STD_LLC_IE
986 #endif
987 #undef HISAX_DE_AOC
988 #ifdef CONFIG_DE_AOC
989 #define HISAX_DE_AOC 1
990 #endif
991 #endif
993 /* L1 Debug */
994 #define L1_DEB_WARN 0x01
995 #define L1_DEB_INTSTAT 0x02
996 #define L1_DEB_ISAC 0x04
997 #define L1_DEB_ISAC_FIFO 0x08
998 #define L1_DEB_HSCX 0x10
999 #define L1_DEB_HSCX_FIFO 0x20
1000 #define L1_DEB_LAPD 0x40
1001 #define L1_DEB_IPAC 0x80
1002 #define L1_DEB_RECEIVE_FRAME 0x100
1003 #define L1_DEB_MONITOR 0x200
1004 #define DEB_DLOG_HEX 0x400
1005 #define DEB_DLOG_VERBOSE 0x800
1007 #define L2FRAME_DEBUG
1009 #ifdef L2FRAME_DEBUG
1010 extern void Logl2Frame(struct IsdnCardState *cs, struct sk_buff *skb, char *buf, int dir);
1011 #endif
1013 struct IsdnCard {
1014 int typ;
1015 int protocol; /* EDSS1 or 1TR6 */
1016 unsigned int para[4];
1017 struct IsdnCardState *cs;
1020 void init_bcstate(struct IsdnCardState *cs, int bc);
1022 void setstack_HiSax(struct PStack *st, struct IsdnCardState *cs);
1023 unsigned int random_ri(void);
1024 void HiSax_addlist(struct IsdnCardState *sp, struct PStack *st);
1025 void HiSax_rmlist(struct IsdnCardState *sp, struct PStack *st);
1027 void setstack_l1_B(struct PStack *st);
1029 void setstack_tei(struct PStack *st);
1030 void setstack_manager(struct PStack *st);
1032 void setstack_isdnl2(struct PStack *st, char *debug_id);
1033 void releasestack_isdnl2(struct PStack *st);
1034 void setstack_transl2(struct PStack *st);
1035 void releasestack_transl2(struct PStack *st);
1037 void setstack_l3dc(struct PStack *st, struct Channel *chanp);
1038 void setstack_l3bc(struct PStack *st, struct Channel *chanp);
1039 void releasestack_isdnl3(struct PStack *st);
1041 u_char *findie(u_char * p, int size, u_char ie, int wanted_set);
1042 int getcallref(u_char * p);
1043 int newcallref(void);
1045 void FsmNew(struct Fsm *fsm, struct FsmNode *fnlist, int fncount);
1046 void FsmFree(struct Fsm *fsm);
1047 int FsmEvent(struct FsmInst *fi, int event, void *arg);
1048 void FsmChangeState(struct FsmInst *fi, int newstate);
1049 void FsmInitTimer(struct FsmInst *fi, struct FsmTimer *ft);
1050 int FsmAddTimer(struct FsmTimer *ft, int millisec, int event,
1051 void *arg, int where);
1052 void FsmRestartTimer(struct FsmTimer *ft, int millisec, int event,
1053 void *arg, int where);
1054 void FsmDelTimer(struct FsmTimer *ft, int where);
1055 int jiftime(char *s, long mark);
1057 int HiSax_command(isdn_ctrl * ic);
1058 int HiSax_writebuf_skb(int id, int chan, int ack, struct sk_buff *skb);
1059 void HiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, ...);
1060 void VHiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, va_list args);
1061 void HiSax_reportcard(int cardnr);
1062 int QuickHex(char *txt, u_char * p, int cnt);
1063 void LogFrame(struct IsdnCardState *cs, u_char * p, int size);
1064 void dlogframe(struct IsdnCardState *cs, struct sk_buff *skb, int dir);
1065 void iecpy(u_char * dest, u_char * iestart, int ieoffset);
1066 int discard_queue(struct sk_buff_head *q);
1067 #ifdef ISDN_CHIP_ISAC
1068 void setstack_isac(struct PStack *st, struct IsdnCardState *cs);
1069 #endif /* ISDN_CHIP_ISAC */
1070 #endif /* __KERNEL__ */
1072 #define HZDELAY(jiffs) {int tout = jiffs; while (tout--) udelay(1000000/HZ);}
1074 int ll_run(struct IsdnCardState *cs);
1075 void ll_stop(struct IsdnCardState *cs);
1076 void CallcNew(void);
1077 void CallcFree(void);
1078 int CallcNewChan(struct IsdnCardState *cs);
1079 void CallcFreeChan(struct IsdnCardState *cs);
1080 void Isdnl1New(void);
1081 void Isdnl1Free(void);
1082 void Isdnl2New(void);
1083 void Isdnl2Free(void);
1084 void Isdnl3New(void);
1085 void Isdnl3Free(void);
1086 void init_tei(struct IsdnCardState *cs, int protocol);
1087 void release_tei(struct IsdnCardState *cs);
1088 char *HiSax_getrev(const char *revision);
1089 void TeiNew(void);
1090 void TeiFree(void);
1091 int certification_check(int output);