1 /******************************************************************************
2 * ixj.h
3 *
4 * Device Driver for the Internet PhoneJACK and
5 * Internet LineJACK Telephony Cards.
6 *
7 * (c) Copyright 1999 Quicknet Technologies, Inc.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 *
14 * Author: Ed Okerson, <eokerson@quicknet.net>
15 *
16 * Contributors: Greg Herlein, <gherlein@quicknet.net>
17 * David W. Erhart, <derhart@quicknet.net>
18 * John Sellers, <jsellers@quicknet.net>
19 * Mike Preston, <mpreston@quicknet.net>
20 *
21 * More information about the hardware related to this driver can be found
22 * at our website: http://www.quicknet.net
23 *
24 * Fixes:
25 *
26 * IN NO EVENT SHALL QUICKNET TECHNOLOGIES, INC. BE LIABLE TO ANY PARTY FOR
27 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
28 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF QUICKNET
29 * TECHNOLOGIES, INC.HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 * QUICKNET TECHNOLOGIES, INC. SPECIFICALLY DISCLAIMS ANY WARRANTIES,
32 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
33 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
34 * ON AN "AS IS" BASIS, AND QUICKNET TECHNOLOGIES, INC. HAS NO OBLIGATION
35 * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
36 *
37 *****************************************************************************/
38 static char ixj_h_rcsid[] = "$Id: ixj.h,v 3.14 2000/03/30 22:06:48 eokerson Exp $";
39
40 #ifndef _I386_TYPES_H
41 #include <asm/types.h>
42 #endif
43
44 #include <linux/ixjuser.h>
45 #include <linux/phonedev.h>
46
47 typedef __u16 WORD;
48 typedef __u32 DWORD;
49 typedef __u8 BYTE;
50 typedef __u8 BOOL;
51
52 #define IXJMAX 16
53
54 #define TRUE 1
55 #define FALSE 0
56
57 #ifndef min
58 #define min(a,b) (((a)<(b))?(a):(b))
59 #endif
60 #ifndef max
61 #define max(a,b) (((a)>(b))?(a):(b))
62 #endif
63
64 /******************************************************************************
65 *
66 * This structure when unioned with the structures below makes simple byte
67 * access to the registers easier.
68 *
69 ******************************************************************************/
70 typedef struct {
71 unsigned char low;
72 unsigned char high;
73 } BYTES;
74
75 typedef union {
76 BYTES bytes;
77 short word;
78 } IXJ_WORD;
79
80 typedef struct{
81 unsigned int b0:1;
82 unsigned int b1:1;
83 unsigned int b2:1;
84 unsigned int b3:1;
85 unsigned int b4:1;
86 unsigned int b5:1;
87 unsigned int b6:1;
88 unsigned int b7:1;
89 } IXJ_CBITS;
90
91 typedef union{
92 IXJ_CBITS cbits;
93 char cbyte;
94 } IXJ_CBYTE;
95
96 int ixj_WriteDSPCommand(unsigned short, int board);
97
98 /******************************************************************************
99 *
100 * This structure represents the Hardware Control Register of the CT8020/8021
101 * The CT8020 is used in the Internet PhoneJACK, and the 8021 in the
102 * Internet LineJACK
103 *
104 ******************************************************************************/
105 typedef struct {
106 unsigned int rxrdy:1;
107 unsigned int txrdy:1;
108 unsigned int status:1;
109 unsigned int auxstatus:1;
110 unsigned int rxdma:1;
111 unsigned int txdma:1;
112 unsigned int rxburst:1;
113 unsigned int txburst:1;
114 unsigned int dmadir:1;
115 unsigned int cont:1;
116 unsigned int irqn:1;
117 unsigned int t:5;
118 } HCRBIT;
119
120 typedef union {
121 HCRBIT bits;
122 BYTES bytes;
123 } HCR;
124
125 /******************************************************************************
126 *
127 * This structure represents the Hardware Status Register of the CT8020/8021
128 * The CT8020 is used in the Internet PhoneJACK, and the 8021 in the
129 * Internet LineJACK
130 *
131 ******************************************************************************/
132 typedef struct {
133 unsigned int controlrdy:1;
134 unsigned int auxctlrdy:1;
135 unsigned int statusrdy:1;
136 unsigned int auxstatusrdy:1;
137 unsigned int rxrdy:1;
138 unsigned int txrdy:1;
139 unsigned int restart:1;
140 unsigned int irqn:1;
141 unsigned int rxdma:1;
142 unsigned int txdma:1;
143 unsigned int cohostshutdown:1;
144 unsigned int t:5;
145 } HSRBIT;
146
147 typedef union {
148 HSRBIT bits;
149 BYTES bytes;
150 } HSR;
151
152 /******************************************************************************
153 *
154 * This structure represents the General Purpose IO Register of the CT8020/8021
155 * The CT8020 is used in the Internet PhoneJACK, and the 8021 in the
156 * Internet LineJACK
157 *
158 ******************************************************************************/
159 typedef struct {
160 unsigned int x:1;
161 unsigned int gpio1:1;
162 unsigned int gpio2:1;
163 unsigned int gpio3:1;
164 unsigned int gpio4:1;
165 unsigned int gpio5:1;
166 unsigned int gpio6:1;
167 unsigned int gpio7:1;
168 unsigned int xread:1;
169 unsigned int gpio1read:1;
170 unsigned int gpio2read:1;
171 unsigned int gpio3read:1;
172 unsigned int gpio4read:1;
173 unsigned int gpio5read:1;
174 unsigned int gpio6read:1;
175 unsigned int gpio7read:1;
176 } GPIOBIT;
177
178 typedef union {
179 GPIOBIT bits;
180 BYTES bytes;
181 unsigned short word;
182 } GPIO;
183
184 /******************************************************************************
185 *
186 * This structure represents the Line Monitor status response
187 *
188 ******************************************************************************/
189 typedef struct {
190 unsigned int digit:4;
191 unsigned int cpf_valid:1;
192 unsigned int dtmf_valid:1;
193 unsigned int peak:1;
194 unsigned int z:1;
195 unsigned int f0:1;
196 unsigned int f1:1;
197 unsigned int f2:1;
198 unsigned int f3:1;
199 unsigned int frame:4;
200 } LMON;
201
202 typedef union {
203 LMON bits;
204 BYTES bytes;
205 } DTMF;
206
207 typedef struct {
208 unsigned int z:7;
209 unsigned int dtmf_en:1;
210 unsigned int y:4;
211 unsigned int F3:1;
212 unsigned int F2:1;
213 unsigned int F1:1;
214 unsigned int F0:1;
215 } CP;
216
217 typedef union {
218 CP bits;
219 BYTES bytes;
220 } CPTF;
221
222 /******************************************************************************
223 *
224 * This structure represents the Status Control Register on the Internet
225 * LineJACK
226 *
227 ******************************************************************************/
228 typedef struct {
229 unsigned int c0:1;
230 unsigned int c1:1;
231 unsigned int stereo:1;
232 unsigned int daafsyncen:1;
233 unsigned int led1:1;
234 unsigned int led2:1;
235 unsigned int led3:1;
236 unsigned int led4:1;
237 } PSCRWI; // Internet LineJACK and Internet PhoneJACK Lite
238
239 typedef struct {
240 unsigned int eidp:1;
241 unsigned int eisd:1;
242 unsigned int x:6;
243 } PSCRWP; // Internet PhoneJACK PCI
244
245 typedef union {
246 PSCRWI bits;
247 PSCRWP pcib;
248 char byte;
249 } PLD_SCRW;
250
251 typedef struct {
252 unsigned int c0:1;
253 unsigned int c1:1;
254 unsigned int x:1;
255 unsigned int d0ee:1;
256 unsigned int mixerbusy:1;
257 unsigned int sci:1;
258 unsigned int dspflag:1;
259 unsigned int daaflag:1;
260 } PSCRRI;
261
262 typedef struct {
263 unsigned int eidp:1;
264 unsigned int eisd:1;
265 unsigned int x:4;
266 unsigned int dspflag:1;
267 unsigned int det:1;
268 } PSCRRP;
269
270 typedef union {
271 PSCRRI bits;
272 PSCRRP pcib;
273 char byte;
274 } PLD_SCRR;
275
276 /******************************************************************************
277 *
278 * These structures represents the SLIC Control Register on the
279 * Internet LineJACK
280 *
281 ******************************************************************************/
282 typedef struct {
283 unsigned int c1:1;
284 unsigned int c2:1;
285 unsigned int c3:1;
286 unsigned int b2en:1;
287 unsigned int spken:1;
288 unsigned int rly1:1;
289 unsigned int rly2:1;
290 unsigned int rly3:1;
291 } PSLICWRITE;
292
293 typedef struct {
294 unsigned int state:3;
295 unsigned int b2en:1;
296 unsigned int spken:1;
297 unsigned int c3:1;
298 unsigned int potspstn:1;
299 unsigned int det:1;
300 } PSLICREAD;
301
302 typedef struct {
303 unsigned int c1:1;
304 unsigned int c2:1;
305 unsigned int c3:1;
306 unsigned int b2en:1;
307 unsigned int e1:1;
308 unsigned int mic:1;
309 unsigned int spk:1;
310 unsigned int x:1;
311 } PSLICPCI;
312
313 typedef union {
314 PSLICPCI pcib;
315 PSLICWRITE bits;
316 PSLICREAD slic;
317 char byte;
318 } PLD_SLICW;
319
320 typedef union {
321 PSLICPCI pcib;
322 PSLICREAD bits;
323 char byte;
324 } PLD_SLICR;
325
326 /******************************************************************************
327 *
328 * These structures represents the Clock Control Register on the
329 * Internet LineJACK
330 *
331 ******************************************************************************/
332 typedef struct {
333 unsigned int clk0:1;
334 unsigned int clk1:1;
335 unsigned int clk2:1;
336 unsigned int x0:1;
337 unsigned int slic_e1:1;
338 unsigned int x1:1;
339 unsigned int x2:1;
340 unsigned int x3:1;
341 } PCLOCK;
342
343 typedef union {
344 PCLOCK bits;
345 char byte;
346 } PLD_CLOCK;
347
348 /******************************************************************************
349 *
350 * These structures deal with the mixer on the Internet LineJACK
351 *
352 ******************************************************************************/
353
354 typedef struct {
355 unsigned short vol[10];
356 unsigned int recsrc;
357 unsigned int modcnt;
358 unsigned short micpreamp;
359 } MIX;
360
361 /******************************************************************************
362 *
363 * These structures deal with the control logic on the Internet PhoneCARD
364 *
365 ******************************************************************************/
366 typedef struct {
367 unsigned int x0:4; // unused bits
368
369 unsigned int ed:1; // Event Detect
370
371 unsigned int drf:1; // Smart Cable Removal Flag 1=no cable
372
373 unsigned int dspf:1; // DSP Flag 1=DSP Ready
374
375 unsigned int crr:1; // Control Register Ready
376
377 } COMMAND_REG1;
378
379 typedef union {
380 COMMAND_REG1 bits;
381 unsigned char byte;
382 } PCMCIA_CR1;
383
384 typedef struct {
385 unsigned int x0:4; // unused bits
386
387 unsigned int rstc:1; // Smart Cable Reset
388
389 unsigned int pwr:1; // Smart Cable Power
390
391 unsigned int x1:2; // unused bits
392
393 } COMMAND_REG2;
394
395 typedef union {
396 COMMAND_REG2 bits;
397 unsigned char byte;
398 } PCMCIA_CR2;
399
400 typedef struct {
401 unsigned int addr:5; // R/W Smart Cable Register Address
402
403 unsigned int rw:1; // Read / Write flag
404
405 unsigned int dev:2; // 2 bit Smart Cable Device Address
406
407 } CONTROL_REG;
408
409 typedef union {
410 CONTROL_REG bits;
411 unsigned char byte;
412 } PCMCIA_SCCR;
413
414 typedef struct {
415 unsigned int hsw:1;
416 unsigned int det:1;
417 unsigned int led2:1;
418 unsigned int led1:1;
419 unsigned int ring1:1;
420 unsigned int ring0:1;
421 unsigned int x:1;
422 unsigned int powerdown:1;
423 } PCMCIA_SLIC_REG;
424
425 typedef union {
426 PCMCIA_SLIC_REG bits;
427 unsigned char byte;
428 } PCMCIA_SLIC;
429
430 typedef struct {
431 unsigned int cpd:1; // Chip Power Down
432
433 unsigned int mpd:1; // MIC Bias Power Down
434
435 unsigned int hpd:1; // Handset Drive Power Down
436
437 unsigned int lpd:1; // Line Drive Power Down
438
439 unsigned int spd:1; // Speaker Drive Power Down
440
441 unsigned int x:2; // unused bits
442
443 unsigned int sr:1; // Software Reset
444
445 } Si3CONTROL1;
446
447 typedef union {
448 Si3CONTROL1 bits;
449 unsigned char byte;
450 } Si3C1;
451
452 typedef struct {
453 unsigned int al:1; // Analog Loopback DAC analog -> ADC analog
454
455 unsigned int dl2:1; // Digital Loopback DAC -> ADC one bit
456
457 unsigned int dl1:1; // Digital Loopback ADC -> DAC one bit
458
459 unsigned int pll:1; // 1 = div 10, 0 = div 5
460
461 unsigned int hpd:1; // HPF disable
462
463 unsigned int x:3; // unused bits
464
465 } Si3CONTROL2;
466
467 typedef union {
468 Si3CONTROL2 bits;
469 unsigned char byte;
470 } Si3C2;
471
472 typedef struct {
473 unsigned int iir:1; // 1 enables IIR, 0 enables FIR
474
475 unsigned int him:1; // Handset Input Mute
476
477 unsigned int mcm:1; // MIC In Mute
478
479 unsigned int mcg:2; // MIC In Gain
480
481 unsigned int lim:1; // Line In Mute
482
483 unsigned int lig:2; // Line In Gain
484
485 } Si3RXGAIN;
486
487 typedef union {
488 Si3RXGAIN bits;
489 unsigned char byte;
490 } Si3RXG;
491
492 typedef struct {
493 unsigned int hom:1; // Handset Out Mute
494
495 unsigned int lom:1; // Line Out Mute
496
497 unsigned int rxg:5; // RX PGA Gain
498
499 unsigned int x:1; // unused bit
500
501 } Si3ADCVOLUME;
502
503 typedef union {
504 Si3ADCVOLUME bits;
505 unsigned char byte;
506 } Si3ADC;
507
508 typedef struct {
509 unsigned int srm:1; // Speaker Right Mute
510
511 unsigned int slm:1; // Speaker Left Mute
512
513 unsigned int txg:5; // TX PGA Gain
514
515 unsigned int x:1; // unused bit
516
517 } Si3DACVOLUME;
518
519 typedef union {
520 Si3DACVOLUME bits;
521 unsigned char byte;
522 } Si3DAC;
523
524 typedef struct {
525 unsigned int x:5; // unused bit
526
527 unsigned int losc:1; // Line Out Short Circuit
528
529 unsigned int srsc:1; // Speaker Right Short Circuit
530
531 unsigned int slsc:1; // Speaker Left Short Circuit
532
533 } Si3STATUSREPORT;
534
535 typedef union {
536 Si3STATUSREPORT bits;
537 unsigned char byte;
538 } Si3STAT;
539
540 typedef struct {
541 unsigned int sot:2; // Speaker Out Attenuation
542
543 unsigned int lot:2; // Line Out Attenuation
544
545 unsigned int x:4; // unused bits
546
547 } Si3ANALOGATTN;
548
549 typedef union {
550 Si3ANALOGATTN bits;
551 unsigned char byte;
552 } Si3AATT;
553
554 /******************************************************************************
555 *
556 * These structures deal with the DAA on the Internet LineJACK
557 *
558 ******************************************************************************/
559
560 typedef struct _DAA_REGS {
561 //-----------------------------------------------
562 // SOP Registers
563 //
564 BYTE bySOP;
565
566 union _SOP_REGS {
567 struct _SOP {
568 union // SOP - CR0 Register
569 {
570 BYTE reg;
571 struct _CR0_BITREGS {
572 BYTE CLK_EXT:1; // cr0[0:0]
573
574 BYTE RIP:1; // cr0[1:1]
575
576 BYTE AR:1; // cr0[2:2]
577
578 BYTE AX:1; // cr0[3:3]
579
580 BYTE FRR:1; // cr0[4:4]
581
582 BYTE FRX:1; // cr0[5:5]
583
584 BYTE IM:1; // cr0[6:6]
585
586 BYTE TH:1; // cr0[7:7]
587
588 } bitreg;
589 } cr0;
590
591 union // SOP - CR1 Register
592 {
593 BYTE reg;
594 struct _CR1_REGS {
595 BYTE RM:1; // cr1[0:0]
596
597 BYTE RMR:1; // cr1[1:1]
598
599 BYTE No_auto:1; // cr1[2:2]
600
601 BYTE Pulse:1; // cr1[3:3]
602
603 BYTE P_Tone1:1; // cr1[4:4]
604
605 BYTE P_Tone2:1; // cr1[5:5]
606
607 BYTE E_Tone1:1; // cr1[6:6]
608
609 BYTE E_Tone2:1; // cr1[7:7]
610
611 } bitreg;
612 } cr1;
613
614 union // SOP - CR2 Register
615 {
616 BYTE reg;
617 struct _CR2_REGS {
618 BYTE Call_II:1; // CR2[0:0]
619
620 BYTE Call_I:1; // CR2[1:1]
621
622 BYTE Call_en:1; // CR2[2:2]
623
624 BYTE Call_pon:1; // CR2[3:3]
625
626 BYTE IDR:1; // CR2[4:4]
627
628 BYTE COT_R:3; // CR2[5:7]
629
630 } bitreg;
631 } cr2;
632
633 union // SOP - CR3 Register
634 {
635 BYTE reg;
636 struct _CR3_REGS {
637 BYTE DHP_X:1; // CR3[0:0]
638
639 BYTE DHP_R:1; // CR3[1:1]
640
641 BYTE Cal_pctl:1; // CR3[2:2]
642
643 BYTE SEL:1; // CR3[3:3]
644
645 BYTE TestLoops:4; // CR3[4:7]
646
647 } bitreg;
648 } cr3;
649
650 union // SOP - CR4 Register
651 {
652 BYTE reg;
653 struct _CR4_REGS {
654 BYTE Fsc_en:1; // CR4[0:0]
655
656 BYTE Int_en:1; // CR4[1:1]
657
658 BYTE AGX:2; // CR4[2:3]
659
660 BYTE AGR_R:2; // CR4[4:5]
661
662 BYTE AGR_Z:2; // CR4[6:7]
663
664 } bitreg;
665 } cr4;
666
667 union // SOP - CR5 Register
668 {
669 BYTE reg;
670 struct _CR5_REGS {
671 BYTE V_0:1; // CR5[0:0]
672
673 BYTE V_1:1; // CR5[1:1]
674
675 BYTE V_2:1; // CR5[2:2]
676
677 BYTE V_3:1; // CR5[3:3]
678
679 BYTE V_4:1; // CR5[4:4]
680
681 BYTE V_5:1; // CR5[5:5]
682
683 BYTE V_6:1; // CR5[6:6]
684
685 BYTE V_7:1; // CR5[7:7]
686
687 } bitreg;
688 } cr5;
689
690 union // SOP - CR6 Register
691 {
692 BYTE reg;
693 struct _CR6_REGS {
694 BYTE reserved:8; // CR6[0:7]
695
696 } bitreg;
697 } cr6;
698
699 union // SOP - CR7 Register
700 {
701 BYTE reg;
702 struct _CR7_REGS {
703 BYTE reserved:8; // CR7[0:7]
704
705 } bitreg;
706 } cr7;
707 } SOP;
708
709 BYTE ByteRegs[sizeof(struct _SOP)];
710
711 } SOP_REGS;
712
713 // DAA_REGS.SOP_REGS.SOP.CR5.reg
714 // DAA_REGS.SOP_REGS.SOP.CR5.bitreg
715 // DAA_REGS.SOP_REGS.SOP.CR5.bitreg.V_2
716 // DAA_REGS.SOP_REGS.ByteRegs[5]
717
718 //-----------------------------------------------
719 // XOP Registers
720 //
721 BYTE byXOP;
722
723 union _XOP_REGS {
724 struct _XOP {
725 union // XOP - XR0 Register - Read values
726 {
727 BYTE reg;
728 struct _XR0_BITREGS {
729 BYTE SI_0:1; // XR0[0:0] - Read
730
731 BYTE SI_1:1; // XR0[1:1] - Read
732
733 BYTE VDD_OK:1; // XR0[2:2] - Read
734
735 BYTE Caller_ID:1; // XR0[3:3] - Read
736
737 BYTE RING:1; // XR0[4:4] - Read
738
739 BYTE Cadence:1; // XR0[5:5] - Read
740
741 BYTE Wake_up:1; // XR0[6:6] - Read
742
743 BYTE unused:1; // XR0[7:7] - Read
744
745 } bitreg;
746 } xr0;
747
748 union // XOP - XR1 Register
749 {
750 BYTE reg;
751 struct _XR1_BITREGS {
752 BYTE M_SI_0:1; // XR1[0:0]
753
754 BYTE M_SI_1:1; // XR1[1:1]
755
756 BYTE M_VDD_OK:1; // XR1[2:2]
757
758 BYTE M_Caller_ID:1; // XR1[3:3]
759
760 BYTE M_RING:1; // XR1[4:4]
761
762 BYTE M_Cadence:1; // XR1[5:5]
763
764 BYTE M_Wake_up:1; // XR1[6:6]
765
766 BYTE unused:1; // XR1[7:7]
767
768 } bitreg;
769 } xr1;
770
771 union // XOP - XR2 Register
772 {
773 BYTE reg;
774 struct _XR2_BITREGS {
775 BYTE CTO0:1; // XR2[0:0]
776
777 BYTE CTO1:1; // XR2[1:1]
778
779 BYTE CTO2:1; // XR2[2:2]
780
781 BYTE CTO3:1; // XR2[3:3]
782
783 BYTE CTO4:1; // XR2[4:4]
784
785 BYTE CTO5:1; // XR2[5:5]
786
787 BYTE CTO6:1; // XR2[6:6]
788
789 BYTE CTO7:1; // XR2[7:7]
790
791 } bitreg;
792 } xr2;
793
794 union // XOP - XR3 Register
795 {
796 BYTE reg;
797 struct _XR3_BITREGS {
798 BYTE DCR0:1; // XR3[0:0]
799
800 BYTE DCR1:1; // XR3[1:1]
801
802 BYTE DCI:1; // XR3[2:2]
803
804 BYTE DCU0:1; // XR3[3:3]
805
806 BYTE DCU1:1; // XR3[4:4]
807
808 BYTE B_off:1; // XR3[5:5]
809
810 BYTE AGB0:1; // XR3[6:6]
811
812 BYTE AGB1:1; // XR3[7:7]
813
814 } bitreg;
815 } xr3;
816
817 union // XOP - XR4 Register
818 {
819 BYTE reg;
820 struct _XR4_BITREGS {
821 BYTE C_0:1; // XR4[0:0]
822
823 BYTE C_1:1; // XR4[1:1]
824
825 BYTE C_2:1; // XR4[2:2]
826
827 BYTE C_3:1; // XR4[3:3]
828
829 BYTE C_4:1; // XR4[4:4]
830
831 BYTE C_5:1; // XR4[5:5]
832
833 BYTE C_6:1; // XR4[6:6]
834
835 BYTE C_7:1; // XR4[7:7]
836
837 } bitreg;
838 } xr4;
839
840 union // XOP - XR5 Register
841 {
842 BYTE reg;
843 struct _XR5_BITREGS {
844 BYTE T_0:1; // XR5[0:0]
845
846 BYTE T_1:1; // XR5[1:1]
847
848 BYTE T_2:1; // XR5[2:2]
849
850 BYTE T_3:1; // XR5[3:3]
851
852 BYTE T_4:1; // XR5[4:4]
853
854 BYTE T_5:1; // XR5[5:5]
855
856 BYTE T_6:1; // XR5[6:6]
857
858 BYTE T_7:1; // XR5[7:7]
859
860 } bitreg;
861 } xr5;
862
863 union // XOP - XR6 Register - Read Values
864 {
865 BYTE reg;
866 struct _XR6_BITREGS {
867 BYTE CPS0:1; // XR6[0:0]
868
869 BYTE CPS1:1; // XR6[1:1]
870
871 BYTE unused1:2; // XR6[2:3]
872
873 BYTE CLK_OFF:1; // XR6[4:4]
874
875 BYTE unused2:3; // XR6[5:7]
876
877 } bitreg;
878 } xr6;
879
880 union // XOP - XR7 Register
881 {
882 BYTE reg;
883 struct _XR7_BITREGS {
884 BYTE unused1:1; // XR7[0:0]
885
886 BYTE Vdd0:1; // XR7[1:1]
887
888 BYTE Vdd1:1; // XR7[2:2]
889
890 BYTE unused2:5; // XR7[3:7]
891
892 } bitreg;
893 } xr7;
894 } XOP;
895
896 BYTE ByteRegs[sizeof(struct _XOP)];
897
898 } XOP_REGS;
899
900 // DAA_REGS.XOP_REGS.XOP.XR7.reg
901 // DAA_REGS.XOP_REGS.XOP.XR7.bitreg
902 // DAA_REGS.XOP_REGS.XOP.XR7.bitreg.Vdd0
903 // DAA_REGS.XOP_REGS.ByteRegs[7]
904
905 //-----------------------------------------------
906 // COP Registers
907 //
908 BYTE byCOP;
909
910 union _COP_REGS {
911 struct _COP {
912 BYTE THFilterCoeff_1[8]; // COP - TH Filter Coefficients, CODE=0, Part 1
913
914 BYTE THFilterCoeff_2[8]; // COP - TH Filter Coefficients, CODE=1, Part 2
915
916 BYTE THFilterCoeff_3[8]; // COP - TH Filter Coefficients, CODE=2, Part 3
917
918 BYTE RingerImpendance_1[8]; // COP - Ringer Impendance Coefficients, CODE=3, Part 1
919
920 BYTE IMFilterCoeff_1[8]; // COP - IM Filter Coefficients, CODE=4, Part 1
921
922 BYTE IMFilterCoeff_2[8]; // COP - IM Filter Coefficients, CODE=5, Part 2
923
924 BYTE RingerImpendance_2[8]; // COP - Ringer Impendance Coefficients, CODE=6, Part 2
925
926 BYTE FRRFilterCoeff[8]; // COP - FRR Filter Coefficients, CODE=7
927
928 BYTE FRXFilterCoeff[8]; // COP - FRX Filter Coefficients, CODE=8
929
930 BYTE ARFilterCoeff[4]; // COP - AR Filter Coefficients, CODE=9
931
932 BYTE AXFilterCoeff[4]; // COP - AX Filter Coefficients, CODE=10
933
934 BYTE Tone1Coeff[4]; // COP - Tone1 Coefficients, CODE=11
935
936 BYTE Tone2Coeff[4]; // COP - Tone2 Coefficients, CODE=12
937
938 BYTE LevelmeteringRinging[4]; // COP - Levelmetering Ringing, CODE=13
939
940 BYTE CallerID1stTone[8]; // COP - Caller ID 1st Tone, CODE=14
941
942 BYTE CallerID2ndTone[8]; // COP - Caller ID 2nd Tone, CODE=15
943
944 } COP;
945
946 BYTE ByteRegs[sizeof(struct _COP)];
947
948 } COP_REGS;
949
950 // DAA_REGS.COP_REGS.COP.XR7.Tone1Coeff[3]
951 // DAA_REGS.COP_REGS.COP.XR7.bitreg
952 // DAA_REGS.COP_REGS.COP.XR7.bitreg.Vdd0
953 // DAA_REGS.COP_REGS.ByteRegs[57]
954
955 //-----------------------------------------------
956 // CAO Registers
957 //
958 BYTE byCAO;
959
960 union _CAO_REGS {
961 struct _CAO {
962 BYTE CallerID[512]; // CAO - Caller ID Bytes
963
964 } CAO;
965
966 BYTE ByteRegs[sizeof(struct _CAO)];
967 } CAO_REGS;
968
969 union // XOP - XR0 Register - Write values
970 {
971 BYTE reg;
972 struct _XR0_BITREGSW {
973 BYTE SO_0:1; // XR1[0:0] - Write
974
975 BYTE SO_1:1; // XR1[1:1] - Write
976
977 BYTE SO_2:1; // XR1[2:2] - Write
978
979 BYTE unused:5; // XR1[3:7] - Write
980
981 } bitreg;
982 } XOP_xr0_W;
983
984 union // XOP - XR6 Register - Write values
985 {
986 BYTE reg;
987 struct _XR6_BITREGSW {
988 BYTE unused1:4; // XR6[0:3]
989
990 BYTE CLK_OFF:1; // XR6[4:4]
991
992 BYTE unused2:3; // XR6[5:7]
993
994 } bitreg;
995 } XOP_xr6_W;
996
997 } DAA_REGS;
998
999 #define ALISDAA_ID_BYTE 0x81
1000 #define ALISDAA_CALLERID_SIZE 512
1001
1002 //------------------------------
1003 //
1004 // Misc definitions
1005 //
1006
1007 // Power Up Operation
1008 #define SOP_PU_SLEEP 0
1009 #define SOP_PU_RINGING 1
1010 #define SOP_PU_CONVERSATION 2
1011 #define SOP_PU_PULSEDIALING 3
1012
1013 #define ALISDAA_CALLERID_SIZE 512
1014
1015 #define PLAYBACK_MODE_COMPRESSED 0 // Selects: Compressed modes, TrueSpeech 8.5-4.1, G.723.1, G.722, G.728, G.729
1016 #define PLAYBACK_MODE_TRUESPEECH_V40 0 // Selects: TrueSpeech 8.5, 6.3, 5.3, 4.8 or 4.1 Kbps
1017 #define PLAYBACK_MODE_TRUESPEECH 8 // Selects: TrueSpeech 8.5, 6.3, 5.3, 4.8 or 4.1 Kbps Version 5.1
1018 #define PLAYBACK_MODE_ULAW 2 // Selects: 64 Kbit/sec MuA-law PCM
1019 #define PLAYBACK_MODE_ALAW 10 // Selects: 64 Kbit/sec A-law PCM
1020 #define PLAYBACK_MODE_16LINEAR 6 // Selects: 128 Kbit/sec 16-bit linear
1021 #define PLAYBACK_MODE_8LINEAR 4 // Selects: 64 Kbit/sec 8-bit signed linear
1022 #define PLAYBACK_MODE_8LINEAR_WSS 5 // Selects: 64 Kbit/sec WSS 8-bit unsigned linear
1023
1024 #define RECORD_MODE_COMPRESSED 0 // Selects: Compressed modes, TrueSpeech 8.5-4.1, G.723.1, G.722, G.728, G.729
1025 #define RECORD_MODE_TRUESPEECH 0 // Selects: TrueSpeech 8.5, 6.3, 5.3, 4.8 or 4.1 Kbps
1026 #define RECORD_MODE_ULAW 4 // Selects: 64 Kbit/sec Mu-law PCM
1027 #define RECORD_MODE_ALAW 12 // Selects: 64 Kbit/sec A-law PCM
1028 #define RECORD_MODE_16LINEAR 5 // Selects: 128 Kbit/sec 16-bit linear
1029 #define RECORD_MODE_8LINEAR 6 // Selects: 64 Kbit/sec 8-bit signed linear
1030 #define RECORD_MODE_8LINEAR_WSS 7 // Selects: 64 Kbit/sec WSS 8-bit unsigned linear
1031
1032 enum SLIC_STATES {
1033 PLD_SLIC_STATE_OC = 0,
1034 PLD_SLIC_STATE_RINGING,
1035 PLD_SLIC_STATE_ACTIVE,
1036 PLD_SLIC_STATE_OHT,
1037 PLD_SLIC_STATE_TIPOPEN,
1038 PLD_SLIC_STATE_STANDBY,
1039 PLD_SLIC_STATE_APR,
1040 PLD_SLIC_STATE_OHTPR
1041 };
1042
1043 enum SCI_CONTROL {
1044 SCI_End = 0,
1045 SCI_Enable_DAA,
1046 SCI_Enable_Mixer,
1047 SCI_Enable_EEPROM
1048 };
1049
1050 enum Mode {
1051 T63, T53, T48, T40
1052 };
1053 enum Dir {
1054 V3_TO_V4, V4_TO_V3, V4_TO_V5, V5_TO_V4
1055 };
1056
1057 typedef struct Proc_Info_Tag {
1058 enum Mode convert_mode;
1059 enum Dir convert_dir;
1060 int Prev_Frame_Type;
1061 int Current_Frame_Type;
1062 } Proc_Info_Type;
1063
1064 enum PREVAL {
1065 NORMAL = 0,
1066 NOPOST,
1067 POSTONLY,
1068 PREERROR
1069 };
1070
1071 enum IXJ_EXTENSIONS {
1072 G729LOADER = 0,
1073 TS85LOADER,
1074 PRE_READ,
1075 POST_READ,
1076 PRE_WRITE,
1077 POST_WRITE,
1078 PRE_IOCTL,
1079 POST_IOCTL
1080 };
1081
1082 typedef struct {
1083 char enable;
1084 char en_filter;
1085 unsigned int filter;
1086 unsigned int state; // State 0 when cadence has not started.
1087
1088 unsigned int on1; // State 1
1089
1090 unsigned long on1min; // State 1 - 10% + jiffies
1091 unsigned long on1dot; // State 1 + jiffies
1092
1093 unsigned long on1max; // State 1 + 10% + jiffies
1094
1095 unsigned int off1; // State 2
1096
1097 unsigned long off1min;
1098 unsigned long off1max;
1099 unsigned int on2; // State 3
1100
1101 unsigned long on2min;
1102 unsigned long on2dot;
1103 unsigned long on2max;
1104 unsigned int off2; // State 4
1105
1106 unsigned long off2min;
1107 unsigned long off2max;
1108 unsigned int on3; // State 5
1109
1110 unsigned long on3min;
1111 unsigned long on3dot;
1112 unsigned long on3max;
1113 unsigned int off3; // State 6
1114
1115 unsigned long off3min;
1116 unsigned long off3max;
1117 } IXJ_CADENCE_F;
1118
1119 typedef struct {
1120 unsigned int busytone:1;
1121 unsigned int dialtone:1;
1122 unsigned int ringback:1;
1123 unsigned int ringing:1;
1124 unsigned int playing:1;
1125 unsigned int recording:1;
1126 unsigned int cringing:1;
1127 unsigned int play_first_frame:1;
1128 unsigned int pstn_present:1;
1129 unsigned int pstn_ringing:1;
1130 unsigned int pots_correct:1;
1131 unsigned int pots_pstn:1;
1132 unsigned int g729_loaded:1;
1133 unsigned int ts85_loaded:1;
1134 unsigned int dtmf_oob:1; // DTMF Out-Of-Band
1135
1136 unsigned int pcmciascp:1; // Smart Cable Present
1137
1138 unsigned int pcmciasct:2; // Smart Cable Type
1139
1140 unsigned int pcmciastate:3; // Smart Cable Init State
1141
1142 unsigned int inwrite:1; // Currently writing
1143
1144 unsigned int inread:1; // Currently reading
1145
1146 unsigned int incheck:1; // Currently checking the smart cable
1147
1148 unsigned int cidplay:1; // Currently playing Caller ID
1149
1150 unsigned int cidring:1; // This is the ring for Caller ID
1151
1152 unsigned int cidsent:1; // Caller ID has been sent
1153
1154 unsigned int cidcw_ack:1; // Caller ID CW ACK (from CPE)
1155
1156 unsigned int x:6; // unsed bits
1157
1158 } IXJ_FLAGS;
1159
1160 /******************************************************************************
1161 *
1162 * This structure represents the Internet PhoneJACK and Internet LineJACK
1163 *
1164 ******************************************************************************/
1165
1166 typedef struct {
1167 struct phone_device p;
1168 unsigned int board;
1169 unsigned int DSPbase;
1170 unsigned int XILINXbase;
1171 unsigned int serial;
1172 struct phone_capability caplist[30];
1173 unsigned int caps;
1174 unsigned int country;
1175 struct pci_dev *dev;
1176 unsigned int cardtype;
1177 unsigned int rec_codec;
1178 char rec_mode;
1179 unsigned int play_codec;
1180 unsigned int cid_play_codec;
1181 char play_mode;
1182 IXJ_FLAGS flags;
1183 unsigned int rec_frame_size;
1184 unsigned int play_frame_size;
1185 unsigned int cid_base_frame_size;
1186 unsigned long cidcw_wait;
1187 int aec_level;
1188 int readers, writers;
1189 wait_queue_head_t poll_q;
1190 wait_queue_head_t read_q;
1191 char *read_buffer, *read_buffer_end;
1192 char *read_convert_buffer;
1193 unsigned int read_buffer_size;
1194 unsigned int read_buffer_ready;
1195 wait_queue_head_t write_q;
1196 char *write_buffer, *write_buffer_end;
1197 char *write_convert_buffer;
1198 unsigned int write_buffer_size;
1199 unsigned int write_buffers_empty;
1200 unsigned long drybuffer;
1201 char *write_buffer_rp, *write_buffer_wp;
1202 char dtmfbuffer[80];
1203 char dtmf_current;
1204 int dtmf_wp, dtmf_rp, dtmf_state, dtmf_proc;
1205 int tone_off_time, tone_on_time;
1206 struct fasync_struct *async_queue;
1207 unsigned long tone_start_jif;
1208 char tone_index;
1209 char tone_state;
1210 char maxrings;
1211 IXJ_CADENCE *cadence_t;
1212 int tone_cadence_state;
1213 IXJ_CADENCE_F cadence_f[4];
1214 DTMF dtmf;
1215 CPTF cptf;
1216 BYTES dsp;
1217 BYTES ver;
1218 BYTES scr;
1219 BYTES ssr;
1220 BYTES baseframe;
1221 HSR hsr;
1222 GPIO gpio;
1223 PLD_SCRR pld_scrr;
1224 PLD_SCRW pld_scrw;
1225 PLD_SLICW pld_slicw;
1226 PLD_SLICR pld_slicr;
1227 PLD_CLOCK pld_clock;
1228 PCMCIA_CR1 pccr1;
1229 PCMCIA_CR2 pccr2;
1230 PCMCIA_SCCR psccr;
1231 PCMCIA_SLIC pslic;
1232 char pscdd;
1233 Si3C1 sic1;
1234 Si3C2 sic2;
1235 Si3RXG sirxg;
1236 Si3ADC siadc;
1237 Si3DAC sidac;
1238 Si3STAT sistat;
1239 Si3AATT siaatt;
1240 MIX mix;
1241 unsigned short ring_cadence;
1242 int ring_cadence_t;
1243 unsigned long ring_cadence_jif;
1244 unsigned long checkwait;
1245 int intercom;
1246 int m_hook;
1247 int r_hook;
1248 char pstn_envelope;
1249 char pstn_cid_intr;
1250 unsigned char fskz;
1251 unsigned char fskphase;
1252 unsigned char fskcnt;
1253 unsigned pstn_cid_received;
1254 PHONE_CID cid;
1255 PHONE_CID cid_send;
1256 unsigned long pstn_ring_start;
1257 unsigned long pstn_ring_stop;
1258 unsigned long pstn_winkstart;
1259 unsigned int winktime;
1260 unsigned long flash_end;
1261 char port;
1262 union telephony_exception ex;
1263 char daa_mode;
1264 char daa_country;
1265 unsigned long pstn_sleeptil;
1266 DAA_REGS m_DAAShadowRegs;
1267 Proc_Info_Type Info_read;
1268 Proc_Info_Type Info_write;
1269 unsigned short frame_count;
1270 unsigned int filter_hist[4];
1271 unsigned char filter_en[4];
1272 unsigned short proc_load;
1273 unsigned long framesread;
1274 unsigned long frameswritten;
1275 unsigned long read_wait;
1276 unsigned long write_wait;
1277 unsigned long timerchecks;
1278 unsigned long txreadycheck;
1279 unsigned long rxreadycheck;
1280 short fskdata[8000];
1281 int fskdcnt;
1282 } IXJ;
1283
1284 typedef int (*IXJ_REGFUNC) (IXJ * j, unsigned long arg);
1285
1286 int ixj_register(int index, IXJ_REGFUNC regfunc);
1287 int ixj_unregister(int index);
1288
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.