Hopefully get the Kconfig PCI stuff right, finally.
[linux-2.6/linux-mips.git] / drivers / isdn / hisax / hisax.h
blobf32fe99a733a7992160ccd8c71da34672408e021
1 /* $Id: hisax.h,v 1.1.4.1.2.1 2001/12/09 20:18:40 kai Exp $
3 * Basic declarations, defines and prototypes
5 * This software may be used and distributed according to the terms
6 * of the GNU General Public License, incorporated herein by reference.
8 */
10 #ifndef __HISAX_H__
11 #define __HISAX_H__
13 #include <linux/config.h>
14 #include <linux/errno.h>
15 #include <linux/fs.h>
16 #include <linux/major.h>
17 #include <asm/io.h>
18 #include <linux/delay.h>
19 #include <linux/kernel.h>
20 #include <linux/signal.h>
21 #include <linux/slab.h>
22 #include <linux/mm.h>
23 #include <linux/mman.h>
24 #include <linux/ioport.h>
25 #include <linux/timer.h>
26 #include <linux/wait.h>
27 #include <linux/isdnif.h>
28 #include <linux/tty.h>
29 #include <linux/serial_reg.h>
30 #include <linux/netdevice.h>
31 #include <linux/interrupt.h>
33 #define ERROR_STATISTIC
35 #define REQUEST 0
36 #define CONFIRM 1
37 #define INDICATION 2
38 #define RESPONSE 3
40 #define HW_ENABLE 0x0000
41 #define HW_RESET 0x0004
42 #define HW_POWERUP 0x0008
43 #define HW_ACTIVATE 0x0010
44 #define HW_DEACTIVATE 0x0018
46 #define HW_INFO1 0x0010
47 #define HW_INFO2 0x0020
48 #define HW_INFO3 0x0030
49 #define HW_INFO4 0x0040
50 #define HW_INFO4_P8 0x0040
51 #define HW_INFO4_P10 0x0048
52 #define HW_RSYNC 0x0060
53 #define HW_TESTLOOP 0x0070
55 #define PH_ACTIVATE 0x0100
56 #define PH_DEACTIVATE 0x0110
57 #define PH_DATA 0x0120
58 #define PH_PULL 0x0130
59 #define PH_TESTLOOP 0x0140
60 #define PH_PAUSE 0x0150
61 #define MPH_ACTIVATE 0x0180
62 #define MPH_DEACTIVATE 0x0190
63 #define MPH_INFORMATION 0x01A0
65 #define DL_ESTABLISH 0x0200
66 #define DL_RELEASE 0x0210
67 #define DL_DATA 0x0220
68 #define DL_FLUSH 0x0224
69 #define DL_UNIT_DATA 0x0230
71 #define MDL_ASSIGN 0x0280
72 #define MDL_REMOVE 0x0284
73 #define MDL_ERROR 0x0288
75 #define CC_SETUP 0x0300
76 #define CC_RESUME 0x0304
77 #define CC_MORE_INFO 0x0310
78 #define CC_IGNORE 0x0320
79 #define CC_REJECT 0x0324
80 #define CC_SETUP_COMPL 0x0330
81 #define CC_PROCEEDING 0x0340
82 #define CC_ALERTING 0x0344
83 #define CC_PROGRESS 0x0348
84 #define CC_CONNECT 0x0350
85 #define CC_CHARGE 0x0354
86 #define CC_NOTIFY 0x0358
87 #define CC_DISCONNECT 0x0360
88 #define CC_RELEASE 0x0368
89 #define CC_SUSPEND 0x0370
90 #define CC_PROCEED_SEND 0x0374
91 #define CC_REDIR 0x0378
92 #define CC_T302 0x0382
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_TSPID 0x03A0
104 #define CC_NOSETUP_RSP 0x03E0
105 #define CC_SETUP_ERR 0x03E1
106 #define CC_SUSPEND_ERR 0x03E2
107 #define CC_RESUME_ERR 0x03E3
108 #define CC_CONNECT_ERR 0x03E4
109 #define CC_RELEASE_ERR 0x03E5
110 #define CC_RESTART 0x03F4
111 #define CC_TDSS1_IO 0x13F4 /* DSS1 IO user timer */
112 #define CC_TNI1_IO 0x13F5 /* NI1 IO user timer */
114 /* define maximum number of possible waiting incoming calls */
115 #define MAX_WAITING_CALLS 2
118 #ifdef __KERNEL__
120 /* include l3dss1 & ni1 specific process structures, but no other defines */
121 #ifdef CONFIG_HISAX_EURO
122 #define l3dss1_process
123 #include "l3dss1.h"
124 #undef l3dss1_process
125 #endif /* CONFIG_HISAX_EURO */
127 #ifdef CONFIG_HISAX_NI1
128 #define l3ni1_process
129 #include "l3ni1.h"
130 #undef l3ni1_process
131 #endif /* CONFIG_HISAX_NI1 */
133 #define MAX_DFRAME_LEN 260
134 #define MAX_DFRAME_LEN_L1 300
135 #define HSCX_BUFMAX 4096
136 #define MAX_DATA_SIZE (HSCX_BUFMAX - 4)
137 #define MAX_DATA_MEM (HSCX_BUFMAX + 64)
138 #define RAW_BUFMAX (((HSCX_BUFMAX*6)/5) + 5)
139 #define MAX_HEADER_LEN 4
140 #define MAX_WINDOW 8
141 #define MAX_MON_FRAME 32
142 #define MAX_DLOG_SPACE 2048
143 #define MAX_BLOG_SPACE 256
145 /* #define I4L_IRQ_FLAG SA_INTERRUPT */
146 #define I4L_IRQ_FLAG 0
148 struct res {
149 struct list_head node;
150 const char *name;
151 unsigned long start, end;
152 unsigned long flags;
153 union {
154 void *ioremap_addr;
155 } r_u;
158 struct resources {
159 struct list_head res_head;
162 void
163 resources_init(struct resources *rs);
165 void
166 resources_release(struct resources *rs);
168 unsigned long
169 request_io(struct resources *rs, unsigned long start, int len,
170 const char *name);
172 void *
173 request_mmio(struct resources *rs, unsigned long start, int len,
174 const char *name);
178 * Statemachine
181 struct FsmInst;
183 typedef void (* FSMFNPTR)(struct FsmInst *, int, void *);
185 struct Fsm {
186 FSMFNPTR *jumpmatrix;
187 int state_count, event_count;
188 char **strEvent, **strState;
191 struct FsmInst {
192 struct Fsm *fsm;
193 int state;
194 int debug;
195 void *userdata;
196 int userint;
197 void (*printdebug) (struct FsmInst *, char *, ...);
200 struct FsmNode {
201 int state, event;
202 void (*routine) (struct FsmInst *, int, void *);
205 struct FsmTimer {
206 struct FsmInst *fi;
207 struct timer_list tl;
208 int event;
209 void *arg;
212 struct L3Timer {
213 struct l3_process *pc;
214 struct timer_list tl;
215 int event;
218 #define FLG_L1_ACTIVATING 1
219 #define FLG_L1_ACTIVATED 2
220 #define FLG_L1_DEACTTIMER 3
221 #define FLG_L1_ACTTIMER 4
222 #define FLG_L1_T3RUN 5
223 #define FLG_L1_PULL_REQ 6
224 #define FLG_L1_UINT 7
226 struct Layer1 {
227 void *hardware;
228 struct BCState *bcs;
229 struct PStack **stlistp;
230 long Flags;
231 struct FsmInst l1m;
232 struct FsmTimer timer;
233 void (*l1hw) (struct PStack *, int, void *);
234 void (*l1tei) (struct PStack *, int, void *);
235 void (*l2l1) (struct PStack *, int, void *);
236 int mode, bc;
237 int delay;
240 #define GROUP_TEI 127
241 #define TEI_SAPI 63
242 #define CTRL_SAPI 0
243 #define PACKET_NOACK 250
245 /* Layer2 Flags */
247 #define FLG_LAPB 0
248 #define FLG_LAPD 1
249 #define FLG_ORIG 2
250 #define FLG_MOD128 3
251 #define FLG_PEND_REL 4
252 #define FLG_L3_INIT 5
253 #define FLG_T200_RUN 6
254 #define FLG_ACK_PEND 7
255 #define FLG_REJEXC 8
256 #define FLG_OWN_BUSY 9
257 #define FLG_PEER_BUSY 10
258 #define FLG_DCHAN_BUSY 11
259 #define FLG_L1_ACTIV 12
260 #define FLG_ESTAB_PEND 13
261 #define FLG_PTP 14
262 #define FLG_FIXED_TEI 15
263 #define FLG_L2BLOCK 16
265 struct Layer2 {
266 int tei;
267 int sap;
268 int maxlen;
269 unsigned long flag;
270 unsigned int vs, va, vr;
271 int rc;
272 unsigned int window;
273 unsigned int sow;
274 struct sk_buff *windowar[MAX_WINDOW];
275 struct sk_buff_head i_queue;
276 struct sk_buff_head ui_queue;
277 void (*l3l2) (struct PStack *, int, void *);
278 void (*l1l2) (struct PStack *, int, void *);
279 void (*l2tei) (struct PStack *, int, void *);
280 struct FsmInst l2m;
281 struct FsmTimer t200, t203;
282 int T200, N200, T203;
283 int debug;
284 char debug_id[16];
287 struct Layer3 {
288 void (*l4l3) (struct PStack *, int, void *);
289 int (*l4l3_proto) (struct PStack *, isdn_ctrl *);
290 void (*l3ml3) (struct PStack *, int, void *);
291 void (*l2l3) (struct PStack *, int, void *);
292 struct FsmInst l3m;
293 struct FsmTimer l3m_timer;
294 struct sk_buff_head squeue;
295 struct l3_process *proc;
296 struct l3_process *global;
297 int N303;
298 int debug;
299 char debug_id[8];
302 struct LLInterface {
303 void (*l3l4) (struct PStack *, int, void *);
304 void *userdata;
308 struct Management {
309 int ri;
310 struct FsmInst tei_m;
311 struct FsmTimer t202;
312 int T202, N202, debug;
313 void (*layer) (struct PStack *, int, void *);
316 #define NO_CAUSE 254
318 struct Param {
319 u8 cause;
320 u8 loc;
321 u8 diag[6];
322 int bchannel;
323 int chargeinfo;
324 int spv; /* SPV Flag */
325 setup_parm setup; /* from isdnif.h numbers and Serviceindicator */
326 u8 moderate; /* transfer mode and rate (bearer octet 4) */
330 struct PStack {
331 struct PStack *next;
332 struct Layer1 l1;
333 struct Layer2 l2;
334 struct Layer3 l3;
335 struct LLInterface lli;
336 struct Management ma;
337 int protocol; /* EDSS1, 1TR6 or NI1 */
339 /* protocol specific data fields */
340 union
341 { u8 uuuu; /* only as dummy */
342 #ifdef CONFIG_HISAX_EURO
343 dss1_stk_priv dss1; /* private dss1 data */
344 #endif /* CONFIG_HISAX_EURO */
345 #ifdef CONFIG_HISAX_NI1
346 ni1_stk_priv ni1; /* private ni1 data */
347 #endif /* CONFIG_HISAX_NI1 */
348 } prot;
351 struct l3_process {
352 int callref;
353 int state;
354 struct L3Timer timer;
355 int N303;
356 int debug;
357 struct Param para;
358 struct Channel *chan;
359 struct PStack *st;
360 struct l3_process *next;
361 ulong redir_result;
363 /* protocol specific data fields */
364 union
365 { u8 uuuu; /* only when euro not defined, avoiding empty union */
366 #ifdef CONFIG_HISAX_EURO
367 dss1_proc_priv dss1; /* private dss1 data */
368 #endif /* CONFIG_HISAX_EURO */
369 #ifdef CONFIG_HISAX_NI1
370 ni1_proc_priv ni1; /* private ni1 data */
371 #endif /* CONFIG_HISAX_NI1 */
372 } prot;
375 struct hscx_hw {
376 u8 tsaxr0;
377 u8 tsaxr1;
380 struct w6692B_hw {
381 int bchan;
384 struct isar_reg {
385 unsigned long Flags;
386 volatile u8 bstat;
387 volatile u8 iis;
388 volatile u8 cmsb;
389 volatile u8 clsb;
390 volatile u8 par[8];
393 struct isar_hw {
394 int dpath;
395 int rcvidx;
396 int mml;
397 u8 state;
398 u8 cmd;
399 u8 mod;
400 u8 newcmd;
401 u8 newmod;
402 char try_mod;
403 struct timer_list ftimer;
404 u8 *rcvbuf; /* B-Channel receive Buffer */
405 u8 conmsg[16];
406 struct isar_reg *reg;
409 struct hdlc_stat_reg {
410 #ifdef __BIG_ENDIAN
411 u8 fill __attribute__((packed));
412 u8 mode __attribute__((packed));
413 u8 xml __attribute__((packed));
414 u8 cmd __attribute__((packed));
415 #else
416 u8 cmd __attribute__((packed));
417 u8 xml __attribute__((packed));
418 u8 mode __attribute__((packed));
419 u8 fill __attribute__((packed));
420 #endif
423 struct hdlc_hw {
424 union {
425 u_int ctrl;
426 struct hdlc_stat_reg sr;
427 } ctrl;
428 u_int stat;
431 struct hfcB_hw {
432 unsigned int *send;
433 int f1;
434 int f2;
437 struct tiger_hw {
438 u_int *send;
439 dma_addr_t send_dma;
440 u_int *s_end;
441 u_int *sendp;
442 u_int *rec;
443 dma_addr_t rec_dma;
444 int free;
445 u8 *rcvbuf;
446 u8 *sendbuf;
447 u8 *sp;
448 int sendcnt;
449 u_int s_tot;
450 u_int r_bitcnt;
451 u_int r_tot;
452 u_int r_err;
453 u_int r_fcs;
454 u8 r_state;
455 u8 r_one;
456 u8 r_val;
457 u8 s_state;
460 struct amd7930_hw {
461 u8 *tx_buff;
462 u8 *rv_buff;
463 int rv_buff_in;
464 int rv_buff_out;
465 struct sk_buff *rv_skb;
466 struct hdlc_state *hdlc_state;
467 struct work_struct rcv_work;
468 struct work_struct xmt_work;
471 #define BC_FLG_INIT 1
472 #define BC_FLG_ACTIV 2
473 #define BC_FLG_BUSY 3
474 #define BC_FLG_NOFRAME 4
475 #define BC_FLG_HALF 5
476 #define BC_FLG_EMPTY 6
477 #define BC_FLG_ORIG 7
478 #define BC_FLG_DLEETX 8
479 #define BC_FLG_LASTDLE 9
480 #define BC_FLG_FIRST 10
481 #define BC_FLG_LASTDATA 11
482 #define BC_FLG_NMD_DATA 12
483 #define BC_FLG_FTI_RUN 13
484 #define BC_FLG_LL_OK 14
485 #define BC_FLG_LL_CONN 15
487 #define L1_MODE_NULL 0
488 #define L1_MODE_TRANS 1
489 #define L1_MODE_HDLC 2
490 #define L1_MODE_EXTRN 3
491 #define L1_MODE_HDLC_56K 4
492 #define L1_MODE_MODEM 7
493 #define L1_MODE_V32 8
494 #define L1_MODE_FAX 9
496 struct BCState {
497 int channel;
498 int mode;
499 long Flag;
500 struct IsdnCardState *cs;
501 int unit; /* first or second unit (e.g. HSCX) */
502 int rcvidx;
503 u8 *rcvbuf; /* B-Channel receive Buffer */
504 int tx_cnt; /* B-Channel transmit counter */
505 struct sk_buff *tx_skb; /* B-Channel transmit Buffer */
506 struct sk_buff_head rqueue; /* B-Channel receive queue */
507 struct sk_buff_head squeue; /* B-Channel send queue */
508 struct sk_buff_head cmpl_queue; /* B-Channel send complete queue */
509 struct PStack *st;
510 u8 *blog;
511 u8 *conmsg;
512 struct timer_list transbusy;
513 struct work_struct work;
514 unsigned long event;
515 #ifdef ERROR_STATISTIC
516 int err_crc;
517 int err_tx;
518 int err_rdo;
519 int err_inv;
520 #endif
521 int count;
522 union {
523 struct hscx_hw hscx;
524 struct hdlc_hw hdlc;
525 struct isar_hw isar;
526 struct hfcB_hw hfc;
527 struct tiger_hw tiger;
528 struct amd7930_hw amd7930;
529 struct w6692B_hw w6692;
530 struct hisax_b_if *b_if;
531 } hw;
534 struct Channel {
535 struct PStack *b_st, *d_st;
536 struct IsdnCardState *cs;
537 struct BCState *bcs;
538 int chan;
539 int incoming;
540 struct FsmInst fi;
541 struct FsmTimer drel_timer, dial_timer;
542 int debug;
543 int l2_protocol, l2_active_protocol;
544 int l3_protocol;
545 int data_open;
546 struct l3_process *proc;
547 setup_parm setup; /* from isdnif.h numbers and Serviceindicator */
548 long Flags; /* for remembering action done in l4 */
549 /* long req'd for set_bit --RR */
550 int leased;
553 struct elsa_hw {
554 unsigned long base;
555 unsigned int cfg;
556 unsigned int ctrl;
557 unsigned int ale;
558 unsigned int isac;
559 unsigned int itac;
560 unsigned int hscx;
561 unsigned int trig;
562 unsigned int timer;
563 unsigned int counter;
564 unsigned int status;
565 struct timer_list tl;
566 unsigned int MFlag;
567 struct BCState *bcs;
568 u8 *transbuf;
569 u8 *rcvbuf;
570 unsigned int transp;
571 unsigned int rcvp;
572 unsigned int transcnt;
573 unsigned int rcvcnt;
574 u8 IER;
575 u8 FCR;
576 u8 LCR;
577 u8 MCR;
578 u8 ctrl_reg;
581 struct teles3_hw {
582 unsigned int cfg_reg;
583 signed int isac;
584 signed int hscx[2];
585 signed int isacfifo;
586 signed int hscxfifo[2];
589 struct teles0_hw {
590 unsigned int cfg_reg;
591 unsigned long phymem;
592 void *membase;
595 struct avm_hw {
596 unsigned int cfg_reg;
597 unsigned int isac;
598 unsigned int hscx[2];
599 unsigned int isacfifo;
600 unsigned int hscxfifo[2];
601 unsigned int counter;
604 struct ix1_hw {
605 unsigned int cfg_reg;
606 unsigned int isac_ale;
607 unsigned int isac;
608 unsigned int hscx_ale;
609 unsigned int hscx;
612 struct diva_hw {
613 unsigned long cfg_reg;
614 unsigned long pci_cfg;
615 unsigned int ctrl;
616 unsigned long isac_adr;
617 unsigned int isac;
618 unsigned long hscx_adr;
619 unsigned int hscx;
620 struct timer_list tl;
621 u8 ctrl_reg;
624 struct asus_hw {
625 unsigned int cfg_reg;
626 unsigned int adr;
627 unsigned int isac;
628 unsigned int hscx;
629 unsigned int u7;
630 unsigned int pots;
634 struct hfc_hw {
635 unsigned int addr;
636 unsigned int fifosize;
637 unsigned char cirm;
638 unsigned char ctmt;
639 unsigned char cip;
640 u8 isac_spcr;
641 struct timer_list timer;
644 struct sedl_hw {
645 unsigned int cfg_reg;
646 unsigned int adr;
647 unsigned int isac;
648 unsigned int hscx;
649 unsigned int reset_on;
650 unsigned int reset_off;
651 struct isar_reg isar;
652 unsigned int chip;
653 unsigned int bus;
656 struct spt_hw {
657 unsigned int cfg_reg;
658 unsigned int isac;
659 unsigned int hscx[2];
660 unsigned char res_irq;
663 struct mic_hw {
664 unsigned int cfg_reg;
665 unsigned int adr;
666 unsigned int isac;
667 unsigned int hscx;
670 struct njet_hw {
671 unsigned long base;
672 unsigned int isac;
673 unsigned int auxa;
674 unsigned char auxd;
675 unsigned char dmactrl;
676 unsigned char ctrl_reg;
677 unsigned char irqmask0;
678 unsigned char irqstat0;
679 unsigned char last_is0;
680 struct pci_dev *pdev;
681 void (*bc_activate)(struct IsdnCardState *cs, int bc);
682 void (*bc_deactivate)(struct IsdnCardState *cs, int bc);
685 struct hfcPCI_hw {
686 unsigned char cirm;
687 unsigned char ctmt;
688 unsigned char conn;
689 unsigned char mst_m;
690 unsigned char int_m1;
691 unsigned char int_m2;
692 unsigned char int_s1;
693 unsigned char sctrl;
694 unsigned char sctrl_r;
695 unsigned char sctrl_e;
696 unsigned char trm;
697 unsigned char stat;
698 unsigned char fifo;
699 unsigned char fifo_en;
700 unsigned char bswapped;
701 unsigned char nt_mode;
702 int nt_timer;
703 unsigned char *pci_io; /* start of PCI IO memory */
704 void *fifos; /* FIFO memory */
705 dma_addr_t fifos_dma;
706 struct pci_dev* pdev;
707 int last_bfifo_cnt[2]; /* marker saving last b-fifo frame count */
708 struct timer_list timer;
711 struct hfcSX_hw {
712 unsigned long base;
713 unsigned char cirm;
714 unsigned char ctmt;
715 unsigned char conn;
716 unsigned char mst_m;
717 unsigned char int_m1;
718 unsigned char int_m2;
719 unsigned char int_s1;
720 unsigned char sctrl;
721 unsigned char sctrl_r;
722 unsigned char sctrl_e;
723 unsigned char trm;
724 unsigned char stat;
725 unsigned char fifo;
726 unsigned char bswapped;
727 unsigned char nt_mode;
728 unsigned char chip;
729 int b_fifo_size;
730 unsigned char last_fifo;
731 void *extra;
732 int nt_timer;
733 struct timer_list timer;
736 struct hfcD_hw {
737 unsigned int addr;
738 unsigned int bfifosize;
739 unsigned int dfifosize;
740 unsigned char cirm;
741 unsigned char ctmt;
742 unsigned char cip;
743 unsigned char conn;
744 unsigned char mst_m;
745 unsigned char int_m1;
746 unsigned char int_m2;
747 unsigned char int_s1;
748 unsigned char sctrl;
749 unsigned char stat;
750 unsigned char fifo;
751 unsigned char f1;
752 unsigned char f2;
753 unsigned int *send;
754 struct timer_list timer;
757 struct isurf_hw {
758 unsigned int reset;
759 void *isac;
760 void *isar;
761 struct isar_reg isar_r;
764 struct saphir_hw {
765 unsigned int cfg_reg;
766 unsigned int ale;
767 unsigned int isac;
768 unsigned int hscx;
769 struct timer_list timer;
772 struct bkm_hw {
773 unsigned long base;
774 /* A4T stuff */
775 unsigned long isac_adr;
776 unsigned int isac_ale;
777 unsigned long jade_adr;
778 unsigned int jade_ale;
779 /* Scitel Quadro stuff */
780 unsigned long plx_adr;
781 unsigned long data_adr;
784 struct gazel_hw {
785 unsigned int cfg_reg;
786 signed int ipac;
787 signed int isac;
788 signed int hscx[2];
789 signed int isacfifo;
790 signed int hscxfifo[2];
791 unsigned char timeslot;
792 unsigned char iom2;
795 struct w6692_hw {
796 unsigned int iobase;
797 struct timer_list timer;
800 #ifdef CONFIG_HISAX_TESTEMU
801 struct te_hw {
802 unsigned char *sfifo;
803 unsigned char *sfifo_w;
804 unsigned char *sfifo_r;
805 unsigned char *sfifo_e;
806 int sfifo_cnt;
807 unsigned int stat;
808 wait_queue_head_t rwaitq;
809 wait_queue_head_t swaitq;
811 #endif
813 struct arcofi_msg {
814 struct arcofi_msg *next;
815 u8 receive;
816 u8 len;
817 u8 msg[10];
820 struct isac_chip {
821 int ph_state;
822 u8 *mon_tx;
823 u8 *mon_rx;
824 int mon_txp;
825 int mon_txc;
826 int mon_rxp;
827 struct arcofi_msg *arcofi_list;
828 struct timer_list arcofitimer;
829 wait_queue_head_t arcofi_wait;
830 u8 arcofi_bc;
831 u8 arcofi_state;
832 u8 mocr;
833 u8 adf2;
836 struct hfcd_chip {
837 int ph_state;
840 struct hfcpci_chip {
841 int ph_state;
844 struct hfcsx_chip {
845 int ph_state;
848 struct w6692_chip {
849 int ph_state;
852 struct amd7930_chip {
853 u8 lmr1;
854 u8 ph_state;
855 u8 old_state;
856 u8 flg_t3;
857 unsigned int tx_xmtlen;
858 struct timer_list timer3;
859 void (*ph_command) (struct IsdnCardState *, u8, char *);
860 void (*setIrqMask) (struct IsdnCardState *, u8);
863 struct icc_chip {
864 int ph_state;
865 u8 *mon_tx;
866 u8 *mon_rx;
867 int mon_txp;
868 int mon_txc;
869 int mon_rxp;
870 struct arcofi_msg *arcofi_list;
871 struct timer_list arcofitimer;
872 wait_queue_head_t arcofi_wait;
873 u8 arcofi_bc;
874 u8 arcofi_state;
875 u8 mocr;
876 u8 adf2;
879 struct IsdnCardState;
881 /* Methods provided by driver for a specific card */
883 struct card_ops {
884 void (*init) (struct IsdnCardState *);
885 void (*test) (struct IsdnCardState *);
886 int (*reset) (struct IsdnCardState *);
887 void (*release) (struct IsdnCardState *);
888 void (*aux_ind) (struct IsdnCardState *, void *);
889 void (*led_handler)(struct IsdnCardState *);
890 irqreturn_t (*irq_func) (int, void *, struct pt_regs *);
893 /* Card specific drivers provide methods to access the
894 * chips to the chip drivers */
896 struct bc_hw_ops {
897 u8 (*read_reg) (struct IsdnCardState *, int, u8);
898 void (*write_reg) (struct IsdnCardState *, int, u8, u8);
899 void (*read_fifo) (struct IsdnCardState *, int, u8 *, int);
900 void (*write_fifo) (struct IsdnCardState *, int, u8 *, int);
903 struct dc_hw_ops {
904 u8 (*read_reg) (struct IsdnCardState *, u8);
905 void (*write_reg) (struct IsdnCardState *, u8, u8);
906 void (*read_fifo) (struct IsdnCardState *, u8 *, int);
907 void (*write_fifo) (struct IsdnCardState *, u8 *, int);
910 /* Methods provided to shared B-channel FIFO handling */
912 struct bc_l1_ops {
913 void (*fill_fifo) (struct BCState *);
914 int (*open) (struct PStack *, struct BCState *);
915 void (*close) (struct BCState *);
918 /* Methods provided to shared D-channel FIFO handling */
920 struct dc_l1_ops {
921 void (*fill_fifo) (struct IsdnCardState *);
922 int (*open) (struct PStack *, struct IsdnCardState *);
923 void (*close) (struct IsdnCardState *);
925 void (*bh_func) (void *);
926 void (*dbusy_func) (struct IsdnCardState *);
929 #define HW_IOM1 0
930 #define HW_IPAC 1
931 #define HW_ISAR 2
932 #define HW_ARCOFI 3
933 #define FLG_TWO_DCHAN 4
934 #define FLG_L1_DBUSY 5
935 #define FLG_DBUSY_TIMER 6
936 #define FLG_ARCOFI_TIMER 8
937 #define FLG_ARCOFI_ERROR 9
938 #define FLG_HW_L1_UINT 10
939 #define FLG_BUGGY_PLX9050 11
941 struct IsdnCardState {
942 unsigned char typ;
943 unsigned char subtyp;
944 spinlock_t lock;
945 struct card_ops *card_ops;
946 int protocol;
947 struct resources rs;
948 unsigned int irq;
949 unsigned long irq_flags;
950 int status;
951 long HW_Flags;
952 int *busy_flag;
953 int chanlimit; /* limited number of B-chans to use */
954 int logecho; /* log echo if supported by card */
955 union {
956 struct elsa_hw elsa;
957 struct teles0_hw teles0;
958 struct teles3_hw teles3;
959 struct avm_hw avm;
960 struct ix1_hw ix1;
961 struct diva_hw diva;
962 struct asus_hw asus;
963 struct hfc_hw hfc;
964 struct sedl_hw sedl;
965 struct spt_hw spt;
966 struct mic_hw mic;
967 struct njet_hw njet;
968 struct hfcD_hw hfcD;
969 struct hfcPCI_hw hfcpci;
970 struct hfcSX_hw hfcsx;
971 struct ix1_hw niccy;
972 struct isurf_hw isurf;
973 struct saphir_hw saphir;
974 #ifdef CONFIG_HISAX_TESTEMU
975 struct te_hw te;
976 #endif
977 struct bkm_hw ax;
978 struct gazel_hw gazel;
979 struct w6692_hw w6692;
980 struct hisax_d_if *hisax_d_if;
981 } hw;
982 int myid;
983 isdn_if iif;
984 u8 *status_buf;
985 u8 *status_read;
986 u8 *status_write;
987 u8 *status_end;
988 struct dc_hw_ops *dc_hw_ops;
989 struct bc_hw_ops *bc_hw_ops;
990 struct dc_l1_ops *dc_l1_ops;
991 struct bc_l1_ops *bc_l1_ops;
992 int (*cardmsg) (struct IsdnCardState *, int, void *);
993 int (*auxcmd) (struct IsdnCardState *, isdn_ctrl *);
994 struct Channel channel[2+MAX_WAITING_CALLS];
995 struct BCState bcs[2+MAX_WAITING_CALLS];
996 struct PStack *stlist;
997 struct sk_buff_head rq, sq; /* D-channel queues */
998 int cardnr;
999 char *dlog;
1000 int debug;
1001 union {
1002 struct isac_chip isac;
1003 struct hfcd_chip hfcd;
1004 struct hfcpci_chip hfcpci;
1005 struct hfcsx_chip hfcsx;
1006 struct w6692_chip w6692;
1007 struct amd7930_chip amd7930;
1008 struct icc_chip icc;
1009 } dc;
1010 u8 *rcvbuf;
1011 int rcvidx;
1012 struct sk_buff *tx_skb;
1013 int tx_cnt;
1014 long event;
1015 struct work_struct work;
1016 struct timer_list dbusytimer;
1017 #ifdef ERROR_STATISTIC
1018 int err_crc;
1019 int err_tx;
1020 int err_rx;
1021 #endif
1024 void
1025 hisax_release_resources(struct IsdnCardState *cs);
1027 #define MON0_RX 1
1028 #define MON1_RX 2
1029 #define MON0_TX 4
1030 #define MON1_TX 8
1032 #define ISDN_CTYPE_16_0 1
1033 #define ISDN_CTYPE_8_0 2
1034 #define ISDN_CTYPE_16_3 3
1035 #define ISDN_CTYPE_PNP 4
1036 #define ISDN_CTYPE_A1 5
1037 #define ISDN_CTYPE_ELSA 6
1038 #define ISDN_CTYPE_ELSA_PNP 7
1039 #define ISDN_CTYPE_TELESPCMCIA 8
1040 #define ISDN_CTYPE_IX1MICROR2 9
1041 #define ISDN_CTYPE_ELSA_PCMCIA 10
1042 #define ISDN_CTYPE_DIEHLDIVA 11
1043 #define ISDN_CTYPE_ASUSCOM 12
1044 #define ISDN_CTYPE_TELEINT 13
1045 #define ISDN_CTYPE_TELES3C 14
1046 #define ISDN_CTYPE_SEDLBAUER 15
1047 #define ISDN_CTYPE_SPORTSTER 16
1048 #define ISDN_CTYPE_MIC 17
1049 #define ISDN_CTYPE_ELSA_PCI 18
1050 #define ISDN_CTYPE_COMPAQ_ISA 19
1051 #define ISDN_CTYPE_NETJET_S 20
1052 #define ISDN_CTYPE_TELESPCI 21
1053 #define ISDN_CTYPE_SEDLBAUER_PCMCIA 22
1054 #define ISDN_CTYPE_AMD7930 23
1055 #define ISDN_CTYPE_NICCY 24
1056 #define ISDN_CTYPE_S0BOX 25
1057 #define ISDN_CTYPE_A1_PCMCIA 26
1058 #define ISDN_CTYPE_FRITZPCI 27
1059 #define ISDN_CTYPE_SEDLBAUER_FAX 28
1060 #define ISDN_CTYPE_ISURF 29
1061 #define ISDN_CTYPE_ACERP10 30
1062 #define ISDN_CTYPE_HSTSAPHIR 31
1063 #define ISDN_CTYPE_BKM_A4T 32
1064 #define ISDN_CTYPE_SCT_QUADRO 33
1065 #define ISDN_CTYPE_GAZEL 34
1066 #define ISDN_CTYPE_HFC_PCI 35
1067 #define ISDN_CTYPE_W6692 36
1068 #define ISDN_CTYPE_HFC_SX 37
1069 #define ISDN_CTYPE_NETJET_U 38
1070 #define ISDN_CTYPE_HFC_SP_PCMCIA 39
1071 #define ISDN_CTYPE_DYNAMIC 40
1072 #define ISDN_CTYPE_ENTERNOW 41
1073 #define ISDN_CTYPE_COUNT 41
1076 #ifdef CONFIG_HISAX_TESTEMU
1077 #define ISDN_CTYPE_TESTEMU 99
1078 #undef ISDN_CTYPE_COUNT
1079 #define ISDN_CTYPE_COUNT ISDN_CTYPE_TESTEMU
1080 #endif
1082 #ifdef CONFIG_HISAX_NETJET_U
1083 #ifndef HISAX_UINTERFACE
1084 #define HISAX_UINTERFACE 1
1085 #endif
1086 #else
1087 #endif
1089 #define TEI_PER_CARD 1
1091 /* L1 Debug */
1092 #define L1_DEB_WARN 0x01
1093 #define L1_DEB_INTSTAT 0x02
1094 #define L1_DEB_ISAC 0x04
1095 #define L1_DEB_ISAC_FIFO 0x08
1096 #define L1_DEB_HSCX 0x10
1097 #define L1_DEB_HSCX_FIFO 0x20
1098 #define L1_DEB_LAPD 0x40
1099 #define L1_DEB_IPAC 0x80
1100 #define L1_DEB_RECEIVE_FRAME 0x100
1101 #define L1_DEB_MONITOR 0x200
1102 #define DEB_DLOG_HEX 0x400
1103 #define DEB_DLOG_VERBOSE 0x800
1105 #define L2FRAME_DEBUG
1107 #ifdef L2FRAME_DEBUG
1108 extern void Logl2Frame(struct IsdnCardState *cs, struct sk_buff *skb, char *buf, int dir);
1109 #endif
1111 struct IsdnCard {
1112 int typ;
1113 int protocol; /* EDSS1, 1TR6 or NI1 */
1114 unsigned long para[4];
1115 struct IsdnCardState *cs;
1118 void init_bcstate(struct IsdnCardState *cs, int bc);
1120 void setstack_HiSax(struct PStack *st, struct IsdnCardState *cs);
1121 unsigned int random_ri(void);
1122 void HiSax_addlist(struct IsdnCardState *sp, struct PStack *st);
1123 void HiSax_rmlist(struct IsdnCardState *sp, struct PStack *st);
1125 void setstack_l1_B(struct PStack *st);
1127 void setstack_tei(struct PStack *st);
1128 void setstack_manager(struct PStack *st);
1130 void setstack_isdnl2(struct PStack *st, char *debug_id);
1131 void releasestack_isdnl2(struct PStack *st);
1132 void setstack_transl2(struct PStack *st);
1133 void releasestack_transl2(struct PStack *st);
1135 void setstack_l3dc(struct PStack *st, struct Channel *chanp);
1136 void setstack_l3bc(struct PStack *st, struct Channel *chanp);
1137 void releasestack_isdnl3(struct PStack *st);
1139 u8 *findie(u8 * p, int size, u8 ie, int wanted_set);
1140 int getcallref(u8 * p);
1141 int newcallref(void);
1143 int FsmNew(struct Fsm *fsm, struct FsmNode *fnlist, int fncount);
1144 void FsmFree(struct Fsm *fsm);
1145 int FsmEvent(struct FsmInst *fi, int event, void *arg);
1146 void FsmChangeState(struct FsmInst *fi, int newstate);
1147 void FsmInitTimer(struct FsmInst *fi, struct FsmTimer *ft);
1148 int FsmAddTimer(struct FsmTimer *ft, int millisec, int event,
1149 void *arg, int where);
1150 void FsmRestartTimer(struct FsmTimer *ft, int millisec, int event,
1151 void *arg, int where);
1152 void FsmDelTimer(struct FsmTimer *ft, int where);
1153 int jiftime(char *s, long mark);
1155 int HiSax_command(isdn_ctrl * ic);
1156 int HiSax_writebuf_skb(int id, int chan, int ack, struct sk_buff *skb);
1157 void HiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, ...);
1158 void VHiSax_putstatus(struct IsdnCardState *cs, char *head, const char *fmt, va_list args);
1159 void HiSax_reportcard(int cardnr, int sel);
1160 int QuickHex(char *txt, u8 * p, int cnt);
1161 void LogFrame(struct IsdnCardState *cs, u8 * p, int size);
1162 void dlogframe(struct IsdnCardState *cs, struct sk_buff *skb, int dir);
1163 void iecpy(u8 * dest, u8 * iestart, int ieoffset);
1164 #endif /* __KERNEL__ */
1166 #define HZDELAY(jiffs) {int tout = jiffs; while (tout--) udelay(1000000/HZ);}
1168 int ll_run(struct IsdnCardState *cs, int addfeatures);
1169 void ll_stop(struct IsdnCardState *cs);
1170 int CallcNew(void);
1171 void CallcFree(void);
1172 int CallcNewChan(struct IsdnCardState *cs);
1173 void CallcFreeChan(struct IsdnCardState *cs);
1174 int Isdnl1New(void);
1175 void Isdnl1Free(void);
1176 int Isdnl2New(void);
1177 void Isdnl2Free(void);
1178 int Isdnl3New(void);
1179 void Isdnl3Free(void);
1180 void init_tei(struct IsdnCardState *cs, int protocol);
1181 void release_tei(struct IsdnCardState *cs);
1182 char *HiSax_getrev(const char *revision);
1183 int TeiNew(void);
1184 void TeiFree(void);
1185 int certification_check(int output);
1187 static inline void
1188 L2L1(struct PStack *st, int pr, void *arg)
1190 st->l1.l2l1(st, pr, arg);
1193 static inline void
1194 L1L2(struct PStack *st, int pr, void *arg)
1196 st->l2.l1l2(st, pr, arg);
1199 static inline void
1200 L3L2(struct PStack *st, int pr, void *arg)
1202 st->l2.l3l2(st, pr, arg);
1205 static inline void
1206 L2L3(struct PStack *st, int pr, void *arg)
1208 st->l3.l2l3(st, pr, arg);
1211 static inline void
1212 L3L4(struct PStack *st, int pr, void *arg)
1214 st->lli.l3l4(st, pr, arg);
1217 static inline void
1218 L4L3(struct PStack *st, int pr, void *arg)
1220 st->l3.l4l3(st, pr, arg);
1224 #endif