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 ***************************************************************************/
45 * Revision 4.8 2003/07/09 19:39:00 Daniele Bellucci
46 * Audit some copy_*_user and minor cleanup.
48 * Revision 4.7 2001/08/13 06:19:33 craigs
49 * Added additional changes from Alan Cox and John Anderson for
50 * 2.2 to 2.4 cleanup and bounds checking
52 * Revision 4.6 2001/08/13 01:05:05 craigs
53 * Really fixed PHONE_QUERY_CODEC problem this time
55 * Revision 4.5 2001/08/13 00:11:03 craigs
56 * Fixed problem in handling of PHONE_QUERY_CODEC, thanks to Shane Anderson
58 * Revision 4.4 2001/08/07 07:58:12 craigs
59 * Changed back to three digit version numbers
60 * Added tagbuild target to allow automatic and easy tagging of versions
62 * Revision 4.3 2001/08/07 07:24:47 craigs
63 * Added ixj-ver.h to allow easy configuration management of driver
64 * Added display of version number in /prox/ixj
66 * Revision 4.2 2001/08/06 07:07:19 craigs
67 * Reverted IXJCTL_DSP_TYPE and IXJCTL_DSP_VERSION files to original
68 * behaviour of returning int rather than short *
70 * Revision 4.1 2001/08/05 00:17:37 craigs
71 * More changes for correct PCMCIA installation
72 * Start of changes for backward Linux compatibility
74 * Revision 4.0 2001/08/04 12:33:12 craigs
75 * New version using GNU autoconf
77 * Revision 3.105 2001/07/20 23:14:32 eokerson
78 * More work on CallerID generation when using ring cadences.
80 * Revision 3.104 2001/07/06 01:33:55 eokerson
81 * Some bugfixes from Robert Vojta <vojta@ipex.cz> and a few mods to the Makefile.
83 * Revision 3.103 2001/07/05 19:20:16 eokerson
85 * Changed mic gain to 30dB on Internet LineJACK mic/speaker port.
87 * Revision 3.102 2001/07/03 23:51:21 eokerson
88 * Un-mute mic on Internet LineJACK when in speakerphone mode.
90 * Revision 3.101 2001/07/02 19:26:56 eokerson
91 * Removed initialiazation of ixjdebug and ixj_convert_loaded so they will go in the .bss instead of the .data
93 * Revision 3.100 2001/07/02 19:18:27 eokerson
94 * Changed driver to make dynamic allocation possible. We now pass IXJ * between functions instead of array indexes.
95 * Fixed the way the POTS and PSTN ports interact during a PSTN call to allow local answering.
96 * Fixed speaker mode on Internet LineJACK.
98 * Revision 3.99 2001/05/09 14:11:16 eokerson
99 * Fixed kmalloc error in ixj_build_filter_cadence. Thanks David Chan <cat@waulogy.stanford.edu>.
101 * Revision 3.98 2001/05/08 19:55:33 eokerson
102 * Fixed POTS hookstate detection while it is connected to PSTN port.
104 * Revision 3.97 2001/05/08 00:01:04 eokerson
105 * Fixed kernel oops when sending caller ID data.
107 * Revision 3.96 2001/05/04 23:09:30 eokerson
108 * Now uses one kernel timer for each card, instead of one for the entire driver.
110 * Revision 3.95 2001/04/25 22:06:47 eokerson
111 * Fixed squawking at beginning of some G.723.1 calls.
113 * Revision 3.94 2001/04/03 23:42:00 eokerson
114 * Added linear volume ioctls
115 * Added raw filter load ioctl
117 * Revision 3.93 2001/02/27 01:00:06 eokerson
118 * Fixed blocking in CallerID.
119 * Reduced size of ixj structure for smaller driver footprint.
121 * Revision 3.92 2001/02/20 22:02:59 eokerson
122 * Fixed isapnp and pcmcia module compatibility for 2.4.x kernels.
123 * Improved PSTN ring detection.
124 * Fixed wink generation on POTS ports.
126 * Revision 3.91 2001/02/13 00:55:44 eokerson
127 * Turn AEC back on after changing frame sizes.
129 * Revision 3.90 2001/02/12 16:42:00 eokerson
130 * Added ALAW codec, thanks to Fabio Ferrari for the table based converters to make ALAW from ULAW.
132 * Revision 3.89 2001/02/12 15:41:16 eokerson
133 * Fix from Artis Kugevics - Tone gains were not being set correctly.
135 * Revision 3.88 2001/02/05 23:25:42 eokerson
136 * Fixed lockup bugs with deregister.
138 * Revision 3.87 2001/01/29 21:00:39 eokerson
139 * Fix from Fabio Ferrari <fabio.ferrari@digitro.com.br> to properly handle EAGAIN and EINTR during non-blocking write.
140 * Updated copyright date.
142 * Revision 3.86 2001/01/23 23:53:46 eokerson
143 * Fixes to G.729 compatibility.
145 * Revision 3.85 2001/01/23 21:30:36 eokerson
146 * Added verbage about cards supported.
147 * Removed commands that put the card in low power mode at some times that it should not be in low power mode.
149 * Revision 3.84 2001/01/22 23:32:10 eokerson
150 * Some bugfixes from David Huggins-Daines, <dhd@cepstral.com> and other cleanups.
152 * Revision 3.83 2001/01/19 14:51:41 eokerson
153 * Fixed ixj_WriteDSPCommand to decrement usage counter when command fails.
155 * Revision 3.82 2001/01/19 00:34:49 eokerson
156 * Added verbosity to write overlap errors.
158 * Revision 3.81 2001/01/18 23:56:54 eokerson
159 * Fixed PSTN line test functions.
161 * Revision 3.80 2001/01/18 22:29:27 eokerson
162 * Updated AEC/AGC values for different cards.
164 * Revision 3.79 2001/01/17 02:58:54 eokerson
165 * Fixed AEC reset after Caller ID.
166 * Fixed Codec lockup after Caller ID on Call Waiting when not using 30ms frames.
168 * Revision 3.78 2001/01/16 19:43:09 eokerson
169 * Added support for Linux 2.4.x kernels.
171 * Revision 3.77 2001/01/09 04:00:52 eokerson
172 * Linetest will now test the line, even if it has previously succeded.
174 * Revision 3.76 2001/01/08 19:27:00 eokerson
175 * Fixed problem with standard cable on Internet PhoneCARD.
177 * Revision 3.75 2000/12/22 16:52:14 eokerson
178 * Modified to allow hookstate detection on the POTS port when the PSTN port is selected.
180 * Revision 3.74 2000/12/08 22:41:50 eokerson
181 * Added capability for G729B.
183 * Revision 3.73 2000/12/07 23:35:16 eokerson
184 * Added capability to have different ring pattern before CallerID data.
185 * Added hookstate checks in CallerID routines to stop FSK.
187 * Revision 3.72 2000/12/06 19:31:31 eokerson
188 * Modified signal behavior to only send one signal per event.
190 * Revision 3.71 2000/12/06 03:23:08 eokerson
191 * Fixed CallerID on Call Waiting.
193 * Revision 3.70 2000/12/04 21:29:37 eokerson
194 * Added checking to Smart Cable gain functions.
196 * Revision 3.69 2000/12/04 21:05:20 eokerson
197 * Changed ixjdebug levels.
198 * Added ioctls to change gains in Internet Phone CARD Smart Cable.
200 * Revision 3.68 2000/12/04 00:17:21 craigs
201 * Changed mixer voice gain to +6dB rather than 0dB
203 * Revision 3.67 2000/11/30 21:25:51 eokerson
204 * Fixed write signal errors.
206 * Revision 3.66 2000/11/29 22:42:44 eokerson
207 * Fixed PSTN ring detect problems.
209 * Revision 3.65 2000/11/29 07:31:55 craigs
210 * Added new 425Hz filter co-efficients
211 * Added card-specific DTMF prescaler initialisation
213 * Revision 3.64 2000/11/28 14:03:32 craigs
214 * Changed certain mixer initialisations to be 0dB rather than 12dB
215 * Added additional information to /proc/ixj
217 * Revision 3.63 2000/11/28 11:38:41 craigs
218 * Added display of AEC modes in AUTO and AGC mode
220 * Revision 3.62 2000/11/28 04:05:44 eokerson
221 * Improved PSTN ring detection routine.
223 * Revision 3.61 2000/11/27 21:53:12 eokerson
224 * Fixed flash detection.
226 * Revision 3.60 2000/11/27 15:57:29 eokerson
227 * More work on G.729 load routines.
229 * Revision 3.59 2000/11/25 21:55:12 eokerson
230 * Fixed errors in G.729 load routine.
232 * Revision 3.58 2000/11/25 04:08:29 eokerson
233 * Added board locks around G.729 and TS85 load routines.
235 * Revision 3.57 2000/11/24 05:35:17 craigs
236 * Added ability to retrieve mixer values on LineJACK
237 * Added complete initialisation of all mixer values at startup
238 * Fixed spelling mistake
240 * Revision 3.56 2000/11/23 02:52:11 robertj
241 * Added cvs change log keyword.
242 * Fixed bug in capabilities list when using G.729 module.
248 #define PERFMON_STATS
252 #include <linux/module.h>
254 #include <linux/init.h>
255 #include <linux/sched.h>
256 #include <linux/kernel.h> /* printk() */
257 #include <linux/fs.h> /* everything... */
258 #include <linux/errno.h> /* error codes */
259 #include <linux/slab.h>
260 #include <linux/mutex.h>
261 #include <linux/mm.h>
262 #include <linux/ioport.h>
263 #include <linux/interrupt.h>
264 #include <linux/proc_fs.h>
265 #include <linux/poll.h>
266 #include <linux/timer.h>
267 #include <linux/delay.h>
268 #include <linux/pci.h>
271 #include <asm/uaccess.h>
273 #include <linux/isapnp.h>
277 #define TYPE(inode) (iminor(inode) >> 4)
278 #define NUM(inode) (iminor(inode) & 0xf)
280 static DEFINE_MUTEX(ixj_mutex
);
282 static int hertz
= HZ
;
283 static int samplerate
= 100;
285 module_param(ixjdebug
, int, 0);
287 static struct pci_device_id ixj_pci_tbl
[] __devinitdata
= {
288 { PCI_VENDOR_ID_QUICKNET
, PCI_DEVICE_ID_QUICKNET_XJ
,
289 PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, 0},
293 MODULE_DEVICE_TABLE(pci
, ixj_pci_tbl
);
295 /************************************************************************
297 * ixjdebug meanings are now bit mapped instead of level based
298 * Values can be or'ed together to turn on multiple messages
300 * bit 0 (0x0001) = any failure
301 * bit 1 (0x0002) = general messages
302 * bit 2 (0x0004) = POTS ringing related
303 * bit 3 (0x0008) = PSTN events
304 * bit 4 (0x0010) = PSTN Cadence state details
305 * bit 5 (0x0020) = Tone detection triggers
306 * bit 6 (0x0040) = Tone detection cadence details
307 * bit 7 (0x0080) = ioctl tracking
308 * bit 8 (0x0100) = signal tracking
309 * bit 9 (0x0200) = CallerID generation details
311 ************************************************************************/
315 static IXJ
*ixj
[IXJMAX
];
316 #define get_ixj(b) ixj[(b)]
319 * Allocate a free IXJ device
322 static IXJ
*ixj_alloc()
324 for(cnt
=0; cnt
<IXJMAX
; cnt
++)
326 if(ixj
[cnt
] == NULL
|| !ixj
[cnt
]->DSPbase
)
328 j
= kmalloc(sizeof(IXJ
), GFP_KERNEL
);
338 static void ixj_fsk_free(IXJ
*j
)
344 static void ixj_fsk_alloc(IXJ
*j
)
347 j
->fskdata
= kmalloc(8000, GFP_KERNEL
);
349 if(ixjdebug
& 0x0200) {
350 printk("IXJ phone%d - allocate failed\n", j
->board
);
355 if(ixjdebug
& 0x0200) {
356 printk("IXJ phone%d - allocate succeded\n", j
->board
);
364 static IXJ ixj
[IXJMAX
];
365 #define get_ixj(b) (&ixj[(b)])
368 * Allocate a free IXJ device
371 static IXJ
*ixj_alloc(void)
374 for(cnt
=0; cnt
<IXJMAX
; cnt
++) {
375 if(!ixj
[cnt
].DSPbase
)
381 static inline void ixj_fsk_free(IXJ
*j
) {;}
383 static inline void ixj_fsk_alloc(IXJ
*j
)
391 #define ixj_perfmon(x) ((x)++)
393 #define ixj_perfmon(x) do { } while(0)
396 static int ixj_convert_loaded
;
398 static int ixj_WriteDSPCommand(unsigned short, IXJ
*j
);
400 /************************************************************************
402 * These are function definitions to allow external modules to register
403 * enhanced functionality call backs.
405 ************************************************************************/
407 static int Stub(IXJ
* J
, unsigned long arg
)
412 static IXJ_REGFUNC ixj_PreRead
= &Stub
;
413 static IXJ_REGFUNC ixj_PostRead
= &Stub
;
414 static IXJ_REGFUNC ixj_PreWrite
= &Stub
;
415 static IXJ_REGFUNC ixj_PostWrite
= &Stub
;
417 static void ixj_read_frame(IXJ
*j
);
418 static void ixj_write_frame(IXJ
*j
);
419 static void ixj_init_timer(IXJ
*j
);
420 static void ixj_add_timer(IXJ
* j
);
421 static void ixj_timeout(unsigned long ptr
);
422 static int read_filters(IXJ
*j
);
423 static int LineMonitor(IXJ
*j
);
424 static int ixj_fasync(int fd
, struct file
*, int mode
);
425 static int ixj_set_port(IXJ
*j
, int arg
);
426 static int ixj_set_pots(IXJ
*j
, int arg
);
427 static int ixj_hookstate(IXJ
*j
);
428 static int ixj_record_start(IXJ
*j
);
429 static void ixj_record_stop(IXJ
*j
);
430 static void set_rec_volume(IXJ
*j
, int volume
);
431 static int get_rec_volume(IXJ
*j
);
432 static int set_rec_codec(IXJ
*j
, int rate
);
433 static void ixj_vad(IXJ
*j
, int arg
);
434 static int ixj_play_start(IXJ
*j
);
435 static void ixj_play_stop(IXJ
*j
);
436 static int ixj_set_tone_on(unsigned short arg
, IXJ
*j
);
437 static int ixj_set_tone_off(unsigned short, IXJ
*j
);
438 static int ixj_play_tone(IXJ
*j
, char tone
);
439 static void ixj_aec_start(IXJ
*j
, int level
);
440 static int idle(IXJ
*j
);
441 static void ixj_ring_on(IXJ
*j
);
442 static void ixj_ring_off(IXJ
*j
);
443 static void aec_stop(IXJ
*j
);
444 static void ixj_ringback(IXJ
*j
);
445 static void ixj_busytone(IXJ
*j
);
446 static void ixj_dialtone(IXJ
*j
);
447 static void ixj_cpt_stop(IXJ
*j
);
448 static char daa_int_read(IXJ
*j
);
449 static char daa_CR_read(IXJ
*j
, int cr
);
450 static int daa_set_mode(IXJ
*j
, int mode
);
451 static int ixj_linetest(IXJ
*j
);
452 static int ixj_daa_write(IXJ
*j
);
453 static int ixj_daa_cid_read(IXJ
*j
);
454 static void DAA_Coeff_US(IXJ
*j
);
455 static void DAA_Coeff_UK(IXJ
*j
);
456 static void DAA_Coeff_France(IXJ
*j
);
457 static void DAA_Coeff_Germany(IXJ
*j
);
458 static void DAA_Coeff_Australia(IXJ
*j
);
459 static void DAA_Coeff_Japan(IXJ
*j
);
460 static int ixj_init_filter(IXJ
*j
, IXJ_FILTER
* jf
);
461 static int ixj_init_filter_raw(IXJ
*j
, IXJ_FILTER_RAW
* jfr
);
462 static int ixj_init_tone(IXJ
*j
, IXJ_TONE
* ti
);
463 static int ixj_build_cadence(IXJ
*j
, IXJ_CADENCE __user
* cp
);
464 static int ixj_build_filter_cadence(IXJ
*j
, IXJ_FILTER_CADENCE __user
* cp
);
465 /* Serial Control Interface funtions */
466 static int SCI_Control(IXJ
*j
, int control
);
467 static int SCI_Prepare(IXJ
*j
);
468 static int SCI_WaitHighSCI(IXJ
*j
);
469 static int SCI_WaitLowSCI(IXJ
*j
);
470 static DWORD
PCIEE_GetSerialNumber(WORD wAddress
);
471 static int ixj_PCcontrol_wait(IXJ
*j
);
472 static void ixj_pre_cid(IXJ
*j
);
473 static void ixj_write_cid(IXJ
*j
);
474 static void ixj_write_cid_bit(IXJ
*j
, int bit
);
475 static int set_base_frame(IXJ
*j
, int size
);
476 static int set_play_codec(IXJ
*j
, int rate
);
477 static void set_rec_depth(IXJ
*j
, int depth
);
478 static int ixj_mixer(long val
, IXJ
*j
);
480 /************************************************************************
481 CT8020/CT8021 Host Programmers Model
482 Host address Function Access
484 0-1 Aux Software Status Register (reserved) Read Only
485 2-3 Software Status Register Read Only
486 4-5 Aux Software Control Register (reserved) Read Write
487 6-7 Software Control Register Read Write
488 8-9 Hardware Status Register Read Only
489 A-B Hardware Control Register Read Write
490 C-D Host Transmit (Write) Data Buffer Access Port (buffer input)Write Only
491 E-F Host Recieve (Read) Data Buffer Access Port (buffer input) Read Only
492 ************************************************************************/
494 static inline void ixj_read_HSR(IXJ
*j
)
496 j
->hsr
.bytes
.low
= inb_p(j
->DSPbase
+ 8);
497 j
->hsr
.bytes
.high
= inb_p(j
->DSPbase
+ 9);
500 static inline int IsControlReady(IXJ
*j
)
503 return j
->hsr
.bits
.controlrdy
? 1 : 0;
506 static inline int IsPCControlReady(IXJ
*j
)
508 j
->pccr1
.byte
= inb_p(j
->XILINXbase
+ 3);
509 return j
->pccr1
.bits
.crr
? 1 : 0;
512 static inline int IsStatusReady(IXJ
*j
)
515 return j
->hsr
.bits
.statusrdy
? 1 : 0;
518 static inline int IsRxReady(IXJ
*j
)
521 ixj_perfmon(j
->rxreadycheck
);
522 return j
->hsr
.bits
.rxrdy
? 1 : 0;
525 static inline int IsTxReady(IXJ
*j
)
528 ixj_perfmon(j
->txreadycheck
);
529 return j
->hsr
.bits
.txrdy
? 1 : 0;
532 static inline void set_play_volume(IXJ
*j
, int volume
)
534 if (ixjdebug
& 0x0002)
535 printk(KERN_INFO
"IXJ: /dev/phone%d Setting Play Volume to 0x%4.4x\n", j
->board
, volume
);
536 ixj_WriteDSPCommand(0xCF02, j
);
537 ixj_WriteDSPCommand(volume
, j
);
540 static int set_play_volume_linear(IXJ
*j
, int volume
)
542 int newvolume
, dspplaymax
;
544 if (ixjdebug
& 0x0002)
545 printk(KERN_INFO
"IXJ: /dev/phone %d Setting Linear Play Volume to 0x%4.4x\n", j
->board
, volume
);
546 if(volume
> 100 || volume
< 0) {
550 /* This should normalize the perceived volumes between the different cards caused by differences in the hardware */
551 switch (j
->cardtype
) {
556 if(j
->port
== PORT_PSTN
) {
562 case QTI_PHONEJACK_LITE
:
565 case QTI_PHONEJACK_PCI
:
574 newvolume
= (dspplaymax
* volume
) / 100;
575 set_play_volume(j
, newvolume
);
579 static inline void set_play_depth(IXJ
*j
, int depth
)
585 ixj_WriteDSPCommand(0x5280 + depth
, j
);
588 static inline int get_play_volume(IXJ
*j
)
590 ixj_WriteDSPCommand(0xCF00, j
);
591 return j
->ssr
.high
<< 8 | j
->ssr
.low
;
594 static int get_play_volume_linear(IXJ
*j
)
596 int volume
, newvolume
, dspplaymax
;
598 /* This should normalize the perceived volumes between the different cards caused by differences in the hardware */
599 switch (j
->cardtype
) {
604 if(j
->port
== PORT_PSTN
) {
610 case QTI_PHONEJACK_LITE
:
613 case QTI_PHONEJACK_PCI
:
622 volume
= get_play_volume(j
);
623 newvolume
= (volume
* 100) / dspplaymax
;
629 static inline BYTE
SLIC_GetState(IXJ
*j
)
631 if (j
->cardtype
== QTI_PHONECARD
) {
633 j
->psccr
.bits
.dev
= 3;
634 j
->psccr
.bits
.rw
= 1;
635 outw_p(j
->psccr
.byte
<< 8, j
->XILINXbase
+ 0x00);
636 ixj_PCcontrol_wait(j
);
637 j
->pslic
.byte
= inw_p(j
->XILINXbase
+ 0x00) & 0xFF;
638 ixj_PCcontrol_wait(j
);
639 if (j
->pslic
.bits
.powerdown
)
640 return PLD_SLIC_STATE_OC
;
641 else if (!j
->pslic
.bits
.ring0
&& !j
->pslic
.bits
.ring1
)
642 return PLD_SLIC_STATE_ACTIVE
;
644 return PLD_SLIC_STATE_RINGING
;
646 j
->pld_slicr
.byte
= inb_p(j
->XILINXbase
+ 0x01);
648 return j
->pld_slicr
.bits
.state
;
651 static bool SLIC_SetState(BYTE byState
, IXJ
*j
)
653 bool fRetVal
= false;
655 if (j
->cardtype
== QTI_PHONECARD
) {
656 if (j
->flags
.pcmciasct
) {
658 case PLD_SLIC_STATE_TIPOPEN
:
659 case PLD_SLIC_STATE_OC
:
660 j
->pslic
.bits
.powerdown
= 1;
661 j
->pslic
.bits
.ring0
= j
->pslic
.bits
.ring1
= 0;
664 case PLD_SLIC_STATE_RINGING
:
665 if (j
->readers
|| j
->writers
) {
666 j
->pslic
.bits
.powerdown
= 0;
667 j
->pslic
.bits
.ring0
= 1;
668 j
->pslic
.bits
.ring1
= 0;
672 case PLD_SLIC_STATE_OHT
: /* On-hook transmit */
674 case PLD_SLIC_STATE_STANDBY
:
675 case PLD_SLIC_STATE_ACTIVE
:
676 if (j
->readers
|| j
->writers
) {
677 j
->pslic
.bits
.powerdown
= 0;
679 j
->pslic
.bits
.powerdown
= 1;
681 j
->pslic
.bits
.ring0
= j
->pslic
.bits
.ring1
= 0;
684 case PLD_SLIC_STATE_APR
: /* Active polarity reversal */
686 case PLD_SLIC_STATE_OHTPR
: /* OHT polarity reversal */
692 j
->psccr
.bits
.dev
= 3;
693 j
->psccr
.bits
.rw
= 0;
694 outw_p(j
->psccr
.byte
<< 8 | j
->pslic
.byte
, j
->XILINXbase
+ 0x00);
695 ixj_PCcontrol_wait(j
);
698 /* Set the C1, C2, C3 & B2EN signals. */
700 case PLD_SLIC_STATE_OC
:
701 j
->pld_slicw
.bits
.c1
= 0;
702 j
->pld_slicw
.bits
.c2
= 0;
703 j
->pld_slicw
.bits
.c3
= 0;
704 j
->pld_slicw
.bits
.b2en
= 0;
705 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
708 case PLD_SLIC_STATE_RINGING
:
709 j
->pld_slicw
.bits
.c1
= 1;
710 j
->pld_slicw
.bits
.c2
= 0;
711 j
->pld_slicw
.bits
.c3
= 0;
712 j
->pld_slicw
.bits
.b2en
= 1;
713 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
716 case PLD_SLIC_STATE_ACTIVE
:
717 j
->pld_slicw
.bits
.c1
= 0;
718 j
->pld_slicw
.bits
.c2
= 1;
719 j
->pld_slicw
.bits
.c3
= 0;
720 j
->pld_slicw
.bits
.b2en
= 0;
721 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
724 case PLD_SLIC_STATE_OHT
: /* On-hook transmit */
726 j
->pld_slicw
.bits
.c1
= 1;
727 j
->pld_slicw
.bits
.c2
= 1;
728 j
->pld_slicw
.bits
.c3
= 0;
729 j
->pld_slicw
.bits
.b2en
= 0;
730 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
733 case PLD_SLIC_STATE_TIPOPEN
:
734 j
->pld_slicw
.bits
.c1
= 0;
735 j
->pld_slicw
.bits
.c2
= 0;
736 j
->pld_slicw
.bits
.c3
= 1;
737 j
->pld_slicw
.bits
.b2en
= 0;
738 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
741 case PLD_SLIC_STATE_STANDBY
:
742 j
->pld_slicw
.bits
.c1
= 1;
743 j
->pld_slicw
.bits
.c2
= 0;
744 j
->pld_slicw
.bits
.c3
= 1;
745 j
->pld_slicw
.bits
.b2en
= 1;
746 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
749 case PLD_SLIC_STATE_APR
: /* Active polarity reversal */
751 j
->pld_slicw
.bits
.c1
= 0;
752 j
->pld_slicw
.bits
.c2
= 1;
753 j
->pld_slicw
.bits
.c3
= 1;
754 j
->pld_slicw
.bits
.b2en
= 0;
755 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
758 case PLD_SLIC_STATE_OHTPR
: /* OHT polarity reversal */
760 j
->pld_slicw
.bits
.c1
= 1;
761 j
->pld_slicw
.bits
.c2
= 1;
762 j
->pld_slicw
.bits
.c3
= 1;
763 j
->pld_slicw
.bits
.b2en
= 0;
764 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
776 static int ixj_wink(IXJ
*j
)
780 slicnow
= SLIC_GetState(j
);
782 j
->pots_winkstart
= jiffies
;
783 SLIC_SetState(PLD_SLIC_STATE_OC
, j
);
785 msleep(jiffies_to_msecs(j
->winktime
));
787 SLIC_SetState(slicnow
, j
);
791 static void ixj_init_timer(IXJ
*j
)
793 init_timer(&j
->timer
);
794 j
->timer
.function
= ixj_timeout
;
795 j
->timer
.data
= (unsigned long)j
;
798 static void ixj_add_timer(IXJ
*j
)
800 j
->timer
.expires
= jiffies
+ (hertz
/ samplerate
);
801 add_timer(&j
->timer
);
804 static void ixj_tone_timeout(IXJ
*j
)
809 if (j
->tone_state
== 3) {
812 j
->tone_cadence_state
++;
813 if (j
->tone_cadence_state
>= j
->cadence_t
->elements_used
) {
814 switch (j
->cadence_t
->termination
) {
818 case REPEAT_LAST_ELEMENT
:
819 j
->tone_cadence_state
--;
820 ixj_play_tone(j
, j
->cadence_t
->ce
[j
->tone_cadence_state
].index
);
823 j
->tone_cadence_state
= 0;
824 if (j
->cadence_t
->ce
[j
->tone_cadence_state
].freq0
) {
825 ti
.tone_index
= j
->cadence_t
->ce
[j
->tone_cadence_state
].index
;
826 ti
.freq0
= j
->cadence_t
->ce
[j
->tone_cadence_state
].freq0
;
827 ti
.gain0
= j
->cadence_t
->ce
[j
->tone_cadence_state
].gain0
;
828 ti
.freq1
= j
->cadence_t
->ce
[j
->tone_cadence_state
].freq1
;
829 ti
.gain1
= j
->cadence_t
->ce
[j
->tone_cadence_state
].gain1
;
830 ixj_init_tone(j
, &ti
);
832 ixj_set_tone_on(j
->cadence_t
->ce
[0].tone_on_time
, j
);
833 ixj_set_tone_off(j
->cadence_t
->ce
[0].tone_off_time
, j
);
834 ixj_play_tone(j
, j
->cadence_t
->ce
[0].index
);
838 if (j
->cadence_t
->ce
[j
->tone_cadence_state
].gain0
) {
839 ti
.tone_index
= j
->cadence_t
->ce
[j
->tone_cadence_state
].index
;
840 ti
.freq0
= j
->cadence_t
->ce
[j
->tone_cadence_state
].freq0
;
841 ti
.gain0
= j
->cadence_t
->ce
[j
->tone_cadence_state
].gain0
;
842 ti
.freq1
= j
->cadence_t
->ce
[j
->tone_cadence_state
].freq1
;
843 ti
.gain1
= j
->cadence_t
->ce
[j
->tone_cadence_state
].gain1
;
844 ixj_init_tone(j
, &ti
);
846 ixj_set_tone_on(j
->cadence_t
->ce
[j
->tone_cadence_state
].tone_on_time
, j
);
847 ixj_set_tone_off(j
->cadence_t
->ce
[j
->tone_cadence_state
].tone_off_time
, j
);
848 ixj_play_tone(j
, j
->cadence_t
->ce
[j
->tone_cadence_state
].index
);
854 static inline void ixj_kill_fasync(IXJ
*j
, IXJ_SIGEVENT event
, int dir
)
856 if(j
->ixj_signals
[event
]) {
857 if(ixjdebug
& 0x0100)
858 printk("Sending signal for event %d\n", event
);
859 /* Send apps notice of change */
860 /* see config.h for macro definition */
861 kill_fasync(&(j
->async_queue
), j
->ixj_signals
[event
], dir
);
865 static void ixj_pstn_state(IXJ
*j
)
868 union XOPXR0 XR0
, daaint
;
872 XR0
.reg
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.reg
;
874 XR0
.bitreg
.RMR
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.bitreg
.RMR
;
876 j
->pld_scrr
.byte
= inb_p(j
->XILINXbase
);
877 if (j
->pld_scrr
.bits
.daaflag
) {
879 if(j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.RING
) {
880 if(time_after(jiffies
, j
->pstn_sleeptil
) && !(j
->flags
.pots_pstn
&& j
->hookstate
)) {
881 daaint
.bitreg
.RING
= 1;
882 if(ixjdebug
& 0x0008) {
883 printk(KERN_INFO
"IXJ DAA Ring Interrupt /dev/phone%d at %ld\n", j
->board
, jiffies
);
886 daa_set_mode(j
, SOP_PU_RESET
);
889 if(j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.Caller_ID
) {
890 daaint
.bitreg
.Caller_ID
= 1;
891 j
->pstn_cid_intr
= 1;
892 j
->pstn_cid_received
= jiffies
;
893 if(ixjdebug
& 0x0008) {
894 printk(KERN_INFO
"IXJ DAA Caller_ID Interrupt /dev/phone%d at %ld\n", j
->board
, jiffies
);
897 if(j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.Cadence
) {
898 daaint
.bitreg
.Cadence
= 1;
899 if(ixjdebug
& 0x0008) {
900 printk(KERN_INFO
"IXJ DAA Cadence Interrupt /dev/phone%d at %ld\n", j
->board
, jiffies
);
903 if(j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.VDD_OK
!= XR0
.bitreg
.VDD_OK
) {
904 daaint
.bitreg
.VDD_OK
= 1;
905 daaint
.bitreg
.SI_0
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.VDD_OK
;
909 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
)) {
910 daaint
.bitreg
.RMR
= 1;
911 daaint
.bitreg
.SI_1
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.bitreg
.RMR
;
912 if(ixjdebug
& 0x0008) {
913 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
);
915 j
->pstn_prev_rmr
= j
->pstn_last_rmr
;
916 j
->pstn_last_rmr
= jiffies
;
918 switch(j
->daa_mode
) {
920 if (daaint
.bitreg
.RING
) {
921 if (!j
->flags
.pstn_ringing
) {
922 if (j
->daa_mode
!= SOP_PU_RINGING
) {
923 j
->pstn_ring_int
= jiffies
;
924 daa_set_mode(j
, SOP_PU_RINGING
);
930 if (daaint
.bitreg
.RMR
) {
931 if (ixjdebug
& 0x0008) {
932 printk(KERN_INFO
"IXJ Ring Cadence a state = %d /dev/phone%d at %ld\n", j
->cadence_f
[4].state
, j
->board
, jiffies
);
934 if (daaint
.bitreg
.SI_1
) { /* Rising edge of RMR */
935 j
->flags
.pstn_rmr
= 1;
936 j
->pstn_ring_start
= jiffies
;
937 j
->pstn_ring_stop
= 0;
938 j
->ex
.bits
.pstn_ring
= 0;
939 if (j
->cadence_f
[4].state
== 0) {
940 j
->cadence_f
[4].state
= 1;
941 j
->cadence_f
[4].on1min
= jiffies
+ (long)((j
->cadence_f
[4].on1
* hertz
* (100 - var
)) / 10000);
942 j
->cadence_f
[4].on1dot
= jiffies
+ (long)((j
->cadence_f
[4].on1
* hertz
* (100)) / 10000);
943 j
->cadence_f
[4].on1max
= jiffies
+ (long)((j
->cadence_f
[4].on1
* hertz
* (100 + var
)) / 10000);
944 } else if (j
->cadence_f
[4].state
== 2) {
945 if((time_after(jiffies
, j
->cadence_f
[4].off1min
) &&
946 time_before(jiffies
, j
->cadence_f
[4].off1max
))) {
947 if (j
->cadence_f
[4].on2
) {
948 j
->cadence_f
[4].state
= 3;
949 j
->cadence_f
[4].on2min
= jiffies
+ (long)((j
->cadence_f
[4].on2
* (hertz
* (100 - var
)) / 10000));
950 j
->cadence_f
[4].on2dot
= jiffies
+ (long)((j
->cadence_f
[4].on2
* (hertz
* (100)) / 10000));
951 j
->cadence_f
[4].on2max
= jiffies
+ (long)((j
->cadence_f
[4].on2
* (hertz
* (100 + var
)) / 10000));
953 j
->cadence_f
[4].state
= 7;
956 if (ixjdebug
& 0x0008) {
957 printk(KERN_INFO
"IXJ Ring Cadence fail state = %d /dev/phone%d at %ld should be %d\n",
958 j
->cadence_f
[4].state
, j
->board
, jiffies
- j
->pstn_prev_rmr
,
959 j
->cadence_f
[4].off1
);
961 j
->cadence_f
[4].state
= 0;
963 } else if (j
->cadence_f
[4].state
== 4) {
964 if((time_after(jiffies
, j
->cadence_f
[4].off2min
) &&
965 time_before(jiffies
, j
->cadence_f
[4].off2max
))) {
966 if (j
->cadence_f
[4].on3
) {
967 j
->cadence_f
[4].state
= 5;
968 j
->cadence_f
[4].on3min
= jiffies
+ (long)((j
->cadence_f
[4].on3
* (hertz
* (100 - var
)) / 10000));
969 j
->cadence_f
[4].on3dot
= jiffies
+ (long)((j
->cadence_f
[4].on3
* (hertz
* (100)) / 10000));
970 j
->cadence_f
[4].on3max
= jiffies
+ (long)((j
->cadence_f
[4].on3
* (hertz
* (100 + var
)) / 10000));
972 j
->cadence_f
[4].state
= 7;
975 if (ixjdebug
& 0x0008) {
976 printk(KERN_INFO
"IXJ Ring Cadence fail state = %d /dev/phone%d at %ld should be %d\n",
977 j
->cadence_f
[4].state
, j
->board
, jiffies
- j
->pstn_prev_rmr
,
978 j
->cadence_f
[4].off2
);
980 j
->cadence_f
[4].state
= 0;
982 } else if (j
->cadence_f
[4].state
== 6) {
983 if((time_after(jiffies
, j
->cadence_f
[4].off3min
) &&
984 time_before(jiffies
, j
->cadence_f
[4].off3max
))) {
985 j
->cadence_f
[4].state
= 7;
987 if (ixjdebug
& 0x0008) {
988 printk(KERN_INFO
"IXJ Ring Cadence fail state = %d /dev/phone%d at %ld should be %d\n",
989 j
->cadence_f
[4].state
, j
->board
, jiffies
- j
->pstn_prev_rmr
,
990 j
->cadence_f
[4].off3
);
992 j
->cadence_f
[4].state
= 0;
995 j
->cadence_f
[4].state
= 0;
997 } else { /* Falling edge of RMR */
998 j
->pstn_ring_start
= 0;
999 j
->pstn_ring_stop
= jiffies
;
1000 if (j
->cadence_f
[4].state
== 1) {
1001 if(!j
->cadence_f
[4].on1
) {
1002 j
->cadence_f
[4].state
= 7;
1003 } else if((time_after(jiffies
, j
->cadence_f
[4].on1min
) &&
1004 time_before(jiffies
, j
->cadence_f
[4].on1max
))) {
1005 if (j
->cadence_f
[4].off1
) {
1006 j
->cadence_f
[4].state
= 2;
1007 j
->cadence_f
[4].off1min
= jiffies
+ (long)((j
->cadence_f
[4].off1
* (hertz
* (100 - var
)) / 10000));
1008 j
->cadence_f
[4].off1dot
= jiffies
+ (long)((j
->cadence_f
[4].off1
* (hertz
* (100)) / 10000));
1009 j
->cadence_f
[4].off1max
= jiffies
+ (long)((j
->cadence_f
[4].off1
* (hertz
* (100 + var
)) / 10000));
1011 j
->cadence_f
[4].state
= 7;
1014 if (ixjdebug
& 0x0008) {
1015 printk(KERN_INFO
"IXJ Ring Cadence fail state = %d /dev/phone%d at %ld should be %d\n",
1016 j
->cadence_f
[4].state
, j
->board
, jiffies
- j
->pstn_prev_rmr
,
1017 j
->cadence_f
[4].on1
);
1019 j
->cadence_f
[4].state
= 0;
1021 } else if (j
->cadence_f
[4].state
== 3) {
1022 if((time_after(jiffies
, j
->cadence_f
[4].on2min
) &&
1023 time_before(jiffies
, j
->cadence_f
[4].on2max
))) {
1024 if (j
->cadence_f
[4].off2
) {
1025 j
->cadence_f
[4].state
= 4;
1026 j
->cadence_f
[4].off2min
= jiffies
+ (long)((j
->cadence_f
[4].off2
* (hertz
* (100 - var
)) / 10000));
1027 j
->cadence_f
[4].off2dot
= jiffies
+ (long)((j
->cadence_f
[4].off2
* (hertz
* (100)) / 10000));
1028 j
->cadence_f
[4].off2max
= jiffies
+ (long)((j
->cadence_f
[4].off2
* (hertz
* (100 + var
)) / 10000));
1030 j
->cadence_f
[4].state
= 7;
1033 if (ixjdebug
& 0x0008) {
1034 printk(KERN_INFO
"IXJ Ring Cadence fail state = %d /dev/phone%d at %ld should be %d\n",
1035 j
->cadence_f
[4].state
, j
->board
, jiffies
- j
->pstn_prev_rmr
,
1036 j
->cadence_f
[4].on2
);
1038 j
->cadence_f
[4].state
= 0;
1040 } else if (j
->cadence_f
[4].state
== 5) {
1041 if((time_after(jiffies
, j
->cadence_f
[4].on3min
) &&
1042 time_before(jiffies
, j
->cadence_f
[4].on3max
))) {
1043 if (j
->cadence_f
[4].off3
) {
1044 j
->cadence_f
[4].state
= 6;
1045 j
->cadence_f
[4].off3min
= jiffies
+ (long)((j
->cadence_f
[4].off3
* (hertz
* (100 - var
)) / 10000));
1046 j
->cadence_f
[4].off3dot
= jiffies
+ (long)((j
->cadence_f
[4].off3
* (hertz
* (100)) / 10000));
1047 j
->cadence_f
[4].off3max
= jiffies
+ (long)((j
->cadence_f
[4].off3
* (hertz
* (100 + var
)) / 10000));
1049 j
->cadence_f
[4].state
= 7;
1052 j
->cadence_f
[4].state
= 0;
1055 if (ixjdebug
& 0x0008) {
1056 printk(KERN_INFO
"IXJ Ring Cadence fail state = %d /dev/phone%d at %ld should be %d\n",
1057 j
->cadence_f
[4].state
, j
->board
, jiffies
- j
->pstn_prev_rmr
,
1058 j
->cadence_f
[4].on3
);
1060 j
->cadence_f
[4].state
= 0;
1063 if (ixjdebug
& 0x0010) {
1064 printk(KERN_INFO
"IXJ Ring Cadence b state = %d /dev/phone%d at %ld\n", j
->cadence_f
[4].state
, j
->board
, jiffies
);
1066 if (ixjdebug
& 0x0010) {
1067 switch(j
->cadence_f
[4].state
) {
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].on1
, j
->cadence_f
[4].on1min
, j
->cadence_f
[4].on1dot
, j
->cadence_f
[4].on1max
);
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].off1
, j
->cadence_f
[4].off1min
, j
->cadence_f
[4].off1dot
, j
->cadence_f
[4].off1max
);
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].on2
, j
->cadence_f
[4].on2min
, j
->cadence_f
[4].on2dot
, j
->cadence_f
[4].on2max
);
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].off2
, j
->cadence_f
[4].off2min
, j
->cadence_f
[4].off2dot
, j
->cadence_f
[4].off2max
);
1085 printk(KERN_INFO
"IXJ /dev/phone%d Next Ring Cadence state at %u min %ld - %ld - max %ld\n", j
->board
,
1086 j
->cadence_f
[4].on3
, j
->cadence_f
[4].on3min
, j
->cadence_f
[4].on3dot
, j
->cadence_f
[4].on3max
);
1089 printk(KERN_INFO
"IXJ /dev/phone%d Next Ring Cadence state at %u min %ld - %ld - max %ld\n", j
->board
,
1090 j
->cadence_f
[4].off3
, j
->cadence_f
[4].off3min
, j
->cadence_f
[4].off3dot
, j
->cadence_f
[4].off3max
);
1095 if (j
->cadence_f
[4].state
== 7) {
1096 j
->cadence_f
[4].state
= 0;
1097 j
->pstn_ring_stop
= jiffies
;
1098 j
->ex
.bits
.pstn_ring
= 1;
1099 ixj_kill_fasync(j
, SIG_PSTN_RING
, POLL_IN
);
1100 if(ixjdebug
& 0x0008) {
1101 printk(KERN_INFO
"IXJ Ring int set /dev/phone%d at %ld\n", j
->board
, jiffies
);
1104 if((j
->pstn_ring_int
!= 0 && time_after(jiffies
, j
->pstn_ring_int
+ (hertz
* 5)) && !j
->flags
.pstn_rmr
) ||
1105 (j
->pstn_ring_stop
!= 0 && time_after(jiffies
, j
->pstn_ring_stop
+ (hertz
* 5)))) {
1106 if(ixjdebug
& 0x0008) {
1107 printk("IXJ DAA no ring in 5 seconds /dev/phone%d at %ld\n", j
->board
, jiffies
);
1108 printk("IXJ DAA pstn ring int /dev/phone%d at %ld\n", j
->board
, j
->pstn_ring_int
);
1109 printk("IXJ DAA pstn ring stop /dev/phone%d at %ld\n", j
->board
, j
->pstn_ring_stop
);
1111 j
->pstn_ring_stop
= j
->pstn_ring_int
= 0;
1112 daa_set_mode(j
, SOP_PU_SLEEP
);
1114 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
1115 if (j
->pstn_cid_intr
&& time_after(jiffies
, j
->pstn_cid_received
+ hertz
)) {
1116 ixj_daa_cid_read(j
);
1117 j
->ex
.bits
.caller_id
= 1;
1118 ixj_kill_fasync(j
, SIG_CALLER_ID
, POLL_IN
);
1119 j
->pstn_cid_intr
= 0;
1121 if (daaint
.bitreg
.Cadence
) {
1122 if(ixjdebug
& 0x0008) {
1123 printk("IXJ DAA Cadence interrupt going to sleep /dev/phone%d\n", j
->board
);
1125 daa_set_mode(j
, SOP_PU_SLEEP
);
1126 j
->ex
.bits
.pstn_ring
= 0;
1129 case SOP_PU_CONVERSATION
:
1130 if (daaint
.bitreg
.VDD_OK
) {
1131 if(!daaint
.bitreg
.SI_0
) {
1132 if (!j
->pstn_winkstart
) {
1133 if(ixjdebug
& 0x0008) {
1134 printk("IXJ DAA possible wink /dev/phone%d %ld\n", j
->board
, jiffies
);
1136 j
->pstn_winkstart
= jiffies
;
1139 if (j
->pstn_winkstart
) {
1140 if(ixjdebug
& 0x0008) {
1141 printk("IXJ DAA possible wink end /dev/phone%d %ld\n", j
->board
, jiffies
);
1143 j
->pstn_winkstart
= 0;
1147 if (j
->pstn_winkstart
&& time_after(jiffies
, j
->pstn_winkstart
+ ((hertz
* j
->winktime
) / 1000))) {
1148 if(ixjdebug
& 0x0008) {
1149 printk("IXJ DAA wink detected going to sleep /dev/phone%d %ld\n", j
->board
, jiffies
);
1151 daa_set_mode(j
, SOP_PU_SLEEP
);
1152 j
->pstn_winkstart
= 0;
1153 j
->ex
.bits
.pstn_wink
= 1;
1154 ixj_kill_fasync(j
, SIG_PSTN_WINK
, POLL_IN
);
1160 static void ixj_timeout(unsigned long ptr
)
1163 unsigned long jifon
;
1164 IXJ
*j
= (IXJ
*)ptr
;
1167 if (j
->DSPbase
&& atomic_read(&j
->DSPWrite
) == 0 && test_and_set_bit(board
, (void *)&j
->busyflags
) == 0) {
1168 ixj_perfmon(j
->timerchecks
);
1169 j
->hookstate
= ixj_hookstate(j
);
1170 if (j
->tone_state
) {
1171 if (!(j
->hookstate
)) {
1175 j
->ex
.bits
.hookstate
= 1;
1176 ixj_kill_fasync(j
, SIG_HOOKSTATE
, POLL_IN
);
1178 clear_bit(board
, &j
->busyflags
);
1182 if (j
->tone_state
== 1)
1183 jifon
= ((hertz
* j
->tone_on_time
) * 25 / 100000);
1185 jifon
= ((hertz
* j
->tone_on_time
) * 25 / 100000) + ((hertz
* j
->tone_off_time
) * 25 / 100000);
1186 if (time_before(jiffies
, j
->tone_start_jif
+ jifon
)) {
1187 if (j
->tone_state
== 1) {
1188 ixj_play_tone(j
, j
->tone_index
);
1189 if (j
->dsp
.low
== 0x20) {
1190 clear_bit(board
, &j
->busyflags
);
1195 ixj_play_tone(j
, 0);
1196 if (j
->dsp
.low
== 0x20) {
1197 clear_bit(board
, &j
->busyflags
);
1203 ixj_tone_timeout(j
);
1204 if (j
->flags
.dialtone
) {
1207 if (j
->flags
.busytone
) {
1209 if (j
->dsp
.low
== 0x20) {
1210 clear_bit(board
, &j
->busyflags
);
1215 if (j
->flags
.ringback
) {
1217 if (j
->dsp
.low
== 0x20) {
1218 clear_bit(board
, &j
->busyflags
);
1223 if (!j
->tone_state
) {
1228 if (!(j
->tone_state
&& j
->dsp
.low
== 0x20)) {
1236 if (j
->flags
.cringing
) {
1237 if (j
->hookstate
& 1) {
1238 j
->flags
.cringing
= 0;
1240 } else if(j
->cadence_f
[5].enable
&& ((!j
->cadence_f
[5].en_filter
) || (j
->cadence_f
[5].en_filter
&& j
->flags
.firstring
))) {
1241 switch(j
->cadence_f
[5].state
) {
1243 j
->cadence_f
[5].on1dot
= jiffies
+ (long)((j
->cadence_f
[5].on1
* (hertz
* 100) / 10000));
1244 if (time_before(jiffies
, j
->cadence_f
[5].on1dot
)) {
1245 if(ixjdebug
& 0x0004) {
1246 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1250 j
->cadence_f
[5].state
= 1;
1253 if (time_after(jiffies
, j
->cadence_f
[5].on1dot
)) {
1254 j
->cadence_f
[5].off1dot
= jiffies
+ (long)((j
->cadence_f
[5].off1
* (hertz
* 100) / 10000));
1255 if(ixjdebug
& 0x0004) {
1256 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1259 j
->cadence_f
[5].state
= 2;
1263 if (time_after(jiffies
, j
->cadence_f
[5].off1dot
)) {
1264 if(ixjdebug
& 0x0004) {
1265 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1268 if (j
->cadence_f
[5].on2
) {
1269 j
->cadence_f
[5].on2dot
= jiffies
+ (long)((j
->cadence_f
[5].on2
* (hertz
* 100) / 10000));
1270 j
->cadence_f
[5].state
= 3;
1272 j
->cadence_f
[5].state
= 7;
1277 if (time_after(jiffies
, j
->cadence_f
[5].on2dot
)) {
1278 if(ixjdebug
& 0x0004) {
1279 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1282 if (j
->cadence_f
[5].off2
) {
1283 j
->cadence_f
[5].off2dot
= jiffies
+ (long)((j
->cadence_f
[5].off2
* (hertz
* 100) / 10000));
1284 j
->cadence_f
[5].state
= 4;
1286 j
->cadence_f
[5].state
= 7;
1291 if (time_after(jiffies
, j
->cadence_f
[5].off2dot
)) {
1292 if(ixjdebug
& 0x0004) {
1293 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1296 if (j
->cadence_f
[5].on3
) {
1297 j
->cadence_f
[5].on3dot
= jiffies
+ (long)((j
->cadence_f
[5].on3
* (hertz
* 100) / 10000));
1298 j
->cadence_f
[5].state
= 5;
1300 j
->cadence_f
[5].state
= 7;
1305 if (time_after(jiffies
, j
->cadence_f
[5].on3dot
)) {
1306 if(ixjdebug
& 0x0004) {
1307 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1310 if (j
->cadence_f
[5].off3
) {
1311 j
->cadence_f
[5].off3dot
= jiffies
+ (long)((j
->cadence_f
[5].off3
* (hertz
* 100) / 10000));
1312 j
->cadence_f
[5].state
= 6;
1314 j
->cadence_f
[5].state
= 7;
1319 if (time_after(jiffies
, j
->cadence_f
[5].off3dot
)) {
1320 if(ixjdebug
& 0x0004) {
1321 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1323 j
->cadence_f
[5].state
= 7;
1327 if(ixjdebug
& 0x0004) {
1328 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1330 j
->flags
.cidring
= 1;
1331 j
->cadence_f
[5].state
= 0;
1334 if (j
->flags
.cidring
&& !j
->flags
.cidsent
) {
1335 j
->flags
.cidsent
= 1;
1337 SLIC_SetState(PLD_SLIC_STATE_OHT
, j
);
1340 j
->flags
.cidring
= 0;
1342 clear_bit(board
, &j
->busyflags
);
1346 if (time_after(jiffies
, j
->ring_cadence_jif
+ (hertz
/ 2))) {
1347 if (j
->flags
.cidring
&& !j
->flags
.cidsent
) {
1348 j
->flags
.cidsent
= 1;
1350 SLIC_SetState(PLD_SLIC_STATE_OHT
, j
);
1353 j
->flags
.cidring
= 0;
1355 j
->ring_cadence_t
--;
1356 if (j
->ring_cadence_t
== -1)
1357 j
->ring_cadence_t
= 15;
1358 j
->ring_cadence_jif
= jiffies
;
1360 if (j
->ring_cadence
& 1 << j
->ring_cadence_t
) {
1361 if(j
->flags
.cidsent
&& j
->cadence_f
[5].en_filter
)
1362 j
->flags
.firstring
= 1;
1367 if(!j
->flags
.cidsent
)
1368 j
->flags
.cidring
= 1;
1371 clear_bit(board
, &j
->busyflags
);
1376 if (!j
->flags
.ringing
) {
1377 if (j
->hookstate
) { /* & 1) { */
1378 if (j
->dsp
.low
!= 0x20 &&
1379 SLIC_GetState(j
) != PLD_SLIC_STATE_ACTIVE
) {
1380 SLIC_SetState(PLD_SLIC_STATE_ACTIVE
, j
);
1384 ixj_WriteDSPCommand(0x511B, j
);
1385 j
->proc_load
= j
->ssr
.high
<< 8 | j
->ssr
.low
;
1386 if (!j
->m_hook
&& (j
->hookstate
& 1)) {
1387 j
->m_hook
= j
->ex
.bits
.hookstate
= 1;
1388 ixj_kill_fasync(j
, SIG_HOOKSTATE
, POLL_IN
);
1391 if (j
->ex
.bits
.dtmf_ready
) {
1392 j
->dtmf_wp
= j
->dtmf_rp
= j
->ex
.bits
.dtmf_ready
= 0;
1396 j
->ex
.bits
.hookstate
= 1;
1397 ixj_kill_fasync(j
, SIG_HOOKSTATE
, POLL_IN
);
1401 if (j
->cardtype
== QTI_LINEJACK
&& !j
->flags
.pstncheck
&& j
->flags
.pstn_present
) {
1405 wake_up_interruptible(&j
->poll_q
); /* Wake any blocked selects */
1407 clear_bit(board
, &j
->busyflags
);
1412 static int ixj_status_wait(IXJ
*j
)
1416 jif
= jiffies
+ ((60 * hertz
) / 100);
1417 while (!IsStatusReady(j
)) {
1418 ixj_perfmon(j
->statuswait
);
1419 if (time_after(jiffies
, jif
)) {
1420 ixj_perfmon(j
->statuswaitfail
);
1427 static int ixj_PCcontrol_wait(IXJ
*j
)
1431 jif
= jiffies
+ ((60 * hertz
) / 100);
1432 while (!IsPCControlReady(j
)) {
1433 ixj_perfmon(j
->pcontrolwait
);
1434 if (time_after(jiffies
, jif
)) {
1435 ixj_perfmon(j
->pcontrolwaitfail
);
1442 static int ixj_WriteDSPCommand(unsigned short cmd
, IXJ
*j
)
1447 atomic_inc(&j
->DSPWrite
);
1448 if(atomic_read(&j
->DSPWrite
) > 1) {
1449 printk("IXJ %d DSP write overlap attempting command 0x%4.4x\n", j
->board
, cmd
);
1452 bytes
.high
= (cmd
& 0xFF00) >> 8;
1453 bytes
.low
= cmd
& 0x00FF;
1454 jif
= jiffies
+ ((60 * hertz
) / 100);
1455 while (!IsControlReady(j
)) {
1456 ixj_perfmon(j
->iscontrolready
);
1457 if (time_after(jiffies
, jif
)) {
1458 ixj_perfmon(j
->iscontrolreadyfail
);
1459 atomic_dec(&j
->DSPWrite
);
1460 if(atomic_read(&j
->DSPWrite
) > 0) {
1461 printk("IXJ %d DSP overlaped command 0x%4.4x during control ready failure.\n", j
->board
, cmd
);
1462 while(atomic_read(&j
->DSPWrite
) > 0) {
1463 atomic_dec(&j
->DSPWrite
);
1469 outb(bytes
.low
, j
->DSPbase
+ 6);
1470 outb(bytes
.high
, j
->DSPbase
+ 7);
1472 if (ixj_status_wait(j
)) {
1475 atomic_dec(&j
->DSPWrite
);
1476 if(atomic_read(&j
->DSPWrite
) > 0) {
1477 printk("IXJ %d DSP overlaped command 0x%4.4x during status wait failure.\n", j
->board
, cmd
);
1478 while(atomic_read(&j
->DSPWrite
) > 0) {
1479 atomic_dec(&j
->DSPWrite
);
1484 /* Read Software Status Register */
1485 j
->ssr
.low
= inb_p(j
->DSPbase
+ 2);
1486 j
->ssr
.high
= inb_p(j
->DSPbase
+ 3);
1487 atomic_dec(&j
->DSPWrite
);
1488 if(atomic_read(&j
->DSPWrite
) > 0) {
1489 printk("IXJ %d DSP overlaped command 0x%4.4x\n", j
->board
, cmd
);
1490 while(atomic_read(&j
->DSPWrite
) > 0) {
1491 atomic_dec(&j
->DSPWrite
);
1497 /***************************************************************************
1499 * General Purpose IO Register read routine
1501 ***************************************************************************/
1502 static inline int ixj_gpio_read(IXJ
*j
)
1504 if (ixj_WriteDSPCommand(0x5143, j
))
1507 j
->gpio
.bytes
.low
= j
->ssr
.low
;
1508 j
->gpio
.bytes
.high
= j
->ssr
.high
;
1513 static inline void LED_SetState(int state
, IXJ
*j
)
1515 if (j
->cardtype
== QTI_LINEJACK
) {
1516 j
->pld_scrw
.bits
.led1
= state
& 0x1 ? 1 : 0;
1517 j
->pld_scrw
.bits
.led2
= state
& 0x2 ? 1 : 0;
1518 j
->pld_scrw
.bits
.led3
= state
& 0x4 ? 1 : 0;
1519 j
->pld_scrw
.bits
.led4
= state
& 0x8 ? 1 : 0;
1521 outb(j
->pld_scrw
.byte
, j
->XILINXbase
);
1525 /*********************************************************************
1526 * GPIO Pins are configured as follows on the Quicknet Internet
1527 * PhoneJACK Telephony Cards
1529 * POTS Select GPIO_6=0 GPIO_7=0
1530 * Mic/Speaker Select GPIO_6=0 GPIO_7=1
1531 * Handset Select GPIO_6=1 GPIO_7=0
1533 * SLIC Active GPIO_1=0 GPIO_2=1 GPIO_5=0
1534 * SLIC Ringing GPIO_1=1 GPIO_2=1 GPIO_5=0
1535 * SLIC Open Circuit GPIO_1=0 GPIO_2=0 GPIO_5=0
1537 * Hook Switch changes reported on GPIO_3
1538 *********************************************************************/
1539 static int ixj_set_port(IXJ
*j
, int arg
)
1541 if (j
->cardtype
== QTI_PHONEJACK_LITE
) {
1542 if (arg
!= PORT_POTS
)
1549 j
->port
= PORT_POTS
;
1550 switch (j
->cardtype
) {
1552 if (j
->flags
.pcmciasct
== 1)
1553 SLIC_SetState(PLD_SLIC_STATE_ACTIVE
, j
);
1557 case QTI_PHONEJACK_PCI
:
1558 j
->pld_slicw
.pcib
.mic
= 0;
1559 j
->pld_slicw
.pcib
.spk
= 0;
1560 outb(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
1563 ixj_set_pots(j
, 0); /* Disconnect POTS/PSTN relay */
1564 if (ixj_WriteDSPCommand(0xC528, j
)) /* Write CODEC config to
1565 Software Control Register */
1567 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
1569 outb(j
->pld_scrw
.byte
, j
->XILINXbase
);
1570 j
->pld_clock
.byte
= 0;
1571 outb(j
->pld_clock
.byte
, j
->XILINXbase
+ 0x04);
1572 j
->pld_slicw
.bits
.rly1
= 1;
1573 j
->pld_slicw
.bits
.spken
= 0;
1574 outb(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
1575 ixj_mixer(0x1200, j
); /* Turn Off MIC switch on mixer left */
1576 ixj_mixer(0x1401, j
); /* Turn On Mono1 switch on mixer left */
1577 ixj_mixer(0x1300, j
); /* Turn Off MIC switch on mixer right */
1578 ixj_mixer(0x1501, j
); /* Turn On Mono1 switch on mixer right */
1579 ixj_mixer(0x0E80, j
); /*Mic mute */
1580 ixj_mixer(0x0F00, j
); /* Set mono out (SLIC) to 0dB */
1581 ixj_mixer(0x0080, j
); /* Mute Master Left volume */
1582 ixj_mixer(0x0180, j
); /* Mute Master Right volume */
1583 SLIC_SetState(PLD_SLIC_STATE_STANDBY
, j
);
1584 /* SLIC_SetState(PLD_SLIC_STATE_ACTIVE, j); */
1587 j
->gpio
.bytes
.high
= 0x0B;
1588 j
->gpio
.bits
.gpio6
= 0;
1589 j
->gpio
.bits
.gpio7
= 0;
1590 ixj_WriteDSPCommand(j
->gpio
.word
, j
);
1595 if (j
->cardtype
== QTI_LINEJACK
) {
1596 ixj_WriteDSPCommand(0xC534, j
); /* Write CODEC config to Software Control Register */
1598 j
->pld_slicw
.bits
.rly3
= 0;
1599 j
->pld_slicw
.bits
.rly1
= 1;
1600 j
->pld_slicw
.bits
.spken
= 0;
1601 outb(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
1602 j
->port
= PORT_PSTN
;
1608 j
->port
= PORT_SPEAKER
;
1609 switch (j
->cardtype
) {
1611 if (j
->flags
.pcmciasct
) {
1612 SLIC_SetState(PLD_SLIC_STATE_OC
, j
);
1615 case QTI_PHONEJACK_PCI
:
1616 j
->pld_slicw
.pcib
.mic
= 1;
1617 j
->pld_slicw
.pcib
.spk
= 1;
1618 outb(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
1621 ixj_set_pots(j
, 0); /* Disconnect POTS/PSTN relay */
1622 if (ixj_WriteDSPCommand(0xC528, j
)) /* Write CODEC config to
1623 Software Control Register */
1625 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
1627 outb(j
->pld_scrw
.byte
, j
->XILINXbase
);
1628 j
->pld_clock
.byte
= 0;
1629 outb(j
->pld_clock
.byte
, j
->XILINXbase
+ 0x04);
1630 j
->pld_slicw
.bits
.rly1
= 1;
1631 j
->pld_slicw
.bits
.spken
= 1;
1632 outb(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
1633 ixj_mixer(0x1201, j
); /* Turn On MIC switch on mixer left */
1634 ixj_mixer(0x1400, j
); /* Turn Off Mono1 switch on mixer left */
1635 ixj_mixer(0x1301, j
); /* Turn On MIC switch on mixer right */
1636 ixj_mixer(0x1500, j
); /* Turn Off Mono1 switch on mixer right */
1637 ixj_mixer(0x0E06, j
); /*Mic un-mute 0dB */
1638 ixj_mixer(0x0F80, j
); /* Mute mono out (SLIC) */
1639 ixj_mixer(0x0000, j
); /* Set Master Left volume to 0dB */
1640 ixj_mixer(0x0100, j
); /* Set Master Right volume to 0dB */
1643 j
->gpio
.bytes
.high
= 0x0B;
1644 j
->gpio
.bits
.gpio6
= 0;
1645 j
->gpio
.bits
.gpio7
= 1;
1646 ixj_WriteDSPCommand(j
->gpio
.word
, j
);
1651 if (j
->cardtype
!= QTI_PHONEJACK
) {
1654 j
->gpio
.bytes
.high
= 0x0B;
1655 j
->gpio
.bits
.gpio6
= 1;
1656 j
->gpio
.bits
.gpio7
= 0;
1657 ixj_WriteDSPCommand(j
->gpio
.word
, j
);
1658 j
->port
= PORT_HANDSET
;
1668 static int ixj_set_pots(IXJ
*j
, int arg
)
1670 if (j
->cardtype
== QTI_LINEJACK
) {
1672 if (j
->port
== PORT_PSTN
) {
1673 j
->pld_slicw
.bits
.rly1
= 0;
1674 outb(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
1675 j
->flags
.pots_pstn
= 1;
1678 j
->flags
.pots_pstn
= 0;
1682 j
->pld_slicw
.bits
.rly1
= 1;
1683 outb(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
1684 j
->flags
.pots_pstn
= 0;
1692 static void ixj_ring_on(IXJ
*j
)
1694 if (j
->dsp
.low
== 0x20) /* Internet PhoneJACK */
1696 if (ixjdebug
& 0x0004)
1697 printk(KERN_INFO
"IXJ Ring On /dev/phone%d\n", j
->board
);
1699 j
->gpio
.bytes
.high
= 0x0B;
1700 j
->gpio
.bytes
.low
= 0x00;
1701 j
->gpio
.bits
.gpio1
= 1;
1702 j
->gpio
.bits
.gpio2
= 1;
1703 j
->gpio
.bits
.gpio5
= 0;
1704 ixj_WriteDSPCommand(j
->gpio
.word
, j
); /* send the ring signal */
1705 } else /* Internet LineJACK, Internet PhoneJACK Lite or Internet PhoneJACK PCI */
1707 if (ixjdebug
& 0x0004)
1708 printk(KERN_INFO
"IXJ Ring On /dev/phone%d\n", j
->board
);
1710 SLIC_SetState(PLD_SLIC_STATE_RINGING
, j
);
1714 static int ixj_siadc(IXJ
*j
, int val
)
1716 if(j
->cardtype
== QTI_PHONECARD
){
1717 if(j
->flags
.pcmciascp
){
1719 return j
->siadc
.bits
.rxg
;
1721 if(val
< 0 || val
> 0x1F)
1724 j
->siadc
.bits
.hom
= 0; /* Handset Out Mute */
1725 j
->siadc
.bits
.lom
= 0; /* Line Out Mute */
1726 j
->siadc
.bits
.rxg
= val
; /*(0xC000 - 0x41C8) / 0x4EF; RX PGA Gain */
1727 j
->psccr
.bits
.addr
= 6; /* R/W Smart Cable Register Address */
1728 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1729 j
->psccr
.bits
.dev
= 0;
1730 outb(j
->siadc
.byte
, j
->XILINXbase
+ 0x00);
1731 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1732 ixj_PCcontrol_wait(j
);
1733 return j
->siadc
.bits
.rxg
;
1739 static int ixj_sidac(IXJ
*j
, int val
)
1741 if(j
->cardtype
== QTI_PHONECARD
){
1742 if(j
->flags
.pcmciascp
){
1744 return j
->sidac
.bits
.txg
;
1746 if(val
< 0 || val
> 0x1F)
1749 j
->sidac
.bits
.srm
= 1; /* Speaker Right Mute */
1750 j
->sidac
.bits
.slm
= 1; /* Speaker Left Mute */
1751 j
->sidac
.bits
.txg
= val
; /* (0xC000 - 0x45E4) / 0x5D3; TX PGA Gain */
1752 j
->psccr
.bits
.addr
= 7; /* R/W Smart Cable Register Address */
1753 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1754 j
->psccr
.bits
.dev
= 0;
1755 outb(j
->sidac
.byte
, j
->XILINXbase
+ 0x00);
1756 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1757 ixj_PCcontrol_wait(j
);
1758 return j
->sidac
.bits
.txg
;
1764 static int ixj_pcmcia_cable_check(IXJ
*j
)
1766 j
->pccr1
.byte
= inb_p(j
->XILINXbase
+ 0x03);
1767 if (!j
->flags
.pcmciastate
) {
1768 j
->pccr2
.byte
= inb_p(j
->XILINXbase
+ 0x02);
1769 if (j
->pccr1
.bits
.drf
|| j
->pccr2
.bits
.rstc
) {
1770 j
->flags
.pcmciastate
= 4;
1773 if (j
->pccr1
.bits
.ed
) {
1774 j
->pccr1
.bits
.ed
= 0;
1775 j
->psccr
.bits
.dev
= 3;
1776 j
->psccr
.bits
.rw
= 1;
1777 outw_p(j
->psccr
.byte
<< 8, j
->XILINXbase
+ 0x00);
1778 ixj_PCcontrol_wait(j
);
1779 j
->pslic
.byte
= inw_p(j
->XILINXbase
+ 0x00) & 0xFF;
1780 j
->pslic
.bits
.led2
= j
->pslic
.bits
.det
? 1 : 0;
1781 j
->psccr
.bits
.dev
= 3;
1782 j
->psccr
.bits
.rw
= 0;
1783 outw_p(j
->psccr
.byte
<< 8 | j
->pslic
.byte
, j
->XILINXbase
+ 0x00);
1784 ixj_PCcontrol_wait(j
);
1785 return j
->pslic
.bits
.led2
? 1 : 0;
1786 } else if (j
->flags
.pcmciasct
) {
1791 } else if (j
->flags
.pcmciastate
== 4) {
1792 if (!j
->pccr1
.bits
.drf
) {
1793 j
->flags
.pcmciastate
= 3;
1796 } else if (j
->flags
.pcmciastate
== 3) {
1797 j
->pccr2
.bits
.pwr
= 0;
1798 j
->pccr2
.bits
.rstc
= 1;
1799 outb(j
->pccr2
.byte
, j
->XILINXbase
+ 0x02);
1800 j
->checkwait
= jiffies
+ (hertz
* 2);
1801 j
->flags
.incheck
= 1;
1802 j
->flags
.pcmciastate
= 2;
1804 } else if (j
->flags
.pcmciastate
== 2) {
1805 if (j
->flags
.incheck
) {
1806 if (time_before(jiffies
, j
->checkwait
)) {
1809 j
->flags
.incheck
= 0;
1812 j
->pccr2
.bits
.pwr
= 0;
1813 j
->pccr2
.bits
.rstc
= 0;
1814 outb_p(j
->pccr2
.byte
, j
->XILINXbase
+ 0x02);
1815 j
->flags
.pcmciastate
= 1;
1817 } else if (j
->flags
.pcmciastate
== 1) {
1818 j
->flags
.pcmciastate
= 0;
1819 if (!j
->pccr1
.bits
.drf
) {
1820 j
->psccr
.bits
.dev
= 3;
1821 j
->psccr
.bits
.rw
= 1;
1822 outb_p(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1823 ixj_PCcontrol_wait(j
);
1824 j
->flags
.pcmciascp
= 1; /* Set Cable Present Flag */
1826 j
->flags
.pcmciasct
= (inw_p(j
->XILINXbase
+ 0x00) >> 8) & 0x03; /* Get Cable Type */
1828 if (j
->flags
.pcmciasct
== 3) {
1829 j
->flags
.pcmciastate
= 4;
1831 } else if (j
->flags
.pcmciasct
== 0) {
1832 j
->pccr2
.bits
.pwr
= 1;
1833 j
->pccr2
.bits
.rstc
= 0;
1834 outb_p(j
->pccr2
.byte
, j
->XILINXbase
+ 0x02);
1835 j
->port
= PORT_SPEAKER
;
1837 j
->port
= PORT_POTS
;
1839 j
->sic1
.bits
.cpd
= 0; /* Chip Power Down */
1840 j
->sic1
.bits
.mpd
= 0; /* MIC Bias Power Down */
1841 j
->sic1
.bits
.hpd
= 0; /* Handset Bias Power Down */
1842 j
->sic1
.bits
.lpd
= 0; /* Line Bias Power Down */
1843 j
->sic1
.bits
.spd
= 1; /* Speaker Drive Power Down */
1844 j
->psccr
.bits
.addr
= 1; /* R/W Smart Cable Register Address */
1845 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1846 j
->psccr
.bits
.dev
= 0;
1847 outb(j
->sic1
.byte
, j
->XILINXbase
+ 0x00);
1848 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1849 ixj_PCcontrol_wait(j
);
1851 j
->sic2
.bits
.al
= 0; /* Analog Loopback DAC analog -> ADC analog */
1852 j
->sic2
.bits
.dl2
= 0; /* Digital Loopback DAC -> ADC one bit */
1853 j
->sic2
.bits
.dl1
= 0; /* Digital Loopback ADC -> DAC one bit */
1854 j
->sic2
.bits
.pll
= 0; /* 1 = div 10, 0 = div 5 */
1855 j
->sic2
.bits
.hpd
= 0; /* HPF disable */
1856 j
->psccr
.bits
.addr
= 2; /* R/W Smart Cable Register Address */
1857 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1858 j
->psccr
.bits
.dev
= 0;
1859 outb(j
->sic2
.byte
, j
->XILINXbase
+ 0x00);
1860 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1861 ixj_PCcontrol_wait(j
);
1863 j
->psccr
.bits
.addr
= 3; /* R/W Smart Cable Register Address */
1864 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1865 j
->psccr
.bits
.dev
= 0;
1866 outb(0x00, j
->XILINXbase
+ 0x00); /* PLL Divide N1 */
1867 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1868 ixj_PCcontrol_wait(j
);
1870 j
->psccr
.bits
.addr
= 4; /* R/W Smart Cable Register Address */
1871 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1872 j
->psccr
.bits
.dev
= 0;
1873 outb(0x09, j
->XILINXbase
+ 0x00); /* PLL Multiply M1 */
1874 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1875 ixj_PCcontrol_wait(j
);
1877 j
->sirxg
.bits
.lig
= 1; /* Line In Gain */
1878 j
->sirxg
.bits
.lim
= 1; /* Line In Mute */
1879 j
->sirxg
.bits
.mcg
= 0; /* MIC In Gain was 3 */
1880 j
->sirxg
.bits
.mcm
= 0; /* MIC In Mute */
1881 j
->sirxg
.bits
.him
= 0; /* Handset In Mute */
1882 j
->sirxg
.bits
.iir
= 1; /* IIR */
1883 j
->psccr
.bits
.addr
= 5; /* R/W Smart Cable Register Address */
1884 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1885 j
->psccr
.bits
.dev
= 0;
1886 outb(j
->sirxg
.byte
, j
->XILINXbase
+ 0x00);
1887 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1888 ixj_PCcontrol_wait(j
);
1893 j
->siaatt
.bits
.sot
= 0;
1894 j
->psccr
.bits
.addr
= 9; /* R/W Smart Cable Register Address */
1895 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1896 j
->psccr
.bits
.dev
= 0;
1897 outb(j
->siaatt
.byte
, j
->XILINXbase
+ 0x00);
1898 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1899 ixj_PCcontrol_wait(j
);
1901 if (j
->flags
.pcmciasct
== 1 && !j
->readers
&& !j
->writers
) {
1902 j
->psccr
.byte
= j
->pslic
.byte
= 0;
1903 j
->pslic
.bits
.powerdown
= 1;
1904 j
->psccr
.bits
.dev
= 3;
1905 j
->psccr
.bits
.rw
= 0;
1906 outw_p(j
->psccr
.byte
<< 8 | j
->pslic
.byte
, j
->XILINXbase
+ 0x00);
1907 ixj_PCcontrol_wait(j
);
1912 j
->flags
.pcmciascp
= 0;
1918 static int ixj_hookstate(IXJ
*j
)
1922 switch (j
->cardtype
) {
1925 fOffHook
= j
->gpio
.bits
.gpio3read
? 1 : 0;
1928 case QTI_PHONEJACK_LITE
:
1929 case QTI_PHONEJACK_PCI
:
1931 if(j
->cardtype
== QTI_LINEJACK
&& j
->flags
.pots_pstn
== 1 && (j
->readers
|| j
->writers
)) {
1932 fOffHook
= j
->pld_slicr
.bits
.potspstn
? 1 : 0;
1933 if(fOffHook
!= j
->p_hook
) {
1935 j
->checkwait
= jiffies
;
1937 if(time_before(jiffies
, j
->checkwait
+ 2)) {
1942 j
->p_hook
= fOffHook
;
1943 printk("IXJ : /dev/phone%d pots-pstn hookstate check %d at %ld\n", j
->board
, fOffHook
, jiffies
);
1946 if (j
->pld_slicr
.bits
.state
== PLD_SLIC_STATE_ACTIVE
||
1947 j
->pld_slicr
.bits
.state
== PLD_SLIC_STATE_STANDBY
) {
1948 if (j
->flags
.ringing
|| j
->flags
.cringing
) {
1949 if (!in_interrupt()) {
1953 if (j
->pld_slicr
.bits
.state
== PLD_SLIC_STATE_RINGING
) {
1957 if (j
->cardtype
== QTI_PHONEJACK_PCI
) {
1958 j
->pld_scrr
.byte
= inb_p(j
->XILINXbase
);
1959 fOffHook
= j
->pld_scrr
.pcib
.det
? 1 : 0;
1961 fOffHook
= j
->pld_slicr
.bits
.det
? 1 : 0;
1966 fOffHook
= ixj_pcmcia_cable_check(j
);
1969 if (j
->r_hook
!= fOffHook
) {
1970 j
->r_hook
= fOffHook
;
1971 if (j
->port
== PORT_SPEAKER
|| j
->port
== PORT_HANDSET
) { // || (j->port == PORT_PSTN && j->flags.pots_pstn == 0)) {
1972 j
->ex
.bits
.hookstate
= 1;
1973 ixj_kill_fasync(j
, SIG_HOOKSTATE
, POLL_IN
);
1974 } else if (!fOffHook
) {
1975 j
->flash_end
= jiffies
+ ((60 * hertz
) / 100);
1979 if(time_before(jiffies
, j
->flash_end
)) {
1980 j
->ex
.bits
.flash
= 1;
1982 ixj_kill_fasync(j
, SIG_FLASH
, POLL_IN
);
1985 if(time_before(jiffies
, j
->flash_end
)) {
1990 if (j
->port
== PORT_PSTN
&& j
->daa_mode
== SOP_PU_CONVERSATION
)
1993 if (j
->port
== PORT_SPEAKER
) {
1994 if(j
->cardtype
== QTI_PHONECARD
) {
1995 if(j
->flags
.pcmciascp
&& j
->flags
.pcmciasct
) {
2003 if (j
->port
== PORT_HANDSET
)
2009 static void ixj_ring_off(IXJ
*j
)
2011 if (j
->dsp
.low
== 0x20) /* Internet PhoneJACK */
2013 if (ixjdebug
& 0x0004)
2014 printk(KERN_INFO
"IXJ Ring Off\n");
2015 j
->gpio
.bytes
.high
= 0x0B;
2016 j
->gpio
.bytes
.low
= 0x00;
2017 j
->gpio
.bits
.gpio1
= 0;
2018 j
->gpio
.bits
.gpio2
= 1;
2019 j
->gpio
.bits
.gpio5
= 0;
2020 ixj_WriteDSPCommand(j
->gpio
.word
, j
);
2021 } else /* Internet LineJACK */
2023 if (ixjdebug
& 0x0004)
2024 printk(KERN_INFO
"IXJ Ring Off\n");
2026 if(!j
->flags
.cidplay
)
2027 SLIC_SetState(PLD_SLIC_STATE_STANDBY
, j
);
2033 static void ixj_ring_start(IXJ
*j
)
2035 j
->flags
.cringing
= 1;
2036 if (ixjdebug
& 0x0004)
2037 printk(KERN_INFO
"IXJ Cadence Ringing Start /dev/phone%d\n", j
->board
);
2038 if (ixj_hookstate(j
) & 1) {
2039 if (j
->port
== PORT_POTS
)
2041 j
->flags
.cringing
= 0;
2042 if (ixjdebug
& 0x0004)
2043 printk(KERN_INFO
"IXJ Cadence Ringing Stopped /dev/phone%d off hook\n", j
->board
);
2044 } else if(j
->cadence_f
[5].enable
&& (!j
->cadence_f
[5].en_filter
)) {
2045 j
->ring_cadence_jif
= jiffies
;
2046 j
->flags
.cidsent
= j
->flags
.cidring
= 0;
2047 j
->cadence_f
[5].state
= 0;
2048 if(j
->cadence_f
[5].on1
)
2051 j
->ring_cadence_jif
= jiffies
;
2052 j
->ring_cadence_t
= 15;
2053 if (j
->ring_cadence
& 1 << j
->ring_cadence_t
) {
2058 j
->flags
.cidsent
= j
->flags
.cidring
= j
->flags
.firstring
= 0;
2062 static int ixj_ring(IXJ
*j
)
2067 j
->flags
.ringing
= 1;
2068 if (ixj_hookstate(j
) & 1) {
2070 j
->flags
.ringing
= 0;
2073 for (cntr
= 0; cntr
< j
->maxrings
; cntr
++) {
2074 jif
= jiffies
+ (1 * hertz
);
2076 while (time_before(jiffies
, jif
)) {
2077 if (ixj_hookstate(j
) & 1) {
2079 j
->flags
.ringing
= 0;
2082 schedule_timeout_interruptible(1);
2083 if (signal_pending(current
))
2086 jif
= jiffies
+ (3 * hertz
);
2088 while (time_before(jiffies
, jif
)) {
2089 if (ixj_hookstate(j
) & 1) {
2091 if (ixj_hookstate(j
) & 1) {
2092 j
->flags
.ringing
= 0;
2096 schedule_timeout_interruptible(1);
2097 if (signal_pending(current
))
2102 j
->flags
.ringing
= 0;
2106 static int ixj_open(struct phone_device
*p
, struct file
*file_p
)
2108 IXJ
*j
= get_ixj(p
->board
);
2109 file_p
->private_data
= j
;
2114 if (file_p
->f_mode
& FMODE_READ
) {
2122 if (file_p
->f_mode
& FMODE_WRITE
) {
2126 if (file_p
->f_mode
& FMODE_READ
){
2133 if (j
->cardtype
== QTI_PHONECARD
) {
2134 j
->pslic
.bits
.powerdown
= 0;
2135 j
->psccr
.bits
.dev
= 3;
2136 j
->psccr
.bits
.rw
= 0;
2137 outw_p(j
->psccr
.byte
<< 8 | j
->pslic
.byte
, j
->XILINXbase
+ 0x00);
2138 ixj_PCcontrol_wait(j
);
2141 j
->flags
.cidplay
= 0;
2142 j
->flags
.cidcw_ack
= 0;
2144 if (ixjdebug
& 0x0002)
2145 printk(KERN_INFO
"Opening board %d\n", p
->board
);
2147 j
->framesread
= j
->frameswritten
= 0;
2151 static int ixj_release(struct inode
*inode
, struct file
*file_p
)
2155 IXJ
*j
= file_p
->private_data
;
2156 int board
= j
->p
.board
;
2159 * Set up locks to ensure that only one process is talking to the DSP at a time.
2160 * This is necessary to keep the DSP from locking up.
2162 while(test_and_set_bit(board
, (void *)&j
->busyflags
) != 0)
2163 schedule_timeout_interruptible(1);
2164 if (ixjdebug
& 0x0002)
2165 printk(KERN_INFO
"Closing board %d\n", NUM(inode
));
2167 if (j
->cardtype
== QTI_PHONECARD
)
2168 ixj_set_port(j
, PORT_SPEAKER
);
2170 ixj_set_port(j
, PORT_POTS
);
2175 set_play_volume(j
, 0x100);
2176 set_rec_volume(j
, 0x100);
2179 /* Restore the tone table to default settings. */
2185 ixj_init_tone(j
, &ti
);
2191 ixj_init_tone(j
, &ti
);
2197 ixj_init_tone(j
, &ti
);
2203 ixj_init_tone(j
, &ti
);
2209 ixj_init_tone(j
, &ti
);
2215 ixj_init_tone(j
, &ti
);
2221 ixj_init_tone(j
, &ti
);
2227 ixj_init_tone(j
, &ti
);
2233 ixj_init_tone(j
, &ti
);
2239 ixj_init_tone(j
, &ti
);
2245 ixj_init_tone(j
, &ti
);
2251 ixj_init_tone(j
, &ti
);
2257 ixj_init_tone(j
, &ti
);
2263 ixj_init_tone(j
, &ti
);
2269 ixj_init_tone(j
, &ti
);
2275 ixj_init_tone(j
, &ti
);
2281 ixj_init_tone(j
, &ti
);
2287 ixj_init_tone(j
, &ti
);
2289 set_rec_depth(j
, 2); /* Set Record Channel Limit to 2 frames */
2291 set_play_depth(j
, 2); /* Set Playback Channel Limit to 2 frames */
2293 j
->ex
.bits
.dtmf_ready
= 0;
2295 j
->dtmf_wp
= j
->dtmf_rp
= 0;
2296 j
->rec_mode
= j
->play_mode
= -1;
2297 j
->flags
.ringing
= 0;
2298 j
->maxrings
= MAXRINGS
;
2299 j
->ring_cadence
= USA_RING_CADENCE
;
2300 if(j
->cadence_f
[5].enable
) {
2301 j
->cadence_f
[5].enable
= j
->cadence_f
[5].en_filter
= j
->cadence_f
[5].state
= 0;
2305 j
->flags
.dtmf_oob
= 0;
2306 for (cnt
= 0; cnt
< 4; cnt
++)
2307 j
->cadence_f
[cnt
].enable
= 0;
2311 if(j
->cardtype
== QTI_PHONECARD
) {
2312 SLIC_SetState(PLD_SLIC_STATE_OC
, j
);
2315 if (file_p
->f_mode
& FMODE_READ
)
2317 if (file_p
->f_mode
& FMODE_WRITE
)
2320 if (j
->read_buffer
&& !j
->readers
) {
2321 kfree(j
->read_buffer
);
2322 j
->read_buffer
= NULL
;
2323 j
->read_buffer_size
= 0;
2325 if (j
->write_buffer
&& !j
->writers
) {
2326 kfree(j
->write_buffer
);
2327 j
->write_buffer
= NULL
;
2328 j
->write_buffer_size
= 0;
2330 j
->rec_codec
= j
->play_codec
= 0;
2331 j
->rec_frame_size
= j
->play_frame_size
= 0;
2332 j
->flags
.cidsent
= j
->flags
.cidring
= 0;
2334 if(j
->cardtype
== QTI_LINEJACK
&& !j
->readers
&& !j
->writers
) {
2335 ixj_set_port(j
, PORT_PSTN
);
2336 daa_set_mode(j
, SOP_PU_SLEEP
);
2339 ixj_WriteDSPCommand(0x0FE3, j
); /* Put the DSP in 1/5 power mode. */
2341 /* Set up the default signals for events */
2342 for (cnt
= 0; cnt
< 35; cnt
++)
2343 j
->ixj_signals
[cnt
] = SIGIO
;
2345 /* Set the excetion signal enable flags */
2346 j
->ex_sig
.bits
.dtmf_ready
= j
->ex_sig
.bits
.hookstate
= j
->ex_sig
.bits
.flash
= j
->ex_sig
.bits
.pstn_ring
=
2347 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
=
2348 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;
2350 file_p
->private_data
= NULL
;
2351 clear_bit(board
, &j
->busyflags
);
2355 static int read_filters(IXJ
*j
)
2357 unsigned short fc
, cnt
, trg
;
2361 if (ixj_WriteDSPCommand(0x5144, j
)) {
2362 if(ixjdebug
& 0x0001) {
2363 printk(KERN_INFO
"Read Frame Counter failed!\n");
2367 fc
= j
->ssr
.high
<< 8 | j
->ssr
.low
;
2368 if (fc
== j
->frame_count
)
2371 j
->frame_count
= fc
;
2378 for (cnt
= 0; cnt
< 4; cnt
++) {
2379 if (ixj_WriteDSPCommand(0x5154 + cnt
, j
)) {
2380 if(ixjdebug
& 0x0001) {
2381 printk(KERN_INFO
"Select Filter %d failed!\n", cnt
);
2385 if (ixj_WriteDSPCommand(0x515C, j
)) {
2386 if(ixjdebug
& 0x0001) {
2387 printk(KERN_INFO
"Read Filter History %d failed!\n", cnt
);
2391 j
->filter_hist
[cnt
] = j
->ssr
.high
<< 8 | j
->ssr
.low
;
2393 if (j
->cadence_f
[cnt
].enable
) {
2394 if (j
->filter_hist
[cnt
] & 3 && !(j
->filter_hist
[cnt
] & 12)) {
2395 if (j
->cadence_f
[cnt
].state
== 0) {
2396 j
->cadence_f
[cnt
].state
= 1;
2397 j
->cadence_f
[cnt
].on1min
= jiffies
+ (long)((j
->cadence_f
[cnt
].on1
* (hertz
* (100 - var
)) / 10000));
2398 j
->cadence_f
[cnt
].on1dot
= jiffies
+ (long)((j
->cadence_f
[cnt
].on1
* (hertz
* (100)) / 10000));
2399 j
->cadence_f
[cnt
].on1max
= jiffies
+ (long)((j
->cadence_f
[cnt
].on1
* (hertz
* (100 + var
)) / 10000));
2400 } else if (j
->cadence_f
[cnt
].state
== 2 &&
2401 (time_after(jiffies
, j
->cadence_f
[cnt
].off1min
) &&
2402 time_before(jiffies
, j
->cadence_f
[cnt
].off1max
))) {
2403 if (j
->cadence_f
[cnt
].on2
) {
2404 j
->cadence_f
[cnt
].state
= 3;
2405 j
->cadence_f
[cnt
].on2min
= jiffies
+ (long)((j
->cadence_f
[cnt
].on2
* (hertz
* (100 - var
)) / 10000));
2406 j
->cadence_f
[cnt
].on2dot
= jiffies
+ (long)((j
->cadence_f
[cnt
].on2
* (hertz
* (100)) / 10000));
2407 j
->cadence_f
[cnt
].on2max
= jiffies
+ (long)((j
->cadence_f
[cnt
].on2
* (hertz
* (100 + var
)) / 10000));
2409 j
->cadence_f
[cnt
].state
= 7;
2411 } else if (j
->cadence_f
[cnt
].state
== 4 &&
2412 (time_after(jiffies
, j
->cadence_f
[cnt
].off2min
) &&
2413 time_before(jiffies
, j
->cadence_f
[cnt
].off2max
))) {
2414 if (j
->cadence_f
[cnt
].on3
) {
2415 j
->cadence_f
[cnt
].state
= 5;
2416 j
->cadence_f
[cnt
].on3min
= jiffies
+ (long)((j
->cadence_f
[cnt
].on3
* (hertz
* (100 - var
)) / 10000));
2417 j
->cadence_f
[cnt
].on3dot
= jiffies
+ (long)((j
->cadence_f
[cnt
].on3
* (hertz
* (100)) / 10000));
2418 j
->cadence_f
[cnt
].on3max
= jiffies
+ (long)((j
->cadence_f
[cnt
].on3
* (hertz
* (100 + var
)) / 10000));
2420 j
->cadence_f
[cnt
].state
= 7;
2423 j
->cadence_f
[cnt
].state
= 0;
2425 } else if (j
->filter_hist
[cnt
] & 12 && !(j
->filter_hist
[cnt
] & 3)) {
2426 if (j
->cadence_f
[cnt
].state
== 1) {
2427 if(!j
->cadence_f
[cnt
].on1
) {
2428 j
->cadence_f
[cnt
].state
= 7;
2429 } else if((time_after(jiffies
, j
->cadence_f
[cnt
].on1min
) &&
2430 time_before(jiffies
, j
->cadence_f
[cnt
].on1max
))) {
2431 if(j
->cadence_f
[cnt
].off1
) {
2432 j
->cadence_f
[cnt
].state
= 2;
2433 j
->cadence_f
[cnt
].off1min
= jiffies
+ (long)((j
->cadence_f
[cnt
].off1
* (hertz
* (100 - var
)) / 10000));
2434 j
->cadence_f
[cnt
].off1dot
= jiffies
+ (long)((j
->cadence_f
[cnt
].off1
* (hertz
* (100)) / 10000));
2435 j
->cadence_f
[cnt
].off1max
= jiffies
+ (long)((j
->cadence_f
[cnt
].off1
* (hertz
* (100 + var
)) / 10000));
2437 j
->cadence_f
[cnt
].state
= 7;
2440 j
->cadence_f
[cnt
].state
= 0;
2442 } else if (j
->cadence_f
[cnt
].state
== 3) {
2443 if((time_after(jiffies
, j
->cadence_f
[cnt
].on2min
) &&
2444 time_before(jiffies
, j
->cadence_f
[cnt
].on2max
))) {
2445 if(j
->cadence_f
[cnt
].off2
) {
2446 j
->cadence_f
[cnt
].state
= 4;
2447 j
->cadence_f
[cnt
].off2min
= jiffies
+ (long)((j
->cadence_f
[cnt
].off2
* (hertz
* (100 - var
)) / 10000));
2448 j
->cadence_f
[cnt
].off2dot
= jiffies
+ (long)((j
->cadence_f
[cnt
].off2
* (hertz
* (100)) / 10000));
2449 j
->cadence_f
[cnt
].off2max
= jiffies
+ (long)((j
->cadence_f
[cnt
].off2
* (hertz
* (100 + var
)) / 10000));
2451 j
->cadence_f
[cnt
].state
= 7;
2454 j
->cadence_f
[cnt
].state
= 0;
2456 } else if (j
->cadence_f
[cnt
].state
== 5) {
2457 if ((time_after(jiffies
, j
->cadence_f
[cnt
].on3min
) &&
2458 time_before(jiffies
, j
->cadence_f
[cnt
].on3max
))) {
2459 if(j
->cadence_f
[cnt
].off3
) {
2460 j
->cadence_f
[cnt
].state
= 6;
2461 j
->cadence_f
[cnt
].off3min
= jiffies
+ (long)((j
->cadence_f
[cnt
].off3
* (hertz
* (100 - var
)) / 10000));
2462 j
->cadence_f
[cnt
].off3dot
= jiffies
+ (long)((j
->cadence_f
[cnt
].off3
* (hertz
* (100)) / 10000));
2463 j
->cadence_f
[cnt
].off3max
= jiffies
+ (long)((j
->cadence_f
[cnt
].off3
* (hertz
* (100 + var
)) / 10000));
2465 j
->cadence_f
[cnt
].state
= 7;
2468 j
->cadence_f
[cnt
].state
= 0;
2471 j
->cadence_f
[cnt
].state
= 0;
2474 switch(j
->cadence_f
[cnt
].state
) {
2476 if(time_after(jiffies
, j
->cadence_f
[cnt
].on1dot
) &&
2477 !j
->cadence_f
[cnt
].off1
&&
2478 !j
->cadence_f
[cnt
].on2
&& !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
].on2dot
) &&
2485 !j
->cadence_f
[cnt
].off2
&&
2486 !j
->cadence_f
[cnt
].on3
&& !j
->cadence_f
[cnt
].off3
) {
2487 j
->cadence_f
[cnt
].state
= 7;
2491 if(time_after(jiffies
, j
->cadence_f
[cnt
].on3dot
) &&
2492 !j
->cadence_f
[cnt
].off3
) {
2493 j
->cadence_f
[cnt
].state
= 7;
2499 if (ixjdebug
& 0x0040) {
2500 printk(KERN_INFO
"IXJ Tone Cadence state = %d /dev/phone%d at %ld\n", j
->cadence_f
[cnt
].state
, j
->board
, jiffies
);
2501 switch(j
->cadence_f
[cnt
].state
) {
2503 printk(KERN_INFO
"IXJ /dev/phone%d No Tone detected\n", j
->board
);
2506 printk(KERN_INFO
"IXJ /dev/phone%d Next Tone Cadence state at %u %ld - %ld - %ld\n", j
->board
,
2507 j
->cadence_f
[cnt
].on1
, j
->cadence_f
[cnt
].on1min
, j
->cadence_f
[cnt
].on1dot
, j
->cadence_f
[cnt
].on1max
);
2510 printk(KERN_INFO
"IXJ /dev/phone%d Next Tone Cadence state at %ld - %ld\n", j
->board
, j
->cadence_f
[cnt
].off1min
,
2511 j
->cadence_f
[cnt
].off1max
);
2514 printk(KERN_INFO
"IXJ /dev/phone%d Next Tone Cadence state at %ld - %ld\n", j
->board
, j
->cadence_f
[cnt
].on2min
,
2515 j
->cadence_f
[cnt
].on2max
);
2518 printk(KERN_INFO
"IXJ /dev/phone%d Next Tone Cadence state at %ld - %ld\n", j
->board
, j
->cadence_f
[cnt
].off2min
,
2519 j
->cadence_f
[cnt
].off2max
);
2522 printk(KERN_INFO
"IXJ /dev/phone%d Next Tone Cadence state at %ld - %ld\n", j
->board
, j
->cadence_f
[cnt
].on3min
,
2523 j
->cadence_f
[cnt
].on3max
);
2526 printk(KERN_INFO
"IXJ /dev/phone%d Next Tone Cadence state at %ld - %ld\n", j
->board
, j
->cadence_f
[cnt
].off3min
,
2527 j
->cadence_f
[cnt
].off3max
);
2532 if (j
->cadence_f
[cnt
].state
== 7) {
2533 j
->cadence_f
[cnt
].state
= 0;
2534 if (j
->cadence_f
[cnt
].enable
== 1)
2535 j
->cadence_f
[cnt
].enable
= 0;
2538 if(ixjdebug
& 0x0020) {
2539 printk(KERN_INFO
"Filter Cadence 0 triggered %ld\n", jiffies
);
2542 ixj_kill_fasync(j
, SIG_FC0
, POLL_IN
);
2545 if(ixjdebug
& 0x0020) {
2546 printk(KERN_INFO
"Filter Cadence 1 triggered %ld\n", jiffies
);
2549 ixj_kill_fasync(j
, SIG_FC1
, POLL_IN
);
2552 if(ixjdebug
& 0x0020) {
2553 printk(KERN_INFO
"Filter Cadence 2 triggered %ld\n", jiffies
);
2556 ixj_kill_fasync(j
, SIG_FC2
, POLL_IN
);
2559 if(ixjdebug
& 0x0020) {
2560 printk(KERN_INFO
"Filter Cadence 3 triggered %ld\n", jiffies
);
2563 ixj_kill_fasync(j
, SIG_FC3
, POLL_IN
);
2567 if (j
->filter_en
[cnt
] && ((j
->filter_hist
[cnt
] & 3 && !(j
->filter_hist
[cnt
] & 12)) ||
2568 (j
->filter_hist
[cnt
] & 12 && !(j
->filter_hist
[cnt
] & 3)))) {
2569 if((j
->filter_hist
[cnt
] & 3 && !(j
->filter_hist
[cnt
] & 12))) {
2571 } else if((j
->filter_hist
[cnt
] & 12 && !(j
->filter_hist
[cnt
] & 3))) {
2576 if(ixjdebug
& 0x0020) {
2577 printk(KERN_INFO
"Filter 0 triggered %d at %ld\n", trg
, jiffies
);
2580 ixj_kill_fasync(j
, SIG_F0
, POLL_IN
);
2583 if(ixjdebug
& 0x0020) {
2584 printk(KERN_INFO
"Filter 1 triggered %d at %ld\n", trg
, jiffies
);
2587 ixj_kill_fasync(j
, SIG_F1
, POLL_IN
);
2590 if(ixjdebug
& 0x0020) {
2591 printk(KERN_INFO
"Filter 2 triggered %d at %ld\n", trg
, jiffies
);
2594 ixj_kill_fasync(j
, SIG_F2
, POLL_IN
);
2597 if(ixjdebug
& 0x0020) {
2598 printk(KERN_INFO
"Filter 3 triggered %d at %ld\n", trg
, jiffies
);
2601 ixj_kill_fasync(j
, SIG_F3
, POLL_IN
);
2609 static int LineMonitor(IXJ
*j
)
2616 if (ixj_WriteDSPCommand(0x7000, j
)) /* Line Monitor */
2619 j
->dtmf
.bytes
.high
= j
->ssr
.high
;
2620 j
->dtmf
.bytes
.low
= j
->ssr
.low
;
2621 if (!j
->dtmf_state
&& j
->dtmf
.bits
.dtmf_valid
) {
2623 j
->dtmf_current
= j
->dtmf
.bits
.digit
;
2625 if (j
->dtmf_state
&& !j
->dtmf
.bits
.dtmf_valid
) /* && j->dtmf_wp != j->dtmf_rp) */
2627 if(!j
->cidcw_wait
) {
2628 j
->dtmfbuffer
[j
->dtmf_wp
] = j
->dtmf_current
;
2630 if (j
->dtmf_wp
== 79)
2632 j
->ex
.bits
.dtmf_ready
= 1;
2633 if(j
->ex_sig
.bits
.dtmf_ready
) {
2634 ixj_kill_fasync(j
, SIG_DTMF_READY
, POLL_IN
);
2637 else if(j
->dtmf_current
== 0x00 || j
->dtmf_current
== 0x0D) {
2638 if(ixjdebug
& 0x0020) {
2639 printk("IXJ phone%d saw CIDCW Ack DTMF %d from display at %ld\n", j
->board
, j
->dtmf_current
, jiffies
);
2641 j
->flags
.cidcw_ack
= 1;
2650 /************************************************************************
2652 * Functions to allow alaw <-> ulaw conversions.
2654 ************************************************************************/
2656 static void ulaw2alaw(unsigned char *buff
, unsigned long len
)
2658 static unsigned char table_ulaw2alaw
[] =
2660 0x2A, 0x2B, 0x28, 0x29, 0x2E, 0x2F, 0x2C, 0x2D,
2661 0x22, 0x23, 0x20, 0x21, 0x26, 0x27, 0x24, 0x25,
2662 0x3A, 0x3B, 0x38, 0x39, 0x3E, 0x3F, 0x3C, 0x3D,
2663 0x32, 0x33, 0x30, 0x31, 0x36, 0x37, 0x34, 0x35,
2664 0x0B, 0x08, 0x09, 0x0E, 0x0F, 0x0C, 0x0D, 0x02,
2665 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05, 0x1A,
2666 0x1B, 0x18, 0x19, 0x1E, 0x1F, 0x1C, 0x1D, 0x12,
2667 0x13, 0x10, 0x11, 0x16, 0x17, 0x14, 0x15, 0x6B,
2668 0x68, 0x69, 0x6E, 0x6F, 0x6C, 0x6D, 0x62, 0x63,
2669 0x60, 0x61, 0x66, 0x67, 0x64, 0x65, 0x7B, 0x79,
2670 0x7E, 0x7F, 0x7C, 0x7D, 0x72, 0x73, 0x70, 0x71,
2671 0x76, 0x77, 0x74, 0x75, 0x4B, 0x49, 0x4F, 0x4D,
2672 0x42, 0x43, 0x40, 0x41, 0x46, 0x47, 0x44, 0x45,
2673 0x5A, 0x5B, 0x58, 0x59, 0x5E, 0x5F, 0x5C, 0x5D,
2674 0x52, 0x52, 0x53, 0x53, 0x50, 0x50, 0x51, 0x51,
2675 0x56, 0x56, 0x57, 0x57, 0x54, 0x54, 0x55, 0xD5,
2676 0xAA, 0xAB, 0xA8, 0xA9, 0xAE, 0xAF, 0xAC, 0xAD,
2677 0xA2, 0xA3, 0xA0, 0xA1, 0xA6, 0xA7, 0xA4, 0xA5,
2678 0xBA, 0xBB, 0xB8, 0xB9, 0xBE, 0xBF, 0xBC, 0xBD,
2679 0xB2, 0xB3, 0xB0, 0xB1, 0xB6, 0xB7, 0xB4, 0xB5,
2680 0x8B, 0x88, 0x89, 0x8E, 0x8F, 0x8C, 0x8D, 0x82,
2681 0x83, 0x80, 0x81, 0x86, 0x87, 0x84, 0x85, 0x9A,
2682 0x9B, 0x98, 0x99, 0x9E, 0x9F, 0x9C, 0x9D, 0x92,
2683 0x93, 0x90, 0x91, 0x96, 0x97, 0x94, 0x95, 0xEB,
2684 0xE8, 0xE9, 0xEE, 0xEF, 0xEC, 0xED, 0xE2, 0xE3,
2685 0xE0, 0xE1, 0xE6, 0xE7, 0xE4, 0xE5, 0xFB, 0xF9,
2686 0xFE, 0xFF, 0xFC, 0xFD, 0xF2, 0xF3, 0xF0, 0xF1,
2687 0xF6, 0xF7, 0xF4, 0xF5, 0xCB, 0xC9, 0xCF, 0xCD,
2688 0xC2, 0xC3, 0xC0, 0xC1, 0xC6, 0xC7, 0xC4, 0xC5,
2689 0xDA, 0xDB, 0xD8, 0xD9, 0xDE, 0xDF, 0xDC, 0xDD,
2690 0xD2, 0xD2, 0xD3, 0xD3, 0xD0, 0xD0, 0xD1, 0xD1,
2691 0xD6, 0xD6, 0xD7, 0xD7, 0xD4, 0xD4, 0xD5, 0xD5
2696 *buff
= table_ulaw2alaw
[*(unsigned char *)buff
];
2701 static void alaw2ulaw(unsigned char *buff
, unsigned long len
)
2703 static unsigned char table_alaw2ulaw
[] =
2705 0x29, 0x2A, 0x27, 0x28, 0x2D, 0x2E, 0x2B, 0x2C,
2706 0x21, 0x22, 0x1F, 0x20, 0x25, 0x26, 0x23, 0x24,
2707 0x39, 0x3A, 0x37, 0x38, 0x3D, 0x3E, 0x3B, 0x3C,
2708 0x31, 0x32, 0x2F, 0x30, 0x35, 0x36, 0x33, 0x34,
2709 0x0A, 0x0B, 0x08, 0x09, 0x0E, 0x0F, 0x0C, 0x0D,
2710 0x02, 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05,
2711 0x1A, 0x1B, 0x18, 0x19, 0x1E, 0x1F, 0x1C, 0x1D,
2712 0x12, 0x13, 0x10, 0x11, 0x16, 0x17, 0x14, 0x15,
2713 0x62, 0x63, 0x60, 0x61, 0x66, 0x67, 0x64, 0x65,
2714 0x5D, 0x5D, 0x5C, 0x5C, 0x5F, 0x5F, 0x5E, 0x5E,
2715 0x74, 0x76, 0x70, 0x72, 0x7C, 0x7E, 0x78, 0x7A,
2716 0x6A, 0x6B, 0x68, 0x69, 0x6E, 0x6F, 0x6C, 0x6D,
2717 0x48, 0x49, 0x46, 0x47, 0x4C, 0x4D, 0x4A, 0x4B,
2718 0x40, 0x41, 0x3F, 0x3F, 0x44, 0x45, 0x42, 0x43,
2719 0x56, 0x57, 0x54, 0x55, 0x5A, 0x5B, 0x58, 0x59,
2720 0x4F, 0x4F, 0x4E, 0x4E, 0x52, 0x53, 0x50, 0x51,
2721 0xA9, 0xAA, 0xA7, 0xA8, 0xAD, 0xAE, 0xAB, 0xAC,
2722 0xA1, 0xA2, 0x9F, 0xA0, 0xA5, 0xA6, 0xA3, 0xA4,
2723 0xB9, 0xBA, 0xB7, 0xB8, 0xBD, 0xBE, 0xBB, 0xBC,
2724 0xB1, 0xB2, 0xAF, 0xB0, 0xB5, 0xB6, 0xB3, 0xB4,
2725 0x8A, 0x8B, 0x88, 0x89, 0x8E, 0x8F, 0x8C, 0x8D,
2726 0x82, 0x83, 0x80, 0x81, 0x86, 0x87, 0x84, 0x85,
2727 0x9A, 0x9B, 0x98, 0x99, 0x9E, 0x9F, 0x9C, 0x9D,
2728 0x92, 0x93, 0x90, 0x91, 0x96, 0x97, 0x94, 0x95,
2729 0xE2, 0xE3, 0xE0, 0xE1, 0xE6, 0xE7, 0xE4, 0xE5,
2730 0xDD, 0xDD, 0xDC, 0xDC, 0xDF, 0xDF, 0xDE, 0xDE,
2731 0xF4, 0xF6, 0xF0, 0xF2, 0xFC, 0xFE, 0xF8, 0xFA,
2732 0xEA, 0xEB, 0xE8, 0xE9, 0xEE, 0xEF, 0xEC, 0xED,
2733 0xC8, 0xC9, 0xC6, 0xC7, 0xCC, 0xCD, 0xCA, 0xCB,
2734 0xC0, 0xC1, 0xBF, 0xBF, 0xC4, 0xC5, 0xC2, 0xC3,
2735 0xD6, 0xD7, 0xD4, 0xD5, 0xDA, 0xDB, 0xD8, 0xD9,
2736 0xCF, 0xCF, 0xCE, 0xCE, 0xD2, 0xD3, 0xD0, 0xD1
2741 *buff
= table_alaw2ulaw
[*(unsigned char *)buff
];
2746 static ssize_t
ixj_read(struct file
* file_p
, char __user
*buf
, size_t length
, loff_t
* ppos
)
2748 unsigned long i
= *ppos
;
2749 IXJ
* j
= get_ixj(NUM(file_p
->f_path
.dentry
->d_inode
));
2751 DECLARE_WAITQUEUE(wait
, current
);
2753 if (j
->flags
.inread
)
2756 j
->flags
.inread
= 1;
2758 add_wait_queue(&j
->read_q
, &wait
);
2759 set_current_state(TASK_INTERRUPTIBLE
);
2762 while (!j
->read_buffer_ready
|| (j
->dtmf_state
&& j
->flags
.dtmf_oob
)) {
2764 if (file_p
->f_flags
& O_NONBLOCK
) {
2765 set_current_state(TASK_RUNNING
);
2766 remove_wait_queue(&j
->read_q
, &wait
);
2767 j
->flags
.inread
= 0;
2770 if (!ixj_hookstate(j
)) {
2771 set_current_state(TASK_RUNNING
);
2772 remove_wait_queue(&j
->read_q
, &wait
);
2773 j
->flags
.inread
= 0;
2776 interruptible_sleep_on(&j
->read_q
);
2777 if (signal_pending(current
)) {
2778 set_current_state(TASK_RUNNING
);
2779 remove_wait_queue(&j
->read_q
, &wait
);
2780 j
->flags
.inread
= 0;
2785 remove_wait_queue(&j
->read_q
, &wait
);
2786 set_current_state(TASK_RUNNING
);
2787 /* Don't ever copy more than the user asks */
2788 if(j
->rec_codec
== ALAW
)
2789 ulaw2alaw(j
->read_buffer
, min(length
, j
->read_buffer_size
));
2790 i
= copy_to_user(buf
, j
->read_buffer
, min(length
, j
->read_buffer_size
));
2791 j
->read_buffer_ready
= 0;
2793 j
->flags
.inread
= 0;
2796 j
->flags
.inread
= 0;
2797 return min(length
, j
->read_buffer_size
);
2801 static ssize_t
ixj_enhanced_read(struct file
* file_p
, char __user
*buf
, size_t length
,
2805 ssize_t read_retval
= 0;
2806 IXJ
*j
= get_ixj(NUM(file_p
->f_path
.dentry
->d_inode
));
2808 pre_retval
= ixj_PreRead(j
, 0L);
2809 switch (pre_retval
) {
2811 read_retval
= ixj_read(file_p
, buf
, length
, ppos
);
2812 ixj_PostRead(j
, 0L);
2815 read_retval
= ixj_read(file_p
, buf
, length
, ppos
);
2818 ixj_PostRead(j
, 0L);
2821 read_retval
= pre_retval
;
2826 static ssize_t
ixj_write(struct file
*file_p
, const char __user
*buf
, size_t count
, loff_t
* ppos
)
2828 unsigned long i
= *ppos
;
2829 IXJ
*j
= file_p
->private_data
;
2831 DECLARE_WAITQUEUE(wait
, current
);
2833 if (j
->flags
.inwrite
)
2836 j
->flags
.inwrite
= 1;
2838 add_wait_queue(&j
->write_q
, &wait
);
2839 set_current_state(TASK_INTERRUPTIBLE
);
2843 while (!j
->write_buffers_empty
) {
2845 if (file_p
->f_flags
& O_NONBLOCK
) {
2846 set_current_state(TASK_RUNNING
);
2847 remove_wait_queue(&j
->write_q
, &wait
);
2848 j
->flags
.inwrite
= 0;
2851 if (!ixj_hookstate(j
)) {
2852 set_current_state(TASK_RUNNING
);
2853 remove_wait_queue(&j
->write_q
, &wait
);
2854 j
->flags
.inwrite
= 0;
2857 interruptible_sleep_on(&j
->write_q
);
2858 if (signal_pending(current
)) {
2859 set_current_state(TASK_RUNNING
);
2860 remove_wait_queue(&j
->write_q
, &wait
);
2861 j
->flags
.inwrite
= 0;
2865 set_current_state(TASK_RUNNING
);
2866 remove_wait_queue(&j
->write_q
, &wait
);
2867 if (j
->write_buffer_wp
+ count
>= j
->write_buffer_end
)
2868 j
->write_buffer_wp
= j
->write_buffer
;
2869 i
= copy_from_user(j
->write_buffer_wp
, buf
, min(count
, j
->write_buffer_size
));
2871 j
->flags
.inwrite
= 0;
2874 if(j
->play_codec
== ALAW
)
2875 alaw2ulaw(j
->write_buffer_wp
, min(count
, j
->write_buffer_size
));
2876 j
->flags
.inwrite
= 0;
2877 return min(count
, j
->write_buffer_size
);
2880 static ssize_t
ixj_enhanced_write(struct file
* file_p
, const char __user
*buf
, size_t count
, loff_t
* ppos
)
2883 ssize_t write_retval
= 0;
2885 IXJ
*j
= get_ixj(NUM(file_p
->f_path
.dentry
->d_inode
));
2887 pre_retval
= ixj_PreWrite(j
, 0L);
2888 switch (pre_retval
) {
2890 write_retval
= ixj_write(file_p
, buf
, count
, ppos
);
2891 if (write_retval
> 0) {
2892 ixj_PostWrite(j
, 0L);
2893 j
->write_buffer_wp
+= write_retval
;
2894 j
->write_buffers_empty
--;
2898 write_retval
= ixj_write(file_p
, buf
, count
, ppos
);
2899 if (write_retval
> 0) {
2900 j
->write_buffer_wp
+= write_retval
;
2901 j
->write_buffers_empty
--;
2905 ixj_PostWrite(j
, 0L);
2908 write_retval
= pre_retval
;
2910 return write_retval
;
2913 static void ixj_read_frame(IXJ
*j
)
2917 if (j
->read_buffer
) {
2918 for (cnt
= 0; cnt
< j
->rec_frame_size
* 2; cnt
+= 2) {
2919 if (!(cnt
% 16) && !IsRxReady(j
)) {
2921 while (!IsRxReady(j
)) {
2929 /* Throw away word 0 of the 8021 compressed format to get standard G.729. */
2930 if (j
->rec_codec
== G729
&& (cnt
== 0 || cnt
== 10 || cnt
== 20)) {
2931 inb_p(j
->DSPbase
+ 0x0E);
2932 inb_p(j
->DSPbase
+ 0x0F);
2934 *(j
->read_buffer
+ cnt
) = inb_p(j
->DSPbase
+ 0x0E);
2935 *(j
->read_buffer
+ cnt
+ 1) = inb_p(j
->DSPbase
+ 0x0F);
2938 if (j
->intercom
!= -1) {
2939 if (IsTxReady(get_ixj(j
->intercom
))) {
2940 for (cnt
= 0; cnt
< j
->rec_frame_size
* 2; cnt
+= 2) {
2941 if (!(cnt
% 16) && !IsTxReady(j
)) {
2943 while (!IsTxReady(j
)) {
2951 outb_p(*(j
->read_buffer
+ cnt
), get_ixj(j
->intercom
)->DSPbase
+ 0x0C);
2952 outb_p(*(j
->read_buffer
+ cnt
+ 1), get_ixj(j
->intercom
)->DSPbase
+ 0x0D);
2954 get_ixj(j
->intercom
)->frameswritten
++;
2957 j
->read_buffer_ready
= 1;
2958 wake_up_interruptible(&j
->read_q
); /* Wake any blocked readers */
2960 wake_up_interruptible(&j
->poll_q
); /* Wake any blocked selects */
2962 if(j
->ixj_signals
[SIG_READ_READY
])
2963 ixj_kill_fasync(j
, SIG_READ_READY
, POLL_OUT
);
2968 static short fsk
[][6][20] =
2972 0, 17846, 29934, 32364, 24351, 8481, -10126, -25465, -32587, -29196,
2973 -16384, 1715, 19260, 30591, 32051, 23170, 6813, -11743, -26509, -32722
2976 -28377, -14876, 3425, 20621, 31163, 31650, 21925, 5126, -13328, -27481,
2977 -32767, -27481, -13328, 5126, 21925, 31650, 31163, 20621, 3425, -14876
2980 -28377, -32722, -26509, -11743, 6813, 23170, 32051, 30591, 19260, 1715,
2981 -16384, -29196, -32587, -25465, -10126, 8481, 24351, 32364, 29934, 17846
2984 0, -17846, -29934, -32364, -24351, -8481, 10126, 25465, 32587, 29196,
2985 16384, -1715, -19260, -30591, -32051, -23170, -6813, 11743, 26509, 32722
2988 28377, 14876, -3425, -20621, -31163, -31650, -21925, -5126, 13328, 27481,
2989 32767, 27481, 13328, -5126, -21925, -31650, -31163, -20621, -3425, 14876
2992 28377, 32722, 26509, 11743, -6813, -23170, -32051, -30591, -19260, -1715,
2993 16384, 29196, 32587, 25465, 10126, -8481, -24351, -32364, -29934, -17846
2998 0, 10126, 19260, 26509, 31163, 32767, 31163, 26509, 19260, 10126,
2999 0, -10126, -19260, -26509, -31163, -32767, -31163, -26509, -19260, -10126
3002 -28377, -21925, -13328, -3425, 6813, 16384, 24351, 29934, 32587, 32051,
3003 28377, 21925, 13328, 3425, -6813, -16384, -24351, -29934, -32587, -32051
3006 -28377, -32051, -32587, -29934, -24351, -16384, -6813, 3425, 13328, 21925,
3007 28377, 32051, 32587, 29934, 24351, 16384, 6813, -3425, -13328, -21925
3010 0, -10126, -19260, -26509, -31163, -32767, -31163, -26509, -19260, -10126,
3011 0, 10126, 19260, 26509, 31163, 32767, 31163, 26509, 19260, 10126
3014 28377, 21925, 13328, 3425, -6813, -16383, -24351, -29934, -32587, -32051,
3015 -28377, -21925, -13328, -3425, 6813, 16383, 24351, 29934, 32587, 32051
3018 28377, 32051, 32587, 29934, 24351, 16384, 6813, -3425, -13328, -21925,
3019 -28377, -32051, -32587, -29934, -24351, -16384, -6813, 3425, 13328, 21925
3025 static void ixj_write_cid_bit(IXJ
*j
, int bit
)
3027 while (j
->fskcnt
< 20) {
3028 if(j
->fskdcnt
< (j
->fsksize
- 1))
3029 j
->fskdata
[j
->fskdcnt
++] = fsk
[bit
][j
->fskz
][j
->fskcnt
];
3042 static void ixj_write_cid_byte(IXJ
*j
, char byte
)
3047 ixj_write_cid_bit(j
, 0);
3048 ixj_write_cid_bit(j
, cb
.cbits
.b0
? 1 : 0);
3049 ixj_write_cid_bit(j
, cb
.cbits
.b1
? 1 : 0);
3050 ixj_write_cid_bit(j
, cb
.cbits
.b2
? 1 : 0);
3051 ixj_write_cid_bit(j
, cb
.cbits
.b3
? 1 : 0);
3052 ixj_write_cid_bit(j
, cb
.cbits
.b4
? 1 : 0);
3053 ixj_write_cid_bit(j
, cb
.cbits
.b5
? 1 : 0);
3054 ixj_write_cid_bit(j
, cb
.cbits
.b6
? 1 : 0);
3055 ixj_write_cid_bit(j
, cb
.cbits
.b7
? 1 : 0);
3056 ixj_write_cid_bit(j
, 1);
3059 static void ixj_write_cid_seize(IXJ
*j
)
3063 for (cnt
= 0; cnt
< 150; cnt
++) {
3064 ixj_write_cid_bit(j
, 0);
3065 ixj_write_cid_bit(j
, 1);
3067 for (cnt
= 0; cnt
< 180; cnt
++) {
3068 ixj_write_cid_bit(j
, 1);
3072 static void ixj_write_cidcw_seize(IXJ
*j
)
3076 for (cnt
= 0; cnt
< 80; cnt
++) {
3077 ixj_write_cid_bit(j
, 1);
3081 static int ixj_write_cid_string(IXJ
*j
, char *s
, int checksum
)
3085 for (cnt
= 0; cnt
< strlen(s
); cnt
++) {
3086 ixj_write_cid_byte(j
, s
[cnt
]);
3087 checksum
= (checksum
+ s
[cnt
]);
3092 static void ixj_pad_fsk(IXJ
*j
, int pad
)
3096 for (cnt
= 0; cnt
< pad
; cnt
++) {
3097 if(j
->fskdcnt
< (j
->fsksize
- 1))
3098 j
->fskdata
[j
->fskdcnt
++] = 0x0000;
3100 for (cnt
= 0; cnt
< 720; cnt
++) {
3101 if(j
->fskdcnt
< (j
->fsksize
- 1))
3102 j
->fskdata
[j
->fskdcnt
++] = 0x0000;
3106 static void ixj_pre_cid(IXJ
*j
)
3108 j
->cid_play_codec
= j
->play_codec
;
3109 j
->cid_play_frame_size
= j
->play_frame_size
;
3110 j
->cid_play_volume
= get_play_volume(j
);
3111 j
->cid_play_flag
= j
->flags
.playing
;
3113 j
->cid_rec_codec
= j
->rec_codec
;
3114 j
->cid_rec_volume
= get_rec_volume(j
);
3115 j
->cid_rec_flag
= j
->flags
.recording
;
3117 j
->cid_play_aec_level
= j
->aec_level
;
3119 switch(j
->baseframe
.low
) {
3121 j
->cid_base_frame_size
= 20;
3124 j
->cid_base_frame_size
= 10;
3127 j
->cid_base_frame_size
= 30;
3134 j
->flags
.cidplay
= 1;
3136 set_base_frame(j
, 30);
3137 set_play_codec(j
, LINEAR16
);
3138 set_play_volume(j
, 0x1B);
3142 static void ixj_post_cid(IXJ
*j
)
3146 if(j
->cidsize
> 5000) {
3147 SLIC_SetState(PLD_SLIC_STATE_STANDBY
, j
);
3149 j
->flags
.cidplay
= 0;
3150 if(ixjdebug
& 0x0200) {
3151 printk("IXJ phone%d Finished Playing CallerID data %ld\n", j
->board
, jiffies
);
3157 set_base_frame(j
, j
->cid_base_frame_size
);
3158 set_play_codec(j
, j
->cid_play_codec
);
3159 ixj_aec_start(j
, j
->cid_play_aec_level
);
3160 set_play_volume(j
, j
->cid_play_volume
);
3162 set_rec_codec(j
, j
->cid_rec_codec
);
3163 set_rec_volume(j
, j
->cid_rec_volume
);
3166 ixj_record_start(j
);
3168 if(j
->cid_play_flag
)
3171 if(j
->cid_play_flag
) {
3172 wake_up_interruptible(&j
->write_q
); /* Wake any blocked writers */
3176 static void ixj_write_cid(IXJ
*j
)
3181 char mdmflen
, len1
, len2
, len3
;
3186 if (j
->dsp
.low
== 0x20 || j
->flags
.cidplay
)
3189 j
->fskz
= j
->fskphase
= j
->fskcnt
= j
->fskdcnt
= 0;
3190 j
->cidsize
= j
->cidcnt
= 0;
3194 strcpy(sdmf1
, j
->cid_send
.month
);
3195 strcat(sdmf1
, j
->cid_send
.day
);
3196 strcat(sdmf1
, j
->cid_send
.hour
);
3197 strcat(sdmf1
, j
->cid_send
.min
);
3198 strcpy(sdmf2
, j
->cid_send
.number
);
3199 strcpy(sdmf3
, j
->cid_send
.name
);
3201 len1
= strlen(sdmf1
);
3202 len2
= strlen(sdmf2
);
3203 len3
= strlen(sdmf3
);
3204 mdmflen
= len1
+ len2
+ len3
+ 6;
3207 ixj_write_cid_seize(j
);
3209 ixj_write_cid_byte(j
, 0x80);
3211 ixj_write_cid_byte(j
, mdmflen
);
3212 checksum
= checksum
+ mdmflen
;
3214 ixj_write_cid_byte(j
, 0x01);
3215 checksum
= checksum
+ 0x01;
3216 ixj_write_cid_byte(j
, len1
);
3217 checksum
= checksum
+ len1
;
3218 checksum
= ixj_write_cid_string(j
, sdmf1
, checksum
);
3219 if(ixj_hookstate(j
) & 1)
3222 ixj_write_cid_byte(j
, 0x02);
3223 checksum
= checksum
+ 0x02;
3224 ixj_write_cid_byte(j
, len2
);
3225 checksum
= checksum
+ len2
;
3226 checksum
= ixj_write_cid_string(j
, sdmf2
, checksum
);
3227 if(ixj_hookstate(j
) & 1)
3230 ixj_write_cid_byte(j
, 0x07);
3231 checksum
= checksum
+ 0x07;
3232 ixj_write_cid_byte(j
, len3
);
3233 checksum
= checksum
+ len3
;
3234 checksum
= ixj_write_cid_string(j
, sdmf3
, checksum
);
3235 if(ixj_hookstate(j
) & 1)
3242 ixj_write_cid_byte(j
, (char) checksum
);
3244 pad
= j
->fskdcnt
% 240;
3248 ixj_pad_fsk(j
, pad
);
3255 static void ixj_write_cidcw(IXJ
*j
)
3262 char mdmflen
, len1
, len2
, len3
;
3267 if (j
->dsp
.low
== 0x20 || j
->flags
.cidplay
)
3270 j
->fskz
= j
->fskphase
= j
->fskcnt
= j
->fskdcnt
= 0;
3271 j
->cidsize
= j
->cidcnt
= 0;
3275 j
->flags
.cidcw_ack
= 0;
3282 ixj_init_tone(j
, &ti
);
3284 ixj_set_tone_on(1500, j
);
3285 ixj_set_tone_off(32, j
);
3286 if(ixjdebug
& 0x0200) {
3287 printk("IXJ cidcw phone%d first tone start at %ld\n", j
->board
, jiffies
);
3289 ixj_play_tone(j
, 23);
3291 clear_bit(j
->board
, &j
->busyflags
);
3292 while(j
->tone_state
)
3293 schedule_timeout_interruptible(1);
3294 while(test_and_set_bit(j
->board
, (void *)&j
->busyflags
) != 0)
3295 schedule_timeout_interruptible(1);
3296 if(ixjdebug
& 0x0200) {
3297 printk("IXJ cidcw phone%d first tone end at %ld\n", j
->board
, jiffies
);
3305 ixj_init_tone(j
, &ti
);
3307 ixj_set_tone_off(10, j
);
3308 ixj_set_tone_on(600, j
);
3309 if(ixjdebug
& 0x0200) {
3310 printk("IXJ cidcw phone%d second tone start at %ld\n", j
->board
, jiffies
);
3312 ixj_play_tone(j
, 24);
3314 clear_bit(j
->board
, &j
->busyflags
);
3315 while(j
->tone_state
)
3316 schedule_timeout_interruptible(1);
3317 while(test_and_set_bit(j
->board
, (void *)&j
->busyflags
) != 0)
3318 schedule_timeout_interruptible(1);
3319 if(ixjdebug
& 0x0200) {
3320 printk("IXJ cidcw phone%d sent second tone at %ld\n", j
->board
, jiffies
);
3323 j
->cidcw_wait
= jiffies
+ ((50 * hertz
) / 100);
3325 clear_bit(j
->board
, &j
->busyflags
);
3326 while(!j
->flags
.cidcw_ack
&& time_before(jiffies
, j
->cidcw_wait
))
3327 schedule_timeout_interruptible(1);
3328 while(test_and_set_bit(j
->board
, (void *)&j
->busyflags
) != 0)
3329 schedule_timeout_interruptible(1);
3331 if(!j
->flags
.cidcw_ack
) {
3332 if(ixjdebug
& 0x0200) {
3333 printk("IXJ cidcw phone%d did not receive ACK from display %ld\n", j
->board
, jiffies
);
3336 if(j
->cid_play_flag
) {
3337 wake_up_interruptible(&j
->write_q
); /* Wake any blocked readers */
3343 j
->flags
.cidcw_ack
= 0;
3344 strcpy(sdmf1
, j
->cid_send
.month
);
3345 strcat(sdmf1
, j
->cid_send
.day
);
3346 strcat(sdmf1
, j
->cid_send
.hour
);
3347 strcat(sdmf1
, j
->cid_send
.min
);
3348 strcpy(sdmf2
, j
->cid_send
.number
);
3349 strcpy(sdmf3
, j
->cid_send
.name
);
3351 len1
= strlen(sdmf1
);
3352 len2
= strlen(sdmf2
);
3353 len3
= strlen(sdmf3
);
3354 mdmflen
= len1
+ len2
+ len3
+ 6;
3356 ixj_write_cidcw_seize(j
);
3358 ixj_write_cid_byte(j
, 0x80);
3360 ixj_write_cid_byte(j
, mdmflen
);
3361 checksum
= checksum
+ mdmflen
;
3363 ixj_write_cid_byte(j
, 0x01);
3364 checksum
= checksum
+ 0x01;
3365 ixj_write_cid_byte(j
, len1
);
3366 checksum
= checksum
+ len1
;
3367 checksum
= ixj_write_cid_string(j
, sdmf1
, checksum
);
3369 ixj_write_cid_byte(j
, 0x02);
3370 checksum
= checksum
+ 0x02;
3371 ixj_write_cid_byte(j
, len2
);
3372 checksum
= checksum
+ len2
;
3373 checksum
= ixj_write_cid_string(j
, sdmf2
, checksum
);
3375 ixj_write_cid_byte(j
, 0x07);
3376 checksum
= checksum
+ 0x07;
3377 ixj_write_cid_byte(j
, len3
);
3378 checksum
= checksum
+ len3
;
3379 checksum
= ixj_write_cid_string(j
, sdmf3
, checksum
);
3385 ixj_write_cid_byte(j
, (char) checksum
);
3387 pad
= j
->fskdcnt
% 240;
3391 ixj_pad_fsk(j
, pad
);
3392 if(ixjdebug
& 0x0200) {
3393 printk("IXJ cidcw phone%d sent FSK data at %ld\n", j
->board
, jiffies
);
3397 static void ixj_write_vmwi(IXJ
*j
, int msg
)
3404 if (j
->dsp
.low
== 0x20 || j
->flags
.cidplay
)
3407 j
->fskz
= j
->fskphase
= j
->fskcnt
= j
->fskdcnt
= 0;
3408 j
->cidsize
= j
->cidcnt
= 0;
3414 if (j
->port
== PORT_POTS
)
3415 SLIC_SetState(PLD_SLIC_STATE_OHT
, j
);
3417 ixj_write_cid_seize(j
);
3419 ixj_write_cid_byte(j
, 0x82);
3421 ixj_write_cid_byte(j
, mdmflen
);
3422 checksum
= checksum
+ mdmflen
;
3424 ixj_write_cid_byte(j
, 0x0B);
3425 checksum
= checksum
+ 0x0B;
3426 ixj_write_cid_byte(j
, 1);
3427 checksum
= checksum
+ 1;
3430 ixj_write_cid_byte(j
, 0xFF);
3431 checksum
= checksum
+ 0xFF;
3434 ixj_write_cid_byte(j
, 0x00);
3435 checksum
= checksum
+ 0x00;
3442 ixj_write_cid_byte(j
, (char) checksum
);
3444 pad
= j
->fskdcnt
% 240;
3448 ixj_pad_fsk(j
, pad
);
3451 static void ixj_write_frame(IXJ
*j
)
3453 int cnt
, frame_count
, dly
;
3457 if(j
->flags
.cidplay
) {
3458 for(cnt
= 0; cnt
< 480; cnt
++) {
3459 if (!(cnt
% 16) && !IsTxReady(j
)) {
3461 while (!IsTxReady(j
)) {
3469 dat
.word
= j
->fskdata
[j
->cidcnt
++];
3470 outb_p(dat
.bytes
.low
, j
->DSPbase
+ 0x0C);
3471 outb_p(dat
.bytes
.high
, j
->DSPbase
+ 0x0D);
3474 if(j
->cidcnt
>= j
->fskdcnt
) {
3477 /* This may seem rude, but if we just played one frame of FSK data for CallerID
3478 and there is real audio data in the buffer, we need to throw it away because
3479 we just used it's time slot */
3480 if (j
->write_buffer_rp
> j
->write_buffer_wp
) {
3481 j
->write_buffer_rp
+= j
->cid_play_frame_size
* 2;
3482 if (j
->write_buffer_rp
>= j
->write_buffer_end
) {
3483 j
->write_buffer_rp
= j
->write_buffer
;
3485 j
->write_buffers_empty
++;
3486 wake_up_interruptible(&j
->write_q
); /* Wake any blocked writers */
3488 wake_up_interruptible(&j
->poll_q
); /* Wake any blocked selects */
3490 } else if (j
->write_buffer
&& j
->write_buffers_empty
< 1) {
3491 if (j
->write_buffer_wp
> j
->write_buffer_rp
) {
3493 (j
->write_buffer_wp
- j
->write_buffer_rp
) / (j
->play_frame_size
* 2);
3495 if (j
->write_buffer_rp
> j
->write_buffer_wp
) {
3497 (j
->write_buffer_wp
- j
->write_buffer
) / (j
->play_frame_size
* 2) +
3498 (j
->write_buffer_end
- j
->write_buffer_rp
) / (j
->play_frame_size
* 2);
3500 if (frame_count
>= 1) {
3501 if (j
->ver
.low
== 0x12 && j
->play_mode
&& j
->flags
.play_first_frame
) {
3504 switch (j
->play_mode
) {
3505 case PLAYBACK_MODE_ULAW
:
3506 case PLAYBACK_MODE_ALAW
:
3507 blankword
.low
= blankword
.high
= 0xFF;
3509 case PLAYBACK_MODE_8LINEAR
:
3510 case PLAYBACK_MODE_16LINEAR
:
3512 blankword
.low
= blankword
.high
= 0x00;
3514 case PLAYBACK_MODE_8LINEAR_WSS
:
3515 blankword
.low
= blankword
.high
= 0x80;
3518 for (cnt
= 0; cnt
< 16; cnt
++) {
3519 if (!(cnt
% 16) && !IsTxReady(j
)) {
3521 while (!IsTxReady(j
)) {
3529 outb_p((blankword
.low
), j
->DSPbase
+ 0x0C);
3530 outb_p((blankword
.high
), j
->DSPbase
+ 0x0D);
3532 j
->flags
.play_first_frame
= 0;
3533 } else if (j
->play_codec
== G723_63
&& j
->flags
.play_first_frame
) {
3534 for (cnt
= 0; cnt
< 24; cnt
++) {
3538 blankword
.low
= 0x02;
3539 blankword
.high
= 0x00;
3542 blankword
.low
= blankword
.high
= 0x00;
3544 if (!(cnt
% 16) && !IsTxReady(j
)) {
3546 while (!IsTxReady(j
)) {
3554 outb_p((blankword
.low
), j
->DSPbase
+ 0x0C);
3555 outb_p((blankword
.high
), j
->DSPbase
+ 0x0D);
3557 j
->flags
.play_first_frame
= 0;
3559 for (cnt
= 0; cnt
< j
->play_frame_size
* 2; cnt
+= 2) {
3560 if (!(cnt
% 16) && !IsTxReady(j
)) {
3562 while (!IsTxReady(j
)) {
3570 /* Add word 0 to G.729 frames for the 8021. Right now we don't do VAD/CNG */
3571 if (j
->play_codec
== G729
&& (cnt
== 0 || cnt
== 10 || cnt
== 20)) {
3572 if (j
->write_buffer_rp
[cnt
] == 0 &&
3573 j
->write_buffer_rp
[cnt
+ 1] == 0 &&
3574 j
->write_buffer_rp
[cnt
+ 2] == 0 &&
3575 j
->write_buffer_rp
[cnt
+ 3] == 0 &&
3576 j
->write_buffer_rp
[cnt
+ 4] == 0 &&
3577 j
->write_buffer_rp
[cnt
+ 5] == 0 &&
3578 j
->write_buffer_rp
[cnt
+ 6] == 0 &&
3579 j
->write_buffer_rp
[cnt
+ 7] == 0 &&
3580 j
->write_buffer_rp
[cnt
+ 8] == 0 &&
3581 j
->write_buffer_rp
[cnt
+ 9] == 0) {
3582 /* someone is trying to write silence lets make this a type 0 frame. */
3583 outb_p(0x00, j
->DSPbase
+ 0x0C);
3584 outb_p(0x00, j
->DSPbase
+ 0x0D);
3586 /* so all other frames are type 1. */
3587 outb_p(0x01, j
->DSPbase
+ 0x0C);
3588 outb_p(0x00, j
->DSPbase
+ 0x0D);
3591 outb_p(*(j
->write_buffer_rp
+ cnt
), j
->DSPbase
+ 0x0C);
3592 outb_p(*(j
->write_buffer_rp
+ cnt
+ 1), j
->DSPbase
+ 0x0D);
3593 *(j
->write_buffer_rp
+ cnt
) = 0;
3594 *(j
->write_buffer_rp
+ cnt
+ 1) = 0;
3596 j
->write_buffer_rp
+= j
->play_frame_size
* 2;
3597 if (j
->write_buffer_rp
>= j
->write_buffer_end
) {
3598 j
->write_buffer_rp
= j
->write_buffer
;
3600 j
->write_buffers_empty
++;
3601 wake_up_interruptible(&j
->write_q
); /* Wake any blocked writers */
3603 wake_up_interruptible(&j
->poll_q
); /* Wake any blocked selects */
3610 if(j
->ixj_signals
[SIG_WRITE_READY
]) {
3611 ixj_kill_fasync(j
, SIG_WRITE_READY
, POLL_OUT
);
3615 static int idle(IXJ
*j
)
3617 if (ixj_WriteDSPCommand(0x0000, j
)) /* DSP Idle */
3621 if (j
->ssr
.high
|| j
->ssr
.low
) {
3625 j
->flags
.playing
= 0;
3627 j
->flags
.recording
= 0;
3632 static int set_base_frame(IXJ
*j
, int size
)
3638 j
->cid_play_aec_level
= j
->aec_level
;
3640 for (cnt
= 0; cnt
< 10; cnt
++) {
3644 if (j
->ssr
.high
|| j
->ssr
.low
)
3646 if (j
->dsp
.low
!= 0x20) {
3650 /* Set Base Frame Size to 240 pg9-10 8021 */
3654 /* Set Base Frame Size to 160 pg9-10 8021 */
3658 /* Set Base Frame Size to 80 pg9-10 8021 */
3669 if (ixj_WriteDSPCommand(cmd
, j
)) {
3670 j
->baseframe
.high
= j
->baseframe
.low
= 0xFF;
3673 j
->baseframe
.high
= j
->ssr
.high
;
3674 j
->baseframe
.low
= j
->ssr
.low
;
3675 /* If the status returned is 0x0000 (pg9-9 8021) the call failed */
3676 if(j
->baseframe
.high
== 0x00 && j
->baseframe
.low
== 0x00) {
3680 ixj_aec_start(j
, j
->cid_play_aec_level
);
3684 static int set_rec_codec(IXJ
*j
, int rate
)
3688 j
->rec_codec
= rate
;
3692 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
3693 j
->rec_frame_size
= 12;
3700 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
3701 j
->rec_frame_size
= 10;
3708 if (j
->dsp
.low
== 0x20 || j
->flags
.ts85_loaded
) {
3709 j
->rec_frame_size
= 16;
3716 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
3717 j
->rec_frame_size
= 9;
3724 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
3725 j
->rec_frame_size
= 8;
3732 if (j
->dsp
.low
!= 0x20) {
3733 j
->rec_frame_size
= 48;
3740 if (j
->dsp
.low
!= 0x20) {
3741 if (!j
->flags
.g729_loaded
) {
3745 switch (j
->baseframe
.low
) {
3747 j
->rec_frame_size
= 10;
3750 j
->rec_frame_size
= 5;
3753 j
->rec_frame_size
= 15;
3762 if (j
->dsp
.low
!= 0x20) {
3763 if (!j
->flags
.g729_loaded
) {
3767 switch (j
->baseframe
.low
) {
3769 j
->rec_frame_size
= 12;
3772 j
->rec_frame_size
= 6;
3775 j
->rec_frame_size
= 18;
3784 switch (j
->baseframe
.low
) {
3786 j
->rec_frame_size
= 80;
3789 j
->rec_frame_size
= 40;
3792 j
->rec_frame_size
= 120;
3798 switch (j
->baseframe
.low
) {
3800 j
->rec_frame_size
= 80;
3803 j
->rec_frame_size
= 40;
3806 j
->rec_frame_size
= 120;
3812 switch (j
->baseframe
.low
) {
3814 j
->rec_frame_size
= 160;
3817 j
->rec_frame_size
= 80;
3820 j
->rec_frame_size
= 240;
3826 switch (j
->baseframe
.low
) {
3828 j
->rec_frame_size
= 80;
3831 j
->rec_frame_size
= 40;
3834 j
->rec_frame_size
= 120;
3840 switch (j
->baseframe
.low
) {
3842 j
->rec_frame_size
= 80;
3845 j
->rec_frame_size
= 40;
3848 j
->rec_frame_size
= 120;
3854 kfree(j
->read_buffer
);
3855 j
->rec_frame_size
= 0;
3857 j
->read_buffer
= NULL
;
3858 j
->read_buffer_size
= 0;
3865 static int ixj_record_start(IXJ
*j
)
3867 unsigned short cmd
= 0x0000;
3869 if (j
->read_buffer
) {
3872 j
->flags
.recording
= 1;
3873 ixj_WriteDSPCommand(0x0FE0, j
); /* Put the DSP in full power mode. */
3875 if(ixjdebug
& 0x0002)
3876 printk("IXJ %d Starting Record Codec %d at %ld\n", j
->board
, j
->rec_codec
, jiffies
);
3879 switch (j
->rec_codec
) {
3887 cmd
= 0x5130; /* TrueSpeech 8.5 */
3891 cmd
= 0x5133; /* TrueSpeech 4.8 */
3895 cmd
= 0x5134; /* TrueSpeech 4.1 */
3908 if (ixj_WriteDSPCommand(cmd
, j
))
3911 if (!j
->read_buffer
) {
3912 if (!j
->read_buffer
)
3913 j
->read_buffer
= kmalloc(j
->rec_frame_size
* 2, GFP_ATOMIC
);
3914 if (!j
->read_buffer
) {
3915 printk("Read buffer allocation for ixj board %d failed!\n", j
->board
);
3919 j
->read_buffer_size
= j
->rec_frame_size
* 2;
3921 if (ixj_WriteDSPCommand(0x5102, j
)) /* Set Poll sync mode */
3925 switch (j
->rec_mode
) {
3927 cmd
= 0x1C03; /* Record C1 */
3931 if (j
->ver
.low
== 0x12) {
3932 cmd
= 0x1E03; /* Record C1 */
3935 cmd
= 0x1E01; /* Record C1 */
3940 if (j
->ver
.low
== 0x12) {
3941 cmd
= 0x1E83; /* Record C1 */
3944 cmd
= 0x1E81; /* Record C1 */
3949 if (j
->ver
.low
== 0x12) {
3950 cmd
= 0x1F03; /* Record C1 */
3953 cmd
= 0x1F01; /* Record C1 */
3958 if (j
->ver
.low
== 0x12) {
3959 cmd
= 0x1F83; /* Record C1 */
3961 cmd
= 0x1F81; /* Record C1 */
3965 if (ixj_WriteDSPCommand(cmd
, j
))
3968 if (j
->flags
.playing
) {
3969 ixj_aec_start(j
, j
->aec_level
);
3974 static void ixj_record_stop(IXJ
*j
)
3976 if (ixjdebug
& 0x0002)
3977 printk("IXJ %d Stopping Record Codec %d at %ld\n", j
->board
, j
->rec_codec
, jiffies
);
3979 kfree(j
->read_buffer
);
3980 j
->read_buffer
= NULL
;
3981 j
->read_buffer_size
= 0;
3982 if (j
->rec_mode
> -1) {
3983 ixj_WriteDSPCommand(0x5120, j
);
3986 j
->flags
.recording
= 0;
3988 static void ixj_vad(IXJ
*j
, int arg
)
3991 ixj_WriteDSPCommand(0x513F, j
);
3993 ixj_WriteDSPCommand(0x513E, j
);
3996 static void set_rec_depth(IXJ
*j
, int depth
)
4002 ixj_WriteDSPCommand(0x5180 + depth
, j
);
4005 static void set_dtmf_prescale(IXJ
*j
, int volume
)
4007 ixj_WriteDSPCommand(0xCF07, j
);
4008 ixj_WriteDSPCommand(volume
, j
);
4011 static int get_dtmf_prescale(IXJ
*j
)
4013 ixj_WriteDSPCommand(0xCF05, j
);
4014 return j
->ssr
.high
<< 8 | j
->ssr
.low
;
4017 static void set_rec_volume(IXJ
*j
, int volume
)
4019 if(j
->aec_level
== AEC_AGC
) {
4020 if (ixjdebug
& 0x0002)
4021 printk(KERN_INFO
"IXJ: /dev/phone%d Setting AGC Threshold to 0x%4.4x\n", j
->board
, volume
);
4022 ixj_WriteDSPCommand(0xCF96, j
);
4023 ixj_WriteDSPCommand(volume
, j
);
4025 if (ixjdebug
& 0x0002)
4026 printk(KERN_INFO
"IXJ: /dev/phone %d Setting Record Volume to 0x%4.4x\n", j
->board
, volume
);
4027 ixj_WriteDSPCommand(0xCF03, j
);
4028 ixj_WriteDSPCommand(volume
, j
);
4032 static int set_rec_volume_linear(IXJ
*j
, int volume
)
4034 int newvolume
, dsprecmax
;
4036 if (ixjdebug
& 0x0002)
4037 printk(KERN_INFO
"IXJ: /dev/phone %d Setting Linear Record Volume to 0x%4.4x\n", j
->board
, volume
);
4038 if(volume
> 100 || volume
< 0) {
4042 /* This should normalize the perceived volumes between the different cards caused by differences in the hardware */
4043 switch (j
->cardtype
) {
4049 ixj_mixer(0x0203, j
); /*Voice Left Volume unmute 6db */
4050 ixj_mixer(0x0303, j
); /*Voice Right Volume unmute 6db */
4051 ixj_mixer(0x0C00, j
); /*Mono1 unmute 12db */
4053 case QTI_PHONEJACK_LITE
:
4056 case QTI_PHONEJACK_PCI
:
4065 newvolume
= (dsprecmax
* volume
) / 100;
4066 set_rec_volume(j
, newvolume
);
4070 static int get_rec_volume(IXJ
*j
)
4072 if(j
->aec_level
== AEC_AGC
) {
4073 if (ixjdebug
& 0x0002)
4074 printk(KERN_INFO
"Getting AGC Threshold\n");
4075 ixj_WriteDSPCommand(0xCF86, j
);
4076 if (ixjdebug
& 0x0002)
4077 printk(KERN_INFO
"AGC Threshold is 0x%2.2x%2.2x\n", j
->ssr
.high
, j
->ssr
.low
);
4078 return j
->ssr
.high
<< 8 | j
->ssr
.low
;
4080 if (ixjdebug
& 0x0002)
4081 printk(KERN_INFO
"Getting Record Volume\n");
4082 ixj_WriteDSPCommand(0xCF01, j
);
4083 return j
->ssr
.high
<< 8 | j
->ssr
.low
;
4087 static int get_rec_volume_linear(IXJ
*j
)
4089 int volume
, newvolume
, dsprecmax
;
4091 switch (j
->cardtype
) {
4098 case QTI_PHONEJACK_LITE
:
4101 case QTI_PHONEJACK_PCI
:
4110 volume
= get_rec_volume(j
);
4111 newvolume
= (volume
* 100) / dsprecmax
;
4117 static int get_rec_level(IXJ
*j
)
4121 ixj_WriteDSPCommand(0xCF88, j
);
4123 retval
= j
->ssr
.high
<< 8 | j
->ssr
.low
;
4124 retval
= (retval
* 256) / 240;
4128 static void ixj_aec_start(IXJ
*j
, int level
)
4130 j
->aec_level
= level
;
4131 if (ixjdebug
& 0x0002)
4132 printk(KERN_INFO
"AGC set = 0x%2.2x\n", j
->aec_level
);
4136 if (j
->rec_codec
== G729
|| j
->play_codec
== G729
|| j
->rec_codec
== G729B
|| j
->play_codec
== G729B
) {
4137 ixj_WriteDSPCommand(0xE022, j
); /* Move AEC filter buffer */
4139 ixj_WriteDSPCommand(0x0300, j
);
4141 ixj_WriteDSPCommand(0xB001, j
); /* AEC On */
4143 ixj_WriteDSPCommand(0xE013, j
); /* Advanced AEC C1 */
4147 ixj_WriteDSPCommand(0x0000, j
); /* Advanced AEC C2 = off */
4149 ixj_WriteDSPCommand(0xE011, j
);
4150 ixj_WriteDSPCommand(0xFFFF, j
);
4152 ixj_WriteDSPCommand(0xCF97, j
); /* Set AGC Enable */
4153 ixj_WriteDSPCommand(0x0000, j
); /* to off */
4158 ixj_WriteDSPCommand(0x0600, j
); /* Advanced AEC C2 = on medium */
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 ixj_WriteDSPCommand(0x0C00, j
); /* Advanced AEC C2 = on high */
4171 ixj_WriteDSPCommand(0xE011, j
);
4172 ixj_WriteDSPCommand(0x0080, j
);
4174 ixj_WriteDSPCommand(0xCF97, j
); /* Set AGC Enable */
4175 ixj_WriteDSPCommand(0x0000, j
); /* to off */
4180 /* First we have to put the AEC into advance auto mode so that AGC will not conflict with it */
4181 ixj_WriteDSPCommand(0x0002, j
); /* Attenuation scaling factor of 2 */
4183 ixj_WriteDSPCommand(0xE011, j
);
4184 ixj_WriteDSPCommand(0x0100, j
); /* Higher Threshold Floor */
4186 ixj_WriteDSPCommand(0xE012, j
); /* Set Train and Lock */
4188 if(j
->cardtype
== QTI_LINEJACK
|| j
->cardtype
== QTI_PHONECARD
)
4189 ixj_WriteDSPCommand(0x0224, j
);
4191 ixj_WriteDSPCommand(0x1224, j
);
4193 ixj_WriteDSPCommand(0xE014, j
);
4194 ixj_WriteDSPCommand(0x0003, j
); /* Lock threshold at 3dB */
4196 ixj_WriteDSPCommand(0xE338, j
); /* Set Echo Suppresser Attenuation to 0dB */
4198 /* Now we can set the AGC initial parameters and turn it on */
4199 ixj_WriteDSPCommand(0xCF90, j
); /* Set AGC Minumum gain */
4200 ixj_WriteDSPCommand(0x0020, j
); /* to 0.125 (-18dB) */
4202 ixj_WriteDSPCommand(0xCF91, j
); /* Set AGC Maximum gain */
4203 ixj_WriteDSPCommand(0x1000, j
); /* to 16 (24dB) */
4205 ixj_WriteDSPCommand(0xCF92, j
); /* Set AGC start gain */
4206 ixj_WriteDSPCommand(0x0800, j
); /* to 8 (+18dB) */
4208 ixj_WriteDSPCommand(0xCF93, j
); /* Set AGC hold time */
4209 ixj_WriteDSPCommand(0x1F40, j
); /* to 2 seconds (units are 250us) */
4211 ixj_WriteDSPCommand(0xCF94, j
); /* Set AGC Attack Time Constant */
4212 ixj_WriteDSPCommand(0x0005, j
); /* to 8ms */
4214 ixj_WriteDSPCommand(0xCF95, j
); /* Set AGC Decay Time Constant */
4215 ixj_WriteDSPCommand(0x000D, j
); /* to 4096ms */
4217 ixj_WriteDSPCommand(0xCF96, j
); /* Set AGC Attack Threshold */
4218 ixj_WriteDSPCommand(0x1200, j
); /* to 25% */
4220 ixj_WriteDSPCommand(0xCF97, j
); /* Set AGC Enable */
4221 ixj_WriteDSPCommand(0x0001, j
); /* to on */
4226 ixj_WriteDSPCommand(0x0002, j
); /* Attenuation scaling factor of 2 */
4228 ixj_WriteDSPCommand(0xE011, j
);
4229 ixj_WriteDSPCommand(0x0100, j
); /* Higher Threshold Floor */
4231 ixj_WriteDSPCommand(0xE012, j
); /* Set Train and Lock */
4233 if(j
->cardtype
== QTI_LINEJACK
|| j
->cardtype
== QTI_PHONECARD
)
4234 ixj_WriteDSPCommand(0x0224, j
);
4236 ixj_WriteDSPCommand(0x1224, j
);
4238 ixj_WriteDSPCommand(0xE014, j
);
4239 ixj_WriteDSPCommand(0x0003, j
); /* Lock threshold at 3dB */
4241 ixj_WriteDSPCommand(0xE338, j
); /* Set Echo Suppresser Attenuation to 0dB */
4248 static void aec_stop(IXJ
*j
)
4250 j
->aec_level
= AEC_OFF
;
4251 if (j
->rec_codec
== G729
|| j
->play_codec
== G729
|| j
->rec_codec
== G729B
|| j
->play_codec
== G729B
) {
4252 ixj_WriteDSPCommand(0xE022, j
); /* Move AEC filter buffer back */
4254 ixj_WriteDSPCommand(0x0700, j
);
4256 if (j
->play_mode
!= -1 && j
->rec_mode
!= -1)
4258 ixj_WriteDSPCommand(0xB002, j
); /* AEC Stop */
4262 static int set_play_codec(IXJ
*j
, int rate
)
4266 j
->play_codec
= rate
;
4270 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
4271 j
->play_frame_size
= 12;
4278 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
4279 j
->play_frame_size
= 10;
4286 if (j
->dsp
.low
== 0x20 || j
->flags
.ts85_loaded
) {
4287 j
->play_frame_size
= 16;
4294 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
4295 j
->play_frame_size
= 9;
4302 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
4303 j
->play_frame_size
= 8;
4310 if (j
->dsp
.low
!= 0x20) {
4311 j
->play_frame_size
= 48;
4318 if (j
->dsp
.low
!= 0x20) {
4319 if (!j
->flags
.g729_loaded
) {
4323 switch (j
->baseframe
.low
) {
4325 j
->play_frame_size
= 10;
4328 j
->play_frame_size
= 5;
4331 j
->play_frame_size
= 15;
4340 if (j
->dsp
.low
!= 0x20) {
4341 if (!j
->flags
.g729_loaded
) {
4345 switch (j
->baseframe
.low
) {
4347 j
->play_frame_size
= 12;
4350 j
->play_frame_size
= 6;
4353 j
->play_frame_size
= 18;
4362 switch (j
->baseframe
.low
) {
4364 j
->play_frame_size
= 80;
4367 j
->play_frame_size
= 40;
4370 j
->play_frame_size
= 120;
4376 switch (j
->baseframe
.low
) {
4378 j
->play_frame_size
= 80;
4381 j
->play_frame_size
= 40;
4384 j
->play_frame_size
= 120;
4390 switch (j
->baseframe
.low
) {
4392 j
->play_frame_size
= 160;
4395 j
->play_frame_size
= 80;
4398 j
->play_frame_size
= 240;
4404 switch (j
->baseframe
.low
) {
4406 j
->play_frame_size
= 80;
4409 j
->play_frame_size
= 40;
4412 j
->play_frame_size
= 120;
4418 switch (j
->baseframe
.low
) {
4420 j
->play_frame_size
= 80;
4423 j
->play_frame_size
= 40;
4426 j
->play_frame_size
= 120;
4432 kfree(j
->write_buffer
);
4433 j
->play_frame_size
= 0;
4435 j
->write_buffer
= NULL
;
4436 j
->write_buffer_size
= 0;
4443 static int ixj_play_start(IXJ
*j
)
4445 unsigned short cmd
= 0x0000;
4447 if (j
->write_buffer
) {
4451 if(ixjdebug
& 0x0002)
4452 printk("IXJ %d Starting Play Codec %d at %ld\n", j
->board
, j
->play_codec
, jiffies
);
4454 j
->flags
.playing
= 1;
4455 ixj_WriteDSPCommand(0x0FE0, j
); /* Put the DSP in full power mode. */
4457 j
->flags
.play_first_frame
= 1;
4460 if (!j
->play_mode
) {
4461 switch (j
->play_codec
) {
4469 cmd
= 0x5230; /* TrueSpeech 8.5 */
4473 cmd
= 0x5233; /* TrueSpeech 4.8 */
4477 cmd
= 0x5234; /* TrueSpeech 4.1 */
4490 if (ixj_WriteDSPCommand(cmd
, j
))
4493 j
->write_buffer
= kmalloc(j
->play_frame_size
* 2, GFP_ATOMIC
);
4494 if (!j
->write_buffer
) {
4495 printk("Write buffer allocation for ixj board %d failed!\n", j
->board
);
4498 /* j->write_buffers_empty = 2; */
4499 j
->write_buffers_empty
= 1;
4500 j
->write_buffer_size
= j
->play_frame_size
* 2;
4501 j
->write_buffer_end
= j
->write_buffer
+ j
->play_frame_size
* 2;
4502 j
->write_buffer_rp
= j
->write_buffer_wp
= j
->write_buffer
;
4504 if (ixj_WriteDSPCommand(0x5202, j
)) /* Set Poll sync mode */
4508 switch (j
->play_mode
) {
4513 if (j
->ver
.low
== 0x12) {
4520 if (j
->ver
.low
== 0x12) {
4527 if (j
->ver
.low
== 0x12) {
4534 if (j
->ver
.low
== 0x12) {
4541 if (ixj_WriteDSPCommand(cmd
, j
))
4544 if (ixj_WriteDSPCommand(0x2000, j
)) /* Playback C2 */
4547 if (ixj_WriteDSPCommand(0x2000 + j
->play_frame_size
, j
)) /* Playback C3 */
4550 if (j
->flags
.recording
) {
4551 ixj_aec_start(j
, j
->aec_level
);
4557 static void ixj_play_stop(IXJ
*j
)
4559 if (ixjdebug
& 0x0002)
4560 printk("IXJ %d Stopping Play Codec %d at %ld\n", j
->board
, j
->play_codec
, jiffies
);
4562 kfree(j
->write_buffer
);
4563 j
->write_buffer
= NULL
;
4564 j
->write_buffer_size
= 0;
4565 if (j
->play_mode
> -1) {
4566 ixj_WriteDSPCommand(0x5221, j
); /* Stop playback and flush buffers. 8022 reference page 9-40 */
4570 j
->flags
.playing
= 0;
4573 static inline int get_play_level(IXJ
*j
)
4577 ixj_WriteDSPCommand(0xCF8F, j
); /* 8022 Reference page 9-38 */
4578 return j
->ssr
.high
<< 8 | j
->ssr
.low
;
4579 retval
= j
->ssr
.high
<< 8 | j
->ssr
.low
;
4580 retval
= (retval
* 256) / 240;
4584 static unsigned int ixj_poll(struct file
*file_p
, poll_table
* wait
)
4586 unsigned int mask
= 0;
4588 IXJ
*j
= get_ixj(NUM(file_p
->f_path
.dentry
->d_inode
));
4590 poll_wait(file_p
, &(j
->poll_q
), wait
);
4591 if (j
->read_buffer_ready
> 0)
4592 mask
|= POLLIN
| POLLRDNORM
; /* readable */
4593 if (j
->write_buffers_empty
> 0)
4594 mask
|= POLLOUT
| POLLWRNORM
; /* writable */
4600 static int ixj_play_tone(IXJ
*j
, char tone
)
4602 if (!j
->tone_state
) {
4603 if(ixjdebug
& 0x0002) {
4604 printk("IXJ %d starting tone %d at %ld\n", j
->board
, tone
, jiffies
);
4606 if (j
->dsp
.low
== 0x20) {
4609 j
->tone_start_jif
= jiffies
;
4614 j
->tone_index
= tone
;
4615 if (ixj_WriteDSPCommand(0x6000 + j
->tone_index
, j
))
4621 static int ixj_set_tone_on(unsigned short arg
, IXJ
*j
)
4623 j
->tone_on_time
= arg
;
4625 if (ixj_WriteDSPCommand(0x6E04, j
)) /* Set Tone On Period */
4629 if (ixj_WriteDSPCommand(arg
, j
))
4635 static int SCI_WaitHighSCI(IXJ
*j
)
4639 j
->pld_scrr
.byte
= inb_p(j
->XILINXbase
);
4640 if (!j
->pld_scrr
.bits
.sci
) {
4641 for (cnt
= 0; cnt
< 10; cnt
++) {
4643 j
->pld_scrr
.byte
= inb_p(j
->XILINXbase
);
4645 if ((j
->pld_scrr
.bits
.sci
))
4648 if (ixjdebug
& 0x0001)
4649 printk(KERN_INFO
"SCI Wait High failed %x\n", j
->pld_scrr
.byte
);
4655 static int SCI_WaitLowSCI(IXJ
*j
)
4659 j
->pld_scrr
.byte
= inb_p(j
->XILINXbase
);
4660 if (j
->pld_scrr
.bits
.sci
) {
4661 for (cnt
= 0; cnt
< 10; cnt
++) {
4663 j
->pld_scrr
.byte
= inb_p(j
->XILINXbase
);
4665 if (!(j
->pld_scrr
.bits
.sci
))
4668 if (ixjdebug
& 0x0001)
4669 printk(KERN_INFO
"SCI Wait Low failed %x\n", j
->pld_scrr
.byte
);
4675 static int SCI_Control(IXJ
*j
, int control
)
4679 j
->pld_scrw
.bits
.c0
= 0; /* Set PLD Serial control interface */
4681 j
->pld_scrw
.bits
.c1
= 0; /* to no selection */
4684 case SCI_Enable_DAA
:
4685 j
->pld_scrw
.bits
.c0
= 1; /* Set PLD Serial control interface */
4687 j
->pld_scrw
.bits
.c1
= 0; /* to write to DAA */
4690 case SCI_Enable_Mixer
:
4691 j
->pld_scrw
.bits
.c0
= 0; /* Set PLD Serial control interface */
4693 j
->pld_scrw
.bits
.c1
= 1; /* to write to mixer */
4696 case SCI_Enable_EEPROM
:
4697 j
->pld_scrw
.bits
.c0
= 1; /* Set PLD Serial control interface */
4699 j
->pld_scrw
.bits
.c1
= 1; /* to write to EEPROM */
4706 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
4712 case SCI_Enable_DAA
:
4713 case SCI_Enable_Mixer
:
4714 case SCI_Enable_EEPROM
:
4715 if (!SCI_WaitHighSCI(j
))
4725 static int SCI_Prepare(IXJ
*j
)
4727 if (!SCI_Control(j
, SCI_End
))
4730 if (!SCI_WaitLowSCI(j
))
4736 static int ixj_get_mixer(long val
, IXJ
*j
)
4738 int reg
= (val
& 0x1F00) >> 8;
4739 return j
->mix
.vol
[reg
];
4742 static int ixj_mixer(long val
, IXJ
*j
)
4746 bytes
.high
= (val
& 0x1F00) >> 8;
4747 bytes
.low
= val
& 0x00FF;
4749 /* save mixer value so we can get back later on */
4750 j
->mix
.vol
[bytes
.high
] = bytes
.low
;
4752 outb_p(bytes
.high
& 0x1F, j
->XILINXbase
+ 0x03); /* Load Mixer Address */
4754 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02); /* Load Mixer Data */
4756 SCI_Control(j
, SCI_Enable_Mixer
);
4758 SCI_Control(j
, SCI_End
);
4763 static int daa_load(BYTES
* p_bytes
, IXJ
*j
)
4765 outb_p(p_bytes
->high
, j
->XILINXbase
+ 0x03);
4766 outb_p(p_bytes
->low
, j
->XILINXbase
+ 0x02);
4767 if (!SCI_Control(j
, SCI_Enable_DAA
))
4773 static int ixj_daa_cr4(IXJ
*j
, char reg
)
4777 switch (j
->daa_mode
) {
4781 case SOP_PU_RINGING
:
4784 case SOP_PU_CONVERSATION
:
4787 case SOP_PU_PULSEDIALING
:
4792 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= reg
;
4794 switch (j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.bitreg
.AGX
) {
4796 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.bitreg
.AGR_Z
= 0;
4799 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.bitreg
.AGR_Z
= 2;
4802 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.bitreg
.AGR_Z
= 1;
4805 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.bitreg
.AGR_Z
= 3;
4809 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
;
4811 if (!daa_load(&bytes
, j
))
4814 if (!SCI_Prepare(j
))
4820 static char daa_int_read(IXJ
*j
)
4824 if (!SCI_Prepare(j
))
4829 outb_p(bytes
.high
, j
->XILINXbase
+ 0x03);
4830 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02);
4832 if (!SCI_Control(j
, SCI_Enable_DAA
))
4835 bytes
.high
= inb_p(j
->XILINXbase
+ 0x03);
4836 bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
4837 if (bytes
.low
!= ALISDAA_ID_BYTE
) {
4838 if (ixjdebug
& 0x0001)
4839 printk("Cannot read DAA ID Byte high = %d low = %d\n", bytes
.high
, bytes
.low
);
4842 if (!SCI_Control(j
, SCI_Enable_DAA
))
4844 if (!SCI_Control(j
, SCI_End
))
4847 bytes
.high
= inb_p(j
->XILINXbase
+ 0x03);
4848 bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
4850 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.reg
= bytes
.high
;
4855 static char daa_CR_read(IXJ
*j
, int cr
)
4860 if (!SCI_Prepare(j
))
4863 switch (j
->daa_mode
) {
4865 bytes
.high
= 0x30 + cr
;
4867 case SOP_PU_RINGING
:
4868 bytes
.high
= 0x70 + cr
;
4870 case SOP_PU_CONVERSATION
:
4871 bytes
.high
= 0xB0 + cr
;
4873 case SOP_PU_PULSEDIALING
:
4875 bytes
.high
= 0xF0 + cr
;
4881 outb_p(bytes
.high
, j
->XILINXbase
+ 0x03);
4882 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02);
4884 if (!SCI_Control(j
, SCI_Enable_DAA
))
4887 bytes
.high
= inb_p(j
->XILINXbase
+ 0x03);
4888 bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
4889 if (bytes
.low
!= ALISDAA_ID_BYTE
) {
4890 if (ixjdebug
& 0x0001)
4891 printk("Cannot read DAA ID Byte high = %d low = %d\n", bytes
.high
, bytes
.low
);
4894 if (!SCI_Control(j
, SCI_Enable_DAA
))
4896 if (!SCI_Control(j
, SCI_End
))
4899 wdata
.word
= inw_p(j
->XILINXbase
+ 0x02);
4903 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr5
.reg
= wdata
.bytes
.high
;
4906 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= wdata
.bytes
.high
;
4909 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
= wdata
.bytes
.high
;
4912 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
= wdata
.bytes
.high
;
4915 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
= wdata
.bytes
.high
;
4918 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
= wdata
.bytes
.high
;
4926 static int ixj_daa_cid_reset(IXJ
*j
)
4931 if (ixjdebug
& 0x0002)
4932 printk("DAA Clearing CID ram\n");
4934 if (!SCI_Prepare(j
))
4939 outb_p(bytes
.high
, j
->XILINXbase
+ 0x03);
4940 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02);
4942 if (!SCI_Control(j
, SCI_Enable_DAA
))
4945 if (!SCI_WaitHighSCI(j
))
4948 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
- 1; i
+= 2) {
4949 bytes
.high
= bytes
.low
= 0x00;
4950 outb_p(bytes
.high
, j
->XILINXbase
+ 0x03);
4952 if (i
< ALISDAA_CALLERID_SIZE
- 1)
4953 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02);
4955 if (!SCI_Control(j
, SCI_Enable_DAA
))
4958 if (!SCI_WaitHighSCI(j
))
4963 if (!SCI_Control(j
, SCI_End
))
4966 if (ixjdebug
& 0x0002)
4967 printk("DAA CID ram cleared\n");
4972 static int ixj_daa_cid_read(IXJ
*j
)
4976 char CID
[ALISDAA_CALLERID_SIZE
];
4980 if (!SCI_Prepare(j
))
4985 outb_p(bytes
.high
, j
->XILINXbase
+ 0x03);
4986 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02);
4988 if (!SCI_Control(j
, SCI_Enable_DAA
))
4991 if (!SCI_WaitHighSCI(j
))
4994 bytes
.high
= inb_p(j
->XILINXbase
+ 0x03);
4995 bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
4996 if (bytes
.low
!= ALISDAA_ID_BYTE
) {
4997 if (ixjdebug
& 0x0001)
4998 printk("DAA Get Version Cannot read DAA ID Byte high = %d low = %d\n", bytes
.high
, bytes
.low
);
5001 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
; i
+= 2) {
5002 bytes
.high
= bytes
.low
= 0x00;
5003 outb_p(bytes
.high
, j
->XILINXbase
+ 0x03);
5004 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02);
5006 if (!SCI_Control(j
, SCI_Enable_DAA
))
5009 if (!SCI_WaitHighSCI(j
))
5012 CID
[i
+ 0] = inb_p(j
->XILINXbase
+ 0x03);
5013 CID
[i
+ 1] = inb_p(j
->XILINXbase
+ 0x02);
5016 if (!SCI_Control(j
, SCI_End
))
5020 pOut
= j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
;
5023 if ((pIn
[1] & 0x03) == 0x01) {
5026 if ((pIn
[2] & 0x0c) == 0x04) {
5027 pOut
[1] = ((pIn
[2] & 0x03) << 6) | ((pIn
[1] & 0xfc) >> 2);
5029 if ((pIn
[3] & 0x30) == 0x10) {
5030 pOut
[2] = ((pIn
[3] & 0x0f) << 4) | ((pIn
[2] & 0xf0) >> 4);
5032 if ((pIn
[4] & 0xc0) == 0x40) {
5033 pOut
[3] = ((pIn
[4] & 0x3f) << 2) | ((pIn
[3] & 0xc0) >> 6);
5037 pIn
+= 5, pOut
+= 4;
5039 memset(&j
->cid
, 0, sizeof(PHONE_CID
));
5040 pOut
= j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
;
5042 strncpy(j
->cid
.month
, pOut
, 2);
5044 strncpy(j
->cid
.day
, pOut
, 2);
5046 strncpy(j
->cid
.hour
, pOut
, 2);
5048 strncpy(j
->cid
.min
, pOut
, 2);
5050 j
->cid
.numlen
= *pOut
;
5052 strncpy(j
->cid
.number
, pOut
, j
->cid
.numlen
);
5053 pOut
+= j
->cid
.numlen
+ 1;
5054 j
->cid
.namelen
= *pOut
;
5056 strncpy(j
->cid
.name
, pOut
, j
->cid
.namelen
);
5058 ixj_daa_cid_reset(j
);
5062 static char daa_get_version(IXJ
*j
)
5066 if (!SCI_Prepare(j
))
5071 outb_p(bytes
.high
, j
->XILINXbase
+ 0x03);
5072 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02);
5074 if (!SCI_Control(j
, SCI_Enable_DAA
))
5077 bytes
.high
= inb_p(j
->XILINXbase
+ 0x03);
5078 bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
5079 if (bytes
.low
!= ALISDAA_ID_BYTE
) {
5080 if (ixjdebug
& 0x0001)
5081 printk("DAA Get Version Cannot read DAA ID Byte high = %d low = %d\n", bytes
.high
, bytes
.low
);
5084 if (!SCI_Control(j
, SCI_Enable_DAA
))
5087 if (!SCI_Control(j
, SCI_End
))
5090 bytes
.high
= inb_p(j
->XILINXbase
+ 0x03);
5091 bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
5092 if (ixjdebug
& 0x0002)
5093 printk("DAA CR5 Byte high = 0x%x low = 0x%x\n", bytes
.high
, bytes
.low
);
5094 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr5
.reg
= bytes
.high
;
5098 static int daa_set_mode(IXJ
*j
, int mode
)
5101 The DAA *MUST* be in the conversation mode if the
5102 PSTN line is to be seized (PSTN line off-hook).
5103 Taking the PSTN line off-hook while the DAA is in
5104 a mode other than conversation mode will cause a
5105 hardware failure of the ALIS-A part.
5108 The DAA can only go to SLEEP, RINGING or PULSEDIALING modes
5109 if the PSTN line is on-hook. Failure to have the PSTN line
5110 in the on-hook state WILL CAUSE A HARDWARE FAILURE OF THE
5116 j
->flags
.pstn_rmr
= 0;
5118 if (!SCI_Prepare(j
))
5123 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
5125 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5126 j
->pld_slicw
.bits
.rly2
= 0;
5127 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
5129 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
;
5130 daa_load(&bytes
, j
);
5131 if (!SCI_Prepare(j
))
5134 j
->daa_mode
= SOP_PU_SLEEP
;
5137 if(j
->daa_mode
== SOP_PU_SLEEP
)
5141 if (ixjdebug
& 0x0008)
5142 printk(KERN_INFO
"phone DAA: SOP_PU_SLEEP at %ld\n", jiffies
);
5143 /* if(j->daa_mode == SOP_PU_CONVERSATION) */
5145 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
5147 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5148 j
->pld_slicw
.bits
.rly2
= 0;
5149 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
5151 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
;
5152 daa_load(&bytes
, j
);
5153 if (!SCI_Prepare(j
))
5156 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
5158 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5159 j
->pld_slicw
.bits
.rly2
= 0;
5160 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
5162 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
;
5163 daa_load(&bytes
, j
);
5164 if (!SCI_Prepare(j
))
5167 j
->daa_mode
= SOP_PU_SLEEP
;
5168 j
->flags
.pstn_ringing
= 0;
5169 j
->ex
.bits
.pstn_ring
= 0;
5170 j
->pstn_sleeptil
= jiffies
+ (hertz
/ 4);
5171 wake_up_interruptible(&j
->read_q
); /* Wake any blocked readers */
5172 wake_up_interruptible(&j
->write_q
); /* Wake any blocked writers */
5173 wake_up_interruptible(&j
->poll_q
); /* Wake any blocked selects */
5175 case SOP_PU_RINGING
:
5176 if (ixjdebug
& 0x0008)
5177 printk(KERN_INFO
"phone DAA: SOP_PU_RINGING at %ld\n", jiffies
);
5178 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
5180 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5181 j
->pld_slicw
.bits
.rly2
= 0;
5182 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
5184 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
;
5185 daa_load(&bytes
, j
);
5186 if (!SCI_Prepare(j
))
5188 j
->daa_mode
= SOP_PU_RINGING
;
5190 case SOP_PU_CONVERSATION
:
5191 if (ixjdebug
& 0x0008)
5192 printk(KERN_INFO
"phone DAA: SOP_PU_CONVERSATION at %ld\n", jiffies
);
5194 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
;
5195 daa_load(&bytes
, j
);
5196 if (!SCI_Prepare(j
))
5198 j
->pld_slicw
.bits
.rly2
= 1;
5199 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
5200 j
->pld_scrw
.bits
.daafsyncen
= 1; /* Turn on DAA Frame Sync */
5202 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5203 j
->daa_mode
= SOP_PU_CONVERSATION
;
5204 j
->flags
.pstn_ringing
= 0;
5205 j
->ex
.bits
.pstn_ring
= 0;
5206 j
->pstn_sleeptil
= jiffies
;
5207 j
->pstn_ring_start
= j
->pstn_ring_stop
= j
->pstn_ring_int
= 0;
5209 case SOP_PU_PULSEDIALING
:
5210 if (ixjdebug
& 0x0008)
5211 printk(KERN_INFO
"phone DAA: SOP_PU_PULSEDIALING at %ld\n", jiffies
);
5212 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
5214 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5215 j
->pld_slicw
.bits
.rly2
= 0;
5216 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
5218 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
;
5219 daa_load(&bytes
, j
);
5220 if (!SCI_Prepare(j
))
5222 j
->daa_mode
= SOP_PU_PULSEDIALING
;
5230 static int ixj_daa_write(IXJ
*j
)
5234 j
->flags
.pstncheck
= 1;
5236 daa_set_mode(j
, SOP_PU_SLEEP
);
5238 if (!SCI_Prepare(j
))
5241 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5244 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
;
5245 if (!daa_load(&bytes
, j
))
5248 bytes
.high
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
;
5249 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
;
5250 if (!daa_load(&bytes
, j
))
5253 bytes
.high
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
;
5254 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
;
5255 if (!daa_load(&bytes
, j
))
5258 if (!SCI_Prepare(j
))
5262 bytes
.low
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr7
.reg
;
5263 if (!daa_load(&bytes
, j
))
5266 bytes
.high
= j
->m_DAAShadowRegs
.XOP_xr6_W
.reg
;
5267 bytes
.low
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr5
.reg
;
5268 if (!daa_load(&bytes
, j
))
5271 bytes
.high
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr4
.reg
;
5272 bytes
.low
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr3
.reg
;
5273 if (!daa_load(&bytes
, j
))
5276 bytes
.high
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr2
.reg
;
5277 bytes
.low
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr1
.reg
;
5278 if (!daa_load(&bytes
, j
))
5281 bytes
.high
= j
->m_DAAShadowRegs
.XOP_xr0_W
.reg
;
5283 if (!daa_load(&bytes
, j
))
5286 if (!SCI_Prepare(j
))
5290 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[7];
5291 if (!daa_load(&bytes
, j
))
5294 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[6];
5295 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[5];
5296 if (!daa_load(&bytes
, j
))
5299 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[4];
5300 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[3];
5301 if (!daa_load(&bytes
, j
))
5304 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[2];
5305 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[1];
5306 if (!daa_load(&bytes
, j
))
5309 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[0];
5311 if (!daa_load(&bytes
, j
))
5314 if (!SCI_Control(j
, SCI_End
))
5316 if (!SCI_WaitLowSCI(j
))
5320 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[7];
5321 if (!daa_load(&bytes
, j
))
5324 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[6];
5325 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[5];
5326 if (!daa_load(&bytes
, j
))
5329 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[4];
5330 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[3];
5331 if (!daa_load(&bytes
, j
))
5334 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[2];
5335 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[1];
5336 if (!daa_load(&bytes
, j
))
5339 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[0];
5341 if (!daa_load(&bytes
, j
))
5344 if (!SCI_Control(j
, SCI_End
))
5346 if (!SCI_WaitLowSCI(j
))
5350 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[7];
5351 if (!daa_load(&bytes
, j
))
5354 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[6];
5355 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[5];
5356 if (!daa_load(&bytes
, j
))
5359 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[4];
5360 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[3];
5361 if (!daa_load(&bytes
, j
))
5364 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[2];
5365 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[1];
5366 if (!daa_load(&bytes
, j
))
5369 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[0];
5371 if (!daa_load(&bytes
, j
))
5374 if (!SCI_Control(j
, SCI_End
))
5376 if (!SCI_WaitLowSCI(j
))
5380 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[7];
5381 if (!daa_load(&bytes
, j
))
5384 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[6];
5385 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[5];
5386 if (!daa_load(&bytes
, j
))
5389 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[4];
5390 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[3];
5391 if (!daa_load(&bytes
, j
))
5394 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[2];
5395 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[1];
5396 if (!daa_load(&bytes
, j
))
5399 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[0];
5401 if (!daa_load(&bytes
, j
))
5404 if (!SCI_Control(j
, SCI_End
))
5406 if (!SCI_WaitLowSCI(j
))
5410 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[7];
5411 if (!daa_load(&bytes
, j
))
5414 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[6];
5415 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[5];
5416 if (!daa_load(&bytes
, j
))
5419 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[4];
5420 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[3];
5421 if (!daa_load(&bytes
, j
))
5424 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[2];
5425 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[1];
5426 if (!daa_load(&bytes
, j
))
5429 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[0];
5431 if (!daa_load(&bytes
, j
))
5434 if (!SCI_Control(j
, SCI_End
))
5436 if (!SCI_WaitLowSCI(j
))
5440 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[7];
5441 if (!daa_load(&bytes
, j
))
5444 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[6];
5445 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[5];
5446 if (!daa_load(&bytes
, j
))
5449 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[4];
5450 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[3];
5451 if (!daa_load(&bytes
, j
))
5454 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[2];
5455 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[1];
5456 if (!daa_load(&bytes
, j
))
5459 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[0];
5461 if (!daa_load(&bytes
, j
))
5464 if (!SCI_Control(j
, SCI_End
))
5466 if (!SCI_WaitLowSCI(j
))
5470 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[7];
5471 if (!daa_load(&bytes
, j
))
5474 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[6];
5475 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[5];
5476 if (!daa_load(&bytes
, j
))
5479 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[4];
5480 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[3];
5481 if (!daa_load(&bytes
, j
))
5484 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[2];
5485 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[1];
5486 if (!daa_load(&bytes
, j
))
5489 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[0];
5491 if (!daa_load(&bytes
, j
))
5494 if (!SCI_Control(j
, SCI_End
))
5496 if (!SCI_WaitLowSCI(j
))
5500 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[7];
5501 if (!daa_load(&bytes
, j
))
5504 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[6];
5505 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[5];
5506 if (!daa_load(&bytes
, j
))
5509 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[4];
5510 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[3];
5511 if (!daa_load(&bytes
, j
))
5514 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[2];
5515 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[1];
5516 if (!daa_load(&bytes
, j
))
5519 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[0];
5521 if (!daa_load(&bytes
, j
))
5524 if (!SCI_Control(j
, SCI_End
))
5526 if (!SCI_WaitLowSCI(j
))
5530 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[7];
5531 if (!daa_load(&bytes
, j
))
5534 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[6];
5535 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[5];
5536 if (!daa_load(&bytes
, j
))
5539 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[4];
5540 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[3];
5541 if (!daa_load(&bytes
, j
))
5544 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[2];
5545 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[1];
5546 if (!daa_load(&bytes
, j
))
5549 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[0];
5551 if (!daa_load(&bytes
, j
))
5554 if (!SCI_Control(j
, SCI_End
))
5556 if (!SCI_WaitLowSCI(j
))
5560 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[3];
5561 if (!daa_load(&bytes
, j
))
5564 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[2];
5565 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[1];
5566 if (!daa_load(&bytes
, j
))
5569 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[0];
5571 if (!daa_load(&bytes
, j
))
5574 if (!SCI_Control(j
, SCI_End
))
5576 if (!SCI_WaitLowSCI(j
))
5580 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[3];
5581 if (!daa_load(&bytes
, j
))
5584 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[2];
5585 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[1];
5586 if (!daa_load(&bytes
, j
))
5589 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[0];
5591 if (!daa_load(&bytes
, j
))
5594 if (!SCI_Control(j
, SCI_End
))
5596 if (!SCI_WaitLowSCI(j
))
5600 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[3];
5601 if (!daa_load(&bytes
, j
))
5604 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[2];
5605 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[1];
5606 if (!daa_load(&bytes
, j
))
5609 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[0];
5611 if (!daa_load(&bytes
, j
))
5614 if (!SCI_Control(j
, SCI_End
))
5616 if (!SCI_WaitLowSCI(j
))
5620 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[3];
5621 if (!daa_load(&bytes
, j
))
5624 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[2];
5625 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[1];
5626 if (!daa_load(&bytes
, j
))
5629 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[0];
5631 if (!daa_load(&bytes
, j
))
5634 if (!SCI_Control(j
, SCI_End
))
5636 if (!SCI_WaitLowSCI(j
))
5640 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[3];
5641 if (!daa_load(&bytes
, j
))
5644 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[2];
5645 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[1];
5646 if (!daa_load(&bytes
, j
))
5649 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[0];
5651 if (!daa_load(&bytes
, j
))
5654 if (!SCI_Control(j
, SCI_End
))
5656 if (!SCI_WaitLowSCI(j
))
5660 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[7];
5661 if (!daa_load(&bytes
, j
))
5664 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[6];
5665 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[5];
5666 if (!daa_load(&bytes
, j
))
5669 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[4];
5670 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[3];
5671 if (!daa_load(&bytes
, j
))
5674 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[2];
5675 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[1];
5676 if (!daa_load(&bytes
, j
))
5679 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[0];
5681 if (!daa_load(&bytes
, j
))
5684 if (!SCI_Control(j
, SCI_End
))
5686 if (!SCI_WaitLowSCI(j
))
5690 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[7];
5691 if (!daa_load(&bytes
, j
))
5694 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[6];
5695 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[5];
5696 if (!daa_load(&bytes
, j
))
5699 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[4];
5700 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[3];
5701 if (!daa_load(&bytes
, j
))
5704 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[2];
5705 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[1];
5706 if (!daa_load(&bytes
, j
))
5709 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[0];
5711 if (!daa_load(&bytes
, j
))
5715 j
->pld_scrr
.byte
= inb_p(j
->XILINXbase
);
5716 if (!SCI_Control(j
, SCI_End
))
5719 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5721 if (ixjdebug
& 0x0002)
5722 printk("DAA Coefficients Loaded\n");
5724 j
->flags
.pstncheck
= 0;
5728 static int ixj_set_tone_off(unsigned short arg
, IXJ
*j
)
5730 j
->tone_off_time
= arg
;
5731 if (ixj_WriteDSPCommand(0x6E05, j
)) /* Set Tone Off Period */
5734 if (ixj_WriteDSPCommand(arg
, j
))
5739 static int ixj_get_tone_on(IXJ
*j
)
5741 if (ixj_WriteDSPCommand(0x6E06, j
)) /* Get Tone On Period */
5747 static int ixj_get_tone_off(IXJ
*j
)
5749 if (ixj_WriteDSPCommand(0x6E07, j
)) /* Get Tone Off Period */
5755 static void ixj_busytone(IXJ
*j
)
5757 j
->flags
.ringback
= 0;
5758 j
->flags
.dialtone
= 0;
5759 j
->flags
.busytone
= 1;
5760 ixj_set_tone_on(0x07D0, j
);
5761 ixj_set_tone_off(0x07D0, j
);
5762 ixj_play_tone(j
, 27);
5765 static void ixj_dialtone(IXJ
*j
)
5767 j
->flags
.ringback
= 0;
5768 j
->flags
.dialtone
= 1;
5769 j
->flags
.busytone
= 0;
5770 if (j
->dsp
.low
== 0x20) {
5773 ixj_set_tone_on(0xFFFF, j
);
5774 ixj_set_tone_off(0x0000, j
);
5775 ixj_play_tone(j
, 25);
5779 static void ixj_cpt_stop(IXJ
*j
)
5781 if(j
->tone_state
|| j
->tone_cadence_state
)
5783 j
->flags
.dialtone
= 0;
5784 j
->flags
.busytone
= 0;
5785 j
->flags
.ringback
= 0;
5786 ixj_set_tone_on(0x0001, j
);
5787 ixj_set_tone_off(0x0000, j
);
5788 ixj_play_tone(j
, 0);
5789 j
->tone_state
= j
->tone_cadence_state
= 0;
5791 kfree(j
->cadence_t
->ce
);
5792 kfree(j
->cadence_t
);
5793 j
->cadence_t
= NULL
;
5796 if (j
->play_mode
== -1 && j
->rec_mode
== -1)
5798 if (j
->play_mode
!= -1 && j
->dsp
.low
== 0x20)
5800 if (j
->rec_mode
!= -1 && j
->dsp
.low
== 0x20)
5801 ixj_record_start(j
);
5804 static void ixj_ringback(IXJ
*j
)
5806 j
->flags
.busytone
= 0;
5807 j
->flags
.dialtone
= 0;
5808 j
->flags
.ringback
= 1;
5809 ixj_set_tone_on(0x0FA0, j
);
5810 ixj_set_tone_off(0x2EE0, j
);
5811 ixj_play_tone(j
, 26);
5814 static void ixj_testram(IXJ
*j
)
5816 ixj_WriteDSPCommand(0x3001, j
); /* Test External SRAM */
5819 static int ixj_build_cadence(IXJ
*j
, IXJ_CADENCE __user
* cp
)
5822 IXJ_CADENCE_ELEMENT __user
*cep
;
5823 IXJ_CADENCE_ELEMENT
*lcep
;
5827 lcp
= kmalloc(sizeof(ixj_cadence
), GFP_KERNEL
);
5832 if (copy_from_user(&lcp
->elements_used
,
5833 &cp
->elements_used
, sizeof(int)))
5835 if (copy_from_user(&lcp
->termination
,
5836 &cp
->termination
, sizeof(IXJ_CADENCE_TERM
)))
5838 if (get_user(cep
, &cp
->ce
))
5842 if ((unsigned)lcp
->elements_used
>= ~0U/sizeof(IXJ_CADENCE_ELEMENT
))
5846 lcep
= kmalloc(sizeof(IXJ_CADENCE_ELEMENT
) * lcp
->elements_used
, GFP_KERNEL
);
5851 if (copy_from_user(lcep
, cep
, sizeof(IXJ_CADENCE_ELEMENT
) * lcp
->elements_used
))
5855 kfree(j
->cadence_t
->ce
);
5856 kfree(j
->cadence_t
);
5858 lcp
->ce
= (void *) lcep
;
5860 j
->tone_cadence_state
= 0;
5861 ixj_set_tone_on(lcp
->ce
[0].tone_on_time
, j
);
5862 ixj_set_tone_off(lcp
->ce
[0].tone_off_time
, j
);
5863 if (j
->cadence_t
->ce
[j
->tone_cadence_state
].freq0
) {
5864 ti
.tone_index
= j
->cadence_t
->ce
[j
->tone_cadence_state
].index
;
5865 ti
.freq0
= j
->cadence_t
->ce
[j
->tone_cadence_state
].freq0
;
5866 ti
.gain0
= j
->cadence_t
->ce
[j
->tone_cadence_state
].gain0
;
5867 ti
.freq1
= j
->cadence_t
->ce
[j
->tone_cadence_state
].freq1
;
5868 ti
.gain1
= j
->cadence_t
->ce
[j
->tone_cadence_state
].gain1
;
5869 ixj_init_tone(j
, &ti
);
5871 ixj_play_tone(j
, lcp
->ce
[0].index
);
5880 static int ixj_build_filter_cadence(IXJ
*j
, IXJ_FILTER_CADENCE __user
* cp
)
5882 IXJ_FILTER_CADENCE
*lcp
;
5883 lcp
= memdup_user(cp
, sizeof(IXJ_FILTER_CADENCE
));
5885 if(ixjdebug
& 0x0001) {
5886 printk(KERN_INFO
"Could not allocate memory for cadence or could not copy cadence to kernel\n");
5888 return PTR_ERR(lcp
);
5890 if (lcp
->filter
> 5) {
5891 if(ixjdebug
& 0x0001) {
5892 printk(KERN_INFO
"Cadence out of range\n");
5897 j
->cadence_f
[lcp
->filter
].state
= 0;
5898 j
->cadence_f
[lcp
->filter
].enable
= lcp
->enable
;
5899 j
->filter_en
[lcp
->filter
] = j
->cadence_f
[lcp
->filter
].en_filter
= lcp
->en_filter
;
5900 j
->cadence_f
[lcp
->filter
].on1
= lcp
->on1
;
5901 j
->cadence_f
[lcp
->filter
].on1min
= 0;
5902 j
->cadence_f
[lcp
->filter
].on1max
= 0;
5903 j
->cadence_f
[lcp
->filter
].off1
= lcp
->off1
;
5904 j
->cadence_f
[lcp
->filter
].off1min
= 0;
5905 j
->cadence_f
[lcp
->filter
].off1max
= 0;
5906 j
->cadence_f
[lcp
->filter
].on2
= lcp
->on2
;
5907 j
->cadence_f
[lcp
->filter
].on2min
= 0;
5908 j
->cadence_f
[lcp
->filter
].on2max
= 0;
5909 j
->cadence_f
[lcp
->filter
].off2
= lcp
->off2
;
5910 j
->cadence_f
[lcp
->filter
].off2min
= 0;
5911 j
->cadence_f
[lcp
->filter
].off2max
= 0;
5912 j
->cadence_f
[lcp
->filter
].on3
= lcp
->on3
;
5913 j
->cadence_f
[lcp
->filter
].on3min
= 0;
5914 j
->cadence_f
[lcp
->filter
].on3max
= 0;
5915 j
->cadence_f
[lcp
->filter
].off3
= lcp
->off3
;
5916 j
->cadence_f
[lcp
->filter
].off3min
= 0;
5917 j
->cadence_f
[lcp
->filter
].off3max
= 0;
5918 if(ixjdebug
& 0x0002) {
5919 printk(KERN_INFO
"Cadence %d loaded\n", lcp
->filter
);
5925 static void add_caps(IXJ
*j
)
5928 j
->caplist
[j
->caps
].cap
= PHONE_VENDOR_QUICKNET
;
5929 strcpy(j
->caplist
[j
->caps
].desc
, "Quicknet Technologies, Inc. (www.quicknet.net)");
5930 j
->caplist
[j
->caps
].captype
= vendor
;
5931 j
->caplist
[j
->caps
].handle
= j
->caps
++;
5932 j
->caplist
[j
->caps
].captype
= device
;
5933 switch (j
->cardtype
) {
5935 strcpy(j
->caplist
[j
->caps
].desc
, "Quicknet Internet PhoneJACK");
5938 strcpy(j
->caplist
[j
->caps
].desc
, "Quicknet Internet LineJACK");
5940 case QTI_PHONEJACK_LITE
:
5941 strcpy(j
->caplist
[j
->caps
].desc
, "Quicknet Internet PhoneJACK Lite");
5943 case QTI_PHONEJACK_PCI
:
5944 strcpy(j
->caplist
[j
->caps
].desc
, "Quicknet Internet PhoneJACK PCI");
5947 strcpy(j
->caplist
[j
->caps
].desc
, "Quicknet Internet PhoneCARD");
5950 j
->caplist
[j
->caps
].cap
= j
->cardtype
;
5951 j
->caplist
[j
->caps
].handle
= j
->caps
++;
5952 strcpy(j
->caplist
[j
->caps
].desc
, "POTS");
5953 j
->caplist
[j
->caps
].captype
= port
;
5954 j
->caplist
[j
->caps
].cap
= pots
;
5955 j
->caplist
[j
->caps
].handle
= j
->caps
++;
5957 /* add devices that can do speaker/mic */
5958 switch (j
->cardtype
) {
5961 case QTI_PHONEJACK_PCI
:
5963 strcpy(j
->caplist
[j
->caps
].desc
, "SPEAKER");
5964 j
->caplist
[j
->caps
].captype
= port
;
5965 j
->caplist
[j
->caps
].cap
= speaker
;
5966 j
->caplist
[j
->caps
].handle
= j
->caps
++;
5971 /* add devices that can do handset */
5972 switch (j
->cardtype
) {
5974 strcpy(j
->caplist
[j
->caps
].desc
, "HANDSET");
5975 j
->caplist
[j
->caps
].captype
= port
;
5976 j
->caplist
[j
->caps
].cap
= handset
;
5977 j
->caplist
[j
->caps
].handle
= j
->caps
++;
5983 /* add devices that can do PSTN */
5984 switch (j
->cardtype
) {
5986 strcpy(j
->caplist
[j
->caps
].desc
, "PSTN");
5987 j
->caplist
[j
->caps
].captype
= port
;
5988 j
->caplist
[j
->caps
].cap
= pstn
;
5989 j
->caplist
[j
->caps
].handle
= j
->caps
++;
5995 /* add codecs - all cards can do uLaw, linear 8/16, and Windows sound system */
5996 strcpy(j
->caplist
[j
->caps
].desc
, "ULAW");
5997 j
->caplist
[j
->caps
].captype
= codec
;
5998 j
->caplist
[j
->caps
].cap
= ULAW
;
5999 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6001 strcpy(j
->caplist
[j
->caps
].desc
, "LINEAR 16 bit");
6002 j
->caplist
[j
->caps
].captype
= codec
;
6003 j
->caplist
[j
->caps
].cap
= LINEAR16
;
6004 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6006 strcpy(j
->caplist
[j
->caps
].desc
, "LINEAR 8 bit");
6007 j
->caplist
[j
->caps
].captype
= codec
;
6008 j
->caplist
[j
->caps
].cap
= LINEAR8
;
6009 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6011 strcpy(j
->caplist
[j
->caps
].desc
, "Windows Sound System");
6012 j
->caplist
[j
->caps
].captype
= codec
;
6013 j
->caplist
[j
->caps
].cap
= WSS
;
6014 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6016 /* software ALAW codec, made from ULAW */
6017 strcpy(j
->caplist
[j
->caps
].desc
, "ALAW");
6018 j
->caplist
[j
->caps
].captype
= codec
;
6019 j
->caplist
[j
->caps
].cap
= ALAW
;
6020 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6022 /* version 12 of the 8020 does the following codecs in a broken way */
6023 if (j
->dsp
.low
!= 0x20 || j
->ver
.low
!= 0x12) {
6024 strcpy(j
->caplist
[j
->caps
].desc
, "G.723.1 6.3kbps");
6025 j
->caplist
[j
->caps
].captype
= codec
;
6026 j
->caplist
[j
->caps
].cap
= G723_63
;
6027 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6029 strcpy(j
->caplist
[j
->caps
].desc
, "G.723.1 5.3kbps");
6030 j
->caplist
[j
->caps
].captype
= codec
;
6031 j
->caplist
[j
->caps
].cap
= G723_53
;
6032 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6034 strcpy(j
->caplist
[j
->caps
].desc
, "TrueSpeech 4.8kbps");
6035 j
->caplist
[j
->caps
].captype
= codec
;
6036 j
->caplist
[j
->caps
].cap
= TS48
;
6037 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6039 strcpy(j
->caplist
[j
->caps
].desc
, "TrueSpeech 4.1kbps");
6040 j
->caplist
[j
->caps
].captype
= codec
;
6041 j
->caplist
[j
->caps
].cap
= TS41
;
6042 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6045 /* 8020 chips can do TS8.5 native, and 8021/8022 can load it */
6046 if (j
->dsp
.low
== 0x20 || j
->flags
.ts85_loaded
) {
6047 strcpy(j
->caplist
[j
->caps
].desc
, "TrueSpeech 8.5kbps");
6048 j
->caplist
[j
->caps
].captype
= codec
;
6049 j
->caplist
[j
->caps
].cap
= TS85
;
6050 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6053 /* 8021 chips can do G728 */
6054 if (j
->dsp
.low
== 0x21) {
6055 strcpy(j
->caplist
[j
->caps
].desc
, "G.728 16kbps");
6056 j
->caplist
[j
->caps
].captype
= codec
;
6057 j
->caplist
[j
->caps
].cap
= G728
;
6058 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6061 /* 8021/8022 chips can do G729 if loaded */
6062 if (j
->dsp
.low
!= 0x20 && j
->flags
.g729_loaded
) {
6063 strcpy(j
->caplist
[j
->caps
].desc
, "G.729A 8kbps");
6064 j
->caplist
[j
->caps
].captype
= codec
;
6065 j
->caplist
[j
->caps
].cap
= G729
;
6066 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6068 if (j
->dsp
.low
!= 0x20 && j
->flags
.g729_loaded
) {
6069 strcpy(j
->caplist
[j
->caps
].desc
, "G.729B 8kbps");
6070 j
->caplist
[j
->caps
].captype
= codec
;
6071 j
->caplist
[j
->caps
].cap
= G729B
;
6072 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6076 static int capabilities_check(IXJ
*j
, struct phone_capability
*pcreq
)
6080 for (cnt
= 0; cnt
< j
->caps
; cnt
++) {
6081 if (pcreq
->captype
== j
->caplist
[cnt
].captype
6082 && pcreq
->cap
== j
->caplist
[cnt
].cap
) {
6090 static long do_ixj_ioctl(struct file
*file_p
, unsigned int cmd
, unsigned long arg
)
6095 void __user
*argp
= (void __user
*)arg
;
6096 struct inode
*inode
= file_p
->f_path
.dentry
->d_inode
;
6097 unsigned int minor
= iminor(inode
);
6098 unsigned int raise
, mant
;
6099 int board
= NUM(inode
);
6101 IXJ
*j
= get_ixj(NUM(inode
));
6106 * Set up locks to ensure that only one process is talking to the DSP at a time.
6107 * This is necessary to keep the DSP from locking up.
6109 while(test_and_set_bit(board
, (void *)&j
->busyflags
) != 0)
6110 schedule_timeout_interruptible(1);
6111 if (ixjdebug
& 0x0040)
6112 printk("phone%d ioctl, cmd: 0x%x, arg: 0x%lx\n", minor
, cmd
, arg
);
6113 if (minor
>= IXJMAX
) {
6114 clear_bit(board
, &j
->busyflags
);
6118 * Check ioctls only root can use.
6120 if (!capable(CAP_SYS_ADMIN
)) {
6122 case IXJCTL_TESTRAM
:
6128 case IXJCTL_TESTRAM
:
6130 retval
= (j
->ssr
.high
<< 8) + j
->ssr
.low
;
6132 case IXJCTL_CARDTYPE
:
6133 retval
= j
->cardtype
;
6138 case IXJCTL_VERSION
:
6141 snprintf(arg_str
, sizeof(arg_str
),
6142 "\nDriver version %i.%i.%i", IXJ_VER_MAJOR
,
6143 IXJ_VER_MINOR
, IXJ_BLD_VER
);
6144 if (copy_to_user(argp
, arg_str
, strlen(arg_str
)))
6148 case PHONE_RING_CADENCE
:
6149 j
->ring_cadence
= arg
;
6153 if (copy_from_user(&j
->cid_send
, argp
, sizeof(PHONE_CID
))) {
6158 memset(&j
->cid_send
, 0, sizeof(PHONE_CID
));
6162 /* Binary compatbility */
6163 case OLD_PHONE_RING_START
:
6166 case PHONE_RING_START
:
6168 if (copy_from_user(&j
->cid_send
, argp
, sizeof(PHONE_CID
))) {
6174 memset(&j
->cid_send
, 0, sizeof(PHONE_CID
));
6178 case PHONE_RING_STOP
:
6179 j
->flags
.cringing
= 0;
6180 if(j
->cadence_f
[5].enable
) {
6181 j
->cadence_f
[5].state
= 0;
6186 retval
= ixj_ring(j
);
6188 case PHONE_EXCEPTION
:
6189 retval
= j
->ex
.bytes
;
6190 if(j
->ex
.bits
.flash
) {
6192 j
->ex
.bits
.flash
= 0;
6194 j
->ex
.bits
.pstn_ring
= 0;
6195 j
->ex
.bits
.caller_id
= 0;
6196 j
->ex
.bits
.pstn_wink
= 0;
6205 j
->ex
.bits
.reserved
= 0;
6207 case PHONE_HOOKSTATE
:
6208 j
->ex
.bits
.hookstate
= 0;
6209 retval
= j
->hookstate
; //j->r_hook;
6211 case IXJCTL_SET_LED
:
6212 LED_SetState(arg
, j
);
6215 retval
= set_base_frame(j
, arg
);
6217 case PHONE_REC_CODEC
:
6218 retval
= set_rec_codec(j
, arg
);
6223 case PHONE_REC_START
:
6224 ixj_record_start(j
);
6226 case PHONE_REC_STOP
:
6229 case PHONE_REC_DEPTH
:
6230 set_rec_depth(j
, arg
);
6232 case PHONE_REC_VOLUME
:
6234 retval
= get_rec_volume(j
);
6237 set_rec_volume(j
, arg
);
6241 case PHONE_REC_VOLUME_LINEAR
:
6243 retval
= get_rec_volume_linear(j
);
6246 set_rec_volume_linear(j
, arg
);
6250 case IXJCTL_DTMF_PRESCALE
:
6252 retval
= get_dtmf_prescale(j
);
6255 set_dtmf_prescale(j
, arg
);
6259 case PHONE_REC_LEVEL
:
6260 retval
= get_rec_level(j
);
6263 retval
= ixj_siadc(j
, arg
);
6266 retval
= ixj_sidac(j
, arg
);
6268 case IXJCTL_AEC_START
:
6269 ixj_aec_start(j
, arg
);
6271 case IXJCTL_AEC_STOP
:
6274 case IXJCTL_AEC_GET_LEVEL
:
6275 retval
= j
->aec_level
;
6277 case PHONE_PLAY_CODEC
:
6278 retval
= set_play_codec(j
, arg
);
6280 case PHONE_PLAY_START
:
6281 retval
= ixj_play_start(j
);
6283 case PHONE_PLAY_STOP
:
6286 case PHONE_PLAY_DEPTH
:
6287 set_play_depth(j
, arg
);
6289 case PHONE_PLAY_VOLUME
:
6291 retval
= get_play_volume(j
);
6294 set_play_volume(j
, arg
);
6298 case PHONE_PLAY_VOLUME_LINEAR
:
6300 retval
= get_play_volume_linear(j
);
6303 set_play_volume_linear(j
, arg
);
6307 case PHONE_PLAY_LEVEL
:
6308 retval
= get_play_level(j
);
6310 case IXJCTL_DSP_TYPE
:
6311 retval
= (j
->dsp
.high
<< 8) + j
->dsp
.low
;
6313 case IXJCTL_DSP_VERSION
:
6314 retval
= (j
->ver
.high
<< 8) + j
->ver
.low
;
6325 case IXJCTL_DRYBUFFER_READ
:
6326 put_user(j
->drybuffer
, (unsigned long __user
*) argp
);
6328 case IXJCTL_DRYBUFFER_CLEAR
:
6331 case IXJCTL_FRAMES_READ
:
6332 put_user(j
->framesread
, (unsigned long __user
*) argp
);
6334 case IXJCTL_FRAMES_WRITTEN
:
6335 put_user(j
->frameswritten
, (unsigned long __user
*) argp
);
6337 case IXJCTL_READ_WAIT
:
6338 put_user(j
->read_wait
, (unsigned long __user
*) argp
);
6340 case IXJCTL_WRITE_WAIT
:
6341 put_user(j
->write_wait
, (unsigned long __user
*) argp
);
6343 case PHONE_MAXRINGS
:
6346 case PHONE_SET_TONE_ON_TIME
:
6347 ixj_set_tone_on(arg
, j
);
6349 case PHONE_SET_TONE_OFF_TIME
:
6350 ixj_set_tone_off(arg
, j
);
6352 case PHONE_GET_TONE_ON_TIME
:
6353 if (ixj_get_tone_on(j
)) {
6356 retval
= (j
->ssr
.high
<< 8) + j
->ssr
.low
;
6359 case PHONE_GET_TONE_OFF_TIME
:
6360 if (ixj_get_tone_off(j
)) {
6363 retval
= (j
->ssr
.high
<< 8) + j
->ssr
.low
;
6366 case PHONE_PLAY_TONE
:
6368 retval
= ixj_play_tone(j
, arg
);
6372 case PHONE_GET_TONE_STATE
:
6373 retval
= j
->tone_state
;
6375 case PHONE_DTMF_READY
:
6376 retval
= j
->ex
.bits
.dtmf_ready
;
6378 case PHONE_GET_DTMF
:
6379 if (ixj_hookstate(j
)) {
6380 if (j
->dtmf_rp
!= j
->dtmf_wp
) {
6381 retval
= j
->dtmfbuffer
[j
->dtmf_rp
];
6383 if (j
->dtmf_rp
== 79)
6385 if (j
->dtmf_rp
== j
->dtmf_wp
) {
6386 j
->ex
.bits
.dtmf_ready
= j
->dtmf_rp
= j
->dtmf_wp
= 0;
6391 case PHONE_GET_DTMF_ASCII
:
6392 if (ixj_hookstate(j
)) {
6393 if (j
->dtmf_rp
!= j
->dtmf_wp
) {
6394 switch (j
->dtmfbuffer
[j
->dtmf_rp
]) {
6396 retval
= 42; /* '*'; */
6400 retval
= 48; /*'0'; */
6404 retval
= 35; /*'#'; */
6408 retval
= 65; /*'A'; */
6412 retval
= 66; /*'B'; */
6416 retval
= 67; /*'C'; */
6420 retval
= 68; /*'D'; */
6424 retval
= 48 + j
->dtmfbuffer
[j
->dtmf_rp
];
6428 if (j
->dtmf_rp
== 79)
6430 if(j
->dtmf_rp
== j
->dtmf_wp
)
6432 j
->ex
.bits
.dtmf_ready
= j
->dtmf_rp
= j
->dtmf_wp
= 0;
6437 case PHONE_DTMF_OOB
:
6438 j
->flags
.dtmf_oob
= arg
;
6440 case PHONE_DIALTONE
:
6446 case PHONE_RINGBACK
:
6450 if(j
->cardtype
== QTI_PHONEJACK
)
6453 retval
= ixj_wink(j
);
6455 case PHONE_CPT_STOP
:
6458 case PHONE_QUERY_CODEC
:
6460 struct phone_codec_data pd
;
6462 int proto_size
[] = {
6464 12, 10, 16, 9, 8, 48, 5,
6465 40, 40, 80, 40, 40, 6
6467 if(copy_from_user(&pd
, argp
, sizeof(pd
))) {
6471 if(pd
.type
<1 || pd
.type
>13) {
6472 retval
= -EPROTONOSUPPORT
;
6476 val
=proto_size
[pd
.type
];
6477 else switch(j
->baseframe
.low
)
6479 case 0xA0:val
=2*proto_size
[pd
.type
];break;
6480 case 0x50:val
=proto_size
[pd
.type
];break;
6481 default:val
=proto_size
[pd
.type
]*3;break;
6483 pd
.buf_min
=pd
.buf_max
=pd
.buf_opt
=val
;
6484 if(copy_to_user(argp
, &pd
, sizeof(pd
)))
6488 case IXJCTL_DSP_IDLE
:
6492 if ((arg
& 0xff) == 0xff)
6493 retval
= ixj_get_mixer(arg
, j
);
6497 case IXJCTL_DAA_COEFF_SET
:
6501 retval
= ixj_daa_write(j
);
6505 retval
= ixj_daa_write(j
);
6508 DAA_Coeff_France(j
);
6509 retval
= ixj_daa_write(j
);
6512 DAA_Coeff_Germany(j
);
6513 retval
= ixj_daa_write(j
);
6516 DAA_Coeff_Australia(j
);
6517 retval
= ixj_daa_write(j
);
6521 retval
= ixj_daa_write(j
);
6528 case IXJCTL_DAA_AGAIN
:
6529 ixj_daa_cr4(j
, arg
| 0x02);
6531 case IXJCTL_PSTN_LINETEST
:
6532 retval
= ixj_linetest(j
);
6535 ixj_write_vmwi(j
, arg
);
6538 if (copy_to_user(argp
, &j
->cid
, sizeof(PHONE_CID
)))
6540 j
->ex
.bits
.caller_id
= 0;
6542 case IXJCTL_WINK_DURATION
:
6547 retval
= ixj_set_port(j
, arg
);
6551 case IXJCTL_POTS_PSTN
:
6552 retval
= ixj_set_pots(j
, arg
);
6554 case PHONE_CAPABILITIES
:
6558 case PHONE_CAPABILITIES_LIST
:
6560 if (copy_to_user(argp
, j
->caplist
, sizeof(struct phone_capability
) * j
->caps
))
6563 case PHONE_CAPABILITIES_CHECK
:
6565 struct phone_capability cap
;
6566 if (copy_from_user(&cap
, argp
, sizeof(cap
)))
6570 retval
= capabilities_check(j
, &cap
);
6574 case PHONE_PSTN_SET_STATE
:
6575 daa_set_mode(j
, arg
);
6577 case PHONE_PSTN_GET_STATE
:
6578 retval
= j
->daa_mode
;
6579 j
->ex
.bits
.pstn_ring
= 0;
6581 case IXJCTL_SET_FILTER
:
6582 if (copy_from_user(&jf
, argp
, sizeof(jf
)))
6584 retval
= ixj_init_filter(j
, &jf
);
6586 case IXJCTL_SET_FILTER_RAW
:
6587 if (copy_from_user(&jfr
, argp
, sizeof(jfr
)))
6590 retval
= ixj_init_filter_raw(j
, &jfr
);
6592 case IXJCTL_GET_FILTER_HIST
:
6596 retval
= j
->filter_hist
[arg
];
6598 case IXJCTL_INIT_TONE
:
6599 if (copy_from_user(&ti
, argp
, sizeof(ti
)))
6602 retval
= ixj_init_tone(j
, &ti
);
6604 case IXJCTL_TONE_CADENCE
:
6605 retval
= ixj_build_cadence(j
, argp
);
6607 case IXJCTL_FILTER_CADENCE
:
6608 retval
= ixj_build_filter_cadence(j
, argp
);
6611 if (copy_from_user(&j
->sigdef
, argp
, sizeof(IXJ_SIGDEF
))) {
6615 j
->ixj_signals
[j
->sigdef
.event
] = j
->sigdef
.signal
;
6616 if(j
->sigdef
.event
< 33) {
6618 for(mant
= 0; mant
< j
->sigdef
.event
; mant
++){
6621 if(j
->sigdef
.signal
)
6622 j
->ex_sig
.bytes
|= raise
;
6624 j
->ex_sig
.bytes
&= (raise
^0xffff);
6627 case IXJCTL_INTERCOM_STOP
:
6628 if(arg
< 0 || arg
>= IXJMAX
)
6634 get_ixj(arg
)->intercom
= -1;
6635 ixj_record_stop(get_ixj(arg
));
6636 ixj_play_stop(get_ixj(arg
));
6639 case IXJCTL_INTERCOM_START
:
6640 if(arg
< 0 || arg
>= IXJMAX
)
6643 ixj_record_start(j
);
6645 get_ixj(arg
)->intercom
= board
;
6646 ixj_play_start(get_ixj(arg
));
6647 ixj_record_start(get_ixj(arg
));
6650 if (ixjdebug
& 0x0040)
6651 printk("phone%d ioctl end, cmd: 0x%x, arg: 0x%lx\n", minor
, cmd
, arg
);
6652 clear_bit(board
, &j
->busyflags
);
6656 static long ixj_ioctl(struct file
*file_p
, unsigned int cmd
, unsigned long arg
)
6659 mutex_lock(&ixj_mutex
);
6660 ret
= do_ixj_ioctl(file_p
, cmd
, arg
);
6661 mutex_unlock(&ixj_mutex
);
6665 static int ixj_fasync(int fd
, struct file
*file_p
, int mode
)
6667 IXJ
*j
= get_ixj(NUM(file_p
->f_path
.dentry
->d_inode
));
6669 return fasync_helper(fd
, file_p
, mode
, &j
->async_queue
);
6672 static const struct file_operations ixj_fops
=
6674 .owner
= THIS_MODULE
,
6675 .read
= ixj_enhanced_read
,
6676 .write
= ixj_enhanced_write
,
6678 .unlocked_ioctl
= ixj_ioctl
,
6679 .release
= ixj_release
,
6680 .fasync
= ixj_fasync
,
6681 .llseek
= default_llseek
,
6684 static int ixj_linetest(IXJ
*j
)
6686 j
->flags
.pstncheck
= 1; /* Testing */
6687 j
->flags
.pstn_present
= 0; /* Assume the line is not there */
6689 daa_int_read(j
); /*Clear DAA Interrupt flags */
6691 /* Hold all relays in the normally de-energized position. */
6694 j
->pld_slicw
.bits
.rly1
= 0;
6695 j
->pld_slicw
.bits
.rly2
= 0;
6696 j
->pld_slicw
.bits
.rly3
= 0;
6697 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
6698 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
6700 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
6701 j
->pld_slicr
.byte
= inb_p(j
->XILINXbase
+ 0x01);
6702 if (j
->pld_slicr
.bits
.potspstn
) {
6703 j
->flags
.pots_pstn
= 1;
6704 j
->flags
.pots_correct
= 0;
6705 LED_SetState(0x4, j
);
6707 j
->flags
.pots_pstn
= 0;
6708 j
->pld_slicw
.bits
.rly1
= 0;
6709 j
->pld_slicw
.bits
.rly2
= 0;
6710 j
->pld_slicw
.bits
.rly3
= 1;
6711 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
6712 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
6714 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
6715 daa_set_mode(j
, SOP_PU_CONVERSATION
);
6718 daa_set_mode(j
, SOP_PU_RESET
);
6719 if (j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.VDD_OK
) {
6720 j
->flags
.pots_correct
= 0; /* Should not be line voltage on POTS port. */
6721 LED_SetState(0x4, j
);
6722 j
->pld_slicw
.bits
.rly3
= 0;
6723 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
6725 j
->flags
.pots_correct
= 1;
6726 LED_SetState(0x8, j
);
6727 j
->pld_slicw
.bits
.rly1
= 1;
6728 j
->pld_slicw
.bits
.rly2
= 0;
6729 j
->pld_slicw
.bits
.rly3
= 0;
6730 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
6733 j
->pld_slicw
.bits
.rly3
= 0;
6734 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
6735 daa_set_mode(j
, SOP_PU_CONVERSATION
);
6738 daa_set_mode(j
, SOP_PU_RESET
);
6739 if (j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.VDD_OK
) {
6740 j
->pstn_sleeptil
= jiffies
+ (hertz
/ 4);
6741 j
->flags
.pstn_present
= 1;
6743 j
->flags
.pstn_present
= 0;
6745 if (j
->flags
.pstn_present
) {
6746 if (j
->flags
.pots_correct
) {
6747 LED_SetState(0xA, j
);
6749 LED_SetState(0x6, j
);
6752 if (j
->flags
.pots_correct
) {
6753 LED_SetState(0x9, j
);
6755 LED_SetState(0x5, j
);
6758 j
->flags
.pstncheck
= 0; /* Testing */
6759 return j
->flags
.pstn_present
;
6762 static int ixj_selfprobe(IXJ
*j
)
6768 init_waitqueue_head(&j
->poll_q
);
6769 init_waitqueue_head(&j
->read_q
);
6770 init_waitqueue_head(&j
->write_q
);
6772 while(atomic_read(&j
->DSPWrite
) > 0)
6773 atomic_dec(&j
->DSPWrite
);
6774 if (ixjdebug
& 0x0002)
6775 printk(KERN_INFO
"Write IDLE to Software Control Register\n");
6776 ixj_WriteDSPCommand(0x0FE0, j
); /* Put the DSP in full power mode. */
6778 if (ixj_WriteDSPCommand(0x0000, j
)) /* Write IDLE to Software Control Register */
6780 /* The read values of the SSR should be 0x00 for the IDLE command */
6781 if (j
->ssr
.low
|| j
->ssr
.high
)
6783 if (ixjdebug
& 0x0002)
6784 printk(KERN_INFO
"Get Device ID Code\n");
6785 if (ixj_WriteDSPCommand(0x3400, j
)) /* Get Device ID Code */
6787 j
->dsp
.low
= j
->ssr
.low
;
6788 j
->dsp
.high
= j
->ssr
.high
;
6789 if (ixjdebug
& 0x0002)
6790 printk(KERN_INFO
"Get Device Version Code\n");
6791 if (ixj_WriteDSPCommand(0x3800, j
)) /* Get Device Version Code */
6793 j
->ver
.low
= j
->ssr
.low
;
6794 j
->ver
.high
= j
->ssr
.high
;
6796 if (j
->dsp
.low
== 0x21) {
6797 bytes
.high
= bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
6798 outb_p(bytes
.low
^ 0xFF, j
->XILINXbase
+ 0x02);
6799 /* Test for Internet LineJACK or Internet PhoneJACK Lite */
6800 bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
6801 if (bytes
.low
== bytes
.high
) /* Register is read only on */
6802 /* Internet PhoneJack Lite */
6804 j
->cardtype
= QTI_PHONEJACK_LITE
;
6805 if (!request_region(j
->XILINXbase
, 4, "ixj control")) {
6806 printk(KERN_INFO
"ixj: can't get I/O address 0x%x\n", j
->XILINXbase
);
6809 j
->pld_slicw
.pcib
.e1
= 1;
6810 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
);
6812 j
->cardtype
= QTI_LINEJACK
;
6814 if (!request_region(j
->XILINXbase
, 8, "ixj control")) {
6815 printk(KERN_INFO
"ixj: can't get I/O address 0x%x\n", j
->XILINXbase
);
6819 } else if (j
->dsp
.low
== 0x22) {
6820 j
->cardtype
= QTI_PHONEJACK_PCI
;
6821 request_region(j
->XILINXbase
, 4, "ixj control");
6822 j
->pld_slicw
.pcib
.e1
= 1;
6823 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
);
6825 j
->cardtype
= QTI_PHONEJACK
;
6827 switch (j
->cardtype
) {
6829 if (!j
->dsp
.low
!= 0x20) {
6832 ixj_WriteDSPCommand(0x3800, j
);
6833 j
->ver
.low
= j
->ssr
.low
;
6834 j
->ver
.high
= j
->ssr
.high
;
6838 if (!request_region(j
->XILINXbase
, 8, "ixj control")) {
6839 printk(KERN_INFO
"ixj: can't get I/O address 0x%x\n", j
->XILINXbase
);
6843 case QTI_PHONEJACK_LITE
:
6844 case QTI_PHONEJACK_PCI
:
6845 if (!request_region(j
->XILINXbase
, 4, "ixj control")) {
6846 printk(KERN_INFO
"ixj: can't get I/O address 0x%x\n", j
->XILINXbase
);
6849 j
->pld_slicw
.pcib
.e1
= 1;
6850 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
);
6856 if (j
->dsp
.low
== 0x20 || j
->cardtype
== QTI_PHONEJACK_LITE
|| j
->cardtype
== QTI_PHONEJACK_PCI
) {
6857 if (ixjdebug
& 0x0002)
6858 printk(KERN_INFO
"Write CODEC config to Software Control Register\n");
6859 if (ixj_WriteDSPCommand(0xC462, j
)) /* Write CODEC config to Software Control Register */
6861 if (ixjdebug
& 0x0002)
6862 printk(KERN_INFO
"Write CODEC timing to Software Control Register\n");
6863 if (j
->cardtype
== QTI_PHONEJACK
) {
6868 if (ixj_WriteDSPCommand(cmd
, j
)) /* Write CODEC timing to Software Control Register */
6871 if (set_base_frame(j
, 30) != 30)
6873 if (ixjdebug
& 0x0002)
6874 printk(KERN_INFO
"Write CODEC config to Software Control Register\n");
6875 if (j
->cardtype
== QTI_PHONECARD
) {
6876 if (ixj_WriteDSPCommand(0xC528, j
)) /* Write CODEC config to Software Control Register */
6879 if (j
->cardtype
== QTI_LINEJACK
) {
6880 if (ixj_WriteDSPCommand(0xC528, j
)) /* Write CODEC config to Software Control Register */
6882 if (ixjdebug
& 0x0002)
6883 printk(KERN_INFO
"Turn on the PLD Clock at 8Khz\n");
6884 j
->pld_clock
.byte
= 0;
6885 outb_p(j
->pld_clock
.byte
, j
->XILINXbase
+ 0x04);
6889 if (j
->dsp
.low
== 0x20) {
6890 if (ixjdebug
& 0x0002)
6891 printk(KERN_INFO
"Configure GPIO pins\n");
6892 j
->gpio
.bytes
.high
= 0x09;
6893 /* bytes.low = 0xEF; 0xF7 */
6894 j
->gpio
.bits
.gpio1
= 1;
6895 j
->gpio
.bits
.gpio2
= 1;
6896 j
->gpio
.bits
.gpio3
= 0;
6897 j
->gpio
.bits
.gpio4
= 1;
6898 j
->gpio
.bits
.gpio5
= 1;
6899 j
->gpio
.bits
.gpio6
= 1;
6900 j
->gpio
.bits
.gpio7
= 1;
6901 ixj_WriteDSPCommand(j
->gpio
.word
, j
); /* Set GPIO pin directions */
6902 if (ixjdebug
& 0x0002)
6903 printk(KERN_INFO
"Enable SLIC\n");
6904 j
->gpio
.bytes
.high
= 0x0B;
6905 j
->gpio
.bytes
.low
= 0x00;
6906 j
->gpio
.bits
.gpio1
= 0;
6907 j
->gpio
.bits
.gpio2
= 1;
6908 j
->gpio
.bits
.gpio5
= 0;
6909 ixj_WriteDSPCommand(j
->gpio
.word
, j
); /* send the ring stop signal */
6910 j
->port
= PORT_POTS
;
6912 if (j
->cardtype
== QTI_LINEJACK
) {
6913 LED_SetState(0x1, j
);
6915 LED_SetState(0x2, j
);
6917 LED_SetState(0x4, j
);
6919 LED_SetState(0x8, j
);
6921 LED_SetState(0x0, j
);
6923 if (ixjdebug
& 0x0002)
6924 printk("Loading DAA Coefficients\n");
6926 if (!ixj_daa_write(j
)) {
6927 printk("DAA write failed on board %d\n", j
->board
);
6930 if(!ixj_daa_cid_reset(j
)) {
6931 printk("DAA CID reset failed on board %d\n", j
->board
);
6934 j
->flags
.pots_correct
= 0;
6935 j
->flags
.pstn_present
= 0;
6937 if (j
->flags
.pots_correct
) {
6938 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
6940 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
6941 j
->pld_slicw
.bits
.rly1
= 1;
6942 j
->pld_slicw
.bits
.spken
= 1;
6943 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
6944 SLIC_SetState(PLD_SLIC_STATE_STANDBY
, j
);
6945 /* SLIC_SetState(PLD_SLIC_STATE_ACTIVE, j); */
6946 j
->port
= PORT_POTS
;
6948 ixj_set_port(j
, PORT_PSTN
);
6950 if (ixjdebug
& 0x0002)
6951 printk(KERN_INFO
"Enable Mixer\n");
6952 ixj_mixer(0x0000, j
); /*Master Volume Left unmute 0db */
6953 ixj_mixer(0x0100, j
); /*Master Volume Right unmute 0db */
6955 ixj_mixer(0x0203, j
); /*Voice Left Volume unmute 6db */
6956 ixj_mixer(0x0303, j
); /*Voice Right Volume unmute 6db */
6958 ixj_mixer(0x0480, j
); /*FM Left mute */
6959 ixj_mixer(0x0580, j
); /*FM Right mute */
6961 ixj_mixer(0x0680, j
); /*CD Left mute */
6962 ixj_mixer(0x0780, j
); /*CD Right mute */
6964 ixj_mixer(0x0880, j
); /*Line Left mute */
6965 ixj_mixer(0x0980, j
); /*Line Right mute */
6967 ixj_mixer(0x0A80, j
); /*Aux left mute */
6968 ixj_mixer(0x0B80, j
); /*Aux right mute */
6970 ixj_mixer(0x0C00, j
); /*Mono1 unmute 12db */
6971 ixj_mixer(0x0D80, j
); /*Mono2 mute */
6973 ixj_mixer(0x0E80, j
); /*Mic mute */
6975 ixj_mixer(0x0F00, j
); /*Mono Out Volume unmute 0db */
6977 ixj_mixer(0x1000, j
); /*Voice Left and Right out only */
6978 ixj_mixer(0x110C, j
);
6981 ixj_mixer(0x1200, j
); /*Mono1 switch on mixer left */
6982 ixj_mixer(0x1401, j
);
6984 ixj_mixer(0x1300, j
); /*Mono1 switch on mixer right */
6985 ixj_mixer(0x1501, j
);
6987 ixj_mixer(0x1700, j
); /*Clock select */
6989 ixj_mixer(0x1800, j
); /*ADC input from mixer */
6991 ixj_mixer(0x1901, j
); /*Mic gain 30db */
6993 if (ixjdebug
& 0x0002)
6994 printk(KERN_INFO
"Setting Default US Ring Cadence Detection\n");
6995 j
->cadence_f
[4].state
= 0;
6996 j
->cadence_f
[4].on1
= 0; /*Cadence Filter 4 is used for PSTN ring cadence */
6997 j
->cadence_f
[4].off1
= 0;
6998 j
->cadence_f
[4].on2
= 0;
6999 j
->cadence_f
[4].off2
= 0;
7000 j
->cadence_f
[4].on3
= 0;
7001 j
->cadence_f
[4].off3
= 0; /* These should represent standard US ring pulse. */
7002 j
->pstn_last_rmr
= jiffies
;
7005 if (j
->cardtype
== QTI_PHONECARD
) {
7006 ixj_WriteDSPCommand(0xCF07, j
);
7007 ixj_WriteDSPCommand(0x00B0, j
);
7008 ixj_set_port(j
, PORT_SPEAKER
);
7010 ixj_set_port(j
, PORT_POTS
);
7011 SLIC_SetState(PLD_SLIC_STATE_STANDBY
, j
);
7012 /* SLIC_SetState(PLD_SLIC_STATE_ACTIVE, j); */
7018 j
->framesread
= j
->frameswritten
= 0;
7019 j
->read_wait
= j
->write_wait
= 0;
7020 j
->rxreadycheck
= j
->txreadycheck
= 0;
7022 /* initialise the DTMF prescale to a sensible value */
7023 if (j
->cardtype
== QTI_LINEJACK
) {
7024 set_dtmf_prescale(j
, 0x10);
7026 set_dtmf_prescale(j
, 0x40);
7028 set_play_volume(j
, 0x100);
7029 set_rec_volume(j
, 0x100);
7031 if (ixj_WriteDSPCommand(0x0000, j
)) /* Write IDLE to Software Control Register */
7033 /* The read values of the SSR should be 0x00 for the IDLE command */
7034 if (j
->ssr
.low
|| j
->ssr
.high
)
7037 if (ixjdebug
& 0x0002)
7038 printk(KERN_INFO
"Enable Line Monitor\n");
7040 if (ixjdebug
& 0x0002)
7041 printk(KERN_INFO
"Set Line Monitor to Asyncronous Mode\n");
7043 if (ixj_WriteDSPCommand(0x7E01, j
)) /* Asynchronous Line Monitor */
7046 if (ixjdebug
& 0x002)
7047 printk(KERN_INFO
"Enable DTMF Detectors\n");
7049 if (ixj_WriteDSPCommand(0x5151, j
)) /* Enable DTMF detection */
7052 if (ixj_WriteDSPCommand(0x6E01, j
)) /* Set Asyncronous Tone Generation */
7055 set_rec_depth(j
, 2); /* Set Record Channel Limit to 2 frames */
7057 set_play_depth(j
, 2); /* Set Playback Channel Limit to 2 frames */
7059 j
->ex
.bits
.dtmf_ready
= 0;
7061 j
->dtmf_wp
= j
->dtmf_rp
= 0;
7062 j
->rec_mode
= j
->play_mode
= -1;
7063 j
->flags
.ringing
= 0;
7064 j
->maxrings
= MAXRINGS
;
7065 j
->ring_cadence
= USA_RING_CADENCE
;
7068 j
->flags
.dtmf_oob
= 0;
7069 for (cnt
= 0; cnt
< 4; cnt
++)
7070 j
->cadence_f
[cnt
].enable
= 0;
7071 /* must be a device on the specified address */
7072 ixj_WriteDSPCommand(0x0FE3, j
); /* Put the DSP in 1/5 power mode. */
7074 /* Set up the default signals for events */
7075 for (cnt
= 0; cnt
< 35; cnt
++)
7076 j
->ixj_signals
[cnt
] = SIGIO
;
7078 /* Set the excetion signal enable flags */
7079 j
->ex_sig
.bits
.dtmf_ready
= j
->ex_sig
.bits
.hookstate
= j
->ex_sig
.bits
.flash
= j
->ex_sig
.bits
.pstn_ring
=
7080 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
=
7081 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;
7082 #ifdef IXJ_DYN_ALLOC
7088 /* Register with the Telephony for Linux subsystem */
7089 j
->p
.f_op
= &ixj_fops
;
7090 j
->p
.open
= ixj_open
;
7091 j
->p
.board
= j
->board
;
7092 phone_register_device(&j
->p
, PHONE_UNIT_ANY
);
7100 * Exported service for pcmcia card handling
7103 IXJ
*ixj_pcmcia_probe(unsigned long dsp
, unsigned long xilinx
)
7105 IXJ
*j
= ixj_alloc();
7110 j
->XILINXbase
= xilinx
;
7111 j
->cardtype
= QTI_PHONECARD
;
7116 EXPORT_SYMBOL(ixj_pcmcia_probe
); /* Fpr PCMCIA */
7118 static int ixj_get_status_proc(char *buf
)
7124 len
+= sprintf(buf
+ len
, "\nDriver version %i.%i.%i", IXJ_VER_MAJOR
, IXJ_VER_MINOR
, IXJ_BLD_VER
);
7125 len
+= sprintf(buf
+ len
, "\nsizeof IXJ struct %Zd bytes", sizeof(IXJ
));
7126 len
+= sprintf(buf
+ len
, "\nsizeof DAA struct %Zd bytes", sizeof(DAA_REGS
));
7127 len
+= sprintf(buf
+ len
, "\nUsing old telephony API");
7128 len
+= sprintf(buf
+ len
, "\nDebug Level %d\n", ixjdebug
);
7130 for (cnt
= 0; cnt
< IXJMAX
; cnt
++) {
7135 len
+= sprintf(buf
+ len
, "\nCard Num %d", cnt
);
7136 len
+= sprintf(buf
+ len
, "\nDSP Base Address 0x%4.4x", j
->DSPbase
);
7137 if (j
->cardtype
!= QTI_PHONEJACK
)
7138 len
+= sprintf(buf
+ len
, "\nXILINX Base Address 0x%4.4x", j
->XILINXbase
);
7139 len
+= sprintf(buf
+ len
, "\nDSP Type %2.2x%2.2x", j
->dsp
.high
, j
->dsp
.low
);
7140 len
+= sprintf(buf
+ len
, "\nDSP Version %2.2x.%2.2x", j
->ver
.high
, j
->ver
.low
);
7141 len
+= sprintf(buf
+ len
, "\nSerial Number %8.8x", j
->serial
);
7142 switch (j
->cardtype
) {
7143 case (QTI_PHONEJACK
):
7144 len
+= sprintf(buf
+ len
, "\nCard Type = Internet PhoneJACK");
7146 case (QTI_LINEJACK
):
7147 len
+= sprintf(buf
+ len
, "\nCard Type = Internet LineJACK");
7148 if (j
->flags
.g729_loaded
)
7149 len
+= sprintf(buf
+ len
, " w/G.729 A/B");
7150 len
+= sprintf(buf
+ len
, " Country = %d", j
->daa_country
);
7152 case (QTI_PHONEJACK_LITE
):
7153 len
+= sprintf(buf
+ len
, "\nCard Type = Internet PhoneJACK Lite");
7154 if (j
->flags
.g729_loaded
)
7155 len
+= sprintf(buf
+ len
, " w/G.729 A/B");
7157 case (QTI_PHONEJACK_PCI
):
7158 len
+= sprintf(buf
+ len
, "\nCard Type = Internet PhoneJACK PCI");
7159 if (j
->flags
.g729_loaded
)
7160 len
+= sprintf(buf
+ len
, " w/G.729 A/B");
7162 case (QTI_PHONECARD
):
7163 len
+= sprintf(buf
+ len
, "\nCard Type = Internet PhoneCARD");
7164 if (j
->flags
.g729_loaded
)
7165 len
+= sprintf(buf
+ len
, " w/G.729 A/B");
7166 len
+= sprintf(buf
+ len
, "\nSmart Cable %spresent", j
->pccr1
.bits
.drf
? "not " : "");
7167 if (!j
->pccr1
.bits
.drf
)
7168 len
+= sprintf(buf
+ len
, "\nSmart Cable type %d", j
->flags
.pcmciasct
);
7169 len
+= sprintf(buf
+ len
, "\nSmart Cable state %d", j
->flags
.pcmciastate
);
7172 len
+= sprintf(buf
+ len
, "\nCard Type = %d", j
->cardtype
);
7175 len
+= sprintf(buf
+ len
, "\nReaders %d", j
->readers
);
7176 len
+= sprintf(buf
+ len
, "\nWriters %d", j
->writers
);
7178 len
+= sprintf(buf
+ len
, "\nCapabilities %d", j
->caps
);
7179 if (j
->dsp
.low
!= 0x20)
7180 len
+= sprintf(buf
+ len
, "\nDSP Processor load %d", j
->proc_load
);
7181 if (j
->flags
.cidsent
)
7182 len
+= sprintf(buf
+ len
, "\nCaller ID data sent");
7184 len
+= sprintf(buf
+ len
, "\nCaller ID data not sent");
7186 len
+= sprintf(buf
+ len
, "\nPlay CODEC ");
7187 switch (j
->play_codec
) {
7189 len
+= sprintf(buf
+ len
, "G.723.1 6.3");
7192 len
+= sprintf(buf
+ len
, "G.723.1 5.3");
7195 len
+= sprintf(buf
+ len
, "TrueSpeech 8.5");
7198 len
+= sprintf(buf
+ len
, "TrueSpeech 4.8");
7201 len
+= sprintf(buf
+ len
, "TrueSpeech 4.1");
7204 len
+= sprintf(buf
+ len
, "G.728");
7207 len
+= sprintf(buf
+ len
, "G.729");
7210 len
+= sprintf(buf
+ len
, "G.729B");
7213 len
+= sprintf(buf
+ len
, "uLaw");
7216 len
+= sprintf(buf
+ len
, "aLaw");
7219 len
+= sprintf(buf
+ len
, "16 bit Linear");
7222 len
+= sprintf(buf
+ len
, "8 bit Linear");
7225 len
+= sprintf(buf
+ len
, "Windows Sound System");
7228 len
+= sprintf(buf
+ len
, "NO CODEC CHOSEN");
7231 len
+= sprintf(buf
+ len
, "\nRecord CODEC ");
7232 switch (j
->rec_codec
) {
7234 len
+= sprintf(buf
+ len
, "G.723.1 6.3");
7237 len
+= sprintf(buf
+ len
, "G.723.1 5.3");
7240 len
+= sprintf(buf
+ len
, "TrueSpeech 8.5");
7243 len
+= sprintf(buf
+ len
, "TrueSpeech 4.8");
7246 len
+= sprintf(buf
+ len
, "TrueSpeech 4.1");
7249 len
+= sprintf(buf
+ len
, "G.728");
7252 len
+= sprintf(buf
+ len
, "G.729");
7255 len
+= sprintf(buf
+ len
, "G.729B");
7258 len
+= sprintf(buf
+ len
, "uLaw");
7261 len
+= sprintf(buf
+ len
, "aLaw");
7264 len
+= sprintf(buf
+ len
, "16 bit Linear");
7267 len
+= sprintf(buf
+ len
, "8 bit Linear");
7270 len
+= sprintf(buf
+ len
, "Windows Sound System");
7273 len
+= sprintf(buf
+ len
, "NO CODEC CHOSEN");
7276 len
+= sprintf(buf
+ len
, "\nAEC ");
7277 switch (j
->aec_level
) {
7279 len
+= sprintf(buf
+ len
, "Off");
7282 len
+= sprintf(buf
+ len
, "Low");
7285 len
+= sprintf(buf
+ len
, "Med");
7288 len
+= sprintf(buf
+ len
, "High");
7291 len
+= sprintf(buf
+ len
, "Auto");
7294 len
+= sprintf(buf
+ len
, "AEC/AGC");
7297 len
+= sprintf(buf
+ len
, "unknown(%i)", j
->aec_level
);
7301 len
+= sprintf(buf
+ len
, "\nRec volume 0x%x", get_rec_volume(j
));
7302 len
+= sprintf(buf
+ len
, "\nPlay volume 0x%x", get_play_volume(j
));
7303 len
+= sprintf(buf
+ len
, "\nDTMF prescale 0x%x", get_dtmf_prescale(j
));
7305 len
+= sprintf(buf
+ len
, "\nHook state %d", j
->hookstate
); /* j->r_hook); */
7307 if (j
->cardtype
== QTI_LINEJACK
) {
7308 len
+= sprintf(buf
+ len
, "\nPOTS Correct %d", j
->flags
.pots_correct
);
7309 len
+= sprintf(buf
+ len
, "\nPSTN Present %d", j
->flags
.pstn_present
);
7310 len
+= sprintf(buf
+ len
, "\nPSTN Check %d", j
->flags
.pstncheck
);
7311 len
+= sprintf(buf
+ len
, "\nPOTS to PSTN %d", j
->flags
.pots_pstn
);
7312 switch (j
->daa_mode
) {
7314 len
+= sprintf(buf
+ len
, "\nDAA PSTN On Hook");
7316 case SOP_PU_RINGING
:
7317 len
+= sprintf(buf
+ len
, "\nDAA PSTN Ringing");
7318 len
+= sprintf(buf
+ len
, "\nRinging state = %d", j
->cadence_f
[4].state
);
7320 case SOP_PU_CONVERSATION
:
7321 len
+= sprintf(buf
+ len
, "\nDAA PSTN Off Hook");
7323 case SOP_PU_PULSEDIALING
:
7324 len
+= sprintf(buf
+ len
, "\nDAA PSTN Pulse Dialing");
7327 len
+= sprintf(buf
+ len
, "\nDAA RMR = %d", j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.bitreg
.RMR
);
7328 len
+= sprintf(buf
+ len
, "\nDAA VDD OK = %d", j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.VDD_OK
);
7329 len
+= sprintf(buf
+ len
, "\nDAA CR0 = 0x%02x", j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
);
7330 len
+= sprintf(buf
+ len
, "\nDAA CR1 = 0x%02x", j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
);
7331 len
+= sprintf(buf
+ len
, "\nDAA CR2 = 0x%02x", j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
);
7332 len
+= sprintf(buf
+ len
, "\nDAA CR3 = 0x%02x", j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
);
7333 len
+= sprintf(buf
+ len
, "\nDAA CR4 = 0x%02x", j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
);
7334 len
+= sprintf(buf
+ len
, "\nDAA CR5 = 0x%02x", j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr5
.reg
);
7335 len
+= sprintf(buf
+ len
, "\nDAA XR0 = 0x%02x", j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.reg
);
7336 len
+= sprintf(buf
+ len
, "\nDAA ringstop %ld - jiffies %ld", j
->pstn_ring_stop
, jiffies
);
7340 len
+= sprintf(buf
+ len
, "\nPort POTS");
7343 len
+= sprintf(buf
+ len
, "\nPort PSTN");
7346 len
+= sprintf(buf
+ len
, "\nPort SPEAKER/MIC");
7349 len
+= sprintf(buf
+ len
, "\nPort HANDSET");
7352 if (j
->dsp
.low
== 0x21 || j
->dsp
.low
== 0x22) {
7353 len
+= sprintf(buf
+ len
, "\nSLIC state ");
7354 switch (SLIC_GetState(j
)) {
7355 case PLD_SLIC_STATE_OC
:
7356 len
+= sprintf(buf
+ len
, "OC");
7358 case PLD_SLIC_STATE_RINGING
:
7359 len
+= sprintf(buf
+ len
, "RINGING");
7361 case PLD_SLIC_STATE_ACTIVE
:
7362 len
+= sprintf(buf
+ len
, "ACTIVE");
7364 case PLD_SLIC_STATE_OHT
: /* On-hook transmit */
7365 len
+= sprintf(buf
+ len
, "OHT");
7367 case PLD_SLIC_STATE_TIPOPEN
:
7368 len
+= sprintf(buf
+ len
, "TIPOPEN");
7370 case PLD_SLIC_STATE_STANDBY
:
7371 len
+= sprintf(buf
+ len
, "STANDBY");
7373 case PLD_SLIC_STATE_APR
: /* Active polarity reversal */
7374 len
+= sprintf(buf
+ len
, "APR");
7376 case PLD_SLIC_STATE_OHTPR
: /* OHT polarity reversal */
7377 len
+= sprintf(buf
+ len
, "OHTPR");
7380 len
+= sprintf(buf
+ len
, "%d", SLIC_GetState(j
));
7384 len
+= sprintf(buf
+ len
, "\nBase Frame %2.2x.%2.2x", j
->baseframe
.high
, j
->baseframe
.low
);
7385 len
+= sprintf(buf
+ len
, "\nCID Base Frame %2d", j
->cid_base_frame_size
);
7386 #ifdef PERFMON_STATS
7387 len
+= sprintf(buf
+ len
, "\nTimer Checks %ld", j
->timerchecks
);
7388 len
+= sprintf(buf
+ len
, "\nRX Ready Checks %ld", j
->rxreadycheck
);
7389 len
+= sprintf(buf
+ len
, "\nTX Ready Checks %ld", j
->txreadycheck
);
7390 len
+= sprintf(buf
+ len
, "\nFrames Read %ld", j
->framesread
);
7391 len
+= sprintf(buf
+ len
, "\nFrames Written %ld", j
->frameswritten
);
7392 len
+= sprintf(buf
+ len
, "\nDry Buffer %ld", j
->drybuffer
);
7393 len
+= sprintf(buf
+ len
, "\nRead Waits %ld", j
->read_wait
);
7394 len
+= sprintf(buf
+ len
, "\nWrite Waits %ld", j
->write_wait
);
7395 len
+= sprintf(buf
+ len
, "\nStatus Waits %ld", j
->statuswait
);
7396 len
+= sprintf(buf
+ len
, "\nStatus Wait Fails %ld", j
->statuswaitfail
);
7397 len
+= sprintf(buf
+ len
, "\nPControl Waits %ld", j
->pcontrolwait
);
7398 len
+= sprintf(buf
+ len
, "\nPControl Wait Fails %ld", j
->pcontrolwaitfail
);
7399 len
+= sprintf(buf
+ len
, "\nIs Control Ready Checks %ld", j
->iscontrolready
);
7400 len
+= sprintf(buf
+ len
, "\nIs Control Ready Check failures %ld", j
->iscontrolreadyfail
);
7403 len
+= sprintf(buf
+ len
, "\n");
7409 static int ixj_read_proc(char *page
, char **start
, off_t off
,
7410 int count
, int *eof
, void *data
)
7412 int len
= ixj_get_status_proc(page
);
7413 if (len
<= off
+count
) *eof
= 1;
7414 *start
= page
+ off
;
7416 if (len
>count
) len
= count
;
7422 static void cleanup(void)
7427 for (cnt
= 0; cnt
< IXJMAX
; cnt
++) {
7429 if(j
!= NULL
&& j
->DSPbase
) {
7430 if (ixjdebug
& 0x0002)
7431 printk(KERN_INFO
"IXJ: Deleting timer for /dev/phone%d\n", cnt
);
7432 del_timer(&j
->timer
);
7433 if (j
->cardtype
== QTI_LINEJACK
) {
7434 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
7436 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
7437 j
->pld_slicw
.bits
.rly1
= 0;
7438 j
->pld_slicw
.bits
.rly2
= 0;
7439 j
->pld_slicw
.bits
.rly3
= 0;
7440 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
7441 LED_SetState(0x0, j
);
7442 if (ixjdebug
& 0x0002)
7443 printk(KERN_INFO
"IXJ: Releasing XILINX address for /dev/phone%d\n", cnt
);
7444 release_region(j
->XILINXbase
, 8);
7445 } else if (j
->cardtype
== QTI_PHONEJACK_LITE
|| j
->cardtype
== QTI_PHONEJACK_PCI
) {
7446 if (ixjdebug
& 0x0002)
7447 printk(KERN_INFO
"IXJ: Releasing XILINX address for /dev/phone%d\n", cnt
);
7448 release_region(j
->XILINXbase
, 4);
7450 kfree(j
->read_buffer
);
7451 kfree(j
->write_buffer
);
7453 pnp_device_detach(j
->dev
);
7454 if (ixjdebug
& 0x0002)
7455 printk(KERN_INFO
"IXJ: Unregistering /dev/phone%d from LTAPI\n", cnt
);
7456 phone_unregister_device(&j
->p
);
7457 if (ixjdebug
& 0x0002)
7458 printk(KERN_INFO
"IXJ: Releasing DSP address for /dev/phone%d\n", cnt
);
7459 release_region(j
->DSPbase
, 16);
7460 #ifdef IXJ_DYN_ALLOC
7461 if (ixjdebug
& 0x0002)
7462 printk(KERN_INFO
"IXJ: Freeing memory for /dev/phone%d\n", cnt
);
7468 if (ixjdebug
& 0x0002)
7469 printk(KERN_INFO
"IXJ: Removing /proc/ixj\n");
7470 remove_proc_entry ("ixj", NULL
);
7479 static void PCIEE_WriteBit(WORD wEEPROMAddress
, BYTE lastLCC
, BYTE byData
)
7481 lastLCC
= lastLCC
& 0xfb;
7482 lastLCC
= lastLCC
| (byData
? 4 : 0);
7483 outb(lastLCC
, wEEPROMAddress
); /*set data out bit as appropriate */
7486 lastLCC
= lastLCC
| 0x01;
7487 outb(lastLCC
, wEEPROMAddress
); /*SK rising edge */
7489 byData
= byData
<< 1;
7490 lastLCC
= lastLCC
& 0xfe;
7492 outb(lastLCC
, wEEPROMAddress
); /*after delay, SK falling edge */
7496 static BYTE
PCIEE_ReadBit(WORD wEEPROMAddress
, BYTE lastLCC
)
7499 lastLCC
= lastLCC
| 0x01;
7500 outb(lastLCC
, wEEPROMAddress
); /*SK rising edge */
7502 lastLCC
= lastLCC
& 0xfe;
7504 outb(lastLCC
, wEEPROMAddress
); /*after delay, SK falling edge */
7506 return ((inb(wEEPROMAddress
) >> 3) & 1);
7509 static bool PCIEE_ReadWord(WORD wAddress
, WORD wLoc
, WORD
* pwResult
)
7512 WORD wEEPROMAddress
= wAddress
+ 3;
7516 lastLCC
= inb(wEEPROMAddress
);
7517 lastLCC
= lastLCC
| 0x02;
7518 lastLCC
= lastLCC
& 0xfe;
7519 outb(lastLCC
, wEEPROMAddress
); /* CS hi, SK lo */
7521 mdelay(1); /* delay */
7523 PCIEE_WriteBit(wEEPROMAddress
, lastLCC
, 1);
7524 PCIEE_WriteBit(wEEPROMAddress
, lastLCC
, 1);
7525 PCIEE_WriteBit(wEEPROMAddress
, lastLCC
, 0);
7526 for (i
= 0; i
< 8; i
++) {
7527 PCIEE_WriteBit(wEEPROMAddress
, lastLCC
, wLoc
& 0x80 ? 1 : 0);
7531 for (i
= 0; i
< 16; i
++) {
7532 byResult
= PCIEE_ReadBit(wEEPROMAddress
, lastLCC
);
7533 *pwResult
= (*pwResult
<< 1) | byResult
;
7536 mdelay(1); /* another delay */
7538 lastLCC
= lastLCC
& 0xfd;
7539 outb(lastLCC
, wEEPROMAddress
); /* negate CS */
7544 static DWORD
PCIEE_GetSerialNumber(WORD wAddress
)
7547 if (PCIEE_ReadWord(wAddress
, 62, &wLo
))
7549 if (PCIEE_ReadWord(wAddress
, 63, &wHi
))
7551 return (((DWORD
) wHi
<< 16) | wLo
);
7554 static int dspio
[IXJMAX
+ 1] =
7558 static int xio
[IXJMAX
+ 1] =
7563 module_param_array(dspio
, int, NULL
, 0);
7564 module_param_array(xio
, int, NULL
, 0);
7565 MODULE_DESCRIPTION("Quicknet VoIP Telephony card module - www.quicknet.net");
7566 MODULE_AUTHOR("Ed Okerson <eokerson@quicknet.net>");
7567 MODULE_LICENSE("GPL");
7569 static void __exit
ixj_exit(void)
7574 static IXJ
*new_ixj(unsigned long port
)
7577 if (!request_region(port
, 16, "ixj DSP")) {
7578 printk(KERN_INFO
"ixj: can't get I/O address 0x%lx\n", port
);
7583 release_region(port
, 16);
7584 printk(KERN_INFO
"ixj: out of memory\n");
7587 res
->DSPbase
= port
;
7591 static int __init
ixj_probe_isapnp(int *cnt
)
7595 struct pnp_dev
*dev
= NULL
, *old_dev
= NULL
;
7603 dev
= pnp_find_dev(NULL
, ISAPNP_VENDOR('Q', 'T', 'I'),
7604 ISAPNP_FUNCTION(func
), old_dev
);
7605 if (!dev
|| !dev
->card
)
7607 result
= pnp_device_attach(dev
);
7609 printk("pnp attach failed %d \n", result
);
7612 if (pnp_activate_dev(dev
) < 0) {
7613 printk("pnp activate failed (out of resources?)\n");
7614 pnp_device_detach(dev
);
7618 if (!pnp_port_valid(dev
, 0)) {
7619 pnp_device_detach(dev
);
7623 j
= new_ixj(pnp_port_start(dev
, 0));
7628 j
->XILINXbase
= pnp_port_start(dev
, 1); /* get real port */
7632 j
->cardtype
= QTI_PHONEJACK
;
7635 j
->cardtype
= QTI_LINEJACK
;
7638 j
->cardtype
= QTI_PHONEJACK_LITE
;
7642 probe
= ixj_selfprobe(j
);
7644 j
->serial
= dev
->card
->serial
;
7648 printk(KERN_INFO
"ixj: found Internet PhoneJACK at 0x%x\n", j
->DSPbase
);
7651 printk(KERN_INFO
"ixj: found Internet LineJACK at 0x%x\n", j
->DSPbase
);
7654 printk(KERN_INFO
"ixj: found Internet PhoneJACK Lite at 0x%x\n", j
->DSPbase
);
7671 static int __init
ixj_probe_isa(int *cnt
)
7675 /* Use passed parameters for older kernels without PnP */
7676 for (i
= 0; i
< IXJMAX
; i
++) {
7678 IXJ
*j
= new_ixj(dspio
[i
]);
7683 j
->XILINXbase
= xio
[i
];
7687 probe
= ixj_selfprobe(j
);
7695 static int __init
ixj_probe_pci(int *cnt
)
7697 struct pci_dev
*pci
= NULL
;
7701 for (i
= 0; i
< IXJMAX
- *cnt
; i
++) {
7702 pci
= pci_get_device(PCI_VENDOR_ID_QUICKNET
,
7703 PCI_DEVICE_ID_QUICKNET_XJ
, pci
);
7707 if (pci_enable_device(pci
))
7709 j
= new_ixj(pci_resource_start(pci
, 0));
7713 j
->serial
= (PCIEE_GetSerialNumber
)pci_resource_start(pci
, 2);
7714 j
->XILINXbase
= j
->DSPbase
+ 0x10;
7715 j
->cardtype
= QTI_PHONEJACK_PCI
;
7717 probe
= ixj_selfprobe(j
);
7719 printk(KERN_INFO
"ixj: found Internet PhoneJACK PCI at 0x%x\n", j
->DSPbase
);
7726 static int __init
ixj_init(void)
7733 /* These might be no-ops, see above. */
7734 if ((probe
= ixj_probe_isapnp(&cnt
)) < 0) {
7737 if ((probe
= ixj_probe_isa(&cnt
)) < 0) {
7740 if ((probe
= ixj_probe_pci(&cnt
)) < 0) {
7743 printk(KERN_INFO
"ixj driver initialized.\n");
7744 create_proc_read_entry ("ixj", 0, NULL
, ixj_read_proc
, NULL
);
7748 module_init(ixj_init
);
7749 module_exit(ixj_exit
);
7751 static void DAA_Coeff_US(IXJ
*j
)
7755 j
->daa_country
= DAA_US
;
7756 /*----------------------------------------------- */
7758 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
; i
++) {
7759 j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
[i
] = 0;
7762 /* Bytes for IM-filter part 1 (04): 0E,32,E2,2F,C2,5A,C0,00 */
7763 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[7] = 0x03;
7764 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[6] = 0x4B;
7765 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[5] = 0x5D;
7766 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[4] = 0xCD;
7767 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[3] = 0x24;
7768 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[2] = 0xC5;
7769 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[1] = 0xA0;
7770 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[0] = 0x00;
7771 /* Bytes for IM-filter part 2 (05): 72,85,00,0E,2B,3A,D0,08 */
7772 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[7] = 0x71;
7773 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[6] = 0x1A;
7774 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[5] = 0x00;
7775 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[4] = 0x0A;
7776 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[3] = 0xB5;
7777 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[2] = 0x33;
7778 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[1] = 0xE0;
7779 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[0] = 0x08;
7780 /* Bytes for FRX-filter (08): 03,8F,48,F2,8F,48,70,08 */
7781 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[7] = 0x05;
7782 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[6] = 0xA3;
7783 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[5] = 0x72;
7784 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[4] = 0x34;
7785 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[3] = 0x3F;
7786 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[2] = 0x3B;
7787 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[1] = 0x30;
7788 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[0] = 0x08;
7789 /* Bytes for FRR-filter (07): 04,8F,38,7F,9B,EA,B0,08 */
7790 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[7] = 0x05;
7791 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[6] = 0x87;
7792 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[5] = 0xF9;
7793 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[4] = 0x3E;
7794 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[3] = 0x32;
7795 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[2] = 0xDA;
7796 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[1] = 0xB0;
7797 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[0] = 0x08;
7798 /* Bytes for AX-filter (0A): 16,55,DD,CA */
7799 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[3] = 0x41;
7800 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[2] = 0xB5;
7801 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[1] = 0xDD;
7802 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[0] = 0xCA;
7803 /* Bytes for AR-filter (09): 52,D3,11,42 */
7804 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[3] = 0x25;
7805 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[2] = 0xC7;
7806 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[1] = 0x10;
7807 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[0] = 0xD6;
7808 /* Bytes for TH-filter part 1 (00): 00,42,48,81,B3,80,00,98 */
7809 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[7] = 0x00;
7810 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[6] = 0x42;
7811 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[5] = 0x48;
7812 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[4] = 0x81;
7813 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[3] = 0xA5;
7814 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[2] = 0x80;
7815 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[1] = 0x00;
7816 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[0] = 0x98;
7817 /* Bytes for TH-filter part 2 (01): 02,F2,33,A0,68,AB,8A,AD */
7818 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[7] = 0x02;
7819 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[6] = 0xA2;
7820 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[5] = 0x2B;
7821 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[4] = 0xB0;
7822 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[3] = 0xE8;
7823 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[2] = 0xAB;
7824 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[1] = 0x81;
7825 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[0] = 0xCC;
7826 /* Bytes for TH-filter part 3 (02): 00,88,DA,54,A4,BA,2D,BB */
7827 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[7] = 0x00;
7828 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[6] = 0x88;
7829 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[5] = 0xD2;
7830 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[4] = 0x24;
7831 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[3] = 0xBA;
7832 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[2] = 0xA9;
7833 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[1] = 0x3B;
7834 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[0] = 0xA6;
7835 /* ; (10K, 0.68uF) */
7837 /* Bytes for Ringing part 1 (03):1B,3B,9B,BA,D4,1C,B3,23 */
7838 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[7] = 0x1B;
7839 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[6] = 0x3C;
7840 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[5] = 0x93;
7841 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[4] = 0x3A;
7842 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[3] = 0x22;
7843 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[2] = 0x12;
7844 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[1] = 0xA3;
7845 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[0] = 0x23;
7846 /* Bytes for Ringing part 2 (06):13,42,A6,BA,D4,73,CA,D5 */
7847 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[7] = 0x12;
7848 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[6] = 0xA2;
7849 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[5] = 0xA6;
7850 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[4] = 0xBA;
7851 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[3] = 0x22;
7852 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[2] = 0x7A;
7853 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[1] = 0x0A;
7854 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[0] = 0xD5;
7856 /* Levelmetering Ringing (0D):B2,45,0F,8E */
7857 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[3] = 0xAA;
7858 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[2] = 0x35;
7859 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[1] = 0x0F;
7860 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[0] = 0x8E;
7862 /* Bytes for Ringing part 1 (03):1B,3B,9B,BA,D4,1C,B3,23 */
7863 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[7] = 0x1C; */
7864 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[6] = 0xB3; */
7865 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[5] = 0xAB; */
7866 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[4] = 0xAB; */
7867 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[3] = 0x54; */
7868 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[2] = 0x2D; */
7869 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[1] = 0x62; */
7870 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[0] = 0x2D; */
7871 /* Bytes for Ringing part 2 (06):13,42,A6,BA,D4,73,CA,D5 */
7872 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[7] = 0x2D; */
7873 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[6] = 0x62; */
7874 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[5] = 0xA6; */
7875 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[4] = 0xBB; */
7876 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[3] = 0x2A; */
7877 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[2] = 0x7D; */
7878 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[1] = 0x0A; */
7879 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[0] = 0xD4; */
7881 /* Levelmetering Ringing (0D):B2,45,0F,8E */
7882 /* j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[3] = 0xAA; */
7883 /* j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[2] = 0x05; */
7884 /* j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[1] = 0x0F; */
7885 /* j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[0] = 0x8E; */
7887 /* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
7888 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[7] = 0xCA;
7889 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[6] = 0x0E;
7890 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[5] = 0xCA;
7891 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[4] = 0x09;
7892 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[3] = 0x99;
7893 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[2] = 0x99;
7894 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[1] = 0x99;
7895 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[0] = 0x99;
7896 /* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
7897 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[7] = 0xFD;
7898 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[6] = 0xB5;
7899 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[5] = 0xBA;
7900 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[4] = 0x07;
7901 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[3] = 0xDA;
7902 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[2] = 0x00;
7903 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[1] = 0x00;
7904 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[0] = 0x00;
7907 /* Config. Reg. 0 (filters) (cr0):FE ; CLK gen. by crystal */
7908 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
= 0xFF;
7909 /* Config. Reg. 1 (dialing) (cr1):05 */
7910 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
= 0x05;
7911 /* Config. Reg. 2 (caller ID) (cr2):04 */
7912 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
= 0x04;
7913 /* Config. Reg. 3 (testloops) (cr3):03 ; SEL Bit==0, HP-disabled */
7914 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
= 0x00;
7915 /* Config. Reg. 4 (analog gain) (cr4):02 */
7916 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= 0x02;
7917 /* Config. Reg. 5 (Version) (cr5):02 */
7918 /* Config. Reg. 6 (Reserved) (cr6):00 */
7919 /* Config. Reg. 7 (Reserved) (cr7):00 */
7922 /* Ext. Reg. 0 (Interrupt Reg.) (xr0):02 */
7924 j
->m_DAAShadowRegs
.XOP_xr0_W
.reg
= 0x02; /* SO_1 set to '1' because it is inverted. */
7925 /* Ext. Reg. 1 (Interrupt enable) (xr1):3C Cadence, RING, Caller ID, VDD_OK */
7927 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr1
.reg
= 0x3C;
7928 /* Ext. Reg. 2 (Cadence Time Out) (xr2):7D */
7929 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr2
.reg
= 0x7D;
7930 /* Ext. Reg. 3 (DC Char) (xr3):32 ; B-Filter Off == 1 */
7931 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr3
.reg
= 0x3B; /*0x32; */
7932 /* Ext. Reg. 4 (Cadence) (xr4):00 */
7934 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr4
.reg
= 0x00;
7935 /* Ext. Reg. 5 (Ring timer) (xr5):22 */
7936 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr5
.reg
= 0x22;
7937 /* Ext. Reg. 6 (Power State) (xr6):00 */
7938 j
->m_DAAShadowRegs
.XOP_xr6_W
.reg
= 0x00;
7939 /* Ext. Reg. 7 (Vdd) (xr7):40 */
7940 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr7
.reg
= 0x40; /* 0x40 ??? Should it be 0x00? */
7942 /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
7943 /* 12,33,5A,C3 ; 770 Hz */
7944 /* 13,3C,5B,32 ; 852 Hz */
7945 /* 1D,1B,5C,CC ; 941 Hz */
7947 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[3] = 0x11;
7948 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[2] = 0xB3;
7949 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[1] = 0x5A;
7950 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[0] = 0x2C;
7951 /* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
7952 /* EC,1D,52,22 ; 1336 Hz */
7953 /* AA,AC,51,D2 ; 1477 Hz */
7954 /* 9B,3B,51,25 ; 1633 Hz */
7955 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[3] = 0x32;
7956 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[2] = 0x32;
7957 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[1] = 0x52;
7958 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[0] = 0xB3;
7961 static void DAA_Coeff_UK(IXJ
*j
)
7965 j
->daa_country
= DAA_UK
;
7966 /*----------------------------------------------- */
7968 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
; i
++) {
7969 j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
[i
] = 0;
7972 /* Bytes for IM-filter part 1 (04): 00,C2,BB,A8,CB,81,A0,00 */
7973 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[7] = 0x00;
7974 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[6] = 0xC2;
7975 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[5] = 0xBB;
7976 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[4] = 0xA8;
7977 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[3] = 0xCB;
7978 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[2] = 0x81;
7979 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[1] = 0xA0;
7980 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[0] = 0x00;
7981 /* Bytes for IM-filter part 2 (05): 40,00,00,0A,A4,33,E0,08 */
7982 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[7] = 0x40;
7983 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[6] = 0x00;
7984 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[5] = 0x00;
7985 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[4] = 0x0A;
7986 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[3] = 0xA4;
7987 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[2] = 0x33;
7988 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[1] = 0xE0;
7989 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[0] = 0x08;
7990 /* Bytes for FRX-filter (08): 07,9B,ED,24,B2,A2,A0,08 */
7991 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[7] = 0x07;
7992 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[6] = 0x9B;
7993 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[5] = 0xED;
7994 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[4] = 0x24;
7995 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[3] = 0xB2;
7996 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[2] = 0xA2;
7997 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[1] = 0xA0;
7998 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[0] = 0x08;
7999 /* Bytes for FRR-filter (07): 0F,92,F2,B2,87,D2,30,08 */
8000 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[7] = 0x0F;
8001 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[6] = 0x92;
8002 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[5] = 0xF2;
8003 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[4] = 0xB2;
8004 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[3] = 0x87;
8005 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[2] = 0xD2;
8006 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[1] = 0x30;
8007 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[0] = 0x08;
8008 /* Bytes for AX-filter (0A): 1B,A5,DD,CA */
8009 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[3] = 0x1B;
8010 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[2] = 0xA5;
8011 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[1] = 0xDD;
8012 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[0] = 0xCA;
8013 /* Bytes for AR-filter (09): E2,27,10,D6 */
8014 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[3] = 0xE2;
8015 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[2] = 0x27;
8016 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[1] = 0x10;
8017 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[0] = 0xD6;
8018 /* Bytes for TH-filter part 1 (00): 80,2D,38,8B,D0,00,00,98 */
8019 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[7] = 0x80;
8020 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[6] = 0x2D;
8021 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[5] = 0x38;
8022 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[4] = 0x8B;
8023 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[3] = 0xD0;
8024 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[2] = 0x00;
8025 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[1] = 0x00;
8026 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[0] = 0x98;
8027 /* Bytes for TH-filter part 2 (01): 02,5A,53,F0,0B,5F,84,D4 */
8028 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[7] = 0x02;
8029 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[6] = 0x5A;
8030 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[5] = 0x53;
8031 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[4] = 0xF0;
8032 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[3] = 0x0B;
8033 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[2] = 0x5F;
8034 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[1] = 0x84;
8035 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[0] = 0xD4;
8036 /* Bytes for TH-filter part 3 (02): 00,88,6A,A4,8F,52,F5,32 */
8037 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[7] = 0x00;
8038 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[6] = 0x88;
8039 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[5] = 0x6A;
8040 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[4] = 0xA4;
8041 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[3] = 0x8F;
8042 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[2] = 0x52;
8043 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[1] = 0xF5;
8044 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[0] = 0x32;
8046 /* Bytes for Ringing part 1 (03):1B,3C,93,3A,22,12,A3,23 */
8047 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[7] = 0x1B;
8048 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[6] = 0x3C;
8049 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[5] = 0x93;
8050 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[4] = 0x3A;
8051 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[3] = 0x22;
8052 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[2] = 0x12;
8053 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[1] = 0xA3;
8054 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[0] = 0x23;
8055 /* Bytes for Ringing part 2 (06):12,A2,A6,BA,22,7A,0A,D5 */
8056 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[7] = 0x12;
8057 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[6] = 0xA2;
8058 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[5] = 0xA6;
8059 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[4] = 0xBA;
8060 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[3] = 0x22;
8061 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[2] = 0x7A;
8062 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[1] = 0x0A;
8063 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[0] = 0xD5;
8064 /* Levelmetering Ringing (0D):AA,35,0F,8E ; 25Hz 30V less possible? */
8065 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[3] = 0xAA;
8066 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[2] = 0x35;
8067 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[1] = 0x0F;
8068 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[0] = 0x8E;
8069 /* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
8070 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[7] = 0xCA;
8071 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[6] = 0x0E;
8072 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[5] = 0xCA;
8073 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[4] = 0x09;
8074 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[3] = 0x99;
8075 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[2] = 0x99;
8076 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[1] = 0x99;
8077 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[0] = 0x99;
8078 /* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
8079 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[7] = 0xFD;
8080 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[6] = 0xB5;
8081 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[5] = 0xBA;
8082 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[4] = 0x07;
8083 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[3] = 0xDA;
8084 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[2] = 0x00;
8085 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[1] = 0x00;
8086 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[0] = 0x00;
8088 /* Config. Reg. 0 (filters) (cr0):FF */
8089 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
= 0xFF;
8090 /* Config. Reg. 1 (dialing) (cr1):05 */
8091 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
= 0x05;
8092 /* Config. Reg. 2 (caller ID) (cr2):04 */
8093 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
= 0x04;
8094 /* Config. Reg. 3 (testloops) (cr3):00 ; */
8095 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
= 0x00;
8096 /* Config. Reg. 4 (analog gain) (cr4):02 */
8097 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= 0x02;
8098 /* Config. Reg. 5 (Version) (cr5):02 */
8099 /* Config. Reg. 6 (Reserved) (cr6):00 */
8100 /* Config. Reg. 7 (Reserved) (cr7):00 */
8102 /* Ext. Reg. 0 (Interrupt Reg.) (xr0):02 */
8104 j
->m_DAAShadowRegs
.XOP_xr0_W
.reg
= 0x02; /* SO_1 set to '1' because it is inverted. */
8105 /* Ext. Reg. 1 (Interrupt enable) (xr1):1C */
8107 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr1
.reg
= 0x1C; /* RING, Caller ID, VDD_OK */
8108 /* Ext. Reg. 2 (Cadence Time Out) (xr2):7D */
8110 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr2
.reg
= 0x7D;
8111 /* Ext. Reg. 3 (DC Char) (xr3):36 ; */
8112 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr3
.reg
= 0x36;
8113 /* Ext. Reg. 4 (Cadence) (xr4):00 */
8114 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr4
.reg
= 0x00;
8115 /* Ext. Reg. 5 (Ring timer) (xr5):22 */
8116 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr5
.reg
= 0x22;
8117 /* Ext. Reg. 6 (Power State) (xr6):00 */
8118 j
->m_DAAShadowRegs
.XOP_xr6_W
.reg
= 0x00;
8119 /* Ext. Reg. 7 (Vdd) (xr7):46 */
8120 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr7
.reg
= 0x46; /* 0x46 ??? Should it be 0x00? */
8121 /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
8122 /* 12,33,5A,C3 ; 770 Hz */
8123 /* 13,3C,5B,32 ; 852 Hz */
8124 /* 1D,1B,5C,CC ; 941 Hz */
8126 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[3] = 0x11;
8127 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[2] = 0xB3;
8128 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[1] = 0x5A;
8129 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[0] = 0x2C;
8130 /* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
8131 /* EC,1D,52,22 ; 1336 Hz */
8132 /* AA,AC,51,D2 ; 1477 Hz */
8133 /* 9B,3B,51,25 ; 1633 Hz */
8134 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[3] = 0x32;
8135 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[2] = 0x32;
8136 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[1] = 0x52;
8137 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[0] = 0xB3;
8141 static void DAA_Coeff_France(IXJ
*j
)
8145 j
->daa_country
= DAA_FRANCE
;
8146 /*----------------------------------------------- */
8148 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
; i
++) {
8149 j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
[i
] = 0;
8152 /* Bytes for IM-filter part 1 (04): 02,A2,43,2C,22,AF,A0,00 */
8153 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[7] = 0x02;
8154 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[6] = 0xA2;
8155 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[5] = 0x43;
8156 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[4] = 0x2C;
8157 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[3] = 0x22;
8158 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[2] = 0xAF;
8159 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[1] = 0xA0;
8160 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[0] = 0x00;
8161 /* Bytes for IM-filter part 2 (05): 67,CE,00,0C,22,33,E0,08 */
8162 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[7] = 0x67;
8163 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[6] = 0xCE;
8164 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[5] = 0x00;
8165 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[4] = 0x2C;
8166 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[3] = 0x22;
8167 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[2] = 0x33;
8168 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[1] = 0xE0;
8169 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[0] = 0x08;
8170 /* Bytes for FRX-filter (08): 07,9A,28,F6,23,4A,B0,08 */
8171 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[7] = 0x07;
8172 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[6] = 0x9A;
8173 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[5] = 0x28;
8174 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[4] = 0xF6;
8175 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[3] = 0x23;
8176 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[2] = 0x4A;
8177 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[1] = 0xB0;
8178 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[0] = 0x08;
8179 /* Bytes for FRR-filter (07): 03,8F,F9,2F,9E,FA,20,08 */
8180 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[7] = 0x03;
8181 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[6] = 0x8F;
8182 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[5] = 0xF9;
8183 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[4] = 0x2F;
8184 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[3] = 0x9E;
8185 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[2] = 0xFA;
8186 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[1] = 0x20;
8187 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[0] = 0x08;
8188 /* Bytes for AX-filter (0A): 16,B5,DD,CA */
8189 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[3] = 0x16;
8190 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[2] = 0xB5;
8191 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[1] = 0xDD;
8192 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[0] = 0xCA;
8193 /* Bytes for AR-filter (09): 52,C7,10,D6 */
8194 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[3] = 0xE2;
8195 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[2] = 0xC7;
8196 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[1] = 0x10;
8197 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[0] = 0xD6;
8198 /* Bytes for TH-filter part 1 (00): 00,42,48,81,A6,80,00,98 */
8199 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[7] = 0x00;
8200 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[6] = 0x42;
8201 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[5] = 0x48;
8202 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[4] = 0x81;
8203 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[3] = 0xA6;
8204 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[2] = 0x80;
8205 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[1] = 0x00;
8206 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[0] = 0x98;
8207 /* Bytes for TH-filter part 2 (01): 02,AC,2A,30,78,AC,8A,2C */
8208 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[7] = 0x02;
8209 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[6] = 0xAC;
8210 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[5] = 0x2A;
8211 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[4] = 0x30;
8212 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[3] = 0x78;
8213 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[2] = 0xAC;
8214 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[1] = 0x8A;
8215 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[0] = 0x2C;
8216 /* Bytes for TH-filter part 3 (02): 00,88,DA,A5,22,BA,2C,45 */
8217 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[7] = 0x00;
8218 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[6] = 0x88;
8219 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[5] = 0xDA;
8220 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[4] = 0xA5;
8221 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[3] = 0x22;
8222 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[2] = 0xBA;
8223 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[1] = 0x2C;
8224 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[0] = 0x45;
8226 /* Bytes for Ringing part 1 (03):1B,3C,93,3A,22,12,A3,23 */
8227 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[7] = 0x1B;
8228 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[6] = 0x3C;
8229 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[5] = 0x93;
8230 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[4] = 0x3A;
8231 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[3] = 0x22;
8232 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[2] = 0x12;
8233 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[1] = 0xA3;
8234 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[0] = 0x23;
8235 /* Bytes for Ringing part 2 (06):12,A2,A6,BA,22,7A,0A,D5 */
8236 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[7] = 0x12;
8237 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[6] = 0xA2;
8238 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[5] = 0xA6;
8239 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[4] = 0xBA;
8240 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[3] = 0x22;
8241 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[2] = 0x7A;
8242 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[1] = 0x0A;
8243 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[0] = 0xD5;
8244 /* Levelmetering Ringing (0D):32,45,B5,84 ; 50Hz 20V */
8245 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[3] = 0x32;
8246 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[2] = 0x45;
8247 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[1] = 0xB5;
8248 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[0] = 0x84;
8249 /* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
8250 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[7] = 0xCA;
8251 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[6] = 0x0E;
8252 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[5] = 0xCA;
8253 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[4] = 0x09;
8254 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[3] = 0x99;
8255 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[2] = 0x99;
8256 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[1] = 0x99;
8257 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[0] = 0x99;
8258 /* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
8259 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[7] = 0xFD;
8260 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[6] = 0xB5;
8261 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[5] = 0xBA;
8262 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[4] = 0x07;
8263 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[3] = 0xDA;
8264 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[2] = 0x00;
8265 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[1] = 0x00;
8266 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[0] = 0x00;
8268 /* Config. Reg. 0 (filters) (cr0):FF */
8269 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
= 0xFF;
8270 /* Config. Reg. 1 (dialing) (cr1):05 */
8271 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
= 0x05;
8272 /* Config. Reg. 2 (caller ID) (cr2):04 */
8273 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
= 0x04;
8274 /* Config. Reg. 3 (testloops) (cr3):00 ; */
8275 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
= 0x00;
8276 /* Config. Reg. 4 (analog gain) (cr4):02 */
8277 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= 0x02;
8278 /* Config. Reg. 5 (Version) (cr5):02 */
8279 /* Config. Reg. 6 (Reserved) (cr6):00 */
8280 /* Config. Reg. 7 (Reserved) (cr7):00 */
8282 /* Ext. Reg. 0 (Interrupt Reg.) (xr0):02 */
8284 j
->m_DAAShadowRegs
.XOP_xr0_W
.reg
= 0x02; /* SO_1 set to '1' because it is inverted. */
8285 /* Ext. Reg. 1 (Interrupt enable) (xr1):1C */
8287 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr1
.reg
= 0x1C; /* RING, Caller ID, VDD_OK */
8288 /* Ext. Reg. 2 (Cadence Time Out) (xr2):7D */
8290 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr2
.reg
= 0x7D;
8291 /* Ext. Reg. 3 (DC Char) (xr3):36 ; */
8292 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr3
.reg
= 0x36;
8293 /* Ext. Reg. 4 (Cadence) (xr4):00 */
8294 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr4
.reg
= 0x00;
8295 /* Ext. Reg. 5 (Ring timer) (xr5):22 */
8296 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr5
.reg
= 0x22;
8297 /* Ext. Reg. 6 (Power State) (xr6):00 */
8298 j
->m_DAAShadowRegs
.XOP_xr6_W
.reg
= 0x00;
8299 /* Ext. Reg. 7 (Vdd) (xr7):46 */
8300 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr7
.reg
= 0x46; /* 0x46 ??? Should it be 0x00? */
8301 /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
8302 /* 12,33,5A,C3 ; 770 Hz */
8303 /* 13,3C,5B,32 ; 852 Hz */
8304 /* 1D,1B,5C,CC ; 941 Hz */
8306 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[3] = 0x11;
8307 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[2] = 0xB3;
8308 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[1] = 0x5A;
8309 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[0] = 0x2C;
8310 /* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
8311 /* EC,1D,52,22 ; 1336 Hz */
8312 /* AA,AC,51,D2 ; 1477 Hz */
8313 /* 9B,3B,51,25 ; 1633 Hz */
8314 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[3] = 0x32;
8315 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[2] = 0x32;
8316 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[1] = 0x52;
8317 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[0] = 0xB3;
8321 static void DAA_Coeff_Germany(IXJ
*j
)
8325 j
->daa_country
= DAA_GERMANY
;
8326 /*----------------------------------------------- */
8328 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
; i
++) {
8329 j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
[i
] = 0;
8332 /* Bytes for IM-filter part 1 (04): 00,CE,BB,B8,D2,81,B0,00 */
8333 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[7] = 0x00;
8334 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[6] = 0xCE;
8335 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[5] = 0xBB;
8336 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[4] = 0xB8;
8337 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[3] = 0xD2;
8338 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[2] = 0x81;
8339 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[1] = 0xB0;
8340 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[0] = 0x00;
8341 /* Bytes for IM-filter part 2 (05): 45,8F,00,0C,D2,3A,D0,08 */
8342 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[7] = 0x45;
8343 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[6] = 0x8F;
8344 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[5] = 0x00;
8345 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[4] = 0x0C;
8346 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[3] = 0xD2;
8347 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[2] = 0x3A;
8348 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[1] = 0xD0;
8349 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[0] = 0x08;
8350 /* Bytes for FRX-filter (08): 07,AA,E2,34,24,89,20,08 */
8351 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[7] = 0x07;
8352 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[6] = 0xAA;
8353 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[5] = 0xE2;
8354 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[4] = 0x34;
8355 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[3] = 0x24;
8356 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[2] = 0x89;
8357 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[1] = 0x20;
8358 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[0] = 0x08;
8359 /* Bytes for FRR-filter (07): 02,87,FA,37,9A,CA,B0,08 */
8360 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[7] = 0x02;
8361 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[6] = 0x87;
8362 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[5] = 0xFA;
8363 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[4] = 0x37;
8364 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[3] = 0x9A;
8365 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[2] = 0xCA;
8366 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[1] = 0xB0;
8367 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[0] = 0x08;
8368 /* Bytes for AX-filter (0A): 72,D5,DD,CA */
8369 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[3] = 0x72;
8370 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[2] = 0xD5;
8371 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[1] = 0xDD;
8372 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[0] = 0xCA;
8373 /* Bytes for AR-filter (09): 72,42,13,4B */
8374 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[3] = 0x72;
8375 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[2] = 0x42;
8376 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[1] = 0x13;
8377 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[0] = 0x4B;
8378 /* Bytes for TH-filter part 1 (00): 80,52,48,81,AD,80,00,98 */
8379 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[7] = 0x80;
8380 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[6] = 0x52;
8381 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[5] = 0x48;
8382 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[4] = 0x81;
8383 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[3] = 0xAD;
8384 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[2] = 0x80;
8385 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[1] = 0x00;
8386 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[0] = 0x98;
8387 /* Bytes for TH-filter part 2 (01): 02,42,5A,20,E8,1A,81,27 */
8388 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[7] = 0x02;
8389 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[6] = 0x42;
8390 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[5] = 0x5A;
8391 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[4] = 0x20;
8392 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[3] = 0xE8;
8393 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[2] = 0x1A;
8394 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[1] = 0x81;
8395 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[0] = 0x27;
8396 /* Bytes for TH-filter part 3 (02): 00,88,63,26,BD,4B,A3,C2 */
8397 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[7] = 0x00;
8398 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[6] = 0x88;
8399 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[5] = 0x63;
8400 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[4] = 0x26;
8401 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[3] = 0xBD;
8402 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[2] = 0x4B;
8403 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[1] = 0xA3;
8404 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[0] = 0xC2;
8405 /* ; (10K, 0.68uF) */
8406 /* Bytes for Ringing part 1 (03):1B,3B,9B,BA,D4,1C,B3,23 */
8407 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[7] = 0x1B;
8408 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[6] = 0x3B;
8409 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[5] = 0x9B;
8410 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[4] = 0xBA;
8411 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[3] = 0xD4;
8412 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[2] = 0x1C;
8413 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[1] = 0xB3;
8414 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[0] = 0x23;
8415 /* Bytes for Ringing part 2 (06):13,42,A6,BA,D4,73,CA,D5 */
8416 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[7] = 0x13;
8417 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[6] = 0x42;
8418 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[5] = 0xA6;
8419 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[4] = 0xBA;
8420 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[3] = 0xD4;
8421 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[2] = 0x73;
8422 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[1] = 0xCA;
8423 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[0] = 0xD5;
8424 /* Levelmetering Ringing (0D):B2,45,0F,8E */
8425 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[3] = 0xB2;
8426 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[2] = 0x45;
8427 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[1] = 0x0F;
8428 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[0] = 0x8E;
8429 /* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
8430 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[7] = 0xCA;
8431 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[6] = 0x0E;
8432 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[5] = 0xCA;
8433 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[4] = 0x09;
8434 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[3] = 0x99;
8435 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[2] = 0x99;
8436 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[1] = 0x99;
8437 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[0] = 0x99;
8438 /* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
8439 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[7] = 0xFD;
8440 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[6] = 0xB5;
8441 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[5] = 0xBA;
8442 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[4] = 0x07;
8443 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[3] = 0xDA;
8444 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[2] = 0x00;
8445 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[1] = 0x00;
8446 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[0] = 0x00;
8448 /* Config. Reg. 0 (filters) (cr0):FF ; all Filters enabled, CLK from ext. source */
8449 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
= 0xFF;
8450 /* Config. Reg. 1 (dialing) (cr1):05 ; Manual Ring, Ring metering enabled */
8451 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
= 0x05;
8452 /* Config. Reg. 2 (caller ID) (cr2):04 ; Analog Gain 0dB, FSC internal */
8453 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
= 0x04;
8454 /* Config. Reg. 3 (testloops) (cr3):00 ; SEL Bit==0, HP-enabled */
8455 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
= 0x00;
8456 /* Config. Reg. 4 (analog gain) (cr4):02 */
8457 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= 0x02;
8458 /* Config. Reg. 5 (Version) (cr5):02 */
8459 /* Config. Reg. 6 (Reserved) (cr6):00 */
8460 /* Config. Reg. 7 (Reserved) (cr7):00 */
8462 /* Ext. Reg. 0 (Interrupt Reg.) (xr0):02 */
8464 j
->m_DAAShadowRegs
.XOP_xr0_W
.reg
= 0x02; /* SO_1 set to '1' because it is inverted. */
8465 /* Ext. Reg. 1 (Interrupt enable) (xr1):1C ; Ring, CID, VDDOK Interrupts enabled */
8467 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr1
.reg
= 0x1C; /* RING, Caller ID, VDD_OK */
8468 /* Ext. Reg. 2 (Cadence Time Out) (xr2):7D */
8470 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr2
.reg
= 0x7D;
8471 /* Ext. Reg. 3 (DC Char) (xr3):32 ; B-Filter Off==1, U0=3.5V, R=200Ohm */
8472 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr3
.reg
= 0x32;
8473 /* Ext. Reg. 4 (Cadence) (xr4):00 */
8474 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr4
.reg
= 0x00;
8475 /* Ext. Reg. 5 (Ring timer) (xr5):22 */
8476 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr5
.reg
= 0x22;
8477 /* Ext. Reg. 6 (Power State) (xr6):00 */
8478 j
->m_DAAShadowRegs
.XOP_xr6_W
.reg
= 0x00;
8479 /* Ext. Reg. 7 (Vdd) (xr7):40 ; VDD=4.25 V */
8480 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr7
.reg
= 0x40; /* 0x40 ??? Should it be 0x00? */
8481 /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
8482 /* 12,33,5A,C3 ; 770 Hz */
8483 /* 13,3C,5B,32 ; 852 Hz */
8484 /* 1D,1B,5C,CC ; 941 Hz */
8486 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[3] = 0x11;
8487 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[2] = 0xB3;
8488 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[1] = 0x5A;
8489 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[0] = 0x2C;
8490 /* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
8491 /* EC,1D,52,22 ; 1336 Hz */
8492 /* AA,AC,51,D2 ; 1477 Hz */
8493 /* 9B,3B,51,25 ; 1633 Hz */
8494 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[3] = 0x32;
8495 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[2] = 0x32;
8496 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[1] = 0x52;
8497 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[0] = 0xB3;
8501 static void DAA_Coeff_Australia(IXJ
*j
)
8505 j
->daa_country
= DAA_AUSTRALIA
;
8506 /*----------------------------------------------- */
8508 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
; i
++) {
8509 j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
[i
] = 0;
8512 /* Bytes for IM-filter part 1 (04): 00,A3,AA,28,B3,82,D0,00 */
8513 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[7] = 0x00;
8514 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[6] = 0xA3;
8515 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[5] = 0xAA;
8516 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[4] = 0x28;
8517 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[3] = 0xB3;
8518 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[2] = 0x82;
8519 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[1] = 0xD0;
8520 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[0] = 0x00;
8521 /* Bytes for IM-filter part 2 (05): 70,96,00,09,32,6B,C0,08 */
8522 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[7] = 0x70;
8523 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[6] = 0x96;
8524 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[5] = 0x00;
8525 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[4] = 0x09;
8526 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[3] = 0x32;
8527 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[2] = 0x6B;
8528 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[1] = 0xC0;
8529 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[0] = 0x08;
8530 /* Bytes for FRX-filter (08): 07,96,E2,34,32,9B,30,08 */
8531 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[7] = 0x07;
8532 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[6] = 0x96;
8533 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[5] = 0xE2;
8534 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[4] = 0x34;
8535 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[3] = 0x32;
8536 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[2] = 0x9B;
8537 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[1] = 0x30;
8538 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[0] = 0x08;
8539 /* Bytes for FRR-filter (07): 0F,9A,E9,2F,22,CC,A0,08 */
8540 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[7] = 0x0F;
8541 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[6] = 0x9A;
8542 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[5] = 0xE9;
8543 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[4] = 0x2F;
8544 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[3] = 0x22;
8545 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[2] = 0xCC;
8546 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[1] = 0xA0;
8547 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[0] = 0x08;
8548 /* Bytes for AX-filter (0A): CB,45,DD,CA */
8549 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[3] = 0xCB;
8550 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[2] = 0x45;
8551 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[1] = 0xDD;
8552 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[0] = 0xCA;
8553 /* Bytes for AR-filter (09): 1B,67,10,D6 */
8554 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[3] = 0x1B;
8555 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[2] = 0x67;
8556 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[1] = 0x10;
8557 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[0] = 0xD6;
8558 /* Bytes for TH-filter part 1 (00): 80,52,48,81,AF,80,00,98 */
8559 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[7] = 0x80;
8560 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[6] = 0x52;
8561 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[5] = 0x48;
8562 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[4] = 0x81;
8563 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[3] = 0xAF;
8564 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[2] = 0x80;
8565 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[1] = 0x00;
8566 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[0] = 0x98;
8567 /* Bytes for TH-filter part 2 (01): 02,DB,52,B0,38,01,82,AC */
8568 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[7] = 0x02;
8569 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[6] = 0xDB;
8570 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[5] = 0x52;
8571 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[4] = 0xB0;
8572 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[3] = 0x38;
8573 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[2] = 0x01;
8574 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[1] = 0x82;
8575 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[0] = 0xAC;
8576 /* Bytes for TH-filter part 3 (02): 00,88,4A,3E,2C,3B,24,46 */
8577 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[7] = 0x00;
8578 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[6] = 0x88;
8579 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[5] = 0x4A;
8580 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[4] = 0x3E;
8581 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[3] = 0x2C;
8582 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[2] = 0x3B;
8583 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[1] = 0x24;
8584 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[0] = 0x46;
8586 /* Bytes for Ringing part 1 (03):1B,3C,93,3A,22,12,A3,23 */
8587 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[7] = 0x1B;
8588 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[6] = 0x3C;
8589 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[5] = 0x93;
8590 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[4] = 0x3A;
8591 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[3] = 0x22;
8592 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[2] = 0x12;
8593 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[1] = 0xA3;
8594 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[0] = 0x23;
8595 /* Bytes for Ringing part 2 (06):12,A2,A6,BA,22,7A,0A,D5 */
8596 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[7] = 0x12;
8597 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[6] = 0xA2;
8598 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[5] = 0xA6;
8599 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[4] = 0xBA;
8600 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[3] = 0x22;
8601 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[2] = 0x7A;
8602 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[1] = 0x0A;
8603 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[0] = 0xD5;
8604 /* Levelmetering Ringing (0D):32,45,B5,84 ; 50Hz 20V */
8605 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[3] = 0x32;
8606 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[2] = 0x45;
8607 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[1] = 0xB5;
8608 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[0] = 0x84;
8609 /* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
8610 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[7] = 0xCA;
8611 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[6] = 0x0E;
8612 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[5] = 0xCA;
8613 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[4] = 0x09;
8614 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[3] = 0x99;
8615 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[2] = 0x99;
8616 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[1] = 0x99;
8617 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[0] = 0x99;
8618 /* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
8619 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[7] = 0xFD;
8620 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[6] = 0xB5;
8621 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[5] = 0xBA;
8622 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[4] = 0x07;
8623 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[3] = 0xDA;
8624 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[2] = 0x00;
8625 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[1] = 0x00;
8626 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[0] = 0x00;
8628 /* Config. Reg. 0 (filters) (cr0):FF */
8629 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
= 0xFF;
8630 /* Config. Reg. 1 (dialing) (cr1):05 */
8631 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
= 0x05;
8632 /* Config. Reg. 2 (caller ID) (cr2):04 */
8633 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
= 0x04;
8634 /* Config. Reg. 3 (testloops) (cr3):00 ; */
8635 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
= 0x00;
8636 /* Config. Reg. 4 (analog gain) (cr4):02 */
8637 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= 0x02;
8638 /* Config. Reg. 5 (Version) (cr5):02 */
8639 /* Config. Reg. 6 (Reserved) (cr6):00 */
8640 /* Config. Reg. 7 (Reserved) (cr7):00 */
8642 /* Ext. Reg. 0 (Interrupt Reg.) (xr0):02 */
8644 j
->m_DAAShadowRegs
.XOP_xr0_W
.reg
= 0x02; /* SO_1 set to '1' because it is inverted. */
8645 /* Ext. Reg. 1 (Interrupt enable) (xr1):1C */
8647 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr1
.reg
= 0x1C; /* RING, Caller ID, VDD_OK */
8648 /* Ext. Reg. 2 (Cadence Time Out) (xr2):7D */
8650 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr2
.reg
= 0x7D;
8651 /* Ext. Reg. 3 (DC Char) (xr3):2B ; */
8652 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr3
.reg
= 0x2B;
8653 /* Ext. Reg. 4 (Cadence) (xr4):00 */
8654 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr4
.reg
= 0x00;
8655 /* Ext. Reg. 5 (Ring timer) (xr5):22 */
8656 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr5
.reg
= 0x22;
8657 /* Ext. Reg. 6 (Power State) (xr6):00 */
8658 j
->m_DAAShadowRegs
.XOP_xr6_W
.reg
= 0x00;
8659 /* Ext. Reg. 7 (Vdd) (xr7):40 */
8660 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr7
.reg
= 0x40; /* 0x40 ??? Should it be 0x00? */
8662 /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
8663 /* 12,33,5A,C3 ; 770 Hz */
8664 /* 13,3C,5B,32 ; 852 Hz */
8665 /* 1D,1B,5C,CC ; 941 Hz */
8666 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[3] = 0x11;
8667 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[2] = 0xB3;
8668 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[1] = 0x5A;
8669 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[0] = 0x2C;
8671 /* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
8672 /* EC,1D,52,22 ; 1336 Hz */
8673 /* AA,AC,51,D2 ; 1477 Hz */
8674 /* 9B,3B,51,25 ; 1633 Hz */
8675 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[3] = 0x32;
8676 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[2] = 0x32;
8677 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[1] = 0x52;
8678 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[0] = 0xB3;
8681 static void DAA_Coeff_Japan(IXJ
*j
)
8685 j
->daa_country
= DAA_JAPAN
;
8686 /*----------------------------------------------- */
8688 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
; i
++) {
8689 j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
[i
] = 0;
8692 /* Bytes for IM-filter part 1 (04): 06,BD,E2,2D,BA,F9,A0,00 */
8693 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[7] = 0x06;
8694 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[6] = 0xBD;
8695 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[5] = 0xE2;
8696 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[4] = 0x2D;
8697 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[3] = 0xBA;
8698 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[2] = 0xF9;
8699 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[1] = 0xA0;
8700 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[0] = 0x00;
8701 /* Bytes for IM-filter part 2 (05): 6F,F7,00,0E,34,33,E0,08 */
8702 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[7] = 0x6F;
8703 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[6] = 0xF7;
8704 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[5] = 0x00;
8705 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[4] = 0x0E;
8706 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[3] = 0x34;
8707 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[2] = 0x33;
8708 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[1] = 0xE0;
8709 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[0] = 0x08;
8710 /* Bytes for FRX-filter (08): 02,8F,68,77,9C,58,F0,08 */
8711 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[7] = 0x02;
8712 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[6] = 0x8F;
8713 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[5] = 0x68;
8714 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[4] = 0x77;
8715 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[3] = 0x9C;
8716 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[2] = 0x58;
8717 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[1] = 0xF0;
8718 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[0] = 0x08;
8719 /* Bytes for FRR-filter (07): 03,8F,38,73,87,EA,20,08 */
8720 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[7] = 0x03;
8721 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[6] = 0x8F;
8722 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[5] = 0x38;
8723 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[4] = 0x73;
8724 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[3] = 0x87;
8725 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[2] = 0xEA;
8726 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[1] = 0x20;
8727 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[0] = 0x08;
8728 /* Bytes for AX-filter (0A): 51,C5,DD,CA */
8729 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[3] = 0x51;
8730 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[2] = 0xC5;
8731 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[1] = 0xDD;
8732 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[0] = 0xCA;
8733 /* Bytes for AR-filter (09): 25,A7,10,D6 */
8734 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[3] = 0x25;
8735 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[2] = 0xA7;
8736 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[1] = 0x10;
8737 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[0] = 0xD6;
8738 /* Bytes for TH-filter part 1 (00): 00,42,48,81,AE,80,00,98 */
8739 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[7] = 0x00;
8740 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[6] = 0x42;
8741 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[5] = 0x48;
8742 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[4] = 0x81;
8743 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[3] = 0xAE;
8744 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[2] = 0x80;
8745 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[1] = 0x00;
8746 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[0] = 0x98;
8747 /* Bytes for TH-filter part 2 (01): 02,AB,2A,20,99,5B,89,28 */
8748 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[7] = 0x02;
8749 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[6] = 0xAB;
8750 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[5] = 0x2A;
8751 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[4] = 0x20;
8752 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[3] = 0x99;
8753 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[2] = 0x5B;
8754 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[1] = 0x89;
8755 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[0] = 0x28;
8756 /* Bytes for TH-filter part 3 (02): 00,88,DA,25,34,C5,4C,BA */
8757 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[7] = 0x00;
8758 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[6] = 0x88;
8759 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[5] = 0xDA;
8760 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[4] = 0x25;
8761 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[3] = 0x34;
8762 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[2] = 0xC5;
8763 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[1] = 0x4C;
8764 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[0] = 0xBA;
8766 /* Bytes for Ringing part 1 (03):1B,3C,93,3A,22,12,A3,23 */
8767 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[7] = 0x1B;
8768 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[6] = 0x3C;
8769 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[5] = 0x93;
8770 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[4] = 0x3A;
8771 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[3] = 0x22;
8772 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[2] = 0x12;
8773 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[1] = 0xA3;
8774 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[0] = 0x23;
8775 /* Bytes for Ringing part 2 (06):12,A2,A6,BA,22,7A,0A,D5 */
8776 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[7] = 0x12;
8777 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[6] = 0xA2;
8778 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[5] = 0xA6;
8779 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[4] = 0xBA;
8780 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[3] = 0x22;
8781 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[2] = 0x7A;
8782 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[1] = 0x0A;
8783 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[0] = 0xD5;
8784 /* Levelmetering Ringing (0D):AA,35,0F,8E ; 25Hz 30V ????????? */
8785 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[3] = 0xAA;
8786 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[2] = 0x35;
8787 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[1] = 0x0F;
8788 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[0] = 0x8E;
8789 /* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
8790 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[7] = 0xCA;
8791 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[6] = 0x0E;
8792 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[5] = 0xCA;
8793 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[4] = 0x09;
8794 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[3] = 0x99;
8795 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[2] = 0x99;
8796 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[1] = 0x99;
8797 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[0] = 0x99;
8798 /* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
8799 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[7] = 0xFD;
8800 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[6] = 0xB5;
8801 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[5] = 0xBA;
8802 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[4] = 0x07;
8803 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[3] = 0xDA;
8804 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[2] = 0x00;
8805 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[1] = 0x00;
8806 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[0] = 0x00;
8808 /* Config. Reg. 0 (filters) (cr0):FF */
8809 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
= 0xFF;
8810 /* Config. Reg. 1 (dialing) (cr1):05 */
8811 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
= 0x05;
8812 /* Config. Reg. 2 (caller ID) (cr2):04 */
8813 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
= 0x04;
8814 /* Config. Reg. 3 (testloops) (cr3):00 ; */
8815 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
= 0x00;
8816 /* Config. Reg. 4 (analog gain) (cr4):02 */
8817 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= 0x02;
8818 /* Config. Reg. 5 (Version) (cr5):02 */
8819 /* Config. Reg. 6 (Reserved) (cr6):00 */
8820 /* Config. Reg. 7 (Reserved) (cr7):00 */
8822 /* Ext. Reg. 0 (Interrupt Reg.) (xr0):02 */
8824 j
->m_DAAShadowRegs
.XOP_xr0_W
.reg
= 0x02; /* SO_1 set to '1' because it is inverted. */
8825 /* Ext. Reg. 1 (Interrupt enable) (xr1):1C */
8827 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr1
.reg
= 0x1C; /* RING, Caller ID, VDD_OK */
8828 /* Ext. Reg. 2 (Cadence Time Out) (xr2):7D */
8830 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr2
.reg
= 0x7D;
8831 /* Ext. Reg. 3 (DC Char) (xr3):22 ; */
8832 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr3
.reg
= 0x22;
8833 /* Ext. Reg. 4 (Cadence) (xr4):00 */
8834 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr4
.reg
= 0x00;
8835 /* Ext. Reg. 5 (Ring timer) (xr5):22 */
8836 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr5
.reg
= 0x22;
8837 /* Ext. Reg. 6 (Power State) (xr6):00 */
8838 j
->m_DAAShadowRegs
.XOP_xr6_W
.reg
= 0x00;
8839 /* Ext. Reg. 7 (Vdd) (xr7):40 */
8840 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr7
.reg
= 0x40; /* 0x40 ??? Should it be 0x00? */
8841 /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
8842 /* 12,33,5A,C3 ; 770 Hz */
8843 /* 13,3C,5B,32 ; 852 Hz */
8844 /* 1D,1B,5C,CC ; 941 Hz */
8846 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[3] = 0x11;
8847 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[2] = 0xB3;
8848 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[1] = 0x5A;
8849 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[0] = 0x2C;
8850 /* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
8851 /* EC,1D,52,22 ; 1336 Hz */
8852 /* AA,AC,51,D2 ; 1477 Hz */
8853 /* 9B,3B,51,25 ; 1633 Hz */
8854 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[3] = 0x32;
8855 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[2] = 0x32;
8856 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[1] = 0x52;
8857 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[0] = 0xB3;
8860 static s16 tone_table
[][19] =
8863 32538, /* A1 = 1.985962 */
8864 -32325, /* A2 = -0.986511 */
8865 -343, /* B2 = -0.010493 */
8867 343, /* B0 = 0.010493 */
8868 32619, /* A1 = 1.990906 */
8869 -32520, /* A2 = -0.992462 */
8870 19179, /* B2 = 0.585327 */
8871 -19178, /* B1 = -1.170593 */
8872 19179, /* B0 = 0.585327 */
8873 32723, /* A1 = 1.997314 */
8874 -32686, /* A2 = -0.997528 */
8875 9973, /* B2 = 0.304352 */
8876 -9955, /* B1 = -0.607605 */
8877 9973, /* B0 = 0.304352 */
8878 7, /* Internal filter scaling */
8879 159, /* Minimum in-band energy threshold */
8880 21, /* 21/32 in-band to broad-band ratio */
8881 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
8883 { /* f133_200[] 12 */
8884 32072, /* A1 = 1.95752 */
8885 -31896, /* A2 = -0.973419 */
8886 -435, /* B2 = -0.013294 */
8888 435, /* B0 = 0.013294 */
8889 32188, /* A1 = 1.9646 */
8890 -32400, /* A2 = -0.98877 */
8891 15139, /* B2 = 0.462036 */
8892 -14882, /* B1 = -0.908356 */
8893 15139, /* B0 = 0.462036 */
8894 32473, /* A1 = 1.981995 */
8895 -32524, /* A2 = -0.992584 */
8896 23200, /* B2 = 0.708008 */
8897 -23113, /* B1 = -1.410706 */
8898 23200, /* B0 = 0.708008 */
8899 7, /* Internal filter scaling */
8900 159, /* Minimum in-band energy threshold */
8901 21, /* 21/32 in-band to broad-band ratio */
8902 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
8905 31769, /* A1 = -1.939026 */
8906 -32584, /* A2 = 0.994385 */
8907 -475, /* B2 = -0.014522 */
8908 0, /* B1 = 0.000000 */
8909 475, /* B0 = 0.014522 */
8910 31789, /* A1 = -1.940247 */
8911 -32679, /* A2 = 0.997284 */
8912 17280, /* B2 = 0.527344 */
8913 -16865, /* B1 = -1.029358 */
8914 17280, /* B0 = 0.527344 */
8915 31841, /* A1 = -1.943481 */
8916 -32681, /* A2 = 0.997345 */
8917 543, /* B2 = 0.016579 */
8918 -525, /* B1 = -0.032097 */
8919 543, /* B0 = 0.016579 */
8920 5, /* Internal filter scaling */
8921 159, /* Minimum in-band energy threshold */
8922 21, /* 21/32 in-band to broad-band ratio */
8923 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
8925 { /* f300_420[] 14 */
8926 30750, /* A1 = 1.876892 */
8927 -31212, /* A2 = -0.952515 */
8928 -804, /* B2 = -0.024541 */
8930 804, /* B0 = 0.024541 */
8931 30686, /* A1 = 1.872925 */
8932 -32145, /* A2 = -0.980988 */
8933 14747, /* B2 = 0.450043 */
8934 -13703, /* B1 = -0.836395 */
8935 14747, /* B0 = 0.450043 */
8936 31651, /* A1 = 1.931824 */
8937 -32321, /* A2 = -0.986389 */
8938 24425, /* B2 = 0.745422 */
8939 -23914, /* B1 = -1.459595 */
8940 24427, /* B0 = 0.745483 */
8941 7, /* Internal filter scaling */
8942 159, /* Minimum in-band energy threshold */
8943 21, /* 21/32 in-band to broad-band ratio */
8944 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
8947 31613, /* A1 = -1.929565 */
8948 -32646, /* A2 = 0.996277 */
8949 -185, /* B2 = -0.005657 */
8950 0, /* B1 = 0.000000 */
8951 185, /* B0 = 0.005657 */
8952 31620, /* A1 = -1.929932 */
8953 -32713, /* A2 = 0.998352 */
8954 19253, /* B2 = 0.587585 */
8955 -18566, /* B1 = -1.133179 */
8956 19253, /* B0 = 0.587585 */
8957 31674, /* A1 = -1.933228 */
8958 -32715, /* A2 = 0.998413 */
8959 2575, /* B2 = 0.078590 */
8960 -2495, /* B1 = -0.152283 */
8961 2575, /* B0 = 0.078590 */
8962 5, /* Internal filter scaling */
8963 159, /* Minimum in-band energy threshold */
8964 21, /* 21/32 in-band to broad-band ratio */
8965 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
8967 { /* f300_425[] 16 */
8968 30741, /* A1 = 1.876282 */
8969 -31475, /* A2 = -0.960541 */
8970 -703, /* B2 = -0.021484 */
8972 703, /* B0 = 0.021484 */
8973 30688, /* A1 = 1.873047 */
8974 -32248, /* A2 = -0.984161 */
8975 14542, /* B2 = 0.443787 */
8976 -13523, /* B1 = -0.825439 */
8977 14542, /* B0 = 0.443817 */
8978 31494, /* A1 = 1.922302 */
8979 -32366, /* A2 = -0.987762 */
8980 21577, /* B2 = 0.658508 */
8981 -21013, /* B1 = -1.282532 */
8982 21577, /* B0 = 0.658508 */
8983 7, /* Internal filter scaling */
8984 159, /* Minimum in-band energy threshold */
8985 21, /* 21/32 in-band to broad-band ratio */
8986 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
8988 { /* f330_440[] 17 */
8989 30627, /* A1 = 1.869324 */
8990 -31338, /* A2 = -0.95636 */
8991 -843, /* B2 = -0.025749 */
8993 843, /* B0 = 0.025749 */
8994 30550, /* A1 = 1.864685 */
8995 -32221, /* A2 = -0.983337 */
8996 13594, /* B2 = 0.414886 */
8997 -12589, /* B1 = -0.768402 */
8998 13594, /* B0 = 0.414886 */
8999 31488, /* A1 = 1.921936 */
9000 -32358, /* A2 = -0.987518 */
9001 24684, /* B2 = 0.753296 */
9002 -24029, /* B1 = -1.466614 */
9003 24684, /* B0 = 0.753296 */
9004 7, /* Internal filter scaling */
9005 159, /* Minimum in-band energy threshold */
9006 21, /* 21/32 in-band to broad-band ratio */
9007 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9010 31546, /* A1 = -1.925476 */
9011 -32646, /* A2 = 0.996277 */
9012 -445, /* B2 = -0.013588 */
9013 0, /* B1 = 0.000000 */
9014 445, /* B0 = 0.013588 */
9015 31551, /* A1 = -1.925781 */
9016 -32713, /* A2 = 0.998352 */
9017 23884, /* B2 = 0.728882 */
9018 -22979, /* B1 = -1.402527 */
9019 23884, /* B0 = 0.728882 */
9020 31606, /* A1 = -1.929138 */
9021 -32715, /* A2 = 0.998413 */
9022 863, /* B2 = 0.026367 */
9023 -835, /* B1 = -0.050985 */
9024 863, /* B0 = 0.026367 */
9025 5, /* Internal filter scaling */
9026 159, /* Minimum in-band energy threshold */
9027 21, /* 21/32 in-band to broad-band ratio */
9028 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9030 { /* f350_400[] 19 */
9031 31006, /* A1 = 1.892517 */
9032 -32029, /* A2 = -0.977448 */
9033 -461, /* B2 = -0.014096 */
9035 461, /* B0 = 0.014096 */
9036 30999, /* A1 = 1.892029 */
9037 -32487, /* A2 = -0.991455 */
9038 11325, /* B2 = 0.345612 */
9039 -10682, /* B1 = -0.651978 */
9040 11325, /* B0 = 0.345612 */
9041 31441, /* A1 = 1.919067 */
9042 -32526, /* A2 = -0.992615 */
9043 24324, /* B2 = 0.74231 */
9044 -23535, /* B1 = -1.436523 */
9045 24324, /* B0 = 0.74231 */
9046 7, /* Internal filter scaling */
9047 159, /* Minimum in-band energy threshold */
9048 21, /* 21/32 in-band to broad-band ratio */
9049 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9052 30634, /* A1 = 1.869751 */
9053 -31533, /* A2 = -0.962341 */
9054 -680, /* B2 = -0.020782 */
9056 680, /* B0 = 0.020782 */
9057 30571, /* A1 = 1.865906 */
9058 -32277, /* A2 = -0.985016 */
9059 12894, /* B2 = 0.393524 */
9060 -11945, /* B1 = -0.729065 */
9061 12894, /* B0 = 0.393524 */
9062 31367, /* A1 = 1.91449 */
9063 -32379, /* A2 = -0.988129 */
9064 23820, /* B2 = 0.726929 */
9065 -23104, /* B1 = -1.410217 */
9066 23820, /* B0 = 0.726929 */
9067 7, /* Internal filter scaling */
9068 159, /* Minimum in-band energy threshold */
9069 21, /* 21/32 in-band to broad-band ratio */
9070 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9073 30552, /* A1 = 1.864807 */
9074 -31434, /* A2 = -0.95929 */
9075 -690, /* B2 = -0.021066 */
9077 690, /* B0 = 0.021066 */
9078 30472, /* A1 = 1.859924 */
9079 -32248, /* A2 = -0.984161 */
9080 13385, /* B2 = 0.408478 */
9081 -12357, /* B1 = -0.754242 */
9082 13385, /* B0 = 0.408478 */
9083 31358, /* A1 = 1.914001 */
9084 -32366, /* A2 = -0.987732 */
9085 26488, /* B2 = 0.80835 */
9086 -25692, /* B1 = -1.568176 */
9087 26490, /* B0 = 0.808411 */
9088 7, /* Internal filter scaling */
9089 159, /* Minimum in-band energy threshold */
9090 21, /* 21/32 in-band to broad-band ratio */
9091 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9094 31397, /* A1 = -1.916321 */
9095 -32623, /* A2 = 0.995605 */
9096 -117, /* B2 = -0.003598 */
9097 0, /* B1 = 0.000000 */
9098 117, /* B0 = 0.003598 */
9099 31403, /* A1 = -1.916687 */
9100 -32700, /* A2 = 0.997925 */
9101 3388, /* B2 = 0.103401 */
9102 -3240, /* B1 = -0.197784 */
9103 3388, /* B0 = 0.103401 */
9104 31463, /* A1 = -1.920410 */
9105 -32702, /* A2 = 0.997986 */
9106 13346, /* B2 = 0.407288 */
9107 -12863, /* B1 = -0.785126 */
9108 13346, /* B0 = 0.407288 */
9109 5, /* Internal filter scaling */
9110 159, /* Minimum in-band energy threshold */
9111 21, /* 21/32 in-band to broad-band ratio */
9112 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9115 30831, /* A1 = 1.881775 */
9116 -32064, /* A2 = -0.978546 */
9117 -367, /* B2 = -0.01122 */
9119 367, /* B0 = 0.01122 */
9120 30813, /* A1 = 1.880737 */
9121 -32456, /* A2 = -0.990509 */
9122 11068, /* B2 = 0.337769 */
9123 -10338, /* B1 = -0.631042 */
9124 11068, /* B0 = 0.337769 */
9125 31214, /* A1 = 1.905212 */
9126 -32491, /* A2 = -0.991577 */
9127 16374, /* B2 = 0.499695 */
9128 -15781, /* B1 = -0.963196 */
9129 16374, /* B0 = 0.499695 */
9130 7, /* Internal filter scaling */
9131 159, /* Minimum in-band energy threshold */
9132 21, /* 21/32 in-band to broad-band ratio */
9133 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9136 31152, /* A1 = -1.901428 */
9137 -32613, /* A2 = 0.995300 */
9138 -314, /* B2 = -0.009605 */
9139 0, /* B1 = 0.000000 */
9140 314, /* B0 = 0.009605 */
9141 31156, /* A1 = -1.901672 */
9142 -32694, /* A2 = 0.997742 */
9143 28847, /* B2 = 0.880371 */
9144 -2734, /* B1 = -0.166901 */
9145 28847, /* B0 = 0.880371 */
9146 31225, /* A1 = -1.905823 */
9147 -32696, /* A2 = 0.997803 */
9148 462, /* B2 = 0.014108 */
9149 -442, /* B1 = -0.027019 */
9150 462, /* B0 = 0.014108 */
9151 5, /* Internal filter scaling */
9152 159, /* Minimum in-band energy threshold */
9153 21, /* 21/32 in-band to broad-band ratio */
9154 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9157 30836, /* A1 = 1.882141 */
9158 -32296, /* A2 = -0.985596 */
9159 -324, /* B2 = -0.009903 */
9161 324, /* B0 = 0.009903 */
9162 30825, /* A1 = 1.881409 */
9163 -32570, /* A2 = -0.993958 */
9164 16847, /* B2 = 0.51416 */
9165 -15792, /* B1 = -0.963898 */
9166 16847, /* B0 = 0.51416 */
9167 31106, /* A1 = 1.89856 */
9168 -32584, /* A2 = -0.994415 */
9169 9579, /* B2 = 0.292328 */
9170 -9164, /* B1 = -0.559357 */
9171 9579, /* B0 = 0.292328 */
9172 7, /* Internal filter scaling */
9173 159, /* Minimum in-band energy threshold */
9174 21, /* 21/32 in-band to broad-band ratio */
9175 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9178 30702, /* A1 = 1.873962 */
9179 -32134, /* A2 = -0.980682 */
9180 -517, /* B2 = -0.015793 */
9182 517, /* B0 = 0.015793 */
9183 30676, /* A1 = 1.872375 */
9184 -32520, /* A2 = -0.992462 */
9185 8144, /* B2 = 0.24855 */
9186 -7596, /* B1 = -0.463684 */
9187 8144, /* B0 = 0.24855 */
9188 31084, /* A1 = 1.897217 */
9189 -32547, /* A2 = -0.993256 */
9190 22713, /* B2 = 0.693176 */
9191 -21734, /* B1 = -1.326599 */
9192 22713, /* B0 = 0.693176 */
9193 7, /* Internal filter scaling */
9194 159, /* Minimum in-band energy threshold */
9195 21, /* 21/32 in-band to broad-band ratio */
9196 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9199 30613, /* A1 = 1.86853 */
9200 -32031, /* A2 = -0.977509 */
9201 -618, /* B2 = -0.018866 */
9203 618, /* B0 = 0.018866 */
9204 30577, /* A1 = 1.866272 */
9205 -32491, /* A2 = -0.991577 */
9206 9612, /* B2 = 0.293335 */
9207 -8935, /* B1 = -0.54541 */
9208 9612, /* B0 = 0.293335 */
9209 31071, /* A1 = 1.896484 */
9210 -32524, /* A2 = -0.992584 */
9211 21596, /* B2 = 0.659058 */
9212 -20667, /* B1 = -1.261414 */
9213 21596, /* B0 = 0.659058 */
9214 7, /* Internal filter scaling */
9215 159, /* Minimum in-band energy threshold */
9216 21, /* 21/32 in-band to broad-band ratio */
9217 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9220 30914, /* A1 = -1.886841 */
9221 -32584, /* A2 = 0.994385 */
9222 -426, /* B2 = -0.013020 */
9223 0, /* B1 = 0.000000 */
9224 426, /* B0 = 0.013020 */
9225 30914, /* A1 = -1.886841 */
9226 -32679, /* A2 = 0.997314 */
9227 17520, /* B2 = 0.534668 */
9228 -16471, /* B1 = -1.005310 */
9229 17520, /* B0 = 0.534668 */
9230 31004, /* A1 = -1.892334 */
9231 -32683, /* A2 = 0.997406 */
9232 819, /* B2 = 0.025023 */
9233 -780, /* B1 = -0.047619 */
9234 819, /* B0 = 0.025023 */
9235 5, /* Internal filter scaling */
9236 159, /* Minimum in-band energy threshold */
9237 21, /* 21/32 in-band to broad-band ratio */
9238 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9242 30881, /* A1 = -1.884827 */
9243 -32603, /* A2 = 0.994965 */
9244 -496, /* B2 = -0.015144 */
9245 0, /* B1 = 0.000000 */
9246 496, /* B0 = 0.015144 */
9247 30880, /* A1 = -1.884766 */
9248 -32692, /* A2 = 0.997711 */
9249 24767, /* B2 = 0.755859 */
9250 -23290, /* B1 = -1.421509 */
9251 24767, /* B0 = 0.755859 */
9252 30967, /* A1 = -1.890076 */
9253 -32694, /* A2 = 0.997772 */
9254 728, /* B2 = 0.022232 */
9255 -691, /* B1 = -0.042194 */
9256 728, /* B0 = 0.022232 */
9257 5, /* Internal filter scaling */
9258 159, /* Minimum in-band energy threshold */
9259 21, /* 21/32 in-band to broad-band ratio */
9260 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9286 30646, /* A1 = 1.870544 */
9287 -32327, /* A2 = -0.986572 */
9288 -287, /* B2 = -0.008769 */
9290 287, /* B0 = 0.008769 */
9291 30627, /* A1 = 1.869324 */
9292 -32607, /* A2 = -0.995087 */
9293 13269, /* B2 = 0.404968 */
9294 -12376, /* B1 = -0.755432 */
9295 13269, /* B0 = 0.404968 */
9296 30924, /* A1 = 1.887512 */
9297 -32619, /* A2 = -0.995453 */
9298 19950, /* B2 = 0.608826 */
9299 -18940, /* B1 = -1.156006 */
9300 19950, /* B0 = 0.608826 */
9301 7, /* Internal filter scaling */
9302 159, /* Minimum in-band energy threshold */
9303 21, /* 21/32 in-band to broad-band ratio */
9304 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9307 30396, /* A1 = 1.855225 */
9308 -32014, /* A2 = -0.97699 */
9309 -395, /* B2 = -0.012055 */
9311 395, /* B0 = 0.012055 */
9312 30343, /* A1 = 1.85199 */
9313 -32482, /* A2 = -0.991302 */
9314 17823, /* B2 = 0.543945 */
9315 -16431, /* B1 = -1.002869 */
9316 17823, /* B0 = 0.543945 */
9317 30872, /* A1 = 1.884338 */
9318 -32516, /* A2 = -0.99231 */
9319 18124, /* B2 = 0.553101 */
9320 -17246, /* B1 = -1.052673 */
9321 18124, /* B0 = 0.553101 */
9322 7, /* Internal filter scaling */
9323 159, /* Minimum in-band energy threshold */
9324 21, /* 21/32 in-band to broad-band ratio */
9325 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9328 30796, /* A1 = -1.879639 */
9329 -32603, /* A2 = 0.994965 */
9330 -254, /* B2 = -0.007762 */
9331 0, /* B1 = 0.000000 */
9332 254, /* B0 = 0.007762 */
9333 30793, /* A1 = -1.879456 */
9334 -32692, /* A2 = 0.997711 */
9335 18934, /* B2 = 0.577820 */
9336 -17751, /* B1 = -1.083496 */
9337 18934, /* B0 = 0.577820 */
9338 30882, /* A1 = -1.884888 */
9339 -32694, /* A2 = 0.997772 */
9340 1858, /* B2 = 0.056713 */
9341 -1758, /* B1 = -0.107357 */
9342 1858, /* B0 = 0.056713 */
9343 5, /* Internal filter scaling */
9344 159, /* Minimum in-band energy threshold */
9345 21, /* 21/32 in-band to broad-band ratio */
9346 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9349 30641, /* A1 = 1.870239 */
9350 -32458, /* A2 = -0.99057 */
9351 -155, /* B2 = -0.004735 */
9353 155, /* B0 = 0.004735 */
9354 30631, /* A1 = 1.869568 */
9355 -32630, /* A2 = -0.995789 */
9356 11453, /* B2 = 0.349548 */
9357 -10666, /* B1 = -0.651001 */
9358 11453, /* B0 = 0.349548 */
9359 30810, /* A1 = 1.880554 */
9360 -32634, /* A2 = -0.995941 */
9361 12237, /* B2 = 0.373474 */
9362 -11588, /* B1 = -0.707336 */
9363 12237, /* B0 = 0.373474 */
9364 7, /* Internal filter scaling */
9365 159, /* Minimum in-band energy threshold */
9366 21, /* 21/32 in-band to broad-band ratio */
9367 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9370 30367, /* A1 = 1.853455 */
9371 -32147, /* A2 = -0.981079 */
9372 -495, /* B2 = -0.015113 */
9374 495, /* B0 = 0.015113 */
9375 30322, /* A1 = 1.850769 */
9376 -32543, /* A2 = -0.993134 */
9377 10031, /* B2 = 0.306152 */
9378 -9252, /* B1 = -0.564728 */
9379 10031, /* B0 = 0.306152 */
9380 30770, /* A1 = 1.878052 */
9381 -32563, /* A2 = -0.993774 */
9382 22674, /* B2 = 0.691956 */
9383 -21465, /* B1 = -1.31012 */
9384 22674, /* B0 = 0.691956 */
9385 7, /* Internal filter scaling */
9386 159, /* Minimum in-band energy threshold */
9387 21, /* 21/32 in-band to broad-band ratio */
9388 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9391 30709, /* A1 = -1.874329 */
9392 -32603, /* A2 = 0.994965 */
9393 -83, /* B2 = -0.002545 */
9394 0, /* B1 = 0.000000 */
9395 83, /* B0 = 0.002545 */
9396 30704, /* A1 = -1.874084 */
9397 -32692, /* A2 = 0.997711 */
9398 10641, /* B2 = 0.324738 */
9399 -9947, /* B1 = -0.607147 */
9400 10641, /* B0 = 0.324738 */
9401 30796, /* A1 = -1.879639 */
9402 -32694, /* A2 = 0.997772 */
9403 10079, /* B2 = 0.307587 */
9404 9513, /* B1 = 0.580688 */
9405 10079, /* B0 = 0.307587 */
9406 5, /* Internal filter scaling */
9407 159, /* Minimum in-band energy threshold */
9408 21, /* 21/32 in-band to broad-band ratio */
9409 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9412 30664, /* A1 = -1.871643 */
9413 -32603, /* A2 = 0.994965 */
9414 -164, /* B2 = -0.005029 */
9415 0, /* B1 = 0.000000 */
9416 164, /* B0 = 0.005029 */
9417 30661, /* A1 = -1.871399 */
9418 -32692, /* A2 = 0.997711 */
9419 15294, /* B2 = 0.466736 */
9420 -14275, /* B1 = -0.871307 */
9421 15294, /* B0 = 0.466736 */
9422 30751, /* A1 = -1.876953 */
9423 -32694, /* A2 = 0.997772 */
9424 3548, /* B2 = 0.108284 */
9425 -3344, /* B1 = -0.204155 */
9426 3548, /* B0 = 0.108284 */
9427 5, /* Internal filter scaling */
9428 159, /* Minimum in-band energy threshold */
9429 21, /* 21/32 in-band to broad-band ratio */
9430 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9433 30653, /* A1 = -1.870911 */
9434 -32615, /* A2 = 0.995361 */
9435 -209, /* B2 = -0.006382 */
9436 0, /* B1 = 0.000000 */
9437 209, /* B0 = 0.006382 */
9438 30647, /* A1 = -1.870605 */
9439 -32702, /* A2 = 0.997986 */
9440 18971, /* B2 = 0.578979 */
9441 -17716, /* B1 = -1.081299 */
9442 18971, /* B0 = 0.578979 */
9443 30738, /* A1 = -1.876099 */
9444 -32702, /* A2 = 0.998016 */
9445 2967, /* B2 = 0.090561 */
9446 -2793, /* B1 = -0.170502 */
9447 2967, /* B0 = 0.090561 */
9448 5, /* Internal filter scaling */
9449 159, /* Minimum in-band energy threshold */
9450 21, /* 21/32 in-band to broad-band ratio */
9451 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9454 30437, /* A1 = -1.857727 */
9455 -32603, /* A2 = 0.994965 */
9456 -264, /* B2 = -0.008062 */
9457 0, /* B1 = 0.000000 */
9458 264, /* B0 = 0.008062 */
9459 30430, /* A1 = -1.857300 */
9460 -32692, /* A2 = 0.997711 */
9461 21681, /* B2 = 0.661682 */
9462 -20082, /* B1 = -1.225708 */
9463 21681, /* B0 = 0.661682 */
9464 30526, /* A1 = -1.863220 */
9465 -32694, /* A2 = 0.997742 */
9466 1559, /* B2 = 0.047600 */
9467 -1459, /* B1 = -0.089096 */
9468 1559, /* B0 = 0.047600 */
9469 5, /* Internal filter scaling */
9470 159, /* Minimum in-band energy threshold */
9471 21, /* 21/32 in-band to broad-band ratio */
9472 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9475 28975, /* A1 = 1.768494 */
9476 -30955, /* A2 = -0.944672 */
9477 -1026, /* B2 = -0.03133 */
9479 1026, /* B0 = 0.03133 */
9480 28613, /* A1 = 1.746399 */
9481 -32089, /* A2 = -0.979309 */
9482 14214, /* B2 = 0.433807 */
9483 -12202, /* B1 = -0.744812 */
9484 14214, /* B0 = 0.433807 */
9485 30243, /* A1 = 1.845947 */
9486 -32238, /* A2 = -0.983856 */
9487 24825, /* B2 = 0.757629 */
9488 -23402, /* B1 = -1.428345 */
9489 24825, /* B0 = 0.757629 */
9490 7, /* Internal filter scaling */
9491 159, /* Minimum in-band energy threshold */
9492 21, /* 21/32 in-band to broad-band ratio */
9493 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9496 30257, /* A1 = -1.846741 */
9497 -32605, /* A2 = 0.995056 */
9498 -249, /* B2 = -0.007625 */
9499 0, /* B1 = 0.000000 */
9500 249, /* B0 = 0.007625 */
9501 30247, /* A1 = -1.846191 */
9502 -32694, /* A2 = 0.997772 */
9503 18088, /* B2 = 0.552002 */
9504 -16652, /* B1 = -1.016418 */
9505 18088, /* B0 = 0.552002 */
9506 30348, /* A1 = -1.852295 */
9507 -32696, /* A2 = 0.997803 */
9508 2099, /* B2 = 0.064064 */
9509 -1953, /* B1 = -0.119202 */
9510 2099, /* B0 = 0.064064 */
9511 5, /* Internal filter scaling */
9512 159, /* Minimum in-band energy threshold */
9513 21, /* 21/32 in-band to broad-band ratio */
9514 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9517 30202, /* A1 = -1.843431 */
9518 -32624, /* A2 = 0.995622 */
9519 -413, /* B2 = -0.012622 */
9520 0, /* B1 = 0.000000 */
9521 413, /* B0 = 0.012622 */
9522 30191, /* A1 = -1.842721 */
9523 -32714, /* A2 = 0.998364 */
9524 25954, /* B2 = 0.792057 */
9525 -23890, /* B1 = -1.458131 */
9526 25954, /* B0 = 0.792057 */
9527 30296, /* A1 = -1.849172 */
9528 -32715, /* A2 = 0.998397 */
9529 2007, /* B2 = 0.061264 */
9530 -1860, /* B1 = -0.113568 */
9531 2007, /* B0 = 0.061264 */
9532 5, /* Internal filter scaling */
9533 159, /* Minimum in-band energy threshold */
9534 21, /* 21/32 in-band to broad-band ratio */
9535 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9538 30001, /* A1 = -1.831116 */
9539 -32613, /* A2 = 0.995270 */
9540 -155, /* B2 = -0.004750 */
9541 0, /* B1 = 0.000000 */
9542 155, /* B0 = 0.004750 */
9543 29985, /* A1 = -1.830200 */
9544 -32710, /* A2 = 0.998260 */
9545 6584, /* B2 = 0.200928 */
9546 -6018, /* B1 = -0.367355 */
9547 6584, /* B0 = 0.200928 */
9548 30105, /* A1 = -1.837524 */
9549 -32712, /* A2 = 0.998291 */
9550 23812, /* B2 = 0.726685 */
9551 -21936, /* B1 = -1.338928 */
9552 23812, /* B0 = 0.726685 */
9553 5, /* Internal filter scaling */
9554 159, /* Minimum in-band energy threshold */
9555 21, /* 21/32 in-band to broad-band ratio */
9556 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9559 29964, /* A1 = -1.828918 */
9560 -32601, /* A2 = 0.994904 */
9561 -101, /* B2 = -0.003110 */
9562 0, /* B1 = 0.000000 */
9563 101, /* B0 = 0.003110 */
9564 29949, /* A1 = -1.827942 */
9565 -32700, /* A2 = 0.997925 */
9566 11041, /* B2 = 0.336975 */
9567 -10075, /* B1 = -0.614960 */
9568 11041, /* B0 = 0.336975 */
9569 30070, /* A1 = -1.835388 */
9570 -32702, /* A2 = 0.997986 */
9571 16762, /* B2 = 0.511536 */
9572 -15437, /* B1 = -0.942230 */
9573 16762, /* B0 = 0.511536 */
9574 5, /* Internal filter scaling */
9575 159, /* Minimum in-band energy threshold */
9576 21, /* 21/32 in-band to broad-band ratio */
9577 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9580 29936, /* A1 = -1.827209 */
9581 -32584, /* A2 = 0.994415 */
9582 -91, /* B2 = -0.002806 */
9583 0, /* B1 = 0.000000 */
9584 91, /* B0 = 0.002806 */
9585 29921, /* A1 = -1.826233 */
9586 -32688, /* A2 = 0.997559 */
9587 11449, /* B2 = 0.349396 */
9588 -10426, /* B1 = -0.636383 */
9589 11449, /* B0 = 0.349396 */
9590 30045, /* A1 = -1.833862 */
9591 -32688, /* A2 = 0.997589 */
9592 13055, /* B2 = 0.398407 */
9593 -12028, /* B1 = -0.734161 */
9594 13055, /* B0 = 0.398407 */
9595 5, /* Internal filter scaling */
9596 159, /* Minimum in-band energy threshold */
9597 21, /* 21/32 in-band to broad-band ratio */
9598 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9601 28499, /* A1 = 1.739441 */
9602 -31129, /* A2 = -0.949982 */
9603 -849, /* B2 = -0.025922 */
9605 849, /* B0 = 0.025922 */
9606 28128, /* A1 = 1.716797 */
9607 -32130, /* A2 = -0.98056 */
9608 14556, /* B2 = 0.444214 */
9609 -12251, /* B1 = -0.747772 */
9610 14556, /* B0 = 0.444244 */
9611 29667, /* A1 = 1.81073 */
9612 -32244, /* A2 = -0.984039 */
9613 23038, /* B2 = 0.703064 */
9614 -21358, /* B1 = -1.303589 */
9615 23040, /* B0 = 0.703125 */
9616 7, /* Internal filter scaling */
9617 159, /* Minimum in-band energy threshold */
9618 21, /* 21/32 in-band to broad-band ratio */
9619 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9622 29271, /* A1 = -1.786560 */
9623 -32599, /* A2 = 0.994873 */
9624 -490, /* B2 = -0.014957 */
9625 0, /* B1 = 0.000000 */
9626 490, /* B0 = 0.014957 */
9627 29246, /* A1 = -1.785095 */
9628 -32700, /* A2 = 0.997925 */
9629 28961, /* B2 = 0.883850 */
9630 -25796, /* B1 = -1.574463 */
9631 28961, /* B0 = 0.883850 */
9632 29383, /* A1 = -1.793396 */
9633 -32700, /* A2 = 0.997955 */
9634 1299, /* B2 = 0.039650 */
9635 -1169, /* B1 = -0.071396 */
9636 1299, /* B0 = 0.039650 */
9637 5, /* Internal filter scaling */
9638 159, /* Minimum in-band energy threshold */
9639 21, /* 21/32 in-band to broad-band ratio */
9640 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9643 29230, /* A1 = -1.784058 */
9644 -32584, /* A2 = 0.994415 */
9645 -418, /* B2 = -0.012757 */
9646 0, /* B1 = 0.000000 */
9647 418, /* B0 = 0.012757 */
9648 29206, /* A1 = -1.782593 */
9649 -32688, /* A2 = 0.997559 */
9650 36556, /* B2 = 1.115601 */
9651 -32478, /* B1 = -1.982300 */
9652 36556, /* B0 = 1.115601 */
9653 29345, /* A1 = -1.791077 */
9654 -32688, /* A2 = 0.997589 */
9655 897, /* B2 = 0.027397 */
9656 -808, /* B1 = -0.049334 */
9657 897, /* B0 = 0.027397 */
9658 5, /* Internal filter scaling */
9659 159, /* Minimum in-band energy threshold */
9660 21, /* 21/32 in-band to broad-band ratio */
9661 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9664 29116, /* A1 = -1.777100 */
9665 -32603, /* A2 = 0.994965 */
9666 -165, /* B2 = -0.005039 */
9667 0, /* B1 = 0.000000 */
9668 165, /* B0 = 0.005039 */
9669 29089, /* A1 = -1.775452 */
9670 -32708, /* A2 = 0.998199 */
9671 6963, /* B2 = 0.212494 */
9672 -6172, /* B1 = -0.376770 */
9673 6963, /* B0 = 0.212494 */
9674 29237, /* A1 = -1.784485 */
9675 -32710, /* A2 = 0.998230 */
9676 24197, /* B2 = 0.738464 */
9677 -21657, /* B1 = -1.321899 */
9678 24197, /* B0 = 0.738464 */
9679 5, /* Internal filter scaling */
9680 159, /* Minimum in-band energy threshold */
9681 21, /* 21/32 in-band to broad-band ratio */
9682 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9685 28376, /* A1 = -1.731934 */
9686 -32567, /* A2 = 0.993896 */
9687 -363, /* B2 = -0.011102 */
9688 0, /* B1 = 0.000000 */
9689 363, /* B0 = 0.011102 */
9690 28337, /* A1 = -1.729614 */
9691 -32683, /* A2 = 0.997434 */
9692 21766, /* B2 = 0.664246 */
9693 -18761, /* B1 = -1.145081 */
9694 21766, /* B0 = 0.664246 */
9695 28513, /* A1 = -1.740356 */
9696 -32686, /* A2 = 0.997498 */
9697 2509, /* B2 = 0.076584 */
9698 -2196, /* B1 = -0.134041 */
9699 2509, /* B0 = 0.076584 */
9700 5, /* Internal filter scaling */
9701 159, /* Minimum in-band energy threshold */
9702 21, /* 21/32 in-band to broad-band ratio */
9703 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9706 27844, /* A1 = -1.699463 */
9707 -32563, /* A2 = 0.993744 */
9708 -366, /* B2 = -0.011187 */
9709 0, /* B1 = 0.000000 */
9710 366, /* B0 = 0.011187 */
9711 27797, /* A1 = -1.696655 */
9712 -32686, /* A2 = 0.997498 */
9713 22748, /* B2 = 0.694214 */
9714 -19235, /* B1 = -1.174072 */
9715 22748, /* B0 = 0.694214 */
9716 27995, /* A1 = -1.708740 */
9717 -32688, /* A2 = 0.997559 */
9718 2964, /* B2 = 0.090477 */
9719 -2546, /* B1 = -0.155449 */
9720 2964, /* B0 = 0.090477 */
9721 5, /* Internal filter scaling */
9722 159, /* Minimum in-band energy threshold */
9723 21, /* 21/32 in-band to broad-band ratio */
9724 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9727 27297, /* A1 = -1.666077 */
9728 -32551, /* A2 = 0.993408 */
9729 -345, /* B2 = -0.010540 */
9730 0, /* B1 = 0.000000 */
9731 345, /* B0 = 0.010540 */
9732 27240, /* A1 = -1.662598 */
9733 -32683, /* A2 = 0.997406 */
9734 22560, /* B2 = 0.688477 */
9735 -18688, /* B1 = -1.140625 */
9736 22560, /* B0 = 0.688477 */
9737 27461, /* A1 = -1.676147 */
9738 -32684, /* A2 = 0.997467 */
9739 3541, /* B2 = 0.108086 */
9740 -2985, /* B1 = -0.182220 */
9741 3541, /* B0 = 0.108086 */
9742 5, /* Internal filter scaling */
9743 159, /* Minimum in-band energy threshold */
9744 21, /* 21/32 in-band to broad-band ratio */
9745 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9748 27155, /* A1 = -1.657410 */
9749 -32551, /* A2 = 0.993408 */
9750 -462, /* B2 = -0.014117 */
9751 0, /* B1 = 0.000000 */
9752 462, /* B0 = 0.014117 */
9753 27097, /* A1 = -1.653870 */
9754 -32683, /* A2 = 0.997406 */
9755 32495, /* B2 = 0.991699 */
9756 -26776, /* B1 = -1.634338 */
9757 32495, /* B0 = 0.991699 */
9758 27321, /* A1 = -1.667542 */
9759 -32684, /* A2 = 0.997467 */
9760 1835, /* B2 = 0.056007 */
9761 -1539, /* B1 = -0.093948 */
9762 1835, /* B0 = 0.056007 */
9763 5, /* Internal filter scaling */
9764 159, /* Minimum in-band energy threshold */
9765 21, /* 21/32 in-band to broad-band ratio */
9766 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9769 19298, /* A1 = 1.177917 */
9770 -24471, /* A2 = -0.746796 */
9771 -4152, /* B2 = -0.126709 */
9773 4152, /* B0 = 0.126709 */
9774 12902, /* A1 = 0.787476 */
9775 -29091, /* A2 = -0.887817 */
9776 12491, /* B2 = 0.38121 */
9777 -1794, /* B1 = -0.109528 */
9778 12494, /* B0 = 0.381317 */
9779 26291, /* A1 = 1.604736 */
9780 -30470, /* A2 = -0.929901 */
9781 28859, /* B2 = 0.880737 */
9782 -26084, /* B1 = -1.592102 */
9783 28861, /* B0 = 0.880798 */
9784 7, /* Internal filter scaling */
9785 159, /* Minimum in-band energy threshold */
9786 21, /* 21/32 in-band to broad-band ratio */
9787 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9790 26867, /* A1 = -1.639832 */
9791 -32551, /* A2 = 0.993408 */
9792 -123, /* B2 = -0.003755 */
9793 0, /* B1 = 0.000000 */
9794 123, /* B0 = 0.003755 */
9795 26805, /* A1 = -1.636108 */
9796 -32683, /* A2 = 0.997406 */
9797 17297, /* B2 = 0.527863 */
9798 -14096, /* B1 = -0.860382 */
9799 17297, /* B0 = 0.527863 */
9800 27034, /* A1 = -1.650085 */
9801 -32684, /* A2 = 0.997467 */
9802 12958, /* B2 = 0.395477 */
9803 -10756, /* B1 = -0.656525 */
9804 12958, /* B0 = 0.395477 */
9805 5, /* Internal filter scaling */
9806 159, /* Minimum in-band energy threshold */
9807 21, /* 21/32 in-band to broad-band ratio */
9808 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9811 26413, /* A1 = -1.612122 */
9812 -32547, /* A2 = 0.993286 */
9813 -223, /* B2 = -0.006825 */
9814 0, /* B1 = 0.000000 */
9815 223, /* B0 = 0.006825 */
9816 26342, /* A1 = -1.607849 */
9817 -32686, /* A2 = 0.997498 */
9818 6391, /* B2 = 0.195053 */
9819 -5120, /* B1 = -0.312531 */
9820 6391, /* B0 = 0.195053 */
9821 26593, /* A1 = -1.623108 */
9822 -32688, /* A2 = 0.997559 */
9823 23681, /* B2 = 0.722717 */
9824 -19328, /* B1 = -1.179688 */
9825 23681, /* B0 = 0.722717 */
9826 5, /* Internal filter scaling */
9827 159, /* Minimum in-band energy threshold */
9828 21, /* 21/32 in-band to broad-band ratio */
9829 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9832 26168, /* A1 = -1.597209 */
9833 -32528, /* A2 = 0.992706 */
9834 -235, /* B2 = -0.007182 */
9835 0, /* B1 = 0.000000 */
9836 235, /* B0 = 0.007182 */
9837 26092, /* A1 = -1.592590 */
9838 -32675, /* A2 = 0.997192 */
9839 20823, /* B2 = 0.635498 */
9840 -16510, /* B1 = -1.007751 */
9841 20823, /* B0 = 0.635498 */
9842 26363, /* A1 = -1.609070 */
9843 -32677, /* A2 = 0.997253 */
9844 6739, /* B2 = 0.205688 */
9845 -5459, /* B1 = -0.333206 */
9846 6739, /* B0 = 0.205688 */
9847 5, /* Internal filter scaling */
9848 159, /* Minimum in-band energy threshold */
9849 21, /* 21/32 in-band to broad-band ratio */
9850 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9853 25641, /* A1 = -1.565063 */
9854 -32536, /* A2 = 0.992950 */
9855 -121, /* B2 = -0.003707 */
9856 0, /* B1 = 0.000000 */
9857 121, /* B0 = 0.003707 */
9858 25560, /* A1 = -1.560059 */
9859 -32684, /* A2 = 0.997437 */
9860 18341, /* B2 = 0.559753 */
9861 -14252, /* B1 = -0.869904 */
9862 18341, /* B0 = 0.559753 */
9863 25837, /* A1 = -1.577026 */
9864 -32684, /* A2 = 0.997467 */
9865 16679, /* B2 = 0.509003 */
9866 -13232, /* B1 = -0.807648 */
9867 16679, /* B0 = 0.509003 */
9868 5, /* Internal filter scaling */
9869 159, /* Minimum in-band energy threshold */
9870 21, /* 21/32 in-band to broad-band ratio */
9871 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9874 16415, /* A1 = 1.001953 */
9875 -23669, /* A2 = -0.722321 */
9876 -4549, /* B2 = -0.138847 */
9878 4549, /* B0 = 0.138847 */
9879 8456, /* A1 = 0.516174 */
9880 -28996, /* A2 = -0.884918 */
9881 13753, /* B2 = 0.419724 */
9882 -12, /* B1 = -0.000763 */
9883 13757, /* B0 = 0.419846 */
9884 24632, /* A1 = 1.503418 */
9885 -30271, /* A2 = -0.923828 */
9886 29070, /* B2 = 0.887146 */
9887 -25265, /* B1 = -1.542114 */
9888 29073, /* B0 = 0.887268 */
9889 7, /* Internal filter scaling */
9890 159, /* Minimum in-band energy threshold */
9891 21, /* 21/32 in-band to broad-band ratio */
9892 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9895 24806, /* A1 = -1.514099 */
9896 -32501, /* A2 = 0.991852 */
9897 -326, /* B2 = -0.009969 */
9898 0, /* B1 = 0.000000 */
9899 326, /* B0 = 0.009969 */
9900 24709, /* A1 = -1.508118 */
9901 -32659, /* A2 = 0.996674 */
9902 20277, /* B2 = 0.618835 */
9903 -15182, /* B1 = -0.926636 */
9904 20277, /* B0 = 0.618835 */
9905 25022, /* A1 = -1.527222 */
9906 -32661, /* A2 = 0.996735 */
9907 4320, /* B2 = 0.131836 */
9908 -3331, /* B1 = -0.203339 */
9909 4320, /* B0 = 0.131836 */
9910 5, /* Internal filter scaling */
9911 159, /* Minimum in-band energy threshold */
9912 21, /* 21/32 in-band to broad-band ratio */
9913 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9916 19776, /* A1 = 1.207092 */
9917 -27437, /* A2 = -0.837341 */
9918 -2666, /* B2 = -0.081371 */
9920 2666, /* B0 = 0.081371 */
9921 16302, /* A1 = 0.995026 */
9922 -30354, /* A2 = -0.926361 */
9923 10389, /* B2 = 0.317062 */
9924 -3327, /* B1 = -0.203064 */
9925 10389, /* B0 = 0.317062 */
9926 24299, /* A1 = 1.483154 */
9927 -30930, /* A2 = -0.943909 */
9928 25016, /* B2 = 0.763428 */
9929 -21171, /* B1 = -1.292236 */
9930 25016, /* B0 = 0.763428 */
9931 7, /* Internal filter scaling */
9932 159, /* Minimum in-band energy threshold */
9933 21, /* 21/32 in-band to broad-band ratio */
9934 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9937 20554, /* A1 = 1.254517 */
9938 -28764, /* A2 = -0.877838 */
9939 -2048, /* B2 = -0.062515 */
9941 2048, /* B0 = 0.062515 */
9942 18209, /* A1 = 1.11145 */
9943 -30951, /* A2 = -0.94458 */
9944 9390, /* B2 = 0.286575 */
9945 -3955, /* B1 = -0.241455 */
9946 9390, /* B0 = 0.286575 */
9947 23902, /* A1 = 1.458923 */
9948 -31286, /* A2 = -0.954803 */
9949 23252, /* B2 = 0.709595 */
9950 -19132, /* B1 = -1.167725 */
9951 23252, /* B0 = 0.709595 */
9952 7, /* Internal filter scaling */
9953 159, /* Minimum in-band energy threshold */
9954 21, /* 21/32 in-band to broad-band ratio */
9955 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9958 17543, /* A1 = 1.07074 */
9959 -26220, /* A2 = -0.800201 */
9960 -3298, /* B2 = -0.100647 */
9962 3298, /* B0 = 0.100647 */
9963 12423, /* A1 = 0.75827 */
9964 -30036, /* A2 = -0.916626 */
9965 12651, /* B2 = 0.386078 */
9966 -2444, /* B1 = -0.14917 */
9967 12653, /* B0 = 0.386154 */
9968 23518, /* A1 = 1.435425 */
9969 -30745, /* A2 = -0.938293 */
9970 27282, /* B2 = 0.832581 */
9971 -22529, /* B1 = -1.375122 */
9972 27286, /* B0 = 0.832703 */
9973 7, /* Internal filter scaling */
9974 159, /* Minimum in-band energy threshold */
9975 21, /* 21/32 in-band to broad-band ratio */
9976 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9979 24104, /* A1 = -1.471252 */
9980 -32507, /* A2 = 0.992065 */
9981 -351, /* B2 = -0.010722 */
9982 0, /* B1 = 0.000000 */
9983 351, /* B0 = 0.010722 */
9984 23996, /* A1 = -1.464600 */
9985 -32671, /* A2 = 0.997040 */
9986 22848, /* B2 = 0.697266 */
9987 -16639, /* B1 = -1.015564 */
9988 22848, /* B0 = 0.697266 */
9989 24332, /* A1 = -1.485168 */
9990 -32673, /* A2 = 0.997101 */
9991 4906, /* B2 = 0.149727 */
9992 -3672, /* B1 = -0.224174 */
9993 4906, /* B0 = 0.149727 */
9994 5, /* Internal filter scaling */
9995 159, /* Minimum in-band energy threshold */
9996 21, /* 21/32 in-band to broad-band ratio */
9997 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10000 23967, /* A1 = -1.462830 */
10001 -32507, /* A2 = 0.992065 */
10002 -518, /* B2 = -0.015821 */
10003 0, /* B1 = 0.000000 */
10004 518, /* B0 = 0.015821 */
10005 23856, /* A1 = -1.456055 */
10006 -32671, /* A2 = 0.997040 */
10007 26287, /* B2 = 0.802246 */
10008 -19031, /* B1 = -1.161560 */
10009 26287, /* B0 = 0.802246 */
10010 24195, /* A1 = -1.476746 */
10011 -32673, /* A2 = 0.997101 */
10012 2890, /* B2 = 0.088196 */
10013 -2151, /* B1 = -0.131317 */
10014 2890, /* B0 = 0.088196 */
10015 5, /* Internal filter scaling */
10016 159, /* Minimum in-band energy threshold */
10017 21, /* 21/32 in-band to broad-band ratio */
10018 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10020 { /* f950_1400[] */
10021 18294, /* A1 = 1.116638 */
10022 -26962, /* A2 = -0.822845 */
10023 -2914, /* B2 = -0.088936 */
10025 2914, /* B0 = 0.088936 */
10026 14119, /* A1 = 0.861786 */
10027 -30227, /* A2 = -0.922455 */
10028 11466, /* B2 = 0.349945 */
10029 -2833, /* B1 = -0.172943 */
10030 11466, /* B0 = 0.349945 */
10031 23431, /* A1 = 1.430115 */
10032 -30828, /* A2 = -0.940796 */
10033 25331, /* B2 = 0.773071 */
10034 -20911, /* B1 = -1.276367 */
10035 25331, /* B0 = 0.773071 */
10036 7, /* Internal filter scaling */
10037 159, /* Minimum in-band energy threshold */
10038 21, /* 21/32 in-band to broad-band ratio */
10039 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10042 23521, /* A1 = -1.435608 */
10043 -32489, /* A2 = 0.991516 */
10044 -193, /* B2 = -0.005915 */
10045 0, /* B1 = 0.000000 */
10046 193, /* B0 = 0.005915 */
10047 23404, /* A1 = -1.428467 */
10048 -32655, /* A2 = 0.996582 */
10049 17740, /* B2 = 0.541412 */
10050 -12567, /* B1 = -0.767029 */
10051 17740, /* B0 = 0.541412 */
10052 23753, /* A1 = -1.449829 */
10053 -32657, /* A2 = 0.996613 */
10054 9090, /* B2 = 0.277405 */
10055 -6662, /* B1 = -0.406647 */
10056 9090, /* B0 = 0.277405 */
10057 5, /* Internal filter scaling */
10058 159, /* Minimum in-band energy threshold */
10059 21, /* 21/32 in-band to broad-band ratio */
10060 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10063 23071, /* A1 = -1.408203 */
10064 -32489, /* A2 = 0.991516 */
10065 -293, /* B2 = -0.008965 */
10066 0, /* B1 = 0.000000 */
10067 293, /* B0 = 0.008965 */
10068 22951, /* A1 = -1.400818 */
10069 -32655, /* A2 = 0.996582 */
10070 5689, /* B2 = 0.173645 */
10071 -3951, /* B1 = -0.241150 */
10072 5689, /* B0 = 0.173645 */
10073 23307, /* A1 = -1.422607 */
10074 -32657, /* A2 = 0.996613 */
10075 18692, /* B2 = 0.570435 */
10076 -13447, /* B1 = -0.820770 */
10077 18692, /* B0 = 0.570435 */
10078 5, /* Internal filter scaling */
10079 159, /* Minimum in-band energy threshold */
10080 21, /* 21/32 in-band to broad-band ratio */
10081 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10084 22701, /* A1 = -1.385620 */
10085 -32474, /* A2 = 0.991058 */
10086 -292, /* B2 = -0.008933 */
10087 0, /*163840 , B1 = 10.000000 */
10088 292, /* B0 = 0.008933 */
10089 22564, /* A1 = -1.377258 */
10090 -32655, /* A2 = 0.996552 */
10091 20756, /* B2 = 0.633423 */
10092 -14176, /* B1 = -0.865295 */
10093 20756, /* B0 = 0.633423 */
10094 22960, /* A1 = -1.401428 */
10095 -32657, /* A2 = 0.996613 */
10096 6520, /* B2 = 0.198990 */
10097 -4619, /* B1 = -0.281937 */
10098 6520, /* B0 = 0.198990 */
10099 5, /* Internal filter scaling */
10100 159, /* Minimum in-band energy threshold */
10101 21, /* 21/32 in-band to broad-band ratio */
10102 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10105 22142, /* A1 = -1.351501 */
10106 -32474, /* A2 = 0.991058 */
10107 -147, /* B2 = -0.004493 */
10108 0, /* B1 = 0.000000 */
10109 147, /* B0 = 0.004493 */
10110 22000, /* A1 = -1.342834 */
10111 -32655, /* A2 = 0.996552 */
10112 15379, /* B2 = 0.469360 */
10113 -10237, /* B1 = -0.624847 */
10114 15379, /* B0 = 0.469360 */
10115 22406, /* A1 = -1.367554 */
10116 -32657, /* A2 = 0.996613 */
10117 17491, /* B2 = 0.533783 */
10118 -12096, /* B1 = -0.738312 */
10119 17491, /* B0 = 0.533783 */
10120 5, /* Internal filter scaling */
10121 159, /* Minimum in-band energy threshold */
10122 21, /* 21/32 in-band to broad-band ratio */
10123 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10125 { /* f1100_1750[] */
10126 12973, /* A1 = 0.79184 */
10127 -24916, /* A2 = -0.760376 */
10128 6655, /* B2 = 0.203102 */
10129 367, /* B1 = 0.0224 */
10130 6657, /* B0 = 0.203171 */
10131 5915, /* A1 = 0.361053 */
10132 -29560, /* A2 = -0.90213 */
10133 -7777, /* B2 = -0.23735 */
10135 7777, /* B0 = 0.23735 */
10136 20510, /* A1 = 1.251892 */
10137 -30260, /* A2 = -0.923462 */
10138 26662, /* B2 = 0.81366 */
10139 -20573, /* B1 = -1.255737 */
10140 26668, /* B0 = 0.813843 */
10141 7, /* Internal filter scaling */
10142 159, /* Minimum in-band energy threshold */
10143 21, /* 21/32 in-band to broad-band ratio */
10144 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10147 20392, /* A1 = -1.244629 */
10148 -32460, /* A2 = 0.990601 */
10149 -270, /* B2 = -0.008240 */
10150 0, /* B1 = 0.000000 */
10151 270, /* B0 = 0.008240 */
10152 20218, /* A1 = -1.234009 */
10153 -32655, /* A2 = 0.996582 */
10154 21337, /* B2 = 0.651154 */
10155 -13044, /* B1 = -0.796143 */
10156 21337, /* B0 = 0.651154 */
10157 20684, /* A1 = -1.262512 */
10158 -32657, /* A2 = 0.996643 */
10159 8572, /* B2 = 0.261612 */
10160 -5476, /* B1 = -0.334244 */
10161 8572, /* B0 = 0.261612 */
10162 5, /* Internal filter scaling */
10163 159, /* Minimum in-band energy threshold */
10164 21, /* 21/32 in-band to broad-band ratio */
10165 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10168 19159, /* A1 = -1.169373 */
10169 -32456, /* A2 = 0.990509 */
10170 -335, /* B2 = -0.010252 */
10171 0, /* B1 = 0.000000 */
10172 335, /* B0 = 0.010252 */
10173 18966, /* A1 = -1.157593 */
10174 -32661, /* A2 = 0.996735 */
10175 6802, /* B2 = 0.207588 */
10176 -3900, /* B1 = -0.238098 */
10177 6802, /* B0 = 0.207588 */
10178 19467, /* A1 = -1.188232 */
10179 -32661, /* A2 = 0.996765 */
10180 25035, /* B2 = 0.764008 */
10181 -15049, /* B1 = -0.918579 */
10182 25035, /* B0 = 0.764008 */
10183 5, /* Internal filter scaling */
10184 159, /* Minimum in-band energy threshold */
10185 21, /* 21/32 in-band to broad-band ratio */
10186 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10189 18976, /* A1 = -1.158264 */
10190 -32439, /* A2 = 0.989990 */
10191 -183, /* B2 = -0.005588 */
10192 0, /* B1 = 0.000000 */
10193 183, /* B0 = 0.005588 */
10194 18774, /* A1 = -1.145874 */
10195 -32650, /* A2 = 0.996429 */
10196 15468, /* B2 = 0.472076 */
10197 -8768, /* B1 = -0.535217 */
10198 15468, /* B0 = 0.472076 */
10199 19300, /* A1 = -1.177979 */
10200 -32652, /* A2 = 0.996490 */
10201 19840, /* B2 = 0.605499 */
10202 -11842, /* B1 = -0.722809 */
10203 19840, /* B0 = 0.605499 */
10204 5, /* Internal filter scaling */
10205 159, /* Minimum in-band energy threshold */
10206 21, /* 21/32 in-band to broad-band ratio */
10207 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10210 16357, /* A1 = -0.998413 */
10211 -32368, /* A2 = 0.987793 */
10212 -217, /* B2 = -0.006652 */
10213 0, /* B1 = 0.000000 */
10214 217, /* B0 = 0.006652 */
10215 16107, /* A1 = -0.983126 */
10216 -32601, /* A2 = 0.994904 */
10217 11602, /* B2 = 0.354065 */
10218 -5555, /* B1 = -0.339111 */
10219 11602, /* B0 = 0.354065 */
10220 16722, /* A1 = -1.020630 */
10221 -32603, /* A2 = 0.994965 */
10222 15574, /* B2 = 0.475311 */
10223 -8176, /* B1 = -0.499069 */
10224 15574, /* B0 = 0.475311 */
10225 5, /* Internal filter scaling */
10226 159, /* Minimum in-band energy threshold */
10227 21, /* 21/32 in-band to broad-band ratio */
10228 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10231 16234, /* A1 = -0.990875 */
10232 32404, /* A2 = -0.988922 */
10233 -193, /* B2 = -0.005908 */
10234 0, /* B1 = 0.000000 */
10235 193, /* B0 = 0.005908 */
10236 15986, /* A1 = -0.975769 */
10237 -32632, /* A2 = 0.995880 */
10238 18051, /* B2 = 0.550903 */
10239 -8658, /* B1 = -0.528473 */
10240 18051, /* B0 = 0.550903 */
10241 16591, /* A1 = -1.012695 */
10242 -32634, /* A2 = 0.995941 */
10243 15736, /* B2 = 0.480240 */
10244 -8125, /* B1 = -0.495926 */
10245 15736, /* B0 = 0.480240 */
10246 5, /* Internal filter scaling */
10247 159, /* Minimum in-band energy threshold */
10248 21, /* 21/32 in-band to broad-band ratio */
10249 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10252 15564, /* A1 = -0.949982 */
10253 -32404, /* A2 = 0.988922 */
10254 -269, /* B2 = -0.008216 */
10255 0, /* B1 = 0.000000 */
10256 269, /* B0 = 0.008216 */
10257 15310, /* A1 = -0.934479 */
10258 -32632, /* A2 = 0.995880 */
10259 10815, /* B2 = 0.330063 */
10260 -4962, /* B1 = -0.302887 */
10261 10815, /* B0 = 0.330063 */
10262 15924, /* A1 = -0.971924 */
10263 -32634, /* A2 = 0.995941 */
10264 18880, /* B2 = 0.576172 */
10265 -9364, /* B1 = -0.571594 */
10266 18880, /* B0 = 0.576172 */
10267 5, /* Internal filter scaling */
10268 159, /* Minimum in-band energy threshold */
10269 21, /* 21/32 in-band to broad-band ratio */
10270 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10273 15247, /* A1 = -0.930603 */
10274 -32397, /* A2 = 0.988708 */
10275 -244, /* B2 = -0.007451 */
10276 0, /* B1 = 0.000000 */
10277 244, /* B0 = 0.007451 */
10278 14989, /* A1 = -0.914886 */
10279 -32627, /* A2 = 0.995697 */
10280 18961, /* B2 = 0.578644 */
10281 -8498, /* B1 = -0.518707 */
10282 18961, /* B0 = 0.578644 */
10283 15608, /* A1 = -0.952667 */
10284 -32628, /* A2 = 0.995758 */
10285 11145, /* B2 = 0.340134 */
10286 -5430, /* B1 = -0.331467 */
10287 11145, /* B0 = 0.340134 */
10288 5, /* Internal filter scaling */
10289 159, /* Minimum in-band energy threshold */
10290 21, /* 21/32 in-band to broad-band ratio */
10291 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10294 14780, /* A1 = -0.902130 */
10295 -32393, /* A2 = 0.988586 */
10296 -396, /* B2 = -0.012086 */
10297 0, /* B1 = 0.000000 */
10298 396, /* B0 = 0.012086 */
10299 14510, /* A1 = -0.885651 */
10300 -32630, /* A2 = 0.995819 */
10301 6326, /* B2 = 0.193069 */
10302 -2747, /* B1 = -0.167671 */
10303 6326, /* B0 = 0.193069 */
10304 15154, /* A1 = -0.924957 */
10305 -32632, /* A2 = 0.995850 */
10306 23235, /* B2 = 0.709076 */
10307 -10983, /* B1 = -0.670380 */
10308 23235, /* B0 = 0.709076 */
10309 5, /* Internal filter scaling */
10310 159, /* Minimum in-band energy threshold */
10311 21, /* 21/32 in-band to broad-band ratio */
10312 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10315 13005, /* A1 = -0.793793 */
10316 -32368, /* A2 = 0.987823 */
10317 -500, /* B2 = -0.015265 */
10318 0, /* B1 = 0.000000 */
10319 500, /* B0 = 0.015265 */
10320 12708, /* A1 = -0.775665 */
10321 -32615, /* A2 = 0.995331 */
10322 11420, /* B2 = 0.348526 */
10323 -4306, /* B1 = -0.262833 */
10324 11420, /* B0 = 0.348526 */
10325 13397, /* A1 = -0.817688 */
10326 -32615, /* A2 = 0.995361 */
10327 9454, /* B2 = 0.288528 */
10328 -3981, /* B1 = -0.243027 */
10329 9454, /* B0 = 0.288528 */
10330 5, /* Internal filter scaling */
10331 159, /* Minimum in-band energy threshold */
10332 21, /* 21/32 in-band to broad-band ratio */
10333 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10336 10046, /* A1 = -0.613190 */
10337 -32331, /* A2 = 0.986694 */
10338 -455, /* B2 = -0.013915 */
10339 0, /* B1 = 0.000000 */
10340 455, /* B0 = 0.013915 */
10341 9694, /* A1 = -0.591705 */
10342 -32601, /* A2 = 0.994934 */
10343 6023, /* B2 = 0.183815 */
10344 -1708, /* B1 = -0.104279 */
10345 6023, /* B0 = 0.183815 */
10346 10478, /* A1 = -0.639587 */
10347 -32603, /* A2 = 0.994965 */
10348 22031, /* B2 = 0.672333 */
10349 -7342, /* B1 = -0.448151 */
10350 22031, /* B0 = 0.672333 */
10351 5, /* Internal filter scaling */
10352 159, /* Minimum in-band energy threshold */
10353 21, /* 21/32 in-band to broad-band ratio */
10354 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10356 { /* f1633_1638[] */
10357 9181, /* A1 = 0.560394 */
10358 -32256, /* A2 = -0.984375 */
10359 -556, /* B2 = -0.016975 */
10361 556, /* B0 = 0.016975 */
10362 8757, /* A1 = 0.534515 */
10363 -32574, /* A2 = -0.99408 */
10364 8443, /* B2 = 0.25769 */
10365 -2135, /* B1 = -0.130341 */
10366 8443, /* B0 = 0.25769 */
10367 9691, /* A1 = 0.591522 */
10368 -32574, /* A2 = -0.99411 */
10369 15446, /* B2 = 0.471375 */
10370 -4809, /* B1 = -0.293579 */
10371 15446, /* B0 = 0.471375 */
10372 7, /* Internal filter scaling */
10373 159, /* Minimum in-band energy threshold */
10374 21, /* 21/32 in-band to broad-band ratio */
10375 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10378 5076, /* A1 = -0.309875 */
10379 -32304, /* A2 = 0.985840 */
10380 -508, /* B2 = -0.015503 */
10381 0, /* B1 = 0.000000 */
10382 508, /* B0 = 0.015503 */
10383 4646, /* A1 = -0.283600 */
10384 -32605, /* A2 = 0.995026 */
10385 6742, /* B2 = 0.205780 */
10386 -878, /* B1 = -0.053635 */
10387 6742, /* B0 = 0.205780 */
10388 5552, /* A1 = -0.338928 */
10389 -32605, /* A2 = 0.995056 */
10390 23667, /* B2 = 0.722260 */
10391 -4297, /* B1 = -0.262329 */
10392 23667, /* B0 = 0.722260 */
10393 5, /* Internal filter scaling */
10394 159, /* Minimum in-band energy threshold */
10395 21, /* 21/32 in-band to broad-band ratio */
10396 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10399 3569, /* A1 = -0.217865 */
10400 -32292, /* A2 = 0.985504 */
10401 -239, /* B2 = -0.007322 */
10402 0, /* B1 = 0.000000 */
10403 239, /* B0 = 0.007322 */
10404 3117, /* A1 = -0.190277 */
10405 -32603, /* A2 = 0.994965 */
10406 18658, /* B2 = 0.569427 */
10407 -1557, /* B1 = -0.095032 */
10408 18658, /* B0 = 0.569427 */
10409 4054, /* A1 = -0.247437 */
10410 -32603, /* A2 = 0.994965 */
10411 18886, /* B2 = 0.576385 */
10412 -2566, /* B1 = -0.156647 */
10413 18886, /* B0 = 0.576385 */
10414 5, /* Internal filter scaling */
10415 159, /* Minimum in-band energy threshold */
10416 21, /* 21/32 in-band to broad-band ratio */
10417 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10420 static int ixj_init_filter(IXJ
*j
, IXJ_FILTER
* jf
)
10422 unsigned short cmd
;
10425 if (jf
->filter
> 3) {
10428 if (ixj_WriteDSPCommand(0x5154 + jf
->filter
, j
)) /* Select Filter */
10432 if (ixj_WriteDSPCommand(0x5152, j
)) /* Disable Filter */
10438 if (ixj_WriteDSPCommand(0x5153, j
)) /* Enable Filter */
10441 /* Select the filter (f0 - f3) to use. */
10442 if (ixj_WriteDSPCommand(0x5154 + jf
->filter
, j
))
10445 if (jf
->freq
< 12 && jf
->freq
> 3) {
10446 /* Select the frequency for the selected filter. */
10447 if (ixj_WriteDSPCommand(0x5170 + jf
->freq
, j
))
10449 } else if (jf
->freq
> 11) {
10450 /* We need to load a programmable filter set for undefined */
10451 /* frequencies. So we will point the filter to a programmable set. */
10452 /* Since there are only 4 filters and 4 programmable sets, we will */
10453 /* just point the filter to the same number set and program it for the */
10454 /* frequency we want. */
10455 if (ixj_WriteDSPCommand(0x5170 + jf
->filter
, j
))
10457 if (j
->ver
.low
!= 0x12) {
10464 if (ixj_WriteDSPCommand(cmd
, j
))
10466 for (cnt
= 0; cnt
< max
; cnt
++) {
10467 if (ixj_WriteDSPCommand(tone_table
[jf
->freq
- 12][cnt
], j
))
10471 j
->filter_en
[jf
->filter
] = jf
->enable
;
10475 static int ixj_init_filter_raw(IXJ
*j
, IXJ_FILTER_RAW
* jfr
)
10477 unsigned short cmd
;
10479 if (jfr
->filter
> 3) {
10482 if (ixj_WriteDSPCommand(0x5154 + jfr
->filter
, j
)) /* Select Filter */
10485 if (!jfr
->enable
) {
10486 if (ixj_WriteDSPCommand(0x5152, j
)) /* Disable Filter */
10491 if (ixj_WriteDSPCommand(0x5153, j
)) /* Enable Filter */
10493 /* Select the filter (f0 - f3) to use. */
10494 if (ixj_WriteDSPCommand(0x5154 + jfr
->filter
, j
))
10497 /* We need to load a programmable filter set for undefined */
10498 /* frequencies. So we will point the filter to a programmable set. */
10499 /* Since there are only 4 filters and 4 programmable sets, we will */
10500 /* just point the filter to the same number set and program it for the */
10501 /* frequency we want. */
10502 if (ixj_WriteDSPCommand(0x5170 + jfr
->filter
, j
))
10504 if (j
->ver
.low
!= 0x12) {
10511 if (ixj_WriteDSPCommand(cmd
, j
))
10513 for (cnt
= 0; cnt
< max
; cnt
++) {
10514 if (ixj_WriteDSPCommand(jfr
->coeff
[cnt
], j
))
10517 j
->filter_en
[jfr
->filter
] = jfr
->enable
;
10521 static int ixj_init_tone(IXJ
*j
, IXJ_TONE
* ti
)
10524 unsigned short data
;
10537 if(ti
->tone_index
> 12 && ti
->tone_index
< 28)
10539 if (ixj_WriteDSPCommand(0x6800 + ti
->tone_index
, j
))
10541 if (ixj_WriteDSPCommand(0x6000 + (ti
->gain1
<< 4) + ti
->gain0
, j
))
10544 if (ixj_WriteDSPCommand(data
, j
))
10547 if (ixj_WriteDSPCommand(data
, j
))