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 ***************************************************************************/
44 static char ixj_c_rcsid
[] = "$Id: ixj.c,v 4.7 2001/08/13 06:19:33 craigs Exp $";
45 static char ixj_c_revision
[] = "$Revision: 4.7 $";
50 * Revision 4.8 2003/07/09 19:39:00 Daniele Bellucci
51 * Audit some copy_*_user and minor cleanup.
53 * Revision 4.7 2001/08/13 06:19:33 craigs
54 * Added additional changes from Alan Cox and John Anderson for
55 * 2.2 to 2.4 cleanup and bounds checking
57 * Revision 4.6 2001/08/13 01:05:05 craigs
58 * Really fixed PHONE_QUERY_CODEC problem this time
60 * Revision 4.5 2001/08/13 00:11:03 craigs
61 * Fixed problem in handling of PHONE_QUERY_CODEC, thanks to Shane Anderson
63 * Revision 4.4 2001/08/07 07:58:12 craigs
64 * Changed back to three digit version numbers
65 * Added tagbuild target to allow automatic and easy tagging of versions
67 * Revision 4.3 2001/08/07 07:24:47 craigs
68 * Added ixj-ver.h to allow easy configuration management of driver
69 * Added display of version number in /prox/ixj
71 * Revision 4.2 2001/08/06 07:07:19 craigs
72 * Reverted IXJCTL_DSP_TYPE and IXJCTL_DSP_VERSION files to original
73 * behaviour of returning int rather than short *
75 * Revision 4.1 2001/08/05 00:17:37 craigs
76 * More changes for correct PCMCIA installation
77 * Start of changes for backward Linux compatibility
79 * Revision 4.0 2001/08/04 12:33:12 craigs
80 * New version using GNU autoconf
82 * Revision 3.105 2001/07/20 23:14:32 eokerson
83 * More work on CallerID generation when using ring cadences.
85 * Revision 3.104 2001/07/06 01:33:55 eokerson
86 * Some bugfixes from Robert Vojta <vojta@ipex.cz> and a few mods to the Makefile.
88 * Revision 3.103 2001/07/05 19:20:16 eokerson
90 * Changed mic gain to 30dB on Internet LineJACK mic/speaker port.
92 * Revision 3.102 2001/07/03 23:51:21 eokerson
93 * Un-mute mic on Internet LineJACK when in speakerphone mode.
95 * Revision 3.101 2001/07/02 19:26:56 eokerson
96 * Removed initialiazation of ixjdebug and ixj_convert_loaded so they will go in the .bss instead of the .data
98 * Revision 3.100 2001/07/02 19:18:27 eokerson
99 * Changed driver to make dynamic allocation possible. We now pass IXJ * between functions instead of array indexes.
100 * Fixed the way the POTS and PSTN ports interact during a PSTN call to allow local answering.
101 * Fixed speaker mode on Internet LineJACK.
103 * Revision 3.99 2001/05/09 14:11:16 eokerson
104 * Fixed kmalloc error in ixj_build_filter_cadence. Thanks David Chan <cat@waulogy.stanford.edu>.
106 * Revision 3.98 2001/05/08 19:55:33 eokerson
107 * Fixed POTS hookstate detection while it is connected to PSTN port.
109 * Revision 3.97 2001/05/08 00:01:04 eokerson
110 * Fixed kernel oops when sending caller ID data.
112 * Revision 3.96 2001/05/04 23:09:30 eokerson
113 * Now uses one kernel timer for each card, instead of one for the entire driver.
115 * Revision 3.95 2001/04/25 22:06:47 eokerson
116 * Fixed squawking at beginning of some G.723.1 calls.
118 * Revision 3.94 2001/04/03 23:42:00 eokerson
119 * Added linear volume ioctls
120 * Added raw filter load ioctl
122 * Revision 3.93 2001/02/27 01:00:06 eokerson
123 * Fixed blocking in CallerID.
124 * Reduced size of ixj structure for smaller driver footprint.
126 * Revision 3.92 2001/02/20 22:02:59 eokerson
127 * Fixed isapnp and pcmcia module compatibility for 2.4.x kernels.
128 * Improved PSTN ring detection.
129 * Fixed wink generation on POTS ports.
131 * Revision 3.91 2001/02/13 00:55:44 eokerson
132 * Turn AEC back on after changing frame sizes.
134 * Revision 3.90 2001/02/12 16:42:00 eokerson
135 * Added ALAW codec, thanks to Fabio Ferrari for the table based converters to make ALAW from ULAW.
137 * Revision 3.89 2001/02/12 15:41:16 eokerson
138 * Fix from Artis Kugevics - Tone gains were not being set correctly.
140 * Revision 3.88 2001/02/05 23:25:42 eokerson
141 * Fixed lockup bugs with deregister.
143 * Revision 3.87 2001/01/29 21:00:39 eokerson
144 * Fix from Fabio Ferrari <fabio.ferrari@digitro.com.br> to properly handle EAGAIN and EINTR during non-blocking write.
145 * Updated copyright date.
147 * Revision 3.86 2001/01/23 23:53:46 eokerson
148 * Fixes to G.729 compatibility.
150 * Revision 3.85 2001/01/23 21:30:36 eokerson
151 * Added verbage about cards supported.
152 * Removed commands that put the card in low power mode at some times that it should not be in low power mode.
154 * Revision 3.84 2001/01/22 23:32:10 eokerson
155 * Some bugfixes from David Huggins-Daines, <dhd@cepstral.com> and other cleanups.
157 * Revision 3.83 2001/01/19 14:51:41 eokerson
158 * Fixed ixj_WriteDSPCommand to decrement usage counter when command fails.
160 * Revision 3.82 2001/01/19 00:34:49 eokerson
161 * Added verbosity to write overlap errors.
163 * Revision 3.81 2001/01/18 23:56:54 eokerson
164 * Fixed PSTN line test functions.
166 * Revision 3.80 2001/01/18 22:29:27 eokerson
167 * Updated AEC/AGC values for different cards.
169 * Revision 3.79 2001/01/17 02:58:54 eokerson
170 * Fixed AEC reset after Caller ID.
171 * Fixed Codec lockup after Caller ID on Call Waiting when not using 30ms frames.
173 * Revision 3.78 2001/01/16 19:43:09 eokerson
174 * Added support for Linux 2.4.x kernels.
176 * Revision 3.77 2001/01/09 04:00:52 eokerson
177 * Linetest will now test the line, even if it has previously succeded.
179 * Revision 3.76 2001/01/08 19:27:00 eokerson
180 * Fixed problem with standard cable on Internet PhoneCARD.
182 * Revision 3.75 2000/12/22 16:52:14 eokerson
183 * Modified to allow hookstate detection on the POTS port when the PSTN port is selected.
185 * Revision 3.74 2000/12/08 22:41:50 eokerson
186 * Added capability for G729B.
188 * Revision 3.73 2000/12/07 23:35:16 eokerson
189 * Added capability to have different ring pattern before CallerID data.
190 * Added hookstate checks in CallerID routines to stop FSK.
192 * Revision 3.72 2000/12/06 19:31:31 eokerson
193 * Modified signal behavior to only send one signal per event.
195 * Revision 3.71 2000/12/06 03:23:08 eokerson
196 * Fixed CallerID on Call Waiting.
198 * Revision 3.70 2000/12/04 21:29:37 eokerson
199 * Added checking to Smart Cable gain functions.
201 * Revision 3.69 2000/12/04 21:05:20 eokerson
202 * Changed ixjdebug levels.
203 * Added ioctls to change gains in Internet Phone CARD Smart Cable.
205 * Revision 3.68 2000/12/04 00:17:21 craigs
206 * Changed mixer voice gain to +6dB rather than 0dB
208 * Revision 3.67 2000/11/30 21:25:51 eokerson
209 * Fixed write signal errors.
211 * Revision 3.66 2000/11/29 22:42:44 eokerson
212 * Fixed PSTN ring detect problems.
214 * Revision 3.65 2000/11/29 07:31:55 craigs
215 * Added new 425Hz filter co-efficients
216 * Added card-specific DTMF prescaler initialisation
218 * Revision 3.64 2000/11/28 14:03:32 craigs
219 * Changed certain mixer initialisations to be 0dB rather than 12dB
220 * Added additional information to /proc/ixj
222 * Revision 3.63 2000/11/28 11:38:41 craigs
223 * Added display of AEC modes in AUTO and AGC mode
225 * Revision 3.62 2000/11/28 04:05:44 eokerson
226 * Improved PSTN ring detection routine.
228 * Revision 3.61 2000/11/27 21:53:12 eokerson
229 * Fixed flash detection.
231 * Revision 3.60 2000/11/27 15:57:29 eokerson
232 * More work on G.729 load routines.
234 * Revision 3.59 2000/11/25 21:55:12 eokerson
235 * Fixed errors in G.729 load routine.
237 * Revision 3.58 2000/11/25 04:08:29 eokerson
238 * Added board locks around G.729 and TS85 load routines.
240 * Revision 3.57 2000/11/24 05:35:17 craigs
241 * Added ability to retrieve mixer values on LineJACK
242 * Added complete initialisation of all mixer values at startup
243 * Fixed spelling mistake
245 * Revision 3.56 2000/11/23 02:52:11 robertj
246 * Added cvs change log keyword.
247 * Fixed bug in capabilities list when using G.729 module.
253 #define PERFMON_STATS
257 #include <linux/module.h>
259 #include <linux/init.h>
260 #include <linux/sched.h>
261 #include <linux/kernel.h> /* printk() */
262 #include <linux/fs.h> /* everything... */
263 #include <linux/errno.h> /* error codes */
264 #include <linux/slab.h>
265 #include <linux/mm.h>
266 #include <linux/ioport.h>
267 #include <linux/interrupt.h>
268 #include <linux/proc_fs.h>
269 #include <linux/poll.h>
270 #include <linux/timer.h>
271 #include <linux/delay.h>
272 #include <linux/pci.h>
275 #include <asm/uaccess.h>
277 #include <linux/isapnp.h>
281 #define TYPE(inode) (iminor(inode) >> 4)
282 #define NUM(inode) (iminor(inode) & 0xf)
285 static int hertz
= HZ
;
286 static int samplerate
= 100;
288 MODULE_PARM(ixjdebug
, "i");
290 /************************************************************************
292 * ixjdebug meanings are now bit mapped instead of level based
293 * Values can be or'ed together to turn on multiple messages
295 * bit 0 (0x0001) = any failure
296 * bit 1 (0x0002) = general messages
297 * bit 2 (0x0004) = POTS ringing related
298 * bit 3 (0x0008) = PSTN events
299 * bit 4 (0x0010) = PSTN Cadence state details
300 * bit 5 (0x0020) = Tone detection triggers
301 * bit 6 (0x0040) = Tone detection cadence details
302 * bit 7 (0x0080) = ioctl tracking
303 * bit 8 (0x0100) = signal tracking
304 * bit 9 (0x0200) = CallerID generation details
306 ************************************************************************/
310 static IXJ
*ixj
[IXJMAX
];
311 #define get_ixj(b) ixj[(b)]
314 * Allocate a free IXJ device
317 static IXJ
*ixj_alloc()
319 for(cnt
=0; cnt
<IXJMAX
; cnt
++)
321 if(ixj
[cnt
] == NULL
|| !ixj
[cnt
]->DSPbase
)
323 j
= kmalloc(sizeof(IXJ
), GFP_KERNEL
);
333 static void ixj_fsk_free(IXJ
*j
)
335 if(j
->fskdata
!= NULL
) {
341 static void ixj_fsk_alloc(IXJ
*j
)
344 j
->fskdata
= kmalloc(8000, GFP_KERNEL
);
346 if(ixjdebug
& 0x0200) {
347 printk("IXJ phone%d - allocate failed\n", j
->board
);
352 if(ixjdebug
& 0x0200) {
353 printk("IXJ phone%d - allocate succeded\n", j
->board
);
361 static IXJ ixj
[IXJMAX
];
362 #define get_ixj(b) (&ixj[(b)])
365 * Allocate a free IXJ device
368 static IXJ
*ixj_alloc(void)
371 for(cnt
=0; cnt
<IXJMAX
; cnt
++) {
372 if(!ixj
[cnt
].DSPbase
)
378 static inline void ixj_fsk_free(IXJ
*j
) {;}
380 static inline void ixj_fsk_alloc(IXJ
*j
)
388 #define ixj_perfmon(x) ((x)++)
390 #define ixj_perfmon(x) do { } while(0)
393 static int ixj_convert_loaded
;
395 static int ixj_WriteDSPCommand(unsigned short, IXJ
*j
);
397 /************************************************************************
399 * These are function definitions to allow external modules to register
400 * enhanced functionality call backs.
402 ************************************************************************/
404 static int Stub(IXJ
* J
, unsigned long arg
)
409 static IXJ_REGFUNC ixj_DownloadG729
= &Stub
;
410 static IXJ_REGFUNC ixj_DownloadTS85
= &Stub
;
411 static IXJ_REGFUNC ixj_PreRead
= &Stub
;
412 static IXJ_REGFUNC ixj_PostRead
= &Stub
;
413 static IXJ_REGFUNC ixj_PreWrite
= &Stub
;
414 static IXJ_REGFUNC ixj_PostWrite
= &Stub
;
415 static IXJ_REGFUNC ixj_PreIoctl
= &Stub
;
416 static IXJ_REGFUNC ixj_PostIoctl
= &Stub
;
418 static void ixj_read_frame(IXJ
*j
);
419 static void ixj_write_frame(IXJ
*j
);
420 static void ixj_init_timer(IXJ
*j
);
421 static void ixj_add_timer(IXJ
* j
);
422 static void ixj_timeout(unsigned long ptr
);
423 static int read_filters(IXJ
*j
);
424 static int LineMonitor(IXJ
*j
);
425 static int ixj_fasync(int fd
, struct file
*, int mode
);
426 static int ixj_set_port(IXJ
*j
, int arg
);
427 static int ixj_set_pots(IXJ
*j
, int arg
);
428 static int ixj_hookstate(IXJ
*j
);
429 static int ixj_record_start(IXJ
*j
);
430 static void ixj_record_stop(IXJ
*j
);
431 static void set_rec_volume(IXJ
*j
, int volume
);
432 static int get_rec_volume(IXJ
*j
);
433 static int set_rec_codec(IXJ
*j
, int rate
);
434 static void ixj_vad(IXJ
*j
, int arg
);
435 static int ixj_play_start(IXJ
*j
);
436 static void ixj_play_stop(IXJ
*j
);
437 static int ixj_set_tone_on(unsigned short arg
, IXJ
*j
);
438 static int ixj_set_tone_off(unsigned short, IXJ
*j
);
439 static int ixj_play_tone(IXJ
*j
, char tone
);
440 static void ixj_aec_start(IXJ
*j
, int level
);
441 static int idle(IXJ
*j
);
442 static void ixj_ring_on(IXJ
*j
);
443 static void ixj_ring_off(IXJ
*j
);
444 static void aec_stop(IXJ
*j
);
445 static void ixj_ringback(IXJ
*j
);
446 static void ixj_busytone(IXJ
*j
);
447 static void ixj_dialtone(IXJ
*j
);
448 static void ixj_cpt_stop(IXJ
*j
);
449 static char daa_int_read(IXJ
*j
);
450 static char daa_CR_read(IXJ
*j
, int cr
);
451 static int daa_set_mode(IXJ
*j
, int mode
);
452 static int ixj_linetest(IXJ
*j
);
453 static int ixj_daa_write(IXJ
*j
);
454 static int ixj_daa_cid_read(IXJ
*j
);
455 static void DAA_Coeff_US(IXJ
*j
);
456 static void DAA_Coeff_UK(IXJ
*j
);
457 static void DAA_Coeff_France(IXJ
*j
);
458 static void DAA_Coeff_Germany(IXJ
*j
);
459 static void DAA_Coeff_Australia(IXJ
*j
);
460 static void DAA_Coeff_Japan(IXJ
*j
);
461 static int ixj_init_filter(IXJ
*j
, IXJ_FILTER
* jf
);
462 static int ixj_init_filter_raw(IXJ
*j
, IXJ_FILTER_RAW
* jfr
);
463 static int ixj_init_tone(IXJ
*j
, IXJ_TONE
* ti
);
464 static int ixj_build_cadence(IXJ
*j
, IXJ_CADENCE __user
* cp
);
465 static int ixj_build_filter_cadence(IXJ
*j
, IXJ_FILTER_CADENCE __user
* cp
);
466 /* Serial Control Interface funtions */
467 static int SCI_Control(IXJ
*j
, int control
);
468 static int SCI_Prepare(IXJ
*j
);
469 static int SCI_WaitHighSCI(IXJ
*j
);
470 static int SCI_WaitLowSCI(IXJ
*j
);
471 static DWORD
PCIEE_GetSerialNumber(WORD wAddress
);
472 static int ixj_PCcontrol_wait(IXJ
*j
);
473 static void ixj_pre_cid(IXJ
*j
);
474 static void ixj_write_cid(IXJ
*j
);
475 static void ixj_write_cid_bit(IXJ
*j
, int bit
);
476 static int set_base_frame(IXJ
*j
, int size
);
477 static int set_play_codec(IXJ
*j
, int rate
);
478 static void set_rec_depth(IXJ
*j
, int depth
);
479 static int ixj_mixer(long val
, IXJ
*j
);
481 /************************************************************************
482 CT8020/CT8021 Host Programmers Model
483 Host address Function Access
485 0-1 Aux Software Status Register (reserved) Read Only
486 2-3 Software Status Register Read Only
487 4-5 Aux Software Control Register (reserved) Read Write
488 6-7 Software Control Register Read Write
489 8-9 Hardware Status Register Read Only
490 A-B Hardware Control Register Read Write
491 C-D Host Transmit (Write) Data Buffer Access Port (buffer input)Write Only
492 E-F Host Recieve (Read) Data Buffer Access Port (buffer input) Read Only
493 ************************************************************************/
495 static inline void ixj_read_HSR(IXJ
*j
)
497 j
->hsr
.bytes
.low
= inb_p(j
->DSPbase
+ 8);
498 j
->hsr
.bytes
.high
= inb_p(j
->DSPbase
+ 9);
501 static inline int IsControlReady(IXJ
*j
)
504 return j
->hsr
.bits
.controlrdy
? 1 : 0;
507 static inline int IsPCControlReady(IXJ
*j
)
509 j
->pccr1
.byte
= inb_p(j
->XILINXbase
+ 3);
510 return j
->pccr1
.bits
.crr
? 1 : 0;
513 static inline int IsStatusReady(IXJ
*j
)
516 return j
->hsr
.bits
.statusrdy
? 1 : 0;
519 static inline int IsRxReady(IXJ
*j
)
522 ixj_perfmon(j
->rxreadycheck
);
523 return j
->hsr
.bits
.rxrdy
? 1 : 0;
526 static inline int IsTxReady(IXJ
*j
)
529 ixj_perfmon(j
->txreadycheck
);
530 return j
->hsr
.bits
.txrdy
? 1 : 0;
533 static inline void set_play_volume(IXJ
*j
, int volume
)
535 if (ixjdebug
& 0x0002)
536 printk(KERN_INFO
"IXJ: /dev/phone%d Setting Play Volume to 0x%4.4x\n", j
->board
, volume
);
537 ixj_WriteDSPCommand(0xCF02, j
);
538 ixj_WriteDSPCommand(volume
, j
);
541 static int set_play_volume_linear(IXJ
*j
, int volume
)
543 int newvolume
, dspplaymax
;
545 if (ixjdebug
& 0x0002)
546 printk(KERN_INFO
"IXJ: /dev/phone %d Setting Linear Play Volume to 0x%4.4x\n", j
->board
, volume
);
547 if(volume
> 100 || volume
< 0) {
551 /* This should normalize the perceived volumes between the different cards caused by differences in the hardware */
552 switch (j
->cardtype
) {
557 if(j
->port
== PORT_PSTN
) {
563 case QTI_PHONEJACK_LITE
:
566 case QTI_PHONEJACK_PCI
:
575 newvolume
= (dspplaymax
* volume
) / 100;
576 set_play_volume(j
, newvolume
);
580 static inline void set_play_depth(IXJ
*j
, int depth
)
586 ixj_WriteDSPCommand(0x5280 + depth
, j
);
589 static inline int get_play_volume(IXJ
*j
)
591 ixj_WriteDSPCommand(0xCF00, j
);
592 return j
->ssr
.high
<< 8 | j
->ssr
.low
;
595 static int get_play_volume_linear(IXJ
*j
)
597 int volume
, newvolume
, dspplaymax
;
599 /* This should normalize the perceived volumes between the different cards caused by differences in the hardware */
600 switch (j
->cardtype
) {
605 if(j
->port
== PORT_PSTN
) {
611 case QTI_PHONEJACK_LITE
:
614 case QTI_PHONEJACK_PCI
:
623 volume
= get_play_volume(j
);
624 newvolume
= (volume
* 100) / dspplaymax
;
630 static inline BYTE
SLIC_GetState(IXJ
*j
)
632 if (j
->cardtype
== QTI_PHONECARD
) {
634 j
->psccr
.bits
.dev
= 3;
635 j
->psccr
.bits
.rw
= 1;
636 outw_p(j
->psccr
.byte
<< 8, j
->XILINXbase
+ 0x00);
637 ixj_PCcontrol_wait(j
);
638 j
->pslic
.byte
= inw_p(j
->XILINXbase
+ 0x00) & 0xFF;
639 ixj_PCcontrol_wait(j
);
640 if (j
->pslic
.bits
.powerdown
)
641 return PLD_SLIC_STATE_OC
;
642 else if (!j
->pslic
.bits
.ring0
&& !j
->pslic
.bits
.ring1
)
643 return PLD_SLIC_STATE_ACTIVE
;
645 return PLD_SLIC_STATE_RINGING
;
647 j
->pld_slicr
.byte
= inb_p(j
->XILINXbase
+ 0x01);
649 return j
->pld_slicr
.bits
.state
;
652 static BOOL
SLIC_SetState(BYTE byState
, IXJ
*j
)
654 BOOL fRetVal
= FALSE
;
656 if (j
->cardtype
== QTI_PHONECARD
) {
657 if (j
->flags
.pcmciasct
) {
659 case PLD_SLIC_STATE_TIPOPEN
:
660 case PLD_SLIC_STATE_OC
:
661 j
->pslic
.bits
.powerdown
= 1;
662 j
->pslic
.bits
.ring0
= j
->pslic
.bits
.ring1
= 0;
665 case PLD_SLIC_STATE_RINGING
:
666 if (j
->readers
|| j
->writers
) {
667 j
->pslic
.bits
.powerdown
= 0;
668 j
->pslic
.bits
.ring0
= 1;
669 j
->pslic
.bits
.ring1
= 0;
673 case PLD_SLIC_STATE_OHT
: /* On-hook transmit */
675 case PLD_SLIC_STATE_STANDBY
:
676 case PLD_SLIC_STATE_ACTIVE
:
677 if (j
->readers
|| j
->writers
) {
678 j
->pslic
.bits
.powerdown
= 0;
680 j
->pslic
.bits
.powerdown
= 1;
682 j
->pslic
.bits
.ring0
= j
->pslic
.bits
.ring1
= 0;
685 case PLD_SLIC_STATE_APR
: /* Active polarity reversal */
687 case PLD_SLIC_STATE_OHTPR
: /* OHT polarity reversal */
693 j
->psccr
.bits
.dev
= 3;
694 j
->psccr
.bits
.rw
= 0;
695 outw_p(j
->psccr
.byte
<< 8 | j
->pslic
.byte
, j
->XILINXbase
+ 0x00);
696 ixj_PCcontrol_wait(j
);
699 /* Set the C1, C2, C3 & B2EN signals. */
701 case PLD_SLIC_STATE_OC
:
702 j
->pld_slicw
.bits
.c1
= 0;
703 j
->pld_slicw
.bits
.c2
= 0;
704 j
->pld_slicw
.bits
.c3
= 0;
705 j
->pld_slicw
.bits
.b2en
= 0;
706 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
709 case PLD_SLIC_STATE_RINGING
:
710 j
->pld_slicw
.bits
.c1
= 1;
711 j
->pld_slicw
.bits
.c2
= 0;
712 j
->pld_slicw
.bits
.c3
= 0;
713 j
->pld_slicw
.bits
.b2en
= 1;
714 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
717 case PLD_SLIC_STATE_ACTIVE
:
718 j
->pld_slicw
.bits
.c1
= 0;
719 j
->pld_slicw
.bits
.c2
= 1;
720 j
->pld_slicw
.bits
.c3
= 0;
721 j
->pld_slicw
.bits
.b2en
= 0;
722 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
725 case PLD_SLIC_STATE_OHT
: /* On-hook transmit */
727 j
->pld_slicw
.bits
.c1
= 1;
728 j
->pld_slicw
.bits
.c2
= 1;
729 j
->pld_slicw
.bits
.c3
= 0;
730 j
->pld_slicw
.bits
.b2en
= 0;
731 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
734 case PLD_SLIC_STATE_TIPOPEN
:
735 j
->pld_slicw
.bits
.c1
= 0;
736 j
->pld_slicw
.bits
.c2
= 0;
737 j
->pld_slicw
.bits
.c3
= 1;
738 j
->pld_slicw
.bits
.b2en
= 0;
739 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
742 case PLD_SLIC_STATE_STANDBY
:
743 j
->pld_slicw
.bits
.c1
= 1;
744 j
->pld_slicw
.bits
.c2
= 0;
745 j
->pld_slicw
.bits
.c3
= 1;
746 j
->pld_slicw
.bits
.b2en
= 1;
747 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
750 case PLD_SLIC_STATE_APR
: /* Active polarity reversal */
752 j
->pld_slicw
.bits
.c1
= 0;
753 j
->pld_slicw
.bits
.c2
= 1;
754 j
->pld_slicw
.bits
.c3
= 1;
755 j
->pld_slicw
.bits
.b2en
= 0;
756 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
759 case PLD_SLIC_STATE_OHTPR
: /* OHT polarity reversal */
761 j
->pld_slicw
.bits
.c1
= 1;
762 j
->pld_slicw
.bits
.c2
= 1;
763 j
->pld_slicw
.bits
.c3
= 1;
764 j
->pld_slicw
.bits
.b2en
= 0;
765 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
777 static int ixj_wink(IXJ
*j
)
781 slicnow
= SLIC_GetState(j
);
783 j
->pots_winkstart
= jiffies
;
784 SLIC_SetState(PLD_SLIC_STATE_OC
, j
);
786 while (time_before(jiffies
, j
->pots_winkstart
+ j
->winktime
)) {
787 set_current_state(TASK_INTERRUPTIBLE
);
791 SLIC_SetState(slicnow
, j
);
795 static int ixj_register(int index
, IXJ_REGFUNC regfunc
)
801 ixj_DownloadG729
= regfunc
;
802 for (cnt
= 0; cnt
< IXJMAX
; cnt
++) {
803 IXJ
*j
= get_ixj(cnt
);
804 while(test_and_set_bit(cnt
, (void *)&j
->busyflags
) != 0) {
805 set_current_state(TASK_INTERRUPTIBLE
);
808 ixj_DownloadG729(j
, 0L);
809 clear_bit(cnt
, &j
->busyflags
);
813 ixj_DownloadTS85
= regfunc
;
814 for (cnt
= 0; cnt
< IXJMAX
; cnt
++) {
815 IXJ
*j
= get_ixj(cnt
);
816 while(test_and_set_bit(cnt
, (void *)&j
->busyflags
) != 0) {
817 set_current_state(TASK_INTERRUPTIBLE
);
820 ixj_DownloadTS85(j
, 0L);
821 clear_bit(cnt
, &j
->busyflags
);
825 ixj_PreRead
= regfunc
;
828 ixj_PostRead
= regfunc
;
831 ixj_PreWrite
= regfunc
;
834 ixj_PostWrite
= regfunc
;
837 ixj_PreIoctl
= regfunc
;
840 ixj_PostIoctl
= regfunc
;
848 EXPORT_SYMBOL(ixj_register
);
850 static int ixj_unregister(int index
)
855 ixj_DownloadG729
= &Stub
;
858 ixj_DownloadTS85
= &Stub
;
864 ixj_PostRead
= &Stub
;
867 ixj_PreWrite
= &Stub
;
870 ixj_PostWrite
= &Stub
;
873 ixj_PreIoctl
= &Stub
;
876 ixj_PostIoctl
= &Stub
;
884 EXPORT_SYMBOL(ixj_unregister
);
886 static void ixj_init_timer(IXJ
*j
)
888 init_timer(&j
->timer
);
889 j
->timer
.function
= ixj_timeout
;
890 j
->timer
.data
= (unsigned long)j
;
893 static void ixj_add_timer(IXJ
*j
)
895 j
->timer
.expires
= jiffies
+ (hertz
/ samplerate
);
896 add_timer(&j
->timer
);
899 static void ixj_tone_timeout(IXJ
*j
)
904 if (j
->tone_state
== 3) {
907 j
->tone_cadence_state
++;
908 if (j
->tone_cadence_state
>= j
->cadence_t
->elements_used
) {
909 switch (j
->cadence_t
->termination
) {
913 case REPEAT_LAST_ELEMENT
:
914 j
->tone_cadence_state
--;
915 ixj_play_tone(j
, j
->cadence_t
->ce
[j
->tone_cadence_state
].index
);
918 j
->tone_cadence_state
= 0;
919 if (j
->cadence_t
->ce
[j
->tone_cadence_state
].freq0
) {
920 ti
.tone_index
= j
->cadence_t
->ce
[j
->tone_cadence_state
].index
;
921 ti
.freq0
= j
->cadence_t
->ce
[j
->tone_cadence_state
].freq0
;
922 ti
.gain0
= j
->cadence_t
->ce
[j
->tone_cadence_state
].gain0
;
923 ti
.freq1
= j
->cadence_t
->ce
[j
->tone_cadence_state
].freq1
;
924 ti
.gain1
= j
->cadence_t
->ce
[j
->tone_cadence_state
].gain1
;
925 ixj_init_tone(j
, &ti
);
927 ixj_set_tone_on(j
->cadence_t
->ce
[0].tone_on_time
, j
);
928 ixj_set_tone_off(j
->cadence_t
->ce
[0].tone_off_time
, j
);
929 ixj_play_tone(j
, j
->cadence_t
->ce
[0].index
);
933 if (j
->cadence_t
->ce
[j
->tone_cadence_state
].gain0
) {
934 ti
.tone_index
= j
->cadence_t
->ce
[j
->tone_cadence_state
].index
;
935 ti
.freq0
= j
->cadence_t
->ce
[j
->tone_cadence_state
].freq0
;
936 ti
.gain0
= j
->cadence_t
->ce
[j
->tone_cadence_state
].gain0
;
937 ti
.freq1
= j
->cadence_t
->ce
[j
->tone_cadence_state
].freq1
;
938 ti
.gain1
= j
->cadence_t
->ce
[j
->tone_cadence_state
].gain1
;
939 ixj_init_tone(j
, &ti
);
941 ixj_set_tone_on(j
->cadence_t
->ce
[j
->tone_cadence_state
].tone_on_time
, j
);
942 ixj_set_tone_off(j
->cadence_t
->ce
[j
->tone_cadence_state
].tone_off_time
, j
);
943 ixj_play_tone(j
, j
->cadence_t
->ce
[j
->tone_cadence_state
].index
);
949 static inline void ixj_kill_fasync(IXJ
*j
, IXJ_SIGEVENT event
, int dir
)
951 if(j
->ixj_signals
[event
]) {
952 if(ixjdebug
& 0x0100)
953 printk("Sending signal for event %d\n", event
);
954 /* Send apps notice of change */
955 /* see config.h for macro definition */
956 kill_fasync(&(j
->async_queue
), j
->ixj_signals
[event
], dir
);
960 static void ixj_pstn_state(IXJ
*j
)
963 union XOPXR0 XR0
, daaint
;
967 XR0
.reg
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.reg
;
969 XR0
.bitreg
.RMR
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.bitreg
.RMR
;
971 j
->pld_scrr
.byte
= inb_p(j
->XILINXbase
);
972 if (j
->pld_scrr
.bits
.daaflag
) {
974 if(j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.RING
) {
975 if(time_after(jiffies
, j
->pstn_sleeptil
) && !(j
->flags
.pots_pstn
&& j
->hookstate
)) {
976 daaint
.bitreg
.RING
= 1;
977 if(ixjdebug
& 0x0008) {
978 printk(KERN_INFO
"IXJ DAA Ring Interrupt /dev/phone%d at %ld\n", j
->board
, jiffies
);
981 daa_set_mode(j
, SOP_PU_RESET
);
984 if(j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.Caller_ID
) {
985 daaint
.bitreg
.Caller_ID
= 1;
986 j
->pstn_cid_intr
= 1;
987 j
->pstn_cid_received
= jiffies
;
988 if(ixjdebug
& 0x0008) {
989 printk(KERN_INFO
"IXJ DAA Caller_ID Interrupt /dev/phone%d at %ld\n", j
->board
, jiffies
);
992 if(j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.Cadence
) {
993 daaint
.bitreg
.Cadence
= 1;
994 if(ixjdebug
& 0x0008) {
995 printk(KERN_INFO
"IXJ DAA Cadence Interrupt /dev/phone%d at %ld\n", j
->board
, jiffies
);
998 if(j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.VDD_OK
!= XR0
.bitreg
.VDD_OK
) {
999 daaint
.bitreg
.VDD_OK
= 1;
1000 daaint
.bitreg
.SI_0
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.VDD_OK
;
1004 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
)) {
1005 daaint
.bitreg
.RMR
= 1;
1006 daaint
.bitreg
.SI_1
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.bitreg
.RMR
;
1007 if(ixjdebug
& 0x0008) {
1008 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
);
1010 j
->pstn_prev_rmr
= j
->pstn_last_rmr
;
1011 j
->pstn_last_rmr
= jiffies
;
1013 switch(j
->daa_mode
) {
1015 if (daaint
.bitreg
.RING
) {
1016 if (!j
->flags
.pstn_ringing
) {
1017 if (j
->daa_mode
!= SOP_PU_RINGING
) {
1018 j
->pstn_ring_int
= jiffies
;
1019 daa_set_mode(j
, SOP_PU_RINGING
);
1024 case SOP_PU_RINGING
:
1025 if (daaint
.bitreg
.RMR
) {
1026 if (ixjdebug
& 0x0008) {
1027 printk(KERN_INFO
"IXJ Ring Cadence a state = %d /dev/phone%d at %ld\n", j
->cadence_f
[4].state
, j
->board
, jiffies
);
1029 if (daaint
.bitreg
.SI_1
) { /* Rising edge of RMR */
1030 j
->flags
.pstn_rmr
= 1;
1031 j
->pstn_ring_start
= jiffies
;
1032 j
->pstn_ring_stop
= 0;
1033 j
->ex
.bits
.pstn_ring
= 0;
1034 if (j
->cadence_f
[4].state
== 0) {
1035 j
->cadence_f
[4].state
= 1;
1036 j
->cadence_f
[4].on1min
= jiffies
+ (long)((j
->cadence_f
[4].on1
* hertz
* (100 - var
)) / 10000);
1037 j
->cadence_f
[4].on1dot
= jiffies
+ (long)((j
->cadence_f
[4].on1
* hertz
* (100)) / 10000);
1038 j
->cadence_f
[4].on1max
= jiffies
+ (long)((j
->cadence_f
[4].on1
* hertz
* (100 + var
)) / 10000);
1039 } else if (j
->cadence_f
[4].state
== 2) {
1040 if((time_after(jiffies
, j
->cadence_f
[4].off1min
) &&
1041 time_before(jiffies
, j
->cadence_f
[4].off1max
))) {
1042 if (j
->cadence_f
[4].on2
) {
1043 j
->cadence_f
[4].state
= 3;
1044 j
->cadence_f
[4].on2min
= jiffies
+ (long)((j
->cadence_f
[4].on2
* (hertz
* (100 - var
)) / 10000));
1045 j
->cadence_f
[4].on2dot
= jiffies
+ (long)((j
->cadence_f
[4].on2
* (hertz
* (100)) / 10000));
1046 j
->cadence_f
[4].on2max
= jiffies
+ (long)((j
->cadence_f
[4].on2
* (hertz
* (100 + var
)) / 10000));
1048 j
->cadence_f
[4].state
= 7;
1051 if (ixjdebug
& 0x0008) {
1052 printk(KERN_INFO
"IXJ Ring Cadence fail state = %d /dev/phone%d at %ld should be %d\n",
1053 j
->cadence_f
[4].state
, j
->board
, jiffies
- j
->pstn_prev_rmr
,
1054 j
->cadence_f
[4].off1
);
1056 j
->cadence_f
[4].state
= 0;
1058 } else if (j
->cadence_f
[4].state
== 4) {
1059 if((time_after(jiffies
, j
->cadence_f
[4].off2min
) &&
1060 time_before(jiffies
, j
->cadence_f
[4].off2max
))) {
1061 if (j
->cadence_f
[4].on3
) {
1062 j
->cadence_f
[4].state
= 5;
1063 j
->cadence_f
[4].on3min
= jiffies
+ (long)((j
->cadence_f
[4].on3
* (hertz
* (100 - var
)) / 10000));
1064 j
->cadence_f
[4].on3dot
= jiffies
+ (long)((j
->cadence_f
[4].on3
* (hertz
* (100)) / 10000));
1065 j
->cadence_f
[4].on3max
= jiffies
+ (long)((j
->cadence_f
[4].on3
* (hertz
* (100 + var
)) / 10000));
1067 j
->cadence_f
[4].state
= 7;
1070 if (ixjdebug
& 0x0008) {
1071 printk(KERN_INFO
"IXJ Ring Cadence fail state = %d /dev/phone%d at %ld should be %d\n",
1072 j
->cadence_f
[4].state
, j
->board
, jiffies
- j
->pstn_prev_rmr
,
1073 j
->cadence_f
[4].off2
);
1075 j
->cadence_f
[4].state
= 0;
1077 } else if (j
->cadence_f
[4].state
== 6) {
1078 if((time_after(jiffies
, j
->cadence_f
[4].off3min
) &&
1079 time_before(jiffies
, j
->cadence_f
[4].off3max
))) {
1080 j
->cadence_f
[4].state
= 7;
1082 if (ixjdebug
& 0x0008) {
1083 printk(KERN_INFO
"IXJ Ring Cadence fail state = %d /dev/phone%d at %ld should be %d\n",
1084 j
->cadence_f
[4].state
, j
->board
, jiffies
- j
->pstn_prev_rmr
,
1085 j
->cadence_f
[4].off3
);
1087 j
->cadence_f
[4].state
= 0;
1090 j
->cadence_f
[4].state
= 0;
1092 } else { /* Falling edge of RMR */
1093 j
->pstn_ring_start
= 0;
1094 j
->pstn_ring_stop
= jiffies
;
1095 if (j
->cadence_f
[4].state
== 1) {
1096 if(!j
->cadence_f
[4].on1
) {
1097 j
->cadence_f
[4].state
= 7;
1098 } else if((time_after(jiffies
, j
->cadence_f
[4].on1min
) &&
1099 time_before(jiffies
, j
->cadence_f
[4].on1max
))) {
1100 if (j
->cadence_f
[4].off1
) {
1101 j
->cadence_f
[4].state
= 2;
1102 j
->cadence_f
[4].off1min
= jiffies
+ (long)((j
->cadence_f
[4].off1
* (hertz
* (100 - var
)) / 10000));
1103 j
->cadence_f
[4].off1dot
= jiffies
+ (long)((j
->cadence_f
[4].off1
* (hertz
* (100)) / 10000));
1104 j
->cadence_f
[4].off1max
= jiffies
+ (long)((j
->cadence_f
[4].off1
* (hertz
* (100 + var
)) / 10000));
1106 j
->cadence_f
[4].state
= 7;
1109 if (ixjdebug
& 0x0008) {
1110 printk(KERN_INFO
"IXJ Ring Cadence fail state = %d /dev/phone%d at %ld should be %d\n",
1111 j
->cadence_f
[4].state
, j
->board
, jiffies
- j
->pstn_prev_rmr
,
1112 j
->cadence_f
[4].on1
);
1114 j
->cadence_f
[4].state
= 0;
1116 } else if (j
->cadence_f
[4].state
== 3) {
1117 if((time_after(jiffies
, j
->cadence_f
[4].on2min
) &&
1118 time_before(jiffies
, j
->cadence_f
[4].on2max
))) {
1119 if (j
->cadence_f
[4].off2
) {
1120 j
->cadence_f
[4].state
= 4;
1121 j
->cadence_f
[4].off2min
= jiffies
+ (long)((j
->cadence_f
[4].off2
* (hertz
* (100 - var
)) / 10000));
1122 j
->cadence_f
[4].off2dot
= jiffies
+ (long)((j
->cadence_f
[4].off2
* (hertz
* (100)) / 10000));
1123 j
->cadence_f
[4].off2max
= jiffies
+ (long)((j
->cadence_f
[4].off2
* (hertz
* (100 + var
)) / 10000));
1125 j
->cadence_f
[4].state
= 7;
1128 if (ixjdebug
& 0x0008) {
1129 printk(KERN_INFO
"IXJ Ring Cadence fail state = %d /dev/phone%d at %ld should be %d\n",
1130 j
->cadence_f
[4].state
, j
->board
, jiffies
- j
->pstn_prev_rmr
,
1131 j
->cadence_f
[4].on2
);
1133 j
->cadence_f
[4].state
= 0;
1135 } else if (j
->cadence_f
[4].state
== 5) {
1136 if((time_after(jiffies
, j
->cadence_f
[4].on3min
) &&
1137 time_before(jiffies
, j
->cadence_f
[4].on3max
))) {
1138 if (j
->cadence_f
[4].off3
) {
1139 j
->cadence_f
[4].state
= 6;
1140 j
->cadence_f
[4].off3min
= jiffies
+ (long)((j
->cadence_f
[4].off3
* (hertz
* (100 - var
)) / 10000));
1141 j
->cadence_f
[4].off3dot
= jiffies
+ (long)((j
->cadence_f
[4].off3
* (hertz
* (100)) / 10000));
1142 j
->cadence_f
[4].off3max
= jiffies
+ (long)((j
->cadence_f
[4].off3
* (hertz
* (100 + var
)) / 10000));
1144 j
->cadence_f
[4].state
= 7;
1147 j
->cadence_f
[4].state
= 0;
1150 if (ixjdebug
& 0x0008) {
1151 printk(KERN_INFO
"IXJ Ring Cadence fail state = %d /dev/phone%d at %ld should be %d\n",
1152 j
->cadence_f
[4].state
, j
->board
, jiffies
- j
->pstn_prev_rmr
,
1153 j
->cadence_f
[4].on3
);
1155 j
->cadence_f
[4].state
= 0;
1158 if (ixjdebug
& 0x0010) {
1159 printk(KERN_INFO
"IXJ Ring Cadence b state = %d /dev/phone%d at %ld\n", j
->cadence_f
[4].state
, j
->board
, jiffies
);
1161 if (ixjdebug
& 0x0010) {
1162 switch(j
->cadence_f
[4].state
) {
1164 printk(KERN_INFO
"IXJ /dev/phone%d Next Ring Cadence state at %u min %ld - %ld - max %ld\n", j
->board
,
1165 j
->cadence_f
[4].on1
, j
->cadence_f
[4].on1min
, j
->cadence_f
[4].on1dot
, j
->cadence_f
[4].on1max
);
1168 printk(KERN_INFO
"IXJ /dev/phone%d Next Ring Cadence state at %u min %ld - %ld - max %ld\n", j
->board
,
1169 j
->cadence_f
[4].off1
, j
->cadence_f
[4].off1min
, j
->cadence_f
[4].off1dot
, j
->cadence_f
[4].off1max
);
1172 printk(KERN_INFO
"IXJ /dev/phone%d Next Ring Cadence state at %u min %ld - %ld - max %ld\n", j
->board
,
1173 j
->cadence_f
[4].on2
, j
->cadence_f
[4].on2min
, j
->cadence_f
[4].on2dot
, j
->cadence_f
[4].on2max
);
1176 printk(KERN_INFO
"IXJ /dev/phone%d Next Ring Cadence state at %u min %ld - %ld - max %ld\n", j
->board
,
1177 j
->cadence_f
[4].off2
, j
->cadence_f
[4].off2min
, j
->cadence_f
[4].off2dot
, j
->cadence_f
[4].off2max
);
1180 printk(KERN_INFO
"IXJ /dev/phone%d Next Ring Cadence state at %u min %ld - %ld - max %ld\n", j
->board
,
1181 j
->cadence_f
[4].on3
, j
->cadence_f
[4].on3min
, j
->cadence_f
[4].on3dot
, j
->cadence_f
[4].on3max
);
1184 printk(KERN_INFO
"IXJ /dev/phone%d Next Ring Cadence state at %u min %ld - %ld - max %ld\n", j
->board
,
1185 j
->cadence_f
[4].off3
, j
->cadence_f
[4].off3min
, j
->cadence_f
[4].off3dot
, j
->cadence_f
[4].off3max
);
1190 if (j
->cadence_f
[4].state
== 7) {
1191 j
->cadence_f
[4].state
= 0;
1192 j
->pstn_ring_stop
= jiffies
;
1193 j
->ex
.bits
.pstn_ring
= 1;
1194 ixj_kill_fasync(j
, SIG_PSTN_RING
, POLL_IN
);
1195 if(ixjdebug
& 0x0008) {
1196 printk(KERN_INFO
"IXJ Ring int set /dev/phone%d at %ld\n", j
->board
, jiffies
);
1199 if((j
->pstn_ring_int
!= 0 && time_after(jiffies
, j
->pstn_ring_int
+ (hertz
* 5)) && !j
->flags
.pstn_rmr
) ||
1200 (j
->pstn_ring_stop
!= 0 && time_after(jiffies
, j
->pstn_ring_stop
+ (hertz
* 5)))) {
1201 if(ixjdebug
& 0x0008) {
1202 printk("IXJ DAA no ring in 5 seconds /dev/phone%d at %ld\n", j
->board
, jiffies
);
1203 printk("IXJ DAA pstn ring int /dev/phone%d at %ld\n", j
->board
, j
->pstn_ring_int
);
1204 printk("IXJ DAA pstn ring stop /dev/phone%d at %ld\n", j
->board
, j
->pstn_ring_stop
);
1206 j
->pstn_ring_stop
= j
->pstn_ring_int
= 0;
1207 daa_set_mode(j
, SOP_PU_SLEEP
);
1209 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
1210 if (j
->pstn_cid_intr
&& time_after(jiffies
, j
->pstn_cid_received
+ hertz
)) {
1211 ixj_daa_cid_read(j
);
1212 j
->ex
.bits
.caller_id
= 1;
1213 ixj_kill_fasync(j
, SIG_CALLER_ID
, POLL_IN
);
1214 j
->pstn_cid_intr
= 0;
1216 if (daaint
.bitreg
.Cadence
) {
1217 if(ixjdebug
& 0x0008) {
1218 printk("IXJ DAA Cadence interrupt going to sleep /dev/phone%d\n", j
->board
);
1220 daa_set_mode(j
, SOP_PU_SLEEP
);
1221 j
->ex
.bits
.pstn_ring
= 0;
1224 case SOP_PU_CONVERSATION
:
1225 if (daaint
.bitreg
.VDD_OK
) {
1226 if(!daaint
.bitreg
.SI_0
) {
1227 if (!j
->pstn_winkstart
) {
1228 if(ixjdebug
& 0x0008) {
1229 printk("IXJ DAA possible wink /dev/phone%d %ld\n", j
->board
, jiffies
);
1231 j
->pstn_winkstart
= jiffies
;
1234 if (j
->pstn_winkstart
) {
1235 if(ixjdebug
& 0x0008) {
1236 printk("IXJ DAA possible wink end /dev/phone%d %ld\n", j
->board
, jiffies
);
1238 j
->pstn_winkstart
= 0;
1242 if (j
->pstn_winkstart
&& time_after(jiffies
, j
->pstn_winkstart
+ ((hertz
* j
->winktime
) / 1000))) {
1243 if(ixjdebug
& 0x0008) {
1244 printk("IXJ DAA wink detected going to sleep /dev/phone%d %ld\n", j
->board
, jiffies
);
1246 daa_set_mode(j
, SOP_PU_SLEEP
);
1247 j
->pstn_winkstart
= 0;
1248 j
->ex
.bits
.pstn_wink
= 1;
1249 ixj_kill_fasync(j
, SIG_PSTN_WINK
, POLL_IN
);
1255 static void ixj_timeout(unsigned long ptr
)
1258 unsigned long jifon
;
1259 IXJ
*j
= (IXJ
*)ptr
;
1262 if (j
->DSPbase
&& atomic_read(&j
->DSPWrite
) == 0 && test_and_set_bit(board
, (void *)&j
->busyflags
) == 0) {
1263 ixj_perfmon(j
->timerchecks
);
1264 j
->hookstate
= ixj_hookstate(j
);
1265 if (j
->tone_state
) {
1266 if (!(j
->hookstate
)) {
1270 j
->ex
.bits
.hookstate
= 1;
1271 ixj_kill_fasync(j
, SIG_HOOKSTATE
, POLL_IN
);
1273 clear_bit(board
, &j
->busyflags
);
1277 if (j
->tone_state
== 1)
1278 jifon
= ((hertz
* j
->tone_on_time
) * 25 / 100000);
1280 jifon
= ((hertz
* j
->tone_on_time
) * 25 / 100000) + ((hertz
* j
->tone_off_time
) * 25 / 100000);
1281 if (time_before(jiffies
, j
->tone_start_jif
+ jifon
)) {
1282 if (j
->tone_state
== 1) {
1283 ixj_play_tone(j
, j
->tone_index
);
1284 if (j
->dsp
.low
== 0x20) {
1285 clear_bit(board
, &j
->busyflags
);
1290 ixj_play_tone(j
, 0);
1291 if (j
->dsp
.low
== 0x20) {
1292 clear_bit(board
, &j
->busyflags
);
1298 ixj_tone_timeout(j
);
1299 if (j
->flags
.dialtone
) {
1302 if (j
->flags
.busytone
) {
1304 if (j
->dsp
.low
== 0x20) {
1305 clear_bit(board
, &j
->busyflags
);
1310 if (j
->flags
.ringback
) {
1312 if (j
->dsp
.low
== 0x20) {
1313 clear_bit(board
, &j
->busyflags
);
1318 if (!j
->tone_state
) {
1323 if (!(j
->tone_state
&& j
->dsp
.low
== 0x20)) {
1331 if (j
->flags
.cringing
) {
1332 if (j
->hookstate
& 1) {
1333 j
->flags
.cringing
= 0;
1335 } else if(j
->cadence_f
[5].enable
&& ((!j
->cadence_f
[5].en_filter
) || (j
->cadence_f
[5].en_filter
&& j
->flags
.firstring
))) {
1336 switch(j
->cadence_f
[5].state
) {
1338 j
->cadence_f
[5].on1dot
= jiffies
+ (long)((j
->cadence_f
[5].on1
* (hertz
* 100) / 10000));
1339 if (time_before(jiffies
, j
->cadence_f
[5].on1dot
)) {
1340 if(ixjdebug
& 0x0004) {
1341 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1345 j
->cadence_f
[5].state
= 1;
1348 if (time_after(jiffies
, j
->cadence_f
[5].on1dot
)) {
1349 j
->cadence_f
[5].off1dot
= jiffies
+ (long)((j
->cadence_f
[5].off1
* (hertz
* 100) / 10000));
1350 if(ixjdebug
& 0x0004) {
1351 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1354 j
->cadence_f
[5].state
= 2;
1358 if (time_after(jiffies
, j
->cadence_f
[5].off1dot
)) {
1359 if(ixjdebug
& 0x0004) {
1360 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1363 if (j
->cadence_f
[5].on2
) {
1364 j
->cadence_f
[5].on2dot
= jiffies
+ (long)((j
->cadence_f
[5].on2
* (hertz
* 100) / 10000));
1365 j
->cadence_f
[5].state
= 3;
1367 j
->cadence_f
[5].state
= 7;
1372 if (time_after(jiffies
, j
->cadence_f
[5].on2dot
)) {
1373 if(ixjdebug
& 0x0004) {
1374 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1377 if (j
->cadence_f
[5].off2
) {
1378 j
->cadence_f
[5].off2dot
= jiffies
+ (long)((j
->cadence_f
[5].off2
* (hertz
* 100) / 10000));
1379 j
->cadence_f
[5].state
= 4;
1381 j
->cadence_f
[5].state
= 7;
1386 if (time_after(jiffies
, j
->cadence_f
[5].off2dot
)) {
1387 if(ixjdebug
& 0x0004) {
1388 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1391 if (j
->cadence_f
[5].on3
) {
1392 j
->cadence_f
[5].on3dot
= jiffies
+ (long)((j
->cadence_f
[5].on3
* (hertz
* 100) / 10000));
1393 j
->cadence_f
[5].state
= 5;
1395 j
->cadence_f
[5].state
= 7;
1400 if (time_after(jiffies
, j
->cadence_f
[5].on3dot
)) {
1401 if(ixjdebug
& 0x0004) {
1402 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1405 if (j
->cadence_f
[5].off3
) {
1406 j
->cadence_f
[5].off3dot
= jiffies
+ (long)((j
->cadence_f
[5].off3
* (hertz
* 100) / 10000));
1407 j
->cadence_f
[5].state
= 6;
1409 j
->cadence_f
[5].state
= 7;
1414 if (time_after(jiffies
, j
->cadence_f
[5].off3dot
)) {
1415 if(ixjdebug
& 0x0004) {
1416 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1418 j
->cadence_f
[5].state
= 7;
1422 if(ixjdebug
& 0x0004) {
1423 printk("Ringing cadence state = %d - %ld\n", j
->cadence_f
[5].state
, jiffies
);
1425 j
->flags
.cidring
= 1;
1426 j
->cadence_f
[5].state
= 0;
1429 if (j
->flags
.cidring
&& !j
->flags
.cidsent
) {
1430 j
->flags
.cidsent
= 1;
1432 SLIC_SetState(PLD_SLIC_STATE_OHT
, j
);
1435 j
->flags
.cidring
= 0;
1437 clear_bit(board
, &j
->busyflags
);
1441 if (time_after(jiffies
, j
->ring_cadence_jif
+ (hertz
/ 2))) {
1442 if (j
->flags
.cidring
&& !j
->flags
.cidsent
) {
1443 j
->flags
.cidsent
= 1;
1445 SLIC_SetState(PLD_SLIC_STATE_OHT
, j
);
1448 j
->flags
.cidring
= 0;
1450 j
->ring_cadence_t
--;
1451 if (j
->ring_cadence_t
== -1)
1452 j
->ring_cadence_t
= 15;
1453 j
->ring_cadence_jif
= jiffies
;
1455 if (j
->ring_cadence
& 1 << j
->ring_cadence_t
) {
1456 if(j
->flags
.cidsent
&& j
->cadence_f
[5].en_filter
)
1457 j
->flags
.firstring
= 1;
1462 if(!j
->flags
.cidsent
)
1463 j
->flags
.cidring
= 1;
1466 clear_bit(board
, &j
->busyflags
);
1471 if (!j
->flags
.ringing
) {
1472 if (j
->hookstate
) { /* & 1) { */
1473 if (j
->dsp
.low
!= 0x20 &&
1474 SLIC_GetState(j
) != PLD_SLIC_STATE_ACTIVE
) {
1475 SLIC_SetState(PLD_SLIC_STATE_ACTIVE
, j
);
1479 ixj_WriteDSPCommand(0x511B, j
);
1480 j
->proc_load
= j
->ssr
.high
<< 8 | j
->ssr
.low
;
1481 if (!j
->m_hook
&& (j
->hookstate
& 1)) {
1482 j
->m_hook
= j
->ex
.bits
.hookstate
= 1;
1483 ixj_kill_fasync(j
, SIG_HOOKSTATE
, POLL_IN
);
1486 if (j
->ex
.bits
.dtmf_ready
) {
1487 j
->dtmf_wp
= j
->dtmf_rp
= j
->ex
.bits
.dtmf_ready
= 0;
1491 j
->ex
.bits
.hookstate
= 1;
1492 ixj_kill_fasync(j
, SIG_HOOKSTATE
, POLL_IN
);
1496 if (j
->cardtype
== QTI_LINEJACK
&& !j
->flags
.pstncheck
&& j
->flags
.pstn_present
) {
1500 wake_up_interruptible(&j
->poll_q
); /* Wake any blocked selects */
1502 clear_bit(board
, &j
->busyflags
);
1507 static int ixj_status_wait(IXJ
*j
)
1511 jif
= jiffies
+ ((60 * hertz
) / 100);
1512 while (!IsStatusReady(j
)) {
1513 ixj_perfmon(j
->statuswait
);
1514 if (time_after(jiffies
, jif
)) {
1515 ixj_perfmon(j
->statuswaitfail
);
1522 static int ixj_PCcontrol_wait(IXJ
*j
)
1526 jif
= jiffies
+ ((60 * hertz
) / 100);
1527 while (!IsPCControlReady(j
)) {
1528 ixj_perfmon(j
->pcontrolwait
);
1529 if (time_after(jiffies
, jif
)) {
1530 ixj_perfmon(j
->pcontrolwaitfail
);
1537 static int ixj_WriteDSPCommand(unsigned short cmd
, IXJ
*j
)
1542 atomic_inc(&j
->DSPWrite
);
1543 if(atomic_read(&j
->DSPWrite
) > 1) {
1544 printk("IXJ %d DSP write overlap attempting command 0x%4.4x\n", j
->board
, cmd
);
1547 bytes
.high
= (cmd
& 0xFF00) >> 8;
1548 bytes
.low
= cmd
& 0x00FF;
1549 jif
= jiffies
+ ((60 * hertz
) / 100);
1550 while (!IsControlReady(j
)) {
1551 ixj_perfmon(j
->iscontrolready
);
1552 if (time_after(jiffies
, jif
)) {
1553 ixj_perfmon(j
->iscontrolreadyfail
);
1554 atomic_dec(&j
->DSPWrite
);
1555 if(atomic_read(&j
->DSPWrite
) > 0) {
1556 printk("IXJ %d DSP overlaped command 0x%4.4x during control ready failure.\n", j
->board
, cmd
);
1557 while(atomic_read(&j
->DSPWrite
) > 0) {
1558 atomic_dec(&j
->DSPWrite
);
1564 outb(bytes
.low
, j
->DSPbase
+ 6);
1565 outb(bytes
.high
, j
->DSPbase
+ 7);
1567 if (ixj_status_wait(j
)) {
1570 atomic_dec(&j
->DSPWrite
);
1571 if(atomic_read(&j
->DSPWrite
) > 0) {
1572 printk("IXJ %d DSP overlaped command 0x%4.4x during status wait failure.\n", j
->board
, cmd
);
1573 while(atomic_read(&j
->DSPWrite
) > 0) {
1574 atomic_dec(&j
->DSPWrite
);
1579 /* Read Software Status Register */
1580 j
->ssr
.low
= inb_p(j
->DSPbase
+ 2);
1581 j
->ssr
.high
= inb_p(j
->DSPbase
+ 3);
1582 atomic_dec(&j
->DSPWrite
);
1583 if(atomic_read(&j
->DSPWrite
) > 0) {
1584 printk("IXJ %d DSP overlaped command 0x%4.4x\n", j
->board
, cmd
);
1585 while(atomic_read(&j
->DSPWrite
) > 0) {
1586 atomic_dec(&j
->DSPWrite
);
1592 /***************************************************************************
1594 * General Purpose IO Register read routine
1596 ***************************************************************************/
1597 static inline int ixj_gpio_read(IXJ
*j
)
1599 if (ixj_WriteDSPCommand(0x5143, j
))
1602 j
->gpio
.bytes
.low
= j
->ssr
.low
;
1603 j
->gpio
.bytes
.high
= j
->ssr
.high
;
1608 static inline void LED_SetState(int state
, IXJ
*j
)
1610 if (j
->cardtype
== QTI_LINEJACK
) {
1611 j
->pld_scrw
.bits
.led1
= state
& 0x1 ? 1 : 0;
1612 j
->pld_scrw
.bits
.led2
= state
& 0x2 ? 1 : 0;
1613 j
->pld_scrw
.bits
.led3
= state
& 0x4 ? 1 : 0;
1614 j
->pld_scrw
.bits
.led4
= state
& 0x8 ? 1 : 0;
1616 outb(j
->pld_scrw
.byte
, j
->XILINXbase
);
1620 /*********************************************************************
1621 * GPIO Pins are configured as follows on the Quicknet Internet
1622 * PhoneJACK Telephony Cards
1624 * POTS Select GPIO_6=0 GPIO_7=0
1625 * Mic/Speaker Select GPIO_6=0 GPIO_7=1
1626 * Handset Select GPIO_6=1 GPIO_7=0
1628 * SLIC Active GPIO_1=0 GPIO_2=1 GPIO_5=0
1629 * SLIC Ringing GPIO_1=1 GPIO_2=1 GPIO_5=0
1630 * SLIC Open Circuit GPIO_1=0 GPIO_2=0 GPIO_5=0
1632 * Hook Switch changes reported on GPIO_3
1633 *********************************************************************/
1634 static int ixj_set_port(IXJ
*j
, int arg
)
1636 if (j
->cardtype
== QTI_PHONEJACK_LITE
) {
1637 if (arg
!= PORT_POTS
)
1644 j
->port
= PORT_POTS
;
1645 switch (j
->cardtype
) {
1647 if (j
->flags
.pcmciasct
== 1)
1648 SLIC_SetState(PLD_SLIC_STATE_ACTIVE
, j
);
1652 case QTI_PHONEJACK_PCI
:
1653 j
->pld_slicw
.pcib
.mic
= 0;
1654 j
->pld_slicw
.pcib
.spk
= 0;
1655 outb(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
1658 ixj_set_pots(j
, 0); /* Disconnect POTS/PSTN relay */
1659 if (ixj_WriteDSPCommand(0xC528, j
)) /* Write CODEC config to
1660 Software Control Register */
1662 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
1664 outb(j
->pld_scrw
.byte
, j
->XILINXbase
);
1665 j
->pld_clock
.byte
= 0;
1666 outb(j
->pld_clock
.byte
, j
->XILINXbase
+ 0x04);
1667 j
->pld_slicw
.bits
.rly1
= 1;
1668 j
->pld_slicw
.bits
.spken
= 0;
1669 outb(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
1670 ixj_mixer(0x1200, j
); /* Turn Off MIC switch on mixer left */
1671 ixj_mixer(0x1401, j
); /* Turn On Mono1 switch on mixer left */
1672 ixj_mixer(0x1300, j
); /* Turn Off MIC switch on mixer right */
1673 ixj_mixer(0x1501, j
); /* Turn On Mono1 switch on mixer right */
1674 ixj_mixer(0x0E80, j
); /*Mic mute */
1675 ixj_mixer(0x0F00, j
); /* Set mono out (SLIC) to 0dB */
1676 ixj_mixer(0x0080, j
); /* Mute Master Left volume */
1677 ixj_mixer(0x0180, j
); /* Mute Master Right volume */
1678 SLIC_SetState(PLD_SLIC_STATE_STANDBY
, j
);
1679 /* SLIC_SetState(PLD_SLIC_STATE_ACTIVE, j); */
1682 j
->gpio
.bytes
.high
= 0x0B;
1683 j
->gpio
.bits
.gpio6
= 0;
1684 j
->gpio
.bits
.gpio7
= 0;
1685 ixj_WriteDSPCommand(j
->gpio
.word
, j
);
1690 if (j
->cardtype
== QTI_LINEJACK
) {
1691 ixj_WriteDSPCommand(0xC534, j
); /* Write CODEC config to Software Control Register */
1693 j
->pld_slicw
.bits
.rly3
= 0;
1694 j
->pld_slicw
.bits
.rly1
= 1;
1695 j
->pld_slicw
.bits
.spken
= 0;
1696 outb(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
1697 j
->port
= PORT_PSTN
;
1703 j
->port
= PORT_SPEAKER
;
1704 switch (j
->cardtype
) {
1706 if (j
->flags
.pcmciasct
) {
1707 SLIC_SetState(PLD_SLIC_STATE_OC
, j
);
1710 case QTI_PHONEJACK_PCI
:
1711 j
->pld_slicw
.pcib
.mic
= 1;
1712 j
->pld_slicw
.pcib
.spk
= 1;
1713 outb(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
1716 ixj_set_pots(j
, 0); /* Disconnect POTS/PSTN relay */
1717 if (ixj_WriteDSPCommand(0xC528, j
)) /* Write CODEC config to
1718 Software Control Register */
1720 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
1722 outb(j
->pld_scrw
.byte
, j
->XILINXbase
);
1723 j
->pld_clock
.byte
= 0;
1724 outb(j
->pld_clock
.byte
, j
->XILINXbase
+ 0x04);
1725 j
->pld_slicw
.bits
.rly1
= 1;
1726 j
->pld_slicw
.bits
.spken
= 1;
1727 outb(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
1728 ixj_mixer(0x1201, j
); /* Turn On MIC switch on mixer left */
1729 ixj_mixer(0x1400, j
); /* Turn Off Mono1 switch on mixer left */
1730 ixj_mixer(0x1301, j
); /* Turn On MIC switch on mixer right */
1731 ixj_mixer(0x1500, j
); /* Turn Off Mono1 switch on mixer right */
1732 ixj_mixer(0x0E06, j
); /*Mic un-mute 0dB */
1733 ixj_mixer(0x0F80, j
); /* Mute mono out (SLIC) */
1734 ixj_mixer(0x0000, j
); /* Set Master Left volume to 0dB */
1735 ixj_mixer(0x0100, j
); /* Set Master Right volume to 0dB */
1738 j
->gpio
.bytes
.high
= 0x0B;
1739 j
->gpio
.bits
.gpio6
= 0;
1740 j
->gpio
.bits
.gpio7
= 1;
1741 ixj_WriteDSPCommand(j
->gpio
.word
, j
);
1746 if (j
->cardtype
!= QTI_PHONEJACK
) {
1749 j
->gpio
.bytes
.high
= 0x0B;
1750 j
->gpio
.bits
.gpio6
= 1;
1751 j
->gpio
.bits
.gpio7
= 0;
1752 ixj_WriteDSPCommand(j
->gpio
.word
, j
);
1753 j
->port
= PORT_HANDSET
;
1763 static int ixj_set_pots(IXJ
*j
, int arg
)
1765 if (j
->cardtype
== QTI_LINEJACK
) {
1767 if (j
->port
== PORT_PSTN
) {
1768 j
->pld_slicw
.bits
.rly1
= 0;
1769 outb(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
1770 j
->flags
.pots_pstn
= 1;
1773 j
->flags
.pots_pstn
= 0;
1777 j
->pld_slicw
.bits
.rly1
= 1;
1778 outb(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
1779 j
->flags
.pots_pstn
= 0;
1787 static void ixj_ring_on(IXJ
*j
)
1789 if (j
->dsp
.low
== 0x20) /* Internet PhoneJACK */
1791 if (ixjdebug
& 0x0004)
1792 printk(KERN_INFO
"IXJ Ring On /dev/phone%d\n", j
->board
);
1794 j
->gpio
.bytes
.high
= 0x0B;
1795 j
->gpio
.bytes
.low
= 0x00;
1796 j
->gpio
.bits
.gpio1
= 1;
1797 j
->gpio
.bits
.gpio2
= 1;
1798 j
->gpio
.bits
.gpio5
= 0;
1799 ixj_WriteDSPCommand(j
->gpio
.word
, j
); /* send the ring signal */
1800 } else /* Internet LineJACK, Internet PhoneJACK Lite or Internet PhoneJACK PCI */
1802 if (ixjdebug
& 0x0004)
1803 printk(KERN_INFO
"IXJ Ring On /dev/phone%d\n", j
->board
);
1805 SLIC_SetState(PLD_SLIC_STATE_RINGING
, j
);
1809 static int ixj_siadc(IXJ
*j
, int val
)
1811 if(j
->cardtype
== QTI_PHONECARD
){
1812 if(j
->flags
.pcmciascp
){
1814 return j
->siadc
.bits
.rxg
;
1816 if(val
< 0 || val
> 0x1F)
1819 j
->siadc
.bits
.hom
= 0; /* Handset Out Mute */
1820 j
->siadc
.bits
.lom
= 0; /* Line Out Mute */
1821 j
->siadc
.bits
.rxg
= val
; /*(0xC000 - 0x41C8) / 0x4EF; RX PGA Gain */
1822 j
->psccr
.bits
.addr
= 6; /* R/W Smart Cable Register Address */
1823 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1824 j
->psccr
.bits
.dev
= 0;
1825 outb(j
->siadc
.byte
, j
->XILINXbase
+ 0x00);
1826 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1827 ixj_PCcontrol_wait(j
);
1828 return j
->siadc
.bits
.rxg
;
1834 static int ixj_sidac(IXJ
*j
, int val
)
1836 if(j
->cardtype
== QTI_PHONECARD
){
1837 if(j
->flags
.pcmciascp
){
1839 return j
->sidac
.bits
.txg
;
1841 if(val
< 0 || val
> 0x1F)
1844 j
->sidac
.bits
.srm
= 1; /* Speaker Right Mute */
1845 j
->sidac
.bits
.slm
= 1; /* Speaker Left Mute */
1846 j
->sidac
.bits
.txg
= val
; /* (0xC000 - 0x45E4) / 0x5D3; TX PGA Gain */
1847 j
->psccr
.bits
.addr
= 7; /* R/W Smart Cable Register Address */
1848 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1849 j
->psccr
.bits
.dev
= 0;
1850 outb(j
->sidac
.byte
, j
->XILINXbase
+ 0x00);
1851 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1852 ixj_PCcontrol_wait(j
);
1853 return j
->sidac
.bits
.txg
;
1859 static int ixj_pcmcia_cable_check(IXJ
*j
)
1861 j
->pccr1
.byte
= inb_p(j
->XILINXbase
+ 0x03);
1862 if (!j
->flags
.pcmciastate
) {
1863 j
->pccr2
.byte
= inb_p(j
->XILINXbase
+ 0x02);
1864 if (j
->pccr1
.bits
.drf
|| j
->pccr2
.bits
.rstc
) {
1865 j
->flags
.pcmciastate
= 4;
1868 if (j
->pccr1
.bits
.ed
) {
1869 j
->pccr1
.bits
.ed
= 0;
1870 j
->psccr
.bits
.dev
= 3;
1871 j
->psccr
.bits
.rw
= 1;
1872 outw_p(j
->psccr
.byte
<< 8, j
->XILINXbase
+ 0x00);
1873 ixj_PCcontrol_wait(j
);
1874 j
->pslic
.byte
= inw_p(j
->XILINXbase
+ 0x00) & 0xFF;
1875 j
->pslic
.bits
.led2
= j
->pslic
.bits
.det
? 1 : 0;
1876 j
->psccr
.bits
.dev
= 3;
1877 j
->psccr
.bits
.rw
= 0;
1878 outw_p(j
->psccr
.byte
<< 8 | j
->pslic
.byte
, j
->XILINXbase
+ 0x00);
1879 ixj_PCcontrol_wait(j
);
1880 return j
->pslic
.bits
.led2
? 1 : 0;
1881 } else if (j
->flags
.pcmciasct
) {
1886 } else if (j
->flags
.pcmciastate
== 4) {
1887 if (!j
->pccr1
.bits
.drf
) {
1888 j
->flags
.pcmciastate
= 3;
1891 } else if (j
->flags
.pcmciastate
== 3) {
1892 j
->pccr2
.bits
.pwr
= 0;
1893 j
->pccr2
.bits
.rstc
= 1;
1894 outb(j
->pccr2
.byte
, j
->XILINXbase
+ 0x02);
1895 j
->checkwait
= jiffies
+ (hertz
* 2);
1896 j
->flags
.incheck
= 1;
1897 j
->flags
.pcmciastate
= 2;
1899 } else if (j
->flags
.pcmciastate
== 2) {
1900 if (j
->flags
.incheck
) {
1901 if (time_before(jiffies
, j
->checkwait
)) {
1904 j
->flags
.incheck
= 0;
1907 j
->pccr2
.bits
.pwr
= 0;
1908 j
->pccr2
.bits
.rstc
= 0;
1909 outb_p(j
->pccr2
.byte
, j
->XILINXbase
+ 0x02);
1910 j
->flags
.pcmciastate
= 1;
1912 } else if (j
->flags
.pcmciastate
== 1) {
1913 j
->flags
.pcmciastate
= 0;
1914 if (!j
->pccr1
.bits
.drf
) {
1915 j
->psccr
.bits
.dev
= 3;
1916 j
->psccr
.bits
.rw
= 1;
1917 outb_p(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1918 ixj_PCcontrol_wait(j
);
1919 j
->flags
.pcmciascp
= 1; /* Set Cable Present Flag */
1921 j
->flags
.pcmciasct
= (inw_p(j
->XILINXbase
+ 0x00) >> 8) & 0x03; /* Get Cable Type */
1923 if (j
->flags
.pcmciasct
== 3) {
1924 j
->flags
.pcmciastate
= 4;
1926 } else if (j
->flags
.pcmciasct
== 0) {
1927 j
->pccr2
.bits
.pwr
= 1;
1928 j
->pccr2
.bits
.rstc
= 0;
1929 outb_p(j
->pccr2
.byte
, j
->XILINXbase
+ 0x02);
1930 j
->port
= PORT_SPEAKER
;
1932 j
->port
= PORT_POTS
;
1934 j
->sic1
.bits
.cpd
= 0; /* Chip Power Down */
1935 j
->sic1
.bits
.mpd
= 0; /* MIC Bias Power Down */
1936 j
->sic1
.bits
.hpd
= 0; /* Handset Bias Power Down */
1937 j
->sic1
.bits
.lpd
= 0; /* Line Bias Power Down */
1938 j
->sic1
.bits
.spd
= 1; /* Speaker Drive Power Down */
1939 j
->psccr
.bits
.addr
= 1; /* R/W Smart Cable Register Address */
1940 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1941 j
->psccr
.bits
.dev
= 0;
1942 outb(j
->sic1
.byte
, j
->XILINXbase
+ 0x00);
1943 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1944 ixj_PCcontrol_wait(j
);
1946 j
->sic2
.bits
.al
= 0; /* Analog Loopback DAC analog -> ADC analog */
1947 j
->sic2
.bits
.dl2
= 0; /* Digital Loopback DAC -> ADC one bit */
1948 j
->sic2
.bits
.dl1
= 0; /* Digital Loopback ADC -> DAC one bit */
1949 j
->sic2
.bits
.pll
= 0; /* 1 = div 10, 0 = div 5 */
1950 j
->sic2
.bits
.hpd
= 0; /* HPF disable */
1951 j
->psccr
.bits
.addr
= 2; /* R/W Smart Cable Register Address */
1952 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1953 j
->psccr
.bits
.dev
= 0;
1954 outb(j
->sic2
.byte
, j
->XILINXbase
+ 0x00);
1955 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1956 ixj_PCcontrol_wait(j
);
1958 j
->psccr
.bits
.addr
= 3; /* R/W Smart Cable Register Address */
1959 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1960 j
->psccr
.bits
.dev
= 0;
1961 outb(0x00, j
->XILINXbase
+ 0x00); /* PLL Divide N1 */
1962 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1963 ixj_PCcontrol_wait(j
);
1965 j
->psccr
.bits
.addr
= 4; /* R/W Smart Cable Register Address */
1966 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1967 j
->psccr
.bits
.dev
= 0;
1968 outb(0x09, j
->XILINXbase
+ 0x00); /* PLL Multiply M1 */
1969 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1970 ixj_PCcontrol_wait(j
);
1972 j
->sirxg
.bits
.lig
= 1; /* Line In Gain */
1973 j
->sirxg
.bits
.lim
= 1; /* Line In Mute */
1974 j
->sirxg
.bits
.mcg
= 0; /* MIC In Gain was 3 */
1975 j
->sirxg
.bits
.mcm
= 0; /* MIC In Mute */
1976 j
->sirxg
.bits
.him
= 0; /* Handset In Mute */
1977 j
->sirxg
.bits
.iir
= 1; /* IIR */
1978 j
->psccr
.bits
.addr
= 5; /* R/W Smart Cable Register Address */
1979 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1980 j
->psccr
.bits
.dev
= 0;
1981 outb(j
->sirxg
.byte
, j
->XILINXbase
+ 0x00);
1982 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1983 ixj_PCcontrol_wait(j
);
1988 j
->siaatt
.bits
.sot
= 0;
1989 j
->psccr
.bits
.addr
= 9; /* R/W Smart Cable Register Address */
1990 j
->psccr
.bits
.rw
= 0; /* Read / Write flag */
1991 j
->psccr
.bits
.dev
= 0;
1992 outb(j
->siaatt
.byte
, j
->XILINXbase
+ 0x00);
1993 outb(j
->psccr
.byte
, j
->XILINXbase
+ 0x01);
1994 ixj_PCcontrol_wait(j
);
1996 if (j
->flags
.pcmciasct
== 1 && !j
->readers
&& !j
->writers
) {
1997 j
->psccr
.byte
= j
->pslic
.byte
= 0;
1998 j
->pslic
.bits
.powerdown
= 1;
1999 j
->psccr
.bits
.dev
= 3;
2000 j
->psccr
.bits
.rw
= 0;
2001 outw_p(j
->psccr
.byte
<< 8 | j
->pslic
.byte
, j
->XILINXbase
+ 0x00);
2002 ixj_PCcontrol_wait(j
);
2007 j
->flags
.pcmciascp
= 0;
2013 static int ixj_hookstate(IXJ
*j
)
2018 switch (j
->cardtype
) {
2021 fOffHook
= j
->gpio
.bits
.gpio3read
? 1 : 0;
2024 case QTI_PHONEJACK_LITE
:
2025 case QTI_PHONEJACK_PCI
:
2027 if(j
->cardtype
== QTI_LINEJACK
&& j
->flags
.pots_pstn
== 1 && (j
->readers
|| j
->writers
)) {
2028 fOffHook
= j
->pld_slicr
.bits
.potspstn
? 1 : 0;
2029 if(fOffHook
!= j
->p_hook
) {
2031 j
->checkwait
= jiffies
;
2033 if(time_before(jiffies
, j
->checkwait
+ 2)) {
2038 j
->p_hook
= fOffHook
;
2039 printk("IXJ : /dev/phone%d pots-pstn hookstate check %d at %ld\n", j
->board
, fOffHook
, jiffies
);
2042 if (j
->pld_slicr
.bits
.state
== PLD_SLIC_STATE_ACTIVE
||
2043 j
->pld_slicr
.bits
.state
== PLD_SLIC_STATE_STANDBY
) {
2044 if (j
->flags
.ringing
|| j
->flags
.cringing
) {
2045 if (!in_interrupt()) {
2046 det
= jiffies
+ (hertz
/ 50);
2047 while (time_before(jiffies
, det
)) {
2048 set_current_state(TASK_INTERRUPTIBLE
);
2049 schedule_timeout(1);
2053 if (j
->pld_slicr
.bits
.state
== PLD_SLIC_STATE_RINGING
) {
2057 if (j
->cardtype
== QTI_PHONEJACK_PCI
) {
2058 j
->pld_scrr
.byte
= inb_p(j
->XILINXbase
);
2059 fOffHook
= j
->pld_scrr
.pcib
.det
? 1 : 0;
2061 fOffHook
= j
->pld_slicr
.bits
.det
? 1 : 0;
2066 fOffHook
= ixj_pcmcia_cable_check(j
);
2069 if (j
->r_hook
!= fOffHook
) {
2070 j
->r_hook
= fOffHook
;
2071 if (j
->port
== PORT_SPEAKER
|| j
->port
== PORT_HANDSET
) { // || (j->port == PORT_PSTN && j->flags.pots_pstn == 0)) {
2072 j
->ex
.bits
.hookstate
= 1;
2073 ixj_kill_fasync(j
, SIG_HOOKSTATE
, POLL_IN
);
2074 } else if (!fOffHook
) {
2075 j
->flash_end
= jiffies
+ ((60 * hertz
) / 100);
2079 if(time_before(jiffies
, j
->flash_end
)) {
2080 j
->ex
.bits
.flash
= 1;
2082 ixj_kill_fasync(j
, SIG_FLASH
, POLL_IN
);
2085 if(time_before(jiffies
, j
->flash_end
)) {
2090 if (j
->port
== PORT_PSTN
&& j
->daa_mode
== SOP_PU_CONVERSATION
)
2093 if (j
->port
== PORT_SPEAKER
) {
2094 if(j
->cardtype
== QTI_PHONECARD
) {
2095 if(j
->flags
.pcmciascp
&& j
->flags
.pcmciasct
) {
2103 if (j
->port
== PORT_HANDSET
)
2109 static void ixj_ring_off(IXJ
*j
)
2111 if (j
->dsp
.low
== 0x20) /* Internet PhoneJACK */
2113 if (ixjdebug
& 0x0004)
2114 printk(KERN_INFO
"IXJ Ring Off\n");
2115 j
->gpio
.bytes
.high
= 0x0B;
2116 j
->gpio
.bytes
.low
= 0x00;
2117 j
->gpio
.bits
.gpio1
= 0;
2118 j
->gpio
.bits
.gpio2
= 1;
2119 j
->gpio
.bits
.gpio5
= 0;
2120 ixj_WriteDSPCommand(j
->gpio
.word
, j
);
2121 } else /* Internet LineJACK */
2123 if (ixjdebug
& 0x0004)
2124 printk(KERN_INFO
"IXJ Ring Off\n");
2126 if(!j
->flags
.cidplay
)
2127 SLIC_SetState(PLD_SLIC_STATE_STANDBY
, j
);
2133 static void ixj_ring_start(IXJ
*j
)
2135 j
->flags
.cringing
= 1;
2136 if (ixjdebug
& 0x0004)
2137 printk(KERN_INFO
"IXJ Cadence Ringing Start /dev/phone%d\n", j
->board
);
2138 if (ixj_hookstate(j
) & 1) {
2139 if (j
->port
== PORT_POTS
)
2141 j
->flags
.cringing
= 0;
2142 if (ixjdebug
& 0x0004)
2143 printk(KERN_INFO
"IXJ Cadence Ringing Stopped /dev/phone%d off hook\n", j
->board
);
2144 } else if(j
->cadence_f
[5].enable
&& (!j
->cadence_f
[5].en_filter
)) {
2145 j
->ring_cadence_jif
= jiffies
;
2146 j
->flags
.cidsent
= j
->flags
.cidring
= 0;
2147 j
->cadence_f
[5].state
= 0;
2148 if(j
->cadence_f
[5].on1
)
2151 j
->ring_cadence_jif
= jiffies
;
2152 j
->ring_cadence_t
= 15;
2153 if (j
->ring_cadence
& 1 << j
->ring_cadence_t
) {
2158 j
->flags
.cidsent
= j
->flags
.cidring
= j
->flags
.firstring
= 0;
2162 static int ixj_ring(IXJ
*j
)
2165 unsigned long jif
, det
;
2167 j
->flags
.ringing
= 1;
2168 if (ixj_hookstate(j
) & 1) {
2170 j
->flags
.ringing
= 0;
2174 for (cntr
= 0; cntr
< j
->maxrings
; cntr
++) {
2175 jif
= jiffies
+ (1 * hertz
);
2177 while (time_before(jiffies
, jif
)) {
2178 if (ixj_hookstate(j
) & 1) {
2180 j
->flags
.ringing
= 0;
2183 set_current_state(TASK_INTERRUPTIBLE
);
2184 schedule_timeout(1);
2185 if (signal_pending(current
))
2188 jif
= jiffies
+ (3 * hertz
);
2190 while (time_before(jiffies
, jif
)) {
2191 if (ixj_hookstate(j
) & 1) {
2192 det
= jiffies
+ (hertz
/ 100);
2193 while (time_before(jiffies
, det
)) {
2194 set_current_state(TASK_INTERRUPTIBLE
);
2195 schedule_timeout(1);
2196 if (signal_pending(current
))
2199 if (ixj_hookstate(j
) & 1) {
2200 j
->flags
.ringing
= 0;
2204 set_current_state(TASK_INTERRUPTIBLE
);
2205 schedule_timeout(1);
2206 if (signal_pending(current
))
2211 j
->flags
.ringing
= 0;
2215 static int ixj_open(struct phone_device
*p
, struct file
*file_p
)
2217 IXJ
*j
= get_ixj(p
->board
);
2218 file_p
->private_data
= j
;
2223 if (file_p
->f_mode
& FMODE_READ
) {
2231 if (file_p
->f_mode
& FMODE_WRITE
) {
2235 if (file_p
->f_mode
& FMODE_READ
){
2242 if (j
->cardtype
== QTI_PHONECARD
) {
2243 j
->pslic
.bits
.powerdown
= 0;
2244 j
->psccr
.bits
.dev
= 3;
2245 j
->psccr
.bits
.rw
= 0;
2246 outw_p(j
->psccr
.byte
<< 8 | j
->pslic
.byte
, j
->XILINXbase
+ 0x00);
2247 ixj_PCcontrol_wait(j
);
2250 j
->flags
.cidplay
= 0;
2251 j
->flags
.cidcw_ack
= 0;
2253 if (ixjdebug
& 0x0002)
2254 printk(KERN_INFO
"Opening board %d\n", p
->board
);
2256 j
->framesread
= j
->frameswritten
= 0;
2260 int ixj_release(struct inode
*inode
, struct file
*file_p
)
2264 IXJ
*j
= file_p
->private_data
;
2265 int board
= j
->p
.board
;
2268 * Set up locks to ensure that only one process is talking to the DSP at a time.
2269 * This is necessary to keep the DSP from locking up.
2271 while(test_and_set_bit(board
, (void *)&j
->busyflags
) != 0) {
2272 set_current_state(TASK_INTERRUPTIBLE
);
2273 schedule_timeout(1);
2275 if (ixjdebug
& 0x0002)
2276 printk(KERN_INFO
"Closing board %d\n", NUM(inode
));
2278 if (j
->cardtype
== QTI_PHONECARD
)
2279 ixj_set_port(j
, PORT_SPEAKER
);
2281 ixj_set_port(j
, PORT_POTS
);
2286 set_play_volume(j
, 0x100);
2287 set_rec_volume(j
, 0x100);
2290 /* Restore the tone table to default settings. */
2296 ixj_init_tone(j
, &ti
);
2302 ixj_init_tone(j
, &ti
);
2308 ixj_init_tone(j
, &ti
);
2314 ixj_init_tone(j
, &ti
);
2320 ixj_init_tone(j
, &ti
);
2326 ixj_init_tone(j
, &ti
);
2332 ixj_init_tone(j
, &ti
);
2338 ixj_init_tone(j
, &ti
);
2344 ixj_init_tone(j
, &ti
);
2350 ixj_init_tone(j
, &ti
);
2356 ixj_init_tone(j
, &ti
);
2362 ixj_init_tone(j
, &ti
);
2368 ixj_init_tone(j
, &ti
);
2374 ixj_init_tone(j
, &ti
);
2380 ixj_init_tone(j
, &ti
);
2386 ixj_init_tone(j
, &ti
);
2392 ixj_init_tone(j
, &ti
);
2398 ixj_init_tone(j
, &ti
);
2400 set_rec_depth(j
, 2); /* Set Record Channel Limit to 2 frames */
2402 set_play_depth(j
, 2); /* Set Playback Channel Limit to 2 frames */
2404 j
->ex
.bits
.dtmf_ready
= 0;
2406 j
->dtmf_wp
= j
->dtmf_rp
= 0;
2407 j
->rec_mode
= j
->play_mode
= -1;
2408 j
->flags
.ringing
= 0;
2409 j
->maxrings
= MAXRINGS
;
2410 j
->ring_cadence
= USA_RING_CADENCE
;
2411 if(j
->cadence_f
[5].enable
) {
2412 j
->cadence_f
[5].enable
= j
->cadence_f
[5].en_filter
= j
->cadence_f
[5].state
= 0;
2416 j
->flags
.dtmf_oob
= 0;
2417 for (cnt
= 0; cnt
< 4; cnt
++)
2418 j
->cadence_f
[cnt
].enable
= 0;
2422 if(j
->cardtype
== QTI_PHONECARD
) {
2423 SLIC_SetState(PLD_SLIC_STATE_OC
, j
);
2426 if (file_p
->f_mode
& FMODE_READ
)
2428 if (file_p
->f_mode
& FMODE_WRITE
)
2431 if (j
->read_buffer
&& !j
->readers
) {
2432 kfree(j
->read_buffer
);
2433 j
->read_buffer
= NULL
;
2434 j
->read_buffer_size
= 0;
2436 if (j
->write_buffer
&& !j
->writers
) {
2437 kfree(j
->write_buffer
);
2438 j
->write_buffer
= NULL
;
2439 j
->write_buffer_size
= 0;
2441 j
->rec_codec
= j
->play_codec
= 0;
2442 j
->rec_frame_size
= j
->play_frame_size
= 0;
2443 j
->flags
.cidsent
= j
->flags
.cidring
= 0;
2444 ixj_fasync(-1, file_p
, 0); /* remove from list of async notification */
2446 if(j
->cardtype
== QTI_LINEJACK
&& !j
->readers
&& !j
->writers
) {
2447 ixj_set_port(j
, PORT_PSTN
);
2448 daa_set_mode(j
, SOP_PU_SLEEP
);
2451 ixj_WriteDSPCommand(0x0FE3, j
); /* Put the DSP in 1/5 power mode. */
2453 /* Set up the default signals for events */
2454 for (cnt
= 0; cnt
< 35; cnt
++)
2455 j
->ixj_signals
[cnt
] = SIGIO
;
2457 /* Set the excetion signal enable flags */
2458 j
->ex_sig
.bits
.dtmf_ready
= j
->ex_sig
.bits
.hookstate
= j
->ex_sig
.bits
.flash
= j
->ex_sig
.bits
.pstn_ring
=
2459 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
=
2460 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;
2462 file_p
->private_data
= NULL
;
2463 clear_bit(board
, &j
->busyflags
);
2467 static int read_filters(IXJ
*j
)
2469 unsigned short fc
, cnt
, trg
;
2473 if (ixj_WriteDSPCommand(0x5144, j
)) {
2474 if(ixjdebug
& 0x0001) {
2475 printk(KERN_INFO
"Read Frame Counter failed!\n");
2479 fc
= j
->ssr
.high
<< 8 | j
->ssr
.low
;
2480 if (fc
== j
->frame_count
)
2483 j
->frame_count
= fc
;
2490 for (cnt
= 0; cnt
< 4; cnt
++) {
2491 if (ixj_WriteDSPCommand(0x5154 + cnt
, j
)) {
2492 if(ixjdebug
& 0x0001) {
2493 printk(KERN_INFO
"Select Filter %d failed!\n", cnt
);
2497 if (ixj_WriteDSPCommand(0x515C, j
)) {
2498 if(ixjdebug
& 0x0001) {
2499 printk(KERN_INFO
"Read Filter History %d failed!\n", cnt
);
2503 j
->filter_hist
[cnt
] = j
->ssr
.high
<< 8 | j
->ssr
.low
;
2505 if (j
->cadence_f
[cnt
].enable
) {
2506 if (j
->filter_hist
[cnt
] & 3 && !(j
->filter_hist
[cnt
] & 12)) {
2507 if (j
->cadence_f
[cnt
].state
== 0) {
2508 j
->cadence_f
[cnt
].state
= 1;
2509 j
->cadence_f
[cnt
].on1min
= jiffies
+ (long)((j
->cadence_f
[cnt
].on1
* (hertz
* (100 - var
)) / 10000));
2510 j
->cadence_f
[cnt
].on1dot
= jiffies
+ (long)((j
->cadence_f
[cnt
].on1
* (hertz
* (100)) / 10000));
2511 j
->cadence_f
[cnt
].on1max
= jiffies
+ (long)((j
->cadence_f
[cnt
].on1
* (hertz
* (100 + var
)) / 10000));
2512 } else if (j
->cadence_f
[cnt
].state
== 2 &&
2513 (time_after(jiffies
, j
->cadence_f
[cnt
].off1min
) &&
2514 time_before(jiffies
, j
->cadence_f
[cnt
].off1max
))) {
2515 if (j
->cadence_f
[cnt
].on2
) {
2516 j
->cadence_f
[cnt
].state
= 3;
2517 j
->cadence_f
[cnt
].on2min
= jiffies
+ (long)((j
->cadence_f
[cnt
].on2
* (hertz
* (100 - var
)) / 10000));
2518 j
->cadence_f
[cnt
].on2dot
= jiffies
+ (long)((j
->cadence_f
[cnt
].on2
* (hertz
* (100)) / 10000));
2519 j
->cadence_f
[cnt
].on2max
= jiffies
+ (long)((j
->cadence_f
[cnt
].on2
* (hertz
* (100 + var
)) / 10000));
2521 j
->cadence_f
[cnt
].state
= 7;
2523 } else if (j
->cadence_f
[cnt
].state
== 4 &&
2524 (time_after(jiffies
, j
->cadence_f
[cnt
].off2min
) &&
2525 time_before(jiffies
, j
->cadence_f
[cnt
].off2max
))) {
2526 if (j
->cadence_f
[cnt
].on3
) {
2527 j
->cadence_f
[cnt
].state
= 5;
2528 j
->cadence_f
[cnt
].on3min
= jiffies
+ (long)((j
->cadence_f
[cnt
].on3
* (hertz
* (100 - var
)) / 10000));
2529 j
->cadence_f
[cnt
].on3dot
= jiffies
+ (long)((j
->cadence_f
[cnt
].on3
* (hertz
* (100)) / 10000));
2530 j
->cadence_f
[cnt
].on3max
= jiffies
+ (long)((j
->cadence_f
[cnt
].on3
* (hertz
* (100 + var
)) / 10000));
2532 j
->cadence_f
[cnt
].state
= 7;
2535 j
->cadence_f
[cnt
].state
= 0;
2537 } else if (j
->filter_hist
[cnt
] & 12 && !(j
->filter_hist
[cnt
] & 3)) {
2538 if (j
->cadence_f
[cnt
].state
== 1) {
2539 if(!j
->cadence_f
[cnt
].on1
) {
2540 j
->cadence_f
[cnt
].state
= 7;
2541 } else if((time_after(jiffies
, j
->cadence_f
[cnt
].on1min
) &&
2542 time_before(jiffies
, j
->cadence_f
[cnt
].on1max
))) {
2543 if(j
->cadence_f
[cnt
].off1
) {
2544 j
->cadence_f
[cnt
].state
= 2;
2545 j
->cadence_f
[cnt
].off1min
= jiffies
+ (long)((j
->cadence_f
[cnt
].off1
* (hertz
* (100 - var
)) / 10000));
2546 j
->cadence_f
[cnt
].off1dot
= jiffies
+ (long)((j
->cadence_f
[cnt
].off1
* (hertz
* (100)) / 10000));
2547 j
->cadence_f
[cnt
].off1max
= jiffies
+ (long)((j
->cadence_f
[cnt
].off1
* (hertz
* (100 + var
)) / 10000));
2549 j
->cadence_f
[cnt
].state
= 7;
2552 j
->cadence_f
[cnt
].state
= 0;
2554 } else if (j
->cadence_f
[cnt
].state
== 3) {
2555 if((time_after(jiffies
, j
->cadence_f
[cnt
].on2min
) &&
2556 time_before(jiffies
, j
->cadence_f
[cnt
].on2max
))) {
2557 if(j
->cadence_f
[cnt
].off2
) {
2558 j
->cadence_f
[cnt
].state
= 4;
2559 j
->cadence_f
[cnt
].off2min
= jiffies
+ (long)((j
->cadence_f
[cnt
].off2
* (hertz
* (100 - var
)) / 10000));
2560 j
->cadence_f
[cnt
].off2dot
= jiffies
+ (long)((j
->cadence_f
[cnt
].off2
* (hertz
* (100)) / 10000));
2561 j
->cadence_f
[cnt
].off2max
= jiffies
+ (long)((j
->cadence_f
[cnt
].off2
* (hertz
* (100 + var
)) / 10000));
2563 j
->cadence_f
[cnt
].state
= 7;
2566 j
->cadence_f
[cnt
].state
= 0;
2568 } else if (j
->cadence_f
[cnt
].state
== 5) {
2569 if ((time_after(jiffies
, j
->cadence_f
[cnt
].on3min
) &&
2570 time_before(jiffies
, j
->cadence_f
[cnt
].on3max
))) {
2571 if(j
->cadence_f
[cnt
].off3
) {
2572 j
->cadence_f
[cnt
].state
= 6;
2573 j
->cadence_f
[cnt
].off3min
= jiffies
+ (long)((j
->cadence_f
[cnt
].off3
* (hertz
* (100 - var
)) / 10000));
2574 j
->cadence_f
[cnt
].off3dot
= jiffies
+ (long)((j
->cadence_f
[cnt
].off3
* (hertz
* (100)) / 10000));
2575 j
->cadence_f
[cnt
].off3max
= jiffies
+ (long)((j
->cadence_f
[cnt
].off3
* (hertz
* (100 + var
)) / 10000));
2577 j
->cadence_f
[cnt
].state
= 7;
2580 j
->cadence_f
[cnt
].state
= 0;
2583 j
->cadence_f
[cnt
].state
= 0;
2586 switch(j
->cadence_f
[cnt
].state
) {
2588 if(time_after(jiffies
, j
->cadence_f
[cnt
].on1dot
) &&
2589 !j
->cadence_f
[cnt
].off1
&&
2590 !j
->cadence_f
[cnt
].on2
&& !j
->cadence_f
[cnt
].off2
&&
2591 !j
->cadence_f
[cnt
].on3
&& !j
->cadence_f
[cnt
].off3
) {
2592 j
->cadence_f
[cnt
].state
= 7;
2596 if(time_after(jiffies
, j
->cadence_f
[cnt
].on2dot
) &&
2597 !j
->cadence_f
[cnt
].off2
&&
2598 !j
->cadence_f
[cnt
].on3
&& !j
->cadence_f
[cnt
].off3
) {
2599 j
->cadence_f
[cnt
].state
= 7;
2603 if(time_after(jiffies
, j
->cadence_f
[cnt
].on3dot
) &&
2604 !j
->cadence_f
[cnt
].off3
) {
2605 j
->cadence_f
[cnt
].state
= 7;
2611 if (ixjdebug
& 0x0040) {
2612 printk(KERN_INFO
"IXJ Tone Cadence state = %d /dev/phone%d at %ld\n", j
->cadence_f
[cnt
].state
, j
->board
, jiffies
);
2613 switch(j
->cadence_f
[cnt
].state
) {
2615 printk(KERN_INFO
"IXJ /dev/phone%d No Tone detected\n", j
->board
);
2618 printk(KERN_INFO
"IXJ /dev/phone%d Next Tone Cadence state at %u %ld - %ld - %ld\n", j
->board
,
2619 j
->cadence_f
[cnt
].on1
, j
->cadence_f
[cnt
].on1min
, j
->cadence_f
[cnt
].on1dot
, j
->cadence_f
[cnt
].on1max
);
2622 printk(KERN_INFO
"IXJ /dev/phone%d Next Tone Cadence state at %ld - %ld\n", j
->board
, j
->cadence_f
[cnt
].off1min
,
2623 j
->cadence_f
[cnt
].off1max
);
2626 printk(KERN_INFO
"IXJ /dev/phone%d Next Tone Cadence state at %ld - %ld\n", j
->board
, j
->cadence_f
[cnt
].on2min
,
2627 j
->cadence_f
[cnt
].on2max
);
2630 printk(KERN_INFO
"IXJ /dev/phone%d Next Tone Cadence state at %ld - %ld\n", j
->board
, j
->cadence_f
[cnt
].off2min
,
2631 j
->cadence_f
[cnt
].off2max
);
2634 printk(KERN_INFO
"IXJ /dev/phone%d Next Tone Cadence state at %ld - %ld\n", j
->board
, j
->cadence_f
[cnt
].on3min
,
2635 j
->cadence_f
[cnt
].on3max
);
2638 printk(KERN_INFO
"IXJ /dev/phone%d Next Tone Cadence state at %ld - %ld\n", j
->board
, j
->cadence_f
[cnt
].off3min
,
2639 j
->cadence_f
[cnt
].off3max
);
2644 if (j
->cadence_f
[cnt
].state
== 7) {
2645 j
->cadence_f
[cnt
].state
= 0;
2646 if (j
->cadence_f
[cnt
].enable
== 1)
2647 j
->cadence_f
[cnt
].enable
= 0;
2650 if(ixjdebug
& 0x0020) {
2651 printk(KERN_INFO
"Filter Cadence 0 triggered %ld\n", jiffies
);
2654 ixj_kill_fasync(j
, SIG_FC0
, POLL_IN
);
2657 if(ixjdebug
& 0x0020) {
2658 printk(KERN_INFO
"Filter Cadence 1 triggered %ld\n", jiffies
);
2661 ixj_kill_fasync(j
, SIG_FC1
, POLL_IN
);
2664 if(ixjdebug
& 0x0020) {
2665 printk(KERN_INFO
"Filter Cadence 2 triggered %ld\n", jiffies
);
2668 ixj_kill_fasync(j
, SIG_FC2
, POLL_IN
);
2671 if(ixjdebug
& 0x0020) {
2672 printk(KERN_INFO
"Filter Cadence 3 triggered %ld\n", jiffies
);
2675 ixj_kill_fasync(j
, SIG_FC3
, POLL_IN
);
2679 if (j
->filter_en
[cnt
] && ((j
->filter_hist
[cnt
] & 3 && !(j
->filter_hist
[cnt
] & 12)) ||
2680 (j
->filter_hist
[cnt
] & 12 && !(j
->filter_hist
[cnt
] & 3)))) {
2681 if((j
->filter_hist
[cnt
] & 3 && !(j
->filter_hist
[cnt
] & 12))) {
2683 } else if((j
->filter_hist
[cnt
] & 12 && !(j
->filter_hist
[cnt
] & 3))) {
2688 if(ixjdebug
& 0x0020) {
2689 printk(KERN_INFO
"Filter 0 triggered %d at %ld\n", trg
, jiffies
);
2692 ixj_kill_fasync(j
, SIG_F0
, POLL_IN
);
2695 if(ixjdebug
& 0x0020) {
2696 printk(KERN_INFO
"Filter 1 triggered %d at %ld\n", trg
, jiffies
);
2699 ixj_kill_fasync(j
, SIG_F1
, POLL_IN
);
2702 if(ixjdebug
& 0x0020) {
2703 printk(KERN_INFO
"Filter 2 triggered %d at %ld\n", trg
, jiffies
);
2706 ixj_kill_fasync(j
, SIG_F2
, POLL_IN
);
2709 if(ixjdebug
& 0x0020) {
2710 printk(KERN_INFO
"Filter 3 triggered %d at %ld\n", trg
, jiffies
);
2713 ixj_kill_fasync(j
, SIG_F3
, POLL_IN
);
2721 static int LineMonitor(IXJ
*j
)
2728 if (ixj_WriteDSPCommand(0x7000, j
)) /* Line Monitor */
2731 j
->dtmf
.bytes
.high
= j
->ssr
.high
;
2732 j
->dtmf
.bytes
.low
= j
->ssr
.low
;
2733 if (!j
->dtmf_state
&& j
->dtmf
.bits
.dtmf_valid
) {
2735 j
->dtmf_current
= j
->dtmf
.bits
.digit
;
2737 if (j
->dtmf_state
&& !j
->dtmf
.bits
.dtmf_valid
) /* && j->dtmf_wp != j->dtmf_rp) */
2739 if(!j
->cidcw_wait
) {
2740 j
->dtmfbuffer
[j
->dtmf_wp
] = j
->dtmf_current
;
2742 if (j
->dtmf_wp
== 79)
2744 j
->ex
.bits
.dtmf_ready
= 1;
2745 if(j
->ex_sig
.bits
.dtmf_ready
) {
2746 ixj_kill_fasync(j
, SIG_DTMF_READY
, POLL_IN
);
2749 else if(j
->dtmf_current
== 0x00 || j
->dtmf_current
== 0x0D) {
2750 if(ixjdebug
& 0x0020) {
2751 printk("IXJ phone%d saw CIDCW Ack DTMF %d from display at %ld\n", j
->board
, j
->dtmf_current
, jiffies
);
2753 j
->flags
.cidcw_ack
= 1;
2762 /************************************************************************
2764 * Functions to allow alaw <-> ulaw conversions.
2766 ************************************************************************/
2768 static void ulaw2alaw(unsigned char *buff
, unsigned long len
)
2770 static unsigned char table_ulaw2alaw
[] =
2772 0x2A, 0x2B, 0x28, 0x29, 0x2E, 0x2F, 0x2C, 0x2D,
2773 0x22, 0x23, 0x20, 0x21, 0x26, 0x27, 0x24, 0x25,
2774 0x3A, 0x3B, 0x38, 0x39, 0x3E, 0x3F, 0x3C, 0x3D,
2775 0x32, 0x33, 0x30, 0x31, 0x36, 0x37, 0x34, 0x35,
2776 0x0B, 0x08, 0x09, 0x0E, 0x0F, 0x0C, 0x0D, 0x02,
2777 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05, 0x1A,
2778 0x1B, 0x18, 0x19, 0x1E, 0x1F, 0x1C, 0x1D, 0x12,
2779 0x13, 0x10, 0x11, 0x16, 0x17, 0x14, 0x15, 0x6B,
2780 0x68, 0x69, 0x6E, 0x6F, 0x6C, 0x6D, 0x62, 0x63,
2781 0x60, 0x61, 0x66, 0x67, 0x64, 0x65, 0x7B, 0x79,
2782 0x7E, 0x7F, 0x7C, 0x7D, 0x72, 0x73, 0x70, 0x71,
2783 0x76, 0x77, 0x74, 0x75, 0x4B, 0x49, 0x4F, 0x4D,
2784 0x42, 0x43, 0x40, 0x41, 0x46, 0x47, 0x44, 0x45,
2785 0x5A, 0x5B, 0x58, 0x59, 0x5E, 0x5F, 0x5C, 0x5D,
2786 0x52, 0x52, 0x53, 0x53, 0x50, 0x50, 0x51, 0x51,
2787 0x56, 0x56, 0x57, 0x57, 0x54, 0x54, 0x55, 0xD5,
2788 0xAA, 0xAB, 0xA8, 0xA9, 0xAE, 0xAF, 0xAC, 0xAD,
2789 0xA2, 0xA3, 0xA0, 0xA1, 0xA6, 0xA7, 0xA4, 0xA5,
2790 0xBA, 0xBB, 0xB8, 0xB9, 0xBE, 0xBF, 0xBC, 0xBD,
2791 0xB2, 0xB3, 0xB0, 0xB1, 0xB6, 0xB7, 0xB4, 0xB5,
2792 0x8B, 0x88, 0x89, 0x8E, 0x8F, 0x8C, 0x8D, 0x82,
2793 0x83, 0x80, 0x81, 0x86, 0x87, 0x84, 0x85, 0x9A,
2794 0x9B, 0x98, 0x99, 0x9E, 0x9F, 0x9C, 0x9D, 0x92,
2795 0x93, 0x90, 0x91, 0x96, 0x97, 0x94, 0x95, 0xEB,
2796 0xE8, 0xE9, 0xEE, 0xEF, 0xEC, 0xED, 0xE2, 0xE3,
2797 0xE0, 0xE1, 0xE6, 0xE7, 0xE4, 0xE5, 0xFB, 0xF9,
2798 0xFE, 0xFF, 0xFC, 0xFD, 0xF2, 0xF3, 0xF0, 0xF1,
2799 0xF6, 0xF7, 0xF4, 0xF5, 0xCB, 0xC9, 0xCF, 0xCD,
2800 0xC2, 0xC3, 0xC0, 0xC1, 0xC6, 0xC7, 0xC4, 0xC5,
2801 0xDA, 0xDB, 0xD8, 0xD9, 0xDE, 0xDF, 0xDC, 0xDD,
2802 0xD2, 0xD2, 0xD3, 0xD3, 0xD0, 0xD0, 0xD1, 0xD1,
2803 0xD6, 0xD6, 0xD7, 0xD7, 0xD4, 0xD4, 0xD5, 0xD5
2808 *buff
= table_ulaw2alaw
[*(unsigned char *)buff
];
2813 static void alaw2ulaw(unsigned char *buff
, unsigned long len
)
2815 static unsigned char table_alaw2ulaw
[] =
2817 0x29, 0x2A, 0x27, 0x28, 0x2D, 0x2E, 0x2B, 0x2C,
2818 0x21, 0x22, 0x1F, 0x20, 0x25, 0x26, 0x23, 0x24,
2819 0x39, 0x3A, 0x37, 0x38, 0x3D, 0x3E, 0x3B, 0x3C,
2820 0x31, 0x32, 0x2F, 0x30, 0x35, 0x36, 0x33, 0x34,
2821 0x0A, 0x0B, 0x08, 0x09, 0x0E, 0x0F, 0x0C, 0x0D,
2822 0x02, 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05,
2823 0x1A, 0x1B, 0x18, 0x19, 0x1E, 0x1F, 0x1C, 0x1D,
2824 0x12, 0x13, 0x10, 0x11, 0x16, 0x17, 0x14, 0x15,
2825 0x62, 0x63, 0x60, 0x61, 0x66, 0x67, 0x64, 0x65,
2826 0x5D, 0x5D, 0x5C, 0x5C, 0x5F, 0x5F, 0x5E, 0x5E,
2827 0x74, 0x76, 0x70, 0x72, 0x7C, 0x7E, 0x78, 0x7A,
2828 0x6A, 0x6B, 0x68, 0x69, 0x6E, 0x6F, 0x6C, 0x6D,
2829 0x48, 0x49, 0x46, 0x47, 0x4C, 0x4D, 0x4A, 0x4B,
2830 0x40, 0x41, 0x3F, 0x3F, 0x44, 0x45, 0x42, 0x43,
2831 0x56, 0x57, 0x54, 0x55, 0x5A, 0x5B, 0x58, 0x59,
2832 0x4F, 0x4F, 0x4E, 0x4E, 0x52, 0x53, 0x50, 0x51,
2833 0xA9, 0xAA, 0xA7, 0xA8, 0xAD, 0xAE, 0xAB, 0xAC,
2834 0xA1, 0xA2, 0x9F, 0xA0, 0xA5, 0xA6, 0xA3, 0xA4,
2835 0xB9, 0xBA, 0xB7, 0xB8, 0xBD, 0xBE, 0xBB, 0xBC,
2836 0xB1, 0xB2, 0xAF, 0xB0, 0xB5, 0xB6, 0xB3, 0xB4,
2837 0x8A, 0x8B, 0x88, 0x89, 0x8E, 0x8F, 0x8C, 0x8D,
2838 0x82, 0x83, 0x80, 0x81, 0x86, 0x87, 0x84, 0x85,
2839 0x9A, 0x9B, 0x98, 0x99, 0x9E, 0x9F, 0x9C, 0x9D,
2840 0x92, 0x93, 0x90, 0x91, 0x96, 0x97, 0x94, 0x95,
2841 0xE2, 0xE3, 0xE0, 0xE1, 0xE6, 0xE7, 0xE4, 0xE5,
2842 0xDD, 0xDD, 0xDC, 0xDC, 0xDF, 0xDF, 0xDE, 0xDE,
2843 0xF4, 0xF6, 0xF0, 0xF2, 0xFC, 0xFE, 0xF8, 0xFA,
2844 0xEA, 0xEB, 0xE8, 0xE9, 0xEE, 0xEF, 0xEC, 0xED,
2845 0xC8, 0xC9, 0xC6, 0xC7, 0xCC, 0xCD, 0xCA, 0xCB,
2846 0xC0, 0xC1, 0xBF, 0xBF, 0xC4, 0xC5, 0xC2, 0xC3,
2847 0xD6, 0xD7, 0xD4, 0xD5, 0xDA, 0xDB, 0xD8, 0xD9,
2848 0xCF, 0xCF, 0xCE, 0xCE, 0xD2, 0xD3, 0xD0, 0xD1
2853 *buff
= table_alaw2ulaw
[*(unsigned char *)buff
];
2858 static ssize_t
ixj_read(struct file
* file_p
, char __user
*buf
, size_t length
, loff_t
* ppos
)
2860 unsigned long i
= *ppos
;
2861 IXJ
* j
= get_ixj(NUM(file_p
->f_dentry
->d_inode
));
2863 DECLARE_WAITQUEUE(wait
, current
);
2865 if (j
->flags
.inread
)
2868 j
->flags
.inread
= 1;
2870 add_wait_queue(&j
->read_q
, &wait
);
2871 set_current_state(TASK_INTERRUPTIBLE
);
2874 while (!j
->read_buffer_ready
|| (j
->dtmf_state
&& j
->flags
.dtmf_oob
)) {
2876 if (file_p
->f_flags
& O_NONBLOCK
) {
2877 set_current_state(TASK_RUNNING
);
2878 remove_wait_queue(&j
->read_q
, &wait
);
2879 j
->flags
.inread
= 0;
2882 if (!ixj_hookstate(j
)) {
2883 set_current_state(TASK_RUNNING
);
2884 remove_wait_queue(&j
->read_q
, &wait
);
2885 j
->flags
.inread
= 0;
2888 interruptible_sleep_on(&j
->read_q
);
2889 if (signal_pending(current
)) {
2890 set_current_state(TASK_RUNNING
);
2891 remove_wait_queue(&j
->read_q
, &wait
);
2892 j
->flags
.inread
= 0;
2897 remove_wait_queue(&j
->read_q
, &wait
);
2898 set_current_state(TASK_RUNNING
);
2899 /* Don't ever copy more than the user asks */
2900 if(j
->rec_codec
== ALAW
)
2901 ulaw2alaw(j
->read_buffer
, min(length
, j
->read_buffer_size
));
2902 i
= copy_to_user(buf
, j
->read_buffer
, min(length
, j
->read_buffer_size
));
2903 j
->read_buffer_ready
= 0;
2905 j
->flags
.inread
= 0;
2908 j
->flags
.inread
= 0;
2909 return min(length
, j
->read_buffer_size
);
2913 static ssize_t
ixj_enhanced_read(struct file
* file_p
, char __user
*buf
, size_t length
,
2917 ssize_t read_retval
= 0;
2918 IXJ
*j
= get_ixj(NUM(file_p
->f_dentry
->d_inode
));
2920 pre_retval
= ixj_PreRead(j
, 0L);
2921 switch (pre_retval
) {
2923 read_retval
= ixj_read(file_p
, buf
, length
, ppos
);
2924 ixj_PostRead(j
, 0L);
2927 read_retval
= ixj_read(file_p
, buf
, length
, ppos
);
2930 ixj_PostRead(j
, 0L);
2933 read_retval
= pre_retval
;
2938 static ssize_t
ixj_write(struct file
*file_p
, const char __user
*buf
, size_t count
, loff_t
* ppos
)
2940 unsigned long i
= *ppos
;
2941 IXJ
*j
= file_p
->private_data
;
2943 DECLARE_WAITQUEUE(wait
, current
);
2945 if (j
->flags
.inwrite
)
2948 j
->flags
.inwrite
= 1;
2950 add_wait_queue(&j
->write_q
, &wait
);
2951 set_current_state(TASK_INTERRUPTIBLE
);
2955 while (!j
->write_buffers_empty
) {
2957 if (file_p
->f_flags
& O_NONBLOCK
) {
2958 set_current_state(TASK_RUNNING
);
2959 remove_wait_queue(&j
->write_q
, &wait
);
2960 j
->flags
.inwrite
= 0;
2963 if (!ixj_hookstate(j
)) {
2964 set_current_state(TASK_RUNNING
);
2965 remove_wait_queue(&j
->write_q
, &wait
);
2966 j
->flags
.inwrite
= 0;
2969 interruptible_sleep_on(&j
->write_q
);
2970 if (signal_pending(current
)) {
2971 set_current_state(TASK_RUNNING
);
2972 remove_wait_queue(&j
->write_q
, &wait
);
2973 j
->flags
.inwrite
= 0;
2977 set_current_state(TASK_RUNNING
);
2978 remove_wait_queue(&j
->write_q
, &wait
);
2979 if (j
->write_buffer_wp
+ count
>= j
->write_buffer_end
)
2980 j
->write_buffer_wp
= j
->write_buffer
;
2981 i
= copy_from_user(j
->write_buffer_wp
, buf
, min(count
, j
->write_buffer_size
));
2983 j
->flags
.inwrite
= 0;
2986 if(j
->play_codec
== ALAW
)
2987 alaw2ulaw(j
->write_buffer_wp
, min(count
, j
->write_buffer_size
));
2988 j
->flags
.inwrite
= 0;
2989 return min(count
, j
->write_buffer_size
);
2992 static ssize_t
ixj_enhanced_write(struct file
* file_p
, const char __user
*buf
, size_t count
, loff_t
* ppos
)
2995 ssize_t write_retval
= 0;
2997 IXJ
*j
= get_ixj(NUM(file_p
->f_dentry
->d_inode
));
2999 pre_retval
= ixj_PreWrite(j
, 0L);
3000 switch (pre_retval
) {
3002 write_retval
= ixj_write(file_p
, buf
, count
, ppos
);
3003 if (write_retval
> 0) {
3004 ixj_PostWrite(j
, 0L);
3005 j
->write_buffer_wp
+= write_retval
;
3006 j
->write_buffers_empty
--;
3010 write_retval
= ixj_write(file_p
, buf
, count
, ppos
);
3011 if (write_retval
> 0) {
3012 j
->write_buffer_wp
+= write_retval
;
3013 j
->write_buffers_empty
--;
3017 ixj_PostWrite(j
, 0L);
3020 write_retval
= pre_retval
;
3022 return write_retval
;
3025 static void ixj_read_frame(IXJ
*j
)
3029 if (j
->read_buffer
) {
3030 for (cnt
= 0; cnt
< j
->rec_frame_size
* 2; cnt
+= 2) {
3031 if (!(cnt
% 16) && !IsRxReady(j
)) {
3033 while (!IsRxReady(j
)) {
3041 /* Throw away word 0 of the 8021 compressed format to get standard G.729. */
3042 if (j
->rec_codec
== G729
&& (cnt
== 0 || cnt
== 10 || cnt
== 20)) {
3043 inb_p(j
->DSPbase
+ 0x0E);
3044 inb_p(j
->DSPbase
+ 0x0F);
3046 *(j
->read_buffer
+ cnt
) = inb_p(j
->DSPbase
+ 0x0E);
3047 *(j
->read_buffer
+ cnt
+ 1) = inb_p(j
->DSPbase
+ 0x0F);
3050 if (j
->intercom
!= -1) {
3051 if (IsTxReady(get_ixj(j
->intercom
))) {
3052 for (cnt
= 0; cnt
< j
->rec_frame_size
* 2; cnt
+= 2) {
3053 if (!(cnt
% 16) && !IsTxReady(j
)) {
3055 while (!IsTxReady(j
)) {
3063 outb_p(*(j
->read_buffer
+ cnt
), get_ixj(j
->intercom
)->DSPbase
+ 0x0C);
3064 outb_p(*(j
->read_buffer
+ cnt
+ 1), get_ixj(j
->intercom
)->DSPbase
+ 0x0D);
3066 get_ixj(j
->intercom
)->frameswritten
++;
3069 j
->read_buffer_ready
= 1;
3070 wake_up_interruptible(&j
->read_q
); /* Wake any blocked readers */
3072 wake_up_interruptible(&j
->poll_q
); /* Wake any blocked selects */
3074 if(j
->ixj_signals
[SIG_READ_READY
])
3075 ixj_kill_fasync(j
, SIG_READ_READY
, POLL_OUT
);
3080 static short fsk
[][6][20] =
3084 0, 17846, 29934, 32364, 24351, 8481, -10126, -25465, -32587, -29196,
3085 -16384, 1715, 19260, 30591, 32051, 23170, 6813, -11743, -26509, -32722
3088 -28377, -14876, 3425, 20621, 31163, 31650, 21925, 5126, -13328, -27481,
3089 -32767, -27481, -13328, 5126, 21925, 31650, 31163, 20621, 3425, -14876
3092 -28377, -32722, -26509, -11743, 6813, 23170, 32051, 30591, 19260, 1715,
3093 -16384, -29196, -32587, -25465, -10126, 8481, 24351, 32364, 29934, 17846
3096 0, -17846, -29934, -32364, -24351, -8481, 10126, 25465, 32587, 29196,
3097 16384, -1715, -19260, -30591, -32051, -23170, -6813, 11743, 26509, 32722
3100 28377, 14876, -3425, -20621, -31163, -31650, -21925, -5126, 13328, 27481,
3101 32767, 27481, 13328, -5126, -21925, -31650, -31163, -20621, -3425, 14876
3104 28377, 32722, 26509, 11743, -6813, -23170, -32051, -30591, -19260, -1715,
3105 16384, 29196, 32587, 25465, 10126, -8481, -24351, -32364, -29934, -17846
3110 0, 10126, 19260, 26509, 31163, 32767, 31163, 26509, 19260, 10126,
3111 0, -10126, -19260, -26509, -31163, -32767, -31163, -26509, -19260, -10126
3114 -28377, -21925, -13328, -3425, 6813, 16384, 24351, 29934, 32587, 32051,
3115 28377, 21925, 13328, 3425, -6813, -16384, -24351, -29934, -32587, -32051
3118 -28377, -32051, -32587, -29934, -24351, -16384, -6813, 3425, 13328, 21925,
3119 28377, 32051, 32587, 29934, 24351, 16384, 6813, -3425, -13328, -21925
3122 0, -10126, -19260, -26509, -31163, -32767, -31163, -26509, -19260, -10126,
3123 0, 10126, 19260, 26509, 31163, 32767, 31163, 26509, 19260, 10126
3126 28377, 21925, 13328, 3425, -6813, -16383, -24351, -29934, -32587, -32051,
3127 -28377, -21925, -13328, -3425, 6813, 16383, 24351, 29934, 32587, 32051
3130 28377, 32051, 32587, 29934, 24351, 16384, 6813, -3425, -13328, -21925,
3131 -28377, -32051, -32587, -29934, -24351, -16384, -6813, 3425, 13328, 21925
3137 static void ixj_write_cid_bit(IXJ
*j
, int bit
)
3139 while (j
->fskcnt
< 20) {
3140 if(j
->fskdcnt
< (j
->fsksize
- 1))
3141 j
->fskdata
[j
->fskdcnt
++] = fsk
[bit
][j
->fskz
][j
->fskcnt
];
3154 static void ixj_write_cid_byte(IXJ
*j
, char byte
)
3159 ixj_write_cid_bit(j
, 0);
3160 ixj_write_cid_bit(j
, cb
.cbits
.b0
? 1 : 0);
3161 ixj_write_cid_bit(j
, cb
.cbits
.b1
? 1 : 0);
3162 ixj_write_cid_bit(j
, cb
.cbits
.b2
? 1 : 0);
3163 ixj_write_cid_bit(j
, cb
.cbits
.b3
? 1 : 0);
3164 ixj_write_cid_bit(j
, cb
.cbits
.b4
? 1 : 0);
3165 ixj_write_cid_bit(j
, cb
.cbits
.b5
? 1 : 0);
3166 ixj_write_cid_bit(j
, cb
.cbits
.b6
? 1 : 0);
3167 ixj_write_cid_bit(j
, cb
.cbits
.b7
? 1 : 0);
3168 ixj_write_cid_bit(j
, 1);
3171 static void ixj_write_cid_seize(IXJ
*j
)
3175 for (cnt
= 0; cnt
< 150; cnt
++) {
3176 ixj_write_cid_bit(j
, 0);
3177 ixj_write_cid_bit(j
, 1);
3179 for (cnt
= 0; cnt
< 180; cnt
++) {
3180 ixj_write_cid_bit(j
, 1);
3184 static void ixj_write_cidcw_seize(IXJ
*j
)
3188 for (cnt
= 0; cnt
< 80; cnt
++) {
3189 ixj_write_cid_bit(j
, 1);
3193 static int ixj_write_cid_string(IXJ
*j
, char *s
, int checksum
)
3197 for (cnt
= 0; cnt
< strlen(s
); cnt
++) {
3198 ixj_write_cid_byte(j
, s
[cnt
]);
3199 checksum
= (checksum
+ s
[cnt
]);
3204 static void ixj_pad_fsk(IXJ
*j
, int pad
)
3208 for (cnt
= 0; cnt
< pad
; cnt
++) {
3209 if(j
->fskdcnt
< (j
->fsksize
- 1))
3210 j
->fskdata
[j
->fskdcnt
++] = 0x0000;
3212 for (cnt
= 0; cnt
< 720; cnt
++) {
3213 if(j
->fskdcnt
< (j
->fsksize
- 1))
3214 j
->fskdata
[j
->fskdcnt
++] = 0x0000;
3218 static void ixj_pre_cid(IXJ
*j
)
3220 j
->cid_play_codec
= j
->play_codec
;
3221 j
->cid_play_frame_size
= j
->play_frame_size
;
3222 j
->cid_play_volume
= get_play_volume(j
);
3223 j
->cid_play_flag
= j
->flags
.playing
;
3225 j
->cid_rec_codec
= j
->rec_codec
;
3226 j
->cid_rec_volume
= get_rec_volume(j
);
3227 j
->cid_rec_flag
= j
->flags
.recording
;
3229 j
->cid_play_aec_level
= j
->aec_level
;
3231 switch(j
->baseframe
.low
) {
3233 j
->cid_base_frame_size
= 20;
3236 j
->cid_base_frame_size
= 10;
3239 j
->cid_base_frame_size
= 30;
3246 j
->flags
.cidplay
= 1;
3248 set_base_frame(j
, 30);
3249 set_play_codec(j
, LINEAR16
);
3250 set_play_volume(j
, 0x1B);
3254 static void ixj_post_cid(IXJ
*j
)
3258 if(j
->cidsize
> 5000) {
3259 SLIC_SetState(PLD_SLIC_STATE_STANDBY
, j
);
3261 j
->flags
.cidplay
= 0;
3262 if(ixjdebug
& 0x0200) {
3263 printk("IXJ phone%d Finished Playing CallerID data %ld\n", j
->board
, jiffies
);
3269 set_base_frame(j
, j
->cid_base_frame_size
);
3270 set_play_codec(j
, j
->cid_play_codec
);
3271 ixj_aec_start(j
, j
->cid_play_aec_level
);
3272 set_play_volume(j
, j
->cid_play_volume
);
3274 set_rec_codec(j
, j
->cid_rec_codec
);
3275 set_rec_volume(j
, j
->cid_rec_volume
);
3278 ixj_record_start(j
);
3280 if(j
->cid_play_flag
)
3283 if(j
->cid_play_flag
) {
3284 wake_up_interruptible(&j
->write_q
); /* Wake any blocked writers */
3288 static void ixj_write_cid(IXJ
*j
)
3293 char mdmflen
, len1
, len2
, len3
;
3298 if (j
->dsp
.low
== 0x20 || j
->flags
.cidplay
)
3301 j
->fskz
= j
->fskphase
= j
->fskcnt
= j
->fskdcnt
= 0;
3302 j
->cidsize
= j
->cidcnt
= 0;
3306 strcpy(sdmf1
, j
->cid_send
.month
);
3307 strcat(sdmf1
, j
->cid_send
.day
);
3308 strcat(sdmf1
, j
->cid_send
.hour
);
3309 strcat(sdmf1
, j
->cid_send
.min
);
3310 strcpy(sdmf2
, j
->cid_send
.number
);
3311 strcpy(sdmf3
, j
->cid_send
.name
);
3313 len1
= strlen(sdmf1
);
3314 len2
= strlen(sdmf2
);
3315 len3
= strlen(sdmf3
);
3316 mdmflen
= len1
+ len2
+ len3
+ 6;
3319 ixj_write_cid_seize(j
);
3321 ixj_write_cid_byte(j
, 0x80);
3323 ixj_write_cid_byte(j
, mdmflen
);
3324 checksum
= checksum
+ mdmflen
;
3326 ixj_write_cid_byte(j
, 0x01);
3327 checksum
= checksum
+ 0x01;
3328 ixj_write_cid_byte(j
, len1
);
3329 checksum
= checksum
+ len1
;
3330 checksum
= ixj_write_cid_string(j
, sdmf1
, checksum
);
3331 if(ixj_hookstate(j
) & 1)
3334 ixj_write_cid_byte(j
, 0x02);
3335 checksum
= checksum
+ 0x02;
3336 ixj_write_cid_byte(j
, len2
);
3337 checksum
= checksum
+ len2
;
3338 checksum
= ixj_write_cid_string(j
, sdmf2
, checksum
);
3339 if(ixj_hookstate(j
) & 1)
3342 ixj_write_cid_byte(j
, 0x07);
3343 checksum
= checksum
+ 0x07;
3344 ixj_write_cid_byte(j
, len3
);
3345 checksum
= checksum
+ len3
;
3346 checksum
= ixj_write_cid_string(j
, sdmf3
, checksum
);
3347 if(ixj_hookstate(j
) & 1)
3354 ixj_write_cid_byte(j
, (char) checksum
);
3356 pad
= j
->fskdcnt
% 240;
3360 ixj_pad_fsk(j
, pad
);
3367 static void ixj_write_cidcw(IXJ
*j
)
3374 char mdmflen
, len1
, len2
, len3
;
3379 if (j
->dsp
.low
== 0x20 || j
->flags
.cidplay
)
3382 j
->fskz
= j
->fskphase
= j
->fskcnt
= j
->fskdcnt
= 0;
3383 j
->cidsize
= j
->cidcnt
= 0;
3387 j
->flags
.cidcw_ack
= 0;
3394 ixj_init_tone(j
, &ti
);
3396 ixj_set_tone_on(1500, j
);
3397 ixj_set_tone_off(32, j
);
3398 if(ixjdebug
& 0x0200) {
3399 printk("IXJ cidcw phone%d first tone start at %ld\n", j
->board
, jiffies
);
3401 ixj_play_tone(j
, 23);
3403 clear_bit(j
->board
, &j
->busyflags
);
3404 while(j
->tone_state
) {
3405 set_current_state(TASK_INTERRUPTIBLE
);
3406 schedule_timeout(1);
3408 while(test_and_set_bit(j
->board
, (void *)&j
->busyflags
) != 0) {
3409 set_current_state(TASK_INTERRUPTIBLE
);
3410 schedule_timeout(1);
3412 if(ixjdebug
& 0x0200) {
3413 printk("IXJ cidcw phone%d first tone end at %ld\n", j
->board
, jiffies
);
3421 ixj_init_tone(j
, &ti
);
3423 ixj_set_tone_off(10, j
);
3424 ixj_set_tone_on(600, j
);
3425 if(ixjdebug
& 0x0200) {
3426 printk("IXJ cidcw phone%d second tone start at %ld\n", j
->board
, jiffies
);
3428 ixj_play_tone(j
, 24);
3430 clear_bit(j
->board
, &j
->busyflags
);
3431 while(j
->tone_state
) {
3432 set_current_state(TASK_INTERRUPTIBLE
);
3433 schedule_timeout(1);
3435 while(test_and_set_bit(j
->board
, (void *)&j
->busyflags
) != 0) {
3436 set_current_state(TASK_INTERRUPTIBLE
);
3437 schedule_timeout(1);
3439 if(ixjdebug
& 0x0200) {
3440 printk("IXJ cidcw phone%d sent second tone at %ld\n", j
->board
, jiffies
);
3443 j
->cidcw_wait
= jiffies
+ ((50 * hertz
) / 100);
3445 clear_bit(j
->board
, &j
->busyflags
);
3446 while(!j
->flags
.cidcw_ack
&& time_before(jiffies
, j
->cidcw_wait
)) {
3447 set_current_state(TASK_INTERRUPTIBLE
);
3448 schedule_timeout(1);
3450 while(test_and_set_bit(j
->board
, (void *)&j
->busyflags
) != 0) {
3451 set_current_state(TASK_INTERRUPTIBLE
);
3452 schedule_timeout(1);
3455 if(!j
->flags
.cidcw_ack
) {
3456 if(ixjdebug
& 0x0200) {
3457 printk("IXJ cidcw phone%d did not receive ACK from display %ld\n", j
->board
, jiffies
);
3460 if(j
->cid_play_flag
) {
3461 wake_up_interruptible(&j
->write_q
); /* Wake any blocked readers */
3467 j
->flags
.cidcw_ack
= 0;
3468 strcpy(sdmf1
, j
->cid_send
.month
);
3469 strcat(sdmf1
, j
->cid_send
.day
);
3470 strcat(sdmf1
, j
->cid_send
.hour
);
3471 strcat(sdmf1
, j
->cid_send
.min
);
3472 strcpy(sdmf2
, j
->cid_send
.number
);
3473 strcpy(sdmf3
, j
->cid_send
.name
);
3475 len1
= strlen(sdmf1
);
3476 len2
= strlen(sdmf2
);
3477 len3
= strlen(sdmf3
);
3478 mdmflen
= len1
+ len2
+ len3
+ 6;
3480 ixj_write_cidcw_seize(j
);
3482 ixj_write_cid_byte(j
, 0x80);
3484 ixj_write_cid_byte(j
, mdmflen
);
3485 checksum
= checksum
+ mdmflen
;
3487 ixj_write_cid_byte(j
, 0x01);
3488 checksum
= checksum
+ 0x01;
3489 ixj_write_cid_byte(j
, len1
);
3490 checksum
= checksum
+ len1
;
3491 checksum
= ixj_write_cid_string(j
, sdmf1
, checksum
);
3493 ixj_write_cid_byte(j
, 0x02);
3494 checksum
= checksum
+ 0x02;
3495 ixj_write_cid_byte(j
, len2
);
3496 checksum
= checksum
+ len2
;
3497 checksum
= ixj_write_cid_string(j
, sdmf2
, checksum
);
3499 ixj_write_cid_byte(j
, 0x07);
3500 checksum
= checksum
+ 0x07;
3501 ixj_write_cid_byte(j
, len3
);
3502 checksum
= checksum
+ len3
;
3503 checksum
= ixj_write_cid_string(j
, sdmf3
, checksum
);
3509 ixj_write_cid_byte(j
, (char) checksum
);
3511 pad
= j
->fskdcnt
% 240;
3515 ixj_pad_fsk(j
, pad
);
3516 if(ixjdebug
& 0x0200) {
3517 printk("IXJ cidcw phone%d sent FSK data at %ld\n", j
->board
, jiffies
);
3521 static void ixj_write_vmwi(IXJ
*j
, int msg
)
3528 if (j
->dsp
.low
== 0x20 || j
->flags
.cidplay
)
3531 j
->fskz
= j
->fskphase
= j
->fskcnt
= j
->fskdcnt
= 0;
3532 j
->cidsize
= j
->cidcnt
= 0;
3538 if (j
->port
== PORT_POTS
)
3539 SLIC_SetState(PLD_SLIC_STATE_OHT
, j
);
3541 ixj_write_cid_seize(j
);
3543 ixj_write_cid_byte(j
, 0x82);
3545 ixj_write_cid_byte(j
, mdmflen
);
3546 checksum
= checksum
+ mdmflen
;
3548 ixj_write_cid_byte(j
, 0x0B);
3549 checksum
= checksum
+ 0x0B;
3550 ixj_write_cid_byte(j
, 1);
3551 checksum
= checksum
+ 1;
3554 ixj_write_cid_byte(j
, 0xFF);
3555 checksum
= checksum
+ 0xFF;
3558 ixj_write_cid_byte(j
, 0x00);
3559 checksum
= checksum
+ 0x00;
3566 ixj_write_cid_byte(j
, (char) checksum
);
3568 pad
= j
->fskdcnt
% 240;
3572 ixj_pad_fsk(j
, pad
);
3575 static void ixj_write_frame(IXJ
*j
)
3577 int cnt
, frame_count
, dly
;
3582 if(j
->flags
.cidplay
) {
3583 for(cnt
= 0; cnt
< 480; cnt
++) {
3584 if (!(cnt
% 16) && !IsTxReady(j
)) {
3586 while (!IsTxReady(j
)) {
3594 dat
.word
= j
->fskdata
[j
->cidcnt
++];
3595 outb_p(dat
.bytes
.low
, j
->DSPbase
+ 0x0C);
3596 outb_p(dat
.bytes
.high
, j
->DSPbase
+ 0x0D);
3599 if(j
->cidcnt
>= j
->fskdcnt
) {
3602 /* This may seem rude, but if we just played one frame of FSK data for CallerID
3603 and there is real audio data in the buffer, we need to throw it away because
3604 we just used it's time slot */
3605 if (j
->write_buffer_rp
> j
->write_buffer_wp
) {
3606 j
->write_buffer_rp
+= j
->cid_play_frame_size
* 2;
3607 if (j
->write_buffer_rp
>= j
->write_buffer_end
) {
3608 j
->write_buffer_rp
= j
->write_buffer
;
3610 j
->write_buffers_empty
++;
3611 wake_up_interruptible(&j
->write_q
); /* Wake any blocked writers */
3613 wake_up_interruptible(&j
->poll_q
); /* Wake any blocked selects */
3615 } else if (j
->write_buffer
&& j
->write_buffers_empty
< 1) {
3616 if (j
->write_buffer_wp
> j
->write_buffer_rp
) {
3618 (j
->write_buffer_wp
- j
->write_buffer_rp
) / (j
->play_frame_size
* 2);
3620 if (j
->write_buffer_rp
> j
->write_buffer_wp
) {
3622 (j
->write_buffer_wp
- j
->write_buffer
) / (j
->play_frame_size
* 2) +
3623 (j
->write_buffer_end
- j
->write_buffer_rp
) / (j
->play_frame_size
* 2);
3625 if (frame_count
>= 1) {
3626 if (j
->ver
.low
== 0x12 && j
->play_mode
&& j
->flags
.play_first_frame
) {
3627 switch (j
->play_mode
) {
3628 case PLAYBACK_MODE_ULAW
:
3629 case PLAYBACK_MODE_ALAW
:
3630 blankword
.low
= blankword
.high
= 0xFF;
3632 case PLAYBACK_MODE_8LINEAR
:
3633 case PLAYBACK_MODE_16LINEAR
:
3634 blankword
.low
= blankword
.high
= 0x00;
3636 case PLAYBACK_MODE_8LINEAR_WSS
:
3637 blankword
.low
= blankword
.high
= 0x80;
3640 for (cnt
= 0; cnt
< 16; cnt
++) {
3641 if (!(cnt
% 16) && !IsTxReady(j
)) {
3643 while (!IsTxReady(j
)) {
3651 outb_p((blankword
.low
), j
->DSPbase
+ 0x0C);
3652 outb_p((blankword
.high
), j
->DSPbase
+ 0x0D);
3654 j
->flags
.play_first_frame
= 0;
3655 } else if (j
->play_codec
== G723_63
&& j
->flags
.play_first_frame
) {
3656 for (cnt
= 0; cnt
< 24; cnt
++) {
3658 blankword
.low
= 0x02;
3659 blankword
.high
= 0x00;
3662 blankword
.low
= blankword
.high
= 0x00;
3664 if (!(cnt
% 16) && !IsTxReady(j
)) {
3666 while (!IsTxReady(j
)) {
3674 outb_p((blankword
.low
), j
->DSPbase
+ 0x0C);
3675 outb_p((blankword
.high
), j
->DSPbase
+ 0x0D);
3677 j
->flags
.play_first_frame
= 0;
3679 for (cnt
= 0; cnt
< j
->play_frame_size
* 2; cnt
+= 2) {
3680 if (!(cnt
% 16) && !IsTxReady(j
)) {
3682 while (!IsTxReady(j
)) {
3690 /* Add word 0 to G.729 frames for the 8021. Right now we don't do VAD/CNG */
3691 if (j
->play_codec
== G729
&& (cnt
== 0 || cnt
== 10 || cnt
== 20)) {
3692 if(j
->write_buffer_rp
+ cnt
== 0 && j
->write_buffer_rp
+ cnt
+ 1 == 0 && j
->write_buffer_rp
+ cnt
+ 2 == 0 &&
3693 j
->write_buffer_rp
+ cnt
+ 3 == 0 && j
->write_buffer_rp
+ cnt
+ 4 == 0 && j
->write_buffer_rp
+ cnt
+ 5 == 0 &&
3694 j
->write_buffer_rp
+ cnt
+ 6 == 0 && j
->write_buffer_rp
+ cnt
+ 7 == 0 && j
->write_buffer_rp
+ cnt
+ 8 == 0 &&
3695 j
->write_buffer_rp
+ cnt
+ 9 == 0) {
3696 /* someone is trying to write silence lets make this a type 0 frame. */
3697 outb_p(0x00, j
->DSPbase
+ 0x0C);
3698 outb_p(0x00, j
->DSPbase
+ 0x0D);
3700 /* so all other frames are type 1. */
3701 outb_p(0x01, j
->DSPbase
+ 0x0C);
3702 outb_p(0x00, j
->DSPbase
+ 0x0D);
3705 outb_p(*(j
->write_buffer_rp
+ cnt
), j
->DSPbase
+ 0x0C);
3706 outb_p(*(j
->write_buffer_rp
+ cnt
+ 1), j
->DSPbase
+ 0x0D);
3707 *(j
->write_buffer_rp
+ cnt
) = 0;
3708 *(j
->write_buffer_rp
+ cnt
+ 1) = 0;
3710 j
->write_buffer_rp
+= j
->play_frame_size
* 2;
3711 if (j
->write_buffer_rp
>= j
->write_buffer_end
) {
3712 j
->write_buffer_rp
= j
->write_buffer
;
3714 j
->write_buffers_empty
++;
3715 wake_up_interruptible(&j
->write_q
); /* Wake any blocked writers */
3717 wake_up_interruptible(&j
->poll_q
); /* Wake any blocked selects */
3724 if(j
->ixj_signals
[SIG_WRITE_READY
]) {
3725 ixj_kill_fasync(j
, SIG_WRITE_READY
, POLL_OUT
);
3729 static int idle(IXJ
*j
)
3731 if (ixj_WriteDSPCommand(0x0000, j
)) /* DSP Idle */
3735 if (j
->ssr
.high
|| j
->ssr
.low
) {
3739 j
->flags
.playing
= 0;
3741 j
->flags
.recording
= 0;
3746 static int set_base_frame(IXJ
*j
, int size
)
3752 j
->cid_play_aec_level
= j
->aec_level
;
3754 for (cnt
= 0; cnt
< 10; cnt
++) {
3758 if (j
->ssr
.high
|| j
->ssr
.low
)
3760 if (j
->dsp
.low
!= 0x20) {
3764 /* Set Base Frame Size to 240 pg9-10 8021 */
3768 /* Set Base Frame Size to 160 pg9-10 8021 */
3772 /* Set Base Frame Size to 80 pg9-10 8021 */
3783 if (ixj_WriteDSPCommand(cmd
, j
)) {
3784 j
->baseframe
.high
= j
->baseframe
.low
= 0xFF;
3787 j
->baseframe
.high
= j
->ssr
.high
;
3788 j
->baseframe
.low
= j
->ssr
.low
;
3789 /* If the status returned is 0x0000 (pg9-9 8021) the call failed */
3790 if(j
->baseframe
.high
== 0x00 && j
->baseframe
.low
== 0x00) {
3794 ixj_aec_start(j
, j
->cid_play_aec_level
);
3798 static int set_rec_codec(IXJ
*j
, int rate
)
3802 j
->rec_codec
= rate
;
3806 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
3807 j
->rec_frame_size
= 12;
3814 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
3815 j
->rec_frame_size
= 10;
3822 if (j
->dsp
.low
== 0x20 || j
->flags
.ts85_loaded
) {
3823 j
->rec_frame_size
= 16;
3830 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
3831 j
->rec_frame_size
= 9;
3838 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
3839 j
->rec_frame_size
= 8;
3846 if (j
->dsp
.low
!= 0x20) {
3847 j
->rec_frame_size
= 48;
3854 if (j
->dsp
.low
!= 0x20) {
3855 if (!j
->flags
.g729_loaded
) {
3859 switch (j
->baseframe
.low
) {
3861 j
->rec_frame_size
= 10;
3864 j
->rec_frame_size
= 5;
3867 j
->rec_frame_size
= 15;
3876 if (j
->dsp
.low
!= 0x20) {
3877 if (!j
->flags
.g729_loaded
) {
3881 switch (j
->baseframe
.low
) {
3883 j
->rec_frame_size
= 12;
3886 j
->rec_frame_size
= 6;
3889 j
->rec_frame_size
= 18;
3898 switch (j
->baseframe
.low
) {
3900 j
->rec_frame_size
= 80;
3903 j
->rec_frame_size
= 40;
3906 j
->rec_frame_size
= 120;
3912 switch (j
->baseframe
.low
) {
3914 j
->rec_frame_size
= 80;
3917 j
->rec_frame_size
= 40;
3920 j
->rec_frame_size
= 120;
3926 switch (j
->baseframe
.low
) {
3928 j
->rec_frame_size
= 160;
3931 j
->rec_frame_size
= 80;
3934 j
->rec_frame_size
= 240;
3940 switch (j
->baseframe
.low
) {
3942 j
->rec_frame_size
= 80;
3945 j
->rec_frame_size
= 40;
3948 j
->rec_frame_size
= 120;
3954 switch (j
->baseframe
.low
) {
3956 j
->rec_frame_size
= 80;
3959 j
->rec_frame_size
= 40;
3962 j
->rec_frame_size
= 120;
3968 j
->rec_frame_size
= 0;
3970 if (j
->read_buffer
) {
3971 kfree(j
->read_buffer
);
3972 j
->read_buffer
= NULL
;
3973 j
->read_buffer_size
= 0;
3981 static int ixj_record_start(IXJ
*j
)
3983 unsigned short cmd
= 0x0000;
3985 if (j
->read_buffer
) {
3988 j
->flags
.recording
= 1;
3989 ixj_WriteDSPCommand(0x0FE0, j
); /* Put the DSP in full power mode. */
3991 if(ixjdebug
& 0x0002)
3992 printk("IXJ %d Starting Record Codec %d at %ld\n", j
->board
, j
->rec_codec
, jiffies
);
3995 switch (j
->rec_codec
) {
4003 cmd
= 0x5130; /* TrueSpeech 8.5 */
4007 cmd
= 0x5133; /* TrueSpeech 4.8 */
4011 cmd
= 0x5134; /* TrueSpeech 4.1 */
4024 if (ixj_WriteDSPCommand(cmd
, j
))
4027 if (!j
->read_buffer
) {
4028 if (!j
->read_buffer
)
4029 j
->read_buffer
= kmalloc(j
->rec_frame_size
* 2, GFP_ATOMIC
);
4030 if (!j
->read_buffer
) {
4031 printk("Read buffer allocation for ixj board %d failed!\n", j
->board
);
4035 j
->read_buffer_size
= j
->rec_frame_size
* 2;
4037 if (ixj_WriteDSPCommand(0x5102, j
)) /* Set Poll sync mode */
4041 switch (j
->rec_mode
) {
4043 cmd
= 0x1C03; /* Record C1 */
4047 if (j
->ver
.low
== 0x12) {
4048 cmd
= 0x1E03; /* Record C1 */
4051 cmd
= 0x1E01; /* Record C1 */
4056 if (j
->ver
.low
== 0x12) {
4057 cmd
= 0x1E83; /* Record C1 */
4060 cmd
= 0x1E81; /* Record C1 */
4065 if (j
->ver
.low
== 0x12) {
4066 cmd
= 0x1F03; /* Record C1 */
4069 cmd
= 0x1F01; /* Record C1 */
4074 if (j
->ver
.low
== 0x12) {
4075 cmd
= 0x1F83; /* Record C1 */
4077 cmd
= 0x1F81; /* Record C1 */
4081 if (ixj_WriteDSPCommand(cmd
, j
))
4084 if (j
->flags
.playing
) {
4085 ixj_aec_start(j
, j
->aec_level
);
4090 static void ixj_record_stop(IXJ
*j
)
4092 if(ixjdebug
& 0x0002)
4093 printk("IXJ %d Stopping Record Codec %d at %ld\n", j
->board
, j
->rec_codec
, jiffies
);
4095 if (j
->read_buffer
) {
4096 kfree(j
->read_buffer
);
4097 j
->read_buffer
= NULL
;
4098 j
->read_buffer_size
= 0;
4100 if (j
->rec_mode
> -1) {
4101 ixj_WriteDSPCommand(0x5120, j
);
4104 j
->flags
.recording
= 0;
4106 static void ixj_vad(IXJ
*j
, int arg
)
4109 ixj_WriteDSPCommand(0x513F, j
);
4111 ixj_WriteDSPCommand(0x513E, j
);
4114 static void set_rec_depth(IXJ
*j
, int depth
)
4120 ixj_WriteDSPCommand(0x5180 + depth
, j
);
4123 static void set_dtmf_prescale(IXJ
*j
, int volume
)
4125 ixj_WriteDSPCommand(0xCF07, j
);
4126 ixj_WriteDSPCommand(volume
, j
);
4129 static int get_dtmf_prescale(IXJ
*j
)
4131 ixj_WriteDSPCommand(0xCF05, j
);
4132 return j
->ssr
.high
<< 8 | j
->ssr
.low
;
4135 static void set_rec_volume(IXJ
*j
, int volume
)
4137 if(j
->aec_level
== AEC_AGC
) {
4138 if (ixjdebug
& 0x0002)
4139 printk(KERN_INFO
"IXJ: /dev/phone%d Setting AGC Threshold to 0x%4.4x\n", j
->board
, volume
);
4140 ixj_WriteDSPCommand(0xCF96, j
);
4141 ixj_WriteDSPCommand(volume
, j
);
4143 if (ixjdebug
& 0x0002)
4144 printk(KERN_INFO
"IXJ: /dev/phone %d Setting Record Volume to 0x%4.4x\n", j
->board
, volume
);
4145 ixj_WriteDSPCommand(0xCF03, j
);
4146 ixj_WriteDSPCommand(volume
, j
);
4150 static int set_rec_volume_linear(IXJ
*j
, int volume
)
4152 int newvolume
, dsprecmax
;
4154 if (ixjdebug
& 0x0002)
4155 printk(KERN_INFO
"IXJ: /dev/phone %d Setting Linear Record Volume to 0x%4.4x\n", j
->board
, volume
);
4156 if(volume
> 100 || volume
< 0) {
4160 /* This should normalize the perceived volumes between the different cards caused by differences in the hardware */
4161 switch (j
->cardtype
) {
4167 ixj_mixer(0x0203, j
); /*Voice Left Volume unmute 6db */
4168 ixj_mixer(0x0303, j
); /*Voice Right Volume unmute 6db */
4169 ixj_mixer(0x0C00, j
); /*Mono1 unmute 12db */
4171 case QTI_PHONEJACK_LITE
:
4174 case QTI_PHONEJACK_PCI
:
4183 newvolume
= (dsprecmax
* volume
) / 100;
4184 set_rec_volume(j
, newvolume
);
4188 static int get_rec_volume(IXJ
*j
)
4190 if(j
->aec_level
== AEC_AGC
) {
4191 if (ixjdebug
& 0x0002)
4192 printk(KERN_INFO
"Getting AGC Threshold\n");
4193 ixj_WriteDSPCommand(0xCF86, j
);
4194 if (ixjdebug
& 0x0002)
4195 printk(KERN_INFO
"AGC Threshold is 0x%2.2x%2.2x\n", j
->ssr
.high
, j
->ssr
.low
);
4196 return j
->ssr
.high
<< 8 | j
->ssr
.low
;
4198 if (ixjdebug
& 0x0002)
4199 printk(KERN_INFO
"Getting Record Volume\n");
4200 ixj_WriteDSPCommand(0xCF01, j
);
4201 return j
->ssr
.high
<< 8 | j
->ssr
.low
;
4205 static int get_rec_volume_linear(IXJ
*j
)
4207 int volume
, newvolume
, dsprecmax
;
4209 switch (j
->cardtype
) {
4216 case QTI_PHONEJACK_LITE
:
4219 case QTI_PHONEJACK_PCI
:
4228 volume
= get_rec_volume(j
);
4229 newvolume
= (volume
* 100) / dsprecmax
;
4235 static int get_rec_level(IXJ
*j
)
4239 ixj_WriteDSPCommand(0xCF88, j
);
4241 retval
= j
->ssr
.high
<< 8 | j
->ssr
.low
;
4242 retval
= (retval
* 256) / 240;
4246 static void ixj_aec_start(IXJ
*j
, int level
)
4248 j
->aec_level
= level
;
4249 if (ixjdebug
& 0x0002)
4250 printk(KERN_INFO
"AGC set = 0x%2.2x\n", j
->aec_level
);
4254 if (j
->rec_codec
== G729
|| j
->play_codec
== G729
|| j
->rec_codec
== G729B
|| j
->play_codec
== G729B
) {
4255 ixj_WriteDSPCommand(0xE022, j
); /* Move AEC filter buffer */
4257 ixj_WriteDSPCommand(0x0300, j
);
4259 ixj_WriteDSPCommand(0xB001, j
); /* AEC On */
4261 ixj_WriteDSPCommand(0xE013, j
); /* Advanced AEC C1 */
4265 ixj_WriteDSPCommand(0x0000, j
); /* Advanced AEC C2 = off */
4267 ixj_WriteDSPCommand(0xE011, j
);
4268 ixj_WriteDSPCommand(0xFFFF, j
);
4270 ixj_WriteDSPCommand(0xCF97, j
); /* Set AGC Enable */
4271 ixj_WriteDSPCommand(0x0000, j
); /* to off */
4276 ixj_WriteDSPCommand(0x0600, j
); /* Advanced AEC C2 = on medium */
4278 ixj_WriteDSPCommand(0xE011, j
);
4279 ixj_WriteDSPCommand(0x0080, j
);
4281 ixj_WriteDSPCommand(0xCF97, j
); /* Set AGC Enable */
4282 ixj_WriteDSPCommand(0x0000, j
); /* to off */
4287 ixj_WriteDSPCommand(0x0C00, j
); /* Advanced AEC C2 = on high */
4289 ixj_WriteDSPCommand(0xE011, j
);
4290 ixj_WriteDSPCommand(0x0080, j
);
4292 ixj_WriteDSPCommand(0xCF97, j
); /* Set AGC Enable */
4293 ixj_WriteDSPCommand(0x0000, j
); /* to off */
4298 /* First we have to put the AEC into advance auto mode so that AGC will not conflict with it */
4299 ixj_WriteDSPCommand(0x0002, j
); /* Attenuation scaling factor of 2 */
4301 ixj_WriteDSPCommand(0xE011, j
);
4302 ixj_WriteDSPCommand(0x0100, j
); /* Higher Threshold Floor */
4304 ixj_WriteDSPCommand(0xE012, j
); /* Set Train and Lock */
4306 if(j
->cardtype
== QTI_LINEJACK
|| j
->cardtype
== QTI_PHONECARD
)
4307 ixj_WriteDSPCommand(0x0224, j
);
4309 ixj_WriteDSPCommand(0x1224, j
);
4311 ixj_WriteDSPCommand(0xE014, j
);
4312 ixj_WriteDSPCommand(0x0003, j
); /* Lock threashold at 3dB */
4314 ixj_WriteDSPCommand(0xE338, j
); /* Set Echo Suppresser Attenuation to 0dB */
4316 /* Now we can set the AGC initial parameters and turn it on */
4317 ixj_WriteDSPCommand(0xCF90, j
); /* Set AGC Minumum gain */
4318 ixj_WriteDSPCommand(0x0020, j
); /* to 0.125 (-18dB) */
4320 ixj_WriteDSPCommand(0xCF91, j
); /* Set AGC Maximum gain */
4321 ixj_WriteDSPCommand(0x1000, j
); /* to 16 (24dB) */
4323 ixj_WriteDSPCommand(0xCF92, j
); /* Set AGC start gain */
4324 ixj_WriteDSPCommand(0x0800, j
); /* to 8 (+18dB) */
4326 ixj_WriteDSPCommand(0xCF93, j
); /* Set AGC hold time */
4327 ixj_WriteDSPCommand(0x1F40, j
); /* to 2 seconds (units are 250us) */
4329 ixj_WriteDSPCommand(0xCF94, j
); /* Set AGC Attack Time Constant */
4330 ixj_WriteDSPCommand(0x0005, j
); /* to 8ms */
4332 ixj_WriteDSPCommand(0xCF95, j
); /* Set AGC Decay Time Constant */
4333 ixj_WriteDSPCommand(0x000D, j
); /* to 4096ms */
4335 ixj_WriteDSPCommand(0xCF96, j
); /* Set AGC Attack Threshold */
4336 ixj_WriteDSPCommand(0x1200, j
); /* to 25% */
4338 ixj_WriteDSPCommand(0xCF97, j
); /* Set AGC Enable */
4339 ixj_WriteDSPCommand(0x0001, j
); /* to on */
4344 ixj_WriteDSPCommand(0x0002, j
); /* Attenuation scaling factor of 2 */
4346 ixj_WriteDSPCommand(0xE011, j
);
4347 ixj_WriteDSPCommand(0x0100, j
); /* Higher Threshold Floor */
4349 ixj_WriteDSPCommand(0xE012, j
); /* Set Train and Lock */
4351 if(j
->cardtype
== QTI_LINEJACK
|| j
->cardtype
== QTI_PHONECARD
)
4352 ixj_WriteDSPCommand(0x0224, j
);
4354 ixj_WriteDSPCommand(0x1224, j
);
4356 ixj_WriteDSPCommand(0xE014, j
);
4357 ixj_WriteDSPCommand(0x0003, j
); /* Lock threashold at 3dB */
4359 ixj_WriteDSPCommand(0xE338, j
); /* Set Echo Suppresser Attenuation to 0dB */
4366 static void aec_stop(IXJ
*j
)
4368 j
->aec_level
= AEC_OFF
;
4369 if (j
->rec_codec
== G729
|| j
->play_codec
== G729
|| j
->rec_codec
== G729B
|| j
->play_codec
== G729B
) {
4370 ixj_WriteDSPCommand(0xE022, j
); /* Move AEC filter buffer back */
4372 ixj_WriteDSPCommand(0x0700, j
);
4374 if (j
->play_mode
!= -1 && j
->rec_mode
!= -1)
4376 ixj_WriteDSPCommand(0xB002, j
); /* AEC Stop */
4380 static int set_play_codec(IXJ
*j
, int rate
)
4384 j
->play_codec
= rate
;
4388 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
4389 j
->play_frame_size
= 12;
4396 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
4397 j
->play_frame_size
= 10;
4404 if (j
->dsp
.low
== 0x20 || j
->flags
.ts85_loaded
) {
4405 j
->play_frame_size
= 16;
4412 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
4413 j
->play_frame_size
= 9;
4420 if (j
->ver
.low
!= 0x12 || ixj_convert_loaded
) {
4421 j
->play_frame_size
= 8;
4428 if (j
->dsp
.low
!= 0x20) {
4429 j
->play_frame_size
= 48;
4436 if (j
->dsp
.low
!= 0x20) {
4437 if (!j
->flags
.g729_loaded
) {
4441 switch (j
->baseframe
.low
) {
4443 j
->play_frame_size
= 10;
4446 j
->play_frame_size
= 5;
4449 j
->play_frame_size
= 15;
4458 if (j
->dsp
.low
!= 0x20) {
4459 if (!j
->flags
.g729_loaded
) {
4463 switch (j
->baseframe
.low
) {
4465 j
->play_frame_size
= 12;
4468 j
->play_frame_size
= 6;
4471 j
->play_frame_size
= 18;
4480 switch (j
->baseframe
.low
) {
4482 j
->play_frame_size
= 80;
4485 j
->play_frame_size
= 40;
4488 j
->play_frame_size
= 120;
4494 switch (j
->baseframe
.low
) {
4496 j
->play_frame_size
= 80;
4499 j
->play_frame_size
= 40;
4502 j
->play_frame_size
= 120;
4508 switch (j
->baseframe
.low
) {
4510 j
->play_frame_size
= 160;
4513 j
->play_frame_size
= 80;
4516 j
->play_frame_size
= 240;
4522 switch (j
->baseframe
.low
) {
4524 j
->play_frame_size
= 80;
4527 j
->play_frame_size
= 40;
4530 j
->play_frame_size
= 120;
4536 switch (j
->baseframe
.low
) {
4538 j
->play_frame_size
= 80;
4541 j
->play_frame_size
= 40;
4544 j
->play_frame_size
= 120;
4550 j
->play_frame_size
= 0;
4552 if (j
->write_buffer
) {
4553 kfree(j
->write_buffer
);
4554 j
->write_buffer
= NULL
;
4555 j
->write_buffer_size
= 0;
4563 static int ixj_play_start(IXJ
*j
)
4565 unsigned short cmd
= 0x0000;
4567 if (j
->write_buffer
) {
4571 if(ixjdebug
& 0x0002)
4572 printk("IXJ %d Starting Play Codec %d at %ld\n", j
->board
, j
->play_codec
, jiffies
);
4574 j
->flags
.playing
= 1;
4575 ixj_WriteDSPCommand(0x0FE0, j
); /* Put the DSP in full power mode. */
4577 j
->flags
.play_first_frame
= 1;
4580 if (!j
->play_mode
) {
4581 switch (j
->play_codec
) {
4589 cmd
= 0x5230; /* TrueSpeech 8.5 */
4593 cmd
= 0x5233; /* TrueSpeech 4.8 */
4597 cmd
= 0x5234; /* TrueSpeech 4.1 */
4610 if (ixj_WriteDSPCommand(cmd
, j
))
4613 j
->write_buffer
= kmalloc(j
->play_frame_size
* 2, GFP_ATOMIC
);
4614 if (!j
->write_buffer
) {
4615 printk("Write buffer allocation for ixj board %d failed!\n", j
->board
);
4618 /* j->write_buffers_empty = 2; */
4619 j
->write_buffers_empty
= 1;
4620 j
->write_buffer_size
= j
->play_frame_size
* 2;
4621 j
->write_buffer_end
= j
->write_buffer
+ j
->play_frame_size
* 2;
4622 j
->write_buffer_rp
= j
->write_buffer_wp
= j
->write_buffer
;
4624 if (ixj_WriteDSPCommand(0x5202, j
)) /* Set Poll sync mode */
4628 switch (j
->play_mode
) {
4633 if (j
->ver
.low
== 0x12) {
4640 if (j
->ver
.low
== 0x12) {
4647 if (j
->ver
.low
== 0x12) {
4654 if (j
->ver
.low
== 0x12) {
4661 if (ixj_WriteDSPCommand(cmd
, j
))
4664 if (ixj_WriteDSPCommand(0x2000, j
)) /* Playback C2 */
4667 if (ixj_WriteDSPCommand(0x2000 + j
->play_frame_size
, j
)) /* Playback C3 */
4670 if (j
->flags
.recording
) {
4671 ixj_aec_start(j
, j
->aec_level
);
4677 static void ixj_play_stop(IXJ
*j
)
4679 if(ixjdebug
& 0x0002)
4680 printk("IXJ %d Stopping Play Codec %d at %ld\n", j
->board
, j
->play_codec
, jiffies
);
4682 if (j
->write_buffer
) {
4683 kfree(j
->write_buffer
);
4684 j
->write_buffer
= NULL
;
4685 j
->write_buffer_size
= 0;
4687 if (j
->play_mode
> -1) {
4688 ixj_WriteDSPCommand(0x5221, j
); /* Stop playback and flush buffers. 8022 reference page 9-40 */
4692 j
->flags
.playing
= 0;
4695 static inline int get_play_level(IXJ
*j
)
4699 ixj_WriteDSPCommand(0xCF8F, j
); /* 8022 Reference page 9-38 */
4700 return j
->ssr
.high
<< 8 | j
->ssr
.low
;
4701 retval
= j
->ssr
.high
<< 8 | j
->ssr
.low
;
4702 retval
= (retval
* 256) / 240;
4706 static unsigned int ixj_poll(struct file
*file_p
, poll_table
* wait
)
4708 unsigned int mask
= 0;
4710 IXJ
*j
= get_ixj(NUM(file_p
->f_dentry
->d_inode
));
4712 poll_wait(file_p
, &(j
->poll_q
), wait
);
4713 if (j
->read_buffer_ready
> 0)
4714 mask
|= POLLIN
| POLLRDNORM
; /* readable */
4715 if (j
->write_buffers_empty
> 0)
4716 mask
|= POLLOUT
| POLLWRNORM
; /* writable */
4722 static int ixj_play_tone(IXJ
*j
, char tone
)
4724 if (!j
->tone_state
) {
4725 if(ixjdebug
& 0x0002) {
4726 printk("IXJ %d starting tone %d at %ld\n", j
->board
, tone
, jiffies
);
4728 if (j
->dsp
.low
== 0x20) {
4731 j
->tone_start_jif
= jiffies
;
4736 j
->tone_index
= tone
;
4737 if (ixj_WriteDSPCommand(0x6000 + j
->tone_index
, j
))
4743 static int ixj_set_tone_on(unsigned short arg
, IXJ
*j
)
4745 j
->tone_on_time
= arg
;
4747 if (ixj_WriteDSPCommand(0x6E04, j
)) /* Set Tone On Period */
4751 if (ixj_WriteDSPCommand(arg
, j
))
4757 static int SCI_WaitHighSCI(IXJ
*j
)
4761 j
->pld_scrr
.byte
= inb_p(j
->XILINXbase
);
4762 if (!j
->pld_scrr
.bits
.sci
) {
4763 for (cnt
= 0; cnt
< 10; cnt
++) {
4765 j
->pld_scrr
.byte
= inb_p(j
->XILINXbase
);
4767 if ((j
->pld_scrr
.bits
.sci
))
4770 if (ixjdebug
& 0x0001)
4771 printk(KERN_INFO
"SCI Wait High failed %x\n", j
->pld_scrr
.byte
);
4777 static int SCI_WaitLowSCI(IXJ
*j
)
4781 j
->pld_scrr
.byte
= inb_p(j
->XILINXbase
);
4782 if (j
->pld_scrr
.bits
.sci
) {
4783 for (cnt
= 0; cnt
< 10; cnt
++) {
4785 j
->pld_scrr
.byte
= inb_p(j
->XILINXbase
);
4787 if (!(j
->pld_scrr
.bits
.sci
))
4790 if (ixjdebug
& 0x0001)
4791 printk(KERN_INFO
"SCI Wait Low failed %x\n", j
->pld_scrr
.byte
);
4797 static int SCI_Control(IXJ
*j
, int control
)
4801 j
->pld_scrw
.bits
.c0
= 0; /* Set PLD Serial control interface */
4803 j
->pld_scrw
.bits
.c1
= 0; /* to no selection */
4806 case SCI_Enable_DAA
:
4807 j
->pld_scrw
.bits
.c0
= 1; /* Set PLD Serial control interface */
4809 j
->pld_scrw
.bits
.c1
= 0; /* to write to DAA */
4812 case SCI_Enable_Mixer
:
4813 j
->pld_scrw
.bits
.c0
= 0; /* Set PLD Serial control interface */
4815 j
->pld_scrw
.bits
.c1
= 1; /* to write to mixer */
4818 case SCI_Enable_EEPROM
:
4819 j
->pld_scrw
.bits
.c0
= 1; /* Set PLD Serial control interface */
4821 j
->pld_scrw
.bits
.c1
= 1; /* to write to EEPROM */
4828 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
4834 case SCI_Enable_DAA
:
4835 case SCI_Enable_Mixer
:
4836 case SCI_Enable_EEPROM
:
4837 if (!SCI_WaitHighSCI(j
))
4847 static int SCI_Prepare(IXJ
*j
)
4849 if (!SCI_Control(j
, SCI_End
))
4852 if (!SCI_WaitLowSCI(j
))
4858 static int ixj_get_mixer(long val
, IXJ
*j
)
4860 int reg
= (val
& 0x1F00) >> 8;
4861 return j
->mix
.vol
[reg
];
4864 static int ixj_mixer(long val
, IXJ
*j
)
4868 bytes
.high
= (val
& 0x1F00) >> 8;
4869 bytes
.low
= val
& 0x00FF;
4871 /* save mixer value so we can get back later on */
4872 j
->mix
.vol
[bytes
.high
] = bytes
.low
;
4874 outb_p(bytes
.high
& 0x1F, j
->XILINXbase
+ 0x03); /* Load Mixer Address */
4876 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02); /* Load Mixer Data */
4878 SCI_Control(j
, SCI_Enable_Mixer
);
4880 SCI_Control(j
, SCI_End
);
4885 static int daa_load(BYTES
* p_bytes
, IXJ
*j
)
4887 outb_p(p_bytes
->high
, j
->XILINXbase
+ 0x03);
4888 outb_p(p_bytes
->low
, j
->XILINXbase
+ 0x02);
4889 if (!SCI_Control(j
, SCI_Enable_DAA
))
4895 static int ixj_daa_cr4(IXJ
*j
, char reg
)
4899 switch (j
->daa_mode
) {
4903 case SOP_PU_RINGING
:
4906 case SOP_PU_CONVERSATION
:
4909 case SOP_PU_PULSEDIALING
:
4914 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= reg
;
4916 switch (j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.bitreg
.AGX
) {
4918 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.bitreg
.AGR_Z
= 0;
4921 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.bitreg
.AGR_Z
= 2;
4924 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.bitreg
.AGR_Z
= 1;
4927 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.bitreg
.AGR_Z
= 3;
4931 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
;
4933 if (!daa_load(&bytes
, j
))
4936 if (!SCI_Prepare(j
))
4942 static char daa_int_read(IXJ
*j
)
4946 if (!SCI_Prepare(j
))
4951 outb_p(bytes
.high
, j
->XILINXbase
+ 0x03);
4952 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02);
4954 if (!SCI_Control(j
, SCI_Enable_DAA
))
4957 bytes
.high
= inb_p(j
->XILINXbase
+ 0x03);
4958 bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
4959 if (bytes
.low
!= ALISDAA_ID_BYTE
) {
4960 if (ixjdebug
& 0x0001)
4961 printk("Cannot read DAA ID Byte high = %d low = %d\n", bytes
.high
, bytes
.low
);
4964 if (!SCI_Control(j
, SCI_Enable_DAA
))
4966 if (!SCI_Control(j
, SCI_End
))
4969 bytes
.high
= inb_p(j
->XILINXbase
+ 0x03);
4970 bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
4972 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.reg
= bytes
.high
;
4977 static char daa_CR_read(IXJ
*j
, int cr
)
4982 if (!SCI_Prepare(j
))
4985 switch (j
->daa_mode
) {
4987 bytes
.high
= 0x30 + cr
;
4989 case SOP_PU_RINGING
:
4990 bytes
.high
= 0x70 + cr
;
4992 case SOP_PU_CONVERSATION
:
4993 bytes
.high
= 0xB0 + cr
;
4995 case SOP_PU_PULSEDIALING
:
4996 bytes
.high
= 0xF0 + cr
;
5002 outb_p(bytes
.high
, j
->XILINXbase
+ 0x03);
5003 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02);
5005 if (!SCI_Control(j
, SCI_Enable_DAA
))
5008 bytes
.high
= inb_p(j
->XILINXbase
+ 0x03);
5009 bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
5010 if (bytes
.low
!= ALISDAA_ID_BYTE
) {
5011 if (ixjdebug
& 0x0001)
5012 printk("Cannot read DAA ID Byte high = %d low = %d\n", bytes
.high
, bytes
.low
);
5015 if (!SCI_Control(j
, SCI_Enable_DAA
))
5017 if (!SCI_Control(j
, SCI_End
))
5020 wdata
.word
= inw_p(j
->XILINXbase
+ 0x02);
5024 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr5
.reg
= wdata
.bytes
.high
;
5027 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= wdata
.bytes
.high
;
5030 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
= wdata
.bytes
.high
;
5033 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
= wdata
.bytes
.high
;
5036 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
= wdata
.bytes
.high
;
5039 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
= wdata
.bytes
.high
;
5047 static int ixj_daa_cid_reset(IXJ
*j
)
5052 if (ixjdebug
& 0x0002)
5053 printk("DAA Clearing CID ram\n");
5055 if (!SCI_Prepare(j
))
5060 outb_p(bytes
.high
, j
->XILINXbase
+ 0x03);
5061 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02);
5063 if (!SCI_Control(j
, SCI_Enable_DAA
))
5066 if (!SCI_WaitHighSCI(j
))
5069 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
- 1; i
+= 2) {
5070 bytes
.high
= bytes
.low
= 0x00;
5071 outb_p(bytes
.high
, j
->XILINXbase
+ 0x03);
5073 if (i
< ALISDAA_CALLERID_SIZE
- 1)
5074 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02);
5076 if (!SCI_Control(j
, SCI_Enable_DAA
))
5079 if (!SCI_WaitHighSCI(j
))
5084 if (!SCI_Control(j
, SCI_End
))
5087 if (ixjdebug
& 0x0002)
5088 printk("DAA CID ram cleared\n");
5093 static int ixj_daa_cid_read(IXJ
*j
)
5097 char CID
[ALISDAA_CALLERID_SIZE
], mContinue
;
5100 if (!SCI_Prepare(j
))
5105 outb_p(bytes
.high
, j
->XILINXbase
+ 0x03);
5106 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02);
5108 if (!SCI_Control(j
, SCI_Enable_DAA
))
5111 if (!SCI_WaitHighSCI(j
))
5114 bytes
.high
= inb_p(j
->XILINXbase
+ 0x03);
5115 bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
5116 if (bytes
.low
!= ALISDAA_ID_BYTE
) {
5117 if (ixjdebug
& 0x0001)
5118 printk("DAA Get Version Cannot read DAA ID Byte high = %d low = %d\n", bytes
.high
, bytes
.low
);
5121 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
; i
+= 2) {
5122 bytes
.high
= bytes
.low
= 0x00;
5123 outb_p(bytes
.high
, j
->XILINXbase
+ 0x03);
5124 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02);
5126 if (!SCI_Control(j
, SCI_Enable_DAA
))
5129 if (!SCI_WaitHighSCI(j
))
5132 CID
[i
+ 0] = inb_p(j
->XILINXbase
+ 0x03);
5133 CID
[i
+ 1] = inb_p(j
->XILINXbase
+ 0x02);
5136 if (!SCI_Control(j
, SCI_End
))
5140 pOut
= j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
;
5143 if ((pIn
[1] & 0x03) == 0x01) {
5146 if ((pIn
[2] & 0x0c) == 0x04) {
5147 pOut
[1] = ((pIn
[2] & 0x03) << 6) | ((pIn
[1] & 0xfc) >> 2);
5149 if ((pIn
[3] & 0x30) == 0x10) {
5150 pOut
[2] = ((pIn
[3] & 0x0f) << 4) | ((pIn
[2] & 0xf0) >> 4);
5152 if ((pIn
[4] & 0xc0) == 0x40) {
5153 pOut
[3] = ((pIn
[4] & 0x3f) << 2) | ((pIn
[3] & 0xc0) >> 6);
5157 pIn
+= 5, pOut
+= 4;
5159 memset(&j
->cid
, 0, sizeof(PHONE_CID
));
5160 pOut
= j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
;
5162 strncpy(j
->cid
.month
, pOut
, 2);
5164 strncpy(j
->cid
.day
, pOut
, 2);
5166 strncpy(j
->cid
.hour
, pOut
, 2);
5168 strncpy(j
->cid
.min
, pOut
, 2);
5170 j
->cid
.numlen
= *pOut
;
5172 strncpy(j
->cid
.number
, pOut
, j
->cid
.numlen
);
5173 pOut
+= j
->cid
.numlen
+ 1;
5174 j
->cid
.namelen
= *pOut
;
5176 strncpy(j
->cid
.name
, pOut
, j
->cid
.namelen
);
5178 ixj_daa_cid_reset(j
);
5182 static char daa_get_version(IXJ
*j
)
5186 if (!SCI_Prepare(j
))
5191 outb_p(bytes
.high
, j
->XILINXbase
+ 0x03);
5192 outb_p(bytes
.low
, j
->XILINXbase
+ 0x02);
5194 if (!SCI_Control(j
, SCI_Enable_DAA
))
5197 bytes
.high
= inb_p(j
->XILINXbase
+ 0x03);
5198 bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
5199 if (bytes
.low
!= ALISDAA_ID_BYTE
) {
5200 if (ixjdebug
& 0x0001)
5201 printk("DAA Get Version Cannot read DAA ID Byte high = %d low = %d\n", bytes
.high
, bytes
.low
);
5204 if (!SCI_Control(j
, SCI_Enable_DAA
))
5207 if (!SCI_Control(j
, SCI_End
))
5210 bytes
.high
= inb_p(j
->XILINXbase
+ 0x03);
5211 bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
5212 if (ixjdebug
& 0x0002)
5213 printk("DAA CR5 Byte high = 0x%x low = 0x%x\n", bytes
.high
, bytes
.low
);
5214 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr5
.reg
= bytes
.high
;
5218 static int daa_set_mode(IXJ
*j
, int mode
)
5221 The DAA *MUST* be in the conversation mode if the
5222 PSTN line is to be seized (PSTN line off-hook).
5223 Taking the PSTN line off-hook while the DAA is in
5224 a mode other than conversation mode will cause a
5225 hardware failure of the ALIS-A part.
5228 The DAA can only go to SLEEP, RINGING or PULSEDIALING modes
5229 if the PSTN line is on-hook. Failure to have the PSTN line
5230 in the on-hook state WILL CAUSE A HARDWARE FAILURE OF THE
5236 j
->flags
.pstn_rmr
= 0;
5238 if (!SCI_Prepare(j
))
5243 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
5245 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5246 j
->pld_slicw
.bits
.rly2
= 0;
5247 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
5249 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
;
5250 daa_load(&bytes
, j
);
5251 if (!SCI_Prepare(j
))
5254 j
->daa_mode
= SOP_PU_SLEEP
;
5257 if(j
->daa_mode
== SOP_PU_SLEEP
)
5261 if (ixjdebug
& 0x0008)
5262 printk(KERN_INFO
"phone DAA: SOP_PU_SLEEP at %ld\n", jiffies
);
5263 /* if(j->daa_mode == SOP_PU_CONVERSATION) */
5265 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
5267 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5268 j
->pld_slicw
.bits
.rly2
= 0;
5269 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
5271 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
;
5272 daa_load(&bytes
, j
);
5273 if (!SCI_Prepare(j
))
5276 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
5278 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5279 j
->pld_slicw
.bits
.rly2
= 0;
5280 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
5282 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
;
5283 daa_load(&bytes
, j
);
5284 if (!SCI_Prepare(j
))
5287 j
->daa_mode
= SOP_PU_SLEEP
;
5288 j
->flags
.pstn_ringing
= 0;
5289 j
->ex
.bits
.pstn_ring
= 0;
5290 j
->pstn_sleeptil
= jiffies
+ (hertz
/ 4);
5291 wake_up_interruptible(&j
->read_q
); /* Wake any blocked readers */
5292 wake_up_interruptible(&j
->write_q
); /* Wake any blocked writers */
5293 wake_up_interruptible(&j
->poll_q
); /* Wake any blocked selects */
5295 case SOP_PU_RINGING
:
5296 if (ixjdebug
& 0x0008)
5297 printk(KERN_INFO
"phone DAA: SOP_PU_RINGING at %ld\n", jiffies
);
5298 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
5300 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5301 j
->pld_slicw
.bits
.rly2
= 0;
5302 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
5304 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
;
5305 daa_load(&bytes
, j
);
5306 if (!SCI_Prepare(j
))
5308 j
->daa_mode
= SOP_PU_RINGING
;
5310 case SOP_PU_CONVERSATION
:
5311 if (ixjdebug
& 0x0008)
5312 printk(KERN_INFO
"phone DAA: SOP_PU_CONVERSATION at %ld\n", jiffies
);
5314 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
;
5315 daa_load(&bytes
, j
);
5316 if (!SCI_Prepare(j
))
5318 j
->pld_slicw
.bits
.rly2
= 1;
5319 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
5320 j
->pld_scrw
.bits
.daafsyncen
= 1; /* Turn on DAA Frame Sync */
5322 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5323 j
->daa_mode
= SOP_PU_CONVERSATION
;
5324 j
->flags
.pstn_ringing
= 0;
5325 j
->ex
.bits
.pstn_ring
= 0;
5326 j
->pstn_sleeptil
= jiffies
;
5327 j
->pstn_ring_start
= j
->pstn_ring_stop
= j
->pstn_ring_int
= 0;
5329 case SOP_PU_PULSEDIALING
:
5330 if (ixjdebug
& 0x0008)
5331 printk(KERN_INFO
"phone DAA: SOP_PU_PULSEDIALING at %ld\n", jiffies
);
5332 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
5334 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5335 j
->pld_slicw
.bits
.rly2
= 0;
5336 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
5338 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
;
5339 daa_load(&bytes
, j
);
5340 if (!SCI_Prepare(j
))
5342 j
->daa_mode
= SOP_PU_PULSEDIALING
;
5350 static int ixj_daa_write(IXJ
*j
)
5354 j
->flags
.pstncheck
= 1;
5356 daa_set_mode(j
, SOP_PU_SLEEP
);
5358 if (!SCI_Prepare(j
))
5361 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5364 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
;
5365 if (!daa_load(&bytes
, j
))
5368 bytes
.high
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
;
5369 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
;
5370 if (!daa_load(&bytes
, j
))
5373 bytes
.high
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
;
5374 bytes
.low
= j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
;
5375 if (!daa_load(&bytes
, j
))
5378 if (!SCI_Prepare(j
))
5382 bytes
.low
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr7
.reg
;
5383 if (!daa_load(&bytes
, j
))
5386 bytes
.high
= j
->m_DAAShadowRegs
.XOP_xr6_W
.reg
;
5387 bytes
.low
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr5
.reg
;
5388 if (!daa_load(&bytes
, j
))
5391 bytes
.high
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr4
.reg
;
5392 bytes
.low
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr3
.reg
;
5393 if (!daa_load(&bytes
, j
))
5396 bytes
.high
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr2
.reg
;
5397 bytes
.low
= j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr1
.reg
;
5398 if (!daa_load(&bytes
, j
))
5401 bytes
.high
= j
->m_DAAShadowRegs
.XOP_xr0_W
.reg
;
5403 if (!daa_load(&bytes
, j
))
5406 if (!SCI_Prepare(j
))
5410 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[7];
5411 if (!daa_load(&bytes
, j
))
5414 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[6];
5415 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[5];
5416 if (!daa_load(&bytes
, j
))
5419 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[4];
5420 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[3];
5421 if (!daa_load(&bytes
, j
))
5424 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[2];
5425 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[1];
5426 if (!daa_load(&bytes
, j
))
5429 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_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
.THFilterCoeff_2
[7];
5441 if (!daa_load(&bytes
, j
))
5444 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[6];
5445 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[5];
5446 if (!daa_load(&bytes
, j
))
5449 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[4];
5450 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[3];
5451 if (!daa_load(&bytes
, j
))
5454 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[2];
5455 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[1];
5456 if (!daa_load(&bytes
, j
))
5459 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_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
.THFilterCoeff_3
[7];
5471 if (!daa_load(&bytes
, j
))
5474 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[6];
5475 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[5];
5476 if (!daa_load(&bytes
, j
))
5479 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[4];
5480 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[3];
5481 if (!daa_load(&bytes
, j
))
5484 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[2];
5485 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[1];
5486 if (!daa_load(&bytes
, j
))
5489 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[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
.RingerImpendance_1
[7];
5501 if (!daa_load(&bytes
, j
))
5504 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[6];
5505 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[5];
5506 if (!daa_load(&bytes
, j
))
5509 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[4];
5510 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[3];
5511 if (!daa_load(&bytes
, j
))
5514 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[2];
5515 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[1];
5516 if (!daa_load(&bytes
, j
))
5519 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[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
.IMFilterCoeff_1
[7];
5531 if (!daa_load(&bytes
, j
))
5534 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[6];
5535 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[5];
5536 if (!daa_load(&bytes
, j
))
5539 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[4];
5540 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[3];
5541 if (!daa_load(&bytes
, j
))
5544 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[2];
5545 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[1];
5546 if (!daa_load(&bytes
, j
))
5549 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[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
.IMFilterCoeff_2
[7];
5561 if (!daa_load(&bytes
, j
))
5564 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[6];
5565 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[5];
5566 if (!daa_load(&bytes
, j
))
5569 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[4];
5570 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[3];
5571 if (!daa_load(&bytes
, j
))
5574 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[2];
5575 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[1];
5576 if (!daa_load(&bytes
, j
))
5579 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[0];
5581 if (!daa_load(&bytes
, j
))
5584 if (!SCI_Control(j
, SCI_End
))
5586 if (!SCI_WaitLowSCI(j
))
5590 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[7];
5591 if (!daa_load(&bytes
, j
))
5594 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[6];
5595 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[5];
5596 if (!daa_load(&bytes
, j
))
5599 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[4];
5600 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[3];
5601 if (!daa_load(&bytes
, j
))
5604 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[2];
5605 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[1];
5606 if (!daa_load(&bytes
, j
))
5609 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[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
.FRRFilterCoeff
[7];
5621 if (!daa_load(&bytes
, j
))
5624 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[6];
5625 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[5];
5626 if (!daa_load(&bytes
, j
))
5629 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[4];
5630 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[3];
5631 if (!daa_load(&bytes
, j
))
5634 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[2];
5635 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[1];
5636 if (!daa_load(&bytes
, j
))
5639 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[0];
5641 if (!daa_load(&bytes
, j
))
5644 if (!SCI_Control(j
, SCI_End
))
5646 if (!SCI_WaitLowSCI(j
))
5650 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[7];
5651 if (!daa_load(&bytes
, j
))
5654 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[6];
5655 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[5];
5656 if (!daa_load(&bytes
, j
))
5659 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[4];
5660 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[3];
5661 if (!daa_load(&bytes
, j
))
5664 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[2];
5665 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[1];
5666 if (!daa_load(&bytes
, j
))
5669 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[0];
5671 if (!daa_load(&bytes
, j
))
5674 if (!SCI_Control(j
, SCI_End
))
5676 if (!SCI_WaitLowSCI(j
))
5680 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[3];
5681 if (!daa_load(&bytes
, j
))
5684 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[2];
5685 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[1];
5686 if (!daa_load(&bytes
, j
))
5689 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[0];
5691 if (!daa_load(&bytes
, j
))
5694 if (!SCI_Control(j
, SCI_End
))
5696 if (!SCI_WaitLowSCI(j
))
5700 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[3];
5701 if (!daa_load(&bytes
, j
))
5704 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[2];
5705 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[1];
5706 if (!daa_load(&bytes
, j
))
5709 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[0];
5711 if (!daa_load(&bytes
, j
))
5714 if (!SCI_Control(j
, SCI_End
))
5716 if (!SCI_WaitLowSCI(j
))
5720 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[3];
5721 if (!daa_load(&bytes
, j
))
5724 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[2];
5725 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[1];
5726 if (!daa_load(&bytes
, j
))
5729 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[0];
5731 if (!daa_load(&bytes
, j
))
5734 if (!SCI_Control(j
, SCI_End
))
5736 if (!SCI_WaitLowSCI(j
))
5740 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[3];
5741 if (!daa_load(&bytes
, j
))
5744 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[2];
5745 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[1];
5746 if (!daa_load(&bytes
, j
))
5749 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[0];
5751 if (!daa_load(&bytes
, j
))
5754 if (!SCI_Control(j
, SCI_End
))
5756 if (!SCI_WaitLowSCI(j
))
5760 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[3];
5761 if (!daa_load(&bytes
, j
))
5764 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[2];
5765 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[1];
5766 if (!daa_load(&bytes
, j
))
5769 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[0];
5771 if (!daa_load(&bytes
, j
))
5774 if (!SCI_Control(j
, SCI_End
))
5776 if (!SCI_WaitLowSCI(j
))
5780 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[7];
5781 if (!daa_load(&bytes
, j
))
5784 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[6];
5785 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[5];
5786 if (!daa_load(&bytes
, j
))
5789 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[4];
5790 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[3];
5791 if (!daa_load(&bytes
, j
))
5794 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[2];
5795 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[1];
5796 if (!daa_load(&bytes
, j
))
5799 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[0];
5801 if (!daa_load(&bytes
, j
))
5804 if (!SCI_Control(j
, SCI_End
))
5806 if (!SCI_WaitLowSCI(j
))
5810 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[7];
5811 if (!daa_load(&bytes
, j
))
5814 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[6];
5815 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[5];
5816 if (!daa_load(&bytes
, j
))
5819 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[4];
5820 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[3];
5821 if (!daa_load(&bytes
, j
))
5824 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[2];
5825 bytes
.low
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[1];
5826 if (!daa_load(&bytes
, j
))
5829 bytes
.high
= j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[0];
5831 if (!daa_load(&bytes
, j
))
5835 j
->pld_scrr
.byte
= inb_p(j
->XILINXbase
);
5836 if (!SCI_Control(j
, SCI_End
))
5839 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
5841 if (ixjdebug
& 0x0002)
5842 printk("DAA Coefficients Loaded\n");
5844 j
->flags
.pstncheck
= 0;
5848 int ixj_set_tone_off(unsigned short arg
, IXJ
*j
)
5850 j
->tone_off_time
= arg
;
5851 if (ixj_WriteDSPCommand(0x6E05, j
)) /* Set Tone Off Period */
5854 if (ixj_WriteDSPCommand(arg
, j
))
5859 static int ixj_get_tone_on(IXJ
*j
)
5861 if (ixj_WriteDSPCommand(0x6E06, j
)) /* Get Tone On Period */
5867 static int ixj_get_tone_off(IXJ
*j
)
5869 if (ixj_WriteDSPCommand(0x6E07, j
)) /* Get Tone Off Period */
5875 static void ixj_busytone(IXJ
*j
)
5877 j
->flags
.ringback
= 0;
5878 j
->flags
.dialtone
= 0;
5879 j
->flags
.busytone
= 1;
5880 ixj_set_tone_on(0x07D0, j
);
5881 ixj_set_tone_off(0x07D0, j
);
5882 ixj_play_tone(j
, 27);
5885 static void ixj_dialtone(IXJ
*j
)
5887 j
->flags
.ringback
= 0;
5888 j
->flags
.dialtone
= 1;
5889 j
->flags
.busytone
= 0;
5890 if (j
->dsp
.low
== 0x20) {
5893 ixj_set_tone_on(0xFFFF, j
);
5894 ixj_set_tone_off(0x0000, j
);
5895 ixj_play_tone(j
, 25);
5899 static void ixj_cpt_stop(IXJ
*j
)
5901 if(j
->tone_state
|| j
->tone_cadence_state
)
5903 j
->flags
.dialtone
= 0;
5904 j
->flags
.busytone
= 0;
5905 j
->flags
.ringback
= 0;
5906 ixj_set_tone_on(0x0001, j
);
5907 ixj_set_tone_off(0x0000, j
);
5908 ixj_play_tone(j
, 0);
5909 j
->tone_state
= j
->tone_cadence_state
= 0;
5911 if (j
->cadence_t
->ce
) {
5912 kfree(j
->cadence_t
->ce
);
5914 kfree(j
->cadence_t
);
5915 j
->cadence_t
= NULL
;
5918 if (j
->play_mode
== -1 && j
->rec_mode
== -1)
5920 if (j
->play_mode
!= -1 && j
->dsp
.low
== 0x20)
5922 if (j
->rec_mode
!= -1 && j
->dsp
.low
== 0x20)
5923 ixj_record_start(j
);
5926 static void ixj_ringback(IXJ
*j
)
5928 j
->flags
.busytone
= 0;
5929 j
->flags
.dialtone
= 0;
5930 j
->flags
.ringback
= 1;
5931 ixj_set_tone_on(0x0FA0, j
);
5932 ixj_set_tone_off(0x2EE0, j
);
5933 ixj_play_tone(j
, 26);
5936 static void ixj_testram(IXJ
*j
)
5938 ixj_WriteDSPCommand(0x3001, j
); /* Test External SRAM */
5941 static int ixj_build_cadence(IXJ
*j
, IXJ_CADENCE __user
* cp
)
5944 IXJ_CADENCE_ELEMENT __user
*cep
;
5945 IXJ_CADENCE_ELEMENT
*lcep
;
5949 lcp
= kmalloc(sizeof(ixj_cadence
), GFP_KERNEL
);
5954 if (copy_from_user(&lcp
->elements_used
,
5955 &cp
->elements_used
, sizeof(int)))
5957 if (copy_from_user(&lcp
->termination
,
5958 &cp
->termination
, sizeof(IXJ_CADENCE_TERM
)))
5960 if (get_user(cep
, &cp
->ce
))
5964 if ((unsigned)lcp
->elements_used
>= ~0U/sizeof(IXJ_CADENCE_ELEMENT
))
5968 lcep
= kmalloc(sizeof(IXJ_CADENCE_ELEMENT
) * lcp
->elements_used
, GFP_KERNEL
);
5973 if (copy_from_user(lcep
, cep
, sizeof(IXJ_CADENCE_ELEMENT
) * lcp
->elements_used
))
5977 kfree(j
->cadence_t
->ce
);
5978 kfree(j
->cadence_t
);
5980 lcp
->ce
= (void *) lcep
;
5982 j
->tone_cadence_state
= 0;
5983 ixj_set_tone_on(lcp
->ce
[0].tone_on_time
, j
);
5984 ixj_set_tone_off(lcp
->ce
[0].tone_off_time
, j
);
5985 if (j
->cadence_t
->ce
[j
->tone_cadence_state
].freq0
) {
5986 ti
.tone_index
= j
->cadence_t
->ce
[j
->tone_cadence_state
].index
;
5987 ti
.freq0
= j
->cadence_t
->ce
[j
->tone_cadence_state
].freq0
;
5988 ti
.gain0
= j
->cadence_t
->ce
[j
->tone_cadence_state
].gain0
;
5989 ti
.freq1
= j
->cadence_t
->ce
[j
->tone_cadence_state
].freq1
;
5990 ti
.gain1
= j
->cadence_t
->ce
[j
->tone_cadence_state
].gain1
;
5991 ixj_init_tone(j
, &ti
);
5993 ixj_play_tone(j
, lcp
->ce
[0].index
);
6002 static int ixj_build_filter_cadence(IXJ
*j
, IXJ_FILTER_CADENCE __user
* cp
)
6004 IXJ_FILTER_CADENCE
*lcp
;
6005 lcp
= kmalloc(sizeof(IXJ_FILTER_CADENCE
), GFP_KERNEL
);
6007 if(ixjdebug
& 0x0001) {
6008 printk(KERN_INFO
"Could not allocate memory for cadence\n");
6012 if (copy_from_user(lcp
, cp
, sizeof(IXJ_FILTER_CADENCE
))) {
6013 if(ixjdebug
& 0x0001) {
6014 printk(KERN_INFO
"Could not copy cadence to kernel\n");
6019 if (lcp
->filter
> 5) {
6020 if(ixjdebug
& 0x0001) {
6021 printk(KERN_INFO
"Cadence out of range\n");
6026 j
->cadence_f
[lcp
->filter
].state
= 0;
6027 j
->cadence_f
[lcp
->filter
].enable
= lcp
->enable
;
6028 j
->filter_en
[lcp
->filter
] = j
->cadence_f
[lcp
->filter
].en_filter
= lcp
->en_filter
;
6029 j
->cadence_f
[lcp
->filter
].on1
= lcp
->on1
;
6030 j
->cadence_f
[lcp
->filter
].on1min
= 0;
6031 j
->cadence_f
[lcp
->filter
].on1max
= 0;
6032 j
->cadence_f
[lcp
->filter
].off1
= lcp
->off1
;
6033 j
->cadence_f
[lcp
->filter
].off1min
= 0;
6034 j
->cadence_f
[lcp
->filter
].off1max
= 0;
6035 j
->cadence_f
[lcp
->filter
].on2
= lcp
->on2
;
6036 j
->cadence_f
[lcp
->filter
].on2min
= 0;
6037 j
->cadence_f
[lcp
->filter
].on2max
= 0;
6038 j
->cadence_f
[lcp
->filter
].off2
= lcp
->off2
;
6039 j
->cadence_f
[lcp
->filter
].off2min
= 0;
6040 j
->cadence_f
[lcp
->filter
].off2max
= 0;
6041 j
->cadence_f
[lcp
->filter
].on3
= lcp
->on3
;
6042 j
->cadence_f
[lcp
->filter
].on3min
= 0;
6043 j
->cadence_f
[lcp
->filter
].on3max
= 0;
6044 j
->cadence_f
[lcp
->filter
].off3
= lcp
->off3
;
6045 j
->cadence_f
[lcp
->filter
].off3min
= 0;
6046 j
->cadence_f
[lcp
->filter
].off3max
= 0;
6048 if(ixjdebug
& 0x0002) {
6049 printk(KERN_INFO
"Cadence %d loaded\n", lcp
->filter
);
6054 static void add_caps(IXJ
*j
)
6057 j
->caplist
[j
->caps
].cap
= PHONE_VENDOR_QUICKNET
;
6058 strcpy(j
->caplist
[j
->caps
].desc
, "Quicknet Technologies, Inc. (www.quicknet.net)");
6059 j
->caplist
[j
->caps
].captype
= vendor
;
6060 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6061 j
->caplist
[j
->caps
].captype
= device
;
6062 switch (j
->cardtype
) {
6064 strcpy(j
->caplist
[j
->caps
].desc
, "Quicknet Internet PhoneJACK");
6067 strcpy(j
->caplist
[j
->caps
].desc
, "Quicknet Internet LineJACK");
6069 case QTI_PHONEJACK_LITE
:
6070 strcpy(j
->caplist
[j
->caps
].desc
, "Quicknet Internet PhoneJACK Lite");
6072 case QTI_PHONEJACK_PCI
:
6073 strcpy(j
->caplist
[j
->caps
].desc
, "Quicknet Internet PhoneJACK PCI");
6076 strcpy(j
->caplist
[j
->caps
].desc
, "Quicknet Internet PhoneCARD");
6079 j
->caplist
[j
->caps
].cap
= j
->cardtype
;
6080 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6081 strcpy(j
->caplist
[j
->caps
].desc
, "POTS");
6082 j
->caplist
[j
->caps
].captype
= port
;
6083 j
->caplist
[j
->caps
].cap
= pots
;
6084 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6086 /* add devices that can do speaker/mic */
6087 switch (j
->cardtype
) {
6090 case QTI_PHONEJACK_PCI
:
6092 strcpy(j
->caplist
[j
->caps
].desc
, "SPEAKER");
6093 j
->caplist
[j
->caps
].captype
= port
;
6094 j
->caplist
[j
->caps
].cap
= speaker
;
6095 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6100 /* add devices that can do handset */
6101 switch (j
->cardtype
) {
6103 strcpy(j
->caplist
[j
->caps
].desc
, "HANDSET");
6104 j
->caplist
[j
->caps
].captype
= port
;
6105 j
->caplist
[j
->caps
].cap
= handset
;
6106 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6112 /* add devices that can do PSTN */
6113 switch (j
->cardtype
) {
6115 strcpy(j
->caplist
[j
->caps
].desc
, "PSTN");
6116 j
->caplist
[j
->caps
].captype
= port
;
6117 j
->caplist
[j
->caps
].cap
= pstn
;
6118 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6124 /* add codecs - all cards can do uLaw, linear 8/16, and Windows sound system */
6125 strcpy(j
->caplist
[j
->caps
].desc
, "ULAW");
6126 j
->caplist
[j
->caps
].captype
= codec
;
6127 j
->caplist
[j
->caps
].cap
= ULAW
;
6128 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6130 strcpy(j
->caplist
[j
->caps
].desc
, "LINEAR 16 bit");
6131 j
->caplist
[j
->caps
].captype
= codec
;
6132 j
->caplist
[j
->caps
].cap
= LINEAR16
;
6133 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6135 strcpy(j
->caplist
[j
->caps
].desc
, "LINEAR 8 bit");
6136 j
->caplist
[j
->caps
].captype
= codec
;
6137 j
->caplist
[j
->caps
].cap
= LINEAR8
;
6138 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6140 strcpy(j
->caplist
[j
->caps
].desc
, "Windows Sound System");
6141 j
->caplist
[j
->caps
].captype
= codec
;
6142 j
->caplist
[j
->caps
].cap
= WSS
;
6143 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6145 /* software ALAW codec, made from ULAW */
6146 strcpy(j
->caplist
[j
->caps
].desc
, "ALAW");
6147 j
->caplist
[j
->caps
].captype
= codec
;
6148 j
->caplist
[j
->caps
].cap
= ALAW
;
6149 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6151 /* version 12 of the 8020 does the following codecs in a broken way */
6152 if (j
->dsp
.low
!= 0x20 || j
->ver
.low
!= 0x12) {
6153 strcpy(j
->caplist
[j
->caps
].desc
, "G.723.1 6.3kbps");
6154 j
->caplist
[j
->caps
].captype
= codec
;
6155 j
->caplist
[j
->caps
].cap
= G723_63
;
6156 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6158 strcpy(j
->caplist
[j
->caps
].desc
, "G.723.1 5.3kbps");
6159 j
->caplist
[j
->caps
].captype
= codec
;
6160 j
->caplist
[j
->caps
].cap
= G723_53
;
6161 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6163 strcpy(j
->caplist
[j
->caps
].desc
, "TrueSpeech 4.8kbps");
6164 j
->caplist
[j
->caps
].captype
= codec
;
6165 j
->caplist
[j
->caps
].cap
= TS48
;
6166 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6168 strcpy(j
->caplist
[j
->caps
].desc
, "TrueSpeech 4.1kbps");
6169 j
->caplist
[j
->caps
].captype
= codec
;
6170 j
->caplist
[j
->caps
].cap
= TS41
;
6171 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6174 /* 8020 chips can do TS8.5 native, and 8021/8022 can load it */
6175 if (j
->dsp
.low
== 0x20 || j
->flags
.ts85_loaded
) {
6176 strcpy(j
->caplist
[j
->caps
].desc
, "TrueSpeech 8.5kbps");
6177 j
->caplist
[j
->caps
].captype
= codec
;
6178 j
->caplist
[j
->caps
].cap
= TS85
;
6179 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6182 /* 8021 chips can do G728 */
6183 if (j
->dsp
.low
== 0x21) {
6184 strcpy(j
->caplist
[j
->caps
].desc
, "G.728 16kbps");
6185 j
->caplist
[j
->caps
].captype
= codec
;
6186 j
->caplist
[j
->caps
].cap
= G728
;
6187 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6190 /* 8021/8022 chips can do G729 if loaded */
6191 if (j
->dsp
.low
!= 0x20 && j
->flags
.g729_loaded
) {
6192 strcpy(j
->caplist
[j
->caps
].desc
, "G.729A 8kbps");
6193 j
->caplist
[j
->caps
].captype
= codec
;
6194 j
->caplist
[j
->caps
].cap
= G729
;
6195 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6197 if (j
->dsp
.low
!= 0x20 && j
->flags
.g729_loaded
) {
6198 strcpy(j
->caplist
[j
->caps
].desc
, "G.729B 8kbps");
6199 j
->caplist
[j
->caps
].captype
= codec
;
6200 j
->caplist
[j
->caps
].cap
= G729B
;
6201 j
->caplist
[j
->caps
].handle
= j
->caps
++;
6205 static int capabilities_check(IXJ
*j
, struct phone_capability
*pcreq
)
6209 for (cnt
= 0; cnt
< j
->caps
; cnt
++) {
6210 if (pcreq
->captype
== j
->caplist
[cnt
].captype
6211 && pcreq
->cap
== j
->caplist
[cnt
].cap
) {
6219 static int ixj_ioctl(struct inode
*inode
, struct file
*file_p
, unsigned int cmd
, unsigned long arg
)
6224 void __user
*argp
= (void __user
*)arg
;
6226 unsigned int raise
, mant
;
6227 unsigned int minor
= iminor(inode
);
6228 int board
= NUM(inode
);
6230 IXJ
*j
= get_ixj(NUM(inode
));
6235 * Set up locks to ensure that only one process is talking to the DSP at a time.
6236 * This is necessary to keep the DSP from locking up.
6238 while(test_and_set_bit(board
, (void *)&j
->busyflags
) != 0) {
6239 set_current_state(TASK_INTERRUPTIBLE
);
6240 schedule_timeout(1);
6242 if (ixjdebug
& 0x0040)
6243 printk("phone%d ioctl, cmd: 0x%x, arg: 0x%lx\n", minor
, cmd
, arg
);
6244 if (minor
>= IXJMAX
) {
6245 clear_bit(board
, &j
->busyflags
);
6249 * Check ioctls only root can use.
6251 if (!capable(CAP_SYS_ADMIN
)) {
6253 case IXJCTL_TESTRAM
:
6259 case IXJCTL_TESTRAM
:
6261 retval
= (j
->ssr
.high
<< 8) + j
->ssr
.low
;
6263 case IXJCTL_CARDTYPE
:
6264 retval
= j
->cardtype
;
6269 case IXJCTL_VERSION
:
6270 if (copy_to_user(argp
, ixj_c_revision
, strlen(ixj_c_revision
)))
6273 case PHONE_RING_CADENCE
:
6274 j
->ring_cadence
= arg
;
6278 if (copy_from_user(&j
->cid_send
, argp
, sizeof(PHONE_CID
))) {
6283 memset(&j
->cid_send
, 0, sizeof(PHONE_CID
));
6287 /* Binary compatbility */
6288 case OLD_PHONE_RING_START
:
6291 case PHONE_RING_START
:
6293 if (copy_from_user(&j
->cid_send
, argp
, sizeof(PHONE_CID
))) {
6299 memset(&j
->cid_send
, 0, sizeof(PHONE_CID
));
6303 case PHONE_RING_STOP
:
6304 j
->flags
.cringing
= 0;
6305 if(j
->cadence_f
[5].enable
) {
6306 j
->cadence_f
[5].state
= 0;
6311 retval
= ixj_ring(j
);
6313 case PHONE_EXCEPTION
:
6314 retval
= j
->ex
.bytes
;
6315 if(j
->ex
.bits
.flash
) {
6317 j
->ex
.bits
.flash
= 0;
6319 j
->ex
.bits
.pstn_ring
= 0;
6320 j
->ex
.bits
.caller_id
= 0;
6321 j
->ex
.bits
.pstn_wink
= 0;
6330 j
->ex
.bits
.reserved
= 0;
6332 case PHONE_HOOKSTATE
:
6333 j
->ex
.bits
.hookstate
= 0;
6334 retval
= j
->hookstate
; //j->r_hook;
6336 case IXJCTL_SET_LED
:
6337 LED_SetState(arg
, j
);
6340 retval
= set_base_frame(j
, arg
);
6342 case PHONE_REC_CODEC
:
6343 retval
= set_rec_codec(j
, arg
);
6348 case PHONE_REC_START
:
6349 ixj_record_start(j
);
6351 case PHONE_REC_STOP
:
6354 case PHONE_REC_DEPTH
:
6355 set_rec_depth(j
, arg
);
6357 case PHONE_REC_VOLUME
:
6359 retval
= get_rec_volume(j
);
6362 set_rec_volume(j
, arg
);
6366 case PHONE_REC_VOLUME_LINEAR
:
6368 retval
= get_rec_volume_linear(j
);
6371 set_rec_volume_linear(j
, arg
);
6375 case IXJCTL_DTMF_PRESCALE
:
6377 retval
= get_dtmf_prescale(j
);
6380 set_dtmf_prescale(j
, arg
);
6384 case PHONE_REC_LEVEL
:
6385 retval
= get_rec_level(j
);
6388 retval
= ixj_siadc(j
, arg
);
6391 retval
= ixj_sidac(j
, arg
);
6393 case IXJCTL_AEC_START
:
6394 ixj_aec_start(j
, arg
);
6396 case IXJCTL_AEC_STOP
:
6399 case IXJCTL_AEC_GET_LEVEL
:
6400 retval
= j
->aec_level
;
6402 case PHONE_PLAY_CODEC
:
6403 retval
= set_play_codec(j
, arg
);
6405 case PHONE_PLAY_START
:
6406 retval
= ixj_play_start(j
);
6408 case PHONE_PLAY_STOP
:
6411 case PHONE_PLAY_DEPTH
:
6412 set_play_depth(j
, arg
);
6414 case PHONE_PLAY_VOLUME
:
6416 retval
= get_play_volume(j
);
6419 set_play_volume(j
, arg
);
6423 case PHONE_PLAY_VOLUME_LINEAR
:
6425 retval
= get_play_volume_linear(j
);
6428 set_play_volume_linear(j
, arg
);
6432 case PHONE_PLAY_LEVEL
:
6433 retval
= get_play_level(j
);
6435 case IXJCTL_DSP_TYPE
:
6436 retval
= (j
->dsp
.high
<< 8) + j
->dsp
.low
;
6438 case IXJCTL_DSP_VERSION
:
6439 retval
= (j
->ver
.high
<< 8) + j
->ver
.low
;
6450 case IXJCTL_DRYBUFFER_READ
:
6451 put_user(j
->drybuffer
, (unsigned long __user
*) argp
);
6453 case IXJCTL_DRYBUFFER_CLEAR
:
6456 case IXJCTL_FRAMES_READ
:
6457 put_user(j
->framesread
, (unsigned long __user
*) argp
);
6459 case IXJCTL_FRAMES_WRITTEN
:
6460 put_user(j
->frameswritten
, (unsigned long __user
*) argp
);
6462 case IXJCTL_READ_WAIT
:
6463 put_user(j
->read_wait
, (unsigned long __user
*) argp
);
6465 case IXJCTL_WRITE_WAIT
:
6466 put_user(j
->write_wait
, (unsigned long __user
*) argp
);
6468 case PHONE_MAXRINGS
:
6471 case PHONE_SET_TONE_ON_TIME
:
6472 ixj_set_tone_on(arg
, j
);
6474 case PHONE_SET_TONE_OFF_TIME
:
6475 ixj_set_tone_off(arg
, j
);
6477 case PHONE_GET_TONE_ON_TIME
:
6478 if (ixj_get_tone_on(j
)) {
6481 retval
= (j
->ssr
.high
<< 8) + j
->ssr
.low
;
6484 case PHONE_GET_TONE_OFF_TIME
:
6485 if (ixj_get_tone_off(j
)) {
6488 retval
= (j
->ssr
.high
<< 8) + j
->ssr
.low
;
6491 case PHONE_PLAY_TONE
:
6493 retval
= ixj_play_tone(j
, arg
);
6497 case PHONE_GET_TONE_STATE
:
6498 retval
= j
->tone_state
;
6500 case PHONE_DTMF_READY
:
6501 retval
= j
->ex
.bits
.dtmf_ready
;
6503 case PHONE_GET_DTMF
:
6504 if (ixj_hookstate(j
)) {
6505 if (j
->dtmf_rp
!= j
->dtmf_wp
) {
6506 retval
= j
->dtmfbuffer
[j
->dtmf_rp
];
6508 if (j
->dtmf_rp
== 79)
6510 if (j
->dtmf_rp
== j
->dtmf_wp
) {
6511 j
->ex
.bits
.dtmf_ready
= j
->dtmf_rp
= j
->dtmf_wp
= 0;
6516 case PHONE_GET_DTMF_ASCII
:
6517 if (ixj_hookstate(j
)) {
6518 if (j
->dtmf_rp
!= j
->dtmf_wp
) {
6519 switch (j
->dtmfbuffer
[j
->dtmf_rp
]) {
6521 retval
= 42; /* '*'; */
6525 retval
= 48; /*'0'; */
6529 retval
= 35; /*'#'; */
6533 retval
= 65; /*'A'; */
6537 retval
= 66; /*'B'; */
6541 retval
= 67; /*'C'; */
6545 retval
= 68; /*'D'; */
6549 retval
= 48 + j
->dtmfbuffer
[j
->dtmf_rp
];
6553 if (j
->dtmf_rp
== 79)
6555 if(j
->dtmf_rp
== j
->dtmf_wp
)
6557 j
->ex
.bits
.dtmf_ready
= j
->dtmf_rp
= j
->dtmf_wp
= 0;
6562 case PHONE_DTMF_OOB
:
6563 j
->flags
.dtmf_oob
= arg
;
6565 case PHONE_DIALTONE
:
6571 case PHONE_RINGBACK
:
6575 if(j
->cardtype
== QTI_PHONEJACK
)
6578 retval
= ixj_wink(j
);
6580 case PHONE_CPT_STOP
:
6583 case PHONE_QUERY_CODEC
:
6585 struct phone_codec_data pd
;
6587 int proto_size
[] = {
6589 12, 10, 16, 9, 8, 48, 5,
6590 40, 40, 80, 40, 40, 6
6592 if(copy_from_user(&pd
, argp
, sizeof(pd
))) {
6596 if(pd
.type
<1 || pd
.type
>13) {
6597 retval
= -EPROTONOSUPPORT
;
6601 val
=proto_size
[pd
.type
];
6602 else switch(j
->baseframe
.low
)
6604 case 0xA0:val
=2*proto_size
[pd
.type
];break;
6605 case 0x50:val
=proto_size
[pd
.type
];break;
6606 default:val
=proto_size
[pd
.type
]*3;break;
6608 pd
.buf_min
=pd
.buf_max
=pd
.buf_opt
=val
;
6609 if(copy_to_user(argp
, &pd
, sizeof(pd
)))
6613 case IXJCTL_DSP_IDLE
:
6617 if ((arg
& 0xff) == 0xff)
6618 retval
= ixj_get_mixer(arg
, j
);
6622 case IXJCTL_DAA_COEFF_SET
:
6626 retval
= ixj_daa_write(j
);
6630 retval
= ixj_daa_write(j
);
6633 DAA_Coeff_France(j
);
6634 retval
= ixj_daa_write(j
);
6637 DAA_Coeff_Germany(j
);
6638 retval
= ixj_daa_write(j
);
6641 DAA_Coeff_Australia(j
);
6642 retval
= ixj_daa_write(j
);
6646 retval
= ixj_daa_write(j
);
6653 case IXJCTL_DAA_AGAIN
:
6654 ixj_daa_cr4(j
, arg
| 0x02);
6656 case IXJCTL_PSTN_LINETEST
:
6657 retval
= ixj_linetest(j
);
6660 ixj_write_vmwi(j
, arg
);
6663 if (copy_to_user(argp
, &j
->cid
, sizeof(PHONE_CID
)))
6665 j
->ex
.bits
.caller_id
= 0;
6667 case IXJCTL_WINK_DURATION
:
6672 retval
= ixj_set_port(j
, arg
);
6676 case IXJCTL_POTS_PSTN
:
6677 retval
= ixj_set_pots(j
, arg
);
6679 case PHONE_CAPABILITIES
:
6683 case PHONE_CAPABILITIES_LIST
:
6685 if (copy_to_user(argp
, j
->caplist
, sizeof(struct phone_capability
) * j
->caps
))
6688 case PHONE_CAPABILITIES_CHECK
:
6690 struct phone_capability cap
;
6691 if (copy_from_user(&cap
, argp
, sizeof(cap
)))
6695 retval
= capabilities_check(j
, &cap
);
6699 case PHONE_PSTN_SET_STATE
:
6700 daa_set_mode(j
, arg
);
6702 case PHONE_PSTN_GET_STATE
:
6703 retval
= j
->daa_mode
;
6704 j
->ex
.bits
.pstn_ring
= 0;
6706 case IXJCTL_SET_FILTER
:
6707 if (copy_from_user(&jf
, argp
, sizeof(jf
)))
6709 retval
= ixj_init_filter(j
, &jf
);
6711 case IXJCTL_SET_FILTER_RAW
:
6712 if (copy_from_user(&jfr
, argp
, sizeof(jfr
)))
6715 retval
= ixj_init_filter_raw(j
, &jfr
);
6717 case IXJCTL_GET_FILTER_HIST
:
6721 retval
= j
->filter_hist
[arg
];
6723 case IXJCTL_INIT_TONE
:
6724 if (copy_from_user(&ti
, argp
, sizeof(ti
)))
6727 retval
= ixj_init_tone(j
, &ti
);
6729 case IXJCTL_TONE_CADENCE
:
6730 retval
= ixj_build_cadence(j
, argp
);
6732 case IXJCTL_FILTER_CADENCE
:
6733 retval
= ixj_build_filter_cadence(j
, argp
);
6736 if (copy_from_user(&j
->sigdef
, argp
, sizeof(IXJ_SIGDEF
))) {
6740 j
->ixj_signals
[j
->sigdef
.event
] = j
->sigdef
.signal
;
6741 if(j
->sigdef
.event
< 33) {
6743 for(mant
= 0; mant
< j
->sigdef
.event
; mant
++){
6746 if(j
->sigdef
.signal
)
6747 j
->ex_sig
.bytes
|= raise
;
6749 j
->ex_sig
.bytes
&= (raise
^0xffff);
6752 case IXJCTL_INTERCOM_STOP
:
6753 if(arg
< 0 || arg
>= IXJMAX
)
6759 get_ixj(arg
)->intercom
= -1;
6760 ixj_record_stop(get_ixj(arg
));
6761 ixj_play_stop(get_ixj(arg
));
6764 case IXJCTL_INTERCOM_START
:
6765 if(arg
< 0 || arg
>= IXJMAX
)
6768 ixj_record_start(j
);
6770 get_ixj(arg
)->intercom
= board
;
6771 ixj_play_start(get_ixj(arg
));
6772 ixj_record_start(get_ixj(arg
));
6775 if (ixjdebug
& 0x0040)
6776 printk("phone%d ioctl end, cmd: 0x%x, arg: 0x%lx\n", minor
, cmd
, arg
);
6777 clear_bit(board
, &j
->busyflags
);
6781 static int ixj_fasync(int fd
, struct file
*file_p
, int mode
)
6783 IXJ
*j
= get_ixj(NUM(file_p
->f_dentry
->d_inode
));
6785 return fasync_helper(fd
, file_p
, mode
, &j
->async_queue
);
6788 struct file_operations ixj_fops
=
6790 .owner
= THIS_MODULE
,
6791 .read
= ixj_enhanced_read
,
6792 .write
= ixj_enhanced_write
,
6795 .release
= ixj_release
,
6796 .fasync
= ixj_fasync
6799 static int ixj_linetest(IXJ
*j
)
6801 unsigned long jifwait
;
6803 j
->flags
.pstncheck
= 1; /* Testing */
6804 j
->flags
.pstn_present
= 0; /* Assume the line is not there */
6806 daa_int_read(j
); /*Clear DAA Interrupt flags */
6808 /* Hold all relays in the normally de-energized position. */
6811 j
->pld_slicw
.bits
.rly1
= 0;
6812 j
->pld_slicw
.bits
.rly2
= 0;
6813 j
->pld_slicw
.bits
.rly3
= 0;
6814 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
6815 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
6817 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
6818 j
->pld_slicr
.byte
= inb_p(j
->XILINXbase
+ 0x01);
6819 if (j
->pld_slicr
.bits
.potspstn
) {
6820 j
->flags
.pots_pstn
= 1;
6821 j
->flags
.pots_correct
= 0;
6822 LED_SetState(0x4, j
);
6824 j
->flags
.pots_pstn
= 0;
6825 j
->pld_slicw
.bits
.rly1
= 0;
6826 j
->pld_slicw
.bits
.rly2
= 0;
6827 j
->pld_slicw
.bits
.rly3
= 1;
6828 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
6829 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
6831 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
6832 daa_set_mode(j
, SOP_PU_CONVERSATION
);
6833 jifwait
= jiffies
+ hertz
;
6834 while (time_before(jiffies
, jifwait
)) {
6835 set_current_state(TASK_INTERRUPTIBLE
);
6836 schedule_timeout(1);
6839 daa_set_mode(j
, SOP_PU_RESET
);
6840 if (j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.VDD_OK
) {
6841 j
->flags
.pots_correct
= 0; /* Should not be line voltage on POTS port. */
6842 LED_SetState(0x4, j
);
6843 j
->pld_slicw
.bits
.rly3
= 0;
6844 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
6846 j
->flags
.pots_correct
= 1;
6847 LED_SetState(0x8, j
);
6848 j
->pld_slicw
.bits
.rly1
= 1;
6849 j
->pld_slicw
.bits
.rly2
= 0;
6850 j
->pld_slicw
.bits
.rly3
= 0;
6851 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
6854 j
->pld_slicw
.bits
.rly3
= 0;
6855 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
6856 daa_set_mode(j
, SOP_PU_CONVERSATION
);
6857 jifwait
= jiffies
+ hertz
;
6858 while (time_before(jiffies
, jifwait
)) {
6859 set_current_state(TASK_INTERRUPTIBLE
);
6860 schedule_timeout(1);
6863 daa_set_mode(j
, SOP_PU_RESET
);
6864 if (j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.VDD_OK
) {
6865 j
->pstn_sleeptil
= jiffies
+ (hertz
/ 4);
6866 j
->flags
.pstn_present
= 1;
6868 j
->flags
.pstn_present
= 0;
6870 if (j
->flags
.pstn_present
) {
6871 if (j
->flags
.pots_correct
) {
6872 LED_SetState(0xA, j
);
6874 LED_SetState(0x6, j
);
6877 if (j
->flags
.pots_correct
) {
6878 LED_SetState(0x9, j
);
6880 LED_SetState(0x5, j
);
6883 j
->flags
.pstncheck
= 0; /* Testing */
6884 return j
->flags
.pstn_present
;
6887 static int ixj_selfprobe(IXJ
*j
)
6894 init_waitqueue_head(&j
->poll_q
);
6895 init_waitqueue_head(&j
->read_q
);
6896 init_waitqueue_head(&j
->write_q
);
6898 while(atomic_read(&j
->DSPWrite
) > 0)
6899 atomic_dec(&j
->DSPWrite
);
6900 if (ixjdebug
& 0x0002)
6901 printk(KERN_INFO
"Write IDLE to Software Control Register\n");
6902 ixj_WriteDSPCommand(0x0FE0, j
); /* Put the DSP in full power mode. */
6904 if (ixj_WriteDSPCommand(0x0000, j
)) /* Write IDLE to Software Control Register */
6906 /* The read values of the SSR should be 0x00 for the IDLE command */
6907 if (j
->ssr
.low
|| j
->ssr
.high
)
6909 if (ixjdebug
& 0x0002)
6910 printk(KERN_INFO
"Get Device ID Code\n");
6911 if (ixj_WriteDSPCommand(0x3400, j
)) /* Get Device ID Code */
6913 j
->dsp
.low
= j
->ssr
.low
;
6914 j
->dsp
.high
= j
->ssr
.high
;
6915 if (ixjdebug
& 0x0002)
6916 printk(KERN_INFO
"Get Device Version Code\n");
6917 if (ixj_WriteDSPCommand(0x3800, j
)) /* Get Device Version Code */
6919 j
->ver
.low
= j
->ssr
.low
;
6920 j
->ver
.high
= j
->ssr
.high
;
6922 if (j
->dsp
.low
== 0x21) {
6923 bytes
.high
= bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
6924 outb_p(bytes
.low
^ 0xFF, j
->XILINXbase
+ 0x02);
6925 /* Test for Internet LineJACK or Internet PhoneJACK Lite */
6926 bytes
.low
= inb_p(j
->XILINXbase
+ 0x02);
6927 if (bytes
.low
== bytes
.high
) /* Register is read only on */
6928 /* Internet PhoneJack Lite */
6930 j
->cardtype
= QTI_PHONEJACK_LITE
;
6931 if (!request_region(j
->XILINXbase
, 4, "ixj control")) {
6932 printk(KERN_INFO
"ixj: can't get I/O address 0x%x\n", j
->XILINXbase
);
6935 j
->pld_slicw
.pcib
.e1
= 1;
6936 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
);
6938 j
->cardtype
= QTI_LINEJACK
;
6940 if (!request_region(j
->XILINXbase
, 8, "ixj control")) {
6941 printk(KERN_INFO
"ixj: can't get I/O address 0x%x\n", j
->XILINXbase
);
6945 } else if (j
->dsp
.low
== 0x22) {
6946 j
->cardtype
= QTI_PHONEJACK_PCI
;
6947 request_region(j
->XILINXbase
, 4, "ixj control");
6948 j
->pld_slicw
.pcib
.e1
= 1;
6949 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
);
6951 j
->cardtype
= QTI_PHONEJACK
;
6953 switch (j
->cardtype
) {
6955 if (!j
->dsp
.low
!= 0x20) {
6958 ixj_WriteDSPCommand(0x3800, j
);
6959 j
->ver
.low
= j
->ssr
.low
;
6960 j
->ver
.high
= j
->ssr
.high
;
6964 if (!request_region(j
->XILINXbase
, 8, "ixj control")) {
6965 printk(KERN_INFO
"ixj: can't get I/O address 0x%x\n", j
->XILINXbase
);
6969 case QTI_PHONEJACK_LITE
:
6970 case QTI_PHONEJACK_PCI
:
6971 if (!request_region(j
->XILINXbase
, 4, "ixj control")) {
6972 printk(KERN_INFO
"ixj: can't get I/O address 0x%x\n", j
->XILINXbase
);
6975 j
->pld_slicw
.pcib
.e1
= 1;
6976 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
);
6982 if (j
->dsp
.low
== 0x20 || j
->cardtype
== QTI_PHONEJACK_LITE
|| j
->cardtype
== QTI_PHONEJACK_PCI
) {
6983 if (ixjdebug
& 0x0002)
6984 printk(KERN_INFO
"Write CODEC config to Software Control Register\n");
6985 if (ixj_WriteDSPCommand(0xC462, j
)) /* Write CODEC config to Software Control Register */
6987 if (ixjdebug
& 0x0002)
6988 printk(KERN_INFO
"Write CODEC timing to Software Control Register\n");
6989 if (j
->cardtype
== QTI_PHONEJACK
) {
6994 if (ixj_WriteDSPCommand(cmd
, j
)) /* Write CODEC timing to Software Control Register */
6997 if (set_base_frame(j
, 30) != 30)
6999 if (ixjdebug
& 0x0002)
7000 printk(KERN_INFO
"Write CODEC config to Software Control Register\n");
7001 if (j
->cardtype
== QTI_PHONECARD
) {
7002 if (ixj_WriteDSPCommand(0xC528, j
)) /* Write CODEC config to Software Control Register */
7005 if (j
->cardtype
== QTI_LINEJACK
) {
7006 if (ixj_WriteDSPCommand(0xC528, j
)) /* Write CODEC config to Software Control Register */
7008 if (ixjdebug
& 0x0002)
7009 printk(KERN_INFO
"Turn on the PLD Clock at 8Khz\n");
7010 j
->pld_clock
.byte
= 0;
7011 outb_p(j
->pld_clock
.byte
, j
->XILINXbase
+ 0x04);
7015 if (j
->dsp
.low
== 0x20) {
7016 if (ixjdebug
& 0x0002)
7017 printk(KERN_INFO
"Configure GPIO pins\n");
7018 j
->gpio
.bytes
.high
= 0x09;
7019 /* bytes.low = 0xEF; 0xF7 */
7020 j
->gpio
.bits
.gpio1
= 1;
7021 j
->gpio
.bits
.gpio2
= 1;
7022 j
->gpio
.bits
.gpio3
= 0;
7023 j
->gpio
.bits
.gpio4
= 1;
7024 j
->gpio
.bits
.gpio5
= 1;
7025 j
->gpio
.bits
.gpio6
= 1;
7026 j
->gpio
.bits
.gpio7
= 1;
7027 ixj_WriteDSPCommand(j
->gpio
.word
, j
); /* Set GPIO pin directions */
7028 if (ixjdebug
& 0x0002)
7029 printk(KERN_INFO
"Enable SLIC\n");
7030 j
->gpio
.bytes
.high
= 0x0B;
7031 j
->gpio
.bytes
.low
= 0x00;
7032 j
->gpio
.bits
.gpio1
= 0;
7033 j
->gpio
.bits
.gpio2
= 1;
7034 j
->gpio
.bits
.gpio5
= 0;
7035 ixj_WriteDSPCommand(j
->gpio
.word
, j
); /* send the ring stop signal */
7036 j
->port
= PORT_POTS
;
7038 if (j
->cardtype
== QTI_LINEJACK
) {
7039 LED_SetState(0x1, j
);
7040 jif
= jiffies
+ (hertz
/ 10);
7041 while (time_before(jiffies
, jif
)) {
7042 set_current_state(TASK_INTERRUPTIBLE
);
7043 schedule_timeout(1);
7045 LED_SetState(0x2, j
);
7046 jif
= jiffies
+ (hertz
/ 10);
7047 while (time_before(jiffies
, jif
)) {
7048 set_current_state(TASK_INTERRUPTIBLE
);
7049 schedule_timeout(1);
7051 LED_SetState(0x4, j
);
7052 jif
= jiffies
+ (hertz
/ 10);
7053 while (time_before(jiffies
, jif
)) {
7054 set_current_state(TASK_INTERRUPTIBLE
);
7055 schedule_timeout(1);
7057 LED_SetState(0x8, j
);
7058 jif
= jiffies
+ (hertz
/ 10);
7059 while (time_before(jiffies
, jif
)) {
7060 set_current_state(TASK_INTERRUPTIBLE
);
7061 schedule_timeout(1);
7063 LED_SetState(0x0, j
);
7065 if (ixjdebug
& 0x0002)
7066 printk("Loading DAA Coefficients\n");
7068 if (!ixj_daa_write(j
)) {
7069 printk("DAA write failed on board %d\n", j
->board
);
7072 if(!ixj_daa_cid_reset(j
)) {
7073 printk("DAA CID reset failed on board %d\n", j
->board
);
7076 j
->flags
.pots_correct
= 0;
7077 j
->flags
.pstn_present
= 0;
7079 if (j
->flags
.pots_correct
) {
7080 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
7082 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
7083 j
->pld_slicw
.bits
.rly1
= 1;
7084 j
->pld_slicw
.bits
.spken
= 1;
7085 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
7086 SLIC_SetState(PLD_SLIC_STATE_STANDBY
, j
);
7087 /* SLIC_SetState(PLD_SLIC_STATE_ACTIVE, j); */
7088 j
->port
= PORT_POTS
;
7090 ixj_set_port(j
, PORT_PSTN
);
7092 if (ixjdebug
& 0x0002)
7093 printk(KERN_INFO
"Enable Mixer\n");
7094 ixj_mixer(0x0000, j
); /*Master Volume Left unmute 0db */
7095 ixj_mixer(0x0100, j
); /*Master Volume Right unmute 0db */
7097 ixj_mixer(0x0203, j
); /*Voice Left Volume unmute 6db */
7098 ixj_mixer(0x0303, j
); /*Voice Right Volume unmute 6db */
7100 ixj_mixer(0x0480, j
); /*FM Left mute */
7101 ixj_mixer(0x0580, j
); /*FM Right mute */
7103 ixj_mixer(0x0680, j
); /*CD Left mute */
7104 ixj_mixer(0x0780, j
); /*CD Right mute */
7106 ixj_mixer(0x0880, j
); /*Line Left mute */
7107 ixj_mixer(0x0980, j
); /*Line Right mute */
7109 ixj_mixer(0x0A80, j
); /*Aux left mute */
7110 ixj_mixer(0x0B80, j
); /*Aux right mute */
7112 ixj_mixer(0x0C00, j
); /*Mono1 unmute 12db */
7113 ixj_mixer(0x0D80, j
); /*Mono2 mute */
7115 ixj_mixer(0x0E80, j
); /*Mic mute */
7117 ixj_mixer(0x0F00, j
); /*Mono Out Volume unmute 0db */
7119 ixj_mixer(0x1000, j
); /*Voice Left and Right out only */
7120 ixj_mixer(0x110C, j
);
7123 ixj_mixer(0x1200, j
); /*Mono1 switch on mixer left */
7124 ixj_mixer(0x1401, j
);
7126 ixj_mixer(0x1300, j
); /*Mono1 switch on mixer right */
7127 ixj_mixer(0x1501, j
);
7129 ixj_mixer(0x1700, j
); /*Clock select */
7131 ixj_mixer(0x1800, j
); /*ADC input from mixer */
7133 ixj_mixer(0x1901, j
); /*Mic gain 30db */
7135 if (ixjdebug
& 0x0002)
7136 printk(KERN_INFO
"Setting Default US Ring Cadence Detection\n");
7137 j
->cadence_f
[4].state
= 0;
7138 j
->cadence_f
[4].on1
= 0; /*Cadence Filter 4 is used for PSTN ring cadence */
7139 j
->cadence_f
[4].off1
= 0;
7140 j
->cadence_f
[4].on2
= 0;
7141 j
->cadence_f
[4].off2
= 0;
7142 j
->cadence_f
[4].on3
= 0;
7143 j
->cadence_f
[4].off3
= 0; /* These should represent standard US ring pulse. */
7144 j
->pstn_last_rmr
= jiffies
;
7147 if (j
->cardtype
== QTI_PHONECARD
) {
7148 ixj_WriteDSPCommand(0xCF07, j
);
7149 ixj_WriteDSPCommand(0x00B0, j
);
7150 ixj_set_port(j
, PORT_SPEAKER
);
7152 ixj_set_port(j
, PORT_POTS
);
7153 SLIC_SetState(PLD_SLIC_STATE_STANDBY
, j
);
7154 /* SLIC_SetState(PLD_SLIC_STATE_ACTIVE, j); */
7160 j
->framesread
= j
->frameswritten
= 0;
7161 j
->read_wait
= j
->write_wait
= 0;
7162 j
->rxreadycheck
= j
->txreadycheck
= 0;
7164 /* initialise the DTMF prescale to a sensible value */
7165 if (j
->cardtype
== QTI_LINEJACK
) {
7166 set_dtmf_prescale(j
, 0x10);
7168 set_dtmf_prescale(j
, 0x40);
7170 set_play_volume(j
, 0x100);
7171 set_rec_volume(j
, 0x100);
7173 if (ixj_WriteDSPCommand(0x0000, j
)) /* Write IDLE to Software Control Register */
7175 /* The read values of the SSR should be 0x00 for the IDLE command */
7176 if (j
->ssr
.low
|| j
->ssr
.high
)
7179 if (ixjdebug
& 0x0002)
7180 printk(KERN_INFO
"Enable Line Monitor\n");
7182 if (ixjdebug
& 0x0002)
7183 printk(KERN_INFO
"Set Line Monitor to Asyncronous Mode\n");
7185 if (ixj_WriteDSPCommand(0x7E01, j
)) /* Asynchronous Line Monitor */
7188 if (ixjdebug
& 0x002)
7189 printk(KERN_INFO
"Enable DTMF Detectors\n");
7191 if (ixj_WriteDSPCommand(0x5151, j
)) /* Enable DTMF detection */
7194 if (ixj_WriteDSPCommand(0x6E01, j
)) /* Set Asyncronous Tone Generation */
7197 set_rec_depth(j
, 2); /* Set Record Channel Limit to 2 frames */
7199 set_play_depth(j
, 2); /* Set Playback Channel Limit to 2 frames */
7201 j
->ex
.bits
.dtmf_ready
= 0;
7203 j
->dtmf_wp
= j
->dtmf_rp
= 0;
7204 j
->rec_mode
= j
->play_mode
= -1;
7205 j
->flags
.ringing
= 0;
7206 j
->maxrings
= MAXRINGS
;
7207 j
->ring_cadence
= USA_RING_CADENCE
;
7210 j
->flags
.dtmf_oob
= 0;
7211 for (cnt
= 0; cnt
< 4; cnt
++)
7212 j
->cadence_f
[cnt
].enable
= 0;
7213 /* must be a device on the specified address */
7214 ixj_WriteDSPCommand(0x0FE3, j
); /* Put the DSP in 1/5 power mode. */
7216 /* Set up the default signals for events */
7217 for (cnt
= 0; cnt
< 35; cnt
++)
7218 j
->ixj_signals
[cnt
] = SIGIO
;
7220 /* Set the excetion signal enable flags */
7221 j
->ex_sig
.bits
.dtmf_ready
= j
->ex_sig
.bits
.hookstate
= j
->ex_sig
.bits
.flash
= j
->ex_sig
.bits
.pstn_ring
=
7222 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
=
7223 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;
7224 #ifdef IXJ_DYN_ALLOC
7230 /* Register with the Telephony for Linux subsystem */
7231 j
->p
.f_op
= &ixj_fops
;
7232 j
->p
.open
= ixj_open
;
7233 j
->p
.board
= j
->board
;
7234 phone_register_device(&j
->p
, PHONE_UNIT_ANY
);
7242 * Exported service for pcmcia card handling
7245 IXJ
*ixj_pcmcia_probe(unsigned long dsp
, unsigned long xilinx
)
7247 IXJ
*j
= ixj_alloc();
7252 j
->XILINXbase
= xilinx
;
7253 j
->cardtype
= QTI_PHONECARD
;
7258 EXPORT_SYMBOL(ixj_pcmcia_probe
); /* Fpr PCMCIA */
7260 static int ixj_get_status_proc(char *buf
)
7266 len
+= sprintf(buf
+ len
, "%s", ixj_c_rcsid
);
7267 len
+= sprintf(buf
+ len
, "\n%s", ixj_h_rcsid
);
7268 len
+= sprintf(buf
+ len
, "\n%s", ixjuser_h_rcsid
);
7269 len
+= sprintf(buf
+ len
, "\nDriver version %i.%i.%i", IXJ_VER_MAJOR
, IXJ_VER_MINOR
, IXJ_BLD_VER
);
7270 len
+= sprintf(buf
+ len
, "\nsizeof IXJ struct %Zd bytes", sizeof(IXJ
));
7271 len
+= sprintf(buf
+ len
, "\nsizeof DAA struct %Zd bytes", sizeof(DAA_REGS
));
7272 len
+= sprintf(buf
+ len
, "\nUsing old telephony API");
7273 len
+= sprintf(buf
+ len
, "\nDebug Level %d\n", ixjdebug
);
7275 for (cnt
= 0; cnt
< IXJMAX
; cnt
++) {
7280 len
+= sprintf(buf
+ len
, "\nCard Num %d", cnt
);
7281 len
+= sprintf(buf
+ len
, "\nDSP Base Address 0x%4.4x", j
->DSPbase
);
7282 if (j
->cardtype
!= QTI_PHONEJACK
)
7283 len
+= sprintf(buf
+ len
, "\nXILINX Base Address 0x%4.4x", j
->XILINXbase
);
7284 len
+= sprintf(buf
+ len
, "\nDSP Type %2.2x%2.2x", j
->dsp
.high
, j
->dsp
.low
);
7285 len
+= sprintf(buf
+ len
, "\nDSP Version %2.2x.%2.2x", j
->ver
.high
, j
->ver
.low
);
7286 len
+= sprintf(buf
+ len
, "\nSerial Number %8.8x", j
->serial
);
7287 switch (j
->cardtype
) {
7288 case (QTI_PHONEJACK
):
7289 len
+= sprintf(buf
+ len
, "\nCard Type = Internet PhoneJACK");
7291 case (QTI_LINEJACK
):
7292 len
+= sprintf(buf
+ len
, "\nCard Type = Internet LineJACK");
7293 if (j
->flags
.g729_loaded
)
7294 len
+= sprintf(buf
+ len
, " w/G.729 A/B");
7295 len
+= sprintf(buf
+ len
, " Country = %d", j
->daa_country
);
7297 case (QTI_PHONEJACK_LITE
):
7298 len
+= sprintf(buf
+ len
, "\nCard Type = Internet PhoneJACK Lite");
7299 if (j
->flags
.g729_loaded
)
7300 len
+= sprintf(buf
+ len
, " w/G.729 A/B");
7302 case (QTI_PHONEJACK_PCI
):
7303 len
+= sprintf(buf
+ len
, "\nCard Type = Internet PhoneJACK PCI");
7304 if (j
->flags
.g729_loaded
)
7305 len
+= sprintf(buf
+ len
, " w/G.729 A/B");
7307 case (QTI_PHONECARD
):
7308 len
+= sprintf(buf
+ len
, "\nCard Type = Internet PhoneCARD");
7309 if (j
->flags
.g729_loaded
)
7310 len
+= sprintf(buf
+ len
, " w/G.729 A/B");
7311 len
+= sprintf(buf
+ len
, "\nSmart Cable %spresent", j
->pccr1
.bits
.drf
? "not " : "");
7312 if (!j
->pccr1
.bits
.drf
)
7313 len
+= sprintf(buf
+ len
, "\nSmart Cable type %d", j
->flags
.pcmciasct
);
7314 len
+= sprintf(buf
+ len
, "\nSmart Cable state %d", j
->flags
.pcmciastate
);
7317 len
+= sprintf(buf
+ len
, "\nCard Type = %d", j
->cardtype
);
7320 len
+= sprintf(buf
+ len
, "\nReaders %d", j
->readers
);
7321 len
+= sprintf(buf
+ len
, "\nWriters %d", j
->writers
);
7323 len
+= sprintf(buf
+ len
, "\nCapabilities %d", j
->caps
);
7324 if (j
->dsp
.low
!= 0x20)
7325 len
+= sprintf(buf
+ len
, "\nDSP Processor load %d", j
->proc_load
);
7326 if (j
->flags
.cidsent
)
7327 len
+= sprintf(buf
+ len
, "\nCaller ID data sent");
7329 len
+= sprintf(buf
+ len
, "\nCaller ID data not sent");
7331 len
+= sprintf(buf
+ len
, "\nPlay CODEC ");
7332 switch (j
->play_codec
) {
7334 len
+= sprintf(buf
+ len
, "G.723.1 6.3");
7337 len
+= sprintf(buf
+ len
, "G.723.1 5.3");
7340 len
+= sprintf(buf
+ len
, "TrueSpeech 8.5");
7343 len
+= sprintf(buf
+ len
, "TrueSpeech 4.8");
7346 len
+= sprintf(buf
+ len
, "TrueSpeech 4.1");
7349 len
+= sprintf(buf
+ len
, "G.728");
7352 len
+= sprintf(buf
+ len
, "G.729");
7355 len
+= sprintf(buf
+ len
, "G.729B");
7358 len
+= sprintf(buf
+ len
, "uLaw");
7361 len
+= sprintf(buf
+ len
, "aLaw");
7364 len
+= sprintf(buf
+ len
, "16 bit Linear");
7367 len
+= sprintf(buf
+ len
, "8 bit Linear");
7370 len
+= sprintf(buf
+ len
, "Windows Sound System");
7373 len
+= sprintf(buf
+ len
, "NO CODEC CHOSEN");
7376 len
+= sprintf(buf
+ len
, "\nRecord CODEC ");
7377 switch (j
->rec_codec
) {
7379 len
+= sprintf(buf
+ len
, "G.723.1 6.3");
7382 len
+= sprintf(buf
+ len
, "G.723.1 5.3");
7385 len
+= sprintf(buf
+ len
, "TrueSpeech 8.5");
7388 len
+= sprintf(buf
+ len
, "TrueSpeech 4.8");
7391 len
+= sprintf(buf
+ len
, "TrueSpeech 4.1");
7394 len
+= sprintf(buf
+ len
, "G.728");
7397 len
+= sprintf(buf
+ len
, "G.729");
7400 len
+= sprintf(buf
+ len
, "G.729B");
7403 len
+= sprintf(buf
+ len
, "uLaw");
7406 len
+= sprintf(buf
+ len
, "aLaw");
7409 len
+= sprintf(buf
+ len
, "16 bit Linear");
7412 len
+= sprintf(buf
+ len
, "8 bit Linear");
7415 len
+= sprintf(buf
+ len
, "Windows Sound System");
7418 len
+= sprintf(buf
+ len
, "NO CODEC CHOSEN");
7421 len
+= sprintf(buf
+ len
, "\nAEC ");
7422 switch (j
->aec_level
) {
7424 len
+= sprintf(buf
+ len
, "Off");
7427 len
+= sprintf(buf
+ len
, "Low");
7430 len
+= sprintf(buf
+ len
, "Med");
7433 len
+= sprintf(buf
+ len
, "High");
7436 len
+= sprintf(buf
+ len
, "Auto");
7439 len
+= sprintf(buf
+ len
, "AEC/AGC");
7442 len
+= sprintf(buf
+ len
, "unknown(%i)", j
->aec_level
);
7446 len
+= sprintf(buf
+ len
, "\nRec volume 0x%x", get_rec_volume(j
));
7447 len
+= sprintf(buf
+ len
, "\nPlay volume 0x%x", get_play_volume(j
));
7448 len
+= sprintf(buf
+ len
, "\nDTMF prescale 0x%x", get_dtmf_prescale(j
));
7450 len
+= sprintf(buf
+ len
, "\nHook state %d", j
->hookstate
); /* j->r_hook); */
7452 if (j
->cardtype
== QTI_LINEJACK
) {
7453 len
+= sprintf(buf
+ len
, "\nPOTS Correct %d", j
->flags
.pots_correct
);
7454 len
+= sprintf(buf
+ len
, "\nPSTN Present %d", j
->flags
.pstn_present
);
7455 len
+= sprintf(buf
+ len
, "\nPSTN Check %d", j
->flags
.pstncheck
);
7456 len
+= sprintf(buf
+ len
, "\nPOTS to PSTN %d", j
->flags
.pots_pstn
);
7457 switch (j
->daa_mode
) {
7459 len
+= sprintf(buf
+ len
, "\nDAA PSTN On Hook");
7461 case SOP_PU_RINGING
:
7462 len
+= sprintf(buf
+ len
, "\nDAA PSTN Ringing");
7463 len
+= sprintf(buf
+ len
, "\nRinging state = %d", j
->cadence_f
[4].state
);
7465 case SOP_PU_CONVERSATION
:
7466 len
+= sprintf(buf
+ len
, "\nDAA PSTN Off Hook");
7468 case SOP_PU_PULSEDIALING
:
7469 len
+= sprintf(buf
+ len
, "\nDAA PSTN Pulse Dialing");
7472 len
+= sprintf(buf
+ len
, "\nDAA RMR = %d", j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.bitreg
.RMR
);
7473 len
+= sprintf(buf
+ len
, "\nDAA VDD OK = %d", j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.bitreg
.VDD_OK
);
7474 len
+= sprintf(buf
+ len
, "\nDAA CR0 = 0x%02x", j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
);
7475 len
+= sprintf(buf
+ len
, "\nDAA CR1 = 0x%02x", j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
);
7476 len
+= sprintf(buf
+ len
, "\nDAA CR2 = 0x%02x", j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
);
7477 len
+= sprintf(buf
+ len
, "\nDAA CR3 = 0x%02x", j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
);
7478 len
+= sprintf(buf
+ len
, "\nDAA CR4 = 0x%02x", j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
);
7479 len
+= sprintf(buf
+ len
, "\nDAA CR5 = 0x%02x", j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr5
.reg
);
7480 len
+= sprintf(buf
+ len
, "\nDAA XR0 = 0x%02x", j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr0
.reg
);
7481 len
+= sprintf(buf
+ len
, "\nDAA ringstop %ld - jiffies %ld", j
->pstn_ring_stop
, jiffies
);
7485 len
+= sprintf(buf
+ len
, "\nPort POTS");
7488 len
+= sprintf(buf
+ len
, "\nPort PSTN");
7491 len
+= sprintf(buf
+ len
, "\nPort SPEAKER/MIC");
7494 len
+= sprintf(buf
+ len
, "\nPort HANDSET");
7497 if (j
->dsp
.low
== 0x21 || j
->dsp
.low
== 0x22) {
7498 len
+= sprintf(buf
+ len
, "\nSLIC state ");
7499 switch (SLIC_GetState(j
)) {
7500 case PLD_SLIC_STATE_OC
:
7501 len
+= sprintf(buf
+ len
, "OC");
7503 case PLD_SLIC_STATE_RINGING
:
7504 len
+= sprintf(buf
+ len
, "RINGING");
7506 case PLD_SLIC_STATE_ACTIVE
:
7507 len
+= sprintf(buf
+ len
, "ACTIVE");
7509 case PLD_SLIC_STATE_OHT
: /* On-hook transmit */
7510 len
+= sprintf(buf
+ len
, "OHT");
7512 case PLD_SLIC_STATE_TIPOPEN
:
7513 len
+= sprintf(buf
+ len
, "TIPOPEN");
7515 case PLD_SLIC_STATE_STANDBY
:
7516 len
+= sprintf(buf
+ len
, "STANDBY");
7518 case PLD_SLIC_STATE_APR
: /* Active polarity reversal */
7519 len
+= sprintf(buf
+ len
, "APR");
7521 case PLD_SLIC_STATE_OHTPR
: /* OHT polarity reversal */
7522 len
+= sprintf(buf
+ len
, "OHTPR");
7525 len
+= sprintf(buf
+ len
, "%d", SLIC_GetState(j
));
7529 len
+= sprintf(buf
+ len
, "\nBase Frame %2.2x.%2.2x", j
->baseframe
.high
, j
->baseframe
.low
);
7530 len
+= sprintf(buf
+ len
, "\nCID Base Frame %2d", j
->cid_base_frame_size
);
7531 #ifdef PERFMON_STATS
7532 len
+= sprintf(buf
+ len
, "\nTimer Checks %ld", j
->timerchecks
);
7533 len
+= sprintf(buf
+ len
, "\nRX Ready Checks %ld", j
->rxreadycheck
);
7534 len
+= sprintf(buf
+ len
, "\nTX Ready Checks %ld", j
->txreadycheck
);
7535 len
+= sprintf(buf
+ len
, "\nFrames Read %ld", j
->framesread
);
7536 len
+= sprintf(buf
+ len
, "\nFrames Written %ld", j
->frameswritten
);
7537 len
+= sprintf(buf
+ len
, "\nDry Buffer %ld", j
->drybuffer
);
7538 len
+= sprintf(buf
+ len
, "\nRead Waits %ld", j
->read_wait
);
7539 len
+= sprintf(buf
+ len
, "\nWrite Waits %ld", j
->write_wait
);
7540 len
+= sprintf(buf
+ len
, "\nStatus Waits %ld", j
->statuswait
);
7541 len
+= sprintf(buf
+ len
, "\nStatus Wait Fails %ld", j
->statuswaitfail
);
7542 len
+= sprintf(buf
+ len
, "\nPControl Waits %ld", j
->pcontrolwait
);
7543 len
+= sprintf(buf
+ len
, "\nPControl Wait Fails %ld", j
->pcontrolwaitfail
);
7544 len
+= sprintf(buf
+ len
, "\nIs Control Ready Checks %ld", j
->iscontrolready
);
7545 len
+= sprintf(buf
+ len
, "\nIs Control Ready Check failures %ld", j
->iscontrolreadyfail
);
7548 len
+= sprintf(buf
+ len
, "\n");
7554 static int ixj_read_proc(char *page
, char **start
, off_t off
,
7555 int count
, int *eof
, void *data
)
7557 int len
= ixj_get_status_proc(page
);
7558 if (len
<= off
+count
) *eof
= 1;
7559 *start
= page
+ off
;
7561 if (len
>count
) len
= count
;
7567 static void cleanup(void)
7572 for (cnt
= 0; cnt
< IXJMAX
; cnt
++) {
7574 if(j
!= NULL
&& j
->DSPbase
) {
7575 if (ixjdebug
& 0x0002)
7576 printk(KERN_INFO
"IXJ: Deleting timer for /dev/phone%d\n", cnt
);
7577 del_timer(&j
->timer
);
7578 if (j
->cardtype
== QTI_LINEJACK
) {
7579 j
->pld_scrw
.bits
.daafsyncen
= 0; /* Turn off DAA Frame Sync */
7581 outb_p(j
->pld_scrw
.byte
, j
->XILINXbase
);
7582 j
->pld_slicw
.bits
.rly1
= 0;
7583 j
->pld_slicw
.bits
.rly2
= 0;
7584 j
->pld_slicw
.bits
.rly3
= 0;
7585 outb_p(j
->pld_slicw
.byte
, j
->XILINXbase
+ 0x01);
7586 LED_SetState(0x0, j
);
7587 if (ixjdebug
& 0x0002)
7588 printk(KERN_INFO
"IXJ: Releasing XILINX address for /dev/phone%d\n", cnt
);
7589 release_region(j
->XILINXbase
, 8);
7590 } else if (j
->cardtype
== QTI_PHONEJACK_LITE
|| j
->cardtype
== QTI_PHONEJACK_PCI
) {
7591 if (ixjdebug
& 0x0002)
7592 printk(KERN_INFO
"IXJ: Releasing XILINX address for /dev/phone%d\n", cnt
);
7593 release_region(j
->XILINXbase
, 4);
7596 kfree(j
->read_buffer
);
7597 if (j
->write_buffer
)
7598 kfree(j
->write_buffer
);
7600 pnp_device_detach(j
->dev
);
7601 if (ixjdebug
& 0x0002)
7602 printk(KERN_INFO
"IXJ: Unregistering /dev/phone%d from LTAPI\n", cnt
);
7603 phone_unregister_device(&j
->p
);
7604 if (ixjdebug
& 0x0002)
7605 printk(KERN_INFO
"IXJ: Releasing DSP address for /dev/phone%d\n", cnt
);
7606 release_region(j
->DSPbase
, 16);
7607 #ifdef IXJ_DYN_ALLOC
7608 if (ixjdebug
& 0x0002)
7609 printk(KERN_INFO
"IXJ: Freeing memory for /dev/phone%d\n", cnt
);
7615 if (ixjdebug
& 0x0002)
7616 printk(KERN_INFO
"IXJ: Removing /proc/ixj\n");
7617 remove_proc_entry ("ixj", NULL
);
7626 static void PCIEE_WriteBit(WORD wEEPROMAddress
, BYTE lastLCC
, BYTE byData
)
7628 lastLCC
= lastLCC
& 0xfb;
7629 lastLCC
= lastLCC
| (byData
? 4 : 0);
7630 outb(lastLCC
, wEEPROMAddress
); /*set data out bit as appropriate */
7633 lastLCC
= lastLCC
| 0x01;
7634 outb(lastLCC
, wEEPROMAddress
); /*SK rising edge */
7636 byData
= byData
<< 1;
7637 lastLCC
= lastLCC
& 0xfe;
7639 outb(lastLCC
, wEEPROMAddress
); /*after delay, SK falling edge */
7643 static BYTE
PCIEE_ReadBit(WORD wEEPROMAddress
, BYTE lastLCC
)
7646 lastLCC
= lastLCC
| 0x01;
7647 outb(lastLCC
, wEEPROMAddress
); /*SK rising edge */
7649 lastLCC
= lastLCC
& 0xfe;
7651 outb(lastLCC
, wEEPROMAddress
); /*after delay, SK falling edge */
7653 return ((inb(wEEPROMAddress
) >> 3) & 1);
7656 static BOOL
PCIEE_ReadWord(WORD wAddress
, WORD wLoc
, WORD
* pwResult
)
7659 WORD wEEPROMAddress
= wAddress
+ 3;
7663 lastLCC
= inb(wEEPROMAddress
);
7664 lastLCC
= lastLCC
| 0x02;
7665 lastLCC
= lastLCC
& 0xfe;
7666 outb(lastLCC
, wEEPROMAddress
); /* CS hi, SK lo */
7668 mdelay(1); /* delay */
7670 PCIEE_WriteBit(wEEPROMAddress
, lastLCC
, 1);
7671 PCIEE_WriteBit(wEEPROMAddress
, lastLCC
, 1);
7672 PCIEE_WriteBit(wEEPROMAddress
, lastLCC
, 0);
7673 for (i
= 0; i
< 8; i
++) {
7674 PCIEE_WriteBit(wEEPROMAddress
, lastLCC
, wLoc
& 0x80 ? 1 : 0);
7678 for (i
= 0; i
< 16; i
++) {
7679 byResult
= PCIEE_ReadBit(wEEPROMAddress
, lastLCC
);
7680 *pwResult
= (*pwResult
<< 1) | byResult
;
7683 mdelay(1); /* another delay */
7685 lastLCC
= lastLCC
& 0xfd;
7686 outb(lastLCC
, wEEPROMAddress
); /* negate CS */
7691 static DWORD
PCIEE_GetSerialNumber(WORD wAddress
)
7694 if (PCIEE_ReadWord(wAddress
, 62, &wLo
))
7696 if (PCIEE_ReadWord(wAddress
, 63, &wHi
))
7698 return (((DWORD
) wHi
<< 16) | wLo
);
7701 static int dspio
[IXJMAX
+ 1] =
7705 static int xio
[IXJMAX
+ 1] =
7710 MODULE_PARM(dspio
, "1-" __MODULE_STRING(IXJMAX
) "i");
7711 MODULE_PARM(xio
, "1-" __MODULE_STRING(IXJMAX
) "i");
7712 MODULE_DESCRIPTION("Quicknet VoIP Telephony card module - www.quicknet.net");
7713 MODULE_AUTHOR("Ed Okerson <eokerson@quicknet.net>");
7714 MODULE_LICENSE("GPL");
7716 static void __exit
ixj_exit(void)
7721 static IXJ
*new_ixj(unsigned long port
)
7724 if (!request_region(port
, 16, "ixj DSP")) {
7725 printk(KERN_INFO
"ixj: can't get I/O address 0x%lx\n", port
);
7730 release_region(port
, 16);
7731 printk(KERN_INFO
"ixj: out of memory\n");
7734 res
->DSPbase
= port
;
7738 int __init
ixj_probe_isapnp(int *cnt
)
7742 struct pnp_dev
*dev
= NULL
, *old_dev
= NULL
;
7750 dev
= pnp_find_dev(NULL
, ISAPNP_VENDOR('Q', 'T', 'I'),
7751 ISAPNP_FUNCTION(func
), old_dev
);
7752 if (!dev
|| !dev
->card
)
7754 result
= pnp_device_attach(dev
);
7756 printk("pnp attach failed %d \n", result
);
7759 if (pnp_activate_dev(dev
) < 0) {
7760 printk("pnp activate failed (out of resources?)\n");
7761 pnp_device_detach(dev
);
7765 if (!pnp_port_valid(dev
, 0)) {
7766 pnp_device_detach(dev
);
7770 j
= new_ixj(pnp_port_start(dev
, 0));
7775 j
->XILINXbase
= pnp_port_start(dev
, 1); /* get real port */
7779 j
->cardtype
= QTI_PHONEJACK
;
7782 j
->cardtype
= QTI_LINEJACK
;
7785 j
->cardtype
= QTI_PHONEJACK_LITE
;
7789 probe
= ixj_selfprobe(j
);
7791 j
->serial
= dev
->card
->serial
;
7795 printk(KERN_INFO
"ixj: found Internet PhoneJACK at 0x%x\n", j
->DSPbase
);
7798 printk(KERN_INFO
"ixj: found Internet LineJACK at 0x%x\n", j
->DSPbase
);
7801 printk(KERN_INFO
"ixj: found Internet PhoneJACK Lite at 0x%x\n", j
->DSPbase
);
7818 int __init
ixj_probe_isa(int *cnt
)
7822 /* Use passed parameters for older kernels without PnP */
7823 for (i
= 0; i
< IXJMAX
; i
++) {
7825 IXJ
*j
= new_ixj(dspio
[i
]);
7830 j
->XILINXbase
= xio
[i
];
7834 probe
= ixj_selfprobe(j
);
7842 int __init
ixj_probe_pci(int *cnt
)
7844 struct pci_dev
*pci
= NULL
;
7848 for (i
= 0; i
< IXJMAX
- *cnt
; i
++) {
7849 pci
= pci_find_device(0x15E2, 0x0500, pci
);
7853 if (pci_enable_device(pci
))
7855 j
= new_ixj(pci_resource_start(pci
, 0));
7859 j
->serial
= (PCIEE_GetSerialNumber
)pci_resource_start(pci
, 2);
7860 j
->XILINXbase
= j
->DSPbase
+ 0x10;
7861 j
->cardtype
= QTI_PHONEJACK_PCI
;
7863 probe
= ixj_selfprobe(j
);
7865 printk(KERN_INFO
"ixj: found Internet PhoneJACK PCI at 0x%x\n", j
->DSPbase
);
7871 static int __init
ixj_init(void)
7878 /* These might be no-ops, see above. */
7879 if ((probe
= ixj_probe_isapnp(&cnt
)) < 0) {
7882 if ((probe
= ixj_probe_isa(&cnt
)) < 0) {
7885 if ((probe
= ixj_probe_pci(&cnt
)) < 0) {
7888 printk("%s\n", ixj_c_rcsid
);
7889 create_proc_read_entry ("ixj", 0, NULL
, ixj_read_proc
, NULL
);
7893 module_init(ixj_init
);
7894 module_exit(ixj_exit
);
7896 static void DAA_Coeff_US(IXJ
*j
)
7900 j
->daa_country
= DAA_US
;
7901 /*----------------------------------------------- */
7903 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
; i
++) {
7904 j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
[i
] = 0;
7907 /* Bytes for IM-filter part 1 (04): 0E,32,E2,2F,C2,5A,C0,00 */
7908 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[7] = 0x03;
7909 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[6] = 0x4B;
7910 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[5] = 0x5D;
7911 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[4] = 0xCD;
7912 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[3] = 0x24;
7913 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[2] = 0xC5;
7914 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[1] = 0xA0;
7915 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[0] = 0x00;
7916 /* Bytes for IM-filter part 2 (05): 72,85,00,0E,2B,3A,D0,08 */
7917 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[7] = 0x71;
7918 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[6] = 0x1A;
7919 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[5] = 0x00;
7920 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[4] = 0x0A;
7921 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[3] = 0xB5;
7922 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[2] = 0x33;
7923 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[1] = 0xE0;
7924 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[0] = 0x08;
7925 /* Bytes for FRX-filter (08): 03,8F,48,F2,8F,48,70,08 */
7926 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[7] = 0x05;
7927 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[6] = 0xA3;
7928 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[5] = 0x72;
7929 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[4] = 0x34;
7930 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[3] = 0x3F;
7931 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[2] = 0x3B;
7932 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[1] = 0x30;
7933 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[0] = 0x08;
7934 /* Bytes for FRR-filter (07): 04,8F,38,7F,9B,EA,B0,08 */
7935 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[7] = 0x05;
7936 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[6] = 0x87;
7937 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[5] = 0xF9;
7938 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[4] = 0x3E;
7939 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[3] = 0x32;
7940 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[2] = 0xDA;
7941 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[1] = 0xB0;
7942 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[0] = 0x08;
7943 /* Bytes for AX-filter (0A): 16,55,DD,CA */
7944 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[3] = 0x41;
7945 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[2] = 0xB5;
7946 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[1] = 0xDD;
7947 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[0] = 0xCA;
7948 /* Bytes for AR-filter (09): 52,D3,11,42 */
7949 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[3] = 0x25;
7950 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[2] = 0xC7;
7951 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[1] = 0x10;
7952 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[0] = 0xD6;
7953 /* Bytes for TH-filter part 1 (00): 00,42,48,81,B3,80,00,98 */
7954 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[7] = 0x00;
7955 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[6] = 0x42;
7956 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[5] = 0x48;
7957 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[4] = 0x81;
7958 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[3] = 0xA5;
7959 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[2] = 0x80;
7960 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[1] = 0x00;
7961 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[0] = 0x98;
7962 /* Bytes for TH-filter part 2 (01): 02,F2,33,A0,68,AB,8A,AD */
7963 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[7] = 0x02;
7964 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[6] = 0xA2;
7965 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[5] = 0x2B;
7966 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[4] = 0xB0;
7967 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[3] = 0xE8;
7968 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[2] = 0xAB;
7969 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[1] = 0x81;
7970 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[0] = 0xCC;
7971 /* Bytes for TH-filter part 3 (02): 00,88,DA,54,A4,BA,2D,BB */
7972 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[7] = 0x00;
7973 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[6] = 0x88;
7974 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[5] = 0xD2;
7975 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[4] = 0x24;
7976 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[3] = 0xBA;
7977 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[2] = 0xA9;
7978 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[1] = 0x3B;
7979 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[0] = 0xA6;
7980 /* ; (10K, 0.68uF) */
7982 /* Bytes for Ringing part 1 (03):1B,3B,9B,BA,D4,1C,B3,23 */
7983 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[7] = 0x1B;
7984 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[6] = 0x3C;
7985 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[5] = 0x93;
7986 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[4] = 0x3A;
7987 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[3] = 0x22;
7988 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[2] = 0x12;
7989 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[1] = 0xA3;
7990 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[0] = 0x23;
7991 /* Bytes for Ringing part 2 (06):13,42,A6,BA,D4,73,CA,D5 */
7992 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[7] = 0x12;
7993 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[6] = 0xA2;
7994 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[5] = 0xA6;
7995 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[4] = 0xBA;
7996 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[3] = 0x22;
7997 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[2] = 0x7A;
7998 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[1] = 0x0A;
7999 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[0] = 0xD5;
8001 /* Levelmetering Ringing (0D):B2,45,0F,8E */
8002 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[3] = 0xAA;
8003 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[2] = 0x35;
8004 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[1] = 0x0F;
8005 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[0] = 0x8E;
8007 /* Bytes for Ringing part 1 (03):1B,3B,9B,BA,D4,1C,B3,23 */
8008 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[7] = 0x1C; */
8009 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[6] = 0xB3; */
8010 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[5] = 0xAB; */
8011 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[4] = 0xAB; */
8012 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[3] = 0x54; */
8013 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[2] = 0x2D; */
8014 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[1] = 0x62; */
8015 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[0] = 0x2D; */
8016 /* Bytes for Ringing part 2 (06):13,42,A6,BA,D4,73,CA,D5 */
8017 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[7] = 0x2D; */
8018 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[6] = 0x62; */
8019 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[5] = 0xA6; */
8020 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[4] = 0xBB; */
8021 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[3] = 0x2A; */
8022 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[2] = 0x7D; */
8023 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[1] = 0x0A; */
8024 /* j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[0] = 0xD4; */
8026 /* Levelmetering Ringing (0D):B2,45,0F,8E */
8027 /* j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[3] = 0xAA; */
8028 /* j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[2] = 0x05; */
8029 /* j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[1] = 0x0F; */
8030 /* j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[0] = 0x8E; */
8032 /* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
8033 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[7] = 0xCA;
8034 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[6] = 0x0E;
8035 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[5] = 0xCA;
8036 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[4] = 0x09;
8037 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[3] = 0x99;
8038 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[2] = 0x99;
8039 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[1] = 0x99;
8040 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[0] = 0x99;
8041 /* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
8042 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[7] = 0xFD;
8043 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[6] = 0xB5;
8044 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[5] = 0xBA;
8045 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[4] = 0x07;
8046 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[3] = 0xDA;
8047 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[2] = 0x00;
8048 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[1] = 0x00;
8049 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[0] = 0x00;
8052 /* Config. Reg. 0 (filters) (cr0):FE ; CLK gen. by crystal */
8053 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
= 0xFF;
8054 /* Config. Reg. 1 (dialing) (cr1):05 */
8055 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
= 0x05;
8056 /* Config. Reg. 2 (caller ID) (cr2):04 */
8057 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
= 0x04;
8058 /* Config. Reg. 3 (testloops) (cr3):03 ; SEL Bit==0, HP-disabled */
8059 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
= 0x00;
8060 /* Config. Reg. 4 (analog gain) (cr4):02 */
8061 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= 0x02;
8062 /* Config. Reg. 5 (Version) (cr5):02 */
8063 /* Config. Reg. 6 (Reserved) (cr6):00 */
8064 /* Config. Reg. 7 (Reserved) (cr7):00 */
8067 /* Ext. Reg. 0 (Interrupt Reg.) (xr0):02 */
8069 j
->m_DAAShadowRegs
.XOP_xr0_W
.reg
= 0x02; /* SO_1 set to '1' because it is inverted. */
8070 /* Ext. Reg. 1 (Interrupt enable) (xr1):3C Cadence, RING, Caller ID, VDD_OK */
8072 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr1
.reg
= 0x3C;
8073 /* Ext. Reg. 2 (Cadence Time Out) (xr2):7D */
8074 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr2
.reg
= 0x7D;
8075 /* Ext. Reg. 3 (DC Char) (xr3):32 ; B-Filter Off == 1 */
8076 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr3
.reg
= 0x3B; /*0x32; */
8077 /* Ext. Reg. 4 (Cadence) (xr4):00 */
8079 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr4
.reg
= 0x00;
8080 /* Ext. Reg. 5 (Ring timer) (xr5):22 */
8081 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr5
.reg
= 0x22;
8082 /* Ext. Reg. 6 (Power State) (xr6):00 */
8083 j
->m_DAAShadowRegs
.XOP_xr6_W
.reg
= 0x00;
8084 /* Ext. Reg. 7 (Vdd) (xr7):40 */
8085 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr7
.reg
= 0x40; /* 0x40 ??? Should it be 0x00? */
8087 /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
8088 /* 12,33,5A,C3 ; 770 Hz */
8089 /* 13,3C,5B,32 ; 852 Hz */
8090 /* 1D,1B,5C,CC ; 941 Hz */
8092 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[3] = 0x11;
8093 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[2] = 0xB3;
8094 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[1] = 0x5A;
8095 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[0] = 0x2C;
8096 /* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
8097 /* EC,1D,52,22 ; 1336 Hz */
8098 /* AA,AC,51,D2 ; 1477 Hz */
8099 /* 9B,3B,51,25 ; 1633 Hz */
8100 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[3] = 0x32;
8101 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[2] = 0x32;
8102 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[1] = 0x52;
8103 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[0] = 0xB3;
8106 static void DAA_Coeff_UK(IXJ
*j
)
8110 j
->daa_country
= DAA_UK
;
8111 /*----------------------------------------------- */
8113 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
; i
++) {
8114 j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
[i
] = 0;
8117 /* Bytes for IM-filter part 1 (04): 00,C2,BB,A8,CB,81,A0,00 */
8118 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[7] = 0x00;
8119 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[6] = 0xC2;
8120 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[5] = 0xBB;
8121 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[4] = 0xA8;
8122 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[3] = 0xCB;
8123 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[2] = 0x81;
8124 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[1] = 0xA0;
8125 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[0] = 0x00;
8126 /* Bytes for IM-filter part 2 (05): 40,00,00,0A,A4,33,E0,08 */
8127 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[7] = 0x40;
8128 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[6] = 0x00;
8129 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[5] = 0x00;
8130 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[4] = 0x0A;
8131 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[3] = 0xA4;
8132 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[2] = 0x33;
8133 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[1] = 0xE0;
8134 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[0] = 0x08;
8135 /* Bytes for FRX-filter (08): 07,9B,ED,24,B2,A2,A0,08 */
8136 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[7] = 0x07;
8137 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[6] = 0x9B;
8138 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[5] = 0xED;
8139 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[4] = 0x24;
8140 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[3] = 0xB2;
8141 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[2] = 0xA2;
8142 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[1] = 0xA0;
8143 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[0] = 0x08;
8144 /* Bytes for FRR-filter (07): 0F,92,F2,B2,87,D2,30,08 */
8145 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[7] = 0x0F;
8146 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[6] = 0x92;
8147 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[5] = 0xF2;
8148 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[4] = 0xB2;
8149 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[3] = 0x87;
8150 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[2] = 0xD2;
8151 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[1] = 0x30;
8152 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[0] = 0x08;
8153 /* Bytes for AX-filter (0A): 1B,A5,DD,CA */
8154 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[3] = 0x1B;
8155 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[2] = 0xA5;
8156 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[1] = 0xDD;
8157 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[0] = 0xCA;
8158 /* Bytes for AR-filter (09): E2,27,10,D6 */
8159 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[3] = 0xE2;
8160 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[2] = 0x27;
8161 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[1] = 0x10;
8162 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[0] = 0xD6;
8163 /* Bytes for TH-filter part 1 (00): 80,2D,38,8B,D0,00,00,98 */
8164 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[7] = 0x80;
8165 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[6] = 0x2D;
8166 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[5] = 0x38;
8167 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[4] = 0x8B;
8168 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[3] = 0xD0;
8169 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[2] = 0x00;
8170 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[1] = 0x00;
8171 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[0] = 0x98;
8172 /* Bytes for TH-filter part 2 (01): 02,5A,53,F0,0B,5F,84,D4 */
8173 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[7] = 0x02;
8174 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[6] = 0x5A;
8175 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[5] = 0x53;
8176 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[4] = 0xF0;
8177 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[3] = 0x0B;
8178 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[2] = 0x5F;
8179 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[1] = 0x84;
8180 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[0] = 0xD4;
8181 /* Bytes for TH-filter part 3 (02): 00,88,6A,A4,8F,52,F5,32 */
8182 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[7] = 0x00;
8183 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[6] = 0x88;
8184 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[5] = 0x6A;
8185 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[4] = 0xA4;
8186 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[3] = 0x8F;
8187 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[2] = 0x52;
8188 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[1] = 0xF5;
8189 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[0] = 0x32;
8191 /* Bytes for Ringing part 1 (03):1B,3C,93,3A,22,12,A3,23 */
8192 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[7] = 0x1B;
8193 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[6] = 0x3C;
8194 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[5] = 0x93;
8195 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[4] = 0x3A;
8196 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[3] = 0x22;
8197 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[2] = 0x12;
8198 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[1] = 0xA3;
8199 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[0] = 0x23;
8200 /* Bytes for Ringing part 2 (06):12,A2,A6,BA,22,7A,0A,D5 */
8201 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[7] = 0x12;
8202 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[6] = 0xA2;
8203 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[5] = 0xA6;
8204 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[4] = 0xBA;
8205 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[3] = 0x22;
8206 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[2] = 0x7A;
8207 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[1] = 0x0A;
8208 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[0] = 0xD5;
8209 /* Levelmetering Ringing (0D):AA,35,0F,8E ; 25Hz 30V less possible? */
8210 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[3] = 0xAA;
8211 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[2] = 0x35;
8212 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[1] = 0x0F;
8213 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[0] = 0x8E;
8214 /* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
8215 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[7] = 0xCA;
8216 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[6] = 0x0E;
8217 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[5] = 0xCA;
8218 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[4] = 0x09;
8219 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[3] = 0x99;
8220 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[2] = 0x99;
8221 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[1] = 0x99;
8222 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[0] = 0x99;
8223 /* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
8224 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[7] = 0xFD;
8225 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[6] = 0xB5;
8226 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[5] = 0xBA;
8227 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[4] = 0x07;
8228 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[3] = 0xDA;
8229 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[2] = 0x00;
8230 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[1] = 0x00;
8231 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[0] = 0x00;
8233 /* Config. Reg. 0 (filters) (cr0):FF */
8234 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
= 0xFF;
8235 /* Config. Reg. 1 (dialing) (cr1):05 */
8236 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
= 0x05;
8237 /* Config. Reg. 2 (caller ID) (cr2):04 */
8238 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
= 0x04;
8239 /* Config. Reg. 3 (testloops) (cr3):00 ; */
8240 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
= 0x00;
8241 /* Config. Reg. 4 (analog gain) (cr4):02 */
8242 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= 0x02;
8243 /* Config. Reg. 5 (Version) (cr5):02 */
8244 /* Config. Reg. 6 (Reserved) (cr6):00 */
8245 /* Config. Reg. 7 (Reserved) (cr7):00 */
8247 /* Ext. Reg. 0 (Interrupt Reg.) (xr0):02 */
8249 j
->m_DAAShadowRegs
.XOP_xr0_W
.reg
= 0x02; /* SO_1 set to '1' because it is inverted. */
8250 /* Ext. Reg. 1 (Interrupt enable) (xr1):1C */
8252 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr1
.reg
= 0x1C; /* RING, Caller ID, VDD_OK */
8253 /* Ext. Reg. 2 (Cadence Time Out) (xr2):7D */
8255 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr2
.reg
= 0x7D;
8256 /* Ext. Reg. 3 (DC Char) (xr3):36 ; */
8257 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr3
.reg
= 0x36;
8258 /* Ext. Reg. 4 (Cadence) (xr4):00 */
8259 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr4
.reg
= 0x00;
8260 /* Ext. Reg. 5 (Ring timer) (xr5):22 */
8261 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr5
.reg
= 0x22;
8262 /* Ext. Reg. 6 (Power State) (xr6):00 */
8263 j
->m_DAAShadowRegs
.XOP_xr6_W
.reg
= 0x00;
8264 /* Ext. Reg. 7 (Vdd) (xr7):46 */
8265 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr7
.reg
= 0x46; /* 0x46 ??? Should it be 0x00? */
8266 /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
8267 /* 12,33,5A,C3 ; 770 Hz */
8268 /* 13,3C,5B,32 ; 852 Hz */
8269 /* 1D,1B,5C,CC ; 941 Hz */
8271 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[3] = 0x11;
8272 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[2] = 0xB3;
8273 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[1] = 0x5A;
8274 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[0] = 0x2C;
8275 /* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
8276 /* EC,1D,52,22 ; 1336 Hz */
8277 /* AA,AC,51,D2 ; 1477 Hz */
8278 /* 9B,3B,51,25 ; 1633 Hz */
8279 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[3] = 0x32;
8280 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[2] = 0x32;
8281 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[1] = 0x52;
8282 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[0] = 0xB3;
8286 static void DAA_Coeff_France(IXJ
*j
)
8290 j
->daa_country
= DAA_FRANCE
;
8291 /*----------------------------------------------- */
8293 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
; i
++) {
8294 j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
[i
] = 0;
8297 /* Bytes for IM-filter part 1 (04): 02,A2,43,2C,22,AF,A0,00 */
8298 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[7] = 0x02;
8299 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[6] = 0xA2;
8300 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[5] = 0x43;
8301 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[4] = 0x2C;
8302 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[3] = 0x22;
8303 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[2] = 0xAF;
8304 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[1] = 0xA0;
8305 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[0] = 0x00;
8306 /* Bytes for IM-filter part 2 (05): 67,CE,00,0C,22,33,E0,08 */
8307 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[7] = 0x67;
8308 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[6] = 0xCE;
8309 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[5] = 0x00;
8310 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[4] = 0x2C;
8311 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[3] = 0x22;
8312 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[2] = 0x33;
8313 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[1] = 0xE0;
8314 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[0] = 0x08;
8315 /* Bytes for FRX-filter (08): 07,9A,28,F6,23,4A,B0,08 */
8316 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[7] = 0x07;
8317 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[6] = 0x9A;
8318 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[5] = 0x28;
8319 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[4] = 0xF6;
8320 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[3] = 0x23;
8321 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[2] = 0x4A;
8322 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[1] = 0xB0;
8323 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[0] = 0x08;
8324 /* Bytes for FRR-filter (07): 03,8F,F9,2F,9E,FA,20,08 */
8325 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[7] = 0x03;
8326 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[6] = 0x8F;
8327 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[5] = 0xF9;
8328 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[4] = 0x2F;
8329 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[3] = 0x9E;
8330 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[2] = 0xFA;
8331 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[1] = 0x20;
8332 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[0] = 0x08;
8333 /* Bytes for AX-filter (0A): 16,B5,DD,CA */
8334 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[3] = 0x16;
8335 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[2] = 0xB5;
8336 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[1] = 0xDD;
8337 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[0] = 0xCA;
8338 /* Bytes for AR-filter (09): 52,C7,10,D6 */
8339 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[3] = 0xE2;
8340 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[2] = 0xC7;
8341 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[1] = 0x10;
8342 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[0] = 0xD6;
8343 /* Bytes for TH-filter part 1 (00): 00,42,48,81,A6,80,00,98 */
8344 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[7] = 0x00;
8345 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[6] = 0x42;
8346 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[5] = 0x48;
8347 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[4] = 0x81;
8348 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[3] = 0xA6;
8349 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[2] = 0x80;
8350 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[1] = 0x00;
8351 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[0] = 0x98;
8352 /* Bytes for TH-filter part 2 (01): 02,AC,2A,30,78,AC,8A,2C */
8353 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[7] = 0x02;
8354 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[6] = 0xAC;
8355 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[5] = 0x2A;
8356 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[4] = 0x30;
8357 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[3] = 0x78;
8358 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[2] = 0xAC;
8359 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[1] = 0x8A;
8360 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[0] = 0x2C;
8361 /* Bytes for TH-filter part 3 (02): 00,88,DA,A5,22,BA,2C,45 */
8362 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[7] = 0x00;
8363 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[6] = 0x88;
8364 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[5] = 0xDA;
8365 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[4] = 0xA5;
8366 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[3] = 0x22;
8367 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[2] = 0xBA;
8368 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[1] = 0x2C;
8369 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[0] = 0x45;
8371 /* Bytes for Ringing part 1 (03):1B,3C,93,3A,22,12,A3,23 */
8372 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[7] = 0x1B;
8373 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[6] = 0x3C;
8374 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[5] = 0x93;
8375 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[4] = 0x3A;
8376 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[3] = 0x22;
8377 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[2] = 0x12;
8378 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[1] = 0xA3;
8379 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[0] = 0x23;
8380 /* Bytes for Ringing part 2 (06):12,A2,A6,BA,22,7A,0A,D5 */
8381 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[7] = 0x12;
8382 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[6] = 0xA2;
8383 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[5] = 0xA6;
8384 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[4] = 0xBA;
8385 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[3] = 0x22;
8386 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[2] = 0x7A;
8387 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[1] = 0x0A;
8388 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[0] = 0xD5;
8389 /* Levelmetering Ringing (0D):32,45,B5,84 ; 50Hz 20V */
8390 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[3] = 0x32;
8391 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[2] = 0x45;
8392 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[1] = 0xB5;
8393 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[0] = 0x84;
8394 /* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
8395 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[7] = 0xCA;
8396 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[6] = 0x0E;
8397 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[5] = 0xCA;
8398 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[4] = 0x09;
8399 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[3] = 0x99;
8400 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[2] = 0x99;
8401 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[1] = 0x99;
8402 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[0] = 0x99;
8403 /* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
8404 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[7] = 0xFD;
8405 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[6] = 0xB5;
8406 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[5] = 0xBA;
8407 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[4] = 0x07;
8408 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[3] = 0xDA;
8409 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[2] = 0x00;
8410 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[1] = 0x00;
8411 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[0] = 0x00;
8413 /* Config. Reg. 0 (filters) (cr0):FF */
8414 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
= 0xFF;
8415 /* Config. Reg. 1 (dialing) (cr1):05 */
8416 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
= 0x05;
8417 /* Config. Reg. 2 (caller ID) (cr2):04 */
8418 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
= 0x04;
8419 /* Config. Reg. 3 (testloops) (cr3):00 ; */
8420 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
= 0x00;
8421 /* Config. Reg. 4 (analog gain) (cr4):02 */
8422 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= 0x02;
8423 /* Config. Reg. 5 (Version) (cr5):02 */
8424 /* Config. Reg. 6 (Reserved) (cr6):00 */
8425 /* Config. Reg. 7 (Reserved) (cr7):00 */
8427 /* Ext. Reg. 0 (Interrupt Reg.) (xr0):02 */
8429 j
->m_DAAShadowRegs
.XOP_xr0_W
.reg
= 0x02; /* SO_1 set to '1' because it is inverted. */
8430 /* Ext. Reg. 1 (Interrupt enable) (xr1):1C */
8432 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr1
.reg
= 0x1C; /* RING, Caller ID, VDD_OK */
8433 /* Ext. Reg. 2 (Cadence Time Out) (xr2):7D */
8435 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr2
.reg
= 0x7D;
8436 /* Ext. Reg. 3 (DC Char) (xr3):36 ; */
8437 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr3
.reg
= 0x36;
8438 /* Ext. Reg. 4 (Cadence) (xr4):00 */
8439 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr4
.reg
= 0x00;
8440 /* Ext. Reg. 5 (Ring timer) (xr5):22 */
8441 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr5
.reg
= 0x22;
8442 /* Ext. Reg. 6 (Power State) (xr6):00 */
8443 j
->m_DAAShadowRegs
.XOP_xr6_W
.reg
= 0x00;
8444 /* Ext. Reg. 7 (Vdd) (xr7):46 */
8445 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr7
.reg
= 0x46; /* 0x46 ??? Should it be 0x00? */
8446 /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
8447 /* 12,33,5A,C3 ; 770 Hz */
8448 /* 13,3C,5B,32 ; 852 Hz */
8449 /* 1D,1B,5C,CC ; 941 Hz */
8451 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[3] = 0x11;
8452 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[2] = 0xB3;
8453 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[1] = 0x5A;
8454 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[0] = 0x2C;
8455 /* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
8456 /* EC,1D,52,22 ; 1336 Hz */
8457 /* AA,AC,51,D2 ; 1477 Hz */
8458 /* 9B,3B,51,25 ; 1633 Hz */
8459 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[3] = 0x32;
8460 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[2] = 0x32;
8461 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[1] = 0x52;
8462 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[0] = 0xB3;
8466 static void DAA_Coeff_Germany(IXJ
*j
)
8470 j
->daa_country
= DAA_GERMANY
;
8471 /*----------------------------------------------- */
8473 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
; i
++) {
8474 j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
[i
] = 0;
8477 /* Bytes for IM-filter part 1 (04): 00,CE,BB,B8,D2,81,B0,00 */
8478 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[7] = 0x00;
8479 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[6] = 0xCE;
8480 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[5] = 0xBB;
8481 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[4] = 0xB8;
8482 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[3] = 0xD2;
8483 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[2] = 0x81;
8484 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[1] = 0xB0;
8485 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[0] = 0x00;
8486 /* Bytes for IM-filter part 2 (05): 45,8F,00,0C,D2,3A,D0,08 */
8487 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[7] = 0x45;
8488 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[6] = 0x8F;
8489 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[5] = 0x00;
8490 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[4] = 0x0C;
8491 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[3] = 0xD2;
8492 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[2] = 0x3A;
8493 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[1] = 0xD0;
8494 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[0] = 0x08;
8495 /* Bytes for FRX-filter (08): 07,AA,E2,34,24,89,20,08 */
8496 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[7] = 0x07;
8497 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[6] = 0xAA;
8498 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[5] = 0xE2;
8499 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[4] = 0x34;
8500 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[3] = 0x24;
8501 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[2] = 0x89;
8502 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[1] = 0x20;
8503 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[0] = 0x08;
8504 /* Bytes for FRR-filter (07): 02,87,FA,37,9A,CA,B0,08 */
8505 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[7] = 0x02;
8506 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[6] = 0x87;
8507 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[5] = 0xFA;
8508 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[4] = 0x37;
8509 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[3] = 0x9A;
8510 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[2] = 0xCA;
8511 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[1] = 0xB0;
8512 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[0] = 0x08;
8513 /* Bytes for AX-filter (0A): 72,D5,DD,CA */
8514 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[3] = 0x72;
8515 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[2] = 0xD5;
8516 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[1] = 0xDD;
8517 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[0] = 0xCA;
8518 /* Bytes for AR-filter (09): 72,42,13,4B */
8519 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[3] = 0x72;
8520 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[2] = 0x42;
8521 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[1] = 0x13;
8522 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[0] = 0x4B;
8523 /* Bytes for TH-filter part 1 (00): 80,52,48,81,AD,80,00,98 */
8524 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[7] = 0x80;
8525 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[6] = 0x52;
8526 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[5] = 0x48;
8527 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[4] = 0x81;
8528 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[3] = 0xAD;
8529 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[2] = 0x80;
8530 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[1] = 0x00;
8531 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[0] = 0x98;
8532 /* Bytes for TH-filter part 2 (01): 02,42,5A,20,E8,1A,81,27 */
8533 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[7] = 0x02;
8534 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[6] = 0x42;
8535 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[5] = 0x5A;
8536 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[4] = 0x20;
8537 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[3] = 0xE8;
8538 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[2] = 0x1A;
8539 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[1] = 0x81;
8540 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[0] = 0x27;
8541 /* Bytes for TH-filter part 3 (02): 00,88,63,26,BD,4B,A3,C2 */
8542 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[7] = 0x00;
8543 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[6] = 0x88;
8544 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[5] = 0x63;
8545 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[4] = 0x26;
8546 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[3] = 0xBD;
8547 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[2] = 0x4B;
8548 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[1] = 0xA3;
8549 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[0] = 0xC2;
8550 /* ; (10K, 0.68uF) */
8551 /* Bytes for Ringing part 1 (03):1B,3B,9B,BA,D4,1C,B3,23 */
8552 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[7] = 0x1B;
8553 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[6] = 0x3B;
8554 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[5] = 0x9B;
8555 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[4] = 0xBA;
8556 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[3] = 0xD4;
8557 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[2] = 0x1C;
8558 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[1] = 0xB3;
8559 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[0] = 0x23;
8560 /* Bytes for Ringing part 2 (06):13,42,A6,BA,D4,73,CA,D5 */
8561 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[7] = 0x13;
8562 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[6] = 0x42;
8563 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[5] = 0xA6;
8564 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[4] = 0xBA;
8565 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[3] = 0xD4;
8566 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[2] = 0x73;
8567 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[1] = 0xCA;
8568 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[0] = 0xD5;
8569 /* Levelmetering Ringing (0D):B2,45,0F,8E */
8570 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[3] = 0xB2;
8571 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[2] = 0x45;
8572 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[1] = 0x0F;
8573 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[0] = 0x8E;
8574 /* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
8575 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[7] = 0xCA;
8576 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[6] = 0x0E;
8577 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[5] = 0xCA;
8578 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[4] = 0x09;
8579 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[3] = 0x99;
8580 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[2] = 0x99;
8581 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[1] = 0x99;
8582 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[0] = 0x99;
8583 /* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
8584 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[7] = 0xFD;
8585 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[6] = 0xB5;
8586 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[5] = 0xBA;
8587 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[4] = 0x07;
8588 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[3] = 0xDA;
8589 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[2] = 0x00;
8590 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[1] = 0x00;
8591 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[0] = 0x00;
8593 /* Config. Reg. 0 (filters) (cr0):FF ; all Filters enabled, CLK from ext. source */
8594 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
= 0xFF;
8595 /* Config. Reg. 1 (dialing) (cr1):05 ; Manual Ring, Ring metering enabled */
8596 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
= 0x05;
8597 /* Config. Reg. 2 (caller ID) (cr2):04 ; Analog Gain 0dB, FSC internal */
8598 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
= 0x04;
8599 /* Config. Reg. 3 (testloops) (cr3):00 ; SEL Bit==0, HP-enabled */
8600 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
= 0x00;
8601 /* Config. Reg. 4 (analog gain) (cr4):02 */
8602 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= 0x02;
8603 /* Config. Reg. 5 (Version) (cr5):02 */
8604 /* Config. Reg. 6 (Reserved) (cr6):00 */
8605 /* Config. Reg. 7 (Reserved) (cr7):00 */
8607 /* Ext. Reg. 0 (Interrupt Reg.) (xr0):02 */
8609 j
->m_DAAShadowRegs
.XOP_xr0_W
.reg
= 0x02; /* SO_1 set to '1' because it is inverted. */
8610 /* Ext. Reg. 1 (Interrupt enable) (xr1):1C ; Ring, CID, VDDOK Interrupts enabled */
8612 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr1
.reg
= 0x1C; /* RING, Caller ID, VDD_OK */
8613 /* Ext. Reg. 2 (Cadence Time Out) (xr2):7D */
8615 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr2
.reg
= 0x7D;
8616 /* Ext. Reg. 3 (DC Char) (xr3):32 ; B-Filter Off==1, U0=3.5V, R=200Ohm */
8617 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr3
.reg
= 0x32;
8618 /* Ext. Reg. 4 (Cadence) (xr4):00 */
8619 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr4
.reg
= 0x00;
8620 /* Ext. Reg. 5 (Ring timer) (xr5):22 */
8621 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr5
.reg
= 0x22;
8622 /* Ext. Reg. 6 (Power State) (xr6):00 */
8623 j
->m_DAAShadowRegs
.XOP_xr6_W
.reg
= 0x00;
8624 /* Ext. Reg. 7 (Vdd) (xr7):40 ; VDD=4.25 V */
8625 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr7
.reg
= 0x40; /* 0x40 ??? Should it be 0x00? */
8626 /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
8627 /* 12,33,5A,C3 ; 770 Hz */
8628 /* 13,3C,5B,32 ; 852 Hz */
8629 /* 1D,1B,5C,CC ; 941 Hz */
8631 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[3] = 0x11;
8632 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[2] = 0xB3;
8633 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[1] = 0x5A;
8634 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[0] = 0x2C;
8635 /* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
8636 /* EC,1D,52,22 ; 1336 Hz */
8637 /* AA,AC,51,D2 ; 1477 Hz */
8638 /* 9B,3B,51,25 ; 1633 Hz */
8639 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[3] = 0x32;
8640 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[2] = 0x32;
8641 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[1] = 0x52;
8642 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[0] = 0xB3;
8646 static void DAA_Coeff_Australia(IXJ
*j
)
8650 j
->daa_country
= DAA_AUSTRALIA
;
8651 /*----------------------------------------------- */
8653 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
; i
++) {
8654 j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
[i
] = 0;
8657 /* Bytes for IM-filter part 1 (04): 00,A3,AA,28,B3,82,D0,00 */
8658 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[7] = 0x00;
8659 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[6] = 0xA3;
8660 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[5] = 0xAA;
8661 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[4] = 0x28;
8662 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[3] = 0xB3;
8663 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[2] = 0x82;
8664 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[1] = 0xD0;
8665 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[0] = 0x00;
8666 /* Bytes for IM-filter part 2 (05): 70,96,00,09,32,6B,C0,08 */
8667 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[7] = 0x70;
8668 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[6] = 0x96;
8669 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[5] = 0x00;
8670 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[4] = 0x09;
8671 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[3] = 0x32;
8672 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[2] = 0x6B;
8673 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[1] = 0xC0;
8674 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[0] = 0x08;
8675 /* Bytes for FRX-filter (08): 07,96,E2,34,32,9B,30,08 */
8676 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[7] = 0x07;
8677 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[6] = 0x96;
8678 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[5] = 0xE2;
8679 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[4] = 0x34;
8680 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[3] = 0x32;
8681 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[2] = 0x9B;
8682 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[1] = 0x30;
8683 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[0] = 0x08;
8684 /* Bytes for FRR-filter (07): 0F,9A,E9,2F,22,CC,A0,08 */
8685 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[7] = 0x0F;
8686 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[6] = 0x9A;
8687 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[5] = 0xE9;
8688 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[4] = 0x2F;
8689 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[3] = 0x22;
8690 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[2] = 0xCC;
8691 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[1] = 0xA0;
8692 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[0] = 0x08;
8693 /* Bytes for AX-filter (0A): CB,45,DD,CA */
8694 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[3] = 0xCB;
8695 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[2] = 0x45;
8696 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[1] = 0xDD;
8697 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[0] = 0xCA;
8698 /* Bytes for AR-filter (09): 1B,67,10,D6 */
8699 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[3] = 0x1B;
8700 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[2] = 0x67;
8701 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[1] = 0x10;
8702 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[0] = 0xD6;
8703 /* Bytes for TH-filter part 1 (00): 80,52,48,81,AF,80,00,98 */
8704 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[7] = 0x80;
8705 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[6] = 0x52;
8706 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[5] = 0x48;
8707 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[4] = 0x81;
8708 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[3] = 0xAF;
8709 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[2] = 0x80;
8710 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[1] = 0x00;
8711 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[0] = 0x98;
8712 /* Bytes for TH-filter part 2 (01): 02,DB,52,B0,38,01,82,AC */
8713 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[7] = 0x02;
8714 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[6] = 0xDB;
8715 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[5] = 0x52;
8716 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[4] = 0xB0;
8717 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[3] = 0x38;
8718 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[2] = 0x01;
8719 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[1] = 0x82;
8720 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[0] = 0xAC;
8721 /* Bytes for TH-filter part 3 (02): 00,88,4A,3E,2C,3B,24,46 */
8722 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[7] = 0x00;
8723 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[6] = 0x88;
8724 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[5] = 0x4A;
8725 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[4] = 0x3E;
8726 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[3] = 0x2C;
8727 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[2] = 0x3B;
8728 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[1] = 0x24;
8729 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[0] = 0x46;
8731 /* Bytes for Ringing part 1 (03):1B,3C,93,3A,22,12,A3,23 */
8732 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[7] = 0x1B;
8733 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[6] = 0x3C;
8734 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[5] = 0x93;
8735 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[4] = 0x3A;
8736 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[3] = 0x22;
8737 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[2] = 0x12;
8738 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[1] = 0xA3;
8739 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[0] = 0x23;
8740 /* Bytes for Ringing part 2 (06):12,A2,A6,BA,22,7A,0A,D5 */
8741 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[7] = 0x12;
8742 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[6] = 0xA2;
8743 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[5] = 0xA6;
8744 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[4] = 0xBA;
8745 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[3] = 0x22;
8746 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[2] = 0x7A;
8747 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[1] = 0x0A;
8748 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[0] = 0xD5;
8749 /* Levelmetering Ringing (0D):32,45,B5,84 ; 50Hz 20V */
8750 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[3] = 0x32;
8751 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[2] = 0x45;
8752 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[1] = 0xB5;
8753 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[0] = 0x84;
8754 /* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
8755 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[7] = 0xCA;
8756 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[6] = 0x0E;
8757 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[5] = 0xCA;
8758 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[4] = 0x09;
8759 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[3] = 0x99;
8760 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[2] = 0x99;
8761 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[1] = 0x99;
8762 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[0] = 0x99;
8763 /* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
8764 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[7] = 0xFD;
8765 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[6] = 0xB5;
8766 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[5] = 0xBA;
8767 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[4] = 0x07;
8768 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[3] = 0xDA;
8769 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[2] = 0x00;
8770 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[1] = 0x00;
8771 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[0] = 0x00;
8773 /* Config. Reg. 0 (filters) (cr0):FF */
8774 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
= 0xFF;
8775 /* Config. Reg. 1 (dialing) (cr1):05 */
8776 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
= 0x05;
8777 /* Config. Reg. 2 (caller ID) (cr2):04 */
8778 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
= 0x04;
8779 /* Config. Reg. 3 (testloops) (cr3):00 ; */
8780 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
= 0x00;
8781 /* Config. Reg. 4 (analog gain) (cr4):02 */
8782 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= 0x02;
8783 /* Config. Reg. 5 (Version) (cr5):02 */
8784 /* Config. Reg. 6 (Reserved) (cr6):00 */
8785 /* Config. Reg. 7 (Reserved) (cr7):00 */
8787 /* Ext. Reg. 0 (Interrupt Reg.) (xr0):02 */
8789 j
->m_DAAShadowRegs
.XOP_xr0_W
.reg
= 0x02; /* SO_1 set to '1' because it is inverted. */
8790 /* Ext. Reg. 1 (Interrupt enable) (xr1):1C */
8792 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr1
.reg
= 0x1C; /* RING, Caller ID, VDD_OK */
8793 /* Ext. Reg. 2 (Cadence Time Out) (xr2):7D */
8795 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr2
.reg
= 0x7D;
8796 /* Ext. Reg. 3 (DC Char) (xr3):2B ; */
8797 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr3
.reg
= 0x2B;
8798 /* Ext. Reg. 4 (Cadence) (xr4):00 */
8799 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr4
.reg
= 0x00;
8800 /* Ext. Reg. 5 (Ring timer) (xr5):22 */
8801 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr5
.reg
= 0x22;
8802 /* Ext. Reg. 6 (Power State) (xr6):00 */
8803 j
->m_DAAShadowRegs
.XOP_xr6_W
.reg
= 0x00;
8804 /* Ext. Reg. 7 (Vdd) (xr7):40 */
8805 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr7
.reg
= 0x40; /* 0x40 ??? Should it be 0x00? */
8807 /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
8808 /* 12,33,5A,C3 ; 770 Hz */
8809 /* 13,3C,5B,32 ; 852 Hz */
8810 /* 1D,1B,5C,CC ; 941 Hz */
8811 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[3] = 0x11;
8812 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[2] = 0xB3;
8813 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[1] = 0x5A;
8814 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[0] = 0x2C;
8816 /* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
8817 /* EC,1D,52,22 ; 1336 Hz */
8818 /* AA,AC,51,D2 ; 1477 Hz */
8819 /* 9B,3B,51,25 ; 1633 Hz */
8820 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[3] = 0x32;
8821 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[2] = 0x32;
8822 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[1] = 0x52;
8823 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[0] = 0xB3;
8826 static void DAA_Coeff_Japan(IXJ
*j
)
8830 j
->daa_country
= DAA_JAPAN
;
8831 /*----------------------------------------------- */
8833 for (i
= 0; i
< ALISDAA_CALLERID_SIZE
; i
++) {
8834 j
->m_DAAShadowRegs
.CAO_REGS
.CAO
.CallerID
[i
] = 0;
8837 /* Bytes for IM-filter part 1 (04): 06,BD,E2,2D,BA,F9,A0,00 */
8838 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[7] = 0x06;
8839 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[6] = 0xBD;
8840 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[5] = 0xE2;
8841 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[4] = 0x2D;
8842 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[3] = 0xBA;
8843 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[2] = 0xF9;
8844 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[1] = 0xA0;
8845 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_1
[0] = 0x00;
8846 /* Bytes for IM-filter part 2 (05): 6F,F7,00,0E,34,33,E0,08 */
8847 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[7] = 0x6F;
8848 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[6] = 0xF7;
8849 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[5] = 0x00;
8850 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[4] = 0x0E;
8851 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[3] = 0x34;
8852 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[2] = 0x33;
8853 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[1] = 0xE0;
8854 j
->m_DAAShadowRegs
.COP_REGS
.COP
.IMFilterCoeff_2
[0] = 0x08;
8855 /* Bytes for FRX-filter (08): 02,8F,68,77,9C,58,F0,08 */
8856 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[7] = 0x02;
8857 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[6] = 0x8F;
8858 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[5] = 0x68;
8859 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[4] = 0x77;
8860 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[3] = 0x9C;
8861 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[2] = 0x58;
8862 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[1] = 0xF0;
8863 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRXFilterCoeff
[0] = 0x08;
8864 /* Bytes for FRR-filter (07): 03,8F,38,73,87,EA,20,08 */
8865 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[7] = 0x03;
8866 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[6] = 0x8F;
8867 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[5] = 0x38;
8868 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[4] = 0x73;
8869 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[3] = 0x87;
8870 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[2] = 0xEA;
8871 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[1] = 0x20;
8872 j
->m_DAAShadowRegs
.COP_REGS
.COP
.FRRFilterCoeff
[0] = 0x08;
8873 /* Bytes for AX-filter (0A): 51,C5,DD,CA */
8874 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[3] = 0x51;
8875 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[2] = 0xC5;
8876 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[1] = 0xDD;
8877 j
->m_DAAShadowRegs
.COP_REGS
.COP
.AXFilterCoeff
[0] = 0xCA;
8878 /* Bytes for AR-filter (09): 25,A7,10,D6 */
8879 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[3] = 0x25;
8880 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[2] = 0xA7;
8881 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[1] = 0x10;
8882 j
->m_DAAShadowRegs
.COP_REGS
.COP
.ARFilterCoeff
[0] = 0xD6;
8883 /* Bytes for TH-filter part 1 (00): 00,42,48,81,AE,80,00,98 */
8884 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[7] = 0x00;
8885 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[6] = 0x42;
8886 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[5] = 0x48;
8887 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[4] = 0x81;
8888 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[3] = 0xAE;
8889 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[2] = 0x80;
8890 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[1] = 0x00;
8891 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_1
[0] = 0x98;
8892 /* Bytes for TH-filter part 2 (01): 02,AB,2A,20,99,5B,89,28 */
8893 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[7] = 0x02;
8894 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[6] = 0xAB;
8895 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[5] = 0x2A;
8896 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[4] = 0x20;
8897 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[3] = 0x99;
8898 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[2] = 0x5B;
8899 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[1] = 0x89;
8900 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_2
[0] = 0x28;
8901 /* Bytes for TH-filter part 3 (02): 00,88,DA,25,34,C5,4C,BA */
8902 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[7] = 0x00;
8903 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[6] = 0x88;
8904 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[5] = 0xDA;
8905 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[4] = 0x25;
8906 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[3] = 0x34;
8907 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[2] = 0xC5;
8908 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[1] = 0x4C;
8909 j
->m_DAAShadowRegs
.COP_REGS
.COP
.THFilterCoeff_3
[0] = 0xBA;
8911 /* Bytes for Ringing part 1 (03):1B,3C,93,3A,22,12,A3,23 */
8912 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[7] = 0x1B;
8913 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[6] = 0x3C;
8914 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[5] = 0x93;
8915 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[4] = 0x3A;
8916 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[3] = 0x22;
8917 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[2] = 0x12;
8918 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[1] = 0xA3;
8919 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_1
[0] = 0x23;
8920 /* Bytes for Ringing part 2 (06):12,A2,A6,BA,22,7A,0A,D5 */
8921 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[7] = 0x12;
8922 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[6] = 0xA2;
8923 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[5] = 0xA6;
8924 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[4] = 0xBA;
8925 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[3] = 0x22;
8926 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[2] = 0x7A;
8927 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[1] = 0x0A;
8928 j
->m_DAAShadowRegs
.COP_REGS
.COP
.RingerImpendance_2
[0] = 0xD5;
8929 /* Levelmetering Ringing (0D):AA,35,0F,8E ; 25Hz 30V ????????? */
8930 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[3] = 0xAA;
8931 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[2] = 0x35;
8932 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[1] = 0x0F;
8933 j
->m_DAAShadowRegs
.COP_REGS
.COP
.LevelmeteringRinging
[0] = 0x8E;
8934 /* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
8935 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[7] = 0xCA;
8936 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[6] = 0x0E;
8937 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[5] = 0xCA;
8938 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[4] = 0x09;
8939 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[3] = 0x99;
8940 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[2] = 0x99;
8941 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[1] = 0x99;
8942 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID1stTone
[0] = 0x99;
8943 /* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
8944 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[7] = 0xFD;
8945 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[6] = 0xB5;
8946 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[5] = 0xBA;
8947 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[4] = 0x07;
8948 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[3] = 0xDA;
8949 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[2] = 0x00;
8950 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[1] = 0x00;
8951 j
->m_DAAShadowRegs
.COP_REGS
.COP
.CallerID2ndTone
[0] = 0x00;
8953 /* Config. Reg. 0 (filters) (cr0):FF */
8954 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr0
.reg
= 0xFF;
8955 /* Config. Reg. 1 (dialing) (cr1):05 */
8956 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr1
.reg
= 0x05;
8957 /* Config. Reg. 2 (caller ID) (cr2):04 */
8958 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr2
.reg
= 0x04;
8959 /* Config. Reg. 3 (testloops) (cr3):00 ; */
8960 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr3
.reg
= 0x00;
8961 /* Config. Reg. 4 (analog gain) (cr4):02 */
8962 j
->m_DAAShadowRegs
.SOP_REGS
.SOP
.cr4
.reg
= 0x02;
8963 /* Config. Reg. 5 (Version) (cr5):02 */
8964 /* Config. Reg. 6 (Reserved) (cr6):00 */
8965 /* Config. Reg. 7 (Reserved) (cr7):00 */
8967 /* Ext. Reg. 0 (Interrupt Reg.) (xr0):02 */
8969 j
->m_DAAShadowRegs
.XOP_xr0_W
.reg
= 0x02; /* SO_1 set to '1' because it is inverted. */
8970 /* Ext. Reg. 1 (Interrupt enable) (xr1):1C */
8972 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr1
.reg
= 0x1C; /* RING, Caller ID, VDD_OK */
8973 /* Ext. Reg. 2 (Cadence Time Out) (xr2):7D */
8975 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr2
.reg
= 0x7D;
8976 /* Ext. Reg. 3 (DC Char) (xr3):22 ; */
8977 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr3
.reg
= 0x22;
8978 /* Ext. Reg. 4 (Cadence) (xr4):00 */
8979 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr4
.reg
= 0x00;
8980 /* Ext. Reg. 5 (Ring timer) (xr5):22 */
8981 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr5
.reg
= 0x22;
8982 /* Ext. Reg. 6 (Power State) (xr6):00 */
8983 j
->m_DAAShadowRegs
.XOP_xr6_W
.reg
= 0x00;
8984 /* Ext. Reg. 7 (Vdd) (xr7):40 */
8985 j
->m_DAAShadowRegs
.XOP_REGS
.XOP
.xr7
.reg
= 0x40; /* 0x40 ??? Should it be 0x00? */
8986 /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
8987 /* 12,33,5A,C3 ; 770 Hz */
8988 /* 13,3C,5B,32 ; 852 Hz */
8989 /* 1D,1B,5C,CC ; 941 Hz */
8991 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[3] = 0x11;
8992 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[2] = 0xB3;
8993 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[1] = 0x5A;
8994 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone1Coeff
[0] = 0x2C;
8995 /* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
8996 /* EC,1D,52,22 ; 1336 Hz */
8997 /* AA,AC,51,D2 ; 1477 Hz */
8998 /* 9B,3B,51,25 ; 1633 Hz */
8999 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[3] = 0x32;
9000 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[2] = 0x32;
9001 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[1] = 0x52;
9002 j
->m_DAAShadowRegs
.COP_REGS
.COP
.Tone2Coeff
[0] = 0xB3;
9005 static s16 tone_table
[][19] =
9008 32538, /* A1 = 1.985962 */
9009 -32325, /* A2 = -0.986511 */
9010 -343, /* B2 = -0.010493 */
9012 343, /* B0 = 0.010493 */
9013 32619, /* A1 = 1.990906 */
9014 -32520, /* A2 = -0.992462 */
9015 19179, /* B2 = 0.585327 */
9016 -19178, /* B1 = -1.170593 */
9017 19179, /* B0 = 0.585327 */
9018 32723, /* A1 = 1.997314 */
9019 -32686, /* A2 = -0.997528 */
9020 9973, /* B2 = 0.304352 */
9021 -9955, /* B1 = -0.607605 */
9022 9973, /* B0 = 0.304352 */
9023 7, /* Internal filter scaling */
9024 159, /* Minimum in-band energy threshold */
9025 21, /* 21/32 in-band to broad-band ratio */
9026 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9028 { /* f133_200[] 12 */
9029 32072, /* A1 = 1.95752 */
9030 -31896, /* A2 = -0.973419 */
9031 -435, /* B2 = -0.013294 */
9033 435, /* B0 = 0.013294 */
9034 32188, /* A1 = 1.9646 */
9035 -32400, /* A2 = -0.98877 */
9036 15139, /* B2 = 0.462036 */
9037 -14882, /* B1 = -0.908356 */
9038 15139, /* B0 = 0.462036 */
9039 32473, /* A1 = 1.981995 */
9040 -32524, /* A2 = -0.992584 */
9041 23200, /* B2 = 0.708008 */
9042 -23113, /* B1 = -1.410706 */
9043 23200, /* B0 = 0.708008 */
9044 7, /* Internal filter scaling */
9045 159, /* Minimum in-band energy threshold */
9046 21, /* 21/32 in-band to broad-band ratio */
9047 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9050 31769, /* A1 = -1.939026 */
9051 -32584, /* A2 = 0.994385 */
9052 -475, /* B2 = -0.014522 */
9053 0, /* B1 = 0.000000 */
9054 475, /* B0 = 0.014522 */
9055 31789, /* A1 = -1.940247 */
9056 -32679, /* A2 = 0.997284 */
9057 17280, /* B2 = 0.527344 */
9058 -16865, /* B1 = -1.029358 */
9059 17280, /* B0 = 0.527344 */
9060 31841, /* A1 = -1.943481 */
9061 -32681, /* A2 = 0.997345 */
9062 543, /* B2 = 0.016579 */
9063 -525, /* B1 = -0.032097 */
9064 543, /* B0 = 0.016579 */
9065 5, /* Internal filter scaling */
9066 159, /* Minimum in-band energy threshold */
9067 21, /* 21/32 in-band to broad-band ratio */
9068 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9070 { /* f300_420[] 14 */
9071 30750, /* A1 = 1.876892 */
9072 -31212, /* A2 = -0.952515 */
9073 -804, /* B2 = -0.024541 */
9075 804, /* B0 = 0.024541 */
9076 30686, /* A1 = 1.872925 */
9077 -32145, /* A2 = -0.980988 */
9078 14747, /* B2 = 0.450043 */
9079 -13703, /* B1 = -0.836395 */
9080 14747, /* B0 = 0.450043 */
9081 31651, /* A1 = 1.931824 */
9082 -32321, /* A2 = -0.986389 */
9083 24425, /* B2 = 0.745422 */
9084 -23914, /* B1 = -1.459595 */
9085 24427, /* B0 = 0.745483 */
9086 7, /* Internal filter scaling */
9087 159, /* Minimum in-band energy threshold */
9088 21, /* 21/32 in-band to broad-band ratio */
9089 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9092 31613, /* A1 = -1.929565 */
9093 -32646, /* A2 = 0.996277 */
9094 -185, /* B2 = -0.005657 */
9095 0, /* B1 = 0.000000 */
9096 185, /* B0 = 0.005657 */
9097 31620, /* A1 = -1.929932 */
9098 -32713, /* A2 = 0.998352 */
9099 19253, /* B2 = 0.587585 */
9100 -18566, /* B1 = -1.133179 */
9101 19253, /* B0 = 0.587585 */
9102 31674, /* A1 = -1.933228 */
9103 -32715, /* A2 = 0.998413 */
9104 2575, /* B2 = 0.078590 */
9105 -2495, /* B1 = -0.152283 */
9106 2575, /* B0 = 0.078590 */
9107 5, /* Internal filter scaling */
9108 159, /* Minimum in-band energy threshold */
9109 21, /* 21/32 in-band to broad-band ratio */
9110 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9112 { /* f300_425[] 16 */
9113 30741, /* A1 = 1.876282 */
9114 -31475, /* A2 = -0.960541 */
9115 -703, /* B2 = -0.021484 */
9117 703, /* B0 = 0.021484 */
9118 30688, /* A1 = 1.873047 */
9119 -32248, /* A2 = -0.984161 */
9120 14542, /* B2 = 0.443787 */
9121 -13523, /* B1 = -0.825439 */
9122 14542, /* B0 = 0.443817 */
9123 31494, /* A1 = 1.922302 */
9124 -32366, /* A2 = -0.987762 */
9125 21577, /* B2 = 0.658508 */
9126 -21013, /* B1 = -1.282532 */
9127 21577, /* B0 = 0.658508 */
9128 7, /* Internal filter scaling */
9129 159, /* Minimum in-band energy threshold */
9130 21, /* 21/32 in-band to broad-band ratio */
9131 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9133 { /* f330_440[] 17 */
9134 30627, /* A1 = 1.869324 */
9135 -31338, /* A2 = -0.95636 */
9136 -843, /* B2 = -0.025749 */
9138 843, /* B0 = 0.025749 */
9139 30550, /* A1 = 1.864685 */
9140 -32221, /* A2 = -0.983337 */
9141 13594, /* B2 = 0.414886 */
9142 -12589, /* B1 = -0.768402 */
9143 13594, /* B0 = 0.414886 */
9144 31488, /* A1 = 1.921936 */
9145 -32358, /* A2 = -0.987518 */
9146 24684, /* B2 = 0.753296 */
9147 -24029, /* B1 = -1.466614 */
9148 24684, /* B0 = 0.753296 */
9149 7, /* Internal filter scaling */
9150 159, /* Minimum in-band energy threshold */
9151 21, /* 21/32 in-band to broad-band ratio */
9152 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9155 31546, /* A1 = -1.925476 */
9156 -32646, /* A2 = 0.996277 */
9157 -445, /* B2 = -0.013588 */
9158 0, /* B1 = 0.000000 */
9159 445, /* B0 = 0.013588 */
9160 31551, /* A1 = -1.925781 */
9161 -32713, /* A2 = 0.998352 */
9162 23884, /* B2 = 0.728882 */
9163 -22979, /* B1 = -1.402527 */
9164 23884, /* B0 = 0.728882 */
9165 31606, /* A1 = -1.929138 */
9166 -32715, /* A2 = 0.998413 */
9167 863, /* B2 = 0.026367 */
9168 -835, /* B1 = -0.050985 */
9169 863, /* B0 = 0.026367 */
9170 5, /* Internal filter scaling */
9171 159, /* Minimum in-band energy threshold */
9172 21, /* 21/32 in-band to broad-band ratio */
9173 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9175 { /* f350_400[] 19 */
9176 31006, /* A1 = 1.892517 */
9177 -32029, /* A2 = -0.977448 */
9178 -461, /* B2 = -0.014096 */
9180 461, /* B0 = 0.014096 */
9181 30999, /* A1 = 1.892029 */
9182 -32487, /* A2 = -0.991455 */
9183 11325, /* B2 = 0.345612 */
9184 -10682, /* B1 = -0.651978 */
9185 11325, /* B0 = 0.345612 */
9186 31441, /* A1 = 1.919067 */
9187 -32526, /* A2 = -0.992615 */
9188 24324, /* B2 = 0.74231 */
9189 -23535, /* B1 = -1.436523 */
9190 24324, /* B0 = 0.74231 */
9191 7, /* Internal filter scaling */
9192 159, /* Minimum in-band energy threshold */
9193 21, /* 21/32 in-band to broad-band ratio */
9194 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9197 30634, /* A1 = 1.869751 */
9198 -31533, /* A2 = -0.962341 */
9199 -680, /* B2 = -0.020782 */
9201 680, /* B0 = 0.020782 */
9202 30571, /* A1 = 1.865906 */
9203 -32277, /* A2 = -0.985016 */
9204 12894, /* B2 = 0.393524 */
9205 -11945, /* B1 = -0.729065 */
9206 12894, /* B0 = 0.393524 */
9207 31367, /* A1 = 1.91449 */
9208 -32379, /* A2 = -0.988129 */
9209 23820, /* B2 = 0.726929 */
9210 -23104, /* B1 = -1.410217 */
9211 23820, /* B0 = 0.726929 */
9212 7, /* Internal filter scaling */
9213 159, /* Minimum in-band energy threshold */
9214 21, /* 21/32 in-band to broad-band ratio */
9215 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9218 30552, /* A1 = 1.864807 */
9219 -31434, /* A2 = -0.95929 */
9220 -690, /* B2 = -0.021066 */
9222 690, /* B0 = 0.021066 */
9223 30472, /* A1 = 1.859924 */
9224 -32248, /* A2 = -0.984161 */
9225 13385, /* B2 = 0.408478 */
9226 -12357, /* B1 = -0.754242 */
9227 13385, /* B0 = 0.408478 */
9228 31358, /* A1 = 1.914001 */
9229 -32366, /* A2 = -0.987732 */
9230 26488, /* B2 = 0.80835 */
9231 -25692, /* B1 = -1.568176 */
9232 26490, /* B0 = 0.808411 */
9233 7, /* Internal filter scaling */
9234 159, /* Minimum in-band energy threshold */
9235 21, /* 21/32 in-band to broad-band ratio */
9236 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9239 31397, /* A1 = -1.916321 */
9240 -32623, /* A2 = 0.995605 */
9241 -117, /* B2 = -0.003598 */
9242 0, /* B1 = 0.000000 */
9243 117, /* B0 = 0.003598 */
9244 31403, /* A1 = -1.916687 */
9245 -32700, /* A2 = 0.997925 */
9246 3388, /* B2 = 0.103401 */
9247 -3240, /* B1 = -0.197784 */
9248 3388, /* B0 = 0.103401 */
9249 31463, /* A1 = -1.920410 */
9250 -32702, /* A2 = 0.997986 */
9251 13346, /* B2 = 0.407288 */
9252 -12863, /* B1 = -0.785126 */
9253 13346, /* B0 = 0.407288 */
9254 5, /* Internal filter scaling */
9255 159, /* Minimum in-band energy threshold */
9256 21, /* 21/32 in-band to broad-band ratio */
9257 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9260 30831, /* A1 = 1.881775 */
9261 -32064, /* A2 = -0.978546 */
9262 -367, /* B2 = -0.01122 */
9264 367, /* B0 = 0.01122 */
9265 30813, /* A1 = 1.880737 */
9266 -32456, /* A2 = -0.990509 */
9267 11068, /* B2 = 0.337769 */
9268 -10338, /* B1 = -0.631042 */
9269 11068, /* B0 = 0.337769 */
9270 31214, /* A1 = 1.905212 */
9271 -32491, /* A2 = -0.991577 */
9272 16374, /* B2 = 0.499695 */
9273 -15781, /* B1 = -0.963196 */
9274 16374, /* B0 = 0.499695 */
9275 7, /* Internal filter scaling */
9276 159, /* Minimum in-band energy threshold */
9277 21, /* 21/32 in-band to broad-band ratio */
9278 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9281 31152, /* A1 = -1.901428 */
9282 -32613, /* A2 = 0.995300 */
9283 -314, /* B2 = -0.009605 */
9284 0, /* B1 = 0.000000 */
9285 314, /* B0 = 0.009605 */
9286 31156, /* A1 = -1.901672 */
9287 -32694, /* A2 = 0.997742 */
9288 28847, /* B2 = 0.880371 */
9289 -2734, /* B1 = -0.166901 */
9290 28847, /* B0 = 0.880371 */
9291 31225, /* A1 = -1.905823 */
9292 -32696, /* A2 = 0.997803 */
9293 462, /* B2 = 0.014108 */
9294 -442, /* B1 = -0.027019 */
9295 462, /* B0 = 0.014108 */
9296 5, /* Internal filter scaling */
9297 159, /* Minimum in-band energy threshold */
9298 21, /* 21/32 in-band to broad-band ratio */
9299 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9302 30836, /* A1 = 1.882141 */
9303 -32296, /* A2 = -0.985596 */
9304 -324, /* B2 = -0.009903 */
9306 324, /* B0 = 0.009903 */
9307 30825, /* A1 = 1.881409 */
9308 -32570, /* A2 = -0.993958 */
9309 16847, /* B2 = 0.51416 */
9310 -15792, /* B1 = -0.963898 */
9311 16847, /* B0 = 0.51416 */
9312 31106, /* A1 = 1.89856 */
9313 -32584, /* A2 = -0.994415 */
9314 9579, /* B2 = 0.292328 */
9315 -9164, /* B1 = -0.559357 */
9316 9579, /* B0 = 0.292328 */
9317 7, /* Internal filter scaling */
9318 159, /* Minimum in-band energy threshold */
9319 21, /* 21/32 in-band to broad-band ratio */
9320 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9323 30702, /* A1 = 1.873962 */
9324 -32134, /* A2 = -0.980682 */
9325 -517, /* B2 = -0.015793 */
9327 517, /* B0 = 0.015793 */
9328 30676, /* A1 = 1.872375 */
9329 -32520, /* A2 = -0.992462 */
9330 8144, /* B2 = 0.24855 */
9331 -7596, /* B1 = -0.463684 */
9332 8144, /* B0 = 0.24855 */
9333 31084, /* A1 = 1.897217 */
9334 -32547, /* A2 = -0.993256 */
9335 22713, /* B2 = 0.693176 */
9336 -21734, /* B1 = -1.326599 */
9337 22713, /* B0 = 0.693176 */
9338 7, /* Internal filter scaling */
9339 159, /* Minimum in-band energy threshold */
9340 21, /* 21/32 in-band to broad-band ratio */
9341 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9344 30613, /* A1 = 1.86853 */
9345 -32031, /* A2 = -0.977509 */
9346 -618, /* B2 = -0.018866 */
9348 618, /* B0 = 0.018866 */
9349 30577, /* A1 = 1.866272 */
9350 -32491, /* A2 = -0.991577 */
9351 9612, /* B2 = 0.293335 */
9352 -8935, /* B1 = -0.54541 */
9353 9612, /* B0 = 0.293335 */
9354 31071, /* A1 = 1.896484 */
9355 -32524, /* A2 = -0.992584 */
9356 21596, /* B2 = 0.659058 */
9357 -20667, /* B1 = -1.261414 */
9358 21596, /* B0 = 0.659058 */
9359 7, /* Internal filter scaling */
9360 159, /* Minimum in-band energy threshold */
9361 21, /* 21/32 in-band to broad-band ratio */
9362 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9365 30914, /* A1 = -1.886841 */
9366 -32584, /* A2 = 0.994385 */
9367 -426, /* B2 = -0.013020 */
9368 0, /* B1 = 0.000000 */
9369 426, /* B0 = 0.013020 */
9370 30914, /* A1 = -1.886841 */
9371 -32679, /* A2 = 0.997314 */
9372 17520, /* B2 = 0.534668 */
9373 -16471, /* B1 = -1.005310 */
9374 17520, /* B0 = 0.534668 */
9375 31004, /* A1 = -1.892334 */
9376 -32683, /* A2 = 0.997406 */
9377 819, /* B2 = 0.025023 */
9378 -780, /* B1 = -0.047619 */
9379 819, /* B0 = 0.025023 */
9380 5, /* Internal filter scaling */
9381 159, /* Minimum in-band energy threshold */
9382 21, /* 21/32 in-band to broad-band ratio */
9383 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9387 30881, /* A1 = -1.884827 */
9388 -32603, /* A2 = 0.994965 */
9389 -496, /* B2 = -0.015144 */
9390 0, /* B1 = 0.000000 */
9391 496, /* B0 = 0.015144 */
9392 30880, /* A1 = -1.884766 */
9393 -32692, /* A2 = 0.997711 */
9394 24767, /* B2 = 0.755859 */
9395 -23290, /* B1 = -1.421509 */
9396 24767, /* B0 = 0.755859 */
9397 30967, /* A1 = -1.890076 */
9398 -32694, /* A2 = 0.997772 */
9399 728, /* B2 = 0.022232 */
9400 -691, /* B1 = -0.042194 */
9401 728, /* B0 = 0.022232 */
9402 5, /* Internal filter scaling */
9403 159, /* Minimum in-band energy threshold */
9404 21, /* 21/32 in-band to broad-band ratio */
9405 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9431 30646, /* A1 = 1.870544 */
9432 -32327, /* A2 = -0.986572 */
9433 -287, /* B2 = -0.008769 */
9435 287, /* B0 = 0.008769 */
9436 30627, /* A1 = 1.869324 */
9437 -32607, /* A2 = -0.995087 */
9438 13269, /* B2 = 0.404968 */
9439 -12376, /* B1 = -0.755432 */
9440 13269, /* B0 = 0.404968 */
9441 30924, /* A1 = 1.887512 */
9442 -32619, /* A2 = -0.995453 */
9443 19950, /* B2 = 0.608826 */
9444 -18940, /* B1 = -1.156006 */
9445 19950, /* B0 = 0.608826 */
9446 7, /* Internal filter scaling */
9447 159, /* Minimum in-band energy threshold */
9448 21, /* 21/32 in-band to broad-band ratio */
9449 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9452 30396, /* A1 = 1.855225 */
9453 -32014, /* A2 = -0.97699 */
9454 -395, /* B2 = -0.012055 */
9456 395, /* B0 = 0.012055 */
9457 30343, /* A1 = 1.85199 */
9458 -32482, /* A2 = -0.991302 */
9459 17823, /* B2 = 0.543945 */
9460 -16431, /* B1 = -1.002869 */
9461 17823, /* B0 = 0.543945 */
9462 30872, /* A1 = 1.884338 */
9463 -32516, /* A2 = -0.99231 */
9464 18124, /* B2 = 0.553101 */
9465 -17246, /* B1 = -1.052673 */
9466 18124, /* B0 = 0.553101 */
9467 7, /* Internal filter scaling */
9468 159, /* Minimum in-band energy threshold */
9469 21, /* 21/32 in-band to broad-band ratio */
9470 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9473 30796, /* A1 = -1.879639 */
9474 -32603, /* A2 = 0.994965 */
9475 -254, /* B2 = -0.007762 */
9476 0, /* B1 = 0.000000 */
9477 254, /* B0 = 0.007762 */
9478 30793, /* A1 = -1.879456 */
9479 -32692, /* A2 = 0.997711 */
9480 18934, /* B2 = 0.577820 */
9481 -17751, /* B1 = -1.083496 */
9482 18934, /* B0 = 0.577820 */
9483 30882, /* A1 = -1.884888 */
9484 -32694, /* A2 = 0.997772 */
9485 1858, /* B2 = 0.056713 */
9486 -1758, /* B1 = -0.107357 */
9487 1858, /* B0 = 0.056713 */
9488 5, /* Internal filter scaling */
9489 159, /* Minimum in-band energy threshold */
9490 21, /* 21/32 in-band to broad-band ratio */
9491 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9494 30641, /* A1 = 1.870239 */
9495 -32458, /* A2 = -0.99057 */
9496 -155, /* B2 = -0.004735 */
9498 155, /* B0 = 0.004735 */
9499 30631, /* A1 = 1.869568 */
9500 -32630, /* A2 = -0.995789 */
9501 11453, /* B2 = 0.349548 */
9502 -10666, /* B1 = -0.651001 */
9503 11453, /* B0 = 0.349548 */
9504 30810, /* A1 = 1.880554 */
9505 -32634, /* A2 = -0.995941 */
9506 12237, /* B2 = 0.373474 */
9507 -11588, /* B1 = -0.707336 */
9508 12237, /* B0 = 0.373474 */
9509 7, /* Internal filter scaling */
9510 159, /* Minimum in-band energy threshold */
9511 21, /* 21/32 in-band to broad-band ratio */
9512 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9515 30367, /* A1 = 1.853455 */
9516 -32147, /* A2 = -0.981079 */
9517 -495, /* B2 = -0.015113 */
9519 495, /* B0 = 0.015113 */
9520 30322, /* A1 = 1.850769 */
9521 -32543, /* A2 = -0.993134 */
9522 10031, /* B2 = 0.306152 */
9523 -9252, /* B1 = -0.564728 */
9524 10031, /* B0 = 0.306152 */
9525 30770, /* A1 = 1.878052 */
9526 -32563, /* A2 = -0.993774 */
9527 22674, /* B2 = 0.691956 */
9528 -21465, /* B1 = -1.31012 */
9529 22674, /* B0 = 0.691956 */
9530 7, /* Internal filter scaling */
9531 159, /* Minimum in-band energy threshold */
9532 21, /* 21/32 in-band to broad-band ratio */
9533 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9536 30709, /* A1 = -1.874329 */
9537 -32603, /* A2 = 0.994965 */
9538 -83, /* B2 = -0.002545 */
9539 0, /* B1 = 0.000000 */
9540 83, /* B0 = 0.002545 */
9541 30704, /* A1 = -1.874084 */
9542 -32692, /* A2 = 0.997711 */
9543 10641, /* B2 = 0.324738 */
9544 -9947, /* B1 = -0.607147 */
9545 10641, /* B0 = 0.324738 */
9546 30796, /* A1 = -1.879639 */
9547 -32694, /* A2 = 0.997772 */
9548 10079, /* B2 = 0.307587 */
9549 9513, /* B1 = 0.580688 */
9550 10079, /* B0 = 0.307587 */
9551 5, /* Internal filter scaling */
9552 159, /* Minimum in-band energy threshold */
9553 21, /* 21/32 in-band to broad-band ratio */
9554 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9557 30664, /* A1 = -1.871643 */
9558 -32603, /* A2 = 0.994965 */
9559 -164, /* B2 = -0.005029 */
9560 0, /* B1 = 0.000000 */
9561 164, /* B0 = 0.005029 */
9562 30661, /* A1 = -1.871399 */
9563 -32692, /* A2 = 0.997711 */
9564 15294, /* B2 = 0.466736 */
9565 -14275, /* B1 = -0.871307 */
9566 15294, /* B0 = 0.466736 */
9567 30751, /* A1 = -1.876953 */
9568 -32694, /* A2 = 0.997772 */
9569 3548, /* B2 = 0.108284 */
9570 -3344, /* B1 = -0.204155 */
9571 3548, /* B0 = 0.108284 */
9572 5, /* Internal filter scaling */
9573 159, /* Minimum in-band energy threshold */
9574 21, /* 21/32 in-band to broad-band ratio */
9575 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9578 30653, /* A1 = -1.870911 */
9579 -32615, /* A2 = 0.995361 */
9580 -209, /* B2 = -0.006382 */
9581 0, /* B1 = 0.000000 */
9582 209, /* B0 = 0.006382 */
9583 30647, /* A1 = -1.870605 */
9584 -32702, /* A2 = 0.997986 */
9585 18971, /* B2 = 0.578979 */
9586 -17716, /* B1 = -1.081299 */
9587 18971, /* B0 = 0.578979 */
9588 30738, /* A1 = -1.876099 */
9589 -32702, /* A2 = 0.998016 */
9590 2967, /* B2 = 0.090561 */
9591 -2793, /* B1 = -0.170502 */
9592 2967, /* B0 = 0.090561 */
9593 5, /* Internal filter scaling */
9594 159, /* Minimum in-band energy threshold */
9595 21, /* 21/32 in-band to broad-band ratio */
9596 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9599 30437, /* A1 = -1.857727 */
9600 -32603, /* A2 = 0.994965 */
9601 -264, /* B2 = -0.008062 */
9602 0, /* B1 = 0.000000 */
9603 264, /* B0 = 0.008062 */
9604 30430, /* A1 = -1.857300 */
9605 -32692, /* A2 = 0.997711 */
9606 21681, /* B2 = 0.661682 */
9607 -20082, /* B1 = -1.225708 */
9608 21681, /* B0 = 0.661682 */
9609 30526, /* A1 = -1.863220 */
9610 -32694, /* A2 = 0.997742 */
9611 1559, /* B2 = 0.047600 */
9612 -1459, /* B1 = -0.089096 */
9613 1559, /* B0 = 0.047600 */
9614 5, /* Internal filter scaling */
9615 159, /* Minimum in-band energy threshold */
9616 21, /* 21/32 in-band to broad-band ratio */
9617 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9620 28975, /* A1 = 1.768494 */
9621 -30955, /* A2 = -0.944672 */
9622 -1026, /* B2 = -0.03133 */
9624 1026, /* B0 = 0.03133 */
9625 28613, /* A1 = 1.746399 */
9626 -32089, /* A2 = -0.979309 */
9627 14214, /* B2 = 0.433807 */
9628 -12202, /* B1 = -0.744812 */
9629 14214, /* B0 = 0.433807 */
9630 30243, /* A1 = 1.845947 */
9631 -32238, /* A2 = -0.983856 */
9632 24825, /* B2 = 0.757629 */
9633 -23402, /* B1 = -1.428345 */
9634 24825, /* B0 = 0.757629 */
9635 7, /* Internal filter scaling */
9636 159, /* Minimum in-band energy threshold */
9637 21, /* 21/32 in-band to broad-band ratio */
9638 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9641 30257, /* A1 = -1.846741 */
9642 -32605, /* A2 = 0.995056 */
9643 -249, /* B2 = -0.007625 */
9644 0, /* B1 = 0.000000 */
9645 249, /* B0 = 0.007625 */
9646 30247, /* A1 = -1.846191 */
9647 -32694, /* A2 = 0.997772 */
9648 18088, /* B2 = 0.552002 */
9649 -16652, /* B1 = -1.016418 */
9650 18088, /* B0 = 0.552002 */
9651 30348, /* A1 = -1.852295 */
9652 -32696, /* A2 = 0.997803 */
9653 2099, /* B2 = 0.064064 */
9654 -1953, /* B1 = -0.119202 */
9655 2099, /* B0 = 0.064064 */
9656 5, /* Internal filter scaling */
9657 159, /* Minimum in-band energy threshold */
9658 21, /* 21/32 in-band to broad-band ratio */
9659 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9662 30202, /* A1 = -1.843431 */
9663 -32624, /* A2 = 0.995622 */
9664 -413, /* B2 = -0.012622 */
9665 0, /* B1 = 0.000000 */
9666 413, /* B0 = 0.012622 */
9667 30191, /* A1 = -1.842721 */
9668 -32714, /* A2 = 0.998364 */
9669 25954, /* B2 = 0.792057 */
9670 -23890, /* B1 = -1.458131 */
9671 25954, /* B0 = 0.792057 */
9672 30296, /* A1 = -1.849172 */
9673 -32715, /* A2 = 0.998397 */
9674 2007, /* B2 = 0.061264 */
9675 -1860, /* B1 = -0.113568 */
9676 2007, /* B0 = 0.061264 */
9677 5, /* Internal filter scaling */
9678 159, /* Minimum in-band energy threshold */
9679 21, /* 21/32 in-band to broad-band ratio */
9680 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9683 30001, /* A1 = -1.831116 */
9684 -32613, /* A2 = 0.995270 */
9685 -155, /* B2 = -0.004750 */
9686 0, /* B1 = 0.000000 */
9687 155, /* B0 = 0.004750 */
9688 29985, /* A1 = -1.830200 */
9689 -32710, /* A2 = 0.998260 */
9690 6584, /* B2 = 0.200928 */
9691 -6018, /* B1 = -0.367355 */
9692 6584, /* B0 = 0.200928 */
9693 30105, /* A1 = -1.837524 */
9694 -32712, /* A2 = 0.998291 */
9695 23812, /* B2 = 0.726685 */
9696 -21936, /* B1 = -1.338928 */
9697 23812, /* B0 = 0.726685 */
9698 5, /* Internal filter scaling */
9699 159, /* Minimum in-band energy threshold */
9700 21, /* 21/32 in-band to broad-band ratio */
9701 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9704 29964, /* A1 = -1.828918 */
9705 -32601, /* A2 = 0.994904 */
9706 -101, /* B2 = -0.003110 */
9707 0, /* B1 = 0.000000 */
9708 101, /* B0 = 0.003110 */
9709 29949, /* A1 = -1.827942 */
9710 -32700, /* A2 = 0.997925 */
9711 11041, /* B2 = 0.336975 */
9712 -10075, /* B1 = -0.614960 */
9713 11041, /* B0 = 0.336975 */
9714 30070, /* A1 = -1.835388 */
9715 -32702, /* A2 = 0.997986 */
9716 16762, /* B2 = 0.511536 */
9717 -15437, /* B1 = -0.942230 */
9718 16762, /* B0 = 0.511536 */
9719 5, /* Internal filter scaling */
9720 159, /* Minimum in-band energy threshold */
9721 21, /* 21/32 in-band to broad-band ratio */
9722 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9725 29936, /* A1 = -1.827209 */
9726 -32584, /* A2 = 0.994415 */
9727 -91, /* B2 = -0.002806 */
9728 0, /* B1 = 0.000000 */
9729 91, /* B0 = 0.002806 */
9730 29921, /* A1 = -1.826233 */
9731 -32688, /* A2 = 0.997559 */
9732 11449, /* B2 = 0.349396 */
9733 -10426, /* B1 = -0.636383 */
9734 11449, /* B0 = 0.349396 */
9735 30045, /* A1 = -1.833862 */
9736 -32688, /* A2 = 0.997589 */
9737 13055, /* B2 = 0.398407 */
9738 -12028, /* B1 = -0.734161 */
9739 13055, /* B0 = 0.398407 */
9740 5, /* Internal filter scaling */
9741 159, /* Minimum in-band energy threshold */
9742 21, /* 21/32 in-band to broad-band ratio */
9743 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9746 28499, /* A1 = 1.739441 */
9747 -31129, /* A2 = -0.949982 */
9748 -849, /* B2 = -0.025922 */
9750 849, /* B0 = 0.025922 */
9751 28128, /* A1 = 1.716797 */
9752 -32130, /* A2 = -0.98056 */
9753 14556, /* B2 = 0.444214 */
9754 -12251, /* B1 = -0.747772 */
9755 14556, /* B0 = 0.444244 */
9756 29667, /* A1 = 1.81073 */
9757 -32244, /* A2 = -0.984039 */
9758 23038, /* B2 = 0.703064 */
9759 -21358, /* B1 = -1.303589 */
9760 23040, /* B0 = 0.703125 */
9761 7, /* Internal filter scaling */
9762 159, /* Minimum in-band energy threshold */
9763 21, /* 21/32 in-band to broad-band ratio */
9764 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9767 29271, /* A1 = -1.786560 */
9768 -32599, /* A2 = 0.994873 */
9769 -490, /* B2 = -0.014957 */
9770 0, /* B1 = 0.000000 */
9771 490, /* B0 = 0.014957 */
9772 29246, /* A1 = -1.785095 */
9773 -32700, /* A2 = 0.997925 */
9774 28961, /* B2 = 0.883850 */
9775 -25796, /* B1 = -1.574463 */
9776 28961, /* B0 = 0.883850 */
9777 29383, /* A1 = -1.793396 */
9778 -32700, /* A2 = 0.997955 */
9779 1299, /* B2 = 0.039650 */
9780 -1169, /* B1 = -0.071396 */
9781 1299, /* B0 = 0.039650 */
9782 5, /* Internal filter scaling */
9783 159, /* Minimum in-band energy threshold */
9784 21, /* 21/32 in-band to broad-band ratio */
9785 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9788 29230, /* A1 = -1.784058 */
9789 -32584, /* A2 = 0.994415 */
9790 -418, /* B2 = -0.012757 */
9791 0, /* B1 = 0.000000 */
9792 418, /* B0 = 0.012757 */
9793 29206, /* A1 = -1.782593 */
9794 -32688, /* A2 = 0.997559 */
9795 36556, /* B2 = 1.115601 */
9796 -32478, /* B1 = -1.982300 */
9797 36556, /* B0 = 1.115601 */
9798 29345, /* A1 = -1.791077 */
9799 -32688, /* A2 = 0.997589 */
9800 897, /* B2 = 0.027397 */
9801 -808, /* B1 = -0.049334 */
9802 897, /* B0 = 0.027397 */
9803 5, /* Internal filter scaling */
9804 159, /* Minimum in-band energy threshold */
9805 21, /* 21/32 in-band to broad-band ratio */
9806 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9809 29116, /* A1 = -1.777100 */
9810 -32603, /* A2 = 0.994965 */
9811 -165, /* B2 = -0.005039 */
9812 0, /* B1 = 0.000000 */
9813 165, /* B0 = 0.005039 */
9814 29089, /* A1 = -1.775452 */
9815 -32708, /* A2 = 0.998199 */
9816 6963, /* B2 = 0.212494 */
9817 -6172, /* B1 = -0.376770 */
9818 6963, /* B0 = 0.212494 */
9819 29237, /* A1 = -1.784485 */
9820 -32710, /* A2 = 0.998230 */
9821 24197, /* B2 = 0.738464 */
9822 -21657, /* B1 = -1.321899 */
9823 24197, /* B0 = 0.738464 */
9824 5, /* Internal filter scaling */
9825 159, /* Minimum in-band energy threshold */
9826 21, /* 21/32 in-band to broad-band ratio */
9827 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9830 28376, /* A1 = -1.731934 */
9831 -32567, /* A2 = 0.993896 */
9832 -363, /* B2 = -0.011102 */
9833 0, /* B1 = 0.000000 */
9834 363, /* B0 = 0.011102 */
9835 28337, /* A1 = -1.729614 */
9836 -32683, /* A2 = 0.997434 */
9837 21766, /* B2 = 0.664246 */
9838 -18761, /* B1 = -1.145081 */
9839 21766, /* B0 = 0.664246 */
9840 28513, /* A1 = -1.740356 */
9841 -32686, /* A2 = 0.997498 */
9842 2509, /* B2 = 0.076584 */
9843 -2196, /* B1 = -0.134041 */
9844 2509, /* B0 = 0.076584 */
9845 5, /* Internal filter scaling */
9846 159, /* Minimum in-band energy threshold */
9847 21, /* 21/32 in-band to broad-band ratio */
9848 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9851 27844, /* A1 = -1.699463 */
9852 -32563, /* A2 = 0.993744 */
9853 -366, /* B2 = -0.011187 */
9854 0, /* B1 = 0.000000 */
9855 366, /* B0 = 0.011187 */
9856 27797, /* A1 = -1.696655 */
9857 -32686, /* A2 = 0.997498 */
9858 22748, /* B2 = 0.694214 */
9859 -19235, /* B1 = -1.174072 */
9860 22748, /* B0 = 0.694214 */
9861 27995, /* A1 = -1.708740 */
9862 -32688, /* A2 = 0.997559 */
9863 2964, /* B2 = 0.090477 */
9864 -2546, /* B1 = -0.155449 */
9865 2964, /* B0 = 0.090477 */
9866 5, /* Internal filter scaling */
9867 159, /* Minimum in-band energy threshold */
9868 21, /* 21/32 in-band to broad-band ratio */
9869 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9872 27297, /* A1 = -1.666077 */
9873 -32551, /* A2 = 0.993408 */
9874 -345, /* B2 = -0.010540 */
9875 0, /* B1 = 0.000000 */
9876 345, /* B0 = 0.010540 */
9877 27240, /* A1 = -1.662598 */
9878 -32683, /* A2 = 0.997406 */
9879 22560, /* B2 = 0.688477 */
9880 -18688, /* B1 = -1.140625 */
9881 22560, /* B0 = 0.688477 */
9882 27461, /* A1 = -1.676147 */
9883 -32684, /* A2 = 0.997467 */
9884 3541, /* B2 = 0.108086 */
9885 -2985, /* B1 = -0.182220 */
9886 3541, /* B0 = 0.108086 */
9887 5, /* Internal filter scaling */
9888 159, /* Minimum in-band energy threshold */
9889 21, /* 21/32 in-band to broad-band ratio */
9890 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9893 27155, /* A1 = -1.657410 */
9894 -32551, /* A2 = 0.993408 */
9895 -462, /* B2 = -0.014117 */
9896 0, /* B1 = 0.000000 */
9897 462, /* B0 = 0.014117 */
9898 27097, /* A1 = -1.653870 */
9899 -32683, /* A2 = 0.997406 */
9900 32495, /* B2 = 0.991699 */
9901 -26776, /* B1 = -1.634338 */
9902 32495, /* B0 = 0.991699 */
9903 27321, /* A1 = -1.667542 */
9904 -32684, /* A2 = 0.997467 */
9905 1835, /* B2 = 0.056007 */
9906 -1539, /* B1 = -0.093948 */
9907 1835, /* B0 = 0.056007 */
9908 5, /* Internal filter scaling */
9909 159, /* Minimum in-band energy threshold */
9910 21, /* 21/32 in-band to broad-band ratio */
9911 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9914 19298, /* A1 = 1.177917 */
9915 -24471, /* A2 = -0.746796 */
9916 -4152, /* B2 = -0.126709 */
9918 4152, /* B0 = 0.126709 */
9919 12902, /* A1 = 0.787476 */
9920 -29091, /* A2 = -0.887817 */
9921 12491, /* B2 = 0.38121 */
9922 -1794, /* B1 = -0.109528 */
9923 12494, /* B0 = 0.381317 */
9924 26291, /* A1 = 1.604736 */
9925 -30470, /* A2 = -0.929901 */
9926 28859, /* B2 = 0.880737 */
9927 -26084, /* B1 = -1.592102 */
9928 28861, /* B0 = 0.880798 */
9929 7, /* Internal filter scaling */
9930 159, /* Minimum in-band energy threshold */
9931 21, /* 21/32 in-band to broad-band ratio */
9932 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9935 26867, /* A1 = -1.639832 */
9936 -32551, /* A2 = 0.993408 */
9937 -123, /* B2 = -0.003755 */
9938 0, /* B1 = 0.000000 */
9939 123, /* B0 = 0.003755 */
9940 26805, /* A1 = -1.636108 */
9941 -32683, /* A2 = 0.997406 */
9942 17297, /* B2 = 0.527863 */
9943 -14096, /* B1 = -0.860382 */
9944 17297, /* B0 = 0.527863 */
9945 27034, /* A1 = -1.650085 */
9946 -32684, /* A2 = 0.997467 */
9947 12958, /* B2 = 0.395477 */
9948 -10756, /* B1 = -0.656525 */
9949 12958, /* B0 = 0.395477 */
9950 5, /* Internal filter scaling */
9951 159, /* Minimum in-band energy threshold */
9952 21, /* 21/32 in-band to broad-band ratio */
9953 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9956 26413, /* A1 = -1.612122 */
9957 -32547, /* A2 = 0.993286 */
9958 -223, /* B2 = -0.006825 */
9959 0, /* B1 = 0.000000 */
9960 223, /* B0 = 0.006825 */
9961 26342, /* A1 = -1.607849 */
9962 -32686, /* A2 = 0.997498 */
9963 6391, /* B2 = 0.195053 */
9964 -5120, /* B1 = -0.312531 */
9965 6391, /* B0 = 0.195053 */
9966 26593, /* A1 = -1.623108 */
9967 -32688, /* A2 = 0.997559 */
9968 23681, /* B2 = 0.722717 */
9969 -19328, /* B1 = -1.179688 */
9970 23681, /* B0 = 0.722717 */
9971 5, /* Internal filter scaling */
9972 159, /* Minimum in-band energy threshold */
9973 21, /* 21/32 in-band to broad-band ratio */
9974 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9977 26168, /* A1 = -1.597209 */
9978 -32528, /* A2 = 0.992706 */
9979 -235, /* B2 = -0.007182 */
9980 0, /* B1 = 0.000000 */
9981 235, /* B0 = 0.007182 */
9982 26092, /* A1 = -1.592590 */
9983 -32675, /* A2 = 0.997192 */
9984 20823, /* B2 = 0.635498 */
9985 -16510, /* B1 = -1.007751 */
9986 20823, /* B0 = 0.635498 */
9987 26363, /* A1 = -1.609070 */
9988 -32677, /* A2 = 0.997253 */
9989 6739, /* B2 = 0.205688 */
9990 -5459, /* B1 = -0.333206 */
9991 6739, /* B0 = 0.205688 */
9992 5, /* Internal filter scaling */
9993 159, /* Minimum in-band energy threshold */
9994 21, /* 21/32 in-band to broad-band ratio */
9995 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
9998 25641, /* A1 = -1.565063 */
9999 -32536, /* A2 = 0.992950 */
10000 -121, /* B2 = -0.003707 */
10001 0, /* B1 = 0.000000 */
10002 121, /* B0 = 0.003707 */
10003 25560, /* A1 = -1.560059 */
10004 -32684, /* A2 = 0.997437 */
10005 18341, /* B2 = 0.559753 */
10006 -14252, /* B1 = -0.869904 */
10007 18341, /* B0 = 0.559753 */
10008 25837, /* A1 = -1.577026 */
10009 -32684, /* A2 = 0.997467 */
10010 16679, /* B2 = 0.509003 */
10011 -13232, /* B1 = -0.807648 */
10012 16679, /* B0 = 0.509003 */
10013 5, /* Internal filter scaling */
10014 159, /* Minimum in-band energy threshold */
10015 21, /* 21/32 in-band to broad-band ratio */
10016 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10018 { /* f857_1645[] */
10019 16415, /* A1 = 1.001953 */
10020 -23669, /* A2 = -0.722321 */
10021 -4549, /* B2 = -0.138847 */
10023 4549, /* B0 = 0.138847 */
10024 8456, /* A1 = 0.516174 */
10025 -28996, /* A2 = -0.884918 */
10026 13753, /* B2 = 0.419724 */
10027 -12, /* B1 = -0.000763 */
10028 13757, /* B0 = 0.419846 */
10029 24632, /* A1 = 1.503418 */
10030 -30271, /* A2 = -0.923828 */
10031 29070, /* B2 = 0.887146 */
10032 -25265, /* B1 = -1.542114 */
10033 29073, /* B0 = 0.887268 */
10034 7, /* Internal filter scaling */
10035 159, /* Minimum in-band energy threshold */
10036 21, /* 21/32 in-band to broad-band ratio */
10037 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10040 24806, /* A1 = -1.514099 */
10041 -32501, /* A2 = 0.991852 */
10042 -326, /* B2 = -0.009969 */
10043 0, /* B1 = 0.000000 */
10044 326, /* B0 = 0.009969 */
10045 24709, /* A1 = -1.508118 */
10046 -32659, /* A2 = 0.996674 */
10047 20277, /* B2 = 0.618835 */
10048 -15182, /* B1 = -0.926636 */
10049 20277, /* B0 = 0.618835 */
10050 25022, /* A1 = -1.527222 */
10051 -32661, /* A2 = 0.996735 */
10052 4320, /* B2 = 0.131836 */
10053 -3331, /* B1 = -0.203339 */
10054 4320, /* B0 = 0.131836 */
10055 5, /* Internal filter scaling */
10056 159, /* Minimum in-band energy threshold */
10057 21, /* 21/32 in-band to broad-band ratio */
10058 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10060 { /* f900_1300[] */
10061 19776, /* A1 = 1.207092 */
10062 -27437, /* A2 = -0.837341 */
10063 -2666, /* B2 = -0.081371 */
10065 2666, /* B0 = 0.081371 */
10066 16302, /* A1 = 0.995026 */
10067 -30354, /* A2 = -0.926361 */
10068 10389, /* B2 = 0.317062 */
10069 -3327, /* B1 = -0.203064 */
10070 10389, /* B0 = 0.317062 */
10071 24299, /* A1 = 1.483154 */
10072 -30930, /* A2 = -0.943909 */
10073 25016, /* B2 = 0.763428 */
10074 -21171, /* B1 = -1.292236 */
10075 25016, /* B0 = 0.763428 */
10076 7, /* Internal filter scaling */
10077 159, /* Minimum in-band energy threshold */
10078 21, /* 21/32 in-band to broad-band ratio */
10079 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10081 { /* f935_1215[] */
10082 20554, /* A1 = 1.254517 */
10083 -28764, /* A2 = -0.877838 */
10084 -2048, /* B2 = -0.062515 */
10086 2048, /* B0 = 0.062515 */
10087 18209, /* A1 = 1.11145 */
10088 -30951, /* A2 = -0.94458 */
10089 9390, /* B2 = 0.286575 */
10090 -3955, /* B1 = -0.241455 */
10091 9390, /* B0 = 0.286575 */
10092 23902, /* A1 = 1.458923 */
10093 -31286, /* A2 = -0.954803 */
10094 23252, /* B2 = 0.709595 */
10095 -19132, /* B1 = -1.167725 */
10096 23252, /* B0 = 0.709595 */
10097 7, /* Internal filter scaling */
10098 159, /* Minimum in-band energy threshold */
10099 21, /* 21/32 in-band to broad-band ratio */
10100 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10102 { /* f941_1477[] */
10103 17543, /* A1 = 1.07074 */
10104 -26220, /* A2 = -0.800201 */
10105 -3298, /* B2 = -0.100647 */
10107 3298, /* B0 = 0.100647 */
10108 12423, /* A1 = 0.75827 */
10109 -30036, /* A2 = -0.916626 */
10110 12651, /* B2 = 0.386078 */
10111 -2444, /* B1 = -0.14917 */
10112 12653, /* B0 = 0.386154 */
10113 23518, /* A1 = 1.435425 */
10114 -30745, /* A2 = -0.938293 */
10115 27282, /* B2 = 0.832581 */
10116 -22529, /* B1 = -1.375122 */
10117 27286, /* B0 = 0.832703 */
10118 7, /* Internal filter scaling */
10119 159, /* Minimum in-band energy threshold */
10120 21, /* 21/32 in-band to broad-band ratio */
10121 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10124 24104, /* A1 = -1.471252 */
10125 -32507, /* A2 = 0.992065 */
10126 -351, /* B2 = -0.010722 */
10127 0, /* B1 = 0.000000 */
10128 351, /* B0 = 0.010722 */
10129 23996, /* A1 = -1.464600 */
10130 -32671, /* A2 = 0.997040 */
10131 22848, /* B2 = 0.697266 */
10132 -16639, /* B1 = -1.015564 */
10133 22848, /* B0 = 0.697266 */
10134 24332, /* A1 = -1.485168 */
10135 -32673, /* A2 = 0.997101 */
10136 4906, /* B2 = 0.149727 */
10137 -3672, /* B1 = -0.224174 */
10138 4906, /* B0 = 0.149727 */
10139 5, /* Internal filter scaling */
10140 159, /* Minimum in-band energy threshold */
10141 21, /* 21/32 in-band to broad-band ratio */
10142 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10145 23967, /* A1 = -1.462830 */
10146 -32507, /* A2 = 0.992065 */
10147 -518, /* B2 = -0.015821 */
10148 0, /* B1 = 0.000000 */
10149 518, /* B0 = 0.015821 */
10150 23856, /* A1 = -1.456055 */
10151 -32671, /* A2 = 0.997040 */
10152 26287, /* B2 = 0.802246 */
10153 -19031, /* B1 = -1.161560 */
10154 26287, /* B0 = 0.802246 */
10155 24195, /* A1 = -1.476746 */
10156 -32673, /* A2 = 0.997101 */
10157 2890, /* B2 = 0.088196 */
10158 -2151, /* B1 = -0.131317 */
10159 2890, /* B0 = 0.088196 */
10160 5, /* Internal filter scaling */
10161 159, /* Minimum in-band energy threshold */
10162 21, /* 21/32 in-band to broad-band ratio */
10163 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10165 { /* f950_1400[] */
10166 18294, /* A1 = 1.116638 */
10167 -26962, /* A2 = -0.822845 */
10168 -2914, /* B2 = -0.088936 */
10170 2914, /* B0 = 0.088936 */
10171 14119, /* A1 = 0.861786 */
10172 -30227, /* A2 = -0.922455 */
10173 11466, /* B2 = 0.349945 */
10174 -2833, /* B1 = -0.172943 */
10175 11466, /* B0 = 0.349945 */
10176 23431, /* A1 = 1.430115 */
10177 -30828, /* A2 = -0.940796 */
10178 25331, /* B2 = 0.773071 */
10179 -20911, /* B1 = -1.276367 */
10180 25331, /* B0 = 0.773071 */
10181 7, /* Internal filter scaling */
10182 159, /* Minimum in-band energy threshold */
10183 21, /* 21/32 in-band to broad-band ratio */
10184 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10187 23521, /* A1 = -1.435608 */
10188 -32489, /* A2 = 0.991516 */
10189 -193, /* B2 = -0.005915 */
10190 0, /* B1 = 0.000000 */
10191 193, /* B0 = 0.005915 */
10192 23404, /* A1 = -1.428467 */
10193 -32655, /* A2 = 0.996582 */
10194 17740, /* B2 = 0.541412 */
10195 -12567, /* B1 = -0.767029 */
10196 17740, /* B0 = 0.541412 */
10197 23753, /* A1 = -1.449829 */
10198 -32657, /* A2 = 0.996613 */
10199 9090, /* B2 = 0.277405 */
10200 -6662, /* B1 = -0.406647 */
10201 9090, /* B0 = 0.277405 */
10202 5, /* Internal filter scaling */
10203 159, /* Minimum in-band energy threshold */
10204 21, /* 21/32 in-band to broad-band ratio */
10205 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10208 23071, /* A1 = -1.408203 */
10209 -32489, /* A2 = 0.991516 */
10210 -293, /* B2 = -0.008965 */
10211 0, /* B1 = 0.000000 */
10212 293, /* B0 = 0.008965 */
10213 22951, /* A1 = -1.400818 */
10214 -32655, /* A2 = 0.996582 */
10215 5689, /* B2 = 0.173645 */
10216 -3951, /* B1 = -0.241150 */
10217 5689, /* B0 = 0.173645 */
10218 23307, /* A1 = -1.422607 */
10219 -32657, /* A2 = 0.996613 */
10220 18692, /* B2 = 0.570435 */
10221 -13447, /* B1 = -0.820770 */
10222 18692, /* B0 = 0.570435 */
10223 5, /* Internal filter scaling */
10224 159, /* Minimum in-band energy threshold */
10225 21, /* 21/32 in-band to broad-band ratio */
10226 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10229 22701, /* A1 = -1.385620 */
10230 -32474, /* A2 = 0.991058 */
10231 -292, /* B2 = -0.008933 */
10232 0, /*163840 , B1 = 10.000000 */
10233 292, /* B0 = 0.008933 */
10234 22564, /* A1 = -1.377258 */
10235 -32655, /* A2 = 0.996552 */
10236 20756, /* B2 = 0.633423 */
10237 -14176, /* B1 = -0.865295 */
10238 20756, /* B0 = 0.633423 */
10239 22960, /* A1 = -1.401428 */
10240 -32657, /* A2 = 0.996613 */
10241 6520, /* B2 = 0.198990 */
10242 -4619, /* B1 = -0.281937 */
10243 6520, /* B0 = 0.198990 */
10244 5, /* Internal filter scaling */
10245 159, /* Minimum in-band energy threshold */
10246 21, /* 21/32 in-band to broad-band ratio */
10247 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10250 22142, /* A1 = -1.351501 */
10251 -32474, /* A2 = 0.991058 */
10252 -147, /* B2 = -0.004493 */
10253 0, /* B1 = 0.000000 */
10254 147, /* B0 = 0.004493 */
10255 22000, /* A1 = -1.342834 */
10256 -32655, /* A2 = 0.996552 */
10257 15379, /* B2 = 0.469360 */
10258 -10237, /* B1 = -0.624847 */
10259 15379, /* B0 = 0.469360 */
10260 22406, /* A1 = -1.367554 */
10261 -32657, /* A2 = 0.996613 */
10262 17491, /* B2 = 0.533783 */
10263 -12096, /* B1 = -0.738312 */
10264 17491, /* B0 = 0.533783 */
10265 5, /* Internal filter scaling */
10266 159, /* Minimum in-band energy threshold */
10267 21, /* 21/32 in-band to broad-band ratio */
10268 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10270 { /* f1100_1750[] */
10271 12973, /* A1 = 0.79184 */
10272 -24916, /* A2 = -0.760376 */
10273 6655, /* B2 = 0.203102 */
10274 367, /* B1 = 0.0224 */
10275 6657, /* B0 = 0.203171 */
10276 5915, /* A1 = 0.361053 */
10277 -29560, /* A2 = -0.90213 */
10278 -7777, /* B2 = -0.23735 */
10280 7777, /* B0 = 0.23735 */
10281 20510, /* A1 = 1.251892 */
10282 -30260, /* A2 = -0.923462 */
10283 26662, /* B2 = 0.81366 */
10284 -20573, /* B1 = -1.255737 */
10285 26668, /* B0 = 0.813843 */
10286 7, /* Internal filter scaling */
10287 159, /* Minimum in-band energy threshold */
10288 21, /* 21/32 in-band to broad-band ratio */
10289 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10292 20392, /* A1 = -1.244629 */
10293 -32460, /* A2 = 0.990601 */
10294 -270, /* B2 = -0.008240 */
10295 0, /* B1 = 0.000000 */
10296 270, /* B0 = 0.008240 */
10297 20218, /* A1 = -1.234009 */
10298 -32655, /* A2 = 0.996582 */
10299 21337, /* B2 = 0.651154 */
10300 -13044, /* B1 = -0.796143 */
10301 21337, /* B0 = 0.651154 */
10302 20684, /* A1 = -1.262512 */
10303 -32657, /* A2 = 0.996643 */
10304 8572, /* B2 = 0.261612 */
10305 -5476, /* B1 = -0.334244 */
10306 8572, /* B0 = 0.261612 */
10307 5, /* Internal filter scaling */
10308 159, /* Minimum in-band energy threshold */
10309 21, /* 21/32 in-band to broad-band ratio */
10310 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10313 19159, /* A1 = -1.169373 */
10314 -32456, /* A2 = 0.990509 */
10315 -335, /* B2 = -0.010252 */
10316 0, /* B1 = 0.000000 */
10317 335, /* B0 = 0.010252 */
10318 18966, /* A1 = -1.157593 */
10319 -32661, /* A2 = 0.996735 */
10320 6802, /* B2 = 0.207588 */
10321 -3900, /* B1 = -0.238098 */
10322 6802, /* B0 = 0.207588 */
10323 19467, /* A1 = -1.188232 */
10324 -32661, /* A2 = 0.996765 */
10325 25035, /* B2 = 0.764008 */
10326 -15049, /* B1 = -0.918579 */
10327 25035, /* B0 = 0.764008 */
10328 5, /* Internal filter scaling */
10329 159, /* Minimum in-band energy threshold */
10330 21, /* 21/32 in-band to broad-band ratio */
10331 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10334 18976, /* A1 = -1.158264 */
10335 -32439, /* A2 = 0.989990 */
10336 -183, /* B2 = -0.005588 */
10337 0, /* B1 = 0.000000 */
10338 183, /* B0 = 0.005588 */
10339 18774, /* A1 = -1.145874 */
10340 -32650, /* A2 = 0.996429 */
10341 15468, /* B2 = 0.472076 */
10342 -8768, /* B1 = -0.535217 */
10343 15468, /* B0 = 0.472076 */
10344 19300, /* A1 = -1.177979 */
10345 -32652, /* A2 = 0.996490 */
10346 19840, /* B2 = 0.605499 */
10347 -11842, /* B1 = -0.722809 */
10348 19840, /* B0 = 0.605499 */
10349 5, /* Internal filter scaling */
10350 159, /* Minimum in-band energy threshold */
10351 21, /* 21/32 in-band to broad-band ratio */
10352 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10355 16357, /* A1 = -0.998413 */
10356 -32368, /* A2 = 0.987793 */
10357 -217, /* B2 = -0.006652 */
10358 0, /* B1 = 0.000000 */
10359 217, /* B0 = 0.006652 */
10360 16107, /* A1 = -0.983126 */
10361 -32601, /* A2 = 0.994904 */
10362 11602, /* B2 = 0.354065 */
10363 -5555, /* B1 = -0.339111 */
10364 11602, /* B0 = 0.354065 */
10365 16722, /* A1 = -1.020630 */
10366 -32603, /* A2 = 0.994965 */
10367 15574, /* B2 = 0.475311 */
10368 -8176, /* B1 = -0.499069 */
10369 15574, /* B0 = 0.475311 */
10370 5, /* Internal filter scaling */
10371 159, /* Minimum in-band energy threshold */
10372 21, /* 21/32 in-band to broad-band ratio */
10373 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10376 16234, /* A1 = -0.990875 */
10377 32404, /* A2 = -0.988922 */
10378 -193, /* B2 = -0.005908 */
10379 0, /* B1 = 0.000000 */
10380 193, /* B0 = 0.005908 */
10381 15986, /* A1 = -0.975769 */
10382 -32632, /* A2 = 0.995880 */
10383 18051, /* B2 = 0.550903 */
10384 -8658, /* B1 = -0.528473 */
10385 18051, /* B0 = 0.550903 */
10386 16591, /* A1 = -1.012695 */
10387 -32634, /* A2 = 0.995941 */
10388 15736, /* B2 = 0.480240 */
10389 -8125, /* B1 = -0.495926 */
10390 15736, /* B0 = 0.480240 */
10391 5, /* Internal filter scaling */
10392 159, /* Minimum in-band energy threshold */
10393 21, /* 21/32 in-band to broad-band ratio */
10394 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10397 15564, /* A1 = -0.949982 */
10398 -32404, /* A2 = 0.988922 */
10399 -269, /* B2 = -0.008216 */
10400 0, /* B1 = 0.000000 */
10401 269, /* B0 = 0.008216 */
10402 15310, /* A1 = -0.934479 */
10403 -32632, /* A2 = 0.995880 */
10404 10815, /* B2 = 0.330063 */
10405 -4962, /* B1 = -0.302887 */
10406 10815, /* B0 = 0.330063 */
10407 15924, /* A1 = -0.971924 */
10408 -32634, /* A2 = 0.995941 */
10409 18880, /* B2 = 0.576172 */
10410 -9364, /* B1 = -0.571594 */
10411 18880, /* B0 = 0.576172 */
10412 5, /* Internal filter scaling */
10413 159, /* Minimum in-band energy threshold */
10414 21, /* 21/32 in-band to broad-band ratio */
10415 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10418 15247, /* A1 = -0.930603 */
10419 -32397, /* A2 = 0.988708 */
10420 -244, /* B2 = -0.007451 */
10421 0, /* B1 = 0.000000 */
10422 244, /* B0 = 0.007451 */
10423 14989, /* A1 = -0.914886 */
10424 -32627, /* A2 = 0.995697 */
10425 18961, /* B2 = 0.578644 */
10426 -8498, /* B1 = -0.518707 */
10427 18961, /* B0 = 0.578644 */
10428 15608, /* A1 = -0.952667 */
10429 -32628, /* A2 = 0.995758 */
10430 11145, /* B2 = 0.340134 */
10431 -5430, /* B1 = -0.331467 */
10432 11145, /* B0 = 0.340134 */
10433 5, /* Internal filter scaling */
10434 159, /* Minimum in-band energy threshold */
10435 21, /* 21/32 in-band to broad-band ratio */
10436 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10439 14780, /* A1 = -0.902130 */
10440 -32393, /* A2 = 0.988586 */
10441 -396, /* B2 = -0.012086 */
10442 0, /* B1 = 0.000000 */
10443 396, /* B0 = 0.012086 */
10444 14510, /* A1 = -0.885651 */
10445 -32630, /* A2 = 0.995819 */
10446 6326, /* B2 = 0.193069 */
10447 -2747, /* B1 = -0.167671 */
10448 6326, /* B0 = 0.193069 */
10449 15154, /* A1 = -0.924957 */
10450 -32632, /* A2 = 0.995850 */
10451 23235, /* B2 = 0.709076 */
10452 -10983, /* B1 = -0.670380 */
10453 23235, /* B0 = 0.709076 */
10454 5, /* Internal filter scaling */
10455 159, /* Minimum in-band energy threshold */
10456 21, /* 21/32 in-band to broad-band ratio */
10457 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10460 13005, /* A1 = -0.793793 */
10461 -32368, /* A2 = 0.987823 */
10462 -500, /* B2 = -0.015265 */
10463 0, /* B1 = 0.000000 */
10464 500, /* B0 = 0.015265 */
10465 12708, /* A1 = -0.775665 */
10466 -32615, /* A2 = 0.995331 */
10467 11420, /* B2 = 0.348526 */
10468 -4306, /* B1 = -0.262833 */
10469 11420, /* B0 = 0.348526 */
10470 13397, /* A1 = -0.817688 */
10471 -32615, /* A2 = 0.995361 */
10472 9454, /* B2 = 0.288528 */
10473 -3981, /* B1 = -0.243027 */
10474 9454, /* B0 = 0.288528 */
10475 5, /* Internal filter scaling */
10476 159, /* Minimum in-band energy threshold */
10477 21, /* 21/32 in-band to broad-band ratio */
10478 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10481 10046, /* A1 = -0.613190 */
10482 -32331, /* A2 = 0.986694 */
10483 -455, /* B2 = -0.013915 */
10484 0, /* B1 = 0.000000 */
10485 455, /* B0 = 0.013915 */
10486 9694, /* A1 = -0.591705 */
10487 -32601, /* A2 = 0.994934 */
10488 6023, /* B2 = 0.183815 */
10489 -1708, /* B1 = -0.104279 */
10490 6023, /* B0 = 0.183815 */
10491 10478, /* A1 = -0.639587 */
10492 -32603, /* A2 = 0.994965 */
10493 22031, /* B2 = 0.672333 */
10494 -7342, /* B1 = -0.448151 */
10495 22031, /* B0 = 0.672333 */
10496 5, /* Internal filter scaling */
10497 159, /* Minimum in-band energy threshold */
10498 21, /* 21/32 in-band to broad-band ratio */
10499 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10501 { /* f1633_1638[] */
10502 9181, /* A1 = 0.560394 */
10503 -32256, /* A2 = -0.984375 */
10504 -556, /* B2 = -0.016975 */
10506 556, /* B0 = 0.016975 */
10507 8757, /* A1 = 0.534515 */
10508 -32574, /* A2 = -0.99408 */
10509 8443, /* B2 = 0.25769 */
10510 -2135, /* B1 = -0.130341 */
10511 8443, /* B0 = 0.25769 */
10512 9691, /* A1 = 0.591522 */
10513 -32574, /* A2 = -0.99411 */
10514 15446, /* B2 = 0.471375 */
10515 -4809, /* B1 = -0.293579 */
10516 15446, /* B0 = 0.471375 */
10517 7, /* Internal filter scaling */
10518 159, /* Minimum in-band energy threshold */
10519 21, /* 21/32 in-band to broad-band ratio */
10520 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10523 5076, /* A1 = -0.309875 */
10524 -32304, /* A2 = 0.985840 */
10525 -508, /* B2 = -0.015503 */
10526 0, /* B1 = 0.000000 */
10527 508, /* B0 = 0.015503 */
10528 4646, /* A1 = -0.283600 */
10529 -32605, /* A2 = 0.995026 */
10530 6742, /* B2 = 0.205780 */
10531 -878, /* B1 = -0.053635 */
10532 6742, /* B0 = 0.205780 */
10533 5552, /* A1 = -0.338928 */
10534 -32605, /* A2 = 0.995056 */
10535 23667, /* B2 = 0.722260 */
10536 -4297, /* B1 = -0.262329 */
10537 23667, /* B0 = 0.722260 */
10538 5, /* Internal filter scaling */
10539 159, /* Minimum in-band energy threshold */
10540 21, /* 21/32 in-band to broad-band ratio */
10541 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10544 3569, /* A1 = -0.217865 */
10545 -32292, /* A2 = 0.985504 */
10546 -239, /* B2 = -0.007322 */
10547 0, /* B1 = 0.000000 */
10548 239, /* B0 = 0.007322 */
10549 3117, /* A1 = -0.190277 */
10550 -32603, /* A2 = 0.994965 */
10551 18658, /* B2 = 0.569427 */
10552 -1557, /* B1 = -0.095032 */
10553 18658, /* B0 = 0.569427 */
10554 4054, /* A1 = -0.247437 */
10555 -32603, /* A2 = 0.994965 */
10556 18886, /* B2 = 0.576385 */
10557 -2566, /* B1 = -0.156647 */
10558 18886, /* B0 = 0.576385 */
10559 5, /* Internal filter scaling */
10560 159, /* Minimum in-band energy threshold */
10561 21, /* 21/32 in-band to broad-band ratio */
10562 0x0FF5 /* shift-mask 0x0FF (look at 16 half-frames) bit count = 5 */
10565 static int ixj_init_filter(IXJ
*j
, IXJ_FILTER
* jf
)
10567 unsigned short cmd
;
10570 if (jf
->filter
> 3) {
10573 if (ixj_WriteDSPCommand(0x5154 + jf
->filter
, j
)) /* Select Filter */
10577 if (ixj_WriteDSPCommand(0x5152, j
)) /* Disable Filter */
10583 if (ixj_WriteDSPCommand(0x5153, j
)) /* Enable Filter */
10586 /* Select the filter (f0 - f3) to use. */
10587 if (ixj_WriteDSPCommand(0x5154 + jf
->filter
, j
))
10590 if (jf
->freq
< 12 && jf
->freq
> 3) {
10591 /* Select the frequency for the selected filter. */
10592 if (ixj_WriteDSPCommand(0x5170 + jf
->freq
, j
))
10594 } else if (jf
->freq
> 11) {
10595 /* We need to load a programmable filter set for undefined */
10596 /* frequencies. So we will point the filter to a programmable set. */
10597 /* Since there are only 4 filters and 4 programmable sets, we will */
10598 /* just point the filter to the same number set and program it for the */
10599 /* frequency we want. */
10600 if (ixj_WriteDSPCommand(0x5170 + jf
->filter
, j
))
10602 if (j
->ver
.low
!= 0x12) {
10609 if (ixj_WriteDSPCommand(cmd
, j
))
10611 for (cnt
= 0; cnt
< max
; cnt
++) {
10612 if (ixj_WriteDSPCommand(tone_table
[jf
->freq
- 12][cnt
], j
))
10616 j
->filter_en
[jf
->filter
] = jf
->enable
;
10620 static int ixj_init_filter_raw(IXJ
*j
, IXJ_FILTER_RAW
* jfr
)
10622 unsigned short cmd
;
10624 if (jfr
->filter
> 3) {
10627 if (ixj_WriteDSPCommand(0x5154 + jfr
->filter
, j
)) /* Select Filter */
10630 if (!jfr
->enable
) {
10631 if (ixj_WriteDSPCommand(0x5152, j
)) /* Disable Filter */
10636 if (ixj_WriteDSPCommand(0x5153, j
)) /* Enable Filter */
10638 /* Select the filter (f0 - f3) to use. */
10639 if (ixj_WriteDSPCommand(0x5154 + jfr
->filter
, j
))
10642 /* We need to load a programmable filter set for undefined */
10643 /* frequencies. So we will point the filter to a programmable set. */
10644 /* Since there are only 4 filters and 4 programmable sets, we will */
10645 /* just point the filter to the same number set and program it for the */
10646 /* frequency we want. */
10647 if (ixj_WriteDSPCommand(0x5170 + jfr
->filter
, j
))
10649 if (j
->ver
.low
!= 0x12) {
10656 if (ixj_WriteDSPCommand(cmd
, j
))
10658 for (cnt
= 0; cnt
< max
; cnt
++) {
10659 if (ixj_WriteDSPCommand(jfr
->coeff
[cnt
], j
))
10662 j
->filter_en
[jfr
->filter
] = jfr
->enable
;
10666 static int ixj_init_tone(IXJ
*j
, IXJ_TONE
* ti
)
10669 unsigned short data
;
10682 if(ti
->tone_index
> 12 && ti
->tone_index
< 28)
10684 if (ixj_WriteDSPCommand(0x6800 + ti
->tone_index
, j
))
10686 if (ixj_WriteDSPCommand(0x6000 + (ti
->gain1
<< 4) + ti
->gain0
, j
))
10689 if (ixj_WriteDSPCommand(data
, j
))
10692 if (ixj_WriteDSPCommand(data
, j
))