Merge with Linux 2.4.0-test6-pre9.
[linux-2.6/linux-mips.git] / drivers / isdn / hisax / hisax.h
blob11d38baf233be8b35300bef2f86102d06787739c
1 /* $Id: hisax.h,v 2.48 2000/07/04 10:24:32 keil Exp $
3 * Basic declarations, defines and prototypes
5 * This file is (c) under GNU PUBLIC LICENSE
7 */
8 #include <linux/config.h>
9 #include <linux/module.h>
10 #include <linux/version.h>
11 #include <linux/errno.h>
12 #include <linux/fs.h>
13 #include <linux/major.h>
14 #include <asm/segment.h>
15 #include <asm/io.h>
16 #include <linux/delay.h>
17 #include <linux/kernel.h>
18 #include <linux/signal.h>
19 #include <linux/malloc.h>
20 #include <linux/mm.h>
21 #include <linux/mman.h>
22 #include <linux/ioport.h>
23 #include <linux/timer.h>
24 #include <linux/wait.h>
25 #include <linux/isdnif.h>
26 #include <linux/tty.h>
27 #include <linux/serial_reg.h>
28 #include <linux/netdevice.h>
30 #define ERROR_STATISTIC
32 #define REQUEST 0
33 #define CONFIRM 1
34 #define INDICATION 2
35 #define RESPONSE 3
37 #define HW_ENABLE 0x0000
38 #define HW_RESET 0x0004
39 #define HW_POWERUP 0x0008
40 #define HW_ACTIVATE 0x0010
41 #define HW_DEACTIVATE 0x0018
42 #define HW_INFO2 0x0020
43 #define HW_INFO3 0x0030
44 #define HW_INFO4_P8 0x0040
45 #define HW_INFO4_P10 0x0048
46 #define HW_RSYNC 0x0060
47 #define HW_TESTLOOP 0x0070
48 #define CARD_RESET 0x00F0
49 #define CARD_INIT 0x00F2
50 #define CARD_RELEASE 0x00F3
51 #define CARD_TEST 0x00F4
52 #define CARD_AUX_IND 0x00F5
54 #define PH_ACTIVATE 0x0100
55 #define PH_DEACTIVATE 0x0110
56 #define PH_DATA 0x0120
57 #define PH_PULL 0x0130
58 #define PH_TESTLOOP 0x0140
59 #define PH_PAUSE 0x0150
60 #define MPH_ACTIVATE 0x0180
61 #define MPH_DEACTIVATE 0x0190
62 #define MPH_INFORMATION 0x01A0
64 #define DL_ESTABLISH 0x0200
65 #define DL_RELEASE 0x0210
66 #define DL_DATA 0x0220
67 #define DL_FLUSH 0x0224
68 #define DL_UNIT_DATA 0x0230
69 #define MDL_ASSIGN 0x0280
70 #define MDL_REMOVE 0x0284
71 #define MDL_ERROR 0x0288
72 #define MDL_INFO_SETUP 0x02E0
73 #define MDL_INFO_CONN 0x02E4
74 #define MDL_INFO_REL 0x02E8
76 #define CC_SETUP 0x0300
77 #define CC_RESUME 0x0304
78 #define CC_MORE_INFO 0x0310
79 #define CC_IGNORE 0x0320
80 #define CC_REJECT 0x0324
81 #define CC_SETUP_COMPL 0x0330
82 #define CC_PROCEEDING 0x0340
83 #define CC_ALERTING 0x0344
84 #define CC_PROGRESS 0x0348
85 #define CC_CONNECT 0x0350
86 #define CC_CHARGE 0x0354
87 #define CC_NOTIFY 0x0358
88 #define CC_DISCONNECT 0x0360
89 #define CC_RELEASE 0x0368
90 #define CC_SUSPEND 0x0370
91 #define CC_PROCEED_SEND 0x0374
92 #define CC_REDIR 0x0378
93 #define CC_T303 0x0383
94 #define CC_T304 0x0384
95 #define CC_T305 0x0385
96 #define CC_T308_1 0x0388
97 #define CC_T308_2 0x038A
98 #define CC_T309 0x0309
99 #define CC_T310 0x0390
100 #define CC_T313 0x0393
101 #define CC_T318 0x0398
102 #define CC_T319 0x0399
103 #define CC_NOSETUP_RSP 0x03E0
104 #define CC_SETUP_ERR 0x03E1
105 #define CC_SUSPEND_ERR 0x03E2
106 #define CC_RESUME_ERR 0x03E3
107 #define CC_CONNECT_ERR 0x03E4
108 #define CC_RELEASE_ERR 0x03E5
109 #define CC_RESTART 0x03F4
110 #define CC_TDSS1_IO 0x13F4 /* DSS1 IO user timer */
112 /* define maximum number of possible waiting incoming calls */
113 #define MAX_WAITING_CALLS 2
116 #ifdef __KERNEL__
118 /* include only l3dss1 specific process structures, but no other defines */
119 #ifdef CONFIG_HISAX_EURO
120 #define l3dss1_process
121 #include "l3dss1.h"
122 #undef l3dss1_process
123 #endif CONFIG_HISAX_EURO
125 #define MAX_DFRAME_LEN 260
126 #define MAX_DFRAME_LEN_L1 300
127 #define HSCX_BUFMAX 4096
128 #define MAX_DATA_SIZE (HSCX_BUFMAX - 4)
129 #define MAX_DATA_MEM (HSCX_BUFMAX + 64)
130 #define RAW_BUFMAX (((HSCX_BUFMAX*6)/5) + 5)
131 #define MAX_HEADER_LEN 4
132 #define MAX_WINDOW 8
133 #define MAX_MON_FRAME 32
134 #define MAX_DLOG_SPACE 2048
135 #define MAX_BLOG_SPACE 256
137 /* #define I4L_IRQ_FLAG SA_INTERRUPT */
138 #define I4L_IRQ_FLAG 0
141 * Statemachine
144 struct FsmInst;
146 typedef void (* FSMFNPTR)(struct FsmInst *, int, void *);
148 struct Fsm {
149 FSMFNPTR *jumpmatrix;
150 int state_count, event_count;
151 char **strEvent, **strState;
154 struct FsmInst {
155 struct Fsm *fsm;
156 int state;
157 int debug;
158 void *userdata;
159 int userint;
160 void (*printdebug) (struct FsmInst *, char *, ...);
163 struct FsmNode {
164 int state, event;
165 void (*routine) (struct FsmInst *, int, void *);
168 struct FsmTimer {
169 struct FsmInst *fi;
170 struct timer_list tl;
171 int event;
172 void *arg;
175 struct L3Timer {
176 struct l3_process *pc;
177 struct timer_list tl;
178 int event;
181 #define FLG_L1_ACTIVATING 1
182 #define FLG_L1_ACTIVATED 2
183 #define FLG_L1_DEACTTIMER 3
184 #define FLG_L1_ACTTIMER 4
185 #define FLG_L1_T3RUN 5
186 #define FLG_L1_PULL_REQ 6
188 struct Layer1 {
189 void *hardware;
190 struct BCState *bcs;
191 struct PStack **stlistp;
192 int Flags;
193 struct FsmInst l1m;
194 struct FsmTimer timer;
195 void (*l1l2) (struct PStack *, int, void *);
196 void (*l1hw) (struct PStack *, int, void *);
197 void (*l1tei) (struct PStack *, int, void *);
198 int mode, bc;
199 int delay;
202 #define GROUP_TEI 127
203 #define TEI_SAPI 63
204 #define CTRL_SAPI 0
205 #define PACKET_NOACK 250
207 /* Layer2 Flags */
209 #define FLG_LAPB 0
210 #define FLG_LAPD 1
211 #define FLG_ORIG 2
212 #define FLG_MOD128 3
213 #define FLG_PEND_REL 4
214 #define FLG_L3_INIT 5
215 #define FLG_T200_RUN 6
216 #define FLG_ACK_PEND 7
217 #define FLG_REJEXC 8
218 #define FLG_OWN_BUSY 9
219 #define FLG_PEER_BUSY 10
220 #define FLG_DCHAN_BUSY 11
221 #define FLG_L1_ACTIV 12
222 #define FLG_ESTAB_PEND 13
223 #define FLG_PTP 14
224 #define FLG_FIXED_TEI 15
225 #define FLG_L2BLOCK 16
227 struct Layer2 {
228 int tei;
229 int sap;
230 int maxlen;
231 unsigned int flag;
232 unsigned int vs, va, vr;
233 int rc;
234 unsigned int window;
235 unsigned int sow;
236 struct sk_buff *windowar[MAX_WINDOW];
237 struct sk_buff_head i_queue;
238 struct sk_buff_head ui_queue;
239 void (*l2l1) (struct PStack *, int, void *);
240 void (*l2l3) (struct PStack *, int, void *);
241 void (*l2tei) (struct PStack *, int, void *);
242 struct FsmInst l2m;
243 struct FsmTimer t200, t203;
244 int T200, N200, T203;
245 int debug;
246 char debug_id[16];
249 struct Layer3 {
250 void (*l3l4) (struct PStack *, int, void *);
251 void (*l3ml3) (struct PStack *, int, void *);
252 void (*l3l2) (struct PStack *, int, void *);
253 struct FsmInst l3m;
254 struct FsmTimer l3m_timer;
255 struct sk_buff_head squeue;
256 struct l3_process *proc;
257 struct l3_process *global;
258 int N303;
259 int debug;
260 char debug_id[8];
263 struct LLInterface {
264 void (*l4l3) (struct PStack *, int, void *);
265 int (*l4l3_proto) (struct PStack *, isdn_ctrl *);
266 void *userdata;
267 void (*l1writewakeup) (struct PStack *, int);
268 void (*l2writewakeup) (struct PStack *, int);
272 struct Management {
273 int ri;
274 struct FsmInst tei_m;
275 struct FsmTimer t202;
276 int T202, N202, debug;
277 void (*layer) (struct PStack *, int, void *);
280 #define NO_CAUSE 254
282 struct Param {
283 u_char cause;
284 u_char loc;
285 u_char diag[6];
286 int bchannel;
287 int chargeinfo;
288 int spv; /* SPV Flag */
289 setup_parm setup; /* from isdnif.h numbers and Serviceindicator */
290 u_char moderate; /* transfer mode and rate (bearer octet 4) */
294 struct PStack {
295 struct PStack *next;
296 struct Layer1 l1;
297 struct Layer2 l2;
298 struct Layer3 l3;
299 struct LLInterface lli;
300 struct Management ma;
301 int protocol; /* EDSS1 or 1TR6 */
303 /* protocol specific data fields */
304 union
305 { u_char uuuu; /* only as dummy */
306 #ifdef CONFIG_HISAX_EURO
307 dss1_stk_priv dss1; /* private dss1 data */
308 #endif CONFIG_HISAX_EURO
309 } prot;
312 struct l3_process {
313 int callref;
314 int state;
315 struct L3Timer timer;
316 int N303;
317 int debug;
318 struct Param para;
319 struct Channel *chan;
320 struct PStack *st;
321 struct l3_process *next;
322 ulong redir_result;
324 /* protocol specific data fields */
325 union
326 { u_char uuuu; /* only when euro not defined, avoiding empty union */
327 #ifdef CONFIG_HISAX_EURO
328 dss1_proc_priv dss1; /* private dss1 data */
329 #endif CONFIG_HISAX_EURO
330 } prot;
333 struct hscx_hw {
334 int hscx;
335 int rcvidx;
336 int count; /* Current skb sent count */
337 u_char *rcvbuf; /* B-Channel receive Buffer */
338 u_char tsaxr0;
339 u_char tsaxr1;
342 struct w6692B_hw {
343 int bchan;
344 int rcvidx;
345 int count; /* Current skb sent count */
346 u_char *rcvbuf; /* B-Channel receive Buffer */
349 struct isar_reg {
350 unsigned int Flags;
351 volatile u_char bstat;
352 volatile u_char iis;
353 volatile u_char cmsb;
354 volatile u_char clsb;
355 volatile u_char par[8];
358 struct isar_hw {
359 int dpath;
360 int rcvidx;
361 int txcnt;
362 int mml;
363 u_char state;
364 u_char cmd;
365 u_char mod;
366 u_char newcmd;
367 u_char newmod;
368 char try_mod;
369 struct timer_list ftimer;
370 u_char *rcvbuf; /* B-Channel receive Buffer */
371 u_char conmsg[16];
372 struct isar_reg *reg;
375 struct hdlc_stat_reg {
376 u_char cmd __attribute__((packed));
377 u_char xml __attribute__((packed));
378 u_char mode __attribute__((packed));
379 u_char fill __attribute__((packed));
382 struct hdlc_hw {
383 union {
384 u_int ctrl;
385 struct hdlc_stat_reg sr;
386 } ctrl;
387 u_int stat;
388 int rcvidx;
389 int count; /* Current skb sent count */
390 u_char *rcvbuf; /* B-Channel receive Buffer */
393 struct hfcB_hw {
394 unsigned int *send;
395 int f1;
396 int f2;
399 struct tiger_hw {
400 u_int *send;
401 u_int *s_irq;
402 u_int *s_end;
403 u_int *sendp;
404 u_int *rec;
405 int free;
406 u_char *rcvbuf;
407 u_char *sendbuf;
408 u_char *sp;
409 int sendcnt;
410 u_int s_tot;
411 u_int r_bitcnt;
412 u_int r_tot;
413 u_int r_err;
414 u_int r_fcs;
415 u_char r_state;
416 u_char r_one;
417 u_char r_val;
418 u_char s_state;
421 struct amd7930_hw {
422 u_char *tx_buff;
423 u_char *rv_buff;
424 int rv_buff_in;
425 int rv_buff_out;
426 struct sk_buff *rv_skb;
427 struct hdlc_state *hdlc_state;
428 struct tq_struct tq_rcv;
429 struct tq_struct tq_xmt;
433 #define BC_FLG_INIT 1
434 #define BC_FLG_ACTIV 2
435 #define BC_FLG_BUSY 3
436 #define BC_FLG_NOFRAME 4
437 #define BC_FLG_HALF 5
438 #define BC_FLG_EMPTY 6
439 #define BC_FLG_ORIG 7
440 #define BC_FLG_DLEETX 8
441 #define BC_FLG_LASTDLE 9
442 #define BC_FLG_FIRST 10
443 #define BC_FLG_LASTDATA 11
444 #define BC_FLG_NMD_DATA 12
445 #define BC_FLG_FTI_RUN 13
446 #define BC_FLG_LL_OK 14
447 #define BC_FLG_LL_CONN 15
449 #define L1_MODE_NULL 0
450 #define L1_MODE_TRANS 1
451 #define L1_MODE_HDLC 2
452 #define L1_MODE_EXTRN 3
453 #define L1_MODE_MODEM 7
454 #define L1_MODE_V32 8
455 #define L1_MODE_FAX 9
457 struct BCState {
458 int channel;
459 int mode;
460 int Flag;
461 struct IsdnCardState *cs;
462 int tx_cnt; /* B-Channel transmit counter */
463 struct sk_buff *tx_skb; /* B-Channel transmit Buffer */
464 struct sk_buff_head rqueue; /* B-Channel receive Queue */
465 struct sk_buff_head squeue; /* B-Channel send Queue */
466 struct PStack *st;
467 u_char *blog;
468 u_char *conmsg;
469 struct timer_list transbusy;
470 struct tq_struct tqueue;
471 int event;
472 int (*BC_SetStack) (struct PStack *, struct BCState *);
473 void (*BC_Close) (struct BCState *);
474 #ifdef ERROR_STATISTIC
475 int err_crc;
476 int err_tx;
477 int err_rdo;
478 int err_inv;
479 #endif
480 union {
481 struct hscx_hw hscx;
482 struct hdlc_hw hdlc;
483 struct isar_hw isar;
484 struct hfcB_hw hfc;
485 struct tiger_hw tiger;
486 struct amd7930_hw amd7930;
487 struct w6692B_hw w6692;
488 } hw;
491 struct Channel {
492 struct PStack *b_st, *d_st;
493 struct IsdnCardState *cs;
494 struct BCState *bcs;
495 int chan;
496 int incoming;
497 struct FsmInst fi;
498 struct FsmTimer drel_timer, dial_timer;
499 int debug;
500 int l2_protocol, l2_active_protocol;
501 int l3_protocol;
502 int data_open;
503 struct l3_process *proc;
504 setup_parm setup; /* from isdnif.h numbers and Serviceindicator */
505 int Flags; /* for remembering action done in l4 */
506 int leased;
509 struct elsa_hw {
510 unsigned int base;
511 unsigned int cfg;
512 unsigned int ctrl;
513 unsigned int ale;
514 unsigned int isac;
515 unsigned int itac;
516 unsigned int hscx;
517 unsigned int trig;
518 unsigned int timer;
519 unsigned int counter;
520 unsigned int status;
521 struct timer_list tl;
522 unsigned int MFlag;
523 struct BCState *bcs;
524 u_char *transbuf;
525 u_char *rcvbuf;
526 unsigned int transp;
527 unsigned int rcvp;
528 unsigned int transcnt;
529 unsigned int rcvcnt;
530 u_char IER;
531 u_char FCR;
532 u_char LCR;
533 u_char MCR;
534 u_char ctrl_reg;
537 struct teles3_hw {
538 unsigned int cfg_reg;
539 signed int isac;
540 signed int hscx[2];
541 signed int isacfifo;
542 signed int hscxfifo[2];
545 struct teles0_hw {
546 unsigned int cfg_reg;
547 unsigned long membase;
548 unsigned long phymem;
551 struct avm_hw {
552 unsigned int cfg_reg;
553 unsigned int isac;
554 unsigned int hscx[2];
555 unsigned int isacfifo;
556 unsigned int hscxfifo[2];
557 unsigned int counter;
560 struct ix1_hw {
561 unsigned int cfg_reg;
562 unsigned int isac_ale;
563 unsigned int isac;
564 unsigned int hscx_ale;
565 unsigned int hscx;
568 struct diva_hw {
569 unsigned long cfg_reg;
570 unsigned long pci_cfg;
571 unsigned int ctrl;
572 unsigned int isac_adr;
573 unsigned int isac;
574 unsigned int hscx_adr;
575 unsigned int hscx;
576 unsigned int status;
577 struct timer_list tl;
578 u_char ctrl_reg;
581 struct asus_hw {
582 unsigned int cfg_reg;
583 unsigned int adr;
584 unsigned int isac;
585 unsigned int hscx;
586 unsigned int u7;
587 unsigned int pots;
591 struct hfc_hw {
592 unsigned int addr;
593 unsigned int fifosize;
594 unsigned char cirm;
595 unsigned char ctmt;
596 unsigned char cip;
597 u_char isac_spcr;
598 struct timer_list timer;
601 struct sedl_hw {
602 unsigned int cfg_reg;
603 unsigned int adr;
604 unsigned int isac;
605 unsigned int hscx;
606 unsigned int reset_on;
607 unsigned int reset_off;
608 struct isar_reg isar;
609 unsigned int chip;
610 unsigned int bus;
613 struct spt_hw {
614 unsigned int cfg_reg;
615 unsigned int isac;
616 unsigned int hscx[2];
617 unsigned char res_irq;
620 struct mic_hw {
621 unsigned int cfg_reg;
622 unsigned int adr;
623 unsigned int isac;
624 unsigned int hscx;
627 struct njet_hw {
628 unsigned int base;
629 unsigned int isac;
630 unsigned int auxa;
631 unsigned char auxd;
632 unsigned char dmactrl;
633 unsigned char ctrl_reg;
634 unsigned char irqmask0;
635 unsigned char irqstat0;
636 unsigned char last_is0;
639 struct hfcPCI_hw {
640 unsigned char cirm;
641 unsigned char ctmt;
642 unsigned char conn;
643 unsigned char mst_m;
644 unsigned char int_m1;
645 unsigned char int_m2;
646 unsigned char int_s1;
647 unsigned char sctrl;
648 unsigned char sctrl_r;
649 unsigned char sctrl_e;
650 unsigned char trm;
651 unsigned char stat;
652 unsigned char fifo;
653 unsigned char fifo_en;
654 unsigned char bswapped;
655 unsigned char nt_mode;
656 int nt_timer;
657 unsigned char pci_bus;
658 unsigned char pci_device_fn;
659 unsigned char *pci_io; /* start of PCI IO memory */
660 void *share_start; /* shared memory for Fifos start */
661 void *fifos; /* FIFO memory */
662 struct timer_list timer;
665 struct hfcSX_hw {
666 unsigned int base;
667 unsigned char cirm;
668 unsigned char ctmt;
669 unsigned char conn;
670 unsigned char mst_m;
671 unsigned char int_m1;
672 unsigned char int_m2;
673 unsigned char int_s1;
674 unsigned char sctrl;
675 unsigned char sctrl_r;
676 unsigned char sctrl_e;
677 unsigned char trm;
678 unsigned char stat;
679 unsigned char fifo;
680 unsigned char bswapped;
681 unsigned char nt_mode;
682 unsigned char chip;
683 int b_fifo_size;
684 unsigned char last_fifo;
685 void *extra;
686 int nt_timer;
687 struct timer_list timer;
690 struct hfcD_hw {
691 unsigned int addr;
692 unsigned int bfifosize;
693 unsigned int dfifosize;
694 unsigned char cirm;
695 unsigned char ctmt;
696 unsigned char cip;
697 unsigned char conn;
698 unsigned char mst_m;
699 unsigned char int_m1;
700 unsigned char int_m2;
701 unsigned char int_s1;
702 unsigned char sctrl;
703 unsigned char stat;
704 unsigned char fifo;
705 unsigned char f1;
706 unsigned char f2;
707 unsigned int *send;
708 struct timer_list timer;
711 struct isurf_hw {
712 unsigned int reset;
713 unsigned long phymem;
714 unsigned long isac;
715 unsigned long isar;
716 struct isar_reg isar_r;
719 struct saphir_hw {
720 unsigned int cfg_reg;
721 unsigned int ale;
722 unsigned int isac;
723 unsigned int hscx;
724 struct timer_list timer;
727 struct bkm_hw {
728 unsigned int base;
729 /* A4T stuff */
730 unsigned int isac_adr;
731 unsigned int isac_ale;
732 unsigned int jade_adr;
733 unsigned int jade_ale;
734 /* Scitel Quadro stuff */
735 unsigned int plx_adr;
736 unsigned int data_adr;
739 struct gazel_hw {
740 unsigned int cfg_reg;
741 unsigned int pciaddr[2];
742 signed int ipac;
743 signed int isac;
744 signed int hscx[2];
745 signed int isacfifo;
746 signed int hscxfifo[2];
747 unsigned char timeslot;
748 unsigned char iom2;
751 struct w6692_hw {
752 unsigned int iobase;
753 struct timer_list timer;
756 #ifdef CONFIG_HISAX_TESTEMU
757 struct te_hw {
758 unsigned char *sfifo;
759 unsigned char *sfifo_w;
760 unsigned char *sfifo_r;
761 unsigned char *sfifo_e;
762 int sfifo_cnt;
763 unsigned int stat;
764 wait_queue_head_t rwaitq;
765 wait_queue_head_t swaitq;
767 #endif
769 struct arcofi_msg {
770 struct arcofi_msg *next;
771 u_char receive;
772 u_char len;
773 u_char msg[10];
776 struct isac_chip {
777 int ph_state;
778 u_char *mon_tx;
779 u_char *mon_rx;
780 int mon_txp;
781 int mon_txc;
782 int mon_rxp;
783 struct arcofi_msg *arcofi_list;
784 struct timer_list arcofitimer;
785 wait_queue_head_t arcofi_wait;
786 u_char arcofi_bc;
787 u_char arcofi_state;
788 u_char mocr;
789 u_char adf2;
792 struct hfcd_chip {
793 int ph_state;
796 struct hfcpci_chip {
797 int ph_state;
800 struct hfcsx_chip {
801 int ph_state;
804 struct w6692_chip {
805 int ph_state;
808 #define HW_IOM1 0
809 #define HW_IPAC 1
810 #define HW_ISAR 2
811 #define HW_ARCOFI 3
812 #define FLG_TWO_DCHAN 4
813 #define FLG_L1_DBUSY 5
814 #define FLG_DBUSY_TIMER 6
815 #define FLG_LOCK_ATOMIC 7
816 #define FLG_ARCOFI_TIMER 8
817 #define FLG_ARCOFI_ERROR 9
819 struct IsdnCardState {
820 unsigned char typ;
821 unsigned char subtyp;
822 int protocol;
823 unsigned int irq;
824 unsigned long irq_flags;
825 int HW_Flags;
826 int *busy_flag;
827 int chanlimit; /* limited number of B-chans to use */
828 int logecho; /* log echo if supported by card */
829 union {
830 struct elsa_hw elsa;
831 struct teles0_hw teles0;
832 struct teles3_hw teles3;
833 struct avm_hw avm;
834 struct ix1_hw ix1;
835 struct diva_hw diva;
836 struct asus_hw asus;
837 struct hfc_hw hfc;
838 struct sedl_hw sedl;
839 struct spt_hw spt;
840 struct mic_hw mic;
841 struct njet_hw njet;
842 struct hfcD_hw hfcD;
843 struct hfcPCI_hw hfcpci;
844 struct hfcSX_hw hfcsx;
845 struct ix1_hw niccy;
846 struct isurf_hw isurf;
847 struct saphir_hw saphir;
848 #ifdef CONFIG_HISAX_TESTEMU
849 struct te_hw te;
850 #endif
851 struct bkm_hw ax;
852 struct gazel_hw gazel;
853 struct w6692_hw w6692;
854 } hw;
855 int myid;
856 isdn_if iif;
857 u_char *status_buf;
858 u_char *status_read;
859 u_char *status_write;
860 u_char *status_end;
861 u_char (*readisac) (struct IsdnCardState *, u_char);
862 void (*writeisac) (struct IsdnCardState *, u_char, u_char);
863 void (*readisacfifo) (struct IsdnCardState *, u_char *, int);
864 void (*writeisacfifo) (struct IsdnCardState *, u_char *, int);
865 u_char (*BC_Read_Reg) (struct IsdnCardState *, int, u_char);
866 void (*BC_Write_Reg) (struct IsdnCardState *, int, u_char, u_char);
867 void (*BC_Send_Data) (struct BCState *);
868 int (*cardmsg) (struct IsdnCardState *, int, void *);
869 void (*setstack_d) (struct PStack *, struct IsdnCardState *);
870 void (*DC_Close) (struct IsdnCardState *);
871 void (*irq_func) (int, void *, struct pt_regs *);
872 int (*auxcmd) (struct IsdnCardState *, isdn_ctrl *);
873 struct Channel channel[2+MAX_WAITING_CALLS];
874 struct BCState bcs[2+MAX_WAITING_CALLS];
875 struct PStack *stlist;
876 struct sk_buff_head rq, sq; /* D-channel queues */
877 int cardnr;
878 char *dlog;
879 int debug;
880 union {
881 struct isac_chip isac;
882 struct hfcd_chip hfcd;
883 struct hfcpci_chip hfcpci;
884 struct hfcsx_chip hfcsx;
885 struct w6692_chip w6692;
886 } dc;
887 u_char *rcvbuf;
888 int rcvidx;
889 struct sk_buff *tx_skb;
890 int tx_cnt;
891 int event;
892 struct tq_struct tqueue;
893 struct timer_list dbusytimer;
894 #ifdef ERROR_STATISTIC
895 int err_crc;
896 int err_tx;
897 int err_rx;
898 #endif
901 #define MON0_RX 1
902 #define MON1_RX 2
903 #define MON0_TX 4
904 #define MON1_TX 8
906 #define HISAX_MAX_CARDS 8
908 #define ISDN_CTYPE_16_0 1
909 #define ISDN_CTYPE_8_0 2
910 #define ISDN_CTYPE_16_3 3
911 #define ISDN_CTYPE_PNP 4
912 #define ISDN_CTYPE_A1 5
913 #define ISDN_CTYPE_ELSA 6
914 #define ISDN_CTYPE_ELSA_PNP 7
915 #define ISDN_CTYPE_TELESPCMCIA 8
916 #define ISDN_CTYPE_IX1MICROR2 9
917 #define ISDN_CTYPE_ELSA_PCMCIA 10
918 #define ISDN_CTYPE_DIEHLDIVA 11
919 #define ISDN_CTYPE_ASUSCOM 12
920 #define ISDN_CTYPE_TELEINT 13
921 #define ISDN_CTYPE_TELES3C 14
922 #define ISDN_CTYPE_SEDLBAUER 15
923 #define ISDN_CTYPE_SPORTSTER 16
924 #define ISDN_CTYPE_MIC 17
925 #define ISDN_CTYPE_ELSA_PCI 18
926 #define ISDN_CTYPE_COMPAQ_ISA 19
927 #define ISDN_CTYPE_NETJET 20
928 #define ISDN_CTYPE_TELESPCI 21
929 #define ISDN_CTYPE_SEDLBAUER_PCMCIA 22
930 #define ISDN_CTYPE_AMD7930 23
931 #define ISDN_CTYPE_NICCY 24
932 #define ISDN_CTYPE_S0BOX 25
933 #define ISDN_CTYPE_A1_PCMCIA 26
934 #define ISDN_CTYPE_FRITZPCI 27
935 #define ISDN_CTYPE_SEDLBAUER_FAX 28
936 #define ISDN_CTYPE_ISURF 29
937 #define ISDN_CTYPE_ACERP10 30
938 #define ISDN_CTYPE_HSTSAPHIR 31
939 #define ISDN_CTYPE_BKM_A4T 32
940 #define ISDN_CTYPE_SCT_QUADRO 33
941 #define ISDN_CTYPE_GAZEL 34
942 #define ISDN_CTYPE_HFC_PCI 35
943 #define ISDN_CTYPE_W6692 36
944 #define ISDN_CTYPE_HFC_SX 37
945 #define ISDN_CTYPE_COUNT 37
948 #ifdef ISDN_CHIP_ISAC
949 #undef ISDN_CHIP_ISAC
950 #endif
952 #ifndef __initfunc
953 #define __initfunc(__arginit) __arginit
954 #endif
956 #ifndef __initdata
957 #define __initdata
958 #endif
960 #define HISAX_INITFUNC(__arginit) __initfunc(__arginit)
961 #define HISAX_INITDATA __initdata
963 #ifdef CONFIG_HISAX_16_0
964 #define CARD_TELES0 1
965 #ifndef ISDN_CHIP_ISAC
966 #define ISDN_CHIP_ISAC 1
967 #endif
968 #else
969 #define CARD_TELES0 0
970 #endif
972 #ifdef CONFIG_HISAX_16_3
973 #define CARD_TELES3 1
974 #ifndef ISDN_CHIP_ISAC
975 #define ISDN_CHIP_ISAC 1
976 #endif
977 #else
978 #define CARD_TELES3 0
979 #endif
981 #ifdef CONFIG_HISAX_TELESPCI
982 #define CARD_TELESPCI 1
983 #ifndef ISDN_CHIP_ISAC
984 #define ISDN_CHIP_ISAC 1
985 #endif
986 #else
987 #define CARD_TELESPCI 0
988 #endif
990 #ifdef CONFIG_HISAX_AVM_A1
991 #define CARD_AVM_A1 1
992 #ifndef ISDN_CHIP_ISAC
993 #define ISDN_CHIP_ISAC 1
994 #endif
995 #else
996 #define CARD_AVM_A1 0
997 #endif
999 #ifdef CONFIG_HISAX_AVM_A1_PCMCIA
1000 #define CARD_AVM_A1_PCMCIA 1
1001 #ifndef ISDN_CHIP_ISAC
1002 #define ISDN_CHIP_ISAC 1
1003 #endif
1004 #else
1005 #define CARD_AVM_A1_PCMCIA 0
1006 #endif
1008 #ifdef CONFIG_HISAX_FRITZPCI
1009 #define CARD_FRITZPCI 1
1010 #ifndef ISDN_CHIP_ISAC
1011 #define ISDN_CHIP_ISAC 1
1012 #endif
1013 #else
1014 #define CARD_FRITZPCI 0
1015 #endif
1017 #ifdef CONFIG_HISAX_ELSA
1018 #define CARD_ELSA 1
1019 #ifndef ISDN_CHIP_ISAC
1020 #define ISDN_CHIP_ISAC 1
1021 #endif
1022 #undef HISAX_INITFUNC
1023 #define HISAX_INITFUNC(__arginit) __arginit
1024 #undef HISAX_INITDATA
1025 #define HISAX_INITDATA
1026 #else
1027 #define CARD_ELSA 0
1028 #endif
1030 #ifdef CONFIG_HISAX_IX1MICROR2
1031 #define CARD_IX1MICROR2 1
1032 #ifndef ISDN_CHIP_ISAC
1033 #define ISDN_CHIP_ISAC 1
1034 #endif
1035 #else
1036 #define CARD_IX1MICROR2 0
1037 #endif
1039 #ifdef CONFIG_HISAX_DIEHLDIVA
1040 #define CARD_DIEHLDIVA 1
1041 #ifndef ISDN_CHIP_ISAC
1042 #define ISDN_CHIP_ISAC 1
1043 #endif
1044 #else
1045 #define CARD_DIEHLDIVA 0
1046 #endif
1048 #ifdef CONFIG_HISAX_ASUSCOM
1049 #define CARD_ASUSCOM 1
1050 #ifndef ISDN_CHIP_ISAC
1051 #define ISDN_CHIP_ISAC 1
1052 #endif
1053 #else
1054 #define CARD_ASUSCOM 0
1055 #endif
1057 #ifdef CONFIG_HISAX_TELEINT
1058 #define CARD_TELEINT 1
1059 #ifndef ISDN_CHIP_ISAC
1060 #define ISDN_CHIP_ISAC 1
1061 #endif
1062 #else
1063 #define CARD_TELEINT 0
1064 #endif
1066 #ifdef CONFIG_HISAX_SEDLBAUER
1067 #define CARD_SEDLBAUER 1
1068 #ifndef ISDN_CHIP_ISAC
1069 #define ISDN_CHIP_ISAC 1
1070 #endif
1071 #else
1072 #define CARD_SEDLBAUER 0
1073 #endif
1075 #ifdef CONFIG_HISAX_SPORTSTER
1076 #define CARD_SPORTSTER 1
1077 #ifndef ISDN_CHIP_ISAC
1078 #define ISDN_CHIP_ISAC 1
1079 #endif
1080 #else
1081 #define CARD_SPORTSTER 0
1082 #endif
1084 #ifdef CONFIG_HISAX_MIC
1085 #define CARD_MIC 1
1086 #ifndef ISDN_CHIP_ISAC
1087 #define ISDN_CHIP_ISAC 1
1088 #endif
1089 #else
1090 #define CARD_MIC 0
1091 #endif
1093 #ifdef CONFIG_HISAX_NETJET
1094 #define CARD_NETJET 1
1095 #ifndef ISDN_CHIP_ISAC
1096 #define ISDN_CHIP_ISAC 1
1097 #endif
1098 #else
1099 #define CARD_NETJET 0
1100 #endif
1102 #ifdef CONFIG_HISAX_HFCS
1103 #define CARD_HFCS 1
1104 #else
1105 #define CARD_HFCS 0
1106 #endif
1108 #ifdef CONFIG_HISAX_HFC_PCI
1109 #define CARD_HFC_PCI 1
1110 #else
1111 #define CARD_HFC_PCI 0
1112 #endif
1114 #ifdef CONFIG_HISAX_HFC_SX
1115 #define CARD_HFC_SX 1
1116 #else
1117 #define CARD_HFC_SX 0
1118 #endif
1120 #ifdef CONFIG_HISAX_AMD7930
1121 #define CARD_AMD7930 1
1122 #else
1123 #define CARD_AMD7930 0
1124 #endif
1126 #ifdef CONFIG_HISAX_NICCY
1127 #define CARD_NICCY 1
1128 #ifndef ISDN_CHIP_ISAC
1129 #define ISDN_CHIP_ISAC 1
1130 #endif
1131 #else
1132 #define CARD_NICCY 0
1133 #endif
1135 #ifdef CONFIG_HISAX_ISURF
1136 #define CARD_ISURF 1
1137 #ifndef ISDN_CHIP_ISAC
1138 #define ISDN_CHIP_ISAC 1
1139 #endif
1140 #else
1141 #define CARD_ISURF 0
1142 #endif
1144 #ifdef CONFIG_HISAX_S0BOX
1145 #define CARD_S0BOX 1
1146 #ifndef ISDN_CHIP_ISAC
1147 #define ISDN_CHIP_ISAC 1
1148 #endif
1149 #else
1150 #define CARD_S0BOX 0
1151 #endif
1153 #ifdef CONFIG_HISAX_HSTSAPHIR
1154 #define CARD_HSTSAPHIR 1
1155 #ifndef ISDN_CHIP_ISAC
1156 #define ISDN_CHIP_ISAC 1
1157 #endif
1158 #else
1159 #define CARD_HSTSAPHIR 0
1160 #endif
1162 #ifdef CONFIG_HISAX_TESTEMU
1163 #define CARD_TESTEMU 1
1164 #define ISDN_CTYPE_TESTEMU 99
1165 #undef ISDN_CTYPE_COUNT
1166 #define ISDN_CTYPE_COUNT ISDN_CTYPE_TESTEMU
1167 #else
1168 #define CARD_TESTEMU 0
1169 #endif
1171 #ifdef CONFIG_HISAX_BKM_A4T
1172 #define CARD_BKM_A4T 1
1173 #ifndef ISDN_CHIP_ISAC
1174 #define ISDN_CHIP_ISAC 1
1175 #endif
1176 #else
1177 #define CARD_BKM_A4T 0
1178 #endif
1180 #ifdef CONFIG_HISAX_SCT_QUADRO
1181 #define CARD_SCT_QUADRO 1
1182 #ifndef ISDN_CHIP_ISAC
1183 #define ISDN_CHIP_ISAC 1
1184 #endif
1185 #else
1186 #define CARD_SCT_QUADRO 0
1187 #endif
1189 #ifdef CONFIG_HISAX_GAZEL
1190 #define CARD_GAZEL 1
1191 #ifndef ISDN_CHIP_ISAC
1192 #define ISDN_CHIP_ISAC 1
1193 #endif
1194 #else
1195 #define CARD_GAZEL 0
1196 #endif
1198 #ifdef CONFIG_HISAX_W6692
1199 #define CARD_W6692 1
1200 #ifndef ISDN_CHIP_W6692
1201 #define ISDN_CHIP_W6692 1
1202 #endif
1203 #else
1204 #define CARD_W6692 0
1205 #endif
1207 #define TEI_PER_CARD 0
1209 #ifdef CONFIG_HISAX_1TR6
1210 #undef TEI_PER_CARD
1211 #define TEI_PER_CARD 1
1212 #endif
1214 #ifdef CONFIG_HISAX_EURO
1215 #undef TEI_PER_CARD
1216 #define TEI_PER_CARD 1
1217 #endif
1219 /* L1 Debug */
1220 #define L1_DEB_WARN 0x01
1221 #define L1_DEB_INTSTAT 0x02
1222 #define L1_DEB_ISAC 0x04
1223 #define L1_DEB_ISAC_FIFO 0x08
1224 #define L1_DEB_HSCX 0x10
1225 #define L1_DEB_HSCX_FIFO 0x20
1226 #define L1_DEB_LAPD 0x40
1227 #define L1_DEB_IPAC 0x80
1228 #define L1_DEB_RECEIVE_FRAME 0x100
1229 #define L1_DEB_MONITOR 0x200
1230 #define DEB_DLOG_HEX 0x400
1231 #define DEB_DLOG_VERBOSE 0x800
1233 #define L2FRAME_DEBUG
1235 #ifdef L2FRAME_DEBUG
1236 extern void Logl2Frame(struct IsdnCardState *cs, struct sk_buff *skb, char *buf, int dir);
1237 #endif
1239 struct IsdnCard {
1240 int typ;
1241 int protocol; /* EDSS1 or 1TR6 */
1242 unsigned int para[4];
1243 struct IsdnCardState *cs;
1246 void init_bcstate(struct IsdnCardState *cs, int bc);
1248 void setstack_HiSax(struct PStack *st, struct IsdnCardState *cs);
1249 unsigned int random_ri(void);
1250 void HiSax_addlist(struct IsdnCardState *sp, struct PStack *st);
1251 void HiSax_rmlist(struct IsdnCardState *sp, struct PStack *st);
1253 void setstack_l1_B(struct PStack *st);
1255 void setstack_tei(struct PStack *st);
1256 void setstack_manager(struct PStack *st);
1258 void setstack_isdnl2(struct PStack *st, char *debug_id);
1259 void releasestack_isdnl2(struct PStack *st);
1260 void setstack_transl2(struct PStack *st);
1261 void releasestack_transl2(struct PStack *st);
1263 void setstack_l3dc(struct PStack *st, struct Channel *chanp);
1264 void setstack_l3bc(struct PStack *st, struct Channel *chanp);
1265 void releasestack_isdnl3(struct PStack *st);
1267 u_char *findie(u_char * p, int size, u_char ie, int wanted_set);
1268 int getcallref(u_char * p);
1269 int newcallref(void);
1271 void FsmNew(struct Fsm *fsm, struct FsmNode *fnlist, int fncount);
1272 void FsmFree(struct Fsm *fsm);
1273 int FsmEvent(struct FsmInst *fi, int event, void *arg);
1274 void FsmChangeState(struct FsmInst *fi, int newstate);
1275 void FsmInitTimer(struct FsmInst *fi, struct FsmTimer *ft);
1276 int FsmAddTimer(struct FsmTimer *ft, int millisec, int event,
1277 void *arg, int where);
1278 void FsmRestartTimer(struct FsmTimer *ft, int millisec, int event,
1279 void *arg, int where);
1280 void FsmDelTimer(struct FsmTimer *ft, int where);
1281 int jiftime(char *s, long mark);
1283 int HiSax_command(isdn_ctrl * ic);
1284 int HiSax_writebuf_skb(int id, int chan, int ack, struct sk_buff *skb);
1285 void HiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, ...);
1286 void VHiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, va_list args);
1287 void HiSax_reportcard(int cardnr, int sel);
1288 int QuickHex(char *txt, u_char * p, int cnt);
1289 void LogFrame(struct IsdnCardState *cs, u_char * p, int size);
1290 void dlogframe(struct IsdnCardState *cs, struct sk_buff *skb, int dir);
1291 void iecpy(u_char * dest, u_char * iestart, int ieoffset);
1292 int discard_queue(struct sk_buff_head *q);
1293 #ifdef ISDN_CHIP_ISAC
1294 void setstack_isac(struct PStack *st, struct IsdnCardState *cs);
1295 #endif /* ISDN_CHIP_ISAC */
1296 #endif /* __KERNEL__ */
1298 #define HZDELAY(jiffs) {int tout = jiffs; while (tout--) udelay(1000000/HZ);}
1300 int ll_run(struct IsdnCardState *cs, int addfeatures);
1301 void ll_stop(struct IsdnCardState *cs);
1302 void CallcNew(void);
1303 void CallcFree(void);
1304 int CallcNewChan(struct IsdnCardState *cs);
1305 void CallcFreeChan(struct IsdnCardState *cs);
1306 void Isdnl1New(void);
1307 void Isdnl1Free(void);
1308 void Isdnl2New(void);
1309 void Isdnl2Free(void);
1310 void Isdnl3New(void);
1311 void Isdnl3Free(void);
1312 void init_tei(struct IsdnCardState *cs, int protocol);
1313 void release_tei(struct IsdnCardState *cs);
1314 char *HiSax_getrev(const char *revision);
1315 void TeiNew(void);
1316 void TeiFree(void);
1317 int certification_check(int output);