1 /****************************************************************************
4 * Device Driver for Quicknet Technologies, Inc.'s Telephony cards
5 * including the Internet PhoneJACK, Internet PhoneJACK Lite,
6 * Internet PhoneJACK PCI, Internet LineJACK, Internet PhoneCARD and
9 * (c) Copyright 1999-2001 Quicknet Technologies, Inc.
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
16 * Author: Ed Okerson, <eokerson@quicknet.net>
18 * Contributors: Greg Herlein, <gherlein@quicknet.net>
19 * David W. Erhart, <derhart@quicknet.net>
20 * John Sellers, <jsellers@quicknet.net>
21 * Mike Preston, <mpreston@quicknet.net>
23 * Fixes: David Huggins-Daines, <dhd@cepstral.com>
24 * Fabio Ferrari, <fabio.ferrari@digitro.com.br>
25 * Artis Kugevics, <artis@mt.lv>
26 * Daniele Bellucci, <bellucda@tiscali.it>
28 * More information about the hardware related to this driver can be found
29 * at our website: http://www.quicknet.net
31 * IN NO EVENT SHALL QUICKNET TECHNOLOGIES, INC. BE LIABLE TO ANY PARTY FOR
32 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
33 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF QUICKNET
34 * TECHNOLOGIES, INC. HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 * QUICKNET TECHNOLOGIES, INC. SPECIFICALLY DISCLAIMS ANY WARRANTIES,
37 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
38 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
39 * ON AN "AS IS" BASIS, AND QUICKNET TECHNOLOGIES, INC. HAS NO OBLIGATION
40 * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
42 ***************************************************************************/
47 * Revision 4.8 2003/07/09 19:39:00 Daniele Bellucci
48 * Audit some copy_*_user and minor cleanup.
50 * Revision 4.7 2001/08/13 06:19:33 craigs
51 * Added additional changes from Alan Cox and John Anderson for
52 * 2.2 to 2.4 cleanup and bounds checking
54 * Revision 4.6 2001/08/13 01:05:05 craigs
55 * Really fixed PHONE_QUERY_CODEC problem this time
57 * Revision 4.5 2001/08/13 00:11:03 craigs
58 * Fixed problem in handling of PHONE_QUERY_CODEC, thanks to Shane Anderson
60 * Revision 4.4 2001/08/07 07:58:12 craigs
61 * Changed back to three digit version numbers
62 * Added tagbuild target to allow automatic and easy tagging of versions
64 * Revision 4.3 2001/08/07 07:24:47 craigs
65 * Added ixj-ver.h to allow easy configuration management of driver
66 * Added display of version number in /prox/ixj
68 * Revision 4.2 2001/08/06 07:07:19 craigs
69 * Reverted IXJCTL_DSP_TYPE and IXJCTL_DSP_VERSION files to original
70 * behaviour of returning int rather than short *
72 * Revision 4.1 2001/08/05 00:17:37 craigs
73 * More changes for correct PCMCIA installation
74 * Start of changes for backward Linux compatibility
76 * Revision 4.0 2001/08/04 12:33:12 craigs
77 * New version using GNU autoconf
79 * Revision 3.105 2001/07/20 23:14:32 eokerson
80 * More work on CallerID generation when using ring cadences.
82 * Revision 3.104 2001/07/06 01:33:55 eokerson
83 * Some bugfixes from Robert Vojta <vojta@ipex.cz> and a few mods to the Makefile.
85 * Revision 3.103 2001/07/05 19:20:16 eokerson
87 * Changed mic gain to 30dB on Internet LineJACK mic/speaker port.
89 * Revision 3.102 2001/07/03 23:51:21 eokerson
90 * Un-mute mic on Internet LineJACK when in speakerphone mode.
92 * Revision 3.101 2001/07/02 19:26:56 eokerson
93 * Removed initialiazation of ixjdebug and ixj_convert_loaded so they will go in the .bss instead of the .data
95 * Revision 3.100 2001/07/02 19:18:27 eokerson
96 * Changed driver to make dynamic allocation possible. We now pass IXJ * between functions instead of array indexes.
97 * Fixed the way the POTS and PSTN ports interact during a PSTN call to allow local answering.
98 * Fixed speaker mode on Internet LineJACK.
100 * Revision 3.99 2001/05/09 14:11:16 eokerson
101 * Fixed kmalloc error in ixj_build_filter_cadence. Thanks David Chan <cat@waulogy.stanford.edu>.
103 * Revision 3.98 2001/05/08 19:55:33 eokerson
104 * Fixed POTS hookstate detection while it is connected to PSTN port.
106 * Revision 3.97 2001/05/08 00:01:04 eokerson
107 * Fixed kernel oops when sending caller ID data.
109 * Revision 3.96 2001/05/04 23:09:30 eokerson
110 * Now uses one kernel timer for each card, instead of one for the entire driver.
112 * Revision 3.95 2001/04/25 22:06:47 eokerson
113 * Fixed squawking at beginning of some G.723.1 calls.
115 * Revision 3.94 2001/04/03 23:42:00 eokerson
116 * Added linear volume ioctls
117 * Added raw filter load ioctl
119 * Revision 3.93 2001/02/27 01:00:06 eokerson
120 * Fixed blocking in CallerID.
121 * Reduced size of ixj structure for smaller driver footprint.
123 * Revision 3.92 2001/02/20 22:02:59 eokerson
124 * Fixed isapnp and pcmcia module compatibility for 2.4.x kernels.
125 * Improved PSTN ring detection.
126 * Fixed wink generation on POTS ports.
128 * Revision 3.91 2001/02/13 00:55:44 eokerson
129 * Turn AEC back on after changing frame sizes.
131 * Revision 3.90 2001/02/12 16:42:00 eokerson
132 * Added ALAW codec, thanks to Fabio Ferrari for the table based converters to make ALAW from ULAW.
134 * Revision 3.89 2001/02/12 15:41:16 eokerson
135 * Fix from Artis Kugevics - Tone gains were not being set correctly.
137 * Revision 3.88 2001/02/05 23:25:42 eokerson
138 * Fixed lockup bugs with deregister.
140 * Revision 3.87 2001/01/29 21:00:39 eokerson
141 * Fix from Fabio Ferrari <fabio.ferrari@digitro.com.br> to properly handle EAGAIN and EINTR during non-blocking write.
142 * Updated copyright date.
144 * Revision 3.86 2001/01/23 23:53:46 eokerson
145 * Fixes to G.729 compatibility.
147 * Revision 3.85 2001/01/23 21:30:36 eokerson
148 * Added verbage about cards supported.
149 * Removed commands that put the card in low power mode at some times that it should not be in low power mode.
151 * Revision 3.84 2001/01/22 23:32:10 eokerson
152 * Some bugfixes from David Huggins-Daines, <dhd@cepstral.com> and other cleanups.
154 * Revision 3.83 2001/01/19 14:51:41 eokerson
155 * Fixed ixj_WriteDSPCommand to decrement usage counter when command fails.
157 * Revision 3.82 2001/01/19 00:34:49 eokerson
158 * Added verbosity to write overlap errors.
160 * Revision 3.81 2001/01/18 23:56:54 eokerson
161 * Fixed PSTN line test functions.
163 * Revision 3.80 2001/01/18 22:29:27 eokerson
164 * Updated AEC/AGC values for different cards.
166 * Revision 3.79 2001/01/17 02:58:54 eokerson
167 * Fixed AEC reset after Caller ID.
168 * Fixed Codec lockup after Caller ID on Call Waiting when not using 30ms frames.
170 * Revision 3.78 2001/01/16 19:43:09 eokerson
171 * Added support for Linux 2.4.x kernels.
173 * Revision 3.77 2001/01/09 04:00:52 eokerson
174 * Linetest will now test the line, even if it has previously succeded.
176 * Revision 3.76 2001/01/08 19:27:00 eokerson
177 * Fixed problem with standard cable on Internet PhoneCARD.
179 * Revision 3.75 2000/12/22 16:52:14 eokerson
180 * Modified to allow hookstate detection on the POTS port when the PSTN port is selected.
182 * Revision 3.74 2000/12/08 22:41:50 eokerson
183 * Added capability for G729B.
185 * Revision 3.73 2000/12/07 23:35:16 eokerson
186 * Added capability to have different ring pattern before CallerID data.
187 * Added hookstate checks in CallerID routines to stop FSK.
189 * Revision 3.72 2000/12/06 19:31:31 eokerson
190 * Modified signal behavior to only send one signal per event.
192 * Revision 3.71 2000/12/06 03:23:08 eokerson
193 * Fixed CallerID on Call Waiting.
195 * Revision 3.70 2000/12/04 21:29:37 eokerson
196 * Added checking to Smart Cable gain functions.
198 * Revision 3.69 2000/12/04 21:05:20 eokerson
199 * Changed ixjdebug levels.
200 * Added ioctls to change gains in Internet Phone CARD Smart Cable.
202 * Revision 3.68 2000/12/04 00:17:21 craigs
203 * Changed mixer voice gain to +6dB rather than 0dB
205 * Revision 3.67 2000/11/30 21:25:51 eokerson
206 * Fixed write signal errors.
208 * Revision 3.66 2000/11/29 22:42:44 eokerson
209 * Fixed PSTN ring detect problems.
211 * Revision 3.65 2000/11/29 07:31:55 craigs
212 * Added new 425Hz filter co-efficients
213 * Added card-specific DTMF prescaler initialisation
215 * Revision 3.64 2000/11/28 14:03:32 craigs
216 * Changed certain mixer initialisations to be 0dB rather than 12dB
217 * Added additional information to /proc/ixj
219 * Revision 3.63 2000/11/28 11:38:41 craigs
220 * Added display of AEC modes in AUTO and AGC mode
222 * Revision 3.62 2000/11/28 04:05:44 eokerson
223 * Improved PSTN ring detection routine.
225 * Revision 3.61 2000/11/27 21:53:12 eokerson
226 * Fixed flash detection.
228 * Revision 3.60 2000/11/27 15:57:29 eokerson
229 * More work on G.729 load routines.
231 * Revision 3.59 2000/11/25 21:55:12 eokerson
232 * Fixed errors in G.729 load routine.
234 * Revision 3.58 2000/11/25 04:08:29 eokerson
235 * Added board locks around G.729 and TS85 load routines.
237 * Revision 3.57 2000/11/24 05:35:17 craigs
238 * Added ability to retrieve mixer values on LineJACK
239 * Added complete initialisation of all mixer values at startup
240 * Fixed spelling mistake
242 * Revision 3.56 2000/11/23 02:52:11 robertj
243 * Added cvs change log keyword.
244 * Fixed bug in capabilities list when using G.729 module.
250 #define PERFMON_STATS
254 #include <linux/module.h>
256 #include <linux/init.h>
257 #include <linux/sched.h>
258 #include <linux/kernel.h> /* printk() */
259 #include <linux/fs.h> /* everything... */
260 #include <linux/errno.h> /* error codes */
261 #include <linux/slab.h>
262 #include <linux/mm.h>
263 #include <linux/ioport.h>
264 #include <linux/interrupt.h>
265 #include <linux/proc_fs.h>
266 #include <linux/poll.h>
267 #include <linux/timer.h>
268 #include <linux/delay.h>
269 #include <linux/pci.h>
272 #include <asm/uaccess.h>
274 #include <linux/isapnp.h>
278 #define TYPE(inode) (iminor(inode) >> 4)
279 #define NUM(inode) (iminor(inode) & 0xf)
282 static int hertz
= HZ
;
283 static int samplerate
= 100;
285 module_param(ixjdebug
, int, 0);
287 /************************************************************************
289 * ixjdebug meanings are now bit mapped instead of level based
290 * Values can be or'ed together to turn on multiple messages
292 * bit 0 (0x0001) = any failure
293 * bit 1 (0x0002) = general messages
294 * bit 2 (0x0004) = POTS ringing related
295 * bit 3 (0x0008) = PSTN events
296 * bit 4 (0x0010) = PSTN Cadence state details
297 * bit 5 (0x0020) = Tone detection triggers
298 * bit 6 (0x0040) = Tone detection cadence details
299 * bit 7 (0x0080) = ioctl tracking
300 * bit 8 (0x0100) = signal tracking
301 * bit 9 (0x0200) = CallerID generation details
303 ************************************************************************/
307 static IXJ
*ixj
[IXJMAX
];
308 #define get_ixj(b) ixj[(b)]
311 * Allocate a free IXJ device
314 static IXJ
*ixj_alloc()
316 for(cnt
=0; cnt
<IXJMAX
; cnt
++)
318 if(ixj
[cnt
] == NULL
|| !ixj
[cnt
]->DSPbase
)
320 j
= kmalloc(sizeof(IXJ
), GFP_KERNEL
);
330 static void ixj_fsk_free(IXJ
*j
)
336 static void ixj_fsk_alloc(IXJ
*j
)
339 j
->fskdata
= kmalloc(8000, GFP_KERNEL
);
341 if(ixjdebug
& 0x0200) {
342 printk("IXJ phone%d - allocate failed\n", j
->board
);
347 if(ixjdebug
& 0x0200) {
348 printk("IXJ phone%d - allocate succeded\n", j
->board
);
356 static IXJ ixj
[IXJMAX
];
357 #define get_ixj(b) (&ixj[(b)])
360 * Allocate a free IXJ device
363 static IXJ
*ixj_alloc(void)
366 for(cnt
=0; cnt
<IXJMAX
; cnt
++) {
367 if(!ixj
[cnt
].DSPbase
)
373 static inline void ixj_fsk_free(IXJ
*j
) {;}
375 static inline void ixj_fsk_alloc(IXJ
*j
)
383 #define ixj_perfmon(x) ((x)++)
385 #define ixj_perfmon(x) do { } while(0)
388 static int ixj_convert_loaded
;
390 static int ixj_WriteDSPCommand(unsigned short, IXJ
*j
);
392 /************************************************************************
394 * These are function definitions to allow external modules to register
395 * enhanced functionality call backs.
397 ************************************************************************/
399 static int Stub(IXJ
* J
, unsigned long arg
)
404 static IXJ_REGFUNC ixj_PreRead
= &Stub
;
405 static IXJ_REGFUNC ixj_PostRead
= &Stub
;
406 static IXJ_REGFUNC ixj_PreWrite
= &Stub
;
407 static IXJ_REGFUNC ixj_PostWrite
= &Stub
;
409 static void ixj_read_frame(IXJ
*j
);
410 static void ixj_write_frame(IXJ
*j
);
411 static void ixj_init_timer(IXJ
*j
);
412 static void ixj_add_timer(IXJ
* j
);
413 static void ixj_timeout(unsigned long ptr
);
414 static int read_filters(IXJ
*j
);
415 static int LineMonitor(IXJ
*j
);
416 static int ixj_fasync(int fd
, struct file
*, int mode
);
417 static int ixj_set_port(IXJ
*j
, int arg
);
418 static int ixj_set_pots(IXJ
*j
, int arg
);
419 static int ixj_hookstate(IXJ
*j
);
420 static int ixj_record_start(IXJ
*j
);
421 static void ixj_record_stop(IXJ
*j
);
422 static void set_rec_volume(IXJ
*j
, int volume
);
423 static int get_rec_volume(IXJ
*j
);
424 static int set_rec_codec(IXJ
*j
, int rate
);
425 static void ixj_vad(IXJ
*j
, int arg
);
426 static int ixj_play_start(IXJ
*j
);
427 static void ixj_play_stop(IXJ
*j
);
428 static int ixj_set_tone_on(unsigned short arg
, IXJ
*j
);
429 static int ixj_set_tone_off(unsigned short, IXJ
*j
);
430 static int ixj_play_tone(IXJ
*j
, char tone
);
431 static void ixj_aec_start(IXJ
*j
, int level
);
432 static int idle(IXJ
*j
);
433 static void ixj_ring_on(IXJ
*j
);
434 static void ixj_ring_off(IXJ
*j
);
435 static void aec_stop(IXJ
*j
);
436 static void ixj_ringback(IXJ
*j
);
437 static void ixj_busytone(IXJ
*j
);
438 static void ixj_dialtone(IXJ
*j
);
439 static void ixj_cpt_stop(IXJ
*j
);
440 static char daa_int_read(IXJ
*j
);
441 static char daa_CR_read(IXJ
*j
, int cr
);
442 static int daa_set_mode(IXJ
*j
, int mode
);
443 static int ixj_linetest(IXJ
*j
);
444 static int ixj_daa_write(IXJ
*j
);
445 static int ixj_daa_cid_read(IXJ
*j
);
446 static void DAA_Coeff_US(IXJ
*j
);
447 static void DAA_Coeff_UK(IXJ
*j
);
448 static void DAA_Coeff_France(IXJ
*j
);
449 static void DAA_Coeff_Germany(IXJ
*j
);
450 static void DAA_Coeff_Australia(IXJ
*j
);
451 static void DAA_Coeff_Japan(IXJ
*j
);
452 static int ixj_init_filter(IXJ
*j
, IXJ_FILTER
* jf
);
453 static int ixj_init_filter_raw(IXJ
*j
, IXJ_FILTER_RAW
* jfr
);
454 static int ixj_init_tone(IXJ
*j
, IXJ_TONE
* ti
);
455 static int ixj_build_cadence(IXJ
*j
, IXJ_CADENCE __user
* cp
);
456 static int ixj_build_filter_cadence(IXJ
*j
, IXJ_FILTER_CADENCE __user
* cp
);
457 /* Serial Control Interface funtions */
458 static int SCI_Control(IXJ
*j
, int control
);
459 static int SCI_Prepare(IXJ
*j
);
460 static int SCI_WaitHighSCI(IXJ
*j
);
461 static int SCI_WaitLowSCI(IXJ
*j
);
462 static DWORD
PCIEE_GetSerialNumber(WORD wAddress
);
463 static int ixj_PCcontrol_wait(IXJ
*j
);
464 static void ixj_pre_cid(IXJ
*j
);
465 static void ixj_write_cid(IXJ
*j
);
466 static void ixj_write_cid_bit(IXJ
*j
, int bit
);
467 static int set_base_frame(IXJ
*j
, int size
);
468 static int set_play_codec(IXJ
*j
, int rate
);
469 static void set_rec_depth(IXJ
*j
, int depth
);
470 static int ixj_mixer(long val
, IXJ
*j
);
472 /************************************************************************
473 CT8020/CT8021 Host Programmers Model
474 Host address Function Access
476 0-1 Aux Software Status Register (reserved) Read Only
477 2-3 Software Status Register Read Only
478 4-5 Aux Software Control Register (reserved) Read Write
479 6-7 Software Control Register Read Write
480 8-9 Hardware Status Register Read Only
481 A-B Hardware Control Register Read Write
482 C-D Host Transmit (Write) Data Buffer Access Port (buffer input)Write Only
483 E-F Host Recieve (Read) Data Buffer Access Port (buffer input) Read Only
484 ************************************************************************/
486 static inline void ixj_read_HSR(IXJ
*j
)
488 j
->hsr
.bytes
.low
= inb_p(j
->DSPbase
+ 8);
489 j
->hsr
.bytes
.high
= inb_p(j
->DSPbase
+ 9);
492 static inline int IsControlReady(IXJ
*j
)
495 return j
->hsr
.bits
.controlrdy
? 1 : 0;
498 static inline int IsPCControlReady(IXJ
*j
)
500 j
->pccr1
.byte
= inb_p(j
->XILINXbase
+ 3);
501 return j
->pccr1
.bits
.crr
? 1 : 0;
504 static inline int IsStatusReady(IXJ
*j
)
507 return j
->hsr
.bits
.statusrdy
? 1 : 0;
510 static inline int IsRxReady(IXJ
*j
)
513 ixj_perfmon(j
->rxreadycheck
);
514 return j
->hsr
.bits
.rxrdy
? 1 : 0;
517 static inline int IsTxReady(IXJ
*j
)
520 ixj_perfmon(j
->txreadycheck
);
521 return j
->hsr
.bits
.txrdy
? 1 : 0;
524 static inline void set_play_volume(IXJ
*j
, int volume
)
526 if (ixjdebug
& 0x0002)
527 printk(KERN_INFO
"IXJ: /dev/phone%d Setting Play Volume to 0x%4.4x\n", j
->board
, volume
);
528 ixj_WriteDSPCommand(0xCF02, j
);
529 ixj_WriteDSPCommand(volume
, j
);
532 static int set_play_volume_linear(IXJ
*j
, int volume
)
534 int newvolume
, dspplaymax
;
536 if (ixjdebug
& 0x0002)
537 printk(KERN_INFO
"IXJ: /dev/phone %d Setting Linear Play Volume to 0x%4.4x\n", j
->board
, volume
);
538 if(volume
> 100 || volume
< 0) {
542 /* This should normalize the perceived volumes between the different cards caused by differences in the hardware */
543 switch (j
->cardtype
) {
548 if(j
->port
== PORT_PSTN
) {
554 case QTI_PHONEJACK_LITE
:
557 case QTI_PHONEJACK_PCI
:
566 newvolume
= (dspplaymax
* volume
) / 100;
567 set_play_volume(j
, newvolume
);
571 static inline void set_play_depth(IXJ
*j
, int depth
)
577 ixj_WriteDSPCommand(0x5280 + depth
, j
);
580 static inline int get_play_volume(IXJ
*j
)
582 ixj_WriteDSPCommand(0xCF00, j
);
583 return j
->ssr
.high
<< 8 | j
->ssr
.low
;
586 static int get_play_volume_linear(IXJ
*j
)
588 int volume
, newvolume
, dspplaymax
;
590 /* This should normalize the perceived volumes between the different cards caused by differences in the hardware */
591 switch (j
->cardtype
) {
596 if(j
->port
== PORT_PSTN
) {
602 case QTI_PHONEJACK_LITE
:
605 case QTI_PHONEJACK_PCI
:
614 volume
= get_play_volume(j
);
615 newvolume
= (volume
* 100) / dspplaymax
;
621 static inline BYTE
SLIC_GetState(IXJ
*j
)
623 if (j
->cardtype
== QTI_PHONECARD
) {
625 j
->psccr
.bits
.dev
= 3;
626 j
->psccr
.bits
.rw
= 1;
627 outw_p(j
->psccr
.byte
<< 8, j
->XILINXbase
+ 0x00);
628 ixj_PCcontrol_wait(j
);
629 j
->pslic
.byte
= inw_p(j
->XILINXbase
+ 0x00) & 0xFF;
630 ixj_PCcontrol_wait(j
);
631 if (j
->pslic
.bits
.powerdown
)
632 return PLD_SLIC_STATE_OC
;
633 else if (!j
->pslic
.bits
.ring0
&& !j
->pslic
.bits
.ring1
)
634 return PLD_SLIC_STATE_ACTIVE
;
636 return PLD_SLIC_STATE_RINGING
;
638 j
->pld_slicr
.byte
= inb_p(j
->XILINXbase
+ 0x01);
640 return j
->pld_slicr
.bits
.state
;
643 static BOOL
SLIC_SetState(BYTE byState
, IXJ
*j
)
645 BOOL fRetVal
= FALSE
;
647 if (j
->cardtype
== QTI_PHONECARD
) {
648 if (j
->flags
.pcmciasct
) {
650 case PLD_SLIC_STATE_TIPOPEN
:
651 case PLD_SLIC_STATE_OC
:
652 j
->pslic
.bits
.powerdown
= 1;
653 j
->pslic
.bits
.ring0
= j
->pslic
.bits
.ring1
= 0;
656 case PLD_SLIC_STATE_RINGING
:
657 if (j
->readers
|| j
->writers
) {
658 j
->pslic
.bits
.powerdown
= 0;
659 j
->pslic
.bits
.ring0
= 1;
660 j
->pslic
.bits
.ring1
= 0;
664 case PLD_SLIC_STATE_OHT
: /* On-hook transmit */
666 case PLD_SLIC_STATE_STANDBY
:
667 case PLD_SLIC_STATE_ACTIVE
:
668 if (j
->readers
|| j
->writers
) {
669 j
->pslic
.bits
.powerdown
= 0;
671 j
->pslic
.bits
.powerdown
= 1;
673 j
->pslic
.bits
.ring0
= j
->pslic
.bits
.ring1
= 0;
676 case PLD_SLIC_STATE_APR
: /* Active polarity reversal */
678 case PLD_SLIC_STATE_OHTPR
: /* OHT polarity reversal */
684 j
->psccr
.bits
.dev
= 3;
685 j
->psccr
.bits
.rw
= 0;
686 outw_p(j
->psccr
.byte
<< 8 | j
->pslic
.byte
, j
->XILINXbase
+ 0x00);
687 ixj_PCcontrol_wait(j
);
690 /* Set the C1, C2, C3 & B2EN signals. */
692 case PLD_SLIC_STATE_OC
:
693 j
->pld_slicw
.bits
.c1
= 0;
694 j
->pld_slicw
.bits
.c2
= 0;
695 j
->pld_slicw
.bits
.c3
= 0;
696 j
->pld_slicw
.bits
.b2en
= 0;
697 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
700 case PLD_SLIC_STATE_RINGING
:
701 j
->pld_slicw
.bits
.c1
= 1;
702 j
->pld_slicw
.bits
.c2
= 0;
703 j
->pld_slicw
.bits
.c3
= 0;
704 j
->pld_slicw
.bits
.b2en
= 1;
705 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
708 case PLD_SLIC_STATE_ACTIVE
:
709 j
->pld_slicw
.bits
.c1
= 0;
710 j
->pld_slicw
.bits
.c2
= 1;
711 j
->pld_slicw
.bits
.c3
= 0;
712 j
->pld_slicw
.bits
.b2en
= 0;
713 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
716 case PLD_SLIC_STATE_OHT
: /* On-hook transmit */
718 j
->pld_slicw
.bits
.c1
= 1;
719 j
->pld_slicw
.bits
.c2
= 1;
720 j
->pld_slicw
.bits
.c3
= 0;
721 j
->pld_slicw
.bits
.b2en
= 0;
722 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
725 case PLD_SLIC_STATE_TIPOPEN
:
726 j
->pld_slicw
.bits
.c1
= 0;
727 j
->pld_slicw
.bits
.c2
= 0;
728 j
->pld_slicw
.bits
.c3
= 1;
729 j
->pld_slicw
.bits
.b2en
= 0;
730 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
733 case PLD_SLIC_STATE_STANDBY
:
734 j
->pld_slicw
.bits
.c1
= 1;
735 j
->pld_slicw
.bits
.c2
= 0;
736 j
->pld_slicw
.bits
.c3
= 1;
737 j
->pld_slicw
.bits
.b2en
= 1;
738 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
741 case PLD_SLIC_STATE_APR
: /* Active polarity reversal */
743 j
->pld_slicw
.bits
.c1
= 0;
744 j
->pld_slicw
.bits
.c2
= 1;
745 j
->pld_slicw
.bits
.c3
= 1;
746 j
->pld_slicw
.bits
.b2en
= 0;
747 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
750 case PLD_SLIC_STATE_OHTPR
: /* OHT polarity reversal */
752 j
->pld_slicw
.bits
.c1
= 1;
753 j
->pld_slicw
.bits
.c2
= 1;
754 j
->pld_slicw
.bits
.c3
= 1;
755 j
->pld_slicw
.bits
.b2en
= 0;
756 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
768 static int ixj_wink(IXJ
*j
)
772 slicnow
= SLIC_GetState(j
);
774 j
->pots_winkstart
= jiffies
;
775 SLIC_SetState(PLD_SLIC_STATE_OC
, j
);
777 msleep(jiffies_to_msecs(j
->winktime
));
779 SLIC_SetState(slicnow
, j
);
783 static void ixj_init_timer(IXJ
*j
)
785 init_timer(&j
->timer
);
786 j
->timer
.function
= ixj_timeout
;
787 j
->timer
.data
= (unsigned long)j
;
790 static void ixj_add_timer(IXJ
*j
)
792 j
->timer
.expires
= jiffies
+ (hertz
/ samplerate
);
793 add_timer(&j
->timer
);
796 static void ixj_tone_timeout(IXJ
*j
)
801 if (j
->tone_state
== 3) {
804 j
->tone_cadence_state
++;
805 if (j
->tone_cadence_state
>= j
->cadence_t
->elements_used
) {
806 switch (j
->cadence_t
->termination
) {
810 case REPEAT_LAST_ELEMENT
:
811 j
->tone_cadence_state
--;
812 ixj_play_tone(j
, j
->cadence_t
->ce
[j
->tone_cadence_state
].index
);
815 j
->tone_cadence_state
= 0;
816 if (j
->cadence_t
->ce
[j
->tone_cadence_state
].freq0
) {
817 ti
.tone_index
= j
->cadence_t
->ce
[j
->tone_cadence_state
].index
;
818 ti
.freq0
= j
->cadence_t
->ce
[j
->tone_cadence_state
].freq0
;
819 ti
.gain0
= j
->cadence_t
->ce
[j
->tone_cadence_state
].gain0
;
820 ti
.freq1
= j
->cadence_t
->ce
[j
->tone_cadence_state
].freq1
;
821 ti
.gain1
= j
->cadence_t
->ce
[j
->tone_cadence_state
].gain1
;
822 ixj_init_tone(j
, &ti
);
824 ixj_set_tone_on(j
->cadence_t
->ce
[0].tone_on_time
, j
);
825 ixj_set_tone_off(j
->cadence_t
->ce
[0].tone_off_time
, j
);
826 ixj_play_tone(j
, j
->cadence_t
->ce
[0].index
);
830 if (j
->cadence_t
->ce
[j
->tone_cadence_state
].gain0
) {
831 ti
.tone_index
= j
->cadence_t
->ce
[j
->tone_cadence_state
].index
;
832 ti
.freq0
= j
->cadence_t
->ce
[j
->tone_cadence_state
].freq0
;
833 ti
.gain0
= j
->cadence_t
->ce
[j
->tone_cadence_state
].gain0
;
834 ti
.freq1
= j
->cadence_t
->ce
[j
->tone_cadence_state
].freq1
;
835 ti
.gain1
= j
->cadence_t
->ce
[j
->tone_cadence_state
].gain1
;
836 ixj_init_tone(j
, &ti
);
838 ixj_set_tone_on(j
->cadence_t
->ce
[j
->tone_cadence_state
].tone_on_time
, j
);
839 ixj_set_tone_off(j
->cadence_t
->ce
[j
->tone_cadence_state
].tone_off_time
, j
);
840 ixj_play_tone(j
, j
->cadence_t
->ce
[j
->tone_cadence_state
].index
);
846 static inline void ixj_kill_fasync(IXJ
*j
, IXJ_SIGEVENT event
, int dir
)
848 if(j
->ixj_signals
[event
]) {
849 if(ixjdebug
& 0x0100)
850 printk("Sending signal for event %d\n", event
);
851 /* Send apps notice of change */
852 /* see config.h for macro definition */
853 kill_fasync(&(j
->async_queue
), j
->ixj_signals
[event
], dir
);
857 static void ixj_pstn_state(IXJ
*j
)
860 union XOPXR0 XR0
, daaint
;
864 XR0
.reg
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.reg
;
866 XR0
.bitreg
.RMR
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.bitreg
.RMR
;
868 j
->pld_scrr
.byte
= inb_p(j
->XILINXbase
);
869 if (j
->pld_scrr
.bits
.daaflag
) {
871 if(j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.RING
) {
872 if(time_after(jiffies
, j
->pstn_sleeptil
) && !(j
->flags
.pots_pstn
&& j
->hookstate
)) {
873 daaint
.bitreg
.RING
= 1;
874 if(ixjdebug
& 0x0008) {
875 printk(KERN_INFO
"IXJ DAA Ring Interrupt /dev/phone%d at %ld\n", j
->board
, jiffies
);
878 daa_set_mode(j
, SOP_PU_RESET
);
881 if(j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.Caller_ID
) {
882 daaint
.bitreg
.Caller_ID
= 1;
883 j
->pstn_cid_intr
= 1;
884 j
->pstn_cid_received
= jiffies
;
885 if(ixjdebug
& 0x0008) {
886 printk(KERN_INFO
"IXJ DAA Caller_ID Interrupt /dev/phone%d at %ld\n", j
->board
, jiffies
);
889 if(j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.Cadence
) {
890 daaint
.bitreg
.Cadence
= 1;
891 if(ixjdebug
& 0x0008) {
892 printk(KERN_INFO
"IXJ DAA Cadence Interrupt /dev/phone%d at %ld\n", j
->board
, jiffies
);
895 if(j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.VDD_OK
!= XR0
.bitreg
.VDD_OK
) {
896 daaint
.bitreg
.VDD_OK
= 1;
897 daaint
.bitreg
.SI_0
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.VDD_OK
;
901 if(j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.bitreg
.RMR
!= XR0
.bitreg
.RMR
&& time_after(jiffies
, j
->pstn_sleeptil
) && !(j
->flags
.pots_pstn
&& j
->hookstate
)) {
902 daaint
.bitreg
.RMR
= 1;
903 daaint
.bitreg
.SI_1
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.bitreg
.RMR
;
904 if(ixjdebug
& 0x0008) {
905 printk(KERN_INFO
"IXJ DAA RMR /dev/phone%d was %s for %ld\n", j
->board
, XR0
.bitreg
.RMR
?"on":"off", jiffies
- j
->pstn_last_rmr
);
907 j
->pstn_prev_rmr
= j
->pstn_last_rmr
;
908 j
->pstn_last_rmr
= jiffies
;
910 switch(j
->daa_mode
) {
912 if (daaint
.bitreg
.RING
) {
913 if (!j
->flags
.pstn_ringing
) {
914 if (j
->daa_mode
!= SOP_PU_RINGING
) {
915 j
->pstn_ring_int
= jiffies
;
916 daa_set_mode(j
, SOP_PU_RINGING
);
922 if (daaint
.bitreg
.RMR
) {
923 if (ixjdebug
& 0x0008) {
924 printk(KERN_INFO
"IXJ Ring Cadence a state = %d /dev/phone%d at %ld\n", j
->cadence_f
[4].state
, j
->board
, jiffies
);
926 if (daaint
.bitreg
.SI_1
) { /* Rising edge of RMR */
927 j
->flags
.pstn_rmr
= 1;
928 j
->pstn_ring_start
= jiffies
;
929 j
->pstn_ring_stop
= 0;
930 j
->ex
.bits
.pstn_ring
= 0;
931 if (j
->cadence_f
[4].state
== 0) {
932 j
->cadence_f
[4].state
= 1;
933 j
->cadence_f
[4].on1min
= jiffies
+ (long)((j
->cadence_f
[4].on1
* hertz
* (100 - var
)) / 10000);
934 j
->cadence_f
[4].on1dot
= jiffies
+ (long)((j
->cadence_f
[4].on1
* hertz
* (100)) / 10000);
935 j
->cadence_f
[4].on1max
= jiffies
+ (long)((j
->cadence_f
[4].on1
* hertz
* (100 + var
)) / 10000);
936 } else if (j
->cadence_f
[4].state
== 2) {
937 if((time_after(jiffies
, j
->cadence_f
[4].off1min
) &&
938 time_before(jiffies
, j
->cadence_f
[4].off1max
))) {
939 if (j
->cadence_f
[4].on2
) {
940 j
->cadence_f
[4].state
= 3;
941 j
->cadence_f
[4].on2min
= jiffies
+ (long)((j
->cadence_f
[4].on2
* (hertz
* (100 - var
)) / 10000));
942 j
->cadence_f
[4].on2dot
= jiffies
+ (long)((j
->cadence_f
[4].on2
* (hertz
* (100)) / 10000));
943 j
->cadence_f
[4].on2max
= jiffies
+ (long)((j
->cadence_f
[4].on2
* (hertz
* (100 + var
)) / 10000));
945 j
->cadence_f
[4].state
= 7;
948 if (ixjdebug
& 0x0008) {
949 printk(KERN_INFO
"IXJ Ring Cadence fail state = %d /dev/phone%d at %ld should be %d\n",
950 j
->cadence_f
[4].state
, j
->board
, jiffies
- j
->pstn_prev_rmr
,
951 j
->cadence_f
[4].off1
);
953 j
->cadence_f
[4].state
= 0;
955 } else if (j
->cadence_f
[4].state
== 4) {
956 if((time_after(jiffies
, j
->cadence_f
[4].off2min
) &&
957 time_before(jiffies
, j
->cadence_f
[4].off2max
))) {
958 if (j
->cadence_f
[4].on3
) {
959 j
->cadence_f
[4].state
= 5;
960 j
->cadence_f
[4].on3min
= jiffies
+ (long)((j
->cadence_f
[4].on3
* (hertz
* (100 - var
)) / 10000));
961 j
->cadence_f
[4].on3dot
= jiffies
+ (long)((j
->cadence_f
[4].on3
* (hertz
* (100)) / 10000));
962 j
->cadence_f
[4].on3max
= jiffies
+ (long)((j
->cadence_f
[4].on3
* (hertz
* (100 + var
)) / 10000));
964 j
->cadence_f
[4].state
= 7;
967 if (ixjdebug
& 0x0008) {
968 printk(KERN_INFO
"IXJ Ring Cadence fail state = %d /dev/phone%d at %ld should be %d\n",
969 j
->cadence_f
[4].state
, j
->board
, jiffies
- j
->pstn_prev_rmr
,
970 j
->cadence_f
[4].off2
);
972 j
->cadence_f
[4].state
= 0;
974 } else if (j
->cadence_f
[4].state
== 6) {
975 if((time_after(jiffies
, j
->cadence_f
[4].off3min
) &&
976 time_before(jiffies
, j
->cadence_f
[4].off3max
))) {
977 j
->cadence_f
[4].state
= 7;
979 if (ixjdebug
& 0x0008) {
980 printk(KERN_INFO
"IXJ Ring Cadence fail state = %d /dev/phone%d at %ld should be %d\n",
981 j
->cadence_f
[4].state
, j
->board
, jiffies
- j
->pstn_prev_rmr
,
982 j
->cadence_f
[4].off3
);
984 j
->cadence_f
[4].state
= 0;
987 j
->cadence_f
[4].state
= 0;
989 } else { /* Falling edge of RMR */
990 j
->pstn_ring_start
= 0;
991 j
->pstn_ring_stop
= jiffies
;
992 if (j
->cadence_f
[4].state
== 1) {
993 if(!j
->cadence_f
[4].on1
) {
994 j
->cadence_f
[4].state
= 7;
995 } else if((time_after(jiffies
, j
->cadence_f
[4].on1min
) &&
996 time_before(jiffies
, j
->cadence_f
[4].on1max
))) {
997 if (j
->cadence_f
[4].off1
) {
998 j
->cadence_f
[4].state
= 2;
999 j
->cadence_f
[4].off1min
= jiffies
+ (long)((j
->cadence_f
[4].off1
* (hertz
* (100 - var
)) / 10000));
1000 j
->cadence_f
[4].off1dot
= jiffies
+ (long)((j
->cadence_f
[4].off1
* (hertz
* (100)) / 10000));
1001 j
->cadence_f
[4].off1max
= jiffies
+ (long)((j
->cadence_f
[4].off1
* (hertz
* (100 + var
)) / 10000));
1003 j
->cadence_f
[4].state
= 7;
1006 if (ixjdebug
& 0x0008) {
1007 printk(KERN_INFO
"IXJ Ring Cadence fail state = %d /dev/phone%d at %ld should be %d\n",
1008 j
->cadence_f
[4].state
, j
->board
, jiffies
- j
->pstn_prev_rmr
,
1009 j
->cadence_f
[4].on1
);
1011 j
->cadence_f
[4].state
= 0;
1013 } else if (j
->cadence_f
[4].state
== 3) {
1014 if((time_after(jiffies
, j
->cadence_f
[4].on2min
) &&
1015 time_before(jiffies
, j
->cadence_f
[4].on2max
))) {
1016 if (j
->cadence_f
[4].off2
) {
1017 j
->cadence_f
[4].state
= 4;
1018 j
->cadence_f
[4].off2min
= jiffies
+ (long)((j
->cadence_f
[4].off2
* (hertz
* (100 - var
)) / 10000));
1019 j
->cadence_f
[4].off2dot
= jiffies
+ (long)((j
->cadence_f
[4].off2
* (hertz
* (100)) / 10000));
1020 j
->cadence_f
[4].off2max
= jiffies
+ (long)((j
->cadence_f
[4].off2
* (hertz
* (100 + var
)) / 10000));
1022 j
->cadence_f
[4].state
= 7;
1025 if (ixjdebug
& 0x0008) {
1026 printk(KERN_INFO
"IXJ Ring Cadence fail state = %d /dev/phone%d at %ld should be %d\n",
1027 j
->cadence_f
[4].state
, j
->board
, jiffies
- j
->pstn_prev_rmr
,
1028 j
->cadence_f
[4].on2
);
1030 j
->cadence_f
[4].state
= 0;
1032 } else if (j
->cadence_f
[4].state
== 5) {
1033 if((time_after(jiffies
, j
->cadence_f
[4].on3min
) &&
1034 time_before(jiffies
, j
->cadence_f
[4].on3max
))) {
1035 if (j
->cadence_f
[4].off3
) {
1036 j
->cadence_f
[4].state
= 6;
1037 j
->cadence_f
[4].off3min
= jiffies
+ (long)((j
->cadence_f
[4].off3
* (hertz
* (100 - var
)) / 10000));
1038 j
->cadence_f
[4].off3dot
= jiffies
+ (long)((j
->cadence_f
[4].off3
* (hertz
* (100)) / 10000));
1039 j
->cadence_f
[4].off3max
= jiffies
+ (long)((j
->cadence_f
[4].off3
* (hertz
* (100 + var
)) / 10000));
1041 j
->cadence_f
[4].state
= 7;
1044 j
->cadence_f
[4].state
= 0;
1047 if (ixjdebug
& 0x0008) {
1048 printk(KERN_INFO
"IXJ Ring Cadence fail state = %d /dev/phone%d at %ld should be %d\n",
1049 j
->cadence_f
[4].state
, j
->board
, jiffies
- j
->pstn_prev_rmr
,
1050 j
->cadence_f
[4].on3
);
1052 j
->cadence_f
[4].state
= 0;
1055 if (ixjdebug
& 0x0010) {
1056 printk(KERN_INFO
"IXJ Ring Cadence b state = %d /dev/phone%d at %ld\n", j
->cadence_f
[4].state
, j
->board
, jiffies
);
1058 if (ixjdebug
& 0x0010) {
1059 switch(j
->cadence_f
[4].state
) {
1061 printk(KERN_INFO
"IXJ /dev/phone%d Next Ring Cadence state at %u min %ld - %ld - max %ld\n", j
->board
,
1062 j
->cadence_f
[4].on1
, j
->cadence_f
[4].on1min
, j
->cadence_f
[4].on1dot
, j
->cadence_f
[4].on1max
);
1065 printk(KERN_INFO
"IXJ /dev/phone%d Next Ring Cadence state at %u min %ld - %ld - max %ld\n", j
->board
,
1066 j
->cadence_f
[4].off1
, j
->cadence_f
[4].off1min
, j
->cadence_f
[4].off1dot
, j
->cadence_f
[4].off1max
);
1069 printk(KERN_INFO
"IXJ /dev/phone%d Next Ring Cadence state at %u min %ld - %ld - max %ld\n", j
->board
,
1070 j
->cadence_f
[4].on2
, j
->cadence_f
[4].on2min
, j
->cadence_f
[4].on2dot
, j
->cadence_f
[4].on2max
);
1073 printk(KERN_INFO
"IXJ /dev/phone%d Next Ring Cadence state at %u min %ld - %ld - max %ld\n", j
->board
,
1074 j
->cadence_f
[4].off2
, j
->cadence_f
[4].off2min
, j
->cadence_f
[4].off2dot
, j
->cadence_f
[4].off2max
);
1077 printk(KERN_INFO
"IXJ /dev/phone%d Next Ring Cadence state at %u min %ld - %ld - max %ld\n", j
->board
,
1078 j
->cadence_f
[4].on3
, j
->cadence_f
[4].on3min
, j
->cadence_f
[4].on3dot
, j
->cadence_f
[4].on3max
);
1081 printk(KERN_INFO
"IXJ /dev/phone%d Next Ring Cadence state at %u min %ld - %ld - max %ld\n", j
->board
,
1082 j
->cadence_f
[4].off3
, j
->cadence_f
[4].off3min
, j
->cadence_f
[4].off3dot
, j
->cadence_f
[4].off3max
);
1087 if (j
->cadence_f
[4].state
== 7) {
1088 j
->cadence_f
[4].state
= 0;
1089 j
->pstn_ring_stop
= jiffies
;
1090 j
->ex
.bits
.pstn_ring
= 1;
1091 ixj_kill_fasync(j
, SIG_PSTN_RING
, POLL_IN
);
1092 if(ixjdebug
& 0x0008) {
1093 printk(KERN_INFO
"IXJ Ring int set /dev/phone%d at %ld\n", j
->board
, jiffies
);
1096 if((j
->pstn_ring_int
!= 0 && time_after(jiffies
, j
->pstn_ring_int
+ (hertz
* 5)) && !j
->flags
.pstn_rmr
) ||
1097 (j
->pstn_ring_stop
!= 0 && time_after(jiffies
, j
->pstn_ring_stop
+ (hertz
* 5)))) {
1098 if(ixjdebug
& 0x0008) {
1099 printk("IXJ DAA no ring in 5 seconds /dev/phone%d at %ld\n", j
->board
, jiffies
);
1100 printk("IXJ DAA pstn ring int /dev/phone%d at %ld\n", j
->board
, j
->pstn_ring_int
);
1101 printk("IXJ DAA pstn ring stop /dev/phone%d at %ld\n", j
->board
, j
->pstn_ring_stop
);
1103 j
->pstn_ring_stop
= j
->pstn_ring_int
= 0;
1104 daa_set_mode(j
, SOP_PU_SLEEP
);
1106 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
1107 if (j
->pstn_cid_intr
&& time_after(jiffies
, j
->pstn_cid_received
+ hertz
)) {
1108 ixj_daa_cid_read(j
);
1109 j
->ex
.bits
.caller_id
= 1;
1110 ixj_kill_fasync(j
, SIG_CALLER_ID
, POLL_IN
);
1111 j
->pstn_cid_intr
= 0;
1113 if (daaint
.bitreg
.Cadence
) {
1114 if(ixjdebug
& 0x0008) {
1115 printk("IXJ DAA Cadence interrupt going to sleep /dev/phone%d\n", j
->board
);
1117 daa_set_mode(j
, SOP_PU_SLEEP
);
1118 j
->ex
.bits
.pstn_ring
= 0;
1121 case SOP_PU_CONVERSATION
:
1122 if (daaint
.bitreg
.VDD_OK
) {
1123 if(!daaint
.bitreg
.SI_0
) {
1124 if (!j
->pstn_winkstart
) {
1125 if(ixjdebug
& 0x0008) {
1126 printk("IXJ DAA possible wink /dev/phone%d %ld\n", j
->board
, jiffies
);
1128 j
->pstn_winkstart
= jiffies
;
1131 if (j
->pstn_winkstart
) {
1132 if(ixjdebug
& 0x0008) {
1133 printk("IXJ DAA possible wink end /dev/phone%d %ld\n", j
->board
, jiffies
);
1135 j
->pstn_winkstart
= 0;
1139 if (j
->pstn_winkstart
&& time_after(jiffies
, j
->pstn_winkstart
+ ((hertz
* j
->winktime
) / 1000))) {
1140 if(ixjdebug
& 0x0008) {
1141 printk("IXJ DAA wink detected going to sleep /dev/phone%d %ld\n", j
->board
, jiffies
);
1143 daa_set_mode(j
, SOP_PU_SLEEP
);
1144 j
->pstn_winkstart
= 0;
1145 j
->ex
.bits
.pstn_wink
= 1;
1146 ixj_kill_fasync(j
, SIG_PSTN_WINK
, POLL_IN
);
1152 static void ixj_timeout(unsigned long ptr
)
1155 unsigned long jifon
;
1156 IXJ
*j
= (IXJ
*)ptr
;
1159 if (j
->DSPbase
&& atomic_read(&j
->DSPWrite
) == 0 && test_and_set_bit(board
, (void *)&j
->busyflags
) == 0) {
1160 ixj_perfmon(j
->timerchecks
);
1161 j
->hookstate
= ixj_hookstate(j
);
1162 if (j
->tone_state
) {
1163 if (!(j
->hookstate
)) {
1167 j
->ex
.bits
.hookstate
= 1;
1168 ixj_kill_fasync(j
, SIG_HOOKSTATE
, POLL_IN
);
1170 clear_bit(board
, &j
->busyflags
);
1174 if (j
->tone_state
== 1)
1175 jifon
= ((hertz
* j
->tone_on_time
) * 25 / 100000);
1177 jifon
= ((hertz
* j
->tone_on_time
) * 25 / 100000) + ((hertz
* j
->tone_off_time
) * 25 / 100000);
1178 if (time_before(jiffies
, j
->tone_start_jif
+ jifon
)) {
1179 if (j
->tone_state
== 1) {
1180 ixj_play_tone(j
, j
->tone_index
);
1181 if (j
->dsp
.low
== 0x20) {
1182 clear_bit(board
, &j
->busyflags
);
1187 ixj_play_tone(j
, 0);
1188 if (j
->dsp
.low
== 0x20) {
1189 clear_bit(board
, &j
->busyflags
);
1195 ixj_tone_timeout(j
);
1196 if (j
->flags
.dialtone
) {
1199 if (j
->flags
.busytone
) {
1201 if (j
->dsp
.low
== 0x20) {
1202 clear_bit(board
, &j
->busyflags
);
1207 if (j
->flags
.ringback
) {
1209 if (j
->dsp
.low
== 0x20) {
1210 clear_bit(board
, &j
->busyflags
);
1215 if (!j
->tone_state
) {
1220 if (!(j
->tone_state
&& j
->dsp
.low
== 0x20)) {
1228 if (j
->flags
.cringing
) {
1229 if (j
->hookstate
& 1) {
1230 j
->flags
.cringing
= 0;
1232 } else if(j
->cadence_f
[5].enable
&& ((!j
->cadence_f
[5].en_filter
) || (j
->cadence_f
[5].en_filter
&& j
->flags
.firstring
))) {
1233 switch(j
->cadence_f
[5].state
) {
1235 j
->cadence_f
[5].on1dot
= jiffies
+ (long)((j
->cadence_f
[5].on1
* (hertz
* 100) / 10000));
1236 if (time_before(jiffies
, j
->cadence_f
[5].on1dot
)) {
1237 if(ixjdebug
& 0x0004) {
1238 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1242 j
->cadence_f
[5].state
= 1;
1245 if (time_after(jiffies
, j
->cadence_f
[5].on1dot
)) {
1246 j
->cadence_f
[5].off1dot
= jiffies
+ (long)((j
->cadence_f
[5].off1
* (hertz
* 100) / 10000));
1247 if(ixjdebug
& 0x0004) {
1248 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1251 j
->cadence_f
[5].state
= 2;
1255 if (time_after(jiffies
, j
->cadence_f
[5].off1dot
)) {
1256 if(ixjdebug
& 0x0004) {
1257 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1260 if (j
->cadence_f
[5].on2
) {
1261 j
->cadence_f
[5].on2dot
= jiffies
+ (long)((j
->cadence_f
[5].on2
* (hertz
* 100) / 10000));
1262 j
->cadence_f
[5].state
= 3;
1264 j
->cadence_f
[5].state
= 7;
1269 if (time_after(jiffies
, j
->cadence_f
[5].on2dot
)) {
1270 if(ixjdebug
& 0x0004) {
1271 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1274 if (j
->cadence_f
[5].off2
) {
1275 j
->cadence_f
[5].off2dot
= jiffies
+ (long)((j
->cadence_f
[5].off2
* (hertz
* 100) / 10000));
1276 j
->cadence_f
[5].state
= 4;
1278 j
->cadence_f
[5].state
= 7;
1283 if (time_after(jiffies
, j
->cadence_f
[5].off2dot
)) {
1284 if(ixjdebug
& 0x0004) {
1285 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1288 if (j
->cadence_f
[5].on3
) {
1289 j
->cadence_f
[5].on3dot
= jiffies
+ (long)((j
->cadence_f
[5].on3
* (hertz
* 100) / 10000));
1290 j
->cadence_f
[5].state
= 5;
1292 j
->cadence_f
[5].state
= 7;
1297 if (time_after(jiffies
, j
->cadence_f
[5].on3dot
)) {
1298 if(ixjdebug
& 0x0004) {
1299 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1302 if (j
->cadence_f
[5].off3
) {
1303 j
->cadence_f
[5].off3dot
= jiffies
+ (long)((j
->cadence_f
[5].off3
* (hertz
* 100) / 10000));
1304 j
->cadence_f
[5].state
= 6;
1306 j
->cadence_f
[5].state
= 7;
1311 if (time_after(jiffies
, j
->cadence_f
[5].off3dot
)) {
1312 if(ixjdebug
& 0x0004) {
1313 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1315 j
->cadence_f
[5].state
= 7;
1319 if(ixjdebug
& 0x0004) {
1320 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1322 j
->flags
.cidring
= 1;
1323 j
->cadence_f
[5].state
= 0;
1326 if (j
->flags
.cidring
&& !j
->flags
.cidsent
) {
1327 j
->flags
.cidsent
= 1;
1329 SLIC_SetState(PLD_SLIC_STATE_OHT
, j
);
1332 j
->flags
.cidring
= 0;
1334 clear_bit(board
, &j
->busyflags
);
1338 if (time_after(jiffies
, j
->ring_cadence_jif
+ (hertz
/ 2))) {
1339 if (j
->flags
.cidring
&& !j
->flags
.cidsent
) {
1340 j
->flags
.cidsent
= 1;
1342 SLIC_SetState(PLD_SLIC_STATE_OHT
, j
);
1345 j
->flags
.cidring
= 0;
1347 j
->ring_cadence_t
--;
1348 if (j
->ring_cadence_t
== -1)
1349 j
->ring_cadence_t
= 15;
1350 j
->ring_cadence_jif
= jiffies
;
1352 if (j
->ring_cadence
& 1 << j
->ring_cadence_t
) {
1353 if(j
->flags
.cidsent
&& j
->cadence_f
[5].en_filter
)
1354 j
->flags
.firstring
= 1;
1359 if(!j
->flags
.cidsent
)
1360 j
->flags
.cidring
= 1;
1363 clear_bit(board
, &j
->busyflags
);
1368 if (!j
->flags
.ringing
) {
1369 if (j
->hookstate
) { /* & 1) { */
1370 if (j
->dsp
.low
!= 0x20 &&
1371 SLIC_GetState(j
) != PLD_SLIC_STATE_ACTIVE
) {
1372 SLIC_SetState(PLD_SLIC_STATE_ACTIVE
, j
);
1376 ixj_WriteDSPCommand(0x511B, j
);
1377 j
->proc_load
= j
->ssr
.high
<< 8 | j
->ssr
.low
;
1378 if (!j
->m_hook
&& (j
->hookstate
& 1)) {
1379 j
->m_hook
= j
->ex
.bits
.hookstate
= 1;
1380 ixj_kill_fasync(j
, SIG_HOOKSTATE
, POLL_IN
);
1383 if (j
->ex
.bits
.dtmf_ready
) {
1384 j
->dtmf_wp
= j
->dtmf_rp
= j
->ex
.bits
.dtmf_ready
= 0;
1388 j
->ex
.bits
.hookstate
= 1;
1389 ixj_kill_fasync(j
, SIG_HOOKSTATE
, POLL_IN
);
1393 if (j
->cardtype
== QTI_LINEJACK
&& !j
->flags
.pstncheck
&& j
->flags
.pstn_present
) {
1397 wake_up_interruptible(&j
->poll_q
); /* Wake any blocked selects */
1399 clear_bit(board
, &j
->busyflags
);
1404 static int ixj_status_wait(IXJ
*j
)
1408 jif
= jiffies
+ ((60 * hertz
) / 100);
1409 while (!IsStatusReady(j
)) {
1410 ixj_perfmon(j
->statuswait
);
1411 if (time_after(jiffies
, jif
)) {
1412 ixj_perfmon(j
->statuswaitfail
);
1419 static int ixj_PCcontrol_wait(IXJ
*j
)
1423 jif
= jiffies
+ ((60 * hertz
) / 100);
1424 while (!IsPCControlReady(j
)) {
1425 ixj_perfmon(j
->pcontrolwait
);
1426 if (time_after(jiffies
, jif
)) {
1427 ixj_perfmon(j
->pcontrolwaitfail
);
1434 static int ixj_WriteDSPCommand(unsigned short cmd
, IXJ
*j
)
1439 atomic_inc(&j
->DSPWrite
);
1440 if(atomic_read(&j
->DSPWrite
) > 1) {
1441 printk("IXJ %d DSP write overlap attempting command 0x%4.4x\n", j
->board
, cmd
);
1444 bytes
.high
= (cmd
& 0xFF00) >> 8;
1445 bytes
.low
= cmd
& 0x00FF;
1446 jif
= jiffies
+ ((60 * hertz
) / 100);
1447 while (!IsControlReady(j
)) {
1448 ixj_perfmon(j
->iscontrolready
);
1449 if (time_after(jiffies
, jif
)) {
1450 ixj_perfmon(j
->iscontrolreadyfail
);
1451 atomic_dec(&j
->DSPWrite
);
1452 if(atomic_read(&j
->DSPWrite
) > 0) {
1453 printk("IXJ %d DSP overlaped command 0x%4.4x during control ready failure.\n", j
->board
, cmd
);
1454 while(atomic_read(&j
->DSPWrite
) > 0) {
1455 atomic_dec(&j
->DSPWrite
);
1461 outb(bytes
.low
, j
->DSPbase
+ 6);
1462 outb(bytes
.high
, j
->DSPbase
+ 7);
1464 if (ixj_status_wait(j
)) {
1467 atomic_dec(&j
->DSPWrite
);
1468 if(atomic_read(&j
->DSPWrite
) > 0) {
1469 printk("IXJ %d DSP overlaped command 0x%4.4x during status wait failure.\n", j
->board
, cmd
);
1470 while(atomic_read(&j
->DSPWrite
) > 0) {
1471 atomic_dec(&j
->DSPWrite
);
1476 /* Read Software Status Register */
1477 j
->ssr
.low
= inb_p(j
->DSPbase
+ 2);
1478 j
->ssr
.high
= inb_p(j
->DSPbase
+ 3);
1479 atomic_dec(&j
->DSPWrite
);
1480 if(atomic_read(&j
->DSPWrite
) > 0) {
1481 printk("IXJ %d DSP overlaped command 0x%4.4x\n", j
->board
, cmd
);
1482 while(atomic_read(&j
->DSPWrite
) > 0) {
1483 atomic_dec(&j
->DSPWrite
);
1489 /***************************************************************************
1491 * General Purpose IO Register read routine
1493 ***************************************************************************/
1494 static inline int ixj_gpio_read(IXJ
*j
)
1496 if (ixj_WriteDSPCommand(0x5143, j
))
1499 j
->gpio
.bytes
.low
= j
->ssr
.low
;
1500 j
->gpio
.bytes
.high
= j
->ssr
.high
;
1505 static inline void LED_SetState(int state
, IXJ
*j
)
1507 if (j
->cardtype
== QTI_LINEJACK
) {
1508 j
->pld_scrw
.bits
.led1
= state
& 0x1 ? 1 : 0;
1509 j
->pld_scrw
.bits
.led2
= state
& 0x2 ? 1 : 0;
1510 j
->pld_scrw
.bits
.led3
= state
& 0x4 ? 1 : 0;
1511 j
->pld_scrw
.bits
.led4
= state
& 0x8 ? 1 : 0;
1513 outb(j
->pld_scrw
.byte
, j
->XILINXbase
);
1517 /*********************************************************************
1518 * GPIO Pins are configured as follows on the Quicknet Internet
1519 * PhoneJACK Telephony Cards
1521 * POTS Select GPIO_6=0 GPIO_7=0
1522 * Mic/Speaker Select GPIO_6=0 GPIO_7=1
1523 * Handset Select GPIO_6=1 GPIO_7=0
1525 * SLIC Active GPIO_1=0 GPIO_2=1 GPIO_5=0
1526 * SLIC Ringing GPIO_1=1 GPIO_2=1 GPIO_5=0
1527 * SLIC Open Circuit GPIO_1=0 GPIO_2=0 GPIO_5=0
1529 * Hook Switch changes reported on GPIO_3
1530 *********************************************************************/
1531 static int ixj_set_port(IXJ
*j
, int arg
)
1533 if (j
->cardtype
== QTI_PHONEJACK_LITE
) {
1534 if (arg
!= PORT_POTS
)
1541 j
->port
= PORT_POTS
;
1542 switch (j
->cardtype
) {
1544 if (j
->flags
.pcmciasct
== 1)
1545 SLIC_SetState(PLD_SLIC_STATE_ACTIVE
, j
);
1549 case QTI_PHONEJACK_PCI
:
1550 j
->pld_slicw
.pcib
.mic
= 0;
1551 j
->pld_slicw
.pcib
.spk
= 0;
1552 outb(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
1555 ixj_set_pots(j
, 0); /* Disconnect POTS/PSTN relay */
1556 if (ixj_WriteDSPCommand(0xC528, j
)) /* Write CODEC config to
1557 Software Control Register */
1559 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
1561 outb(j
->pld_scrw
.byte
, j
->XILINXbase
);
1562 j
->pld_clock
.byte
= 0;
1563 outb(j
->pld_clock
.byte
, j
->XILINXbase
+ 0x04);
1564 j
->pld_slicw
.bits
.rly1
= 1;
1565 j
->pld_slicw
.bits
.spken
= 0;
1566 outb(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
1567 ixj_mixer(0x1200, j
); /* Turn Off MIC switch on mixer left */
1568 ixj_mixer(0x1401, j
); /* Turn On Mono1 switch on mixer left */
1569 ixj_mixer(0x1300, j
); /* Turn Off MIC switch on mixer right */
1570 ixj_mixer(0x1501, j
); /* Turn On Mono1 switch on mixer right */
1571 ixj_mixer(0x0E80, j
); /*Mic mute */
1572 ixj_mixer(0x0F00, j
); /* Set mono out (SLIC) to 0dB */
1573 ixj_mixer(0x0080, j
); /* Mute Master Left volume */
1574 ixj_mixer(0x0180, j
); /* Mute Master Right volume */
1575 SLIC_SetState(PLD_SLIC_STATE_STANDBY
, j
);
1576 /* SLIC_SetState(PLD_SLIC_STATE_ACTIVE, j); */
1579 j
->gpio
.bytes
.high
= 0x0B;
1580 j
->gpio
.bits
.gpio6
= 0;
1581 j
->gpio
.bits
.gpio7
= 0;
1582 ixj_WriteDSPCommand(j
->gpio
.word
, j
);
1587 if (j
->cardtype
== QTI_LINEJACK
) {
1588 ixj_WriteDSPCommand(0xC534, j
); /* Write CODEC config to Software Control Register */
1590 j
->pld_slicw
.bits
.rly3
= 0;
1591 j
->pld_slicw
.bits
.rly1
= 1;
1592 j
->pld_slicw
.bits
.spken
= 0;
1593 outb(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
1594 j
->port
= PORT_PSTN
;
1600 j
->port
= PORT_SPEAKER
;
1601 switch (j
->cardtype
) {
1603 if (j
->flags
.pcmciasct
) {
1604 SLIC_SetState(PLD_SLIC_STATE_OC
, j
);
1607 case QTI_PHONEJACK_PCI
:
1608 j
->pld_slicw
.pcib
.mic
= 1;
1609 j
->pld_slicw
.pcib
.spk
= 1;
1610 outb(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
1613 ixj_set_pots(j
, 0); /* Disconnect POTS/PSTN relay */
1614 if (ixj_WriteDSPCommand(0xC528, j
)) /* Write CODEC config to
1615 Software Control Register */
1617 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
1619 outb(j
->pld_scrw
.byte
, j
->XILINXbase
);
1620 j
->pld_clock
.byte
= 0;
1621 outb(j
->pld_clock
.byte
, j
->XILINXbase
+ 0x04);
1622 j
->pld_slicw
.bits
.rly1
= 1;
1623 j
->pld_slicw
.bits
.spken
= 1;
1624 outb(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
1625 ixj_mixer(0x1201, j
); /* Turn On MIC switch on mixer left */
1626 ixj_mixer(0x1400, j
); /* Turn Off Mono1 switch on mixer left */
1627 ixj_mixer(0x1301, j
); /* Turn On MIC switch on mixer right */
1628 ixj_mixer(0x1500, j
); /* Turn Off Mono1 switch on mixer right */
1629 ixj_mixer(0x0E06, j
); /*Mic un-mute 0dB */
1630 ixj_mixer(0x0F80, j
); /* Mute mono out (SLIC) */
1631 ixj_mixer(0x0000, j
); /* Set Master Left volume to 0dB */
1632 ixj_mixer(0x0100, j
); /* Set Master Right volume to 0dB */
1635 j
->gpio
.bytes
.high
= 0x0B;
1636 j
->gpio
.bits
.gpio6
= 0;
1637 j
->gpio
.bits
.gpio7
= 1;
1638 ixj_WriteDSPCommand(j
->gpio
.word
, j
);
1643 if (j
->cardtype
!= QTI_PHONEJACK
) {
1646 j
->gpio
.bytes
.high
= 0x0B;
1647 j
->gpio
.bits
.gpio6
= 1;
1648 j
->gpio
.bits
.gpio7
= 0;
1649 ixj_WriteDSPCommand(j
->gpio
.word
, j
);
1650 j
->port
= PORT_HANDSET
;
1660 static int ixj_set_pots(IXJ
*j
, int arg
)
1662 if (j
->cardtype
== QTI_LINEJACK
) {
1664 if (j
->port
== PORT_PSTN
) {
1665 j
->pld_slicw
.bits
.rly1
= 0;
1666 outb(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
1667 j
->flags
.pots_pstn
= 1;
1670 j
->flags
.pots_pstn
= 0;
1674 j
->pld_slicw
.bits
.rly1
= 1;
1675 outb(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
1676 j
->flags
.pots_pstn
= 0;
1684 static void ixj_ring_on(IXJ
*j
)
1686 if (j
->dsp
.low
== 0x20) /* Internet PhoneJACK */
1688 if (ixjdebug
& 0x0004)
1689 printk(KERN_INFO
"IXJ Ring On /dev/phone%d\n", j
->board
);
1691 j
->gpio
.bytes
.high
= 0x0B;
1692 j
->gpio
.bytes
.low
= 0x00;
1693 j
->gpio
.bits
.gpio1
= 1;
1694 j
->gpio
.bits
.gpio2
= 1;
1695 j
->gpio
.bits
.gpio5
= 0;
1696 ixj_WriteDSPCommand(j
->gpio
.word
, j
); /* send the ring signal */
1697 } else /* Internet LineJACK, Internet PhoneJACK Lite or Internet PhoneJACK PCI */
1699 if (ixjdebug
& 0x0004)
1700 printk(KERN_INFO
"IXJ Ring On /dev/phone%d\n", j
->board
);
1702 SLIC_SetState(PLD_SLIC_STATE_RINGING
, j
);
1706 static int ixj_siadc(IXJ
*j
, int val
)
1708 if(j
->cardtype
== QTI_PHONECARD
){
1709 if(j
->flags
.pcmciascp
){
1711 return j
->siadc
.bits
.rxg
;
1713 if(val
< 0 || val
> 0x1F)
1716 j
->siadc
.bits
.hom
= 0; /* Handset Out Mute */
1717 j
->siadc
.bits
.lom
= 0; /* Line Out Mute */
1718 j
->siadc
.bits
.rxg
= val
; /*(0xC000 - 0x41C8) / 0x4EF; RX PGA Gain */
1719 j
->psccr
.bits
.addr
= 6; /* R/W Smart Cable Register Address */
1720 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1721 j
->psccr
.bits
.dev
= 0;
1722 outb(j
->siadc
.byte
, j
->XILINXbase
+ 0x00);
1723 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1724 ixj_PCcontrol_wait(j
);
1725 return j
->siadc
.bits
.rxg
;
1731 static int ixj_sidac(IXJ
*j
, int val
)
1733 if(j
->cardtype
== QTI_PHONECARD
){
1734 if(j
->flags
.pcmciascp
){
1736 return j
->sidac
.bits
.txg
;
1738 if(val
< 0 || val
> 0x1F)
1741 j
->sidac
.bits
.srm
= 1; /* Speaker Right Mute */
1742 j
->sidac
.bits
.slm
= 1; /* Speaker Left Mute */
1743 j
->sidac
.bits
.txg
= val
; /* (0xC000 - 0x45E4) / 0x5D3; TX PGA Gain */
1744 j
->psccr
.bits
.addr
= 7; /* R/W Smart Cable Register Address */
1745 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1746 j
->psccr
.bits
.dev
= 0;
1747 outb(j
->sidac
.byte
, j
->XILINXbase
+ 0x00);
1748 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1749 ixj_PCcontrol_wait(j
);
1750 return j
->sidac
.bits
.txg
;
1756 static int ixj_pcmcia_cable_check(IXJ
*j
)
1758 j
->pccr1
.byte
= inb_p(j
->XILINXbase
+ 0x03);
1759 if (!j
->flags
.pcmciastate
) {
1760 j
->pccr2
.byte
= inb_p(j
->XILINXbase
+ 0x02);
1761 if (j
->pccr1
.bits
.drf
|| j
->pccr2
.bits
.rstc
) {
1762 j
->flags
.pcmciastate
= 4;
1765 if (j
->pccr1
.bits
.ed
) {
1766 j
->pccr1
.bits
.ed
= 0;
1767 j
->psccr
.bits
.dev
= 3;
1768 j
->psccr
.bits
.rw
= 1;
1769 outw_p(j
->psccr
.byte
<< 8, j
->XILINXbase
+ 0x00);
1770 ixj_PCcontrol_wait(j
);
1771 j
->pslic
.byte
= inw_p(j
->XILINXbase
+ 0x00) & 0xFF;
1772 j
->pslic
.bits
.led2
= j
->pslic
.bits
.det
? 1 : 0;
1773 j
->psccr
.bits
.dev
= 3;
1774 j
->psccr
.bits
.rw
= 0;
1775 outw_p(j
->psccr
.byte
<< 8 | j
->pslic
.byte
, j
->XILINXbase
+ 0x00);
1776 ixj_PCcontrol_wait(j
);
1777 return j
->pslic
.bits
.led2
? 1 : 0;
1778 } else if (j
->flags
.pcmciasct
) {
1783 } else if (j
->flags
.pcmciastate
== 4) {
1784 if (!j
->pccr1
.bits
.drf
) {
1785 j
->flags
.pcmciastate
= 3;
1788 } else if (j
->flags
.pcmciastate
== 3) {
1789 j
->pccr2
.bits
.pwr
= 0;
1790 j
->pccr2
.bits
.rstc
= 1;
1791 outb(j
->pccr2
.byte
, j
->XILINXbase
+ 0x02);
1792 j
->checkwait
= jiffies
+ (hertz
* 2);
1793 j
->flags
.incheck
= 1;
1794 j
->flags
.pcmciastate
= 2;
1796 } else if (j
->flags
.pcmciastate
== 2) {
1797 if (j
->flags
.incheck
) {
1798 if (time_before(jiffies
, j
->checkwait
)) {
1801 j
->flags
.incheck
= 0;
1804 j
->pccr2
.bits
.pwr
= 0;
1805 j
->pccr2
.bits
.rstc
= 0;
1806 outb_p(j
->pccr2
.byte
, j
->XILINXbase
+ 0x02);
1807 j
->flags
.pcmciastate
= 1;
1809 } else if (j
->flags
.pcmciastate
== 1) {
1810 j
->flags
.pcmciastate
= 0;
1811 if (!j
->pccr1
.bits
.drf
) {
1812 j
->psccr
.bits
.dev
= 3;
1813 j
->psccr
.bits
.rw
= 1;
1814 outb_p(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1815 ixj_PCcontrol_wait(j
);
1816 j
->flags
.pcmciascp
= 1; /* Set Cable Present Flag */
1818 j
->flags
.pcmciasct
= (inw_p(j
->XILINXbase
+ 0x00) >> 8) & 0x03; /* Get Cable Type */
1820 if (j
->flags
.pcmciasct
== 3) {
1821 j
->flags
.pcmciastate
= 4;
1823 } else if (j
->flags
.pcmciasct
== 0) {
1824 j
->pccr2
.bits
.pwr
= 1;
1825 j
->pccr2
.bits
.rstc
= 0;
1826 outb_p(j
->pccr2
.byte
, j
->XILINXbase
+ 0x02);
1827 j
->port
= PORT_SPEAKER
;
1829 j
->port
= PORT_POTS
;
1831 j
->sic1
.bits
.cpd
= 0; /* Chip Power Down */
1832 j
->sic1
.bits
.mpd
= 0; /* MIC Bias Power Down */
1833 j
->sic1
.bits
.hpd
= 0; /* Handset Bias Power Down */
1834 j
->sic1
.bits
.lpd
= 0; /* Line Bias Power Down */
1835 j
->sic1
.bits
.spd
= 1; /* Speaker Drive Power Down */
1836 j
->psccr
.bits
.addr
= 1; /* R/W Smart Cable Register Address */
1837 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1838 j
->psccr
.bits
.dev
= 0;
1839 outb(j
->sic1
.byte
, j
->XILINXbase
+ 0x00);
1840 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1841 ixj_PCcontrol_wait(j
);
1843 j
->sic2
.bits
.al
= 0; /* Analog Loopback DAC analog -> ADC analog */
1844 j
->sic2
.bits
.dl2
= 0; /* Digital Loopback DAC -> ADC one bit */
1845 j
->sic2
.bits
.dl1
= 0; /* Digital Loopback ADC -> DAC one bit */
1846 j
->sic2
.bits
.pll
= 0; /* 1 = div 10, 0 = div 5 */
1847 j
->sic2
.bits
.hpd
= 0; /* HPF disable */
1848 j
->psccr
.bits
.addr
= 2; /* R/W Smart Cable Register Address */
1849 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1850 j
->psccr
.bits
.dev
= 0;
1851 outb(j
->sic2
.byte
, j
->XILINXbase
+ 0x00);
1852 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1853 ixj_PCcontrol_wait(j
);
1855 j
->psccr
.bits
.addr
= 3; /* R/W Smart Cable Register Address */
1856 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1857 j
->psccr
.bits
.dev
= 0;
1858 outb(0x00, j
->XILINXbase
+ 0x00); /* PLL Divide N1 */
1859 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1860 ixj_PCcontrol_wait(j
);
1862 j
->psccr
.bits
.addr
= 4; /* R/W Smart Cable Register Address */
1863 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1864 j
->psccr
.bits
.dev
= 0;
1865 outb(0x09, j
->XILINXbase
+ 0x00); /* PLL Multiply M1 */
1866 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1867 ixj_PCcontrol_wait(j
);
1869 j
->sirxg
.bits
.lig
= 1; /* Line In Gain */
1870 j
->sirxg
.bits
.lim
= 1; /* Line In Mute */
1871 j
->sirxg
.bits
.mcg
= 0; /* MIC In Gain was 3 */
1872 j
->sirxg
.bits
.mcm
= 0; /* MIC In Mute */
1873 j
->sirxg
.bits
.him
= 0; /* Handset In Mute */
1874 j
->sirxg
.bits
.iir
= 1; /* IIR */
1875 j
->psccr
.bits
.addr
= 5; /* R/W Smart Cable Register Address */
1876 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1877 j
->psccr
.bits
.dev
= 0;
1878 outb(j
->sirxg
.byte
, j
->XILINXbase
+ 0x00);
1879 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1880 ixj_PCcontrol_wait(j
);
1885 j
->siaatt
.bits
.sot
= 0;
1886 j
->psccr
.bits
.addr
= 9; /* R/W Smart Cable Register Address */
1887 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1888 j
->psccr
.bits
.dev
= 0;
1889 outb(j
->siaatt
.byte
, j
->XILINXbase
+ 0x00);
1890 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1891 ixj_PCcontrol_wait(j
);
1893 if (j
->flags
.pcmciasct
== 1 && !j
->readers
&& !j
->writers
) {
1894 j
->psccr
.byte
= j
->pslic
.byte
= 0;
1895 j
->pslic
.bits
.powerdown
= 1;
1896 j
->psccr
.bits
.dev
= 3;
1897 j
->psccr
.bits
.rw
= 0;
1898 outw_p(j
->psccr
.byte
<< 8 | j
->pslic
.byte
, j
->XILINXbase
+ 0x00);
1899 ixj_PCcontrol_wait(j
);
1904 j
->flags
.pcmciascp
= 0;
1910 static int ixj_hookstate(IXJ
*j
)
1914 switch (j
->cardtype
) {
1917 fOffHook
= j
->gpio
.bits
.gpio3read
? 1 : 0;
1920 case QTI_PHONEJACK_LITE
:
1921 case QTI_PHONEJACK_PCI
:
1923 if(j
->cardtype
== QTI_LINEJACK
&& j
->flags
.pots_pstn
== 1 && (j
->readers
|| j
->writers
)) {
1924 fOffHook
= j
->pld_slicr
.bits
.potspstn
? 1 : 0;
1925 if(fOffHook
!= j
->p_hook
) {
1927 j
->checkwait
= jiffies
;
1929 if(time_before(jiffies
, j
->checkwait
+ 2)) {
1934 j
->p_hook
= fOffHook
;
1935 printk("IXJ : /dev/phone%d pots-pstn hookstate check %d at %ld\n", j
->board
, fOffHook
, jiffies
);
1938 if (j
->pld_slicr
.bits
.state
== PLD_SLIC_STATE_ACTIVE
||
1939 j
->pld_slicr
.bits
.state
== PLD_SLIC_STATE_STANDBY
) {
1940 if (j
->flags
.ringing
|| j
->flags
.cringing
) {
1941 if (!in_interrupt()) {
1945 if (j
->pld_slicr
.bits
.state
== PLD_SLIC_STATE_RINGING
) {
1949 if (j
->cardtype
== QTI_PHONEJACK_PCI
) {
1950 j
->pld_scrr
.byte
= inb_p(j
->XILINXbase
);
1951 fOffHook
= j
->pld_scrr
.pcib
.det
? 1 : 0;
1953 fOffHook
= j
->pld_slicr
.bits
.det
? 1 : 0;
1958 fOffHook
= ixj_pcmcia_cable_check(j
);
1961 if (j
->r_hook
!= fOffHook
) {
1962 j
->r_hook
= fOffHook
;
1963 if (j
->port
== PORT_SPEAKER
|| j
->port
== PORT_HANDSET
) { // || (j->port == PORT_PSTN && j->flags.pots_pstn == 0)) {
1964 j
->ex
.bits
.hookstate
= 1;
1965 ixj_kill_fasync(j
, SIG_HOOKSTATE
, POLL_IN
);
1966 } else if (!fOffHook
) {
1967 j
->flash_end
= jiffies
+ ((60 * hertz
) / 100);
1971 if(time_before(jiffies
, j
->flash_end
)) {
1972 j
->ex
.bits
.flash
= 1;
1974 ixj_kill_fasync(j
, SIG_FLASH
, POLL_IN
);
1977 if(time_before(jiffies
, j
->flash_end
)) {
1982 if (j
->port
== PORT_PSTN
&& j
->daa_mode
== SOP_PU_CONVERSATION
)
1985 if (j
->port
== PORT_SPEAKER
) {
1986 if(j
->cardtype
== QTI_PHONECARD
) {
1987 if(j
->flags
.pcmciascp
&& j
->flags
.pcmciasct
) {
1995 if (j
->port
== PORT_HANDSET
)
2001 static void ixj_ring_off(IXJ
*j
)
2003 if (j
->dsp
.low
== 0x20) /* Internet PhoneJACK */
2005 if (ixjdebug
& 0x0004)
2006 printk(KERN_INFO
"IXJ Ring Off\n");
2007 j
->gpio
.bytes
.high
= 0x0B;
2008 j
->gpio
.bytes
.low
= 0x00;
2009 j
->gpio
.bits
.gpio1
= 0;
2010 j
->gpio
.bits
.gpio2
= 1;
2011 j
->gpio
.bits
.gpio5
= 0;
2012 ixj_WriteDSPCommand(j
->gpio
.word
, j
);
2013 } else /* Internet LineJACK */
2015 if (ixjdebug
& 0x0004)
2016 printk(KERN_INFO
"IXJ Ring Off\n");
2018 if(!j
->flags
.cidplay
)
2019 SLIC_SetState(PLD_SLIC_STATE_STANDBY
, j
);
2025 static void ixj_ring_start(IXJ
*j
)
2027 j
->flags
.cringing
= 1;
2028 if (ixjdebug
& 0x0004)
2029 printk(KERN_INFO
"IXJ Cadence Ringing Start /dev/phone%d\n", j
->board
);
2030 if (ixj_hookstate(j
) & 1) {
2031 if (j
->port
== PORT_POTS
)
2033 j
->flags
.cringing
= 0;
2034 if (ixjdebug
& 0x0004)
2035 printk(KERN_INFO
"IXJ Cadence Ringing Stopped /dev/phone%d off hook\n", j
->board
);
2036 } else if(j
->cadence_f
[5].enable
&& (!j
->cadence_f
[5].en_filter
)) {
2037 j
->ring_cadence_jif
= jiffies
;
2038 j
->flags
.cidsent
= j
->flags
.cidring
= 0;
2039 j
->cadence_f
[5].state
= 0;
2040 if(j
->cadence_f
[5].on1
)
2043 j
->ring_cadence_jif
= jiffies
;
2044 j
->ring_cadence_t
= 15;
2045 if (j
->ring_cadence
& 1 << j
->ring_cadence_t
) {
2050 j
->flags
.cidsent
= j
->flags
.cidring
= j
->flags
.firstring
= 0;
2054 static int ixj_ring(IXJ
*j
)
2059 j
->flags
.ringing
= 1;
2060 if (ixj_hookstate(j
) & 1) {
2062 j
->flags
.ringing
= 0;
2065 for (cntr
= 0; cntr
< j
->maxrings
; cntr
++) {
2066 jif
= jiffies
+ (1 * hertz
);
2068 while (time_before(jiffies
, jif
)) {
2069 if (ixj_hookstate(j
) & 1) {
2071 j
->flags
.ringing
= 0;
2074 schedule_timeout_interruptible(1);
2075 if (signal_pending(current
))
2078 jif
= jiffies
+ (3 * hertz
);
2080 while (time_before(jiffies
, jif
)) {
2081 if (ixj_hookstate(j
) & 1) {
2083 if (ixj_hookstate(j
) & 1) {
2084 j
->flags
.ringing
= 0;
2088 schedule_timeout_interruptible(1);
2089 if (signal_pending(current
))
2094 j
->flags
.ringing
= 0;
2098 static int ixj_open(struct phone_device
*p
, struct file
*file_p
)
2100 IXJ
*j
= get_ixj(p
->board
);
2101 file_p
->private_data
= j
;
2106 if (file_p
->f_mode
& FMODE_READ
) {
2114 if (file_p
->f_mode
& FMODE_WRITE
) {
2118 if (file_p
->f_mode
& FMODE_READ
){
2125 if (j
->cardtype
== QTI_PHONECARD
) {
2126 j
->pslic
.bits
.powerdown
= 0;
2127 j
->psccr
.bits
.dev
= 3;
2128 j
->psccr
.bits
.rw
= 0;
2129 outw_p(j
->psccr
.byte
<< 8 | j
->pslic
.byte
, j
->XILINXbase
+ 0x00);
2130 ixj_PCcontrol_wait(j
);
2133 j
->flags
.cidplay
= 0;
2134 j
->flags
.cidcw_ack
= 0;
2136 if (ixjdebug
& 0x0002)
2137 printk(KERN_INFO
"Opening board %d\n", p
->board
);
2139 j
->framesread
= j
->frameswritten
= 0;
2143 static int ixj_release(struct inode
*inode
, struct file
*file_p
)
2147 IXJ
*j
= file_p
->private_data
;
2148 int board
= j
->p
.board
;
2151 * Set up locks to ensure that only one process is talking to the DSP at a time.
2152 * This is necessary to keep the DSP from locking up.
2154 while(test_and_set_bit(board
, (void *)&j
->busyflags
) != 0)
2155 schedule_timeout_interruptible(1);
2156 if (ixjdebug
& 0x0002)
2157 printk(KERN_INFO
"Closing board %d\n", NUM(inode
));
2159 if (j
->cardtype
== QTI_PHONECARD
)
2160 ixj_set_port(j
, PORT_SPEAKER
);
2162 ixj_set_port(j
, PORT_POTS
);
2167 set_play_volume(j
, 0x100);
2168 set_rec_volume(j
, 0x100);
2171 /* Restore the tone table to default settings. */
2177 ixj_init_tone(j
, &ti
);
2183 ixj_init_tone(j
, &ti
);
2189 ixj_init_tone(j
, &ti
);
2195 ixj_init_tone(j
, &ti
);
2201 ixj_init_tone(j
, &ti
);
2207 ixj_init_tone(j
, &ti
);
2213 ixj_init_tone(j
, &ti
);
2219 ixj_init_tone(j
, &ti
);
2225 ixj_init_tone(j
, &ti
);
2231 ixj_init_tone(j
, &ti
);
2237 ixj_init_tone(j
, &ti
);
2243 ixj_init_tone(j
, &ti
);
2249 ixj_init_tone(j
, &ti
);
2255 ixj_init_tone(j
, &ti
);
2261 ixj_init_tone(j
, &ti
);
2267 ixj_init_tone(j
, &ti
);
2273 ixj_init_tone(j
, &ti
);
2279 ixj_init_tone(j
, &ti
);
2281 set_rec_depth(j
, 2); /* Set Record Channel Limit to 2 frames */
2283 set_play_depth(j
, 2); /* Set Playback Channel Limit to 2 frames */
2285 j
->ex
.bits
.dtmf_ready
= 0;
2287 j
->dtmf_wp
= j
->dtmf_rp
= 0;
2288 j
->rec_mode
= j
->play_mode
= -1;
2289 j
->flags
.ringing
= 0;
2290 j
->maxrings
= MAXRINGS
;
2291 j
->ring_cadence
= USA_RING_CADENCE
;
2292 if(j
->cadence_f
[5].enable
) {
2293 j
->cadence_f
[5].enable
= j
->cadence_f
[5].en_filter
= j
->cadence_f
[5].state
= 0;
2297 j
->flags
.dtmf_oob
= 0;
2298 for (cnt
= 0; cnt
< 4; cnt
++)
2299 j
->cadence_f
[cnt
].enable
= 0;
2303 if(j
->cardtype
== QTI_PHONECARD
) {
2304 SLIC_SetState(PLD_SLIC_STATE_OC
, j
);
2307 if (file_p
->f_mode
& FMODE_READ
)
2309 if (file_p
->f_mode
& FMODE_WRITE
)
2312 if (j
->read_buffer
&& !j
->readers
) {
2313 kfree(j
->read_buffer
);
2314 j
->read_buffer
= NULL
;
2315 j
->read_buffer_size
= 0;
2317 if (j
->write_buffer
&& !j
->writers
) {
2318 kfree(j
->write_buffer
);
2319 j
->write_buffer
= NULL
;
2320 j
->write_buffer_size
= 0;
2322 j
->rec_codec
= j
->play_codec
= 0;
2323 j
->rec_frame_size
= j
->play_frame_size
= 0;
2324 j
->flags
.cidsent
= j
->flags
.cidring
= 0;
2325 ixj_fasync(-1, file_p
, 0); /* remove from list of async notification */
2327 if(j
->cardtype
== QTI_LINEJACK
&& !j
->readers
&& !j
->writers
) {
2328 ixj_set_port(j
, PORT_PSTN
);
2329 daa_set_mode(j
, SOP_PU_SLEEP
);
2332 ixj_WriteDSPCommand(0x0FE3, j
); /* Put the DSP in 1/5 power mode. */
2334 /* Set up the default signals for events */
2335 for (cnt
= 0; cnt
< 35; cnt
++)
2336 j
->ixj_signals
[cnt
] = SIGIO
;
2338 /* Set the excetion signal enable flags */
2339 j
->ex_sig
.bits
.dtmf_ready
= j
->ex_sig
.bits
.hookstate
= j
->ex_sig
.bits
.flash
= j
->ex_sig
.bits
.pstn_ring
=
2340 j
->ex_sig
.bits
.caller_id
= j
->ex_sig
.bits
.pstn_wink
= j
->ex_sig
.bits
.f0
= j
->ex_sig
.bits
.f1
= j
->ex_sig
.bits
.f2
=
2341 j
->ex_sig
.bits
.f3
= j
->ex_sig
.bits
.fc0
= j
->ex_sig
.bits
.fc1
= j
->ex_sig
.bits
.fc2
= j
->ex_sig
.bits
.fc3
= 1;
2343 file_p
->private_data
= NULL
;
2344 clear_bit(board
, &j
->busyflags
);
2348 static int read_filters(IXJ
*j
)
2350 unsigned short fc
, cnt
, trg
;
2354 if (ixj_WriteDSPCommand(0x5144, j
)) {
2355 if(ixjdebug
& 0x0001) {
2356 printk(KERN_INFO
"Read Frame Counter failed!\n");
2360 fc
= j
->ssr
.high
<< 8 | j
->ssr
.low
;
2361 if (fc
== j
->frame_count
)
2364 j
->frame_count
= fc
;
2371 for (cnt
= 0; cnt
< 4; cnt
++) {
2372 if (ixj_WriteDSPCommand(0x5154 + cnt
, j
)) {
2373 if(ixjdebug
& 0x0001) {
2374 printk(KERN_INFO
"Select Filter %d failed!\n", cnt
);
2378 if (ixj_WriteDSPCommand(0x515C, j
)) {
2379 if(ixjdebug
& 0x0001) {
2380 printk(KERN_INFO
"Read Filter History %d failed!\n", cnt
);
2384 j
->filter_hist
[cnt
] = j
->ssr
.high
<< 8 | j
->ssr
.low
;
2386 if (j
->cadence_f
[cnt
].enable
) {
2387 if (j
->filter_hist
[cnt
] & 3 && !(j
->filter_hist
[cnt
] & 12)) {
2388 if (j
->cadence_f
[cnt
].state
== 0) {
2389 j
->cadence_f
[cnt
].state
= 1;
2390 j
->cadence_f
[cnt
].on1min
= jiffies
+ (long)((j
->cadence_f
[cnt
].on1
* (hertz
* (100 - var
)) / 10000));
2391 j
->cadence_f
[cnt
].on1dot
= jiffies
+ (long)((j
->cadence_f
[cnt
].on1
* (hertz
* (100)) / 10000));
2392 j
->cadence_f
[cnt
].on1max
= jiffies
+ (long)((j
->cadence_f
[cnt
].on1
* (hertz
* (100 + var
)) / 10000));
2393 } else if (j
->cadence_f
[cnt
].state
== 2 &&
2394 (time_after(jiffies
, j
->cadence_f
[cnt
].off1min
) &&
2395 time_before(jiffies
, j
->cadence_f
[cnt
].off1max
))) {
2396 if (j
->cadence_f
[cnt
].on2
) {
2397 j
->cadence_f
[cnt
].state
= 3;
2398 j
->cadence_f
[cnt
].on2min
= jiffies
+ (long)((j
->cadence_f
[cnt
].on2
* (hertz
* (100 - var
)) / 10000));
2399 j
->cadence_f
[cnt
].on2dot
= jiffies
+ (long)((j
->cadence_f
[cnt
].on2
* (hertz
* (100)) / 10000));
2400 j
->cadence_f
[cnt
].on2max
= jiffies
+ (long)((j
->cadence_f
[cnt
].on2
* (hertz
* (100 + var
)) / 10000));
2402 j
->cadence_f
[cnt
].state
= 7;
2404 } else if (j
->cadence_f
[cnt
].state
== 4 &&
2405 (time_after(jiffies
, j
->cadence_f
[cnt
].off2min
) &&
2406 time_before(jiffies
, j
->cadence_f
[cnt
].off2max
))) {
2407 if (j
->cadence_f
[cnt
].on3
) {
2408 j
->cadence_f
[cnt
].state
= 5;
2409 j
->cadence_f
[cnt
].on3min
= jiffies
+ (long)((j
->cadence_f
[cnt
].on3
* (hertz
* (100 - var
)) / 10000));
2410 j
->cadence_f
[cnt
].on3dot
= jiffies
+ (long)((j
->cadence_f
[cnt
].on3
* (hertz
* (100)) / 10000));
2411 j
->cadence_f
[cnt
].on3max
= jiffies
+ (long)((j
->cadence_f
[cnt
].on3
* (hertz
* (100 + var
)) / 10000));
2413 j
->cadence_f
[cnt
].state
= 7;
2416 j
->cadence_f
[cnt
].state
= 0;
2418 } else if (j
->filter_hist
[cnt
] & 12 && !(j
->filter_hist
[cnt
] & 3)) {
2419 if (j
->cadence_f
[cnt
].state
== 1) {
2420 if(!j
->cadence_f
[cnt
].on1
) {
2421 j
->cadence_f
[cnt
].state
= 7;
2422 } else if((time_after(jiffies
, j
->cadence_f
[cnt
].on1min
) &&
2423 time_before(jiffies
, j
->cadence_f
[cnt
].on1max
))) {
2424 if(j
->cadence_f
[cnt
].off1
) {
2425 j
->cadence_f
[cnt
].state
= 2;
2426 j
->cadence_f
[cnt
].off1min
= jiffies
+ (long)((j
->cadence_f
[cnt
].off1
* (hertz
* (100 - var
)) / 10000));
2427 j
->cadence_f
[cnt
].off1dot
= jiffies
+ (long)((j
->cadence_f
[cnt
].off1
* (hertz
* (100)) / 10000));
2428 j
->cadence_f
[cnt
].off1max
= jiffies
+ (long)((j
->cadence_f
[cnt
].off1
* (hertz
* (100 + var
)) / 10000));
2430 j
->cadence_f
[cnt
].state
= 7;
2433 j
->cadence_f
[cnt
].state
= 0;
2435 } else if (j
->cadence_f
[cnt
].state
== 3) {
2436 if((time_after(jiffies
, j
->cadence_f
[cnt
].on2min
) &&
2437 time_before(jiffies
, j
->cadence_f
[cnt
].on2max
))) {
2438 if(j
->cadence_f
[cnt
].off2
) {
2439 j
->cadence_f
[cnt
].state
= 4;
2440 j
->cadence_f
[cnt
].off2min
= jiffies
+ (long)((j
->cadence_f
[cnt
].off2
* (hertz
* (100 - var
)) / 10000));
2441 j
->cadence_f
[cnt
].off2dot
= jiffies
+ (long)((j
->cadence_f
[cnt
].off2
* (hertz
* (100)) / 10000));
2442 j
->cadence_f
[cnt
].off2max
= jiffies
+ (long)((j
->cadence_f
[cnt
].off2
* (hertz
* (100 + var
)) / 10000));
2444 j
->cadence_f
[cnt
].state
= 7;
2447 j
->cadence_f
[cnt
].state
= 0;
2449 } else if (j
->cadence_f
[cnt
].state
== 5) {
2450 if ((time_after(jiffies
, j
->cadence_f
[cnt
].on3min
) &&
2451 time_before(jiffies
, j
->cadence_f
[cnt
].on3max
))) {
2452 if(j
->cadence_f
[cnt
].off3
) {
2453 j
->cadence_f
[cnt
].state
= 6;
2454 j
->cadence_f
[cnt
].off3min
= jiffies
+ (long)((j
->cadence_f
[cnt
].off3
* (hertz
* (100 - var
)) / 10000));
2455 j
->cadence_f
[cnt
].off3dot
= jiffies
+ (long)((j
->cadence_f
[cnt
].off3
* (hertz
* (100)) / 10000));
2456 j
->cadence_f
[cnt
].off3max
= jiffies
+ (long)((j
->cadence_f
[cnt
].off3
* (hertz
* (100 + var
)) / 10000));
2458 j
->cadence_f
[cnt
].state
= 7;
2461 j
->cadence_f
[cnt
].state
= 0;
2464 j
->cadence_f
[cnt
].state
= 0;
2467 switch(j
->cadence_f
[cnt
].state
) {
2469 if(time_after(jiffies
, j
->cadence_f
[cnt
].on1dot
) &&
2470 !j
->cadence_f
[cnt
].off1
&&
2471 !j
->cadence_f
[cnt
].on2
&& !j
->cadence_f
[cnt
].off2
&&
2472 !j
->cadence_f
[cnt
].on3
&& !j
->cadence_f
[cnt
].off3
) {
2473 j
->cadence_f
[cnt
].state
= 7;
2477 if(time_after(jiffies
, j
->cadence_f
[cnt
].on2dot
) &&
2478 !j
->cadence_f
[cnt
].off2
&&
2479 !j
->cadence_f
[cnt
].on3
&& !j
->cadence_f
[cnt
].off3
) {
2480 j
->cadence_f
[cnt
].state
= 7;
2484 if(time_after(jiffies
, j
->cadence_f
[cnt
].on3dot
) &&
2485 !j
->cadence_f
[cnt
].off3
) {
2486 j
->cadence_f
[cnt
].state
= 7;
2492 if (ixjdebug
& 0x0040) {
2493 printk(KERN_INFO
"IXJ Tone Cadence state = %d /dev/phone%d at %ld\n", j
->cadence_f
[cnt
].state
, j
->board
, jiffies
);
2494 switch(j
->cadence_f
[cnt
].state
) {
2496 printk(KERN_INFO
"IXJ /dev/phone%d No Tone detected\n", j
->board
);
2499 printk(KERN_INFO
"IXJ /dev/phone%d Next Tone Cadence state at %u %ld - %ld - %ld\n", j
->board
,
2500 j
->cadence_f
[cnt
].on1
, j
->cadence_f
[cnt
].on1min
, j
->cadence_f
[cnt
].on1dot
, j
->cadence_f
[cnt
].on1max
);
2503 printk(KERN_INFO
"IXJ /dev/phone%d Next Tone Cadence state at %ld - %ld\n", j
->board
, j
->cadence_f
[cnt
].off1min
,
2504 j
->cadence_f
[cnt
].off1max
);
2507 printk(KERN_INFO
"IXJ /dev/phone%d Next Tone Cadence state at %ld - %ld\n", j
->board
, j
->cadence_f
[cnt
].on2min
,
2508 j
->cadence_f
[cnt
].on2max
);
2511 printk(KERN_INFO
"IXJ /dev/phone%d Next Tone Cadence state at %ld - %ld\n", j
->board
, j
->cadence_f
[cnt
].off2min
,
2512 j
->cadence_f
[cnt
].off2max
);
2515 printk(KERN_INFO
"IXJ /dev/phone%d Next Tone Cadence state at %ld - %ld\n", j
->board
, j
->cadence_f
[cnt
].on3min
,
2516 j
->cadence_f
[cnt
].on3max
);
2519 printk(KERN_INFO
"IXJ /dev/phone%d Next Tone Cadence state at %ld - %ld\n", j
->board
, j
->cadence_f
[cnt
].off3min
,
2520 j
->cadence_f
[cnt
].off3max
);
2525 if (j
->cadence_f
[cnt
].state
== 7) {
2526 j
->cadence_f
[cnt
].state
= 0;
2527 if (j
->cadence_f
[cnt
].enable
== 1)
2528 j
->cadence_f
[cnt
].enable
= 0;
2531 if(ixjdebug
& 0x0020) {
2532 printk(KERN_INFO
"Filter Cadence 0 triggered %ld\n", jiffies
);
2535 ixj_kill_fasync(j
, SIG_FC0
, POLL_IN
);
2538 if(ixjdebug
& 0x0020) {
2539 printk(KERN_INFO
"Filter Cadence 1 triggered %ld\n", jiffies
);
2542 ixj_kill_fasync(j
, SIG_FC1
, POLL_IN
);
2545 if(ixjdebug
& 0x0020) {
2546 printk(KERN_INFO
"Filter Cadence 2 triggered %ld\n", jiffies
);
2549 ixj_kill_fasync(j
, SIG_FC2
, POLL_IN
);
2552 if(ixjdebug
& 0x0020) {
2553 printk(KERN_INFO
"Filter Cadence 3 triggered %ld\n", jiffies
);
2556 ixj_kill_fasync(j
, SIG_FC3
, POLL_IN
);
2560 if (j
->filter_en
[cnt
] && ((j
->filter_hist
[cnt
] & 3 && !(j
->filter_hist
[cnt
] & 12)) ||
2561 (j
->filter_hist
[cnt
] & 12 && !(j
->filter_hist
[cnt
] & 3)))) {
2562 if((j
->filter_hist
[cnt
] & 3 && !(j
->filter_hist
[cnt
] & 12))) {
2564 } else if((j
->filter_hist
[cnt
] & 12 && !(j
->filter_hist
[cnt
] & 3))) {
2569 if(ixjdebug
& 0x0020) {
2570 printk(KERN_INFO
"Filter 0 triggered %d at %ld\n", trg
, jiffies
);
2573 ixj_kill_fasync(j
, SIG_F0
, POLL_IN
);
2576 if(ixjdebug
& 0x0020) {
2577 printk(KERN_INFO
"Filter 1 triggered %d at %ld\n", trg
, jiffies
);
2580 ixj_kill_fasync(j
, SIG_F1
, POLL_IN
);
2583 if(ixjdebug
& 0x0020) {
2584 printk(KERN_INFO
"Filter 2 triggered %d at %ld\n", trg
, jiffies
);
2587 ixj_kill_fasync(j
, SIG_F2
, POLL_IN
);
2590 if(ixjdebug
& 0x0020) {
2591 printk(KERN_INFO
"Filter 3 triggered %d at %ld\n", trg
, jiffies
);
2594 ixj_kill_fasync(j
, SIG_F3
, POLL_IN
);
2602 static int LineMonitor(IXJ
*j
)
2609 if (ixj_WriteDSPCommand(0x7000, j
)) /* Line Monitor */
2612 j
->dtmf
.bytes
.high
= j
->ssr
.high
;
2613 j
->dtmf
.bytes
.low
= j
->ssr
.low
;
2614 if (!j
->dtmf_state
&& j
->dtmf
.bits
.dtmf_valid
) {
2616 j
->dtmf_current
= j
->dtmf
.bits
.digit
;
2618 if (j
->dtmf_state
&& !j
->dtmf
.bits
.dtmf_valid
) /* && j->dtmf_wp != j->dtmf_rp) */
2620 if(!j
->cidcw_wait
) {
2621 j
->dtmfbuffer
[j
->dtmf_wp
] = j
->dtmf_current
;
2623 if (j
->dtmf_wp
== 79)
2625 j
->ex
.bits
.dtmf_ready
= 1;
2626 if(j
->ex_sig
.bits
.dtmf_ready
) {
2627 ixj_kill_fasync(j
, SIG_DTMF_READY
, POLL_IN
);
2630 else if(j
->dtmf_current
== 0x00 || j
->dtmf_current
== 0x0D) {
2631 if(ixjdebug
& 0x0020) {
2632 printk("IXJ phone%d saw CIDCW Ack DTMF %d from display at %ld\n", j
->board
, j
->dtmf_current
, jiffies
);
2634 j
->flags
.cidcw_ack
= 1;
2643 /************************************************************************
2645 * Functions to allow alaw <-> ulaw conversions.
2647 ************************************************************************/
2649 static void ulaw2alaw(unsigned char *buff
, unsigned long len
)
2651 static unsigned char table_ulaw2alaw
[] =
2653 0x2A, 0x2B, 0x28, 0x29, 0x2E, 0x2F, 0x2C, 0x2D,
2654 0x22, 0x23, 0x20, 0x21, 0x26, 0x27, 0x24, 0x25,
2655 0x3A, 0x3B, 0x38, 0x39, 0x3E, 0x3F, 0x3C, 0x3D,
2656 0x32, 0x33, 0x30, 0x31, 0x36, 0x37, 0x34, 0x35,
2657 0x0B, 0x08, 0x09, 0x0E, 0x0F, 0x0C, 0x0D, 0x02,
2658 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05, 0x1A,
2659 0x1B, 0x18, 0x19, 0x1E, 0x1F, 0x1C, 0x1D, 0x12,
2660 0x13, 0x10, 0x11, 0x16, 0x17, 0x14, 0x15, 0x6B,
2661 0x68, 0x69, 0x6E, 0x6F, 0x6C, 0x6D, 0x62, 0x63,
2662 0x60, 0x61, 0x66, 0x67, 0x64, 0x65, 0x7B, 0x79,
2663 0x7E, 0x7F, 0x7C, 0x7D, 0x72, 0x73, 0x70, 0x71,
2664 0x76, 0x77, 0x74, 0x75, 0x4B, 0x49, 0x4F, 0x4D,
2665 0x42, 0x43, 0x40, 0x41, 0x46, 0x47, 0x44, 0x45,
2666 0x5A, 0x5B, 0x58, 0x59, 0x5E, 0x5F, 0x5C, 0x5D,
2667 0x52, 0x52, 0x53, 0x53, 0x50, 0x50, 0x51, 0x51,
2668 0x56, 0x56, 0x57, 0x57, 0x54, 0x54, 0x55, 0xD5,
2669 0xAA, 0xAB, 0xA8, 0xA9, 0xAE, 0xAF, 0xAC, 0xAD,
2670 0xA2, 0xA3, 0xA0, 0xA1, 0xA6, 0xA7, 0xA4, 0xA5,
2671 0xBA, 0xBB, 0xB8, 0xB9, 0xBE, 0xBF, 0xBC, 0xBD,
2672 0xB2, 0xB3, 0xB0, 0xB1, 0xB6, 0xB7, 0xB4, 0xB5,
2673 0x8B, 0x88, 0x89, 0x8E, 0x8F, 0x8C, 0x8D, 0x82,
2674 0x83, 0x80, 0x81, 0x86, 0x87, 0x84, 0x85, 0x9A,
2675 0x9B, 0x98, 0x99, 0x9E, 0x9F, 0x9C, 0x9D, 0x92,
2676 0x93, 0x90, 0x91, 0x96, 0x97, 0x94, 0x95, 0xEB,
2677 0xE8, 0xE9, 0xEE, 0xEF, 0xEC, 0xED, 0xE2, 0xE3,
2678 0xE0, 0xE1, 0xE6, 0xE7, 0xE4, 0xE5, 0xFB, 0xF9,
2679 0xFE, 0xFF, 0xFC, 0xFD, 0xF2, 0xF3, 0xF0, 0xF1,
2680 0xF6, 0xF7, 0xF4, 0xF5, 0xCB, 0xC9, 0xCF, 0xCD,
2681 0xC2, 0xC3, 0xC0, 0xC1, 0xC6, 0xC7, 0xC4, 0xC5,
2682 0xDA, 0xDB, 0xD8, 0xD9, 0xDE, 0xDF, 0xDC, 0xDD,
2683 0xD2, 0xD2, 0xD3, 0xD3, 0xD0, 0xD0, 0xD1, 0xD1,
2684 0xD6, 0xD6, 0xD7, 0xD7, 0xD4, 0xD4, 0xD5, 0xD5
2689 *buff
= table_ulaw2alaw
[*(unsigned char *)buff
];
2694 static void alaw2ulaw(unsigned char *buff
, unsigned long len
)
2696 static unsigned char table_alaw2ulaw
[] =
2698 0x29, 0x2A, 0x27, 0x28, 0x2D, 0x2E, 0x2B, 0x2C,
2699 0x21, 0x22, 0x1F, 0x20, 0x25, 0x26, 0x23, 0x24,
2700 0x39, 0x3A, 0x37, 0x38, 0x3D, 0x3E, 0x3B, 0x3C,
2701 0x31, 0x32, 0x2F, 0x30, 0x35, 0x36, 0x33, 0x34,
2702 0x0A, 0x0B, 0x08, 0x09, 0x0E, 0x0F, 0x0C, 0x0D,
2703 0x02, 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05,
2704 0x1A, 0x1B, 0x18, 0x19, 0x1E, 0x1F, 0x1C, 0x1D,
2705 0x12, 0x13, 0x10, 0x11, 0x16, 0x17, 0x14, 0x15,
2706 0x62, 0x63, 0x60, 0x61, 0x66, 0x67, 0x64, 0x65,
2707 0x5D, 0x5D, 0x5C, 0x5C, 0x5F, 0x5F, 0x5E, 0x5E,
2708 0x74, 0x76, 0x70, 0x72, 0x7C, 0x7E, 0x78, 0x7A,
2709 0x6A, 0x6B, 0x68, 0x69, 0x6E, 0x6F, 0x6C, 0x6D,
2710 0x48, 0x49, 0x46, 0x47, 0x4C, 0x4D, 0x4A, 0x4B,
2711 0x40, 0x41, 0x3F, 0x3F, 0x44, 0x45, 0x42, 0x43,
2712 0x56, 0x57, 0x54, 0x55, 0x5A, 0x5B, 0x58, 0x59,
2713 0x4F, 0x4F, 0x4E, 0x4E, 0x52, 0x53, 0x50, 0x51,
2714 0xA9, 0xAA, 0xA7, 0xA8, 0xAD, 0xAE, 0xAB, 0xAC,
2715 0xA1, 0xA2, 0x9F, 0xA0, 0xA5, 0xA6, 0xA3, 0xA4,
2716 0xB9, 0xBA, 0xB7, 0xB8, 0xBD, 0xBE, 0xBB, 0xBC,
2717 0xB1, 0xB2, 0xAF, 0xB0, 0xB5, 0xB6, 0xB3, 0xB4,
2718 0x8A, 0x8B, 0x88, 0x89, 0x8E, 0x8F, 0x8C, 0x8D,
2719 0x82, 0x83, 0x80, 0x81, 0x86, 0x87, 0x84, 0x85,
2720 0x9A, 0x9B, 0x98, 0x99, 0x9E, 0x9F, 0x9C, 0x9D,
2721 0x92, 0x93, 0x90, 0x91, 0x96, 0x97, 0x94, 0x95,
2722 0xE2, 0xE3, 0xE0, 0xE1, 0xE6, 0xE7, 0xE4, 0xE5,
2723 0xDD, 0xDD, 0xDC, 0xDC, 0xDF, 0xDF, 0xDE, 0xDE,
2724 0xF4, 0xF6, 0xF0, 0xF2, 0xFC, 0xFE, 0xF8, 0xFA,
2725 0xEA, 0xEB, 0xE8, 0xE9, 0xEE, 0xEF, 0xEC, 0xED,
2726 0xC8, 0xC9, 0xC6, 0xC7, 0xCC, 0xCD, 0xCA, 0xCB,
2727 0xC0, 0xC1, 0xBF, 0xBF, 0xC4, 0xC5, 0xC2, 0xC3,
2728 0xD6, 0xD7, 0xD4, 0xD5, 0xDA, 0xDB, 0xD8, 0xD9,
2729 0xCF, 0xCF, 0xCE, 0xCE, 0xD2, 0xD3, 0xD0, 0xD1
2734 *buff
= table_alaw2ulaw
[*(unsigned char *)buff
];
2739 static ssize_t
ixj_read(struct file
* file_p
, char __user
*buf
, size_t length
, loff_t
* ppos
)
2741 unsigned long i
= *ppos
;
2742 IXJ
* j
= get_ixj(NUM(file_p
->f_dentry
->d_inode
));
2744 DECLARE_WAITQUEUE(wait
, current
);
2746 if (j
->flags
.inread
)
2749 j
->flags
.inread
= 1;
2751 add_wait_queue(&j
->read_q
, &wait
);
2752 set_current_state(TASK_INTERRUPTIBLE
);
2755 while (!j
->read_buffer_ready
|| (j
->dtmf_state
&& j
->flags
.dtmf_oob
)) {
2757 if (file_p
->f_flags
& O_NONBLOCK
) {
2758 set_current_state(TASK_RUNNING
);
2759 remove_wait_queue(&j
->read_q
, &wait
);
2760 j
->flags
.inread
= 0;
2763 if (!ixj_hookstate(j
)) {
2764 set_current_state(TASK_RUNNING
);
2765 remove_wait_queue(&j
->read_q
, &wait
);
2766 j
->flags
.inread
= 0;
2769 interruptible_sleep_on(&j
->read_q
);
2770 if (signal_pending(current
)) {
2771 set_current_state(TASK_RUNNING
);
2772 remove_wait_queue(&j
->read_q
, &wait
);
2773 j
->flags
.inread
= 0;
2778 remove_wait_queue(&j
->read_q
, &wait
);
2779 set_current_state(TASK_RUNNING
);
2780 /* Don't ever copy more than the user asks */
2781 if(j
->rec_codec
== ALAW
)
2782 ulaw2alaw(j
->read_buffer
, min(length
, j
->read_buffer_size
));
2783 i
= copy_to_user(buf
, j
->read_buffer
, min(length
, j
->read_buffer_size
));
2784 j
->read_buffer_ready
= 0;
2786 j
->flags
.inread
= 0;
2789 j
->flags
.inread
= 0;
2790 return min(length
, j
->read_buffer_size
);
2794 static ssize_t
ixj_enhanced_read(struct file
* file_p
, char __user
*buf
, size_t length
,
2798 ssize_t read_retval
= 0;
2799 IXJ
*j
= get_ixj(NUM(file_p
->f_dentry
->d_inode
));
2801 pre_retval
= ixj_PreRead(j
, 0L);
2802 switch (pre_retval
) {
2804 read_retval
= ixj_read(file_p
, buf
, length
, ppos
);
2805 ixj_PostRead(j
, 0L);
2808 read_retval
= ixj_read(file_p
, buf
, length
, ppos
);
2811 ixj_PostRead(j
, 0L);
2814 read_retval
= pre_retval
;
2819 static ssize_t
ixj_write(struct file
*file_p
, const char __user
*buf
, size_t count
, loff_t
* ppos
)
2821 unsigned long i
= *ppos
;
2822 IXJ
*j
= file_p
->private_data
;
2824 DECLARE_WAITQUEUE(wait
, current
);
2826 if (j
->flags
.inwrite
)
2829 j
->flags
.inwrite
= 1;
2831 add_wait_queue(&j
->write_q
, &wait
);
2832 set_current_state(TASK_INTERRUPTIBLE
);
2836 while (!j
->write_buffers_empty
) {
2838 if (file_p
->f_flags
& O_NONBLOCK
) {
2839 set_current_state(TASK_RUNNING
);
2840 remove_wait_queue(&j
->write_q
, &wait
);
2841 j
->flags
.inwrite
= 0;
2844 if (!ixj_hookstate(j
)) {
2845 set_current_state(TASK_RUNNING
);
2846 remove_wait_queue(&j
->write_q
, &wait
);
2847 j
->flags
.inwrite
= 0;
2850 interruptible_sleep_on(&j
->write_q
);
2851 if (signal_pending(current
)) {
2852 set_current_state(TASK_RUNNING
);
2853 remove_wait_queue(&j
->write_q
, &wait
);
2854 j
->flags
.inwrite
= 0;
2858 set_current_state(TASK_RUNNING
);
2859 remove_wait_queue(&j
->write_q
, &wait
);
2860 if (j
->write_buffer_wp
+ count
>= j
->write_buffer_end
)
2861 j
->write_buffer_wp
= j
->write_buffer
;
2862 i
= copy_from_user(j
->write_buffer_wp
, buf
, min(count
, j
->write_buffer_size
));
2864 j
->flags
.inwrite
= 0;
2867 if(j
->play_codec
== ALAW
)
2868 alaw2ulaw(j
->write_buffer_wp
, min(count
, j
->write_buffer_size
));
2869 j
->flags
.inwrite
= 0;
2870 return min(count
, j
->write_buffer_size
);
2873 static ssize_t
ixj_enhanced_write(struct file
* file_p
, const char __user
*buf
, size_t count
, loff_t
* ppos
)
2876 ssize_t write_retval
= 0;
2878 IXJ
*j
= get_ixj(NUM(file_p
->f_dentry
->d_inode
));
2880 pre_retval
= ixj_PreWrite(j
, 0L);
2881 switch (pre_retval
) {
2883 write_retval
= ixj_write(file_p
, buf
, count
, ppos
);
2884 if (write_retval
> 0) {
2885 ixj_PostWrite(j
, 0L);
2886 j
->write_buffer_wp
+= write_retval
;
2887 j
->write_buffers_empty
--;
2891 write_retval
= ixj_write(file_p
, buf
, count
, ppos
);
2892 if (write_retval
> 0) {
2893 j
->write_buffer_wp
+= write_retval
;
2894 j
->write_buffers_empty
--;
2898 ixj_PostWrite(j
, 0L);
2901 write_retval
= pre_retval
;
2903 return write_retval
;
2906 static void ixj_read_frame(IXJ
*j
)
2910 if (j
->read_buffer
) {
2911 for (cnt
= 0; cnt
< j
->rec_frame_size
* 2; cnt
+= 2) {
2912 if (!(cnt
% 16) && !IsRxReady(j
)) {
2914 while (!IsRxReady(j
)) {
2922 /* Throw away word 0 of the 8021 compressed format to get standard G.729. */
2923 if (j
->rec_codec
== G729
&& (cnt
== 0 || cnt
== 10 || cnt
== 20)) {
2924 inb_p(j
->DSPbase
+ 0x0E);
2925 inb_p(j
->DSPbase
+ 0x0F);
2927 *(j
->read_buffer
+ cnt
) = inb_p(j
->DSPbase
+ 0x0E);
2928 *(j
->read_buffer
+ cnt
+ 1) = inb_p(j
->DSPbase
+ 0x0F);
2931 if (j
->intercom
!= -1) {
2932 if (IsTxReady(get_ixj(j
->intercom
))) {
2933 for (cnt
= 0; cnt
< j
->rec_frame_size
* 2; cnt
+= 2) {
2934 if (!(cnt
% 16) && !IsTxReady(j
)) {
2936 while (!IsTxReady(j
)) {
2944 outb_p(*(j
->read_buffer
+ cnt
), get_ixj(j
->intercom
)->DSPbase
+ 0x0C);
2945 outb_p(*(j
->read_buffer
+ cnt
+ 1), get_ixj(j
->intercom
)->DSPbase
+ 0x0D);
2947 get_ixj(j
->intercom
)->frameswritten
++;
2950 j
->read_buffer_ready
= 1;
2951 wake_up_interruptible(&j
->read_q
); /* Wake any blocked readers */
2953 wake_up_interruptible(&j
->poll_q
); /* Wake any blocked selects */
2955 if(j
->ixj_signals
[SIG_READ_READY
])
2956 ixj_kill_fasync(j
, SIG_READ_READY
, POLL_OUT
);
2961 static short fsk
[][6][20] =
2965 0, 17846, 29934, 32364, 24351, 8481, -10126, -25465, -32587, -29196,
2966 -16384, 1715, 19260, 30591, 32051, 23170, 6813, -11743, -26509, -32722
2969 -28377, -14876, 3425, 20621, 31163, 31650, 21925, 5126, -13328, -27481,
2970 -32767, -27481, -13328, 5126, 21925, 31650, 31163, 20621, 3425, -14876
2973 -28377, -32722, -26509, -11743, 6813, 23170, 32051, 30591, 19260, 1715,
2974 -16384, -29196, -32587, -25465, -10126, 8481, 24351, 32364, 29934, 17846
2977 0, -17846, -29934, -32364, -24351, -8481, 10126, 25465, 32587, 29196,
2978 16384, -1715, -19260, -30591, -32051, -23170, -6813, 11743, 26509, 32722
2981 28377, 14876, -3425, -20621, -31163, -31650, -21925, -5126, 13328, 27481,
2982 32767, 27481, 13328, -5126, -21925, -31650, -31163, -20621, -3425, 14876
2985 28377, 32722, 26509, 11743, -6813, -23170, -32051, -30591, -19260, -1715,
2986 16384, 29196, 32587, 25465, 10126, -8481, -24351, -32364, -29934, -17846
2991 0, 10126, 19260, 26509, 31163, 32767, 31163, 26509, 19260, 10126,
2992 0, -10126, -19260, -26509, -31163, -32767, -31163, -26509, -19260, -10126
2995 -28377, -21925, -13328, -3425, 6813, 16384, 24351, 29934, 32587, 32051,
2996 28377, 21925, 13328, 3425, -6813, -16384, -24351, -29934, -32587, -32051
2999 -28377, -32051, -32587, -29934, -24351, -16384, -6813, 3425, 13328, 21925,
3000 28377, 32051, 32587, 29934, 24351, 16384, 6813, -3425, -13328, -21925
3003 0, -10126, -19260, -26509, -31163, -32767, -31163, -26509, -19260, -10126,
3004 0, 10126, 19260, 26509, 31163, 32767, 31163, 26509, 19260, 10126
3007 28377, 21925, 13328, 3425, -6813, -16383, -24351, -29934, -32587, -32051,
3008 -28377, -21925, -13328, -3425, 6813, 16383, 24351, 29934, 32587, 32051
3011 28377, 32051, 32587, 29934, 24351, 16384, 6813, -3425, -13328, -21925,
3012 -28377, -32051, -32587, -29934, -24351, -16384, -6813, 3425, 13328, 21925
3018 static void ixj_write_cid_bit(IXJ
*j
, int bit
)
3020 while (j
->fskcnt
< 20) {
3021 if(j
->fskdcnt
< (j
->fsksize
- 1))
3022 j
->fskdata
[j
->fskdcnt
++] = fsk
[bit
][j
->fskz
][j
->fskcnt
];
3035 static void ixj_write_cid_byte(IXJ
*j
, char byte
)
3040 ixj_write_cid_bit(j
, 0);
3041 ixj_write_cid_bit(j
, cb
.cbits
.b0
? 1 : 0);
3042 ixj_write_cid_bit(j
, cb
.cbits
.b1
? 1 : 0);
3043 ixj_write_cid_bit(j
, cb
.cbits
.b2
? 1 : 0);
3044 ixj_write_cid_bit(j
, cb
.cbits
.b3
? 1 : 0);
3045 ixj_write_cid_bit(j
, cb
.cbits
.b4
? 1 : 0);
3046 ixj_write_cid_bit(j
, cb
.cbits
.b5
? 1 : 0);
3047 ixj_write_cid_bit(j
, cb
.cbits
.b6
? 1 : 0);
3048 ixj_write_cid_bit(j
, cb
.cbits
.b7
? 1 : 0);
3049 ixj_write_cid_bit(j
, 1);
3052 static void ixj_write_cid_seize(IXJ
*j
)
3056 for (cnt
= 0; cnt
< 150; cnt
++) {
3057 ixj_write_cid_bit(j
, 0);
3058 ixj_write_cid_bit(j
, 1);
3060 for (cnt
= 0; cnt
< 180; cnt
++) {
3061 ixj_write_cid_bit(j
, 1);
3065 static void ixj_write_cidcw_seize(IXJ
*j
)
3069 for (cnt
= 0; cnt
< 80; cnt
++) {
3070 ixj_write_cid_bit(j
, 1);
3074 static int ixj_write_cid_string(IXJ
*j
, char *s
, int checksum
)
3078 for (cnt
= 0; cnt
< strlen(s
); cnt
++) {
3079 ixj_write_cid_byte(j
, s
[cnt
]);
3080 checksum
= (checksum
+ s
[cnt
]);
3085 static void ixj_pad_fsk(IXJ
*j
, int pad
)
3089 for (cnt
= 0; cnt
< pad
; cnt
++) {
3090 if(j
->fskdcnt
< (j
->fsksize
- 1))
3091 j
->fskdata
[j
->fskdcnt
++] = 0x0000;
3093 for (cnt
= 0; cnt
< 720; cnt
++) {
3094 if(j
->fskdcnt
< (j
->fsksize
- 1))
3095 j
->fskdata
[j
->fskdcnt
++] = 0x0000;
3099 static void ixj_pre_cid(IXJ
*j
)
3101 j
->cid_play_codec
= j
->play_codec
;
3102 j
->cid_play_frame_size
= j
->play_frame_size
;
3103 j
->cid_play_volume
= get_play_volume(j
);
3104 j
->cid_play_flag
= j
->flags
.playing
;
3106 j
->cid_rec_codec
= j
->rec_codec
;
3107 j
->cid_rec_volume
= get_rec_volume(j
);
3108 j
->cid_rec_flag
= j
->flags
.recording
;
3110 j
->cid_play_aec_level
= j
->aec_level
;
3112 switch(j
->baseframe
.low
) {
3114 j
->cid_base_frame_size
= 20;
3117 j
->cid_base_frame_size
= 10;
3120 j
->cid_base_frame_size
= 30;
3127 j
->flags
.cidplay
= 1;
3129 set_base_frame(j
, 30);
3130 set_play_codec(j
, LINEAR16
);
3131 set_play_volume(j
, 0x1B);
3135 static void ixj_post_cid(IXJ
*j
)
3139 if(j
->cidsize
> 5000) {
3140 SLIC_SetState(PLD_SLIC_STATE_STANDBY
, j
);
3142 j
->flags
.cidplay
= 0;
3143 if(ixjdebug
& 0x0200) {
3144 printk("IXJ phone%d Finished Playing CallerID data %ld\n", j
->board
, jiffies
);
3150 set_base_frame(j
, j
->cid_base_frame_size
);
3151 set_play_codec(j
, j
->cid_play_codec
);
3152 ixj_aec_start(j
, j
->cid_play_aec_level
);
3153 set_play_volume(j
, j
->cid_play_volume
);
3155 set_rec_codec(j
, j
->cid_rec_codec
);
3156 set_rec_volume(j
, j
->cid_rec_volume
);
3159 ixj_record_start(j
);
3161 if(j
->cid_play_flag
)
3164 if(j
->cid_play_flag
) {
3165 wake_up_interruptible(&j
->write_q
); /* Wake any blocked writers */
3169 static void ixj_write_cid(IXJ
*j
)
3174 char mdmflen
, len1
, len2
, len3
;
3179 if (j
->dsp
.low
== 0x20 || j
->flags
.cidplay
)
3182 j
->fskz
= j
->fskphase
= j
->fskcnt
= j
->fskdcnt
= 0;
3183 j
->cidsize
= j
->cidcnt
= 0;
3187 strcpy(sdmf1
, j
->cid_send
.month
);
3188 strcat(sdmf1
, j
->cid_send
.day
);
3189 strcat(sdmf1
, j
->cid_send
.hour
);
3190 strcat(sdmf1
, j
->cid_send
.min
);
3191 strcpy(sdmf2
, j
->cid_send
.number
);
3192 strcpy(sdmf3
, j
->cid_send
.name
);
3194 len1
= strlen(sdmf1
);
3195 len2
= strlen(sdmf2
);
3196 len3
= strlen(sdmf3
);
3197 mdmflen
= len1
+ len2
+ len3
+ 6;
3200 ixj_write_cid_seize(j
);
3202 ixj_write_cid_byte(j
, 0x80);
3204 ixj_write_cid_byte(j
, mdmflen
);
3205 checksum
= checksum
+ mdmflen
;
3207 ixj_write_cid_byte(j
, 0x01);
3208 checksum
= checksum
+ 0x01;
3209 ixj_write_cid_byte(j
, len1
);
3210 checksum
= checksum
+ len1
;
3211 checksum
= ixj_write_cid_string(j
, sdmf1
, checksum
);
3212 if(ixj_hookstate(j
) & 1)
3215 ixj_write_cid_byte(j
, 0x02);
3216 checksum
= checksum
+ 0x02;
3217 ixj_write_cid_byte(j
, len2
);
3218 checksum
= checksum
+ len2
;
3219 checksum
= ixj_write_cid_string(j
, sdmf2
, checksum
);
3220 if(ixj_hookstate(j
) & 1)
3223 ixj_write_cid_byte(j
, 0x07);
3224 checksum
= checksum
+ 0x07;
3225 ixj_write_cid_byte(j
, len3
);
3226 checksum
= checksum
+ len3
;
3227 checksum
= ixj_write_cid_string(j
, sdmf3
, checksum
);
3228 if(ixj_hookstate(j
) & 1)
3235 ixj_write_cid_byte(j
, (char) checksum
);
3237 pad
= j
->fskdcnt
% 240;
3241 ixj_pad_fsk(j
, pad
);
3248 static void ixj_write_cidcw(IXJ
*j
)
3255 char mdmflen
, len1
, len2
, len3
;
3260 if (j
->dsp
.low
== 0x20 || j
->flags
.cidplay
)
3263 j
->fskz
= j
->fskphase
= j
->fskcnt
= j
->fskdcnt
= 0;
3264 j
->cidsize
= j
->cidcnt
= 0;
3268 j
->flags
.cidcw_ack
= 0;
3275 ixj_init_tone(j
, &ti
);
3277 ixj_set_tone_on(1500, j
);
3278 ixj_set_tone_off(32, j
);
3279 if(ixjdebug
& 0x0200) {
3280 printk("IXJ cidcw phone%d first tone start at %ld\n", j
->board
, jiffies
);
3282 ixj_play_tone(j
, 23);
3284 clear_bit(j
->board
, &j
->busyflags
);
3285 while(j
->tone_state
)
3286 schedule_timeout_interruptible(1);
3287 while(test_and_set_bit(j
->board
, (void *)&j
->busyflags
) != 0)
3288 schedule_timeout_interruptible(1);
3289 if(ixjdebug
& 0x0200) {
3290 printk("IXJ cidcw phone%d first tone end at %ld\n", j
->board
, jiffies
);
3298 ixj_init_tone(j
, &ti
);
3300 ixj_set_tone_off(10, j
);
3301 ixj_set_tone_on(600, j
);
3302 if(ixjdebug
& 0x0200) {
3303 printk("IXJ cidcw phone%d second tone start at %ld\n", j
->board
, jiffies
);
3305 ixj_play_tone(j
, 24);
3307 clear_bit(j
->board
, &j
->busyflags
);
3308 while(j
->tone_state
)
3309 schedule_timeout_interruptible(1);
3310 while(test_and_set_bit(j
->board
, (void *)&j
->busyflags
) != 0)
3311 schedule_timeout_interruptible(1);
3312 if(ixjdebug
& 0x0200) {
3313 printk("IXJ cidcw phone%d sent second tone at %ld\n", j
->board
, jiffies
);
3316 j
->cidcw_wait
= jiffies
+ ((50 * hertz
) / 100);
3318 clear_bit(j
->board
, &j
->busyflags
);
3319 while(!j
->flags
.cidcw_ack
&& time_before(jiffies
, j
->cidcw_wait
))
3320 schedule_timeout_interruptible(1);
3321 while(test_and_set_bit(j
->board
, (void *)&j
->busyflags
) != 0)
3322 schedule_timeout_interruptible(1);
3324 if(!j
->flags
.cidcw_ack
) {
3325 if(ixjdebug
& 0x0200) {
3326 printk("IXJ cidcw phone%d did not receive ACK from display %ld\n", j
->board
, jiffies
);
3329 if(j
->cid_play_flag
) {
3330 wake_up_interruptible(&j
->write_q
); /* Wake any blocked readers */
3336 j
->flags
.cidcw_ack
= 0;
3337 strcpy(sdmf1
, j
->cid_send
.month
);
3338 strcat(sdmf1
, j
->cid_send
.day
);
3339 strcat(sdmf1
, j
->cid_send
.hour
);
3340 strcat(sdmf1
, j
->cid_send
.min
);
3341 strcpy(sdmf2
, j
->cid_send
.number
);
3342 strcpy(sdmf3
, j
->cid_send
.name
);
3344 len1
= strlen(sdmf1
);
3345 len2
= strlen(sdmf2
);
3346 len3
= strlen(sdmf3
);
3347 mdmflen
= len1
+ len2
+ len3
+ 6;
3349 ixj_write_cidcw_seize(j
);
3351 ixj_write_cid_byte(j
, 0x80);
3353 ixj_write_cid_byte(j
, mdmflen
);
3354 checksum
= checksum
+ mdmflen
;
3356 ixj_write_cid_byte(j
, 0x01);
3357 checksum
= checksum
+ 0x01;
3358 ixj_write_cid_byte(j
, len1
);
3359 checksum
= checksum
+ len1
;
3360 checksum
= ixj_write_cid_string(j
, sdmf1
, checksum
);
3362 ixj_write_cid_byte(j
, 0x02);
3363 checksum
= checksum
+ 0x02;
3364 ixj_write_cid_byte(j
, len2
);
3365 checksum
= checksum
+ len2
;
3366 checksum
= ixj_write_cid_string(j
, sdmf2
, checksum
);
3368 ixj_write_cid_byte(j
, 0x07);
3369 checksum
= checksum
+ 0x07;
3370 ixj_write_cid_byte(j
, len3
);
3371 checksum
= checksum
+ len3
;
3372 checksum
= ixj_write_cid_string(j
, sdmf3
, checksum
);
3378 ixj_write_cid_byte(j
, (char) checksum
);
3380 pad
= j
->fskdcnt
% 240;
3384 ixj_pad_fsk(j
, pad
);
3385 if(ixjdebug
& 0x0200) {
3386 printk("IXJ cidcw phone%d sent FSK data at %ld\n", j
->board
, jiffies
);
3390 static void ixj_write_vmwi(IXJ
*j
, int msg
)
3397 if (j
->dsp
.low
== 0x20 || j
->flags
.cidplay
)
3400 j
->fskz
= j
->fskphase
= j
->fskcnt
= j
->fskdcnt
= 0;
3401 j
->cidsize
= j
->cidcnt
= 0;
3407 if (j
->port
== PORT_POTS
)
3408 SLIC_SetState(PLD_SLIC_STATE_OHT
, j
);
3410 ixj_write_cid_seize(j
);
3412 ixj_write_cid_byte(j
, 0x82);
3414 ixj_write_cid_byte(j
, mdmflen
);
3415 checksum
= checksum
+ mdmflen
;
3417 ixj_write_cid_byte(j
, 0x0B);
3418 checksum
= checksum
+ 0x0B;
3419 ixj_write_cid_byte(j
, 1);
3420 checksum
= checksum
+ 1;
3423 ixj_write_cid_byte(j
, 0xFF);
3424 checksum
= checksum
+ 0xFF;
3427 ixj_write_cid_byte(j
, 0x00);
3428 checksum
= checksum
+ 0x00;
3435 ixj_write_cid_byte(j
, (char) checksum
);
3437 pad
= j
->fskdcnt
% 240;
3441 ixj_pad_fsk(j
, pad
);
3444 static void ixj_write_frame(IXJ
*j
)
3446 int cnt
, frame_count
, dly
;
3451 if(j
->flags
.cidplay
) {
3452 for(cnt
= 0; cnt
< 480; cnt
++) {
3453 if (!(cnt
% 16) && !IsTxReady(j
)) {
3455 while (!IsTxReady(j
)) {
3463 dat
.word
= j
->fskdata
[j
->cidcnt
++];
3464 outb_p(dat
.bytes
.low
, j
->DSPbase
+ 0x0C);
3465 outb_p(dat
.bytes
.high
, j
->DSPbase
+ 0x0D);
3468 if(j
->cidcnt
>= j
->fskdcnt
) {
3471 /* This may seem rude, but if we just played one frame of FSK data for CallerID
3472 and there is real audio data in the buffer, we need to throw it away because
3473 we just used it's time slot */
3474 if (j
->write_buffer_rp
> j
->write_buffer_wp
) {
3475 j
->write_buffer_rp
+= j
->cid_play_frame_size
* 2;
3476 if (j
->write_buffer_rp
>= j
->write_buffer_end
) {
3477 j
->write_buffer_rp
= j
->write_buffer
;
3479 j
->write_buffers_empty
++;
3480 wake_up_interruptible(&j
->write_q
); /* Wake any blocked writers */
3482 wake_up_interruptible(&j
->poll_q
); /* Wake any blocked selects */
3484 } else if (j
->write_buffer
&& j
->write_buffers_empty
< 1) {
3485 if (j
->write_buffer_wp
> j
->write_buffer_rp
) {
3487 (j
->write_buffer_wp
- j
->write_buffer_rp
) / (j
->play_frame_size
* 2);
3489 if (j
->write_buffer_rp
> j
->write_buffer_wp
) {
3491 (j
->write_buffer_wp
- j
->write_buffer
) / (j
->play_frame_size
* 2) +
3492 (j
->write_buffer_end
- j
->write_buffer_rp
) / (j
->play_frame_size
* 2);
3494 if (frame_count
>= 1) {
3495 if (j
->ver
.low
== 0x12 && j
->play_mode
&& j
->flags
.play_first_frame
) {
3496 switch (j
->play_mode
) {
3497 case PLAYBACK_MODE_ULAW
:
3498 case PLAYBACK_MODE_ALAW
:
3499 blankword
.low
= blankword
.high
= 0xFF;
3501 case PLAYBACK_MODE_8LINEAR
:
3502 case PLAYBACK_MODE_16LINEAR
:
3503 blankword
.low
= blankword
.high
= 0x00;
3505 case PLAYBACK_MODE_8LINEAR_WSS
:
3506 blankword
.low
= blankword
.high
= 0x80;
3509 for (cnt
= 0; cnt
< 16; cnt
++) {
3510 if (!(cnt
% 16) && !IsTxReady(j
)) {
3512 while (!IsTxReady(j
)) {
3520 outb_p((blankword
.low
), j
->DSPbase
+ 0x0C);
3521 outb_p((blankword
.high
), j
->DSPbase
+ 0x0D);
3523 j
->flags
.play_first_frame
= 0;
3524 } else if (j
->play_codec
== G723_63
&& j
->flags
.play_first_frame
) {
3525 for (cnt
= 0; cnt
< 24; cnt
++) {
3527 blankword
.low
= 0x02;
3528 blankword
.high
= 0x00;
3531 blankword
.low
= blankword
.high
= 0x00;
3533 if (!(cnt
% 16) && !IsTxReady(j
)) {
3535 while (!IsTxReady(j
)) {
3543 outb_p((blankword
.low
), j
->DSPbase
+ 0x0C);
3544 outb_p((blankword
.high
), j
->DSPbase
+ 0x0D);
3546 j
->flags
.play_first_frame
= 0;
3548 for (cnt
= 0; cnt
< j
->play_frame_size
* 2; cnt
+= 2) {
3549 if (!(cnt
% 16) && !IsTxReady(j
)) {
3551 while (!IsTxReady(j
)) {
3559 /* Add word 0 to G.729 frames for the 8021. Right now we don't do VAD/CNG */
3560 if (j
->play_codec
== G729
&& (cnt
== 0 || cnt
== 10 || cnt
== 20)) {
3561 if (j
->write_buffer_rp
[cnt
] == 0 &&
3562 j
->write_buffer_rp
[cnt
+ 1] == 0 &&
3563 j
->write_buffer_rp
[cnt
+ 2] == 0 &&
3564 j
->write_buffer_rp
[cnt
+ 3] == 0 &&
3565 j
->write_buffer_rp
[cnt
+ 4] == 0 &&
3566 j
->write_buffer_rp
[cnt
+ 5] == 0 &&
3567 j
->write_buffer_rp
[cnt
+ 6] == 0 &&
3568 j
->write_buffer_rp
[cnt
+ 7] == 0 &&
3569 j
->write_buffer_rp
[cnt
+ 8] == 0 &&
3570 j
->write_buffer_rp
[cnt
+ 9] == 0) {
3571 /* someone is trying to write silence lets make this a type 0 frame. */
3572 outb_p(0x00, j
->DSPbase
+ 0x0C);
3573 outb_p(0x00, j
->DSPbase
+ 0x0D);
3575 /* so all other frames are type 1. */
3576 outb_p(0x01, j
->DSPbase
+ 0x0C);
3577 outb_p(0x00, j
->DSPbase
+ 0x0D);
3580 outb_p(*(j
->write_buffer_rp
+ cnt
), j
->DSPbase
+ 0x0C);
3581 outb_p(*(j
->write_buffer_rp
+ cnt
+ 1), j
->DSPbase
+ 0x0D);
3582 *(j
->write_buffer_rp
+ cnt
) = 0;
3583 *(j
->write_buffer_rp
+ cnt
+ 1) = 0;
3585 j
->write_buffer_rp
+= j
->play_frame_size
* 2;
3586 if (j
->write_buffer_rp
>= j
->write_buffer_end
) {
3587 j
->write_buffer_rp
= j
->write_buffer
;
3589 j
->write_buffers_empty
++;
3590 wake_up_interruptible(&j
->write_q
); /* Wake any blocked writers */
3592 wake_up_interruptible(&j
->poll_q
); /* Wake any blocked selects */
3599 if(j
->ixj_signals
[SIG_WRITE_READY
]) {
3600 ixj_kill_fasync(j
, SIG_WRITE_READY
, POLL_OUT
);
3604 static int idle(IXJ
*j
)
3606 if (ixj_WriteDSPCommand(0x0000, j
)) /* DSP Idle */
3610 if (j
->ssr
.high
|| j
->ssr
.low
) {
3614 j
->flags
.playing
= 0;
3616 j
->flags
.recording
= 0;
3621 static int set_base_frame(IXJ
*j
, int size
)
3627 j
->cid_play_aec_level
= j
->aec_level
;
3629 for (cnt
= 0; cnt
< 10; cnt
++) {
3633 if (j
->ssr
.high
|| j
->ssr
.low
)
3635 if (j
->dsp
.low
!= 0x20) {
3639 /* Set Base Frame Size to 240 pg9-10 8021 */
3643 /* Set Base Frame Size to 160 pg9-10 8021 */
3647 /* Set Base Frame Size to 80 pg9-10 8021 */
3658 if (ixj_WriteDSPCommand(cmd
, j
)) {
3659 j
->baseframe
.high
= j
->baseframe
.low
= 0xFF;
3662 j
->baseframe
.high
= j
->ssr
.high
;
3663 j
->baseframe
.low
= j
->ssr
.low
;
3664 /* If the status returned is 0x0000 (pg9-9 8021) the call failed */
3665 if(j
->baseframe
.high
== 0x00 && j
->baseframe
.low
== 0x00) {
3669 ixj_aec_start(j
, j
->cid_play_aec_level
);
3673 static int set_rec_codec(IXJ
*j
, int rate
)
3677 j
->rec_codec
= rate
;
3681 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
3682 j
->rec_frame_size
= 12;
3689 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
3690 j
->rec_frame_size
= 10;
3697 if (j
->dsp
.low
== 0x20 || j
->flags
.ts85_loaded
) {
3698 j
->rec_frame_size
= 16;
3705 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
3706 j
->rec_frame_size
= 9;
3713 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
3714 j
->rec_frame_size
= 8;
3721 if (j
->dsp
.low
!= 0x20) {
3722 j
->rec_frame_size
= 48;
3729 if (j
->dsp
.low
!= 0x20) {
3730 if (!j
->flags
.g729_loaded
) {
3734 switch (j
->baseframe
.low
) {
3736 j
->rec_frame_size
= 10;
3739 j
->rec_frame_size
= 5;
3742 j
->rec_frame_size
= 15;
3751 if (j
->dsp
.low
!= 0x20) {
3752 if (!j
->flags
.g729_loaded
) {
3756 switch (j
->baseframe
.low
) {
3758 j
->rec_frame_size
= 12;
3761 j
->rec_frame_size
= 6;
3764 j
->rec_frame_size
= 18;
3773 switch (j
->baseframe
.low
) {
3775 j
->rec_frame_size
= 80;
3778 j
->rec_frame_size
= 40;
3781 j
->rec_frame_size
= 120;
3787 switch (j
->baseframe
.low
) {
3789 j
->rec_frame_size
= 80;
3792 j
->rec_frame_size
= 40;
3795 j
->rec_frame_size
= 120;
3801 switch (j
->baseframe
.low
) {
3803 j
->rec_frame_size
= 160;
3806 j
->rec_frame_size
= 80;
3809 j
->rec_frame_size
= 240;
3815 switch (j
->baseframe
.low
) {
3817 j
->rec_frame_size
= 80;
3820 j
->rec_frame_size
= 40;
3823 j
->rec_frame_size
= 120;
3829 switch (j
->baseframe
.low
) {
3831 j
->rec_frame_size
= 80;
3834 j
->rec_frame_size
= 40;
3837 j
->rec_frame_size
= 120;
3843 kfree(j
->read_buffer
);
3844 j
->rec_frame_size
= 0;
3846 j
->read_buffer
= NULL
;
3847 j
->read_buffer_size
= 0;
3854 static int ixj_record_start(IXJ
*j
)
3856 unsigned short cmd
= 0x0000;
3858 if (j
->read_buffer
) {
3861 j
->flags
.recording
= 1;
3862 ixj_WriteDSPCommand(0x0FE0, j
); /* Put the DSP in full power mode. */
3864 if(ixjdebug
& 0x0002)
3865 printk("IXJ %d Starting Record Codec %d at %ld\n", j
->board
, j
->rec_codec
, jiffies
);
3868 switch (j
->rec_codec
) {
3876 cmd
= 0x5130; /* TrueSpeech 8.5 */
3880 cmd
= 0x5133; /* TrueSpeech 4.8 */
3884 cmd
= 0x5134; /* TrueSpeech 4.1 */
3897 if (ixj_WriteDSPCommand(cmd
, j
))
3900 if (!j
->read_buffer
) {
3901 if (!j
->read_buffer
)
3902 j
->read_buffer
= kmalloc(j
->rec_frame_size
* 2, GFP_ATOMIC
);
3903 if (!j
->read_buffer
) {
3904 printk("Read buffer allocation for ixj board %d failed!\n", j
->board
);
3908 j
->read_buffer_size
= j
->rec_frame_size
* 2;
3910 if (ixj_WriteDSPCommand(0x5102, j
)) /* Set Poll sync mode */
3914 switch (j
->rec_mode
) {
3916 cmd
= 0x1C03; /* Record C1 */
3920 if (j
->ver
.low
== 0x12) {
3921 cmd
= 0x1E03; /* Record C1 */
3924 cmd
= 0x1E01; /* Record C1 */
3929 if (j
->ver
.low
== 0x12) {
3930 cmd
= 0x1E83; /* Record C1 */
3933 cmd
= 0x1E81; /* Record C1 */
3938 if (j
->ver
.low
== 0x12) {
3939 cmd
= 0x1F03; /* Record C1 */
3942 cmd
= 0x1F01; /* Record C1 */
3947 if (j
->ver
.low
== 0x12) {
3948 cmd
= 0x1F83; /* Record C1 */
3950 cmd
= 0x1F81; /* Record C1 */
3954 if (ixj_WriteDSPCommand(cmd
, j
))
3957 if (j
->flags
.playing
) {
3958 ixj_aec_start(j
, j
->aec_level
);
3963 static void ixj_record_stop(IXJ
*j
)
3965 if (ixjdebug
& 0x0002)
3966 printk("IXJ %d Stopping Record Codec %d at %ld\n", j
->board
, j
->rec_codec
, jiffies
);
3968 kfree(j
->read_buffer
);
3969 j
->read_buffer
= NULL
;
3970 j
->read_buffer_size
= 0;
3971 if (j
->rec_mode
> -1) {
3972 ixj_WriteDSPCommand(0x5120, j
);
3975 j
->flags
.recording
= 0;
3977 static void ixj_vad(IXJ
*j
, int arg
)
3980 ixj_WriteDSPCommand(0x513F, j
);
3982 ixj_WriteDSPCommand(0x513E, j
);
3985 static void set_rec_depth(IXJ
*j
, int depth
)
3991 ixj_WriteDSPCommand(0x5180 + depth
, j
);
3994 static void set_dtmf_prescale(IXJ
*j
, int volume
)
3996 ixj_WriteDSPCommand(0xCF07, j
);
3997 ixj_WriteDSPCommand(volume
, j
);
4000 static int get_dtmf_prescale(IXJ
*j
)
4002 ixj_WriteDSPCommand(0xCF05, j
);
4003 return j
->ssr
.high
<< 8 | j
->ssr
.low
;
4006 static void set_rec_volume(IXJ
*j
, int volume
)
4008 if(j
->aec_level
== AEC_AGC
) {
4009 if (ixjdebug
& 0x0002)
4010 printk(KERN_INFO
"IXJ: /dev/phone%d Setting AGC Threshold to 0x%4.4x\n", j
->board
, volume
);
4011 ixj_WriteDSPCommand(0xCF96, j
);
4012 ixj_WriteDSPCommand(volume
, j
);
4014 if (ixjdebug
& 0x0002)
4015 printk(KERN_INFO
"IXJ: /dev/phone %d Setting Record Volume to 0x%4.4x\n", j
->board
, volume
);
4016 ixj_WriteDSPCommand(0xCF03, j
);
4017 ixj_WriteDSPCommand(volume
, j
);
4021 static int set_rec_volume_linear(IXJ
*j
, int volume
)
4023 int newvolume
, dsprecmax
;
4025 if (ixjdebug
& 0x0002)
4026 printk(KERN_INFO
"IXJ: /dev/phone %d Setting Linear Record Volume to 0x%4.4x\n", j
->board
, volume
);
4027 if(volume
> 100 || volume
< 0) {
4031 /* This should normalize the perceived volumes between the different cards caused by differences in the hardware */
4032 switch (j
->cardtype
) {
4038 ixj_mixer(0x0203, j
); /*Voice Left Volume unmute 6db */
4039 ixj_mixer(0x0303, j
); /*Voice Right Volume unmute 6db */
4040 ixj_mixer(0x0C00, j
); /*Mono1 unmute 12db */
4042 case QTI_PHONEJACK_LITE
:
4045 case QTI_PHONEJACK_PCI
:
4054 newvolume
= (dsprecmax
* volume
) / 100;
4055 set_rec_volume(j
, newvolume
);
4059 static int get_rec_volume(IXJ
*j
)
4061 if(j
->aec_level
== AEC_AGC
) {
4062 if (ixjdebug
& 0x0002)
4063 printk(KERN_INFO
"Getting AGC Threshold\n");
4064 ixj_WriteDSPCommand(0xCF86, j
);
4065 if (ixjdebug
& 0x0002)
4066 printk(KERN_INFO
"AGC Threshold is 0x%2.2x%2.2x\n", j
->ssr
.high
, j
->ssr
.low
);
4067 return j
->ssr
.high
<< 8 | j
->ssr
.low
;
4069 if (ixjdebug
& 0x0002)
4070 printk(KERN_INFO
"Getting Record Volume\n");
4071 ixj_WriteDSPCommand(0xCF01, j
);
4072 return j
->ssr
.high
<< 8 | j
->ssr
.low
;
4076 static int get_rec_volume_linear(IXJ
*j
)
4078 int volume
, newvolume
, dsprecmax
;
4080 switch (j
->cardtype
) {
4087 case QTI_PHONEJACK_LITE
:
4090 case QTI_PHONEJACK_PCI
:
4099 volume
= get_rec_volume(j
);
4100 newvolume
= (volume
* 100) / dsprecmax
;
4106 static int get_rec_level(IXJ
*j
)
4110 ixj_WriteDSPCommand(0xCF88, j
);
4112 retval
= j
->ssr
.high
<< 8 | j
->ssr
.low
;
4113 retval
= (retval
* 256) / 240;
4117 static void ixj_aec_start(IXJ
*j
, int level
)
4119 j
->aec_level
= level
;
4120 if (ixjdebug
& 0x0002)
4121 printk(KERN_INFO
"AGC set = 0x%2.2x\n", j
->aec_level
);
4125 if (j
->rec_codec
== G729
|| j
->play_codec
== G729
|| j
->rec_codec
== G729B
|| j
->play_codec
== G729B
) {
4126 ixj_WriteDSPCommand(0xE022, j
); /* Move AEC filter buffer */
4128 ixj_WriteDSPCommand(0x0300, j
);
4130 ixj_WriteDSPCommand(0xB001, j
); /* AEC On */
4132 ixj_WriteDSPCommand(0xE013, j
); /* Advanced AEC C1 */
4136 ixj_WriteDSPCommand(0x0000, j
); /* Advanced AEC C2 = off */
4138 ixj_WriteDSPCommand(0xE011, j
);
4139 ixj_WriteDSPCommand(0xFFFF, j
);
4141 ixj_WriteDSPCommand(0xCF97, j
); /* Set AGC Enable */
4142 ixj_WriteDSPCommand(0x0000, j
); /* to off */
4147 ixj_WriteDSPCommand(0x0600, j
); /* Advanced AEC C2 = on medium */
4149 ixj_WriteDSPCommand(0xE011, j
);
4150 ixj_WriteDSPCommand(0x0080, j
);
4152 ixj_WriteDSPCommand(0xCF97, j
); /* Set AGC Enable */
4153 ixj_WriteDSPCommand(0x0000, j
); /* to off */
4158 ixj_WriteDSPCommand(0x0C00, j
); /* Advanced AEC C2 = on high */
4160 ixj_WriteDSPCommand(0xE011, j
);
4161 ixj_WriteDSPCommand(0x0080, j
);
4163 ixj_WriteDSPCommand(0xCF97, j
); /* Set AGC Enable */
4164 ixj_WriteDSPCommand(0x0000, j
); /* to off */
4169 /* First we have to put the AEC into advance auto mode so that AGC will not conflict with it */
4170 ixj_WriteDSPCommand(0x0002, j
); /* Attenuation scaling factor of 2 */
4172 ixj_WriteDSPCommand(0xE011, j
);
4173 ixj_WriteDSPCommand(0x0100, j
); /* Higher Threshold Floor */
4175 ixj_WriteDSPCommand(0xE012, j
); /* Set Train and Lock */
4177 if(j
->cardtype
== QTI_LINEJACK
|| j
->cardtype
== QTI_PHONECARD
)
4178 ixj_WriteDSPCommand(0x0224, j
);
4180 ixj_WriteDSPCommand(0x1224, j
);
4182 ixj_WriteDSPCommand(0xE014, j
);
4183 ixj_WriteDSPCommand(0x0003, j
); /* Lock threashold at 3dB */
4185 ixj_WriteDSPCommand(0xE338, j
); /* Set Echo Suppresser Attenuation to 0dB */
4187 /* Now we can set the AGC initial parameters and turn it on */
4188 ixj_WriteDSPCommand(0xCF90, j
); /* Set AGC Minumum gain */
4189 ixj_WriteDSPCommand(0x0020, j
); /* to 0.125 (-18dB) */
4191 ixj_WriteDSPCommand(0xCF91, j
); /* Set AGC Maximum gain */
4192 ixj_WriteDSPCommand(0x1000, j
); /* to 16 (24dB) */
4194 ixj_WriteDSPCommand(0xCF92, j
); /* Set AGC start gain */
4195 ixj_WriteDSPCommand(0x0800, j
); /* to 8 (+18dB) */
4197 ixj_WriteDSPCommand(0xCF93, j
); /* Set AGC hold time */
4198 ixj_WriteDSPCommand(0x1F40, j
); /* to 2 seconds (units are 250us) */
4200 ixj_WriteDSPCommand(0xCF94, j
); /* Set AGC Attack Time Constant */
4201 ixj_WriteDSPCommand(0x0005, j
); /* to 8ms */
4203 ixj_WriteDSPCommand(0xCF95, j
); /* Set AGC Decay Time Constant */
4204 ixj_WriteDSPCommand(0x000D, j
); /* to 4096ms */
4206 ixj_WriteDSPCommand(0xCF96, j
); /* Set AGC Attack Threshold */
4207 ixj_WriteDSPCommand(0x1200, j
); /* to 25% */
4209 ixj_WriteDSPCommand(0xCF97, j
); /* Set AGC Enable */
4210 ixj_WriteDSPCommand(0x0001, j
); /* to on */
4215 ixj_WriteDSPCommand(0x0002, j
); /* Attenuation scaling factor of 2 */
4217 ixj_WriteDSPCommand(0xE011, j
);
4218 ixj_WriteDSPCommand(0x0100, j
); /* Higher Threshold Floor */
4220 ixj_WriteDSPCommand(0xE012, j
); /* Set Train and Lock */
4222 if(j
->cardtype
== QTI_LINEJACK
|| j
->cardtype
== QTI_PHONECARD
)
4223 ixj_WriteDSPCommand(0x0224, j
);
4225 ixj_WriteDSPCommand(0x1224, j
);
4227 ixj_WriteDSPCommand(0xE014, j
);
4228 ixj_WriteDSPCommand(0x0003, j
); /* Lock threashold at 3dB */
4230 ixj_WriteDSPCommand(0xE338, j
); /* Set Echo Suppresser Attenuation to 0dB */
4237 static void aec_stop(IXJ
*j
)
4239 j
->aec_level
= AEC_OFF
;
4240 if (j
->rec_codec
== G729
|| j
->play_codec
== G729
|| j
->rec_codec
== G729B
|| j
->play_codec
== G729B
) {
4241 ixj_WriteDSPCommand(0xE022, j
); /* Move AEC filter buffer back */
4243 ixj_WriteDSPCommand(0x0700, j
);
4245 if (j
->play_mode
!= -1 && j
->rec_mode
!= -1)
4247 ixj_WriteDSPCommand(0xB002, j
); /* AEC Stop */
4251 static int set_play_codec(IXJ
*j
, int rate
)
4255 j
->play_codec
= rate
;
4259 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
4260 j
->play_frame_size
= 12;
4267 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
4268 j
->play_frame_size
= 10;
4275 if (j
->dsp
.low
== 0x20 || j
->flags
.ts85_loaded
) {
4276 j
->play_frame_size
= 16;
4283 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
4284 j
->play_frame_size
= 9;
4291 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
4292 j
->play_frame_size
= 8;
4299 if (j
->dsp
.low
!= 0x20) {
4300 j
->play_frame_size
= 48;
4307 if (j
->dsp
.low
!= 0x20) {
4308 if (!j
->flags
.g729_loaded
) {
4312 switch (j
->baseframe
.low
) {
4314 j
->play_frame_size
= 10;
4317 j
->play_frame_size
= 5;
4320 j
->play_frame_size
= 15;
4329 if (j
->dsp
.low
!= 0x20) {
4330 if (!j
->flags
.g729_loaded
) {
4334 switch (j
->baseframe
.low
) {
4336 j
->play_frame_size
= 12;
4339 j
->play_frame_size
= 6;
4342 j
->play_frame_size
= 18;
4351 switch (j
->baseframe
.low
) {
4353 j
->play_frame_size
= 80;
4356 j
->play_frame_size
= 40;
4359 j
->play_frame_size
= 120;
4365 switch (j
->baseframe
.low
) {
4367 j
->play_frame_size
= 80;
4370 j
->play_frame_size
= 40;
4373 j
->play_frame_size
= 120;
4379 switch (j
->baseframe
.low
) {
4381 j
->play_frame_size
= 160;
4384 j
->play_frame_size
= 80;
4387 j
->play_frame_size
= 240;
4393 switch (j
->baseframe
.low
) {
4395 j
->play_frame_size
= 80;
4398 j
->play_frame_size
= 40;
4401 j
->play_frame_size
= 120;
4407 switch (j
->baseframe
.low
) {
4409 j
->play_frame_size
= 80;
4412 j
->play_frame_size
= 40;
4415 j
->play_frame_size
= 120;
4421 kfree(j
->write_buffer
);
4422 j
->play_frame_size
= 0;
4424 j
->write_buffer
= NULL
;
4425 j
->write_buffer_size
= 0;
4432 static int ixj_play_start(IXJ
*j
)
4434 unsigned short cmd
= 0x0000;
4436 if (j
->write_buffer
) {
4440 if(ixjdebug
& 0x0002)
4441 printk("IXJ %d Starting Play Codec %d at %ld\n", j
->board
, j
->play_codec
, jiffies
);
4443 j
->flags
.playing
= 1;
4444 ixj_WriteDSPCommand(0x0FE0, j
); /* Put the DSP in full power mode. */
4446 j
->flags
.play_first_frame
= 1;
4449 if (!j
->play_mode
) {
4450 switch (j
->play_codec
) {
4458 cmd
= 0x5230; /* TrueSpeech 8.5 */
4462 cmd
= 0x5233; /* TrueSpeech 4.8 */
4466 cmd
= 0x5234; /* TrueSpeech 4.1 */
4479 if (ixj_WriteDSPCommand(cmd
, j
))
4482 j
->write_buffer
= kmalloc(j
->play_frame_size
* 2, GFP_ATOMIC
);
4483 if (!j
->write_buffer
) {
4484 printk("Write buffer allocation for ixj board %d failed!\n", j
->board
);
4487 /* j->write_buffers_empty = 2; */
4488 j
->write_buffers_empty
= 1;
4489 j
->write_buffer_size
= j
->play_frame_size
* 2;
4490 j
->write_buffer_end
= j
->write_buffer
+ j
->play_frame_size
* 2;
4491 j
->write_buffer_rp
= j
->write_buffer_wp
= j
->write_buffer
;
4493 if (ixj_WriteDSPCommand(0x5202, j
)) /* Set Poll sync mode */
4497 switch (j
->play_mode
) {
4502 if (j
->ver
.low
== 0x12) {
4509 if (j
->ver
.low
== 0x12) {
4516 if (j
->ver
.low
== 0x12) {
4523 if (j
->ver
.low
== 0x12) {
4530 if (ixj_WriteDSPCommand(cmd
, j
))
4533 if (ixj_WriteDSPCommand(0x2000, j
)) /* Playback C2 */
4536 if (ixj_WriteDSPCommand(0x2000 + j
->play_frame_size
, j
)) /* Playback C3 */
4539 if (j
->flags
.recording
) {
4540 ixj_aec_start(j
, j
->aec_level
);
4546 static void ixj_play_stop(IXJ
*j
)
4548 if (ixjdebug
& 0x0002)
4549 printk("IXJ %d Stopping Play Codec %d at %ld\n", j
->board
, j
->play_codec
, jiffies
);
4551 kfree(j
->write_buffer
);
4552 j
->write_buffer
= NULL
;
4553 j
->write_buffer_size
= 0;
4554 if (j
->play_mode
> -1) {
4555 ixj_WriteDSPCommand(0x5221, j
); /* Stop playback and flush buffers. 8022 reference page 9-40 */
4559 j
->flags
.playing
= 0;
4562 static inline int get_play_level(IXJ
*j
)
4566 ixj_WriteDSPCommand(0xCF8F, j
); /* 8022 Reference page 9-38 */
4567 return j
->ssr
.high
<< 8 | j
->ssr
.low
;
4568 retval
= j
->ssr
.high
<< 8 | j
->ssr
.low
;
4569 retval
= (retval
* 256) / 240;
4573 static unsigned int ixj_poll(struct file
*file_p
, poll_table
* wait
)
4575 unsigned int mask
= 0;
4577 IXJ
*j
= get_ixj(NUM(file_p
->f_dentry
->d_inode
));
4579 poll_wait(file_p
, &(j
->poll_q
), wait
);
4580 if (j
->read_buffer_ready
> 0)
4581 mask
|= POLLIN
| POLLRDNORM
; /* readable */
4582 if (j
->write_buffers_empty
> 0)
4583 mask
|= POLLOUT
| POLLWRNORM
; /* writable */
4589 static int ixj_play_tone(IXJ
*j
, char tone
)
4591 if (!j
->tone_state
) {
4592 if(ixjdebug
& 0x0002) {
4593 printk("IXJ %d starting tone %d at %ld\n", j
->board
, tone
, jiffies
);
4595 if (j
->dsp
.low
== 0x20) {
4598 j
->tone_start_jif
= jiffies
;
4603 j
->tone_index
= tone
;
4604 if (ixj_WriteDSPCommand(0x6000 + j
->tone_index
, j
))
4610 static int ixj_set_tone_on(unsigned short arg
, IXJ
*j
)
4612 j
->tone_on_time
= arg
;
4614 if (ixj_WriteDSPCommand(0x6E04, j
)) /* Set Tone On Period */
4618 if (ixj_WriteDSPCommand(arg
, j
))
4624 static int SCI_WaitHighSCI(IXJ
*j
)
4628 j
->pld_scrr
.byte
= inb_p(j
->XILINXbase
);
4629 if (!j
->pld_scrr
.bits
.sci
) {
4630 for (cnt
= 0; cnt
< 10; cnt
++) {
4632 j
->pld_scrr
.byte
= inb_p(j
->XILINXbase
);
4634 if ((j
->pld_scrr
.bits
.sci
))
4637 if (ixjdebug
& 0x0001)
4638 printk(KERN_INFO
"SCI Wait High failed %x\n", j
->pld_scrr
.byte
);
4644 static int SCI_WaitLowSCI(IXJ
*j
)
4648 j
->pld_scrr
.byte
= inb_p(j
->XILINXbase
);
4649 if (j
->pld_scrr
.bits
.sci
) {
4650 for (cnt
= 0; cnt
< 10; cnt
++) {
4652 j
->pld_scrr
.byte
= inb_p(j
->XILINXbase
);
4654 if (!(j
->pld_scrr
.bits
.sci
))
4657 if (ixjdebug
& 0x0001)
4658 printk(KERN_INFO
"SCI Wait Low failed %x\n", j
->pld_scrr
.byte
);
4664 static int SCI_Control(IXJ
*j
, int control
)
4668 j
->pld_scrw
.bits
.c0
= 0; /* Set PLD Serial control interface */
4670 j
->pld_scrw
.bits
.c1
= 0; /* to no selection */
4673 case SCI_Enable_DAA
:
4674 j
->pld_scrw
.bits
.c0
= 1; /* Set PLD Serial control interface */
4676 j
->pld_scrw
.bits
.c1
= 0; /* to write to DAA */
4679 case SCI_Enable_Mixer
:
4680 j
->pld_scrw
.bits
.c0
= 0; /* Set PLD Serial control interface */
4682 j
->pld_scrw
.bits
.c1
= 1; /* to write to mixer */
4685 case SCI_Enable_EEPROM
:
4686 j
->pld_scrw
.bits
.c0
= 1; /* Set PLD Serial control interface */
4688 j
->pld_scrw
.bits
.c1
= 1; /* to write to EEPROM */
4695 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
4701 case SCI_Enable_DAA
:
4702 case SCI_Enable_Mixer
:
4703 case SCI_Enable_EEPROM
:
4704 if (!SCI_WaitHighSCI(j
))
4714 static int SCI_Prepare(IXJ
*j
)
4716 if (!SCI_Control(j
, SCI_End
))
4719 if (!SCI_WaitLowSCI(j
))
4725 static int ixj_get_mixer(long val
, IXJ
*j
)
4727 int reg
= (val
& 0x1F00) >> 8;
4728 return j
->mix
.vol
[reg
];
4731 static int ixj_mixer(long val
, IXJ
*j
)
4735 bytes
.high
= (val
& 0x1F00) >> 8;
4736 bytes
.low
= val
& 0x00FF;
4738 /* save mixer value so we can get back later on */
4739 j
->mix
.vol
[bytes
.high
] = bytes
.low
;
4741 outb_p(bytes
.high
& 0x1F, j
->XILINXbase
+ 0x03); /* Load Mixer Address */
4743 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02); /* Load Mixer Data */
4745 SCI_Control(j
, SCI_Enable_Mixer
);
4747 SCI_Control(j
, SCI_End
);
4752 static int daa_load(BYTES
* p_bytes
, IXJ
*j
)
4754 outb_p(p_bytes
->high
, j
->XILINXbase
+ 0x03);
4755 outb_p(p_bytes
->low
, j
->XILINXbase
+ 0x02);
4756 if (!SCI_Control(j
, SCI_Enable_DAA
))
4762 static int ixj_daa_cr4(IXJ
*j
, char reg
)
4766 switch (j
->daa_mode
) {
4770 case SOP_PU_RINGING
:
4773 case SOP_PU_CONVERSATION
:
4776 case SOP_PU_PULSEDIALING
:
4781 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= reg
;
4783 switch (j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.bitreg
.AGX
) {
4785 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.bitreg
.AGR_Z
= 0;
4788 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.bitreg
.AGR_Z
= 2;
4791 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.bitreg
.AGR_Z
= 1;
4794 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.bitreg
.AGR_Z
= 3;
4798 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
;
4800 if (!daa_load(&bytes
, j
))
4803 if (!SCI_Prepare(j
))
4809 static char daa_int_read(IXJ
*j
)
4813 if (!SCI_Prepare(j
))
4818 outb_p(bytes
.high
, j
->XILINXbase
+ 0x03);
4819 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02);
4821 if (!SCI_Control(j
, SCI_Enable_DAA
))
4824 bytes
.high
= inb_p(j
->XILINXbase
+ 0x03);
4825 bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
4826 if (bytes
.low
!= ALISDAA_ID_BYTE
) {
4827 if (ixjdebug
& 0x0001)
4828 printk("Cannot read DAA ID Byte high = %d low = %d\n", bytes
.high
, bytes
.low
);
4831 if (!SCI_Control(j
, SCI_Enable_DAA
))
4833 if (!SCI_Control(j
, SCI_End
))
4836 bytes
.high
= inb_p(j
->XILINXbase
+ 0x03);
4837 bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
4839 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.reg
= bytes
.high
;
4844 static char daa_CR_read(IXJ
*j
, int cr
)
4849 if (!SCI_Prepare(j
))
4852 switch (j
->daa_mode
) {
4854 bytes
.high
= 0x30 + cr
;
4856 case SOP_PU_RINGING
:
4857 bytes
.high
= 0x70 + cr
;
4859 case SOP_PU_CONVERSATION
:
4860 bytes
.high
= 0xB0 + cr
;
4862 case SOP_PU_PULSEDIALING
:
4863 bytes
.high
= 0xF0 + cr
;
4869 outb_p(bytes
.high
, j
->XILINXbase
+ 0x03);
4870 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02);
4872 if (!SCI_Control(j
, SCI_Enable_DAA
))
4875 bytes
.high
= inb_p(j
->XILINXbase
+ 0x03);
4876 bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
4877 if (bytes
.low
!= ALISDAA_ID_BYTE
) {
4878 if (ixjdebug
& 0x0001)
4879 printk("Cannot read DAA ID Byte high = %d low = %d\n", bytes
.high
, bytes
.low
);
4882 if (!SCI_Control(j
, SCI_Enable_DAA
))
4884 if (!SCI_Control(j
, SCI_End
))
4887 wdata
.word
= inw_p(j
->XILINXbase
+ 0x02);
4891 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr5
.reg
= wdata
.bytes
.high
;
4894 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= wdata
.bytes
.high
;
4897 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
= wdata
.bytes
.high
;
4900 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
= wdata
.bytes
.high
;
4903 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
= wdata
.bytes
.high
;
4906 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
= wdata
.bytes
.high
;
4914 static int ixj_daa_cid_reset(IXJ
*j
)
4919 if (ixjdebug
& 0x0002)
4920 printk("DAA Clearing CID ram\n");
4922 if (!SCI_Prepare(j
))
4927 outb_p(bytes
.high
, j
->XILINXbase
+ 0x03);
4928 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02);
4930 if (!SCI_Control(j
, SCI_Enable_DAA
))
4933 if (!SCI_WaitHighSCI(j
))
4936 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
- 1; i
+= 2) {
4937 bytes
.high
= bytes
.low
= 0x00;
4938 outb_p(bytes
.high
, j
->XILINXbase
+ 0x03);
4940 if (i
< ALISDAA_CALLERID_SIZE
- 1)
4941 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02);
4943 if (!SCI_Control(j
, SCI_Enable_DAA
))
4946 if (!SCI_WaitHighSCI(j
))
4951 if (!SCI_Control(j
, SCI_End
))
4954 if (ixjdebug
& 0x0002)
4955 printk("DAA CID ram cleared\n");
4960 static int ixj_daa_cid_read(IXJ
*j
)
4964 char CID
[ALISDAA_CALLERID_SIZE
], mContinue
;
4967 if (!SCI_Prepare(j
))
4972 outb_p(bytes
.high
, j
->XILINXbase
+ 0x03);
4973 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02);
4975 if (!SCI_Control(j
, SCI_Enable_DAA
))
4978 if (!SCI_WaitHighSCI(j
))
4981 bytes
.high
= inb_p(j
->XILINXbase
+ 0x03);
4982 bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
4983 if (bytes
.low
!= ALISDAA_ID_BYTE
) {
4984 if (ixjdebug
& 0x0001)
4985 printk("DAA Get Version Cannot read DAA ID Byte high = %d low = %d\n", bytes
.high
, bytes
.low
);
4988 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
; i
+= 2) {
4989 bytes
.high
= bytes
.low
= 0x00;
4990 outb_p(bytes
.high
, j
->XILINXbase
+ 0x03);
4991 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02);
4993 if (!SCI_Control(j
, SCI_Enable_DAA
))
4996 if (!SCI_WaitHighSCI(j
))
4999 CID
[i
+ 0] = inb_p(j
->XILINXbase
+ 0x03);
5000 CID
[i
+ 1] = inb_p(j
->XILINXbase
+ 0x02);
5003 if (!SCI_Control(j
, SCI_End
))
5007 pOut
= j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
;
5010 if ((pIn
[1] & 0x03) == 0x01) {
5013 if ((pIn
[2] & 0x0c) == 0x04) {
5014 pOut
[1] = ((pIn
[2] & 0x03) << 6) | ((pIn
[1] & 0xfc) >> 2);
5016 if ((pIn
[3] & 0x30) == 0x10) {
5017 pOut
[2] = ((pIn
[3] & 0x0f) << 4) | ((pIn
[2] & 0xf0) >> 4);
5019 if ((pIn
[4] & 0xc0) == 0x40) {
5020 pOut
[3] = ((pIn
[4] & 0x3f) << 2) | ((pIn
[3] & 0xc0) >> 6);
5024 pIn
+= 5, pOut
+= 4;
5026 memset(&j
->cid
, 0, sizeof(PHONE_CID
));
5027 pOut
= j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
;
5029 strncpy(j
->cid
.month
, pOut
, 2);
5031 strncpy(j
->cid
.day
, pOut
, 2);
5033 strncpy(j
->cid
.hour
, pOut
, 2);
5035 strncpy(j
->cid
.min
, pOut
, 2);
5037 j
->cid
.numlen
= *pOut
;
5039 strncpy(j
->cid
.number
, pOut
, j
->cid
.numlen
);
5040 pOut
+= j
->cid
.numlen
+ 1;
5041 j
->cid
.namelen
= *pOut
;
5043 strncpy(j
->cid
.name
, pOut
, j
->cid
.namelen
);
5045 ixj_daa_cid_reset(j
);
5049 static char daa_get_version(IXJ
*j
)
5053 if (!SCI_Prepare(j
))
5058 outb_p(bytes
.high
, j
->XILINXbase
+ 0x03);
5059 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02);
5061 if (!SCI_Control(j
, SCI_Enable_DAA
))
5064 bytes
.high
= inb_p(j
->XILINXbase
+ 0x03);
5065 bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
5066 if (bytes
.low
!= ALISDAA_ID_BYTE
) {
5067 if (ixjdebug
& 0x0001)
5068 printk("DAA Get Version Cannot read DAA ID Byte high = %d low = %d\n", bytes
.high
, bytes
.low
);
5071 if (!SCI_Control(j
, SCI_Enable_DAA
))
5074 if (!SCI_Control(j
, SCI_End
))
5077 bytes
.high
= inb_p(j
->XILINXbase
+ 0x03);
5078 bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
5079 if (ixjdebug
& 0x0002)
5080 printk("DAA CR5 Byte high = 0x%x low = 0x%x\n", bytes
.high
, bytes
.low
);
5081 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr5
.reg
= bytes
.high
;
5085 static int daa_set_mode(IXJ
*j
, int mode
)
5088 The DAA *MUST* be in the conversation mode if the
5089 PSTN line is to be seized (PSTN line off-hook).
5090 Taking the PSTN line off-hook while the DAA is in
5091 a mode other than conversation mode will cause a
5092 hardware failure of the ALIS-A part.
5095 The DAA can only go to SLEEP, RINGING or PULSEDIALING modes
5096 if the PSTN line is on-hook. Failure to have the PSTN line
5097 in the on-hook state WILL CAUSE A HARDWARE FAILURE OF THE
5103 j
->flags
.pstn_rmr
= 0;
5105 if (!SCI_Prepare(j
))
5110 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
5112 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5113 j
->pld_slicw
.bits
.rly2
= 0;
5114 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
5116 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
;
5117 daa_load(&bytes
, j
);
5118 if (!SCI_Prepare(j
))
5121 j
->daa_mode
= SOP_PU_SLEEP
;
5124 if(j
->daa_mode
== SOP_PU_SLEEP
)
5128 if (ixjdebug
& 0x0008)
5129 printk(KERN_INFO
"phone DAA: SOP_PU_SLEEP at %ld\n", jiffies
);
5130 /* if(j->daa_mode == SOP_PU_CONVERSATION) */
5132 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
5134 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5135 j
->pld_slicw
.bits
.rly2
= 0;
5136 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
5138 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
;
5139 daa_load(&bytes
, j
);
5140 if (!SCI_Prepare(j
))
5143 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
5145 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5146 j
->pld_slicw
.bits
.rly2
= 0;
5147 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
5149 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
;
5150 daa_load(&bytes
, j
);
5151 if (!SCI_Prepare(j
))
5154 j
->daa_mode
= SOP_PU_SLEEP
;
5155 j
->flags
.pstn_ringing
= 0;
5156 j
->ex
.bits
.pstn_ring
= 0;
5157 j
->pstn_sleeptil
= jiffies
+ (hertz
/ 4);
5158 wake_up_interruptible(&j
->read_q
); /* Wake any blocked readers */
5159 wake_up_interruptible(&j
->write_q
); /* Wake any blocked writers */
5160 wake_up_interruptible(&j
->poll_q
); /* Wake any blocked selects */
5162 case SOP_PU_RINGING
:
5163 if (ixjdebug
& 0x0008)
5164 printk(KERN_INFO
"phone DAA: SOP_PU_RINGING at %ld\n", jiffies
);
5165 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
5167 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5168 j
->pld_slicw
.bits
.rly2
= 0;
5169 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
5171 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
;
5172 daa_load(&bytes
, j
);
5173 if (!SCI_Prepare(j
))
5175 j
->daa_mode
= SOP_PU_RINGING
;
5177 case SOP_PU_CONVERSATION
:
5178 if (ixjdebug
& 0x0008)
5179 printk(KERN_INFO
"phone DAA: SOP_PU_CONVERSATION at %ld\n", jiffies
);
5181 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
;
5182 daa_load(&bytes
, j
);
5183 if (!SCI_Prepare(j
))
5185 j
->pld_slicw
.bits
.rly2
= 1;
5186 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
5187 j
->pld_scrw
.bits
.daafsyncen
= 1; /* Turn on DAA Frame Sync */
5189 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5190 j
->daa_mode
= SOP_PU_CONVERSATION
;
5191 j
->flags
.pstn_ringing
= 0;
5192 j
->ex
.bits
.pstn_ring
= 0;
5193 j
->pstn_sleeptil
= jiffies
;
5194 j
->pstn_ring_start
= j
->pstn_ring_stop
= j
->pstn_ring_int
= 0;
5196 case SOP_PU_PULSEDIALING
:
5197 if (ixjdebug
& 0x0008)
5198 printk(KERN_INFO
"phone DAA: SOP_PU_PULSEDIALING at %ld\n", jiffies
);
5199 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
5201 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5202 j
->pld_slicw
.bits
.rly2
= 0;
5203 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
5205 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
;
5206 daa_load(&bytes
, j
);
5207 if (!SCI_Prepare(j
))
5209 j
->daa_mode
= SOP_PU_PULSEDIALING
;
5217 static int ixj_daa_write(IXJ
*j
)
5221 j
->flags
.pstncheck
= 1;
5223 daa_set_mode(j
, SOP_PU_SLEEP
);
5225 if (!SCI_Prepare(j
))
5228 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5231 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
;
5232 if (!daa_load(&bytes
, j
))
5235 bytes
.high
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
;
5236 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
;
5237 if (!daa_load(&bytes
, j
))
5240 bytes
.high
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
;
5241 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
;
5242 if (!daa_load(&bytes
, j
))
5245 if (!SCI_Prepare(j
))
5249 bytes
.low
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr7
.reg
;
5250 if (!daa_load(&bytes
, j
))
5253 bytes
.high
= j
->m_DAAShadowRegs
.XOP_xr6_W
.reg
;
5254 bytes
.low
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr5
.reg
;
5255 if (!daa_load(&bytes
, j
))
5258 bytes
.high
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr4
.reg
;
5259 bytes
.low
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr3
.reg
;
5260 if (!daa_load(&bytes
, j
))
5263 bytes
.high
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr2
.reg
;
5264 bytes
.low
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr1
.reg
;
5265 if (!daa_load(&bytes
, j
))
5268 bytes
.high
= j
->m_DAAShadowRegs
.XOP_xr0_W
.reg
;
5270 if (!daa_load(&bytes
, j
))
5273 if (!SCI_Prepare(j
))
5277 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[7];
5278 if (!daa_load(&bytes
, j
))
5281 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[6];
5282 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[5];
5283 if (!daa_load(&bytes
, j
))
5286 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[4];
5287 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[3];
5288 if (!daa_load(&bytes
, j
))
5291 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[2];
5292 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[1];
5293 if (!daa_load(&bytes
, j
))
5296 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[0];
5298 if (!daa_load(&bytes
, j
))
5301 if (!SCI_Control(j
, SCI_End
))
5303 if (!SCI_WaitLowSCI(j
))
5307 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[7];
5308 if (!daa_load(&bytes
, j
))
5311 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[6];
5312 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[5];
5313 if (!daa_load(&bytes
, j
))
5316 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[4];
5317 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[3];
5318 if (!daa_load(&bytes
, j
))
5321 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[2];
5322 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[1];
5323 if (!daa_load(&bytes
, j
))
5326 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[0];
5328 if (!daa_load(&bytes
, j
))
5331 if (!SCI_Control(j
, SCI_End
))
5333 if (!SCI_WaitLowSCI(j
))
5337 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[7];
5338 if (!daa_load(&bytes
, j
))
5341 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[6];
5342 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[5];
5343 if (!daa_load(&bytes
, j
))
5346 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[4];
5347 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[3];
5348 if (!daa_load(&bytes
, j
))
5351 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[2];
5352 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[1];
5353 if (!daa_load(&bytes
, j
))
5356 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[0];
5358 if (!daa_load(&bytes
, j
))
5361 if (!SCI_Control(j
, SCI_End
))
5363 if (!SCI_WaitLowSCI(j
))
5367 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[7];
5368 if (!daa_load(&bytes
, j
))
5371 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[6];
5372 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[5];
5373 if (!daa_load(&bytes
, j
))
5376 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[4];
5377 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[3];
5378 if (!daa_load(&bytes
, j
))
5381 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[2];
5382 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[1];
5383 if (!daa_load(&bytes
, j
))
5386 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[0];
5388 if (!daa_load(&bytes
, j
))
5391 if (!SCI_Control(j
, SCI_End
))
5393 if (!SCI_WaitLowSCI(j
))
5397 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[7];
5398 if (!daa_load(&bytes
, j
))
5401 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[6];
5402 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[5];
5403 if (!daa_load(&bytes
, j
))
5406 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[4];
5407 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[3];
5408 if (!daa_load(&bytes
, j
))
5411 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[2];
5412 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[1];
5413 if (!daa_load(&bytes
, j
))
5416 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[0];
5418 if (!daa_load(&bytes
, j
))
5421 if (!SCI_Control(j
, SCI_End
))
5423 if (!SCI_WaitLowSCI(j
))
5427 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[7];
5428 if (!daa_load(&bytes
, j
))
5431 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[6];
5432 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[5];
5433 if (!daa_load(&bytes
, j
))
5436 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[4];
5437 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[3];
5438 if (!daa_load(&bytes
, j
))
5441 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[2];
5442 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[1];
5443 if (!daa_load(&bytes
, j
))
5446 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[0];
5448 if (!daa_load(&bytes
, j
))
5451 if (!SCI_Control(j
, SCI_End
))
5453 if (!SCI_WaitLowSCI(j
))
5457 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[7];
5458 if (!daa_load(&bytes
, j
))
5461 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[6];
5462 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[5];
5463 if (!daa_load(&bytes
, j
))
5466 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[4];
5467 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[3];
5468 if (!daa_load(&bytes
, j
))
5471 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[2];
5472 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[1];
5473 if (!daa_load(&bytes
, j
))
5476 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[0];
5478 if (!daa_load(&bytes
, j
))
5481 if (!SCI_Control(j
, SCI_End
))
5483 if (!SCI_WaitLowSCI(j
))
5487 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[7];
5488 if (!daa_load(&bytes
, j
))
5491 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[6];
5492 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[5];
5493 if (!daa_load(&bytes
, j
))
5496 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[4];
5497 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[3];
5498 if (!daa_load(&bytes
, j
))
5501 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[2];
5502 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[1];
5503 if (!daa_load(&bytes
, j
))
5506 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[0];
5508 if (!daa_load(&bytes
, j
))
5511 if (!SCI_Control(j
, SCI_End
))
5513 if (!SCI_WaitLowSCI(j
))
5517 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[7];
5518 if (!daa_load(&bytes
, j
))
5521 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[6];
5522 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[5];
5523 if (!daa_load(&bytes
, j
))
5526 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[4];
5527 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[3];
5528 if (!daa_load(&bytes
, j
))
5531 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[2];
5532 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[1];
5533 if (!daa_load(&bytes
, j
))
5536 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[0];
5538 if (!daa_load(&bytes
, j
))
5541 if (!SCI_Control(j
, SCI_End
))
5543 if (!SCI_WaitLowSCI(j
))
5547 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[3];
5548 if (!daa_load(&bytes
, j
))
5551 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[2];
5552 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[1];
5553 if (!daa_load(&bytes
, j
))
5556 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[0];
5558 if (!daa_load(&bytes
, j
))
5561 if (!SCI_Control(j
, SCI_End
))
5563 if (!SCI_WaitLowSCI(j
))
5567 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[3];
5568 if (!daa_load(&bytes
, j
))
5571 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[2];
5572 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[1];
5573 if (!daa_load(&bytes
, j
))
5576 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[0];
5578 if (!daa_load(&bytes
, j
))
5581 if (!SCI_Control(j
, SCI_End
))
5583 if (!SCI_WaitLowSCI(j
))
5587 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[3];
5588 if (!daa_load(&bytes
, j
))
5591 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[2];
5592 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[1];
5593 if (!daa_load(&bytes
, j
))
5596 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[0];
5598 if (!daa_load(&bytes
, j
))
5601 if (!SCI_Control(j
, SCI_End
))
5603 if (!SCI_WaitLowSCI(j
))
5607 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[3];
5608 if (!daa_load(&bytes
, j
))
5611 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[2];
5612 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[1];
5613 if (!daa_load(&bytes
, j
))
5616 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[0];
5618 if (!daa_load(&bytes
, j
))
5621 if (!SCI_Control(j
, SCI_End
))
5623 if (!SCI_WaitLowSCI(j
))
5627 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[3];
5628 if (!daa_load(&bytes
, j
))
5631 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[2];
5632 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[1];
5633 if (!daa_load(&bytes
, j
))
5636 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[0];
5638 if (!daa_load(&bytes
, j
))
5641 if (!SCI_Control(j
, SCI_End
))
5643 if (!SCI_WaitLowSCI(j
))
5647 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[7];
5648 if (!daa_load(&bytes
, j
))
5651 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[6];
5652 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[5];
5653 if (!daa_load(&bytes
, j
))
5656 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[4];
5657 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[3];
5658 if (!daa_load(&bytes
, j
))
5661 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[2];
5662 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[1];
5663 if (!daa_load(&bytes
, j
))
5666 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[0];
5668 if (!daa_load(&bytes
, j
))
5671 if (!SCI_Control(j
, SCI_End
))
5673 if (!SCI_WaitLowSCI(j
))
5677 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[7];
5678 if (!daa_load(&bytes
, j
))
5681 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[6];
5682 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[5];
5683 if (!daa_load(&bytes
, j
))
5686 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[4];
5687 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[3];
5688 if (!daa_load(&bytes
, j
))
5691 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[2];
5692 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[1];
5693 if (!daa_load(&bytes
, j
))
5696 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[0];
5698 if (!daa_load(&bytes
, j
))
5702 j
->pld_scrr
.byte
= inb_p(j
->XILINXbase
);
5703 if (!SCI_Control(j
, SCI_End
))
5706 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5708 if (ixjdebug
& 0x0002)
5709 printk("DAA Coefficients Loaded\n");
5711 j
->flags
.pstncheck
= 0;
5715 int ixj_set_tone_off(unsigned short arg
, IXJ
*j
)
5717 j
->tone_off_time
= arg
;
5718 if (ixj_WriteDSPCommand(0x6E05, j
)) /* Set Tone Off Period */
5721 if (ixj_WriteDSPCommand(arg
, j
))
5726 static int ixj_get_tone_on(IXJ
*j
)
5728 if (ixj_WriteDSPCommand(0x6E06, j
)) /* Get Tone On Period */
5734 static int ixj_get_tone_off(IXJ
*j
)
5736 if (ixj_WriteDSPCommand(0x6E07, j
)) /* Get Tone Off Period */
5742 static void ixj_busytone(IXJ
*j
)
5744 j
->flags
.ringback
= 0;
5745 j
->flags
.dialtone
= 0;
5746 j
->flags
.busytone
= 1;
5747 ixj_set_tone_on(0x07D0, j
);
5748 ixj_set_tone_off(0x07D0, j
);
5749 ixj_play_tone(j
, 27);
5752 static void ixj_dialtone(IXJ
*j
)
5754 j
->flags
.ringback
= 0;
5755 j
->flags
.dialtone
= 1;
5756 j
->flags
.busytone
= 0;
5757 if (j
->dsp
.low
== 0x20) {
5760 ixj_set_tone_on(0xFFFF, j
);
5761 ixj_set_tone_off(0x0000, j
);
5762 ixj_play_tone(j
, 25);
5766 static void ixj_cpt_stop(IXJ
*j
)
5768 if(j
->tone_state
|| j
->tone_cadence_state
)
5770 j
->flags
.dialtone
= 0;
5771 j
->flags
.busytone
= 0;
5772 j
->flags
.ringback
= 0;
5773 ixj_set_tone_on(0x0001, j
);
5774 ixj_set_tone_off(0x0000, j
);
5775 ixj_play_tone(j
, 0);
5776 j
->tone_state
= j
->tone_cadence_state
= 0;
5778 kfree(j
->cadence_t
->ce
);
5779 kfree(j
->cadence_t
);
5780 j
->cadence_t
= NULL
;
5783 if (j
->play_mode
== -1 && j
->rec_mode
== -1)
5785 if (j
->play_mode
!= -1 && j
->dsp
.low
== 0x20)
5787 if (j
->rec_mode
!= -1 && j
->dsp
.low
== 0x20)
5788 ixj_record_start(j
);
5791 static void ixj_ringback(IXJ
*j
)
5793 j
->flags
.busytone
= 0;
5794 j
->flags
.dialtone
= 0;
5795 j
->flags
.ringback
= 1;
5796 ixj_set_tone_on(0x0FA0, j
);
5797 ixj_set_tone_off(0x2EE0, j
);
5798 ixj_play_tone(j
, 26);
5801 static void ixj_testram(IXJ
*j
)
5803 ixj_WriteDSPCommand(0x3001, j
); /* Test External SRAM */
5806 static int ixj_build_cadence(IXJ
*j
, IXJ_CADENCE __user
* cp
)
5809 IXJ_CADENCE_ELEMENT __user
*cep
;
5810 IXJ_CADENCE_ELEMENT
*lcep
;
5814 lcp
= kmalloc(sizeof(ixj_cadence
), GFP_KERNEL
);
5819 if (copy_from_user(&lcp
->elements_used
,
5820 &cp
->elements_used
, sizeof(int)))
5822 if (copy_from_user(&lcp
->termination
,
5823 &cp
->termination
, sizeof(IXJ_CADENCE_TERM
)))
5825 if (get_user(cep
, &cp
->ce
))
5829 if ((unsigned)lcp
->elements_used
>= ~0U/sizeof(IXJ_CADENCE_ELEMENT
))
5833 lcep
= kmalloc(sizeof(IXJ_CADENCE_ELEMENT
) * lcp
->elements_used
, GFP_KERNEL
);
5838 if (copy_from_user(lcep
, cep
, sizeof(IXJ_CADENCE_ELEMENT
) * lcp
->elements_used
))
5842 kfree(j
->cadence_t
->ce
);
5843 kfree(j
->cadence_t
);
5845 lcp
->ce
= (void *) lcep
;
5847 j
->tone_cadence_state
= 0;
5848 ixj_set_tone_on(lcp
->ce
[0].tone_on_time
, j
);
5849 ixj_set_tone_off(lcp
->ce
[0].tone_off_time
, j
);
5850 if (j
->cadence_t
->ce
[j
->tone_cadence_state
].freq0
) {
5851 ti
.tone_index
= j
->cadence_t
->ce
[j
->tone_cadence_state
].index
;
5852 ti
.freq0
= j
->cadence_t
->ce
[j
->tone_cadence_state
].freq0
;
5853 ti
.gain0
= j
->cadence_t
->ce
[j
->tone_cadence_state
].gain0
;
5854 ti
.freq1
= j
->cadence_t
->ce
[j
->tone_cadence_state
].freq1
;
5855 ti
.gain1
= j
->cadence_t
->ce
[j
->tone_cadence_state
].gain1
;
5856 ixj_init_tone(j
, &ti
);
5858 ixj_play_tone(j
, lcp
->ce
[0].index
);
5867 static int ixj_build_filter_cadence(IXJ
*j
, IXJ_FILTER_CADENCE __user
* cp
)
5869 IXJ_FILTER_CADENCE
*lcp
;
5870 lcp
= kmalloc(sizeof(IXJ_FILTER_CADENCE
), GFP_KERNEL
);
5872 if(ixjdebug
& 0x0001) {
5873 printk(KERN_INFO
"Could not allocate memory for cadence\n");
5877 if (copy_from_user(lcp
, cp
, sizeof(IXJ_FILTER_CADENCE
))) {
5878 if(ixjdebug
& 0x0001) {
5879 printk(KERN_INFO
"Could not copy cadence to kernel\n");
5884 if (lcp
->filter
> 5) {
5885 if(ixjdebug
& 0x0001) {
5886 printk(KERN_INFO
"Cadence out of range\n");
5891 j
->cadence_f
[lcp
->filter
].state
= 0;
5892 j
->cadence_f
[lcp
->filter
].enable
= lcp
->enable
;
5893 j
->filter_en
[lcp
->filter
] = j
->cadence_f
[lcp
->filter
].en_filter
= lcp
->en_filter
;
5894 j
->cadence_f
[lcp
->filter
].on1
= lcp
->on1
;
5895 j
->cadence_f
[lcp
->filter
].on1min
= 0;
5896 j
->cadence_f
[lcp
->filter
].on1max
= 0;
5897 j
->cadence_f
[lcp
->filter
].off1
= lcp
->off1
;
5898 j
->cadence_f
[lcp
->filter
].off1min
= 0;
5899 j
->cadence_f
[lcp
->filter
].off1max
= 0;
5900 j
->cadence_f
[lcp
->filter
].on2
= lcp
->on2
;
5901 j
->cadence_f
[lcp
->filter
].on2min
= 0;
5902 j
->cadence_f
[lcp
->filter
].on2max
= 0;
5903 j
->cadence_f
[lcp
->filter
].off2
= lcp
->off2
;
5904 j
->cadence_f
[lcp
->filter
].off2min
= 0;
5905 j
->cadence_f
[lcp
->filter
].off2max
= 0;
5906 j
->cadence_f
[lcp
->filter
].on3
= lcp
->on3
;
5907 j
->cadence_f
[lcp
->filter
].on3min
= 0;
5908 j
->cadence_f
[lcp
->filter
].on3max
= 0;
5909 j
->cadence_f
[lcp
->filter
].off3
= lcp
->off3
;
5910 j
->cadence_f
[lcp
->filter
].off3min
= 0;
5911 j
->cadence_f
[lcp
->filter
].off3max
= 0;
5912 if(ixjdebug
& 0x0002) {
5913 printk(KERN_INFO
"Cadence %d loaded\n", lcp
->filter
);
5919 static void add_caps(IXJ
*j
)
5922 j
->caplist
[j
->caps
].cap
= PHONE_VENDOR_QUICKNET
;
5923 strcpy(j
->caplist
[j
->caps
].desc
, "Quicknet Technologies, Inc. (www.quicknet.net)");
5924 j
->caplist
[j
->caps
].captype
= vendor
;
5925 j
->caplist
[j
->caps
].handle
= j
->caps
++;
5926 j
->caplist
[j
->caps
].captype
= device
;
5927 switch (j
->cardtype
) {
5929 strcpy(j
->caplist
[j
->caps
].desc
, "Quicknet Internet PhoneJACK");
5932 strcpy(j
->caplist
[j
->caps
].desc
, "Quicknet Internet LineJACK");
5934 case QTI_PHONEJACK_LITE
:
5935 strcpy(j
->caplist
[j
->caps
].desc
, "Quicknet Internet PhoneJACK Lite");
5937 case QTI_PHONEJACK_PCI
:
5938 strcpy(j
->caplist
[j
->caps
].desc
, "Quicknet Internet PhoneJACK PCI");
5941 strcpy(j
->caplist
[j
->caps
].desc
, "Quicknet Internet PhoneCARD");
5944 j
->caplist
[j
->caps
].cap
= j
->cardtype
;
5945 j
->caplist
[j
->caps
].handle
= j
->caps
++;
5946 strcpy(j
->caplist
[j
->caps
].desc
, "POTS");
5947 j
->caplist
[j
->caps
].captype
= port
;
5948 j
->caplist
[j
->caps
].cap
= pots
;
5949 j
->caplist
[j
->caps
].handle
= j
->caps
++;
5951 /* add devices that can do speaker/mic */
5952 switch (j
->cardtype
) {
5955 case QTI_PHONEJACK_PCI
:
5957 strcpy(j
->caplist
[j
->caps
].desc
, "SPEAKER");
5958 j
->caplist
[j
->caps
].captype
= port
;
5959 j
->caplist
[j
->caps
].cap
= speaker
;
5960 j
->caplist
[j
->caps
].handle
= j
->caps
++;
5965 /* add devices that can do handset */
5966 switch (j
->cardtype
) {
5968 strcpy(j
->caplist
[j
->caps
].desc
, "HANDSET");
5969 j
->caplist
[j
->caps
].captype
= port
;
5970 j
->caplist
[j
->caps
].cap
= handset
;
5971 j
->caplist
[j
->caps
].handle
= j
->caps
++;
5977 /* add devices that can do PSTN */
5978 switch (j
->cardtype
) {
5980 strcpy(j
->caplist
[j
->caps
].desc
, "PSTN");
5981 j
->caplist
[j
->caps
].captype
= port
;
5982 j
->caplist
[j
->caps
].cap
= pstn
;
5983 j
->caplist
[j
->caps
].handle
= j
->caps
++;
5989 /* add codecs - all cards can do uLaw, linear 8/16, and Windows sound system */
5990 strcpy(j
->caplist
[j
->caps
].desc
, "ULAW");
5991 j
->caplist
[j
->caps
].captype
= codec
;
5992 j
->caplist
[j
->caps
].cap
= ULAW
;
5993 j
->caplist
[j
->caps
].handle
= j
->caps
++;
5995 strcpy(j
->caplist
[j
->caps
].desc
, "LINEAR 16 bit");
5996 j
->caplist
[j
->caps
].captype
= codec
;
5997 j
->caplist
[j
->caps
].cap
= LINEAR16
;
5998 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6000 strcpy(j
->caplist
[j
->caps
].desc
, "LINEAR 8 bit");
6001 j
->caplist
[j
->caps
].captype
= codec
;
6002 j
->caplist
[j
->caps
].cap
= LINEAR8
;
6003 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6005 strcpy(j
->caplist
[j
->caps
].desc
, "Windows Sound System");
6006 j
->caplist
[j
->caps
].captype
= codec
;
6007 j
->caplist
[j
->caps
].cap
= WSS
;
6008 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6010 /* software ALAW codec, made from ULAW */
6011 strcpy(j
->caplist
[j
->caps
].desc
, "ALAW");
6012 j
->caplist
[j
->caps
].captype
= codec
;
6013 j
->caplist
[j
->caps
].cap
= ALAW
;
6014 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6016 /* version 12 of the 8020 does the following codecs in a broken way */
6017 if (j
->dsp
.low
!= 0x20 || j
->ver
.low
!= 0x12) {
6018 strcpy(j
->caplist
[j
->caps
].desc
, "G.723.1 6.3kbps");
6019 j
->caplist
[j
->caps
].captype
= codec
;
6020 j
->caplist
[j
->caps
].cap
= G723_63
;
6021 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6023 strcpy(j
->caplist
[j
->caps
].desc
, "G.723.1 5.3kbps");
6024 j
->caplist
[j
->caps
].captype
= codec
;
6025 j
->caplist
[j
->caps
].cap
= G723_53
;
6026 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6028 strcpy(j
->caplist
[j
->caps
].desc
, "TrueSpeech 4.8kbps");
6029 j
->caplist
[j
->caps
].captype
= codec
;
6030 j
->caplist
[j
->caps
].cap
= TS48
;
6031 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6033 strcpy(j
->caplist
[j
->caps
].desc
, "TrueSpeech 4.1kbps");
6034 j
->caplist
[j
->caps
].captype
= codec
;
6035 j
->caplist
[j
->caps
].cap
= TS41
;
6036 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6039 /* 8020 chips can do TS8.5 native, and 8021/8022 can load it */
6040 if (j
->dsp
.low
== 0x20 || j
->flags
.ts85_loaded
) {
6041 strcpy(j
->caplist
[j
->caps
].desc
, "TrueSpeech 8.5kbps");
6042 j
->caplist
[j
->caps
].captype
= codec
;
6043 j
->caplist
[j
->caps
].cap
= TS85
;
6044 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6047 /* 8021 chips can do G728 */
6048 if (j
->dsp
.low
== 0x21) {
6049 strcpy(j
->caplist
[j
->caps
].desc
, "G.728 16kbps");
6050 j
->caplist
[j
->caps
].captype
= codec
;
6051 j
->caplist
[j
->caps
].cap
= G728
;
6052 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6055 /* 8021/8022 chips can do G729 if loaded */
6056 if (j
->dsp
.low
!= 0x20 && j
->flags
.g729_loaded
) {
6057 strcpy(j
->caplist
[j
->caps
].desc
, "G.729A 8kbps");
6058 j
->caplist
[j
->caps
].captype
= codec
;
6059 j
->caplist
[j
->caps
].cap
= G729
;
6060 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6062 if (j
->dsp
.low
!= 0x20 && j
->flags
.g729_loaded
) {
6063 strcpy(j
->caplist
[j
->caps
].desc
, "G.729B 8kbps");
6064 j
->caplist
[j
->caps
].captype
= codec
;
6065 j
->caplist
[j
->caps
].cap
= G729B
;
6066 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6070 static int capabilities_check(IXJ
*j
, struct phone_capability
*pcreq
)
6074 for (cnt
= 0; cnt
< j
->caps
; cnt
++) {
6075 if (pcreq
->captype
== j
->caplist
[cnt
].captype
6076 && pcreq
->cap
== j
->caplist
[cnt
].cap
) {
6084 static int ixj_ioctl(struct inode
*inode
, struct file
*file_p
, unsigned int cmd
, unsigned long arg
)
6089 void __user
*argp
= (void __user
*)arg
;
6091 unsigned int raise
, mant
;
6092 unsigned int minor
= iminor(inode
);
6093 int board
= NUM(inode
);
6095 IXJ
*j
= get_ixj(NUM(inode
));
6100 * Set up locks to ensure that only one process is talking to the DSP at a time.
6101 * This is necessary to keep the DSP from locking up.
6103 while(test_and_set_bit(board
, (void *)&j
->busyflags
) != 0)
6104 schedule_timeout_interruptible(1);
6105 if (ixjdebug
& 0x0040)
6106 printk("phone%d ioctl, cmd: 0x%x, arg: 0x%lx\n", minor
, cmd
, arg
);
6107 if (minor
>= IXJMAX
) {
6108 clear_bit(board
, &j
->busyflags
);
6112 * Check ioctls only root can use.
6114 if (!capable(CAP_SYS_ADMIN
)) {
6116 case IXJCTL_TESTRAM
:
6122 case IXJCTL_TESTRAM
:
6124 retval
= (j
->ssr
.high
<< 8) + j
->ssr
.low
;
6126 case IXJCTL_CARDTYPE
:
6127 retval
= j
->cardtype
;
6132 case IXJCTL_VERSION
:
6135 snprintf(arg_str
, sizeof(arg_str
),
6136 "\nDriver version %i.%i.%i", IXJ_VER_MAJOR
,
6137 IXJ_VER_MINOR
, IXJ_BLD_VER
);
6138 if (copy_to_user(argp
, arg_str
, strlen(arg_str
)))
6142 case PHONE_RING_CADENCE
:
6143 j
->ring_cadence
= arg
;
6147 if (copy_from_user(&j
->cid_send
, argp
, sizeof(PHONE_CID
))) {
6152 memset(&j
->cid_send
, 0, sizeof(PHONE_CID
));
6156 /* Binary compatbility */
6157 case OLD_PHONE_RING_START
:
6160 case PHONE_RING_START
:
6162 if (copy_from_user(&j
->cid_send
, argp
, sizeof(PHONE_CID
))) {
6168 memset(&j
->cid_send
, 0, sizeof(PHONE_CID
));
6172 case PHONE_RING_STOP
:
6173 j
->flags
.cringing
= 0;
6174 if(j
->cadence_f
[5].enable
) {
6175 j
->cadence_f
[5].state
= 0;
6180 retval
= ixj_ring(j
);
6182 case PHONE_EXCEPTION
:
6183 retval
= j
->ex
.bytes
;
6184 if(j
->ex
.bits
.flash
) {
6186 j
->ex
.bits
.flash
= 0;
6188 j
->ex
.bits
.pstn_ring
= 0;
6189 j
->ex
.bits
.caller_id
= 0;
6190 j
->ex
.bits
.pstn_wink
= 0;
6199 j
->ex
.bits
.reserved
= 0;
6201 case PHONE_HOOKSTATE
:
6202 j
->ex
.bits
.hookstate
= 0;
6203 retval
= j
->hookstate
; //j->r_hook;
6205 case IXJCTL_SET_LED
:
6206 LED_SetState(arg
, j
);
6209 retval
= set_base_frame(j
, arg
);
6211 case PHONE_REC_CODEC
:
6212 retval
= set_rec_codec(j
, arg
);
6217 case PHONE_REC_START
:
6218 ixj_record_start(j
);
6220 case PHONE_REC_STOP
:
6223 case PHONE_REC_DEPTH
:
6224 set_rec_depth(j
, arg
);
6226 case PHONE_REC_VOLUME
:
6228 retval
= get_rec_volume(j
);
6231 set_rec_volume(j
, arg
);
6235 case PHONE_REC_VOLUME_LINEAR
:
6237 retval
= get_rec_volume_linear(j
);
6240 set_rec_volume_linear(j
, arg
);
6244 case IXJCTL_DTMF_PRESCALE
:
6246 retval
= get_dtmf_prescale(j
);
6249 set_dtmf_prescale(j
, arg
);
6253 case PHONE_REC_LEVEL
:
6254 retval
= get_rec_level(j
);
6257 retval
= ixj_siadc(j
, arg
);
6260 retval
= ixj_sidac(j
, arg
);
6262 case IXJCTL_AEC_START
:
6263 ixj_aec_start(j
, arg
);
6265 case IXJCTL_AEC_STOP
:
6268 case IXJCTL_AEC_GET_LEVEL
:
6269 retval
= j
->aec_level
;
6271 case PHONE_PLAY_CODEC
:
6272 retval
= set_play_codec(j
, arg
);
6274 case PHONE_PLAY_START
:
6275 retval
= ixj_play_start(j
);
6277 case PHONE_PLAY_STOP
:
6280 case PHONE_PLAY_DEPTH
:
6281 set_play_depth(j
, arg
);
6283 case PHONE_PLAY_VOLUME
:
6285 retval
= get_play_volume(j
);
6288 set_play_volume(j
, arg
);
6292 case PHONE_PLAY_VOLUME_LINEAR
:
6294 retval
= get_play_volume_linear(j
);
6297 set_play_volume_linear(j
, arg
);
6301 case PHONE_PLAY_LEVEL
:
6302 retval
= get_play_level(j
);
6304 case IXJCTL_DSP_TYPE
:
6305 retval
= (j
->dsp
.high
<< 8) + j
->dsp
.low
;
6307 case IXJCTL_DSP_VERSION
:
6308 retval
= (j
->ver
.high
<< 8) + j
->ver
.low
;
6319 case IXJCTL_DRYBUFFER_READ
:
6320 put_user(j
->drybuffer
, (unsigned long __user
*) argp
);
6322 case IXJCTL_DRYBUFFER_CLEAR
:
6325 case IXJCTL_FRAMES_READ
:
6326 put_user(j
->framesread
, (unsigned long __user
*) argp
);
6328 case IXJCTL_FRAMES_WRITTEN
:
6329 put_user(j
->frameswritten
, (unsigned long __user
*) argp
);
6331 case IXJCTL_READ_WAIT
:
6332 put_user(j
->read_wait
, (unsigned long __user
*) argp
);
6334 case IXJCTL_WRITE_WAIT
:
6335 put_user(j
->write_wait
, (unsigned long __user
*) argp
);
6337 case PHONE_MAXRINGS
:
6340 case PHONE_SET_TONE_ON_TIME
:
6341 ixj_set_tone_on(arg
, j
);
6343 case PHONE_SET_TONE_OFF_TIME
:
6344 ixj_set_tone_off(arg
, j
);
6346 case PHONE_GET_TONE_ON_TIME
:
6347 if (ixj_get_tone_on(j
)) {
6350 retval
= (j
->ssr
.high
<< 8) + j
->ssr
.low
;
6353 case PHONE_GET_TONE_OFF_TIME
:
6354 if (ixj_get_tone_off(j
)) {
6357 retval
= (j
->ssr
.high
<< 8) + j
->ssr
.low
;
6360 case PHONE_PLAY_TONE
:
6362 retval
= ixj_play_tone(j
, arg
);
6366 case PHONE_GET_TONE_STATE
:
6367 retval
= j
->tone_state
;
6369 case PHONE_DTMF_READY
:
6370 retval
= j
->ex
.bits
.dtmf_ready
;
6372 case PHONE_GET_DTMF
:
6373 if (ixj_hookstate(j
)) {
6374 if (j
->dtmf_rp
!= j
->dtmf_wp
) {
6375 retval
= j
->dtmfbuffer
[j
->dtmf_rp
];
6377 if (j
->dtmf_rp
== 79)
6379 if (j
->dtmf_rp
== j
->dtmf_wp
) {
6380 j
->ex
.bits
.dtmf_ready
= j
->dtmf_rp
= j
->dtmf_wp
= 0;
6385 case PHONE_GET_DTMF_ASCII
:
6386 if (ixj_hookstate(j
)) {
6387 if (j
->dtmf_rp
!= j
->dtmf_wp
) {
6388 switch (j
->dtmfbuffer
[j
->dtmf_rp
]) {
6390 retval
= 42; /* '*'; */
6394 retval
= 48; /*'0'; */
6398 retval
= 35; /*'#'; */
6402 retval
= 65; /*'A'; */
6406 retval
= 66; /*'B'; */
6410 retval
= 67; /*'C'; */
6414 retval
= 68; /*'D'; */
6418 retval
= 48 + j
->dtmfbuffer
[j
->dtmf_rp
];
6422 if (j
->dtmf_rp
== 79)
6424 if(j
->dtmf_rp
== j
->dtmf_wp
)
6426 j
->ex
.bits
.dtmf_ready
= j
->dtmf_rp
= j
->dtmf_wp
= 0;
6431 case PHONE_DTMF_OOB
:
6432 j
->flags
.dtmf_oob
= arg
;
6434 case PHONE_DIALTONE
:
6440 case PHONE_RINGBACK
:
6444 if(j
->cardtype
== QTI_PHONEJACK
)
6447 retval
= ixj_wink(j
);
6449 case PHONE_CPT_STOP
:
6452 case PHONE_QUERY_CODEC
:
6454 struct phone_codec_data pd
;
6456 int proto_size
[] = {
6458 12, 10, 16, 9, 8, 48, 5,
6459 40, 40, 80, 40, 40, 6
6461 if(copy_from_user(&pd
, argp
, sizeof(pd
))) {
6465 if(pd
.type
<1 || pd
.type
>13) {
6466 retval
= -EPROTONOSUPPORT
;
6470 val
=proto_size
[pd
.type
];
6471 else switch(j
->baseframe
.low
)
6473 case 0xA0:val
=2*proto_size
[pd
.type
];break;
6474 case 0x50:val
=proto_size
[pd
.type
];break;
6475 default:val
=proto_size
[pd
.type
]*3;break;
6477 pd
.buf_min
=pd
.buf_max
=pd
.buf_opt
=val
;
6478 if(copy_to_user(argp
, &pd
, sizeof(pd
)))
6482 case IXJCTL_DSP_IDLE
:
6486 if ((arg
& 0xff) == 0xff)
6487 retval
= ixj_get_mixer(arg
, j
);
6491 case IXJCTL_DAA_COEFF_SET
:
6495 retval
= ixj_daa_write(j
);
6499 retval
= ixj_daa_write(j
);
6502 DAA_Coeff_France(j
);
6503 retval
= ixj_daa_write(j
);
6506 DAA_Coeff_Germany(j
);
6507 retval
= ixj_daa_write(j
);
6510 DAA_Coeff_Australia(j
);
6511 retval
= ixj_daa_write(j
);
6515 retval
= ixj_daa_write(j
);
6522 case IXJCTL_DAA_AGAIN
:
6523 ixj_daa_cr4(j
, arg
| 0x02);
6525 case IXJCTL_PSTN_LINETEST
:
6526 retval
= ixj_linetest(j
);
6529 ixj_write_vmwi(j
, arg
);
6532 if (copy_to_user(argp
, &j
->cid
, sizeof(PHONE_CID
)))
6534 j
->ex
.bits
.caller_id
= 0;
6536 case IXJCTL_WINK_DURATION
:
6541 retval
= ixj_set_port(j
, arg
);
6545 case IXJCTL_POTS_PSTN
:
6546 retval
= ixj_set_pots(j
, arg
);
6548 case PHONE_CAPABILITIES
:
6552 case PHONE_CAPABILITIES_LIST
:
6554 if (copy_to_user(argp
, j
->caplist
, sizeof(struct phone_capability
) * j
->caps
))
6557 case PHONE_CAPABILITIES_CHECK
:
6559 struct phone_capability cap
;
6560 if (copy_from_user(&cap
, argp
, sizeof(cap
)))
6564 retval
= capabilities_check(j
, &cap
);
6568 case PHONE_PSTN_SET_STATE
:
6569 daa_set_mode(j
, arg
);
6571 case PHONE_PSTN_GET_STATE
:
6572 retval
= j
->daa_mode
;
6573 j
->ex
.bits
.pstn_ring
= 0;
6575 case IXJCTL_SET_FILTER
:
6576 if (copy_from_user(&jf
, argp
, sizeof(jf
)))
6578 retval
= ixj_init_filter(j
, &jf
);
6580 case IXJCTL_SET_FILTER_RAW
:
6581 if (copy_from_user(&jfr
, argp
, sizeof(jfr
)))
6584 retval
= ixj_init_filter_raw(j
, &jfr
);
6586 case IXJCTL_GET_FILTER_HIST
:
6590 retval
= j
->filter_hist
[arg
];
6592 case IXJCTL_INIT_TONE
:
6593 if (copy_from_user(&ti
, argp
, sizeof(ti
)))
6596 retval
= ixj_init_tone(j
, &ti
);
6598 case IXJCTL_TONE_CADENCE
:
6599 retval
= ixj_build_cadence(j
, argp
);
6601 case IXJCTL_FILTER_CADENCE
:
6602 retval
= ixj_build_filter_cadence(j
, argp
);
6605 if (copy_from_user(&j
->sigdef
, argp
, sizeof(IXJ_SIGDEF
))) {
6609 j
->ixj_signals
[j
->sigdef
.event
] = j
->sigdef
.signal
;
6610 if(j
->sigdef
.event
< 33) {
6612 for(mant
= 0; mant
< j
->sigdef
.event
; mant
++){
6615 if(j
->sigdef
.signal
)
6616 j
->ex_sig
.bytes
|= raise
;
6618 j
->ex_sig
.bytes
&= (raise
^0xffff);
6621 case IXJCTL_INTERCOM_STOP
:
6622 if(arg
< 0 || arg
>= IXJMAX
)
6628 get_ixj(arg
)->intercom
= -1;
6629 ixj_record_stop(get_ixj(arg
));
6630 ixj_play_stop(get_ixj(arg
));
6633 case IXJCTL_INTERCOM_START
:
6634 if(arg
< 0 || arg
>= IXJMAX
)
6637 ixj_record_start(j
);
6639 get_ixj(arg
)->intercom
= board
;
6640 ixj_play_start(get_ixj(arg
));
6641 ixj_record_start(get_ixj(arg
));
6644 if (ixjdebug
& 0x0040)
6645 printk("phone%d ioctl end, cmd: 0x%x, arg: 0x%lx\n", minor
, cmd
, arg
);
6646 clear_bit(board
, &j
->busyflags
);
6650 static int ixj_fasync(int fd
, struct file
*file_p
, int mode
)
6652 IXJ
*j
= get_ixj(NUM(file_p
->f_dentry
->d_inode
));
6654 return fasync_helper(fd
, file_p
, mode
, &j
->async_queue
);
6657 static struct file_operations ixj_fops
=
6659 .owner
= THIS_MODULE
,
6660 .read
= ixj_enhanced_read
,
6661 .write
= ixj_enhanced_write
,
6664 .release
= ixj_release
,
6665 .fasync
= ixj_fasync
6668 static int ixj_linetest(IXJ
*j
)
6670 j
->flags
.pstncheck
= 1; /* Testing */
6671 j
->flags
.pstn_present
= 0; /* Assume the line is not there */
6673 daa_int_read(j
); /*Clear DAA Interrupt flags */
6675 /* Hold all relays in the normally de-energized position. */
6678 j
->pld_slicw
.bits
.rly1
= 0;
6679 j
->pld_slicw
.bits
.rly2
= 0;
6680 j
->pld_slicw
.bits
.rly3
= 0;
6681 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
6682 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
6684 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
6685 j
->pld_slicr
.byte
= inb_p(j
->XILINXbase
+ 0x01);
6686 if (j
->pld_slicr
.bits
.potspstn
) {
6687 j
->flags
.pots_pstn
= 1;
6688 j
->flags
.pots_correct
= 0;
6689 LED_SetState(0x4, j
);
6691 j
->flags
.pots_pstn
= 0;
6692 j
->pld_slicw
.bits
.rly1
= 0;
6693 j
->pld_slicw
.bits
.rly2
= 0;
6694 j
->pld_slicw
.bits
.rly3
= 1;
6695 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
6696 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
6698 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
6699 daa_set_mode(j
, SOP_PU_CONVERSATION
);
6702 daa_set_mode(j
, SOP_PU_RESET
);
6703 if (j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.VDD_OK
) {
6704 j
->flags
.pots_correct
= 0; /* Should not be line voltage on POTS port. */
6705 LED_SetState(0x4, j
);
6706 j
->pld_slicw
.bits
.rly3
= 0;
6707 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
6709 j
->flags
.pots_correct
= 1;
6710 LED_SetState(0x8, j
);
6711 j
->pld_slicw
.bits
.rly1
= 1;
6712 j
->pld_slicw
.bits
.rly2
= 0;
6713 j
->pld_slicw
.bits
.rly3
= 0;
6714 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
6717 j
->pld_slicw
.bits
.rly3
= 0;
6718 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
6719 daa_set_mode(j
, SOP_PU_CONVERSATION
);
6722 daa_set_mode(j
, SOP_PU_RESET
);
6723 if (j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.VDD_OK
) {
6724 j
->pstn_sleeptil
= jiffies
+ (hertz
/ 4);
6725 j
->flags
.pstn_present
= 1;
6727 j
->flags
.pstn_present
= 0;
6729 if (j
->flags
.pstn_present
) {
6730 if (j
->flags
.pots_correct
) {
6731 LED_SetState(0xA, j
);
6733 LED_SetState(0x6, j
);
6736 if (j
->flags
.pots_correct
) {
6737 LED_SetState(0x9, j
);
6739 LED_SetState(0x5, j
);
6742 j
->flags
.pstncheck
= 0; /* Testing */
6743 return j
->flags
.pstn_present
;
6746 static int ixj_selfprobe(IXJ
*j
)
6752 init_waitqueue_head(&j
->poll_q
);
6753 init_waitqueue_head(&j
->read_q
);
6754 init_waitqueue_head(&j
->write_q
);
6756 while(atomic_read(&j
->DSPWrite
) > 0)
6757 atomic_dec(&j
->DSPWrite
);
6758 if (ixjdebug
& 0x0002)
6759 printk(KERN_INFO
"Write IDLE to Software Control Register\n");
6760 ixj_WriteDSPCommand(0x0FE0, j
); /* Put the DSP in full power mode. */
6762 if (ixj_WriteDSPCommand(0x0000, j
)) /* Write IDLE to Software Control Register */
6764 /* The read values of the SSR should be 0x00 for the IDLE command */
6765 if (j
->ssr
.low
|| j
->ssr
.high
)
6767 if (ixjdebug
& 0x0002)
6768 printk(KERN_INFO
"Get Device ID Code\n");
6769 if (ixj_WriteDSPCommand(0x3400, j
)) /* Get Device ID Code */
6771 j
->dsp
.low
= j
->ssr
.low
;
6772 j
->dsp
.high
= j
->ssr
.high
;
6773 if (ixjdebug
& 0x0002)
6774 printk(KERN_INFO
"Get Device Version Code\n");
6775 if (ixj_WriteDSPCommand(0x3800, j
)) /* Get Device Version Code */
6777 j
->ver
.low
= j
->ssr
.low
;
6778 j
->ver
.high
= j
->ssr
.high
;
6780 if (j
->dsp
.low
== 0x21) {
6781 bytes
.high
= bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
6782 outb_p(bytes
.low
^ 0xFF, j
->XILINXbase
+ 0x02);
6783 /* Test for Internet LineJACK or Internet PhoneJACK Lite */
6784 bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
6785 if (bytes
.low
== bytes
.high
) /* Register is read only on */
6786 /* Internet PhoneJack Lite */
6788 j
->cardtype
= QTI_PHONEJACK_LITE
;
6789 if (!request_region(j
->XILINXbase
, 4, "ixj control")) {
6790 printk(KERN_INFO
"ixj: can't get I/O address 0x%x\n", j
->XILINXbase
);
6793 j
->pld_slicw
.pcib
.e1
= 1;
6794 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
);
6796 j
->cardtype
= QTI_LINEJACK
;
6798 if (!request_region(j
->XILINXbase
, 8, "ixj control")) {
6799 printk(KERN_INFO
"ixj: can't get I/O address 0x%x\n", j
->XILINXbase
);
6803 } else if (j
->dsp
.low
== 0x22) {
6804 j
->cardtype
= QTI_PHONEJACK_PCI
;
6805 request_region(j
->XILINXbase
, 4, "ixj control");
6806 j
->pld_slicw
.pcib
.e1
= 1;
6807 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
);
6809 j
->cardtype
= QTI_PHONEJACK
;
6811 switch (j
->cardtype
) {
6813 if (!j
->dsp
.low
!= 0x20) {
6816 ixj_WriteDSPCommand(0x3800, j
);
6817 j
->ver
.low
= j
->ssr
.low
;
6818 j
->ver
.high
= j
->ssr
.high
;
6822 if (!request_region(j
->XILINXbase
, 8, "ixj control")) {
6823 printk(KERN_INFO
"ixj: can't get I/O address 0x%x\n", j
->XILINXbase
);
6827 case QTI_PHONEJACK_LITE
:
6828 case QTI_PHONEJACK_PCI
:
6829 if (!request_region(j
->XILINXbase
, 4, "ixj control")) {
6830 printk(KERN_INFO
"ixj: can't get I/O address 0x%x\n", j
->XILINXbase
);
6833 j
->pld_slicw
.pcib
.e1
= 1;
6834 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
);
6840 if (j
->dsp
.low
== 0x20 || j
->cardtype
== QTI_PHONEJACK_LITE
|| j
->cardtype
== QTI_PHONEJACK_PCI
) {
6841 if (ixjdebug
& 0x0002)
6842 printk(KERN_INFO
"Write CODEC config to Software Control Register\n");
6843 if (ixj_WriteDSPCommand(0xC462, j
)) /* Write CODEC config to Software Control Register */
6845 if (ixjdebug
& 0x0002)
6846 printk(KERN_INFO
"Write CODEC timing to Software Control Register\n");
6847 if (j
->cardtype
== QTI_PHONEJACK
) {
6852 if (ixj_WriteDSPCommand(cmd
, j
)) /* Write CODEC timing to Software Control Register */
6855 if (set_base_frame(j
, 30) != 30)
6857 if (ixjdebug
& 0x0002)
6858 printk(KERN_INFO
"Write CODEC config to Software Control Register\n");
6859 if (j
->cardtype
== QTI_PHONECARD
) {
6860 if (ixj_WriteDSPCommand(0xC528, j
)) /* Write CODEC config to Software Control Register */
6863 if (j
->cardtype
== QTI_LINEJACK
) {
6864 if (ixj_WriteDSPCommand(0xC528, j
)) /* Write CODEC config to Software Control Register */
6866 if (ixjdebug
& 0x0002)
6867 printk(KERN_INFO
"Turn on the PLD Clock at 8Khz\n");
6868 j
->pld_clock
.byte
= 0;
6869 outb_p(j
->pld_clock
.byte
, j
->XILINXbase
+ 0x04);
6873 if (j
->dsp
.low
== 0x20) {
6874 if (ixjdebug
& 0x0002)
6875 printk(KERN_INFO
"Configure GPIO pins\n");
6876 j
->gpio
.bytes
.high
= 0x09;
6877 /* bytes.low = 0xEF; 0xF7 */
6878 j
->gpio
.bits
.gpio1
= 1;
6879 j
->gpio
.bits
.gpio2
= 1;
6880 j
->gpio
.bits
.gpio3
= 0;
6881 j
->gpio
.bits
.gpio4
= 1;
6882 j
->gpio
.bits
.gpio5
= 1;
6883 j
->gpio
.bits
.gpio6
= 1;
6884 j
->gpio
.bits
.gpio7
= 1;
6885 ixj_WriteDSPCommand(j
->gpio
.word
, j
); /* Set GPIO pin directions */
6886 if (ixjdebug
& 0x0002)
6887 printk(KERN_INFO
"Enable SLIC\n");
6888 j
->gpio
.bytes
.high
= 0x0B;
6889 j
->gpio
.bytes
.low
= 0x00;
6890 j
->gpio
.bits
.gpio1
= 0;
6891 j
->gpio
.bits
.gpio2
= 1;
6892 j
->gpio
.bits
.gpio5
= 0;
6893 ixj_WriteDSPCommand(j
->gpio
.word
, j
); /* send the ring stop signal */
6894 j
->port
= PORT_POTS
;
6896 if (j
->cardtype
== QTI_LINEJACK
) {
6897 LED_SetState(0x1, j
);
6899 LED_SetState(0x2, j
);
6901 LED_SetState(0x4, j
);
6903 LED_SetState(0x8, j
);
6905 LED_SetState(0x0, j
);
6907 if (ixjdebug
& 0x0002)
6908 printk("Loading DAA Coefficients\n");
6910 if (!ixj_daa_write(j
)) {
6911 printk("DAA write failed on board %d\n", j
->board
);
6914 if(!ixj_daa_cid_reset(j
)) {
6915 printk("DAA CID reset failed on board %d\n", j
->board
);
6918 j
->flags
.pots_correct
= 0;
6919 j
->flags
.pstn_present
= 0;
6921 if (j
->flags
.pots_correct
) {
6922 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
6924 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
6925 j
->pld_slicw
.bits
.rly1
= 1;
6926 j
->pld_slicw
.bits
.spken
= 1;
6927 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
6928 SLIC_SetState(PLD_SLIC_STATE_STANDBY
, j
);
6929 /* SLIC_SetState(PLD_SLIC_STATE_ACTIVE, j); */
6930 j
->port
= PORT_POTS
;
6932 ixj_set_port(j
, PORT_PSTN
);
6934 if (ixjdebug
& 0x0002)
6935 printk(KERN_INFO
"Enable Mixer\n");
6936 ixj_mixer(0x0000, j
); /*Master Volume Left unmute 0db */
6937 ixj_mixer(0x0100, j
); /*Master Volume Right unmute 0db */
6939 ixj_mixer(0x0203, j
); /*Voice Left Volume unmute 6db */
6940 ixj_mixer(0x0303, j
); /*Voice Right Volume unmute 6db */
6942 ixj_mixer(0x0480, j
); /*FM Left mute */
6943 ixj_mixer(0x0580, j
); /*FM Right mute */
6945 ixj_mixer(0x0680, j
); /*CD Left mute */
6946 ixj_mixer(0x0780, j
); /*CD Right mute */
6948 ixj_mixer(0x0880, j
); /*Line Left mute */
6949 ixj_mixer(0x0980, j
); /*Line Right mute */
6951 ixj_mixer(0x0A80, j
); /*Aux left mute */
6952 ixj_mixer(0x0B80, j
); /*Aux right mute */
6954 ixj_mixer(0x0C00, j
); /*Mono1 unmute 12db */
6955 ixj_mixer(0x0D80, j
); /*Mono2 mute */
6957 ixj_mixer(0x0E80, j
); /*Mic mute */
6959 ixj_mixer(0x0F00, j
); /*Mono Out Volume unmute 0db */
6961 ixj_mixer(0x1000, j
); /*Voice Left and Right out only */
6962 ixj_mixer(0x110C, j
);
6965 ixj_mixer(0x1200, j
); /*Mono1 switch on mixer left */
6966 ixj_mixer(0x1401, j
);
6968 ixj_mixer(0x1300, j
); /*Mono1 switch on mixer right */
6969 ixj_mixer(0x1501, j
);
6971 ixj_mixer(0x1700, j
); /*Clock select */
6973 ixj_mixer(0x1800, j
); /*ADC input from mixer */
6975 ixj_mixer(0x1901, j
); /*Mic gain 30db */
6977 if (ixjdebug
& 0x0002)
6978 printk(KERN_INFO
"Setting Default US Ring Cadence Detection\n");
6979 j
->cadence_f
[4].state
= 0;
6980 j
->cadence_f
[4].on1
= 0; /*Cadence Filter 4 is used for PSTN ring cadence */
6981 j
->cadence_f
[4].off1
= 0;
6982 j
->cadence_f
[4].on2
= 0;
6983 j
->cadence_f
[4].off2
= 0;
6984 j
->cadence_f
[4].on3
= 0;
6985 j
->cadence_f
[4].off3
= 0; /* These should represent standard US ring pulse. */
6986 j
->pstn_last_rmr
= jiffies
;
6989 if (j
->cardtype
== QTI_PHONECARD
) {
6990 ixj_WriteDSPCommand(0xCF07, j
);
6991 ixj_WriteDSPCommand(0x00B0, j
);
6992 ixj_set_port(j
, PORT_SPEAKER
);
6994 ixj_set_port(j
, PORT_POTS
);
6995 SLIC_SetState(PLD_SLIC_STATE_STANDBY
, j
);
6996 /* SLIC_SetState(PLD_SLIC_STATE_ACTIVE, j); */
7002 j
->framesread
= j
->frameswritten
= 0;
7003 j
->read_wait
= j
->write_wait
= 0;
7004 j
->rxreadycheck
= j
->txreadycheck
= 0;
7006 /* initialise the DTMF prescale to a sensible value */
7007 if (j
->cardtype
== QTI_LINEJACK
) {
7008 set_dtmf_prescale(j
, 0x10);
7010 set_dtmf_prescale(j
, 0x40);
7012 set_play_volume(j
, 0x100);
7013 set_rec_volume(j
, 0x100);
7015 if (ixj_WriteDSPCommand(0x0000, j
)) /* Write IDLE to Software Control Register */
7017 /* The read values of the SSR should be 0x00 for the IDLE command */
7018 if (j
->ssr
.low
|| j
->ssr
.high
)
7021 if (ixjdebug
& 0x0002)
7022 printk(KERN_INFO
"Enable Line Monitor\n");
7024 if (ixjdebug
& 0x0002)
7025 printk(KERN_INFO
"Set Line Monitor to Asyncronous Mode\n");
7027 if (ixj_WriteDSPCommand(0x7E01, j
)) /* Asynchronous Line Monitor */
7030 if (ixjdebug
& 0x002)
7031 printk(KERN_INFO
"Enable DTMF Detectors\n");
7033 if (ixj_WriteDSPCommand(0x5151, j
)) /* Enable DTMF detection */
7036 if (ixj_WriteDSPCommand(0x6E01, j
)) /* Set Asyncronous Tone Generation */
7039 set_rec_depth(j
, 2); /* Set Record Channel Limit to 2 frames */
7041 set_play_depth(j
, 2); /* Set Playback Channel Limit to 2 frames */
7043 j
->ex
.bits
.dtmf_ready
= 0;
7045 j
->dtmf_wp
= j
->dtmf_rp
= 0;
7046 j
->rec_mode
= j
->play_mode
= -1;
7047 j
->flags
.ringing
= 0;
7048 j
->maxrings
= MAXRINGS
;
7049 j
->ring_cadence
= USA_RING_CADENCE
;
7052 j
->flags
.dtmf_oob
= 0;
7053 for (cnt
= 0; cnt
< 4; cnt
++)
7054 j
->cadence_f
[cnt
].enable
= 0;
7055 /* must be a device on the specified address */
7056 ixj_WriteDSPCommand(0x0FE3, j
); /* Put the DSP in 1/5 power mode. */
7058 /* Set up the default signals for events */
7059 for (cnt
= 0; cnt
< 35; cnt
++)
7060 j
->ixj_signals
[cnt
] = SIGIO
;
7062 /* Set the excetion signal enable flags */
7063 j
->ex_sig
.bits
.dtmf_ready
= j
->ex_sig
.bits
.hookstate
= j
->ex_sig
.bits
.flash
= j
->ex_sig
.bits
.pstn_ring
=
7064 j
->ex_sig
.bits
.caller_id
= j
->ex_sig
.bits
.pstn_wink
= j
->ex_sig
.bits
.f0
= j
->ex_sig
.bits
.f1
= j
->ex_sig
.bits
.f2
=
7065 j
->ex_sig
.bits
.f3
= j
->ex_sig
.bits
.fc0
= j
->ex_sig
.bits
.fc1
= j
->ex_sig
.bits
.fc2
= j
->ex_sig
.bits
.fc3
= 1;
7066 #ifdef IXJ_DYN_ALLOC
7072 /* Register with the Telephony for Linux subsystem */
7073 j
->p
.f_op
= &ixj_fops
;
7074 j
->p
.open
= ixj_open
;
7075 j
->p
.board
= j
->board
;
7076 phone_register_device(&j
->p
, PHONE_UNIT_ANY
);
7084 * Exported service for pcmcia card handling
7087 IXJ
*ixj_pcmcia_probe(unsigned long dsp
, unsigned long xilinx
)
7089 IXJ
*j
= ixj_alloc();
7094 j
->XILINXbase
= xilinx
;
7095 j
->cardtype
= QTI_PHONECARD
;
7100 EXPORT_SYMBOL(ixj_pcmcia_probe
); /* Fpr PCMCIA */
7102 static int ixj_get_status_proc(char *buf
)
7108 len
+= sprintf(buf
+ len
, "\nDriver version %i.%i.%i", IXJ_VER_MAJOR
, IXJ_VER_MINOR
, IXJ_BLD_VER
);
7109 len
+= sprintf(buf
+ len
, "\nsizeof IXJ struct %Zd bytes", sizeof(IXJ
));
7110 len
+= sprintf(buf
+ len
, "\nsizeof DAA struct %Zd bytes", sizeof(DAA_REGS
));
7111 len
+= sprintf(buf
+ len
, "\nUsing old telephony API");
7112 len
+= sprintf(buf
+ len
, "\nDebug Level %d\n", ixjdebug
);
7114 for (cnt
= 0; cnt
< IXJMAX
; cnt
++) {
7119 len
+= sprintf(buf
+ len
, "\nCard Num %d", cnt
);
7120 len
+= sprintf(buf
+ len
, "\nDSP Base Address 0x%4.4x", j
->DSPbase
);
7121 if (j
->cardtype
!= QTI_PHONEJACK
)
7122 len
+= sprintf(buf
+ len
, "\nXILINX Base Address 0x%4.4x", j
->XILINXbase
);
7123 len
+= sprintf(buf
+ len
, "\nDSP Type %2.2x%2.2x", j
->dsp
.high
, j
->dsp
.low
);
7124 len
+= sprintf(buf
+ len
, "\nDSP Version %2.2x.%2.2x", j
->ver
.high
, j
->ver
.low
);
7125 len
+= sprintf(buf
+ len
, "\nSerial Number %8.8x", j
->serial
);
7126 switch (j
->cardtype
) {
7127 case (QTI_PHONEJACK
):
7128 len
+= sprintf(buf
+ len
, "\nCard Type = Internet PhoneJACK");
7130 case (QTI_LINEJACK
):
7131 len
+= sprintf(buf
+ len
, "\nCard Type = Internet LineJACK");
7132 if (j
->flags
.g729_loaded
)
7133 len
+= sprintf(buf
+ len
, " w/G.729 A/B");
7134 len
+= sprintf(buf
+ len
, " Country = %d", j
->daa_country
);
7136 case (QTI_PHONEJACK_LITE
):
7137 len
+= sprintf(buf
+ len
, "\nCard Type = Internet PhoneJACK Lite");
7138 if (j
->flags
.g729_loaded
)
7139 len
+= sprintf(buf
+ len
, " w/G.729 A/B");
7141 case (QTI_PHONEJACK_PCI
):
7142 len
+= sprintf(buf
+ len
, "\nCard Type = Internet PhoneJACK PCI");
7143 if (j
->flags
.g729_loaded
)
7144 len
+= sprintf(buf
+ len
, " w/G.729 A/B");
7146 case (QTI_PHONECARD
):
7147 len
+= sprintf(buf
+ len
, "\nCard Type = Internet PhoneCARD");
7148 if (j
->flags
.g729_loaded
)
7149 len
+= sprintf(buf
+ len
, " w/G.729 A/B");
7150 len
+= sprintf(buf
+ len
, "\nSmart Cable %spresent", j
->pccr1
.bits
.drf
? "not " : "");
7151 if (!j
->pccr1
.bits
.drf
)
7152 len
+= sprintf(buf
+ len
, "\nSmart Cable type %d", j
->flags
.pcmciasct
);
7153 len
+= sprintf(buf
+ len
, "\nSmart Cable state %d", j
->flags
.pcmciastate
);
7156 len
+= sprintf(buf
+ len
, "\nCard Type = %d", j
->cardtype
);
7159 len
+= sprintf(buf
+ len
, "\nReaders %d", j
->readers
);
7160 len
+= sprintf(buf
+ len
, "\nWriters %d", j
->writers
);
7162 len
+= sprintf(buf
+ len
, "\nCapabilities %d", j
->caps
);
7163 if (j
->dsp
.low
!= 0x20)
7164 len
+= sprintf(buf
+ len
, "\nDSP Processor load %d", j
->proc_load
);
7165 if (j
->flags
.cidsent
)
7166 len
+= sprintf(buf
+ len
, "\nCaller ID data sent");
7168 len
+= sprintf(buf
+ len
, "\nCaller ID data not sent");
7170 len
+= sprintf(buf
+ len
, "\nPlay CODEC ");
7171 switch (j
->play_codec
) {
7173 len
+= sprintf(buf
+ len
, "G.723.1 6.3");
7176 len
+= sprintf(buf
+ len
, "G.723.1 5.3");
7179 len
+= sprintf(buf
+ len
, "TrueSpeech 8.5");
7182 len
+= sprintf(buf
+ len
, "TrueSpeech 4.8");
7185 len
+= sprintf(buf
+ len
, "TrueSpeech 4.1");
7188 len
+= sprintf(buf
+ len
, "G.728");
7191 len
+= sprintf(buf
+ len
, "G.729");
7194 len
+= sprintf(buf
+ len
, "G.729B");
7197 len
+= sprintf(buf
+ len
, "uLaw");
7200 len
+= sprintf(buf
+ len
, "aLaw");
7203 len
+= sprintf(buf
+ len
, "16 bit Linear");
7206 len
+= sprintf(buf
+ len
, "8 bit Linear");
7209 len
+= sprintf(buf
+ len
, "Windows Sound System");
7212 len
+= sprintf(buf
+ len
, "NO CODEC CHOSEN");
7215 len
+= sprintf(buf
+ len
, "\nRecord CODEC ");
7216 switch (j
->rec_codec
) {
7218 len
+= sprintf(buf
+ len
, "G.723.1 6.3");
7221 len
+= sprintf(buf
+ len
, "G.723.1 5.3");
7224 len
+= sprintf(buf
+ len
, "TrueSpeech 8.5");
7227 len
+= sprintf(buf
+ len
, "TrueSpeech 4.8");
7230 len
+= sprintf(buf
+ len
, "TrueSpeech 4.1");
7233 len
+= sprintf(buf
+ len
, "G.728");
7236 len
+= sprintf(buf
+ len
, "G.729");
7239 len
+= sprintf(buf
+ len
, "G.729B");
7242 len
+= sprintf(buf
+ len
, "uLaw");
7245 len
+= sprintf(buf
+ len
, "aLaw");
7248 len
+= sprintf(buf
+ len
, "16 bit Linear");
7251 len
+= sprintf(buf
+ len
, "8 bit Linear");
7254 len
+= sprintf(buf
+ len
, "Windows Sound System");
7257 len
+= sprintf(buf
+ len
, "NO CODEC CHOSEN");
7260 len
+= sprintf(buf
+ len
, "\nAEC ");
7261 switch (j
->aec_level
) {
7263 len
+= sprintf(buf
+ len
, "Off");
7266 len
+= sprintf(buf
+ len
, "Low");
7269 len
+= sprintf(buf
+ len
, "Med");
7272 len
+= sprintf(buf
+ len
, "High");
7275 len
+= sprintf(buf
+ len
, "Auto");
7278 len
+= sprintf(buf
+ len
, "AEC/AGC");
7281 len
+= sprintf(buf
+ len
, "unknown(%i)", j
->aec_level
);
7285 len
+= sprintf(buf
+ len
, "\nRec volume 0x%x", get_rec_volume(j
));
7286 len
+= sprintf(buf
+ len
, "\nPlay volume 0x%x", get_play_volume(j
));
7287 len
+= sprintf(buf
+ len
, "\nDTMF prescale 0x%x", get_dtmf_prescale(j
));
7289 len
+= sprintf(buf
+ len
, "\nHook state %d", j
->hookstate
); /* j->r_hook); */
7291 if (j
->cardtype
== QTI_LINEJACK
) {
7292 len
+= sprintf(buf
+ len
, "\nPOTS Correct %d", j
->flags
.pots_correct
);
7293 len
+= sprintf(buf
+ len
, "\nPSTN Present %d", j
->flags
.pstn_present
);
7294 len
+= sprintf(buf
+ len
, "\nPSTN Check %d", j
->flags
.pstncheck
);
7295 len
+= sprintf(buf
+ len
, "\nPOTS to PSTN %d", j
->flags
.pots_pstn
);
7296 switch (j
->daa_mode
) {
7298 len
+= sprintf(buf
+ len
, "\nDAA PSTN On Hook");
7300 case SOP_PU_RINGING
:
7301 len
+= sprintf(buf
+ len
, "\nDAA PSTN Ringing");
7302 len
+= sprintf(buf
+ len
, "\nRinging state = %d", j
->cadence_f
[4].state
);
7304 case SOP_PU_CONVERSATION
:
7305 len
+= sprintf(buf
+ len
, "\nDAA PSTN Off Hook");
7307 case SOP_PU_PULSEDIALING
:
7308 len
+= sprintf(buf
+ len
, "\nDAA PSTN Pulse Dialing");
7311 len
+= sprintf(buf
+ len
, "\nDAA RMR = %d", j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.bitreg
.RMR
);
7312 len
+= sprintf(buf
+ len
, "\nDAA VDD OK = %d", j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.VDD_OK
);
7313 len
+= sprintf(buf
+ len
, "\nDAA CR0 = 0x%02x", j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
);
7314 len
+= sprintf(buf
+ len
, "\nDAA CR1 = 0x%02x", j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
);
7315 len
+= sprintf(buf
+ len
, "\nDAA CR2 = 0x%02x", j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
);
7316 len
+= sprintf(buf
+ len
, "\nDAA CR3 = 0x%02x", j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
);
7317 len
+= sprintf(buf
+ len
, "\nDAA CR4 = 0x%02x", j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
);
7318 len
+= sprintf(buf
+ len
, "\nDAA CR5 = 0x%02x", j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr5
.reg
);
7319 len
+= sprintf(buf
+ len
, "\nDAA XR0 = 0x%02x", j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.reg
);
7320 len
+= sprintf(buf
+ len
, "\nDAA ringstop %ld - jiffies %ld", j
->pstn_ring_stop
, jiffies
);
7324 len
+= sprintf(buf
+ len
, "\nPort POTS");
7327 len
+= sprintf(buf
+ len
, "\nPort PSTN");
7330 len
+= sprintf(buf
+ len
, "\nPort SPEAKER/MIC");
7333 len
+= sprintf(buf
+ len
, "\nPort HANDSET");
7336 if (j
->dsp
.low
== 0x21 || j
->dsp
.low
== 0x22) {
7337 len
+= sprintf(buf
+ len
, "\nSLIC state ");
7338 switch (SLIC_GetState(j
)) {
7339 case PLD_SLIC_STATE_OC
:
7340 len
+= sprintf(buf
+ len
, "OC");
7342 case PLD_SLIC_STATE_RINGING
:
7343 len
+= sprintf(buf
+ len
, "RINGING");
7345 case PLD_SLIC_STATE_ACTIVE
:
7346 len
+= sprintf(buf
+ len
, "ACTIVE");
7348 case PLD_SLIC_STATE_OHT
: /* On-hook transmit */
7349 len
+= sprintf(buf
+ len
, "OHT");
7351 case PLD_SLIC_STATE_TIPOPEN
:
7352 len
+= sprintf(buf
+ len
, "TIPOPEN");
7354 case PLD_SLIC_STATE_STANDBY
:
7355 len
+= sprintf(buf
+ len
, "STANDBY");
7357 case PLD_SLIC_STATE_APR
: /* Active polarity reversal */
7358 len
+= sprintf(buf
+ len
, "APR");
7360 case PLD_SLIC_STATE_OHTPR
: /* OHT polarity reversal */
7361 len
+= sprintf(buf
+ len
, "OHTPR");
7364 len
+= sprintf(buf
+ len
, "%d", SLIC_GetState(j
));
7368 len
+= sprintf(buf
+ len
, "\nBase Frame %2.2x.%2.2x", j
->baseframe
.high
, j
->baseframe
.low
);
7369 len
+= sprintf(buf
+ len
, "\nCID Base Frame %2d", j
->cid_base_frame_size
);
7370 #ifdef PERFMON_STATS
7371 len
+= sprintf(buf
+ len
, "\nTimer Checks %ld", j
->timerchecks
);
7372 len
+= sprintf(buf
+ len
, "\nRX Ready Checks %ld", j
->rxreadycheck
);
7373 len
+= sprintf(buf
+ len
, "\nTX Ready Checks %ld", j
->txreadycheck
);
7374 len
+= sprintf(buf
+ len
, "\nFrames Read %ld", j
->framesread
);
7375 len
+= sprintf(buf
+ len
, "\nFrames Written %ld", j
->frameswritten
);
7376 len
+= sprintf(buf
+ len
, "\nDry Buffer %ld", j
->drybuffer
);
7377 len
+= sprintf(buf
+ len
, "\nRead Waits %ld", j
->read_wait
);
7378 len
+= sprintf(buf
+ len
, "\nWrite Waits %ld", j
->write_wait
);
7379 len
+= sprintf(buf
+ len
, "\nStatus Waits %ld", j
->statuswait
);
7380 len
+= sprintf(buf
+ len
, "\nStatus Wait Fails %ld", j
->statuswaitfail
);
7381 len
+= sprintf(buf
+ len
, "\nPControl Waits %ld", j
->pcontrolwait
);
7382 len
+= sprintf(buf
+ len
, "\nPControl Wait Fails %ld", j
->pcontrolwaitfail
);
7383 len
+= sprintf(buf
+ len
, "\nIs Control Ready Checks %ld", j
->iscontrolready
);
7384 len
+= sprintf(buf
+ len
, "\nIs Control Ready Check failures %ld", j
->iscontrolreadyfail
);
7387 len
+= sprintf(buf
+ len
, "\n");
7393 static int ixj_read_proc(char *page
, char **start
, off_t off
,
7394 int count
, int *eof
, void *data
)
7396 int len
= ixj_get_status_proc(page
);
7397 if (len
<= off
+count
) *eof
= 1;
7398 *start
= page
+ off
;
7400 if (len
>count
) len
= count
;
7406 static void cleanup(void)
7411 for (cnt
= 0; cnt
< IXJMAX
; cnt
++) {
7413 if(j
!= NULL
&& j
->DSPbase
) {
7414 if (ixjdebug
& 0x0002)
7415 printk(KERN_INFO
"IXJ: Deleting timer for /dev/phone%d\n", cnt
);
7416 del_timer(&j
->timer
);
7417 if (j
->cardtype
== QTI_LINEJACK
) {
7418 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
7420 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
7421 j
->pld_slicw
.bits
.rly1
= 0;
7422 j
->pld_slicw
.bits
.rly2
= 0;
7423 j
->pld_slicw
.bits
.rly3
= 0;
7424 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
7425 LED_SetState(0x0, j
);
7426 if (ixjdebug
& 0x0002)
7427 printk(KERN_INFO
"IXJ: Releasing XILINX address for /dev/phone%d\n", cnt
);
7428 release_region(j
->XILINXbase
, 8);
7429 } else if (j
->cardtype
== QTI_PHONEJACK_LITE
|| j
->cardtype
== QTI_PHONEJACK_PCI
) {
7430 if (ixjdebug
& 0x0002)
7431 printk(KERN_INFO
"IXJ: Releasing XILINX address for /dev/phone%d\n", cnt
);
7432 release_region(j
->XILINXbase
, 4);
7434 kfree(j
->read_buffer
);
7435 kfree(j
->write_buffer
);
7437 pnp_device_detach(j
->dev
);
7438 if (ixjdebug
& 0x0002)
7439 printk(KERN_INFO
"IXJ: Unregistering /dev/phone%d from LTAPI\n", cnt
);
7440 phone_unregister_device(&j
->p
);
7441 if (ixjdebug
& 0x0002)
7442 printk(KERN_INFO
"IXJ: Releasing DSP address for /dev/phone%d\n", cnt
);
7443 release_region(j
->DSPbase
, 16);
7444 #ifdef IXJ_DYN_ALLOC
7445 if (ixjdebug
& 0x0002)
7446 printk(KERN_INFO
"IXJ: Freeing memory for /dev/phone%d\n", cnt
);
7452 if (ixjdebug
& 0x0002)
7453 printk(KERN_INFO
"IXJ: Removing /proc/ixj\n");
7454 remove_proc_entry ("ixj", NULL
);
7463 static void PCIEE_WriteBit(WORD wEEPROMAddress
, BYTE lastLCC
, BYTE byData
)
7465 lastLCC
= lastLCC
& 0xfb;
7466 lastLCC
= lastLCC
| (byData
? 4 : 0);
7467 outb(lastLCC
, wEEPROMAddress
); /*set data out bit as appropriate */
7470 lastLCC
= lastLCC
| 0x01;
7471 outb(lastLCC
, wEEPROMAddress
); /*SK rising edge */
7473 byData
= byData
<< 1;
7474 lastLCC
= lastLCC
& 0xfe;
7476 outb(lastLCC
, wEEPROMAddress
); /*after delay, SK falling edge */
7480 static BYTE
PCIEE_ReadBit(WORD wEEPROMAddress
, BYTE lastLCC
)
7483 lastLCC
= lastLCC
| 0x01;
7484 outb(lastLCC
, wEEPROMAddress
); /*SK rising edge */
7486 lastLCC
= lastLCC
& 0xfe;
7488 outb(lastLCC
, wEEPROMAddress
); /*after delay, SK falling edge */
7490 return ((inb(wEEPROMAddress
) >> 3) & 1);
7493 static BOOL
PCIEE_ReadWord(WORD wAddress
, WORD wLoc
, WORD
* pwResult
)
7496 WORD wEEPROMAddress
= wAddress
+ 3;
7500 lastLCC
= inb(wEEPROMAddress
);
7501 lastLCC
= lastLCC
| 0x02;
7502 lastLCC
= lastLCC
& 0xfe;
7503 outb(lastLCC
, wEEPROMAddress
); /* CS hi, SK lo */
7505 mdelay(1); /* delay */
7507 PCIEE_WriteBit(wEEPROMAddress
, lastLCC
, 1);
7508 PCIEE_WriteBit(wEEPROMAddress
, lastLCC
, 1);
7509 PCIEE_WriteBit(wEEPROMAddress
, lastLCC
, 0);
7510 for (i
= 0; i
< 8; i
++) {
7511 PCIEE_WriteBit(wEEPROMAddress
, lastLCC
, wLoc
& 0x80 ? 1 : 0);
7515 for (i
= 0; i
< 16; i
++) {
7516 byResult
= PCIEE_ReadBit(wEEPROMAddress
, lastLCC
);
7517 *pwResult
= (*pwResult
<< 1) | byResult
;
7520 mdelay(1); /* another delay */
7522 lastLCC
= lastLCC
& 0xfd;
7523 outb(lastLCC
, wEEPROMAddress
); /* negate CS */
7528 static DWORD
PCIEE_GetSerialNumber(WORD wAddress
)
7531 if (PCIEE_ReadWord(wAddress
, 62, &wLo
))
7533 if (PCIEE_ReadWord(wAddress
, 63, &wHi
))
7535 return (((DWORD
) wHi
<< 16) | wLo
);
7538 static int dspio
[IXJMAX
+ 1] =
7542 static int xio
[IXJMAX
+ 1] =
7547 module_param_array(dspio
, int, NULL
, 0);
7548 module_param_array(xio
, int, NULL
, 0);
7549 MODULE_DESCRIPTION("Quicknet VoIP Telephony card module - www.quicknet.net");
7550 MODULE_AUTHOR("Ed Okerson <eokerson@quicknet.net>");
7551 MODULE_LICENSE("GPL");
7553 static void __exit
ixj_exit(void)
7558 static IXJ
*new_ixj(unsigned long port
)
7561 if (!request_region(port
, 16, "ixj DSP")) {
7562 printk(KERN_INFO
"ixj: can't get I/O address 0x%lx\n", port
);
7567 release_region(port
, 16);
7568 printk(KERN_INFO
"ixj: out of memory\n");
7571 res
->DSPbase
= port
;
7575 static int __init
ixj_probe_isapnp(int *cnt
)
7579 struct pnp_dev
*dev
= NULL
, *old_dev
= NULL
;
7587 dev
= pnp_find_dev(NULL
, ISAPNP_VENDOR('Q', 'T', 'I'),
7588 ISAPNP_FUNCTION(func
), old_dev
);
7589 if (!dev
|| !dev
->card
)
7591 result
= pnp_device_attach(dev
);
7593 printk("pnp attach failed %d \n", result
);
7596 if (pnp_activate_dev(dev
) < 0) {
7597 printk("pnp activate failed (out of resources?)\n");
7598 pnp_device_detach(dev
);
7602 if (!pnp_port_valid(dev
, 0)) {
7603 pnp_device_detach(dev
);
7607 j
= new_ixj(pnp_port_start(dev
, 0));
7612 j
->XILINXbase
= pnp_port_start(dev
, 1); /* get real port */
7616 j
->cardtype
= QTI_PHONEJACK
;
7619 j
->cardtype
= QTI_LINEJACK
;
7622 j
->cardtype
= QTI_PHONEJACK_LITE
;
7626 probe
= ixj_selfprobe(j
);
7628 j
->serial
= dev
->card
->serial
;
7632 printk(KERN_INFO
"ixj: found Internet PhoneJACK at 0x%x\n", j
->DSPbase
);
7635 printk(KERN_INFO
"ixj: found Internet LineJACK at 0x%x\n", j
->DSPbase
);
7638 printk(KERN_INFO
"ixj: found Internet PhoneJACK Lite at 0x%x\n", j
->DSPbase
);
7655 static int __init
ixj_probe_isa(int *cnt
)
7659 /* Use passed parameters for older kernels without PnP */
7660 for (i
= 0; i
< IXJMAX
; i
++) {
7662 IXJ
*j
= new_ixj(dspio
[i
]);
7667 j
->XILINXbase
= xio
[i
];
7671 probe
= ixj_selfprobe(j
);
7679 static int __init
ixj_probe_pci(int *cnt
)
7681 struct pci_dev
*pci
= NULL
;
7685 for (i
= 0; i
< IXJMAX
- *cnt
; i
++) {
7686 pci
= pci_find_device(0x15E2, 0x0500, pci
);
7690 if (pci_enable_device(pci
))
7692 j
= new_ixj(pci_resource_start(pci
, 0));
7696 j
->serial
= (PCIEE_GetSerialNumber
)pci_resource_start(pci
, 2);
7697 j
->XILINXbase
= j
->DSPbase
+ 0x10;
7698 j
->cardtype
= QTI_PHONEJACK_PCI
;
7700 probe
= ixj_selfprobe(j
);
7702 printk(KERN_INFO
"ixj: found Internet PhoneJACK PCI at 0x%x\n", j
->DSPbase
);
7708 static int __init
ixj_init(void)
7715 /* These might be no-ops, see above. */
7716 if ((probe
= ixj_probe_isapnp(&cnt
)) < 0) {
7719 if ((probe
= ixj_probe_isa(&cnt
)) < 0) {
7722 if ((probe
= ixj_probe_pci(&cnt
)) < 0) {
7725 printk(KERN_INFO
"ixj driver initialized.\n");
7726 create_proc_read_entry ("ixj", 0, NULL
, ixj_read_proc
, NULL
);
7730 module_init(ixj_init
);
7731 module_exit(ixj_exit
);
7733 static void DAA_Coeff_US(IXJ
*j
)
7737 j
->daa_country
= DAA_US
;
7738 /*----------------------------------------------- */
7740 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
; i
++) {
7741 j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
[i
] = 0;
7744 /* Bytes for IM-filter part 1 (04): 0E,32,E2,2F,C2,5A,C0,00 */
7745 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[7] = 0x03;
7746 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[6] = 0x4B;
7747 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[5] = 0x5D;
7748 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[4] = 0xCD;
7749 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[3] = 0x24;
7750 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[2] = 0xC5;
7751 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[1] = 0xA0;
7752 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[0] = 0x00;
7753 /* Bytes for IM-filter part 2 (05): 72,85,00,0E,2B,3A,D0,08 */
7754 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[7] = 0x71;
7755 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[6] = 0x1A;
7756 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[5] = 0x00;
7757 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[4] = 0x0A;
7758 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[3] = 0xB5;
7759 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[2] = 0x33;
7760 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[1] = 0xE0;
7761 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[0] = 0x08;
7762 /* Bytes for FRX-filter (08): 03,8F,48,F2,8F,48,70,08 */
7763 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[7] = 0x05;
7764 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[6] = 0xA3;
7765 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[5] = 0x72;
7766 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[4] = 0x34;
7767 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[3] = 0x3F;
7768 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[2] = 0x3B;
7769 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[1] = 0x30;
7770 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[0] = 0x08;
7771 /* Bytes for FRR-filter (07): 04,8F,38,7F,9B,EA,B0,08 */
7772 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[7] = 0x05;
7773 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[6] = 0x87;
7774 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[5] = 0xF9;
7775 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[4] = 0x3E;
7776 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[3] = 0x32;
7777 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[2] = 0xDA;
7778 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[1] = 0xB0;
7779 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[0] = 0x08;
7780 /* Bytes for AX-filter (0A): 16,55,DD,CA */
7781 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[3] = 0x41;
7782 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[2] = 0xB5;
7783 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[1] = 0xDD;
7784 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[0] = 0xCA;
7785 /* Bytes for AR-filter (09): 52,D3,11,42 */
7786 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[3] = 0x25;
7787 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[2] = 0xC7;
7788 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[1] = 0x10;
7789 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[0] = 0xD6;
7790 /* Bytes for TH-filter part 1 (00): 00,42,48,81,B3,80,00,98 */
7791 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[7] = 0x00;
7792 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[6] = 0x42;
7793 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[5] = 0x48;
7794 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[4] = 0x81;
7795 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[3] = 0xA5;
7796 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[2] = 0x80;
7797 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[1] = 0x00;
7798 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[0] = 0x98;
7799 /* Bytes for TH-filter part 2 (01): 02,F2,33,A0,68,AB,8A,AD */
7800 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[7] = 0x02;
7801 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[6] = 0xA2;
7802 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[5] = 0x2B;
7803 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[4] = 0xB0;
7804 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[3] = 0xE8;
7805 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[2] = 0xAB;
7806 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[1] = 0x81;
7807 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[0] = 0xCC;
7808 /* Bytes for TH-filter part 3 (02): 00,88,DA,54,A4,BA,2D,BB */
7809 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[7] = 0x00;
7810 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[6] = 0x88;
7811 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[5] = 0xD2;
7812 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[4] = 0x24;
7813 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[3] = 0xBA;
7814 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[2] = 0xA9;
7815 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[1] = 0x3B;
7816 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[0] = 0xA6;
7817 /* ; (10K, 0.68uF) */
7819 /* Bytes for Ringing part 1 (03):1B,3B,9B,BA,D4,1C,B3,23 */
7820 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[7] = 0x1B;
7821 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[6] = 0x3C;
7822 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[5] = 0x93;
7823 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[4] = 0x3A;
7824 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[3] = 0x22;
7825 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[2] = 0x12;
7826 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[1] = 0xA3;
7827 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[0] = 0x23;
7828 /* Bytes for Ringing part 2 (06):13,42,A6,BA,D4,73,CA,D5 */
7829 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[7] = 0x12;
7830 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[6] = 0xA2;
7831 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[5] = 0xA6;
7832 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[4] = 0xBA;
7833 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[3] = 0x22;
7834 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[2] = 0x7A;
7835 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[1] = 0x0A;
7836 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[0] = 0xD5;
7838 /* Levelmetering Ringing (0D):B2,45,0F,8E */
7839 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[3] = 0xAA;
7840 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[2] = 0x35;
7841 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[1] = 0x0F;
7842 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[0] = 0x8E;
7844 /* Bytes for Ringing part 1 (03):1B,3B,9B,BA,D4,1C,B3,23 */
7845 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[7] = 0x1C; */
7846 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[6] = 0xB3; */
7847 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[5] = 0xAB; */
7848 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[4] = 0xAB; */
7849 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[3] = 0x54; */
7850 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[2] = 0x2D; */
7851 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[1] = 0x62; */
7852 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[0] = 0x2D; */
7853 /* Bytes for Ringing part 2 (06):13,42,A6,BA,D4,73,CA,D5 */
7854 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[7] = 0x2D; */
7855 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[6] = 0x62; */
7856 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[5] = 0xA6; */
7857 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[4] = 0xBB; */
7858 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[3] = 0x2A; */
7859 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[2] = 0x7D; */
7860 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[1] = 0x0A; */
7861 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[0] = 0xD4; */
7863 /* Levelmetering Ringing (0D):B2,45,0F,8E */
7864 /* j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[3] = 0xAA; */
7865 /* j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[2] = 0x05; */
7866 /* j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[1] = 0x0F; */
7867 /* j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[0] = 0x8E; */
7869 /* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
7870 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[7] = 0xCA;
7871 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[6] = 0x0E;
7872 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[5] = 0xCA;
7873 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[4] = 0x09;
7874 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[3] = 0x99;
7875 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[2] = 0x99;
7876 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[1] = 0x99;
7877 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[0] = 0x99;
7878 /* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
7879 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[7] = 0xFD;
7880 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[6] = 0xB5;
7881 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[5] = 0xBA;
7882 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[4] = 0x07;
7883 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[3] = 0xDA;
7884 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[2] = 0x00;
7885 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[1] = 0x00;
7886 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[0] = 0x00;
7889 /* Config. Reg. 0 (filters) (cr0):FE ; CLK gen. by crystal */
7890 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
= 0xFF;
7891 /* Config. Reg. 1 (dialing) (cr1):05 */
7892 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
= 0x05;
7893 /* Config. Reg. 2 (caller ID) (cr2):04 */
7894 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
= 0x04;
7895 /* Config. Reg. 3 (testloops) (cr3):03 ; SEL Bit==0, HP-disabled */
7896 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
= 0x00;
7897 /* Config. Reg. 4 (analog gain) (cr4):02 */
7898 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= 0x02;
7899 /* Config. Reg. 5 (Version) (cr5):02 */
7900 /* Config. Reg. 6 (Reserved) (cr6):00 */
7901 /* Config. Reg. 7 (Reserved) (cr7):00 */
7904 /* Ext. Reg. 0 (Interrupt Reg.) (xr0):02 */
7906 j
->m_DAAShadowRegs
.XOP_xr0_W
.reg
= 0x02; /* SO_1 set to '1' because it is inverted. */
7907 /* Ext. Reg. 1 (Interrupt enable) (xr1):3C Cadence, RING, Caller ID, VDD_OK */
7909 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr1
.reg
= 0x3C;
7910 /* Ext. Reg. 2 (Cadence Time Out) (xr2):7D */
7911 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr2
.reg
= 0x7D;
7912 /* Ext. Reg. 3 (DC Char) (xr3):32 ; B-Filter Off == 1 */
7913 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr3
.reg
= 0x3B; /*0x32; */
7914 /* Ext. Reg. 4 (Cadence) (xr4):00 */
7916 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr4
.reg
= 0x00;
7917 /* Ext. Reg. 5 (Ring timer) (xr5):22 */
7918 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr5
.reg
= 0x22;
7919 /* Ext. Reg. 6 (Power State) (xr6):00 */
7920 j
->m_DAAShadowRegs
.XOP_xr6_W
.reg
= 0x00;
7921 /* Ext. Reg. 7 (Vdd) (xr7):40 */
7922 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr7
.reg
= 0x40; /* 0x40 ??? Should it be 0x00? */
7924 /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
7925 /* 12,33,5A,C3 ; 770 Hz */
7926 /* 13,3C,5B,32 ; 852 Hz */
7927 /* 1D,1B,5C,CC ; 941 Hz */
7929 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[3] = 0x11;
7930 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[2] = 0xB3;
7931 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[1] = 0x5A;
7932 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[0] = 0x2C;
7933 /* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
7934 /* EC,1D,52,22 ; 1336 Hz */
7935 /* AA,AC,51,D2 ; 1477 Hz */
7936 /* 9B,3B,51,25 ; 1633 Hz */
7937 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[3] = 0x32;
7938 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[2] = 0x32;
7939 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[1] = 0x52;
7940 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[0] = 0xB3;
7943 static void DAA_Coeff_UK(IXJ
*j
)
7947 j
->daa_country
= DAA_UK
;
7948 /*----------------------------------------------- */
7950 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
; i
++) {
7951 j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
[i
] = 0;
7954 /* Bytes for IM-filter part 1 (04): 00,C2,BB,A8,CB,81,A0,00 */
7955 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[7] = 0x00;
7956 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[6] = 0xC2;
7957 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[5] = 0xBB;
7958 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[4] = 0xA8;
7959 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[3] = 0xCB;
7960 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[2] = 0x81;
7961 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[1] = 0xA0;
7962 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[0] = 0x00;
7963 /* Bytes for IM-filter part 2 (05): 40,00,00,0A,A4,33,E0,08 */
7964 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[7] = 0x40;
7965 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[6] = 0x00;
7966 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[5] = 0x00;
7967 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[4] = 0x0A;
7968 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[3] = 0xA4;
7969 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[2] = 0x33;
7970 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[1] = 0xE0;
7971 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[0] = 0x08;
7972 /* Bytes for FRX-filter (08): 07,9B,ED,24,B2,A2,A0,08 */
7973 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[7] = 0x07;
7974 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[6] = 0x9B;
7975 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[5] = 0xED;
7976 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[4] = 0x24;
7977 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[3] = 0xB2;
7978 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[2] = 0xA2;
7979 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[1] = 0xA0;
7980 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[0] = 0x08;
7981 /* Bytes for FRR-filter (07): 0F,92,F2,B2,87,D2,30,08 */
7982 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[7] = 0x0F;
7983 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[6] = 0x92;
7984 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[5] = 0xF2;
7985 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[4] = 0xB2;
7986 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[3] = 0x87;
7987 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[2] = 0xD2;
7988 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[1] = 0x30;
7989 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[0] = 0x08;
7990 /* Bytes for AX-filter (0A): 1B,A5,DD,CA */
7991 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[3] = 0x1B;
7992 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[2] = 0xA5;
7993 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[1] = 0xDD;
7994 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[0] = 0xCA;
7995 /* Bytes for AR-filter (09): E2,27,10,D6 */
7996 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[3] = 0xE2;
7997 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[2] = 0x27;
7998 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[1] = 0x10;
7999 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[0] = 0xD6;
8000 /* Bytes for TH-filter part 1 (00): 80,2D,38,8B,D0,00,00,98 */
8001 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[7] = 0x80;
8002 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[6] = 0x2D;
8003 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[5] = 0x38;
8004 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[4] = 0x8B;
8005 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[3] = 0xD0;
8006 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[2] = 0x00;
8007 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[1] = 0x00;
8008 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[0] = 0x98;
8009 /* Bytes for TH-filter part 2 (01): 02,5A,53,F0,0B,5F,84,D4 */
8010 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[7] = 0x02;
8011 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[6] = 0x5A;
8012 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[5] = 0x53;
8013 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[4] = 0xF0;
8014 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[3] = 0x0B;
8015 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[2] = 0x5F;
8016 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[1] = 0x84;
8017 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[0] = 0xD4;
8018 /* Bytes for TH-filter part 3 (02): 00,88,6A,A4,8F,52,F5,32 */
8019 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[7] = 0x00;
8020 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[6] = 0x88;
8021 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[5] = 0x6A;
8022 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[4] = 0xA4;
8023 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[3] = 0x8F;
8024 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[2] = 0x52;
8025 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[1] = 0xF5;
8026 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[0] = 0x32;
8028 /* Bytes for Ringing part 1 (03):1B,3C,93,3A,22,12,A3,23 */
8029 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[7] = 0x1B;
8030 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[6] = 0x3C;
8031 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[5] = 0x93;
8032 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[4] = 0x3A;
8033 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[3] = 0x22;
8034 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[2] = 0x12;
8035 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[1] = 0xA3;
8036 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[0] = 0x23;
8037 /* Bytes for Ringing part 2 (06):12,A2,A6,BA,22,7A,0A,D5 */
8038 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[7] = 0x12;
8039 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[6] = 0xA2;
8040 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[5] = 0xA6;
8041 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[4] = 0xBA;
8042 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[3] = 0x22;
8043 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[2] = 0x7A;
8044 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[1] = 0x0A;
8045 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[0] = 0xD5;
8046 /* Levelmetering Ringing (0D):AA,35,0F,8E ; 25Hz 30V less possible? */
8047 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[3] = 0xAA;
8048 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[2] = 0x35;
8049 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[1] = 0x0F;
8050 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[0] = 0x8E;
8051 /* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
8052 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[7] = 0xCA;
8053 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[6] = 0x0E;
8054 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[5] = 0xCA;
8055 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[4] = 0x09;
8056 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[3] = 0x99;
8057 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[2] = 0x99;
8058 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[1] = 0x99;
8059 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[0] = 0x99;
8060 /* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
8061 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[7] = 0xFD;
8062 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[6] = 0xB5;
8063 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[5] = 0xBA;
8064 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[4] = 0x07;
8065 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[3] = 0xDA;
8066 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[2] = 0x00;
8067 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[1] = 0x00;
8068 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[0] = 0x00;
8070 /* Config. Reg. 0 (filters) (cr0):FF */
8071 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
= 0xFF;
8072 /* Config. Reg. 1 (dialing) (cr1):05 */
8073 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
= 0x05;
8074 /* Config. Reg. 2 (caller ID) (cr2):04 */
8075 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
= 0x04;
8076 /* Config. Reg. 3 (testloops) (cr3):00 ; */
8077 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
= 0x00;
8078 /* Config. Reg. 4 (analog gain) (cr4):02 */
8079 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= 0x02;
8080 /* Config. Reg. 5 (Version) (cr5):02 */
8081 /* Config. Reg. 6 (Reserved) (cr6):00 */
8082 /* Config. Reg. 7 (Reserved) (cr7):00 */
8084 /* Ext. Reg. 0 (Interrupt Reg.) (xr0):02 */
8086 j
->m_DAAShadowRegs
.XOP_xr0_W
.reg
= 0x02; /* SO_1 set to '1' because it is inverted. */
8087 /* Ext. Reg. 1 (Interrupt enable) (xr1):1C */
8089 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr1
.reg
= 0x1C; /* RING, Caller ID, VDD_OK */
8090 /* Ext. Reg. 2 (Cadence Time Out) (xr2):7D */
8092 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr2
.reg
= 0x7D;
8093 /* Ext. Reg. 3 (DC Char) (xr3):36 ; */
8094 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr3
.reg
= 0x36;
8095 /* Ext. Reg. 4 (Cadence) (xr4):00 */
8096 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr4
.reg
= 0x00;
8097 /* Ext. Reg. 5 (Ring timer) (xr5):22 */
8098 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr5
.reg
= 0x22;
8099 /* Ext. Reg. 6 (Power State) (xr6):00 */
8100 j
->m_DAAShadowRegs
.XOP_xr6_W
.reg
= 0x00;
8101 /* Ext. Reg. 7 (Vdd) (xr7):46 */
8102 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr7
.reg
= 0x46; /* 0x46 ??? Should it be 0x00? */
8103 /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
8104 /* 12,33,5A,C3 ; 770 Hz */
8105 /* 13,3C,5B,32 ; 852 Hz */
8106 /* 1D,1B,5C,CC ; 941 Hz */
8108 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[3] = 0x11;
8109 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[2] = 0xB3;
8110 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[1] = 0x5A;
8111 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[0] = 0x2C;
8112 /* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
8113 /* EC,1D,52,22 ; 1336 Hz */
8114 /* AA,AC,51,D2 ; 1477 Hz */
8115 /* 9B,3B,51,25 ; 1633 Hz */
8116 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[3] = 0x32;
8117 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[2] = 0x32;
8118 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[1] = 0x52;
8119 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[0] = 0xB3;
8123 static void DAA_Coeff_France(IXJ
*j
)
8127 j
->daa_country
= DAA_FRANCE
;
8128 /*----------------------------------------------- */
8130 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
; i
++) {
8131 j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
[i
] = 0;
8134 /* Bytes for IM-filter part 1 (04): 02,A2,43,2C,22,AF,A0,00 */
8135 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[7] = 0x02;
8136 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[6] = 0xA2;
8137 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[5] = 0x43;
8138 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[4] = 0x2C;
8139 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[3] = 0x22;
8140 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[2] = 0xAF;
8141 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[1] = 0xA0;
8142 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[0] = 0x00;
8143 /* Bytes for IM-filter part 2 (05): 67,CE,00,0C,22,33,E0,08 */
8144 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[7] = 0x67;
8145 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[6] = 0xCE;
8146 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[5] = 0x00;
8147 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[4] = 0x2C;
8148 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[3] = 0x22;
8149 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[2] = 0x33;
8150 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[1] = 0xE0;
8151 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[0] = 0x08;
8152 /* Bytes for FRX-filter (08): 07,9A,28,F6,23,4A,B0,08 */
8153 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[7] = 0x07;
8154 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[6] = 0x9A;
8155 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[5] = 0x28;
8156 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[4] = 0xF6;
8157 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[3] = 0x23;
8158 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[2] = 0x4A;
8159 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[1] = 0xB0;
8160 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[0] = 0x08;
8161 /* Bytes for FRR-filter (07): 03,8F,F9,2F,9E,FA,20,08 */
8162 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[7] = 0x03;
8163 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[6] = 0x8F;
8164 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[5] = 0xF9;
8165 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[4] = 0x2F;
8166 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[3] = 0x9E;
8167 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[2] = 0xFA;
8168 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[1] = 0x20;
8169 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[0] = 0x08;
8170 /* Bytes for AX-filter (0A): 16,B5,DD,CA */
8171 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[3] = 0x16;
8172 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[2] = 0xB5;
8173 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[1] = 0xDD;
8174 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[0] = 0xCA;
8175 /* Bytes for AR-filter (09): 52,C7,10,D6 */
8176 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[3] = 0xE2;
8177 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[2] = 0xC7;
8178 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[1] = 0x10;
8179 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[0] = 0xD6;
8180 /* Bytes for TH-filter part 1 (00): 00,42,48,81,A6,80,00,98 */
8181 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[7] = 0x00;
8182 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[6] = 0x42;
8183 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[5] = 0x48;
8184 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[4] = 0x81;
8185 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[3] = 0xA6;
8186 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[2] = 0x80;
8187 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[1] = 0x00;
8188 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[0] = 0x98;
8189 /* Bytes for TH-filter part 2 (01): 02,AC,2A,30,78,AC,8A,2C */
8190 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[7] = 0x02;
8191 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[6] = 0xAC;
8192 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[5] = 0x2A;
8193 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[4] = 0x30;
8194 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[3] = 0x78;
8195 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[2] = 0xAC;
8196 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[1] = 0x8A;
8197 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[0] = 0x2C;
8198 /* Bytes for TH-filter part 3 (02): 00,88,DA,A5,22,BA,2C,45 */
8199 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[7] = 0x00;
8200 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[6] = 0x88;
8201 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[5] = 0xDA;
8202 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[4] = 0xA5;
8203 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[3] = 0x22;
8204 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[2] = 0xBA;
8205 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[1] = 0x2C;
8206 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[0] = 0x45;
8208 /* Bytes for Ringing part 1 (03):1B,3C,93,3A,22,12,A3,23 */
8209 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[7] = 0x1B;
8210 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[6] = 0x3C;
8211 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[5] = 0x93;
8212 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[4] = 0x3A;
8213 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[3] = 0x22;
8214 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[2] = 0x12;
8215 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[1] = 0xA3;
8216 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[0] = 0x23;
8217 /* Bytes for Ringing part 2 (06):12,A2,A6,BA,22,7A,0A,D5 */
8218 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[7] = 0x12;
8219 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[6] = 0xA2;
8220 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[5] = 0xA6;
8221 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[4] = 0xBA;
8222 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[3] = 0x22;
8223 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[2] = 0x7A;
8224 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[1] = 0x0A;
8225 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[0] = 0xD5;
8226 /* Levelmetering Ringing (0D):32,45,B5,84 ; 50Hz 20V */
8227 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[3] = 0x32;
8228 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[2] = 0x45;
8229 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[1] = 0xB5;
8230 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[0] = 0x84;
8231 /* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
8232 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[7] = 0xCA;
8233 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[6] = 0x0E;
8234 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[5] = 0xCA;
8235 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[4] = 0x09;
8236 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[3] = 0x99;
8237 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[2] = 0x99;
8238 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[1] = 0x99;
8239 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[0] = 0x99;
8240 /* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
8241 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[7] = 0xFD;
8242 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[6] = 0xB5;
8243 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[5] = 0xBA;
8244 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[4] = 0x07;
8245 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[3] = 0xDA;
8246 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[2] = 0x00;
8247 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[1] = 0x00;
8248 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[0] = 0x00;
8250 /* Config. Reg. 0 (filters) (cr0):FF */
8251 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
= 0xFF;
8252 /* Config. Reg. 1 (dialing) (cr1):05 */
8253 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
= 0x05;
8254 /* Config. Reg. 2 (caller ID) (cr2):04 */
8255 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
= 0x04;
8256 /* Config. Reg. 3 (testloops) (cr3):00 ; */
8257 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
= 0x00;
8258 /* Config. Reg. 4 (analog gain) (cr4):02 */
8259 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= 0x02;
8260 /* Config. Reg. 5 (Version) (cr5):02 */
8261 /* Config. Reg. 6 (Reserved) (cr6):00 */
8262 /* Config. Reg. 7 (Reserved) (cr7):00 */
8264 /* Ext. Reg. 0 (Interrupt Reg.) (xr0):02 */
8266 j
->m_DAAShadowRegs
.XOP_xr0_W
.reg
= 0x02; /* SO_1 set to '1' because it is inverted. */
8267 /* Ext. Reg. 1 (Interrupt enable) (xr1):1C */
8269 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr1
.reg
= 0x1C; /* RING, Caller ID, VDD_OK */
8270 /* Ext. Reg. 2 (Cadence Time Out) (xr2):7D */
8272 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr2
.reg
= 0x7D;
8273 /* Ext. Reg. 3 (DC Char) (xr3):36 ; */
8274 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr3
.reg
= 0x36;
8275 /* Ext. Reg. 4 (Cadence) (xr4):00 */
8276 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr4
.reg
= 0x00;
8277 /* Ext. Reg. 5 (Ring timer) (xr5):22 */
8278 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr5
.reg
= 0x22;
8279 /* Ext. Reg. 6 (Power State) (xr6):00 */
8280 j
->m_DAAShadowRegs
.XOP_xr6_W
.reg
= 0x00;
8281 /* Ext. Reg. 7 (Vdd) (xr7):46 */
8282 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr7
.reg
= 0x46; /* 0x46 ??? Should it be 0x00? */
8283 /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
8284 /* 12,33,5A,C3 ; 770 Hz */
8285 /* 13,3C,5B,32 ; 852 Hz */
8286 /* 1D,1B,5C,CC ; 941 Hz */
8288 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[3] = 0x11;
8289 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[2] = 0xB3;
8290 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[1] = 0x5A;
8291 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[0] = 0x2C;
8292 /* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
8293 /* EC,1D,52,22 ; 1336 Hz */
8294 /* AA,AC,51,D2 ; 1477 Hz */
8295 /* 9B,3B,51,25 ; 1633 Hz */
8296 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[3] = 0x32;
8297 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[2] = 0x32;
8298 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[1] = 0x52;
8299 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[0] = 0xB3;
8303 static void DAA_Coeff_Germany(IXJ
*j
)
8307 j
->daa_country
= DAA_GERMANY
;
8308 /*----------------------------------------------- */
8310 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
; i
++) {
8311 j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
[i
] = 0;
8314 /* Bytes for IM-filter part 1 (04): 00,CE,BB,B8,D2,81,B0,00 */
8315 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[7] = 0x00;
8316 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[6] = 0xCE;
8317 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[5] = 0xBB;
8318 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[4] = 0xB8;
8319 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[3] = 0xD2;
8320 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[2] = 0x81;
8321 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[1] = 0xB0;
8322 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[0] = 0x00;
8323 /* Bytes for IM-filter part 2 (05): 45,8F,00,0C,D2,3A,D0,08 */
8324 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[7] = 0x45;
8325 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[6] = 0x8F;
8326 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[5] = 0x00;
8327 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[4] = 0x0C;
8328 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[3] = 0xD2;
8329 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[2] = 0x3A;
8330 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[1] = 0xD0;
8331 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[0] = 0x08;
8332 /* Bytes for FRX-filter (08): 07,AA,E2,34,24,89,20,08 */
8333 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[7] = 0x07;
8334 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[6] = 0xAA;
8335 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[5] = 0xE2;
8336 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[4] = 0x34;
8337 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[3] = 0x24;
8338 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[2] = 0x89;
8339 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[1] = 0x20;
8340 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[0] = 0x08;
8341 /* Bytes for FRR-filter (07): 02,87,FA,37,9A,CA,B0,08 */
8342 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[7] = 0x02;
8343 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[6] = 0x87;
8344 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[5] = 0xFA;
8345 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[4] = 0x37;
8346 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[3] = 0x9A;
8347 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[2] = 0xCA;
8348 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[1] = 0xB0;
8349 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[0] = 0x08;
8350 /* Bytes for AX-filter (0A): 72,D5,DD,CA */
8351 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[3] = 0x72;
8352 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[2] = 0xD5;
8353 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[1] = 0xDD;
8354 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[0] = 0xCA;
8355 /* Bytes for AR-filter (09): 72,42,13,4B */
8356 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[3] = 0x72;
8357 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[2] = 0x42;
8358 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[1] = 0x13;
8359 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[0] = 0x4B;
8360 /* Bytes for TH-filter part 1 (00): 80,52,48,81,AD,80,00,98 */
8361 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[7] = 0x80;
8362 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[6] = 0x52;
8363 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[5] = 0x48;
8364 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[4] = 0x81;
8365 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[3] = 0xAD;
8366 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[2] = 0x80;
8367 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[1] = 0x00;
8368 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[0] = 0x98;
8369 /* Bytes for TH-filter part 2 (01): 02,42,5A,20,E8,1A,81,27 */
8370 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[7] = 0x02;
8371 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[6] = 0x42;
8372 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[5] = 0x5A;
8373 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[4] = 0x20;
8374 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[3] = 0xE8;
8375 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[2] = 0x1A;
8376 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[1] = 0x81;
8377 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[0] = 0x27;
8378 /* Bytes for TH-filter part 3 (02): 00,88,63,26,BD,4B,A3,C2 */
8379 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[7] = 0x00;
8380 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[6] = 0x88;
8381 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[5] = 0x63;
8382 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[4] = 0x26;
8383 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[3] = 0xBD;
8384 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[2] = 0x4B;
8385 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[1] = 0xA3;
8386 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[0] = 0xC2;
8387 /* ; (10K, 0.68uF) */
8388 /* Bytes for Ringing part 1 (03):1B,3B,9B,BA,D4,1C,B3,23 */
8389 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[7] = 0x1B;
8390 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[6] = 0x3B;
8391 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[5] = 0x9B;
8392 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[4] = 0xBA;
8393 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[3] = 0xD4;
8394 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[2] = 0x1C;
8395 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[1] = 0xB3;
8396 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[0] = 0x23;
8397 /* Bytes for Ringing part 2 (06):13,42,A6,BA,D4,73,CA,D5 */
8398 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[7] = 0x13;
8399 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[6] = 0x42;
8400 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[5] = 0xA6;
8401 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[4] = 0xBA;
8402 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[3] = 0xD4;
8403 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[2] = 0x73;
8404 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[1] = 0xCA;
8405 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[0] = 0xD5;
8406 /* Levelmetering Ringing (0D):B2,45,0F,8E */
8407 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[3] = 0xB2;
8408 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[2] = 0x45;
8409 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[1] = 0x0F;
8410 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[0] = 0x8E;
8411 /* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
8412 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[7] = 0xCA;
8413 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[6] = 0x0E;
8414 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[5] = 0xCA;
8415 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[4] = 0x09;
8416 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[3] = 0x99;
8417 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[2] = 0x99;
8418 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[1] = 0x99;
8419 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[0] = 0x99;
8420 /* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
8421 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[7] = 0xFD;
8422 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[6] = 0xB5;
8423 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[5] = 0xBA;
8424 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[4] = 0x07;
8425 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[3] = 0xDA;
8426 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[2] = 0x00;
8427 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[1] = 0x00;
8428 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[0] = 0x00;
8430 /* Config. Reg. 0 (filters) (cr0):FF ; all Filters enabled, CLK from ext. source */
8431 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
= 0xFF;
8432 /* Config. Reg. 1 (dialing) (cr1):05 ; Manual Ring, Ring metering enabled */
8433 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
= 0x05;
8434 /* Config. Reg. 2 (caller ID) (cr2):04 ; Analog Gain 0dB, FSC internal */
8435 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
= 0x04;
8436 /* Config. Reg. 3 (testloops) (cr3):00 ; SEL Bit==0, HP-enabled */
8437 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
= 0x00;
8438 /* Config. Reg. 4 (analog gain) (cr4):02 */
8439 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= 0x02;
8440 /* Config. Reg. 5 (Version) (cr5):02 */
8441 /* Config. Reg. 6 (Reserved) (cr6):00 */
8442 /* Config. Reg. 7 (Reserved) (cr7):00 */
8444 /* Ext. Reg. 0 (Interrupt Reg.) (xr0):02 */
8446 j
->m_DAAShadowRegs
.XOP_xr0_W
.reg
= 0x02; /* SO_1 set to '1' because it is inverted. */
8447 /* Ext. Reg. 1 (Interrupt enable) (xr1):1C ; Ring, CID, VDDOK Interrupts enabled */
8449 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr1
.reg
= 0x1C; /* RING, Caller ID, VDD_OK */
8450 /* Ext. Reg. 2 (Cadence Time Out) (xr2):7D */
8452 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr2
.reg
= 0x7D;
8453 /* Ext. Reg. 3 (DC Char) (xr3):32 ; B-Filter Off==1, U0=3.5V, R=200Ohm */
8454 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr3
.reg
= 0x32;
8455 /* Ext. Reg. 4 (Cadence) (xr4):00 */
8456 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr4
.reg
= 0x00;
8457 /* Ext. Reg. 5 (Ring timer) (xr5):22 */
8458 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr5
.reg
= 0x22;
8459 /* Ext. Reg. 6 (Power State) (xr6):00 */
8460 j
->m_DAAShadowRegs
.XOP_xr6_W
.reg
= 0x00;
8461 /* Ext. Reg. 7 (Vdd) (xr7):40 ; VDD=4.25 V */
8462 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr7
.reg
= 0x40; /* 0x40 ??? Should it be 0x00? */
8463 /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
8464 /* 12,33,5A,C3 ; 770 Hz */
8465 /* 13,3C,5B,32 ; 852 Hz */
8466 /* 1D,1B,5C,CC ; 941 Hz */
8468 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[3] = 0x11;
8469 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[2] = 0xB3;
8470 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[1] = 0x5A;
8471 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[0] = 0x2C;
8472 /* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
8473 /* EC,1D,52,22 ; 1336 Hz */
8474 /* AA,AC,51,D2 ; 1477 Hz */
8475 /* 9B,3B,51,25 ; 1633 Hz */
8476 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[3] = 0x32;
8477 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[2] = 0x32;
8478 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[1] = 0x52;
8479 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[0] = 0xB3;
8483 static void DAA_Coeff_Australia(IXJ
*j
)
8487 j
->daa_country
= DAA_AUSTRALIA
;
8488 /*----------------------------------------------- */
8490 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
; i
++) {
8491 j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
[i
] = 0;
8494 /* Bytes for IM-filter part 1 (04): 00,A3,AA,28,B3,82,D0,00 */
8495 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[7] = 0x00;
8496 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[6] = 0xA3;
8497 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[5] = 0xAA;
8498 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[4] = 0x28;
8499 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[3] = 0xB3;
8500 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[2] = 0x82;
8501 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[1] = 0xD0;
8502 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[0] = 0x00;
8503 /* Bytes for IM-filter part 2 (05): 70,96,00,09,32,6B,C0,08 */
8504 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[7] = 0x70;
8505 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[6] = 0x96;
8506 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[5] = 0x00;
8507 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[4] = 0x09;
8508 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[3] = 0x32;
8509 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[2] = 0x6B;
8510 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[1] = 0xC0;
8511 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[0] = 0x08;
8512 /* Bytes for FRX-filter (08): 07,96,E2,34,32,9B,30,08 */
8513 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[7] = 0x07;
8514 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[6] = 0x96;
8515 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[5] = 0xE2;
8516 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[4] = 0x34;
8517 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[3] = 0x32;
8518 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[2] = 0x9B;
8519 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[1] = 0x30;
8520 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[0] = 0x08;
8521 /* Bytes for FRR-filter (07): 0F,9A,E9,2F,22,CC,A0,08 */
8522 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[7] = 0x0F;
8523 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[6] = 0x9A;
8524 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[5] = 0xE9;
8525 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[4] = 0x2F;
8526 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[3] = 0x22;
8527 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[2] = 0xCC;
8528 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[1] = 0xA0;
8529 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[0] = 0x08;
8530 /* Bytes for AX-filter (0A): CB,45,DD,CA */
8531 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[3] = 0xCB;
8532 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[2] = 0x45;
8533 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[1] = 0xDD;
8534 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[0] = 0xCA;
8535 /* Bytes for AR-filter (09): 1B,67,10,D6 */
8536 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[3] = 0x1B;
8537 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[2] = 0x67;
8538 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[1] = 0x10;
8539 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[0] = 0xD6;
8540 /* Bytes for TH-filter part 1 (00): 80,52,48,81,AF,80,00,98 */
8541 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[7] = 0x80;
8542 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[6] = 0x52;
8543 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[5] = 0x48;
8544 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[4] = 0x81;
8545 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[3] = 0xAF;
8546 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[2] = 0x80;
8547 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[1] = 0x00;
8548 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[0] = 0x98;
8549 /* Bytes for TH-filter part 2 (01): 02,DB,52,B0,38,01,82,AC */
8550 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[7] = 0x02;
8551 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[6] = 0xDB;
8552 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[5] = 0x52;
8553 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[4] = 0xB0;
8554 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[3] = 0x38;
8555 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[2] = 0x01;
8556 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[1] = 0x82;
8557 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[0] = 0xAC;
8558 /* Bytes for TH-filter part 3 (02): 00,88,4A,3E,2C,3B,24,46 */
8559 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[7] = 0x00;
8560 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[6] = 0x88;
8561 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[5] = 0x4A;
8562 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[4] = 0x3E;
8563 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[3] = 0x2C;
8564 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[2] = 0x3B;
8565 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[1] = 0x24;
8566 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[0] = 0x46;
8568 /* Bytes for Ringing part 1 (03):1B,3C,93,3A,22,12,A3,23 */
8569 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[7] = 0x1B;
8570 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[6] = 0x3C;
8571 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[5] = 0x93;
8572 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[4] = 0x3A;
8573 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[3] = 0x22;
8574 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[2] = 0x12;
8575 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[1] = 0xA3;
8576 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[0] = 0x23;
8577 /* Bytes for Ringing part 2 (06):12,A2,A6,BA,22,7A,0A,D5 */
8578 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[7] = 0x12;
8579 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[6] = 0xA2;
8580 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[5] = 0xA6;
8581 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[4] = 0xBA;
8582 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[3] = 0x22;
8583 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[2] = 0x7A;
8584 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[1] = 0x0A;
8585 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[0] = 0xD5;
8586 /* Levelmetering Ringing (0D):32,45,B5,84 ; 50Hz 20V */
8587 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[3] = 0x32;
8588 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[2] = 0x45;
8589 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[1] = 0xB5;
8590 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[0] = 0x84;
8591 /* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
8592 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[7] = 0xCA;
8593 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[6] = 0x0E;
8594 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[5] = 0xCA;
8595 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[4] = 0x09;
8596 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[3] = 0x99;
8597 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[2] = 0x99;
8598 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[1] = 0x99;
8599 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[0] = 0x99;
8600 /* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
8601 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[7] = 0xFD;
8602 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[6] = 0xB5;
8603 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[5] = 0xBA;
8604 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[4] = 0x07;
8605 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[3] = 0xDA;
8606 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[2] = 0x00;
8607 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[1] = 0x00;
8608 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[0] = 0x00;
8610 /* Config. Reg. 0 (filters) (cr0):FF */
8611 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
= 0xFF;
8612 /* Config. Reg. 1 (dialing) (cr1):05 */
8613 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
= 0x05;
8614 /* Config. Reg. 2 (caller ID) (cr2):04 */
8615 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
= 0x04;
8616 /* Config. Reg. 3 (testloops) (cr3):00 ; */
8617 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
= 0x00;
8618 /* Config. Reg. 4 (analog gain) (cr4):02 */
8619 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= 0x02;
8620 /* Config. Reg. 5 (Version) (cr5):02 */
8621 /* Config. Reg. 6 (Reserved) (cr6):00 */
8622 /* Config. Reg. 7 (Reserved) (cr7):00 */
8624 /* Ext. Reg. 0 (Interrupt Reg.) (xr0):02 */
8626 j
->m_DAAShadowRegs
.XOP_xr0_W
.reg
= 0x02; /* SO_1 set to '1' because it is inverted. */
8627 /* Ext. Reg. 1 (Interrupt enable) (xr1):1C */
8629 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr1
.reg
= 0x1C; /* RING, Caller ID, VDD_OK */
8630 /* Ext. Reg. 2 (Cadence Time Out) (xr2):7D */
8632 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr2
.reg
= 0x7D;
8633 /* Ext. Reg. 3 (DC Char) (xr3):2B ; */
8634 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr3
.reg
= 0x2B;
8635 /* Ext. Reg. 4 (Cadence) (xr4):00 */
8636 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr4
.reg
= 0x00;
8637 /* Ext. Reg. 5 (Ring timer) (xr5):22 */
8638 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr5
.reg
= 0x22;
8639 /* Ext. Reg. 6 (Power State) (xr6):00 */
8640 j
->m_DAAShadowRegs
.XOP_xr6_W
.reg
= 0x00;
8641 /* Ext. Reg. 7 (Vdd) (xr7):40 */
8642 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr7
.reg
= 0x40; /* 0x40 ??? Should it be 0x00? */
8644 /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
8645 /* 12,33,5A,C3 ; 770 Hz */
8646 /* 13,3C,5B,32 ; 852 Hz */
8647 /* 1D,1B,5C,CC ; 941 Hz */
8648 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[3] = 0x11;
8649 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[2] = 0xB3;
8650 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[1] = 0x5A;
8651 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[0] = 0x2C;
8653 /* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
8654 /* EC,1D,52,22 ; 1336 Hz */
8655 /* AA,AC,51,D2 ; 1477 Hz */
8656 /* 9B,3B,51,25 ; 1633 Hz */
8657 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[3] = 0x32;
8658 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[2] = 0x32;
8659 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[1] = 0x52;
8660 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[0] = 0xB3;
8663 static void DAA_Coeff_Japan(IXJ
*j
)
8667 j
->daa_country
= DAA_JAPAN
;
8668 /*----------------------------------------------- */
8670 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
; i
++) {
8671 j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
[i
] = 0;
8674 /* Bytes for IM-filter part 1 (04): 06,BD,E2,2D,BA,F9,A0,00 */
8675 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[7] = 0x06;
8676 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[6] = 0xBD;
8677 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[5] = 0xE2;
8678 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[4] = 0x2D;
8679 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[3] = 0xBA;
8680 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[2] = 0xF9;
8681 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[1] = 0xA0;
8682 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[0] = 0x00;
8683 /* Bytes for IM-filter part 2 (05): 6F,F7,00,0E,34,33,E0,08 */
8684 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[7] = 0x6F;
8685 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[6] = 0xF7;
8686 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[5] = 0x00;
8687 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[4] = 0x0E;
8688 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[3] = 0x34;
8689 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[2] = 0x33;
8690 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[1] = 0xE0;
8691 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[0] = 0x08;
8692 /* Bytes for FRX-filter (08): 02,8F,68,77,9C,58,F0,08 */
8693 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[7] = 0x02;
8694 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[6] = 0x8F;
8695 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[5] = 0x68;
8696 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[4] = 0x77;
8697 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[3] = 0x9C;
8698 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[2] = 0x58;
8699 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[1] = 0xF0;
8700 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[0] = 0x08;
8701 /* Bytes for FRR-filter (07): 03,8F,38,73,87,EA,20,08 */
8702 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[7] = 0x03;
8703 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[6] = 0x8F;
8704 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[5] = 0x38;
8705 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[4] = 0x73;
8706 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[3] = 0x87;
8707 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[2] = 0xEA;
8708 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[1] = 0x20;
8709 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[0] = 0x08;
8710 /* Bytes for AX-filter (0A): 51,C5,DD,CA */
8711 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[3] = 0x51;
8712 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[2] = 0xC5;
8713 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[1] = 0xDD;
8714 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[0] = 0xCA;
8715 /* Bytes for AR-filter (09): 25,A7,10,D6 */
8716 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[3] = 0x25;
8717 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[2] = 0xA7;
8718 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[1] = 0x10;
8719 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[0] = 0xD6;
8720 /* Bytes for TH-filter part 1 (00): 00,42,48,81,AE,80,00,98 */
8721 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[7] = 0x00;
8722 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[6] = 0x42;
8723 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[5] = 0x48;
8724 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[4] = 0x81;
8725 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[3] = 0xAE;
8726 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[2] = 0x80;
8727 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[1] = 0x00;
8728 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[0] = 0x98;
8729 /* Bytes for TH-filter part 2 (01): 02,AB,2A,20,99,5B,89,28 */
8730 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[7] = 0x02;
8731 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[6] = 0xAB;
8732 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[5] = 0x2A;
8733 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[4] = 0x20;
8734 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[3] = 0x99;
8735 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[2] = 0x5B;
8736 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[1] = 0x89;
8737 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[0] = 0x28;
8738 /* Bytes for TH-filter part 3 (02): 00,88,DA,25,34,C5,4C,BA */
8739 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[7] = 0x00;
8740 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[6] = 0x88;
8741 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[5] = 0xDA;
8742 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[4] = 0x25;
8743 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[3] = 0x34;
8744 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[2] = 0xC5;
8745 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[1] = 0x4C;
8746 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[0] = 0xBA;
8748 /* Bytes for Ringing part 1 (03):1B,3C,93,3A,22,12,A3,23 */
8749 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[7] = 0x1B;
8750 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[6] = 0x3C;
8751 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[5] = 0x93;
8752 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[4] = 0x3A;
8753 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[3] = 0x22;
8754 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[2] = 0x12;
8755 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[1] = 0xA3;
8756 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[0] = 0x23;
8757 /* Bytes for Ringing part 2 (06):12,A2,A6,BA,22,7A,0A,D5 */
8758 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[7] = 0x12;
8759 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[6] = 0xA2;
8760 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[5] = 0xA6;
8761 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[4] = 0xBA;
8762 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[3] = 0x22;
8763 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[2] = 0x7A;
8764 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[1] = 0x0A;
8765 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[0] = 0xD5;
8766 /* Levelmetering Ringing (0D):AA,35,0F,8E ; 25Hz 30V ????????? */
8767 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[3] = 0xAA;
8768 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[2] = 0x35;
8769 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[1] = 0x0F;
8770 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[0] = 0x8E;
8771 /* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
8772 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[7] = 0xCA;
8773 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[6] = 0x0E;
8774 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[5] = 0xCA;
8775 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[4] = 0x09;
8776 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[3] = 0x99;
8777 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[2] = 0x99;
8778 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[1] = 0x99;
8779 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[0] = 0x99;
8780 /* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
8781 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[7] = 0xFD;
8782 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[6] = 0xB5;
8783 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[5] = 0xBA;
8784 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[4] = 0x07;
8785 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[3] = 0xDA;
8786 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[2] = 0x00;
8787 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[1] = 0x00;
8788 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[0] = 0x00;
8790 /* Config. Reg. 0 (filters) (cr0):FF */
8791 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
= 0xFF;
8792 /* Config. Reg. 1 (dialing) (cr1):05 */
8793 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
= 0x05;
8794 /* Config. Reg. 2 (caller ID) (cr2):04 */
8795 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
= 0x04;
8796 /* Config. Reg. 3 (testloops) (cr3):00 ; */
8797 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
= 0x00;
8798 /* Config. Reg. 4 (analog gain) (cr4):02 */
8799 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= 0x02;
8800 /* Config. Reg. 5 (Version) (cr5):02 */
8801 /* Config. Reg. 6 (Reserved) (cr6):00 */
8802 /* Config. Reg. 7 (Reserved) (cr7):00 */
8804 /* Ext. Reg. 0 (Interrupt Reg.) (xr0):02 */
8806 j
->m_DAAShadowRegs
.XOP_xr0_W
.reg
= 0x02; /* SO_1 set to '1' because it is inverted. */
8807 /* Ext. Reg. 1 (Interrupt enable) (xr1):1C */
8809 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr1
.reg
= 0x1C; /* RING, Caller ID, VDD_OK */
8810 /* Ext. Reg. 2 (Cadence Time Out) (xr2):7D */
8812 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr2
.reg
= 0x7D;
8813 /* Ext. Reg. 3 (DC Char) (xr3):22 ; */
8814 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr3
.reg
= 0x22;
8815 /* Ext. Reg. 4 (Cadence) (xr4):00 */
8816 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr4
.reg
= 0x00;
8817 /* Ext. Reg. 5 (Ring timer) (xr5):22 */
8818 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr5
.reg
= 0x22;
8819 /* Ext. Reg. 6 (Power State) (xr6):00 */
8820 j
->m_DAAShadowRegs
.XOP_xr6_W
.reg
= 0x00;
8821 /* Ext. Reg. 7 (Vdd) (xr7):40 */
8822 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr7
.reg
= 0x40; /* 0x40 ??? Should it be 0x00? */
8823 /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
8824 /* 12,33,5A,C3 ; 770 Hz */
8825 /* 13,3C,5B,32 ; 852 Hz */
8826 /* 1D,1B,5C,CC ; 941 Hz */
8828 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[3] = 0x11;
8829 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[2] = 0xB3;
8830 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[1] = 0x5A;
8831 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[0] = 0x2C;
8832 /* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
8833 /* EC,1D,52,22 ; 1336 Hz */
8834 /* AA,AC,51,D2 ; 1477 Hz */
8835 /* 9B,3B,51,25 ; 1633 Hz */
8836 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[3] = 0x32;
8837 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[2] = 0x32;
8838 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[1] = 0x52;
8839 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[0] = 0xB3;
8842 static s16 tone_table
[][19] =
8845 32538, /* A1 = 1.985962 */
8846 -32325, /* A2 = -0.986511 */
8847 -343, /* B2 = -0.010493 */
8849 343, /* B0 = 0.010493 */
8850 32619, /* A1 = 1.990906 */
8851 -32520, /* A2 = -0.992462 */
8852 19179, /* B2 = 0.585327 */
8853 -19178, /* B1 = -1.170593 */
8854 19179, /* B0 = 0.585327 */
8855 32723, /* A1 = 1.997314 */
8856 -32686, /* A2 = -0.997528 */
8857 9973, /* B2 = 0.304352 */
8858 -9955, /* B1 = -0.607605 */
8859 9973, /* B0 = 0.304352 */
8860 7, /* Internal filter scaling */
8861 159, /* Minimum in-band energy threshold */
8862 21, /* 21/32 in-band to broad-band ratio */
8863 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
8865 { /* f133_200[] 12 */
8866 32072, /* A1 = 1.95752 */
8867 -31896, /* A2 = -0.973419 */
8868 -435, /* B2 = -0.013294 */
8870 435, /* B0 = 0.013294 */
8871 32188, /* A1 = 1.9646 */
8872 -32400, /* A2 = -0.98877 */
8873 15139, /* B2 = 0.462036 */
8874 -14882, /* B1 = -0.908356 */
8875 15139, /* B0 = 0.462036 */
8876 32473, /* A1 = 1.981995 */
8877 -32524, /* A2 = -0.992584 */
8878 23200, /* B2 = 0.708008 */
8879 -23113, /* B1 = -1.410706 */
8880 23200, /* B0 = 0.708008 */
8881 7, /* Internal filter scaling */
8882 159, /* Minimum in-band energy threshold */
8883 21, /* 21/32 in-band to broad-band ratio */
8884 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
8887 31769, /* A1 = -1.939026 */
8888 -32584, /* A2 = 0.994385 */
8889 -475, /* B2 = -0.014522 */
8890 0, /* B1 = 0.000000 */
8891 475, /* B0 = 0.014522 */
8892 31789, /* A1 = -1.940247 */
8893 -32679, /* A2 = 0.997284 */
8894 17280, /* B2 = 0.527344 */
8895 -16865, /* B1 = -1.029358 */
8896 17280, /* B0 = 0.527344 */
8897 31841, /* A1 = -1.943481 */
8898 -32681, /* A2 = 0.997345 */
8899 543, /* B2 = 0.016579 */
8900 -525, /* B1 = -0.032097 */
8901 543, /* B0 = 0.016579 */
8902 5, /* Internal filter scaling */
8903 159, /* Minimum in-band energy threshold */
8904 21, /* 21/32 in-band to broad-band ratio */
8905 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
8907 { /* f300_420[] 14 */
8908 30750, /* A1 = 1.876892 */
8909 -31212, /* A2 = -0.952515 */
8910 -804, /* B2 = -0.024541 */
8912 804, /* B0 = 0.024541 */
8913 30686, /* A1 = 1.872925 */
8914 -32145, /* A2 = -0.980988 */
8915 14747, /* B2 = 0.450043 */
8916 -13703, /* B1 = -0.836395 */
8917 14747, /* B0 = 0.450043 */
8918 31651, /* A1 = 1.931824 */
8919 -32321, /* A2 = -0.986389 */
8920 24425, /* B2 = 0.745422 */
8921 -23914, /* B1 = -1.459595 */
8922 24427, /* B0 = 0.745483 */
8923 7, /* Internal filter scaling */
8924 159, /* Minimum in-band energy threshold */
8925 21, /* 21/32 in-band to broad-band ratio */
8926 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
8929 31613, /* A1 = -1.929565 */
8930 -32646, /* A2 = 0.996277 */
8931 -185, /* B2 = -0.005657 */
8932 0, /* B1 = 0.000000 */
8933 185, /* B0 = 0.005657 */
8934 31620, /* A1 = -1.929932 */
8935 -32713, /* A2 = 0.998352 */
8936 19253, /* B2 = 0.587585 */
8937 -18566, /* B1 = -1.133179 */
8938 19253, /* B0 = 0.587585 */
8939 31674, /* A1 = -1.933228 */
8940 -32715, /* A2 = 0.998413 */
8941 2575, /* B2 = 0.078590 */
8942 -2495, /* B1 = -0.152283 */
8943 2575, /* B0 = 0.078590 */
8944 5, /* Internal filter scaling */
8945 159, /* Minimum in-band energy threshold */
8946 21, /* 21/32 in-band to broad-band ratio */
8947 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
8949 { /* f300_425[] 16 */
8950 30741, /* A1 = 1.876282 */
8951 -31475, /* A2 = -0.960541 */
8952 -703, /* B2 = -0.021484 */
8954 703, /* B0 = 0.021484 */
8955 30688, /* A1 = 1.873047 */
8956 -32248, /* A2 = -0.984161 */
8957 14542, /* B2 = 0.443787 */
8958 -13523, /* B1 = -0.825439 */
8959 14542, /* B0 = 0.443817 */
8960 31494, /* A1 = 1.922302 */
8961 -32366, /* A2 = -0.987762 */
8962 21577, /* B2 = 0.658508 */
8963 -21013, /* B1 = -1.282532 */
8964 21577, /* B0 = 0.658508 */
8965 7, /* Internal filter scaling */
8966 159, /* Minimum in-band energy threshold */
8967 21, /* 21/32 in-band to broad-band ratio */
8968 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
8970 { /* f330_440[] 17 */
8971 30627, /* A1 = 1.869324 */
8972 -31338, /* A2 = -0.95636 */
8973 -843, /* B2 = -0.025749 */
8975 843, /* B0 = 0.025749 */
8976 30550, /* A1 = 1.864685 */
8977 -32221, /* A2 = -0.983337 */
8978 13594, /* B2 = 0.414886 */
8979 -12589, /* B1 = -0.768402 */
8980 13594, /* B0 = 0.414886 */
8981 31488, /* A1 = 1.921936 */
8982 -32358, /* A2 = -0.987518 */
8983 24684, /* B2 = 0.753296 */
8984 -24029, /* B1 = -1.466614 */
8985 24684, /* B0 = 0.753296 */
8986 7, /* Internal filter scaling */
8987 159, /* Minimum in-band energy threshold */
8988 21, /* 21/32 in-band to broad-band ratio */
8989 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
8992 31546, /* A1 = -1.925476 */
8993 -32646, /* A2 = 0.996277 */
8994 -445, /* B2 = -0.013588 */
8995 0, /* B1 = 0.000000 */
8996 445, /* B0 = 0.013588 */
8997 31551, /* A1 = -1.925781 */
8998 -32713, /* A2 = 0.998352 */
8999 23884, /* B2 = 0.728882 */
9000 -22979, /* B1 = -1.402527 */
9001 23884, /* B0 = 0.728882 */
9002 31606, /* A1 = -1.929138 */
9003 -32715, /* A2 = 0.998413 */
9004 863, /* B2 = 0.026367 */
9005 -835, /* B1 = -0.050985 */
9006 863, /* B0 = 0.026367 */
9007 5, /* Internal filter scaling */
9008 159, /* Minimum in-band energy threshold */
9009 21, /* 21/32 in-band to broad-band ratio */
9010 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9012 { /* f350_400[] 19 */
9013 31006, /* A1 = 1.892517 */
9014 -32029, /* A2 = -0.977448 */
9015 -461, /* B2 = -0.014096 */
9017 461, /* B0 = 0.014096 */
9018 30999, /* A1 = 1.892029 */
9019 -32487, /* A2 = -0.991455 */
9020 11325, /* B2 = 0.345612 */
9021 -10682, /* B1 = -0.651978 */
9022 11325, /* B0 = 0.345612 */
9023 31441, /* A1 = 1.919067 */
9024 -32526, /* A2 = -0.992615 */
9025 24324, /* B2 = 0.74231 */
9026 -23535, /* B1 = -1.436523 */
9027 24324, /* B0 = 0.74231 */
9028 7, /* Internal filter scaling */
9029 159, /* Minimum in-band energy threshold */
9030 21, /* 21/32 in-band to broad-band ratio */
9031 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9034 30634, /* A1 = 1.869751 */
9035 -31533, /* A2 = -0.962341 */
9036 -680, /* B2 = -0.020782 */
9038 680, /* B0 = 0.020782 */
9039 30571, /* A1 = 1.865906 */
9040 -32277, /* A2 = -0.985016 */
9041 12894, /* B2 = 0.393524 */
9042 -11945, /* B1 = -0.729065 */
9043 12894, /* B0 = 0.393524 */
9044 31367, /* A1 = 1.91449 */
9045 -32379, /* A2 = -0.988129 */
9046 23820, /* B2 = 0.726929 */
9047 -23104, /* B1 = -1.410217 */
9048 23820, /* B0 = 0.726929 */
9049 7, /* Internal filter scaling */
9050 159, /* Minimum in-band energy threshold */
9051 21, /* 21/32 in-band to broad-band ratio */
9052 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9055 30552, /* A1 = 1.864807 */
9056 -31434, /* A2 = -0.95929 */
9057 -690, /* B2 = -0.021066 */
9059 690, /* B0 = 0.021066 */
9060 30472, /* A1 = 1.859924 */
9061 -32248, /* A2 = -0.984161 */
9062 13385, /* B2 = 0.408478 */
9063 -12357, /* B1 = -0.754242 */
9064 13385, /* B0 = 0.408478 */
9065 31358, /* A1 = 1.914001 */
9066 -32366, /* A2 = -0.987732 */
9067 26488, /* B2 = 0.80835 */
9068 -25692, /* B1 = -1.568176 */
9069 26490, /* B0 = 0.808411 */
9070 7, /* Internal filter scaling */
9071 159, /* Minimum in-band energy threshold */
9072 21, /* 21/32 in-band to broad-band ratio */
9073 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9076 31397, /* A1 = -1.916321 */
9077 -32623, /* A2 = 0.995605 */
9078 -117, /* B2 = -0.003598 */
9079 0, /* B1 = 0.000000 */
9080 117, /* B0 = 0.003598 */
9081 31403, /* A1 = -1.916687 */
9082 -32700, /* A2 = 0.997925 */
9083 3388, /* B2 = 0.103401 */
9084 -3240, /* B1 = -0.197784 */
9085 3388, /* B0 = 0.103401 */
9086 31463, /* A1 = -1.920410 */
9087 -32702, /* A2 = 0.997986 */
9088 13346, /* B2 = 0.407288 */
9089 -12863, /* B1 = -0.785126 */
9090 13346, /* B0 = 0.407288 */
9091 5, /* Internal filter scaling */
9092 159, /* Minimum in-band energy threshold */
9093 21, /* 21/32 in-band to broad-band ratio */
9094 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9097 30831, /* A1 = 1.881775 */
9098 -32064, /* A2 = -0.978546 */
9099 -367, /* B2 = -0.01122 */
9101 367, /* B0 = 0.01122 */
9102 30813, /* A1 = 1.880737 */
9103 -32456, /* A2 = -0.990509 */
9104 11068, /* B2 = 0.337769 */
9105 -10338, /* B1 = -0.631042 */
9106 11068, /* B0 = 0.337769 */
9107 31214, /* A1 = 1.905212 */
9108 -32491, /* A2 = -0.991577 */
9109 16374, /* B2 = 0.499695 */
9110 -15781, /* B1 = -0.963196 */
9111 16374, /* B0 = 0.499695 */
9112 7, /* Internal filter scaling */
9113 159, /* Minimum in-band energy threshold */
9114 21, /* 21/32 in-band to broad-band ratio */
9115 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9118 31152, /* A1 = -1.901428 */
9119 -32613, /* A2 = 0.995300 */
9120 -314, /* B2 = -0.009605 */
9121 0, /* B1 = 0.000000 */
9122 314, /* B0 = 0.009605 */
9123 31156, /* A1 = -1.901672 */
9124 -32694, /* A2 = 0.997742 */
9125 28847, /* B2 = 0.880371 */
9126 -2734, /* B1 = -0.166901 */
9127 28847, /* B0 = 0.880371 */
9128 31225, /* A1 = -1.905823 */
9129 -32696, /* A2 = 0.997803 */
9130 462, /* B2 = 0.014108 */
9131 -442, /* B1 = -0.027019 */
9132 462, /* B0 = 0.014108 */
9133 5, /* Internal filter scaling */
9134 159, /* Minimum in-band energy threshold */
9135 21, /* 21/32 in-band to broad-band ratio */
9136 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9139 30836, /* A1 = 1.882141 */
9140 -32296, /* A2 = -0.985596 */
9141 -324, /* B2 = -0.009903 */
9143 324, /* B0 = 0.009903 */
9144 30825, /* A1 = 1.881409 */
9145 -32570, /* A2 = -0.993958 */
9146 16847, /* B2 = 0.51416 */
9147 -15792, /* B1 = -0.963898 */
9148 16847, /* B0 = 0.51416 */
9149 31106, /* A1 = 1.89856 */
9150 -32584, /* A2 = -0.994415 */
9151 9579, /* B2 = 0.292328 */
9152 -9164, /* B1 = -0.559357 */
9153 9579, /* B0 = 0.292328 */
9154 7, /* Internal filter scaling */
9155 159, /* Minimum in-band energy threshold */
9156 21, /* 21/32 in-band to broad-band ratio */
9157 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9160 30702, /* A1 = 1.873962 */
9161 -32134, /* A2 = -0.980682 */
9162 -517, /* B2 = -0.015793 */
9164 517, /* B0 = 0.015793 */
9165 30676, /* A1 = 1.872375 */
9166 -32520, /* A2 = -0.992462 */
9167 8144, /* B2 = 0.24855 */
9168 -7596, /* B1 = -0.463684 */
9169 8144, /* B0 = 0.24855 */
9170 31084, /* A1 = 1.897217 */
9171 -32547, /* A2 = -0.993256 */
9172 22713, /* B2 = 0.693176 */
9173 -21734, /* B1 = -1.326599 */
9174 22713, /* B0 = 0.693176 */
9175 7, /* Internal filter scaling */
9176 159, /* Minimum in-band energy threshold */
9177 21, /* 21/32 in-band to broad-band ratio */
9178 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9181 30613, /* A1 = 1.86853 */
9182 -32031, /* A2 = -0.977509 */
9183 -618, /* B2 = -0.018866 */
9185 618, /* B0 = 0.018866 */
9186 30577, /* A1 = 1.866272 */
9187 -32491, /* A2 = -0.991577 */
9188 9612, /* B2 = 0.293335 */
9189 -8935, /* B1 = -0.54541 */
9190 9612, /* B0 = 0.293335 */
9191 31071, /* A1 = 1.896484 */
9192 -32524, /* A2 = -0.992584 */
9193 21596, /* B2 = 0.659058 */
9194 -20667, /* B1 = -1.261414 */
9195 21596, /* B0 = 0.659058 */
9196 7, /* Internal filter scaling */
9197 159, /* Minimum in-band energy threshold */
9198 21, /* 21/32 in-band to broad-band ratio */
9199 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9202 30914, /* A1 = -1.886841 */
9203 -32584, /* A2 = 0.994385 */
9204 -426, /* B2 = -0.013020 */
9205 0, /* B1 = 0.000000 */
9206 426, /* B0 = 0.013020 */
9207 30914, /* A1 = -1.886841 */
9208 -32679, /* A2 = 0.997314 */
9209 17520, /* B2 = 0.534668 */
9210 -16471, /* B1 = -1.005310 */
9211 17520, /* B0 = 0.534668 */
9212 31004, /* A1 = -1.892334 */
9213 -32683, /* A2 = 0.997406 */
9214 819, /* B2 = 0.025023 */
9215 -780, /* B1 = -0.047619 */
9216 819, /* B0 = 0.025023 */
9217 5, /* Internal filter scaling */
9218 159, /* Minimum in-band energy threshold */
9219 21, /* 21/32 in-band to broad-band ratio */
9220 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9224 30881, /* A1 = -1.884827 */
9225 -32603, /* A2 = 0.994965 */
9226 -496, /* B2 = -0.015144 */
9227 0, /* B1 = 0.000000 */
9228 496, /* B0 = 0.015144 */
9229 30880, /* A1 = -1.884766 */
9230 -32692, /* A2 = 0.997711 */
9231 24767, /* B2 = 0.755859 */
9232 -23290, /* B1 = -1.421509 */
9233 24767, /* B0 = 0.755859 */
9234 30967, /* A1 = -1.890076 */
9235 -32694, /* A2 = 0.997772 */
9236 728, /* B2 = 0.022232 */
9237 -691, /* B1 = -0.042194 */
9238 728, /* B0 = 0.022232 */
9239 5, /* Internal filter scaling */
9240 159, /* Minimum in-band energy threshold */
9241 21, /* 21/32 in-band to broad-band ratio */
9242 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9268 30646, /* A1 = 1.870544 */
9269 -32327, /* A2 = -0.986572 */
9270 -287, /* B2 = -0.008769 */
9272 287, /* B0 = 0.008769 */
9273 30627, /* A1 = 1.869324 */
9274 -32607, /* A2 = -0.995087 */
9275 13269, /* B2 = 0.404968 */
9276 -12376, /* B1 = -0.755432 */
9277 13269, /* B0 = 0.404968 */
9278 30924, /* A1 = 1.887512 */
9279 -32619, /* A2 = -0.995453 */
9280 19950, /* B2 = 0.608826 */
9281 -18940, /* B1 = -1.156006 */
9282 19950, /* B0 = 0.608826 */
9283 7, /* Internal filter scaling */
9284 159, /* Minimum in-band energy threshold */
9285 21, /* 21/32 in-band to broad-band ratio */
9286 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9289 30396, /* A1 = 1.855225 */
9290 -32014, /* A2 = -0.97699 */
9291 -395, /* B2 = -0.012055 */
9293 395, /* B0 = 0.012055 */
9294 30343, /* A1 = 1.85199 */
9295 -32482, /* A2 = -0.991302 */
9296 17823, /* B2 = 0.543945 */
9297 -16431, /* B1 = -1.002869 */
9298 17823, /* B0 = 0.543945 */
9299 30872, /* A1 = 1.884338 */
9300 -32516, /* A2 = -0.99231 */
9301 18124, /* B2 = 0.553101 */
9302 -17246, /* B1 = -1.052673 */
9303 18124, /* B0 = 0.553101 */
9304 7, /* Internal filter scaling */
9305 159, /* Minimum in-band energy threshold */
9306 21, /* 21/32 in-band to broad-band ratio */
9307 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9310 30796, /* A1 = -1.879639 */
9311 -32603, /* A2 = 0.994965 */
9312 -254, /* B2 = -0.007762 */
9313 0, /* B1 = 0.000000 */
9314 254, /* B0 = 0.007762 */
9315 30793, /* A1 = -1.879456 */
9316 -32692, /* A2 = 0.997711 */
9317 18934, /* B2 = 0.577820 */
9318 -17751, /* B1 = -1.083496 */
9319 18934, /* B0 = 0.577820 */
9320 30882, /* A1 = -1.884888 */
9321 -32694, /* A2 = 0.997772 */
9322 1858, /* B2 = 0.056713 */
9323 -1758, /* B1 = -0.107357 */
9324 1858, /* B0 = 0.056713 */
9325 5, /* Internal filter scaling */
9326 159, /* Minimum in-band energy threshold */
9327 21, /* 21/32 in-band to broad-band ratio */
9328 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9331 30641, /* A1 = 1.870239 */
9332 -32458, /* A2 = -0.99057 */
9333 -155, /* B2 = -0.004735 */
9335 155, /* B0 = 0.004735 */
9336 30631, /* A1 = 1.869568 */
9337 -32630, /* A2 = -0.995789 */
9338 11453, /* B2 = 0.349548 */
9339 -10666, /* B1 = -0.651001 */
9340 11453, /* B0 = 0.349548 */
9341 30810, /* A1 = 1.880554 */
9342 -32634, /* A2 = -0.995941 */
9343 12237, /* B2 = 0.373474 */
9344 -11588, /* B1 = -0.707336 */
9345 12237, /* B0 = 0.373474 */
9346 7, /* Internal filter scaling */
9347 159, /* Minimum in-band energy threshold */
9348 21, /* 21/32 in-band to broad-band ratio */
9349 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9352 30367, /* A1 = 1.853455 */
9353 -32147, /* A2 = -0.981079 */
9354 -495, /* B2 = -0.015113 */
9356 495, /* B0 = 0.015113 */
9357 30322, /* A1 = 1.850769 */
9358 -32543, /* A2 = -0.993134 */
9359 10031, /* B2 = 0.306152 */
9360 -9252, /* B1 = -0.564728 */
9361 10031, /* B0 = 0.306152 */
9362 30770, /* A1 = 1.878052 */
9363 -32563, /* A2 = -0.993774 */
9364 22674, /* B2 = 0.691956 */
9365 -21465, /* B1 = -1.31012 */
9366 22674, /* B0 = 0.691956 */
9367 7, /* Internal filter scaling */
9368 159, /* Minimum in-band energy threshold */
9369 21, /* 21/32 in-band to broad-band ratio */
9370 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9373 30709, /* A1 = -1.874329 */
9374 -32603, /* A2 = 0.994965 */
9375 -83, /* B2 = -0.002545 */
9376 0, /* B1 = 0.000000 */
9377 83, /* B0 = 0.002545 */
9378 30704, /* A1 = -1.874084 */
9379 -32692, /* A2 = 0.997711 */
9380 10641, /* B2 = 0.324738 */
9381 -9947, /* B1 = -0.607147 */
9382 10641, /* B0 = 0.324738 */
9383 30796, /* A1 = -1.879639 */
9384 -32694, /* A2 = 0.997772 */
9385 10079, /* B2 = 0.307587 */
9386 9513, /* B1 = 0.580688 */
9387 10079, /* B0 = 0.307587 */
9388 5, /* Internal filter scaling */
9389 159, /* Minimum in-band energy threshold */
9390 21, /* 21/32 in-band to broad-band ratio */
9391 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9394 30664, /* A1 = -1.871643 */
9395 -32603, /* A2 = 0.994965 */
9396 -164, /* B2 = -0.005029 */
9397 0, /* B1 = 0.000000 */
9398 164, /* B0 = 0.005029 */
9399 30661, /* A1 = -1.871399 */
9400 -32692, /* A2 = 0.997711 */
9401 15294, /* B2 = 0.466736 */
9402 -14275, /* B1 = -0.871307 */
9403 15294, /* B0 = 0.466736 */
9404 30751, /* A1 = -1.876953 */
9405 -32694, /* A2 = 0.997772 */
9406 3548, /* B2 = 0.108284 */
9407 -3344, /* B1 = -0.204155 */
9408 3548, /* B0 = 0.108284 */
9409 5, /* Internal filter scaling */
9410 159, /* Minimum in-band energy threshold */
9411 21, /* 21/32 in-band to broad-band ratio */
9412 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9415 30653, /* A1 = -1.870911 */
9416 -32615, /* A2 = 0.995361 */
9417 -209, /* B2 = -0.006382 */
9418 0, /* B1 = 0.000000 */
9419 209, /* B0 = 0.006382 */
9420 30647, /* A1 = -1.870605 */
9421 -32702, /* A2 = 0.997986 */
9422 18971, /* B2 = 0.578979 */
9423 -17716, /* B1 = -1.081299 */
9424 18971, /* B0 = 0.578979 */
9425 30738, /* A1 = -1.876099 */
9426 -32702, /* A2 = 0.998016 */
9427 2967, /* B2 = 0.090561 */
9428 -2793, /* B1 = -0.170502 */
9429 2967, /* B0 = 0.090561 */
9430 5, /* Internal filter scaling */
9431 159, /* Minimum in-band energy threshold */
9432 21, /* 21/32 in-band to broad-band ratio */
9433 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9436 30437, /* A1 = -1.857727 */
9437 -32603, /* A2 = 0.994965 */
9438 -264, /* B2 = -0.008062 */
9439 0, /* B1 = 0.000000 */
9440 264, /* B0 = 0.008062 */
9441 30430, /* A1 = -1.857300 */
9442 -32692, /* A2 = 0.997711 */
9443 21681, /* B2 = 0.661682 */
9444 -20082, /* B1 = -1.225708 */
9445 21681, /* B0 = 0.661682 */
9446 30526, /* A1 = -1.863220 */
9447 -32694, /* A2 = 0.997742 */
9448 1559, /* B2 = 0.047600 */
9449 -1459, /* B1 = -0.089096 */
9450 1559, /* B0 = 0.047600 */
9451 5, /* Internal filter scaling */
9452 159, /* Minimum in-band energy threshold */
9453 21, /* 21/32 in-band to broad-band ratio */
9454 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9457 28975, /* A1 = 1.768494 */
9458 -30955, /* A2 = -0.944672 */
9459 -1026, /* B2 = -0.03133 */
9461 1026, /* B0 = 0.03133 */
9462 28613, /* A1 = 1.746399 */
9463 -32089, /* A2 = -0.979309 */
9464 14214, /* B2 = 0.433807 */
9465 -12202, /* B1 = -0.744812 */
9466 14214, /* B0 = 0.433807 */
9467 30243, /* A1 = 1.845947 */
9468 -32238, /* A2 = -0.983856 */
9469 24825, /* B2 = 0.757629 */
9470 -23402, /* B1 = -1.428345 */
9471 24825, /* B0 = 0.757629 */
9472 7, /* Internal filter scaling */
9473 159, /* Minimum in-band energy threshold */
9474 21, /* 21/32 in-band to broad-band ratio */
9475 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9478 30257, /* A1 = -1.846741 */
9479 -32605, /* A2 = 0.995056 */
9480 -249, /* B2 = -0.007625 */
9481 0, /* B1 = 0.000000 */
9482 249, /* B0 = 0.007625 */
9483 30247, /* A1 = -1.846191 */
9484 -32694, /* A2 = 0.997772 */
9485 18088, /* B2 = 0.552002 */
9486 -16652, /* B1 = -1.016418 */
9487 18088, /* B0 = 0.552002 */
9488 30348, /* A1 = -1.852295 */
9489 -32696, /* A2 = 0.997803 */
9490 2099, /* B2 = 0.064064 */
9491 -1953, /* B1 = -0.119202 */
9492 2099, /* B0 = 0.064064 */
9493 5, /* Internal filter scaling */
9494 159, /* Minimum in-band energy threshold */
9495 21, /* 21/32 in-band to broad-band ratio */
9496 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9499 30202, /* A1 = -1.843431 */
9500 -32624, /* A2 = 0.995622 */
9501 -413, /* B2 = -0.012622 */
9502 0, /* B1 = 0.000000 */
9503 413, /* B0 = 0.012622 */
9504 30191, /* A1 = -1.842721 */
9505 -32714, /* A2 = 0.998364 */
9506 25954, /* B2 = 0.792057 */
9507 -23890, /* B1 = -1.458131 */
9508 25954, /* B0 = 0.792057 */
9509 30296, /* A1 = -1.849172 */
9510 -32715, /* A2 = 0.998397 */
9511 2007, /* B2 = 0.061264 */
9512 -1860, /* B1 = -0.113568 */
9513 2007, /* B0 = 0.061264 */
9514 5, /* Internal filter scaling */
9515 159, /* Minimum in-band energy threshold */
9516 21, /* 21/32 in-band to broad-band ratio */
9517 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9520 30001, /* A1 = -1.831116 */
9521 -32613, /* A2 = 0.995270 */
9522 -155, /* B2 = -0.004750 */
9523 0, /* B1 = 0.000000 */
9524 155, /* B0 = 0.004750 */
9525 29985, /* A1 = -1.830200 */
9526 -32710, /* A2 = 0.998260 */
9527 6584, /* B2 = 0.200928 */
9528 -6018, /* B1 = -0.367355 */
9529 6584, /* B0 = 0.200928 */
9530 30105, /* A1 = -1.837524 */
9531 -32712, /* A2 = 0.998291 */
9532 23812, /* B2 = 0.726685 */
9533 -21936, /* B1 = -1.338928 */
9534 23812, /* B0 = 0.726685 */
9535 5, /* Internal filter scaling */
9536 159, /* Minimum in-band energy threshold */
9537 21, /* 21/32 in-band to broad-band ratio */
9538 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9541 29964, /* A1 = -1.828918 */
9542 -32601, /* A2 = 0.994904 */
9543 -101, /* B2 = -0.003110 */
9544 0, /* B1 = 0.000000 */
9545 101, /* B0 = 0.003110 */
9546 29949, /* A1 = -1.827942 */
9547 -32700, /* A2 = 0.997925 */
9548 11041, /* B2 = 0.336975 */
9549 -10075, /* B1 = -0.614960 */
9550 11041, /* B0 = 0.336975 */
9551 30070, /* A1 = -1.835388 */
9552 -32702, /* A2 = 0.997986 */
9553 16762, /* B2 = 0.511536 */
9554 -15437, /* B1 = -0.942230 */
9555 16762, /* B0 = 0.511536 */
9556 5, /* Internal filter scaling */
9557 159, /* Minimum in-band energy threshold */
9558 21, /* 21/32 in-band to broad-band ratio */
9559 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9562 29936, /* A1 = -1.827209 */
9563 -32584, /* A2 = 0.994415 */
9564 -91, /* B2 = -0.002806 */
9565 0, /* B1 = 0.000000 */
9566 91, /* B0 = 0.002806 */
9567 29921, /* A1 = -1.826233 */
9568 -32688, /* A2 = 0.997559 */
9569 11449, /* B2 = 0.349396 */
9570 -10426, /* B1 = -0.636383 */
9571 11449, /* B0 = 0.349396 */
9572 30045, /* A1 = -1.833862 */
9573 -32688, /* A2 = 0.997589 */
9574 13055, /* B2 = 0.398407 */
9575 -12028, /* B1 = -0.734161 */
9576 13055, /* B0 = 0.398407 */
9577 5, /* Internal filter scaling */
9578 159, /* Minimum in-band energy threshold */
9579 21, /* 21/32 in-band to broad-band ratio */
9580 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9583 28499, /* A1 = 1.739441 */
9584 -31129, /* A2 = -0.949982 */
9585 -849, /* B2 = -0.025922 */
9587 849, /* B0 = 0.025922 */
9588 28128, /* A1 = 1.716797 */
9589 -32130, /* A2 = -0.98056 */
9590 14556, /* B2 = 0.444214 */
9591 -12251, /* B1 = -0.747772 */
9592 14556, /* B0 = 0.444244 */
9593 29667, /* A1 = 1.81073 */
9594 -32244, /* A2 = -0.984039 */
9595 23038, /* B2 = 0.703064 */
9596 -21358, /* B1 = -1.303589 */
9597 23040, /* B0 = 0.703125 */
9598 7, /* Internal filter scaling */
9599 159, /* Minimum in-band energy threshold */
9600 21, /* 21/32 in-band to broad-band ratio */
9601 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9604 29271, /* A1 = -1.786560 */
9605 -32599, /* A2 = 0.994873 */
9606 -490, /* B2 = -0.014957 */
9607 0, /* B1 = 0.000000 */
9608 490, /* B0 = 0.014957 */
9609 29246, /* A1 = -1.785095 */
9610 -32700, /* A2 = 0.997925 */
9611 28961, /* B2 = 0.883850 */
9612 -25796, /* B1 = -1.574463 */
9613 28961, /* B0 = 0.883850 */
9614 29383, /* A1 = -1.793396 */
9615 -32700, /* A2 = 0.997955 */
9616 1299, /* B2 = 0.039650 */
9617 -1169, /* B1 = -0.071396 */
9618 1299, /* B0 = 0.039650 */
9619 5, /* Internal filter scaling */
9620 159, /* Minimum in-band energy threshold */
9621 21, /* 21/32 in-band to broad-band ratio */
9622 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9625 29230, /* A1 = -1.784058 */
9626 -32584, /* A2 = 0.994415 */
9627 -418, /* B2 = -0.012757 */
9628 0, /* B1 = 0.000000 */
9629 418, /* B0 = 0.012757 */
9630 29206, /* A1 = -1.782593 */
9631 -32688, /* A2 = 0.997559 */
9632 36556, /* B2 = 1.115601 */
9633 -32478, /* B1 = -1.982300 */
9634 36556, /* B0 = 1.115601 */
9635 29345, /* A1 = -1.791077 */
9636 -32688, /* A2 = 0.997589 */
9637 897, /* B2 = 0.027397 */
9638 -808, /* B1 = -0.049334 */
9639 897, /* B0 = 0.027397 */
9640 5, /* Internal filter scaling */
9641 159, /* Minimum in-band energy threshold */
9642 21, /* 21/32 in-band to broad-band ratio */
9643 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9646 29116, /* A1 = -1.777100 */
9647 -32603, /* A2 = 0.994965 */
9648 -165, /* B2 = -0.005039 */
9649 0, /* B1 = 0.000000 */
9650 165, /* B0 = 0.005039 */
9651 29089, /* A1 = -1.775452 */
9652 -32708, /* A2 = 0.998199 */
9653 6963, /* B2 = 0.212494 */
9654 -6172, /* B1 = -0.376770 */
9655 6963, /* B0 = 0.212494 */
9656 29237, /* A1 = -1.784485 */
9657 -32710, /* A2 = 0.998230 */
9658 24197, /* B2 = 0.738464 */
9659 -21657, /* B1 = -1.321899 */
9660 24197, /* B0 = 0.738464 */
9661 5, /* Internal filter scaling */
9662 159, /* Minimum in-band energy threshold */
9663 21, /* 21/32 in-band to broad-band ratio */
9664 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9667 28376, /* A1 = -1.731934 */
9668 -32567, /* A2 = 0.993896 */
9669 -363, /* B2 = -0.011102 */
9670 0, /* B1 = 0.000000 */
9671 363, /* B0 = 0.011102 */
9672 28337, /* A1 = -1.729614 */
9673 -32683, /* A2 = 0.997434 */
9674 21766, /* B2 = 0.664246 */
9675 -18761, /* B1 = -1.145081 */
9676 21766, /* B0 = 0.664246 */
9677 28513, /* A1 = -1.740356 */
9678 -32686, /* A2 = 0.997498 */
9679 2509, /* B2 = 0.076584 */
9680 -2196, /* B1 = -0.134041 */
9681 2509, /* B0 = 0.076584 */
9682 5, /* Internal filter scaling */
9683 159, /* Minimum in-band energy threshold */
9684 21, /* 21/32 in-band to broad-band ratio */
9685 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9688 27844, /* A1 = -1.699463 */
9689 -32563, /* A2 = 0.993744 */
9690 -366, /* B2 = -0.011187 */
9691 0, /* B1 = 0.000000 */
9692 366, /* B0 = 0.011187 */
9693 27797, /* A1 = -1.696655 */
9694 -32686, /* A2 = 0.997498 */
9695 22748, /* B2 = 0.694214 */
9696 -19235, /* B1 = -1.174072 */
9697 22748, /* B0 = 0.694214 */
9698 27995, /* A1 = -1.708740 */
9699 -32688, /* A2 = 0.997559 */
9700 2964, /* B2 = 0.090477 */
9701 -2546, /* B1 = -0.155449 */
9702 2964, /* B0 = 0.090477 */
9703 5, /* Internal filter scaling */
9704 159, /* Minimum in-band energy threshold */
9705 21, /* 21/32 in-band to broad-band ratio */
9706 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9709 27297, /* A1 = -1.666077 */
9710 -32551, /* A2 = 0.993408 */
9711 -345, /* B2 = -0.010540 */
9712 0, /* B1 = 0.000000 */
9713 345, /* B0 = 0.010540 */
9714 27240, /* A1 = -1.662598 */
9715 -32683, /* A2 = 0.997406 */
9716 22560, /* B2 = 0.688477 */
9717 -18688, /* B1 = -1.140625 */
9718 22560, /* B0 = 0.688477 */
9719 27461, /* A1 = -1.676147 */
9720 -32684, /* A2 = 0.997467 */
9721 3541, /* B2 = 0.108086 */
9722 -2985, /* B1 = -0.182220 */
9723 3541, /* B0 = 0.108086 */
9724 5, /* Internal filter scaling */
9725 159, /* Minimum in-band energy threshold */
9726 21, /* 21/32 in-band to broad-band ratio */
9727 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9730 27155, /* A1 = -1.657410 */
9731 -32551, /* A2 = 0.993408 */
9732 -462, /* B2 = -0.014117 */
9733 0, /* B1 = 0.000000 */
9734 462, /* B0 = 0.014117 */
9735 27097, /* A1 = -1.653870 */
9736 -32683, /* A2 = 0.997406 */
9737 32495, /* B2 = 0.991699 */
9738 -26776, /* B1 = -1.634338 */
9739 32495, /* B0 = 0.991699 */
9740 27321, /* A1 = -1.667542 */
9741 -32684, /* A2 = 0.997467 */
9742 1835, /* B2 = 0.056007 */
9743 -1539, /* B1 = -0.093948 */
9744 1835, /* B0 = 0.056007 */
9745 5, /* Internal filter scaling */
9746 159, /* Minimum in-band energy threshold */
9747 21, /* 21/32 in-band to broad-band ratio */
9748 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9751 19298, /* A1 = 1.177917 */
9752 -24471, /* A2 = -0.746796 */
9753 -4152, /* B2 = -0.126709 */
9755 4152, /* B0 = 0.126709 */
9756 12902, /* A1 = 0.787476 */
9757 -29091, /* A2 = -0.887817 */
9758 12491, /* B2 = 0.38121 */
9759 -1794, /* B1 = -0.109528 */
9760 12494, /* B0 = 0.381317 */
9761 26291, /* A1 = 1.604736 */
9762 -30470, /* A2 = -0.929901 */
9763 28859, /* B2 = 0.880737 */
9764 -26084, /* B1 = -1.592102 */
9765 28861, /* B0 = 0.880798 */
9766 7, /* Internal filter scaling */
9767 159, /* Minimum in-band energy threshold */
9768 21, /* 21/32 in-band to broad-band ratio */
9769 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9772 26867, /* A1 = -1.639832 */
9773 -32551, /* A2 = 0.993408 */
9774 -123, /* B2 = -0.003755 */
9775 0, /* B1 = 0.000000 */
9776 123, /* B0 = 0.003755 */
9777 26805, /* A1 = -1.636108 */
9778 -32683, /* A2 = 0.997406 */
9779 17297, /* B2 = 0.527863 */
9780 -14096, /* B1 = -0.860382 */
9781 17297, /* B0 = 0.527863 */
9782 27034, /* A1 = -1.650085 */
9783 -32684, /* A2 = 0.997467 */
9784 12958, /* B2 = 0.395477 */
9785 -10756, /* B1 = -0.656525 */
9786 12958, /* B0 = 0.395477 */
9787 5, /* Internal filter scaling */
9788 159, /* Minimum in-band energy threshold */
9789 21, /* 21/32 in-band to broad-band ratio */
9790 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9793 26413, /* A1 = -1.612122 */
9794 -32547, /* A2 = 0.993286 */
9795 -223, /* B2 = -0.006825 */
9796 0, /* B1 = 0.000000 */
9797 223, /* B0 = 0.006825 */
9798 26342, /* A1 = -1.607849 */
9799 -32686, /* A2 = 0.997498 */
9800 6391, /* B2 = 0.195053 */
9801 -5120, /* B1 = -0.312531 */
9802 6391, /* B0 = 0.195053 */
9803 26593, /* A1 = -1.623108 */
9804 -32688, /* A2 = 0.997559 */
9805 23681, /* B2 = 0.722717 */
9806 -19328, /* B1 = -1.179688 */
9807 23681, /* B0 = 0.722717 */
9808 5, /* Internal filter scaling */
9809 159, /* Minimum in-band energy threshold */
9810 21, /* 21/32 in-band to broad-band ratio */
9811 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9814 26168, /* A1 = -1.597209 */
9815 -32528, /* A2 = 0.992706 */
9816 -235, /* B2 = -0.007182 */
9817 0, /* B1 = 0.000000 */
9818 235, /* B0 = 0.007182 */
9819 26092, /* A1 = -1.592590 */
9820 -32675, /* A2 = 0.997192 */
9821 20823, /* B2 = 0.635498 */
9822 -16510, /* B1 = -1.007751 */
9823 20823, /* B0 = 0.635498 */
9824 26363, /* A1 = -1.609070 */
9825 -32677, /* A2 = 0.997253 */
9826 6739, /* B2 = 0.205688 */
9827 -5459, /* B1 = -0.333206 */
9828 6739, /* B0 = 0.205688 */
9829 5, /* Internal filter scaling */
9830 159, /* Minimum in-band energy threshold */
9831 21, /* 21/32 in-band to broad-band ratio */
9832 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9835 25641, /* A1 = -1.565063 */
9836 -32536, /* A2 = 0.992950 */
9837 -121, /* B2 = -0.003707 */
9838 0, /* B1 = 0.000000 */
9839 121, /* B0 = 0.003707 */
9840 25560, /* A1 = -1.560059 */
9841 -32684, /* A2 = 0.997437 */
9842 18341, /* B2 = 0.559753 */
9843 -14252, /* B1 = -0.869904 */
9844 18341, /* B0 = 0.559753 */
9845 25837, /* A1 = -1.577026 */
9846 -32684, /* A2 = 0.997467 */
9847 16679, /* B2 = 0.509003 */
9848 -13232, /* B1 = -0.807648 */
9849 16679, /* B0 = 0.509003 */
9850 5, /* Internal filter scaling */
9851 159, /* Minimum in-band energy threshold */
9852 21, /* 21/32 in-band to broad-band ratio */
9853 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9856 16415, /* A1 = 1.001953 */
9857 -23669, /* A2 = -0.722321 */
9858 -4549, /* B2 = -0.138847 */
9860 4549, /* B0 = 0.138847 */
9861 8456, /* A1 = 0.516174 */
9862 -28996, /* A2 = -0.884918 */
9863 13753, /* B2 = 0.419724 */
9864 -12, /* B1 = -0.000763 */
9865 13757, /* B0 = 0.419846 */
9866 24632, /* A1 = 1.503418 */
9867 -30271, /* A2 = -0.923828 */
9868 29070, /* B2 = 0.887146 */
9869 -25265, /* B1 = -1.542114 */
9870 29073, /* B0 = 0.887268 */
9871 7, /* Internal filter scaling */
9872 159, /* Minimum in-band energy threshold */
9873 21, /* 21/32 in-band to broad-band ratio */
9874 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9877 24806, /* A1 = -1.514099 */
9878 -32501, /* A2 = 0.991852 */
9879 -326, /* B2 = -0.009969 */
9880 0, /* B1 = 0.000000 */
9881 326, /* B0 = 0.009969 */
9882 24709, /* A1 = -1.508118 */
9883 -32659, /* A2 = 0.996674 */
9884 20277, /* B2 = 0.618835 */
9885 -15182, /* B1 = -0.926636 */
9886 20277, /* B0 = 0.618835 */
9887 25022, /* A1 = -1.527222 */
9888 -32661, /* A2 = 0.996735 */
9889 4320, /* B2 = 0.131836 */
9890 -3331, /* B1 = -0.203339 */
9891 4320, /* B0 = 0.131836 */
9892 5, /* Internal filter scaling */
9893 159, /* Minimum in-band energy threshold */
9894 21, /* 21/32 in-band to broad-band ratio */
9895 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9898 19776, /* A1 = 1.207092 */
9899 -27437, /* A2 = -0.837341 */
9900 -2666, /* B2 = -0.081371 */
9902 2666, /* B0 = 0.081371 */
9903 16302, /* A1 = 0.995026 */
9904 -30354, /* A2 = -0.926361 */
9905 10389, /* B2 = 0.317062 */
9906 -3327, /* B1 = -0.203064 */
9907 10389, /* B0 = 0.317062 */
9908 24299, /* A1 = 1.483154 */
9909 -30930, /* A2 = -0.943909 */
9910 25016, /* B2 = 0.763428 */
9911 -21171, /* B1 = -1.292236 */
9912 25016, /* B0 = 0.763428 */
9913 7, /* Internal filter scaling */
9914 159, /* Minimum in-band energy threshold */
9915 21, /* 21/32 in-band to broad-band ratio */
9916 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9919 20554, /* A1 = 1.254517 */
9920 -28764, /* A2 = -0.877838 */
9921 -2048, /* B2 = -0.062515 */
9923 2048, /* B0 = 0.062515 */
9924 18209, /* A1 = 1.11145 */
9925 -30951, /* A2 = -0.94458 */
9926 9390, /* B2 = 0.286575 */
9927 -3955, /* B1 = -0.241455 */
9928 9390, /* B0 = 0.286575 */
9929 23902, /* A1 = 1.458923 */
9930 -31286, /* A2 = -0.954803 */
9931 23252, /* B2 = 0.709595 */
9932 -19132, /* B1 = -1.167725 */
9933 23252, /* B0 = 0.709595 */
9934 7, /* Internal filter scaling */
9935 159, /* Minimum in-band energy threshold */
9936 21, /* 21/32 in-band to broad-band ratio */
9937 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9940 17543, /* A1 = 1.07074 */
9941 -26220, /* A2 = -0.800201 */
9942 -3298, /* B2 = -0.100647 */
9944 3298, /* B0 = 0.100647 */
9945 12423, /* A1 = 0.75827 */
9946 -30036, /* A2 = -0.916626 */
9947 12651, /* B2 = 0.386078 */
9948 -2444, /* B1 = -0.14917 */
9949 12653, /* B0 = 0.386154 */
9950 23518, /* A1 = 1.435425 */
9951 -30745, /* A2 = -0.938293 */
9952 27282, /* B2 = 0.832581 */
9953 -22529, /* B1 = -1.375122 */
9954 27286, /* B0 = 0.832703 */
9955 7, /* Internal filter scaling */
9956 159, /* Minimum in-band energy threshold */
9957 21, /* 21/32 in-band to broad-band ratio */
9958 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9961 24104, /* A1 = -1.471252 */
9962 -32507, /* A2 = 0.992065 */
9963 -351, /* B2 = -0.010722 */
9964 0, /* B1 = 0.000000 */
9965 351, /* B0 = 0.010722 */
9966 23996, /* A1 = -1.464600 */
9967 -32671, /* A2 = 0.997040 */
9968 22848, /* B2 = 0.697266 */
9969 -16639, /* B1 = -1.015564 */
9970 22848, /* B0 = 0.697266 */
9971 24332, /* A1 = -1.485168 */
9972 -32673, /* A2 = 0.997101 */
9973 4906, /* B2 = 0.149727 */
9974 -3672, /* B1 = -0.224174 */
9975 4906, /* B0 = 0.149727 */
9976 5, /* Internal filter scaling */
9977 159, /* Minimum in-band energy threshold */
9978 21, /* 21/32 in-band to broad-band ratio */
9979 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9982 23967, /* A1 = -1.462830 */
9983 -32507, /* A2 = 0.992065 */
9984 -518, /* B2 = -0.015821 */
9985 0, /* B1 = 0.000000 */
9986 518, /* B0 = 0.015821 */
9987 23856, /* A1 = -1.456055 */
9988 -32671, /* A2 = 0.997040 */
9989 26287, /* B2 = 0.802246 */
9990 -19031, /* B1 = -1.161560 */
9991 26287, /* B0 = 0.802246 */
9992 24195, /* A1 = -1.476746 */
9993 -32673, /* A2 = 0.997101 */
9994 2890, /* B2 = 0.088196 */
9995 -2151, /* B1 = -0.131317 */
9996 2890, /* B0 = 0.088196 */
9997 5, /* Internal filter scaling */
9998 159, /* Minimum in-band energy threshold */
9999 21, /* 21/32 in-band to broad-band ratio */
10000 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10002 { /* f950_1400[] */
10003 18294, /* A1 = 1.116638 */
10004 -26962, /* A2 = -0.822845 */
10005 -2914, /* B2 = -0.088936 */
10007 2914, /* B0 = 0.088936 */
10008 14119, /* A1 = 0.861786 */
10009 -30227, /* A2 = -0.922455 */
10010 11466, /* B2 = 0.349945 */
10011 -2833, /* B1 = -0.172943 */
10012 11466, /* B0 = 0.349945 */
10013 23431, /* A1 = 1.430115 */
10014 -30828, /* A2 = -0.940796 */
10015 25331, /* B2 = 0.773071 */
10016 -20911, /* B1 = -1.276367 */
10017 25331, /* B0 = 0.773071 */
10018 7, /* Internal filter scaling */
10019 159, /* Minimum in-band energy threshold */
10020 21, /* 21/32 in-band to broad-band ratio */
10021 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10024 23521, /* A1 = -1.435608 */
10025 -32489, /* A2 = 0.991516 */
10026 -193, /* B2 = -0.005915 */
10027 0, /* B1 = 0.000000 */
10028 193, /* B0 = 0.005915 */
10029 23404, /* A1 = -1.428467 */
10030 -32655, /* A2 = 0.996582 */
10031 17740, /* B2 = 0.541412 */
10032 -12567, /* B1 = -0.767029 */
10033 17740, /* B0 = 0.541412 */
10034 23753, /* A1 = -1.449829 */
10035 -32657, /* A2 = 0.996613 */
10036 9090, /* B2 = 0.277405 */
10037 -6662, /* B1 = -0.406647 */
10038 9090, /* B0 = 0.277405 */
10039 5, /* Internal filter scaling */
10040 159, /* Minimum in-band energy threshold */
10041 21, /* 21/32 in-band to broad-band ratio */
10042 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10045 23071, /* A1 = -1.408203 */
10046 -32489, /* A2 = 0.991516 */
10047 -293, /* B2 = -0.008965 */
10048 0, /* B1 = 0.000000 */
10049 293, /* B0 = 0.008965 */
10050 22951, /* A1 = -1.400818 */
10051 -32655, /* A2 = 0.996582 */
10052 5689, /* B2 = 0.173645 */
10053 -3951, /* B1 = -0.241150 */
10054 5689, /* B0 = 0.173645 */
10055 23307, /* A1 = -1.422607 */
10056 -32657, /* A2 = 0.996613 */
10057 18692, /* B2 = 0.570435 */
10058 -13447, /* B1 = -0.820770 */
10059 18692, /* B0 = 0.570435 */
10060 5, /* Internal filter scaling */
10061 159, /* Minimum in-band energy threshold */
10062 21, /* 21/32 in-band to broad-band ratio */
10063 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10066 22701, /* A1 = -1.385620 */
10067 -32474, /* A2 = 0.991058 */
10068 -292, /* B2 = -0.008933 */
10069 0, /*163840 , B1 = 10.000000 */
10070 292, /* B0 = 0.008933 */
10071 22564, /* A1 = -1.377258 */
10072 -32655, /* A2 = 0.996552 */
10073 20756, /* B2 = 0.633423 */
10074 -14176, /* B1 = -0.865295 */
10075 20756, /* B0 = 0.633423 */
10076 22960, /* A1 = -1.401428 */
10077 -32657, /* A2 = 0.996613 */
10078 6520, /* B2 = 0.198990 */
10079 -4619, /* B1 = -0.281937 */
10080 6520, /* B0 = 0.198990 */
10081 5, /* Internal filter scaling */
10082 159, /* Minimum in-band energy threshold */
10083 21, /* 21/32 in-band to broad-band ratio */
10084 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10087 22142, /* A1 = -1.351501 */
10088 -32474, /* A2 = 0.991058 */
10089 -147, /* B2 = -0.004493 */
10090 0, /* B1 = 0.000000 */
10091 147, /* B0 = 0.004493 */
10092 22000, /* A1 = -1.342834 */
10093 -32655, /* A2 = 0.996552 */
10094 15379, /* B2 = 0.469360 */
10095 -10237, /* B1 = -0.624847 */
10096 15379, /* B0 = 0.469360 */
10097 22406, /* A1 = -1.367554 */
10098 -32657, /* A2 = 0.996613 */
10099 17491, /* B2 = 0.533783 */
10100 -12096, /* B1 = -0.738312 */
10101 17491, /* B0 = 0.533783 */
10102 5, /* Internal filter scaling */
10103 159, /* Minimum in-band energy threshold */
10104 21, /* 21/32 in-band to broad-band ratio */
10105 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10107 { /* f1100_1750[] */
10108 12973, /* A1 = 0.79184 */
10109 -24916, /* A2 = -0.760376 */
10110 6655, /* B2 = 0.203102 */
10111 367, /* B1 = 0.0224 */
10112 6657, /* B0 = 0.203171 */
10113 5915, /* A1 = 0.361053 */
10114 -29560, /* A2 = -0.90213 */
10115 -7777, /* B2 = -0.23735 */
10117 7777, /* B0 = 0.23735 */
10118 20510, /* A1 = 1.251892 */
10119 -30260, /* A2 = -0.923462 */
10120 26662, /* B2 = 0.81366 */
10121 -20573, /* B1 = -1.255737 */
10122 26668, /* B0 = 0.813843 */
10123 7, /* Internal filter scaling */
10124 159, /* Minimum in-band energy threshold */
10125 21, /* 21/32 in-band to broad-band ratio */
10126 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10129 20392, /* A1 = -1.244629 */
10130 -32460, /* A2 = 0.990601 */
10131 -270, /* B2 = -0.008240 */
10132 0, /* B1 = 0.000000 */
10133 270, /* B0 = 0.008240 */
10134 20218, /* A1 = -1.234009 */
10135 -32655, /* A2 = 0.996582 */
10136 21337, /* B2 = 0.651154 */
10137 -13044, /* B1 = -0.796143 */
10138 21337, /* B0 = 0.651154 */
10139 20684, /* A1 = -1.262512 */
10140 -32657, /* A2 = 0.996643 */
10141 8572, /* B2 = 0.261612 */
10142 -5476, /* B1 = -0.334244 */
10143 8572, /* B0 = 0.261612 */
10144 5, /* Internal filter scaling */
10145 159, /* Minimum in-band energy threshold */
10146 21, /* 21/32 in-band to broad-band ratio */
10147 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10150 19159, /* A1 = -1.169373 */
10151 -32456, /* A2 = 0.990509 */
10152 -335, /* B2 = -0.010252 */
10153 0, /* B1 = 0.000000 */
10154 335, /* B0 = 0.010252 */
10155 18966, /* A1 = -1.157593 */
10156 -32661, /* A2 = 0.996735 */
10157 6802, /* B2 = 0.207588 */
10158 -3900, /* B1 = -0.238098 */
10159 6802, /* B0 = 0.207588 */
10160 19467, /* A1 = -1.188232 */
10161 -32661, /* A2 = 0.996765 */
10162 25035, /* B2 = 0.764008 */
10163 -15049, /* B1 = -0.918579 */
10164 25035, /* B0 = 0.764008 */
10165 5, /* Internal filter scaling */
10166 159, /* Minimum in-band energy threshold */
10167 21, /* 21/32 in-band to broad-band ratio */
10168 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10171 18976, /* A1 = -1.158264 */
10172 -32439, /* A2 = 0.989990 */
10173 -183, /* B2 = -0.005588 */
10174 0, /* B1 = 0.000000 */
10175 183, /* B0 = 0.005588 */
10176 18774, /* A1 = -1.145874 */
10177 -32650, /* A2 = 0.996429 */
10178 15468, /* B2 = 0.472076 */
10179 -8768, /* B1 = -0.535217 */
10180 15468, /* B0 = 0.472076 */
10181 19300, /* A1 = -1.177979 */
10182 -32652, /* A2 = 0.996490 */
10183 19840, /* B2 = 0.605499 */
10184 -11842, /* B1 = -0.722809 */
10185 19840, /* B0 = 0.605499 */
10186 5, /* Internal filter scaling */
10187 159, /* Minimum in-band energy threshold */
10188 21, /* 21/32 in-band to broad-band ratio */
10189 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10192 16357, /* A1 = -0.998413 */
10193 -32368, /* A2 = 0.987793 */
10194 -217, /* B2 = -0.006652 */
10195 0, /* B1 = 0.000000 */
10196 217, /* B0 = 0.006652 */
10197 16107, /* A1 = -0.983126 */
10198 -32601, /* A2 = 0.994904 */
10199 11602, /* B2 = 0.354065 */
10200 -5555, /* B1 = -0.339111 */
10201 11602, /* B0 = 0.354065 */
10202 16722, /* A1 = -1.020630 */
10203 -32603, /* A2 = 0.994965 */
10204 15574, /* B2 = 0.475311 */
10205 -8176, /* B1 = -0.499069 */
10206 15574, /* B0 = 0.475311 */
10207 5, /* Internal filter scaling */
10208 159, /* Minimum in-band energy threshold */
10209 21, /* 21/32 in-band to broad-band ratio */
10210 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10213 16234, /* A1 = -0.990875 */
10214 32404, /* A2 = -0.988922 */
10215 -193, /* B2 = -0.005908 */
10216 0, /* B1 = 0.000000 */
10217 193, /* B0 = 0.005908 */
10218 15986, /* A1 = -0.975769 */
10219 -32632, /* A2 = 0.995880 */
10220 18051, /* B2 = 0.550903 */
10221 -8658, /* B1 = -0.528473 */
10222 18051, /* B0 = 0.550903 */
10223 16591, /* A1 = -1.012695 */
10224 -32634, /* A2 = 0.995941 */
10225 15736, /* B2 = 0.480240 */
10226 -8125, /* B1 = -0.495926 */
10227 15736, /* B0 = 0.480240 */
10228 5, /* Internal filter scaling */
10229 159, /* Minimum in-band energy threshold */
10230 21, /* 21/32 in-band to broad-band ratio */
10231 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10234 15564, /* A1 = -0.949982 */
10235 -32404, /* A2 = 0.988922 */
10236 -269, /* B2 = -0.008216 */
10237 0, /* B1 = 0.000000 */
10238 269, /* B0 = 0.008216 */
10239 15310, /* A1 = -0.934479 */
10240 -32632, /* A2 = 0.995880 */
10241 10815, /* B2 = 0.330063 */
10242 -4962, /* B1 = -0.302887 */
10243 10815, /* B0 = 0.330063 */
10244 15924, /* A1 = -0.971924 */
10245 -32634, /* A2 = 0.995941 */
10246 18880, /* B2 = 0.576172 */
10247 -9364, /* B1 = -0.571594 */
10248 18880, /* B0 = 0.576172 */
10249 5, /* Internal filter scaling */
10250 159, /* Minimum in-band energy threshold */
10251 21, /* 21/32 in-band to broad-band ratio */
10252 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10255 15247, /* A1 = -0.930603 */
10256 -32397, /* A2 = 0.988708 */
10257 -244, /* B2 = -0.007451 */
10258 0, /* B1 = 0.000000 */
10259 244, /* B0 = 0.007451 */
10260 14989, /* A1 = -0.914886 */
10261 -32627, /* A2 = 0.995697 */
10262 18961, /* B2 = 0.578644 */
10263 -8498, /* B1 = -0.518707 */
10264 18961, /* B0 = 0.578644 */
10265 15608, /* A1 = -0.952667 */
10266 -32628, /* A2 = 0.995758 */
10267 11145, /* B2 = 0.340134 */
10268 -5430, /* B1 = -0.331467 */
10269 11145, /* B0 = 0.340134 */
10270 5, /* Internal filter scaling */
10271 159, /* Minimum in-band energy threshold */
10272 21, /* 21/32 in-band to broad-band ratio */
10273 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10276 14780, /* A1 = -0.902130 */
10277 -32393, /* A2 = 0.988586 */
10278 -396, /* B2 = -0.012086 */
10279 0, /* B1 = 0.000000 */
10280 396, /* B0 = 0.012086 */
10281 14510, /* A1 = -0.885651 */
10282 -32630, /* A2 = 0.995819 */
10283 6326, /* B2 = 0.193069 */
10284 -2747, /* B1 = -0.167671 */
10285 6326, /* B0 = 0.193069 */
10286 15154, /* A1 = -0.924957 */
10287 -32632, /* A2 = 0.995850 */
10288 23235, /* B2 = 0.709076 */
10289 -10983, /* B1 = -0.670380 */
10290 23235, /* B0 = 0.709076 */
10291 5, /* Internal filter scaling */
10292 159, /* Minimum in-band energy threshold */
10293 21, /* 21/32 in-band to broad-band ratio */
10294 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10297 13005, /* A1 = -0.793793 */
10298 -32368, /* A2 = 0.987823 */
10299 -500, /* B2 = -0.015265 */
10300 0, /* B1 = 0.000000 */
10301 500, /* B0 = 0.015265 */
10302 12708, /* A1 = -0.775665 */
10303 -32615, /* A2 = 0.995331 */
10304 11420, /* B2 = 0.348526 */
10305 -4306, /* B1 = -0.262833 */
10306 11420, /* B0 = 0.348526 */
10307 13397, /* A1 = -0.817688 */
10308 -32615, /* A2 = 0.995361 */
10309 9454, /* B2 = 0.288528 */
10310 -3981, /* B1 = -0.243027 */
10311 9454, /* B0 = 0.288528 */
10312 5, /* Internal filter scaling */
10313 159, /* Minimum in-band energy threshold */
10314 21, /* 21/32 in-band to broad-band ratio */
10315 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10318 10046, /* A1 = -0.613190 */
10319 -32331, /* A2 = 0.986694 */
10320 -455, /* B2 = -0.013915 */
10321 0, /* B1 = 0.000000 */
10322 455, /* B0 = 0.013915 */
10323 9694, /* A1 = -0.591705 */
10324 -32601, /* A2 = 0.994934 */
10325 6023, /* B2 = 0.183815 */
10326 -1708, /* B1 = -0.104279 */
10327 6023, /* B0 = 0.183815 */
10328 10478, /* A1 = -0.639587 */
10329 -32603, /* A2 = 0.994965 */
10330 22031, /* B2 = 0.672333 */
10331 -7342, /* B1 = -0.448151 */
10332 22031, /* B0 = 0.672333 */
10333 5, /* Internal filter scaling */
10334 159, /* Minimum in-band energy threshold */
10335 21, /* 21/32 in-band to broad-band ratio */
10336 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10338 { /* f1633_1638[] */
10339 9181, /* A1 = 0.560394 */
10340 -32256, /* A2 = -0.984375 */
10341 -556, /* B2 = -0.016975 */
10343 556, /* B0 = 0.016975 */
10344 8757, /* A1 = 0.534515 */
10345 -32574, /* A2 = -0.99408 */
10346 8443, /* B2 = 0.25769 */
10347 -2135, /* B1 = -0.130341 */
10348 8443, /* B0 = 0.25769 */
10349 9691, /* A1 = 0.591522 */
10350 -32574, /* A2 = -0.99411 */
10351 15446, /* B2 = 0.471375 */
10352 -4809, /* B1 = -0.293579 */
10353 15446, /* B0 = 0.471375 */
10354 7, /* Internal filter scaling */
10355 159, /* Minimum in-band energy threshold */
10356 21, /* 21/32 in-band to broad-band ratio */
10357 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10360 5076, /* A1 = -0.309875 */
10361 -32304, /* A2 = 0.985840 */
10362 -508, /* B2 = -0.015503 */
10363 0, /* B1 = 0.000000 */
10364 508, /* B0 = 0.015503 */
10365 4646, /* A1 = -0.283600 */
10366 -32605, /* A2 = 0.995026 */
10367 6742, /* B2 = 0.205780 */
10368 -878, /* B1 = -0.053635 */
10369 6742, /* B0 = 0.205780 */
10370 5552, /* A1 = -0.338928 */
10371 -32605, /* A2 = 0.995056 */
10372 23667, /* B2 = 0.722260 */
10373 -4297, /* B1 = -0.262329 */
10374 23667, /* B0 = 0.722260 */
10375 5, /* Internal filter scaling */
10376 159, /* Minimum in-band energy threshold */
10377 21, /* 21/32 in-band to broad-band ratio */
10378 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10381 3569, /* A1 = -0.217865 */
10382 -32292, /* A2 = 0.985504 */
10383 -239, /* B2 = -0.007322 */
10384 0, /* B1 = 0.000000 */
10385 239, /* B0 = 0.007322 */
10386 3117, /* A1 = -0.190277 */
10387 -32603, /* A2 = 0.994965 */
10388 18658, /* B2 = 0.569427 */
10389 -1557, /* B1 = -0.095032 */
10390 18658, /* B0 = 0.569427 */
10391 4054, /* A1 = -0.247437 */
10392 -32603, /* A2 = 0.994965 */
10393 18886, /* B2 = 0.576385 */
10394 -2566, /* B1 = -0.156647 */
10395 18886, /* B0 = 0.576385 */
10396 5, /* Internal filter scaling */
10397 159, /* Minimum in-band energy threshold */
10398 21, /* 21/32 in-band to broad-band ratio */
10399 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10402 static int ixj_init_filter(IXJ
*j
, IXJ_FILTER
* jf
)
10404 unsigned short cmd
;
10407 if (jf
->filter
> 3) {
10410 if (ixj_WriteDSPCommand(0x5154 + jf
->filter
, j
)) /* Select Filter */
10414 if (ixj_WriteDSPCommand(0x5152, j
)) /* Disable Filter */
10420 if (ixj_WriteDSPCommand(0x5153, j
)) /* Enable Filter */
10423 /* Select the filter (f0 - f3) to use. */
10424 if (ixj_WriteDSPCommand(0x5154 + jf
->filter
, j
))
10427 if (jf
->freq
< 12 && jf
->freq
> 3) {
10428 /* Select the frequency for the selected filter. */
10429 if (ixj_WriteDSPCommand(0x5170 + jf
->freq
, j
))
10431 } else if (jf
->freq
> 11) {
10432 /* We need to load a programmable filter set for undefined */
10433 /* frequencies. So we will point the filter to a programmable set. */
10434 /* Since there are only 4 filters and 4 programmable sets, we will */
10435 /* just point the filter to the same number set and program it for the */
10436 /* frequency we want. */
10437 if (ixj_WriteDSPCommand(0x5170 + jf
->filter
, j
))
10439 if (j
->ver
.low
!= 0x12) {
10446 if (ixj_WriteDSPCommand(cmd
, j
))
10448 for (cnt
= 0; cnt
< max
; cnt
++) {
10449 if (ixj_WriteDSPCommand(tone_table
[jf
->freq
- 12][cnt
], j
))
10453 j
->filter_en
[jf
->filter
] = jf
->enable
;
10457 static int ixj_init_filter_raw(IXJ
*j
, IXJ_FILTER_RAW
* jfr
)
10459 unsigned short cmd
;
10461 if (jfr
->filter
> 3) {
10464 if (ixj_WriteDSPCommand(0x5154 + jfr
->filter
, j
)) /* Select Filter */
10467 if (!jfr
->enable
) {
10468 if (ixj_WriteDSPCommand(0x5152, j
)) /* Disable Filter */
10473 if (ixj_WriteDSPCommand(0x5153, j
)) /* Enable Filter */
10475 /* Select the filter (f0 - f3) to use. */
10476 if (ixj_WriteDSPCommand(0x5154 + jfr
->filter
, j
))
10479 /* We need to load a programmable filter set for undefined */
10480 /* frequencies. So we will point the filter to a programmable set. */
10481 /* Since there are only 4 filters and 4 programmable sets, we will */
10482 /* just point the filter to the same number set and program it for the */
10483 /* frequency we want. */
10484 if (ixj_WriteDSPCommand(0x5170 + jfr
->filter
, j
))
10486 if (j
->ver
.low
!= 0x12) {
10493 if (ixj_WriteDSPCommand(cmd
, j
))
10495 for (cnt
= 0; cnt
< max
; cnt
++) {
10496 if (ixj_WriteDSPCommand(jfr
->coeff
[cnt
], j
))
10499 j
->filter_en
[jfr
->filter
] = jfr
->enable
;
10503 static int ixj_init_tone(IXJ
*j
, IXJ_TONE
* ti
)
10506 unsigned short data
;
10519 if(ti
->tone_index
> 12 && ti
->tone_index
< 28)
10521 if (ixj_WriteDSPCommand(0x6800 + ti
->tone_index
, j
))
10523 if (ixj_WriteDSPCommand(0x6000 + (ti
->gain1
<< 4) + ti
->gain0
, j
))
10526 if (ixj_WriteDSPCommand(data
, j
))
10529 if (ixj_WriteDSPCommand(data
, j
))