Import changeset
[linux-flexiantxendom0-3.2.10.git] / include / linux / ixjuser.h
1 /******************************************************************************
2  *
3  *    ixjuser.h
4  *
5  *    Device Driver for the Internet PhoneJACK and
6  *    Internet LineJACK Telephony Cards.
7  *
8  *    (c) Copyright 1999 Quicknet Technologies, Inc.
9  *
10  *    This program is free software; you can redistribute it and/or
11  *    modify it under the terms of the GNU General Public License
12  *    as published by the Free Software Foundation; either version
13  *    2 of the License, or (at your option) any later version.
14  *
15  * Author:          Ed Okerson, <eokerson@quicknet.net>
16  *    
17  * Contributors:    Greg Herlein, <gherlein@quicknet.net>
18  *                  David W. Erhart, <derhart@quicknet.net>
19  *                  John Sellers, <jsellers@quicknet.net>
20  *                  Mike Preston, <mpreston@quicknet.net>
21  *
22  * More information about the hardware related to this driver can be found
23  * at our website:    http://www.quicknet.net
24  *
25  * Fixes:
26  *
27  * IN NO EVENT SHALL QUICKNET TECHNOLOGIES, INC. BE LIABLE TO ANY PARTY FOR
28  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
29  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF QUICKNET
30  * TECHNOLOGIES, INC.HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * QUICKNET TECHNOLOGIES, INC. SPECIFICALLY DISCLAIMS ANY WARRANTIES,
33  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
34  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
35  * ON AN "AS IS" BASIS, AND QUICKNET TECHNOLOGIES, INC. HAS NO OBLIGATION 
36  * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
37  *
38  *****************************************************************************/
39
40 static char ixjuser_h_rcsid[] = "$Id: ixjuser.h,v 3.11 2000/03/30 22:06:48 eokerson Exp $";
41
42 #include "telephony.h"
43
44
45 /******************************************************************************
46 *
47 * IOCTL's used for the Quicknet Cards
48 *
49 * If you use the IXJCTL_TESTRAM command, the card must be power cycled to
50 * reset the SRAM values before futher use.
51 *
52 ******************************************************************************/
53
54 #define IXJCTL_DSP_RESET                _IO  ('q', 0xC0)
55
56 #define IXJCTL_RING                     PHONE_RING
57 #define IXJCTL_HOOKSTATE                PHONE_HOOKSTATE
58 #define IXJCTL_MAXRINGS                 PHONE_MAXRINGS
59 #define IXJCTL_RING_CADENCE             PHONE_RING_CADENCE
60 #define IXJCTL_RING_START               PHONE_RING_START
61 #define IXJCTL_RING_STOP                PHONE_RING_STOP
62
63 #define IXJCTL_CARDTYPE                 _IOR ('q', 0xC1, int)
64 #define IXJCTL_SERIAL                   _IOR ('q', 0xC2, int)
65 #define IXJCTL_DSP_TYPE                 _IOR ('q', 0xC3, int)
66 #define IXJCTL_DSP_VERSION              _IOR ('q', 0xC4, int)
67 #define IXJCTL_VERSION                  _IOR ('q', 0xDA, char *)
68 #define IXJCTL_DSP_IDLE                 _IO  ('q', 0xC5)
69 #define IXJCTL_TESTRAM                  _IO  ('q', 0xC6)
70
71 /******************************************************************************
72 *
73 * This group of IOCTLs deal with the record settings of the DSP
74 *
75 * The IXJCTL_REC_DEPTH command sets the internal buffer depth of the DSP.
76 * Setting a lower depth reduces latency, but increases the demand of the
77 * application to service the driver without frame loss.  The DSP has 480
78 * bytes of physical buffer memory for the record channel so the true
79 * maximum limit is determined by how many frames will fit in the buffer.
80 *
81 * 1 uncompressed (480 byte) 16-bit linear frame.
82 * 2 uncompressed (240 byte) 8-bit A-law/mu-law frames.
83 * 15 TrueSpeech 8.5 frames.
84 * 20 TrueSpeech 6.3,5.3,4.8 or 4.1 frames.
85 *
86 * The default in the driver is currently set to 2 frames.
87 *
88 * The IXJCTL_REC_VOLUME and IXJCTL_PLAY_VOLUME commands both use a Q8
89 * number as a parameter, 0x100 scales the signal by 1.0, 0x200 scales the
90 * signal by 2.0, 0x80 scales the signal by 0.5.  No protection is given
91 * against over-scaling, if the multiplication factor times the input
92 * signal exceeds 16 bits, overflow distortion will occur.  The default
93 * setting is 0x100 (1.0).
94 *
95 * The IXJCTL_REC_LEVEL returns the average signal level (not r.m.s.) on
96 * the most recently recorded frame as a 16 bit value.
97 ******************************************************************************/
98
99 #define IXJCTL_REC_CODEC                PHONE_REC_CODEC
100 #define IXJCTL_REC_START                PHONE_REC_START
101 #define IXJCTL_REC_STOP                 PHONE_REC_STOP
102 #define IXJCTL_REC_DEPTH                PHONE_REC_DEPTH
103 #define IXJCTL_FRAME                    PHONE_FRAME
104 #define IXJCTL_REC_VOLUME               PHONE_REC_VOLUME
105 #define IXJCTL_REC_LEVEL                PHONE_REC_LEVEL
106
107 typedef enum {
108         f300_640 = 4, f300_500, f1100, f350, f400, f480, f440, f620, f20_50,
109         f133_200, f300, f300_420, f330, f300_425, f330_440, f340, f350_400,
110         f350_440, f350_450, f360, f380_420, f392, f400_425, f400_440, f400_450,
111         f420, f425, f425_450, f425_475, f435, f440_450, f440_480, f445, f450,
112         f452, f475, f480_620, f494, f500, f520, f523, f525, f540_660, f587,
113         f590, f600, f660, f700, f740, f750, f750_1450, f770, f800, f816, f850,
114         f857_1645, f900, f900_1300, f935_1215, f941_1477, f942, f950, f950_1400,
115         f975, f1000, f1020, f1050, f1100_1750, f1140, f1200, f1209, f1330, f1336,
116         lf1366, f1380, f1400, f1477, f1600, f1633_1638, f1800, f1860
117 } IXJ_FILTER_FREQ;
118
119 typedef struct {
120         unsigned int filter;
121         IXJ_FILTER_FREQ freq;
122         char enable;
123 } IXJ_FILTER;
124
125 typedef struct {
126         char enable;
127         char en_filter;
128         unsigned int filter;
129         unsigned int on1;
130         unsigned int off1;
131         unsigned int on2;
132         unsigned int off2;
133         unsigned int on3;
134         unsigned int off3;
135 } IXJ_FILTER_CADENCE;
136
137 #define IXJCTL_SET_FILTER               _IOW ('q', 0xC7, IXJ_FILTER *)
138 #define IXJCTL_GET_FILTER_HIST          _IOW ('q', 0xC8, int)
139 #define IXJCTL_FILTER_CADENCE           _IOW ('q', 0xD6, IXJ_FILTER_CADENCE *)
140 #define IXJCTL_PLAY_CID                 _IO  ('q', 0xD7)
141 /******************************************************************************
142 *
143 * This IOCTL allows you to reassign values in the tone index table.  The
144 * tone table has 32 entries (0 - 31), but the driver only allows entries
145 * 13 - 27 to be modified, entry 0 is reserved for silence and 1 - 12 are
146 * the standard DTMF digits and 28 - 31 are the DTMF tones for A, B, C & D.
147 * The positions used internally for Call Progress Tones are as follows:
148 *    Dial Tone   - 25
149 *    Ring Back   - 26
150 *    Busy Signal - 27
151 *
152 * The freq values are calculated as:
153 * freq = cos(2 * PI * frequency / 8000)
154 *
155 * The most commonly needed values are already calculated and listed in the
156 * enum IXJ_TONE_FREQ.  Each tone index can have two frequencies with
157 * different gains, if you are only using a single frequency set the unused
158 * one to 0.
159 *
160 * The gain values range from 0 to 15 indicating +6dB to -24dB in 2dB
161 * increments.
162 *
163 ******************************************************************************/
164
165 typedef enum {
166         hz20 = 0x7ffa,
167         hz50 = 0x7fe5,
168         hz133 = 0x7f4c,
169         hz200 = 0x7e6b,
170         hz261 = 0x7d50,         /* .63 C1  */
171         hz277 = 0x7cfa,         /* .18 CS1 */
172         hz293 = 0x7c9f,         /* .66 D1  */
173         hz300 = 0x7c75,
174         hz311 = 0x7c32,         /* .13 DS1 */
175         hz329 = 0x7bbf,         /* .63 E1  */
176         hz330 = 0x7bb8,
177         hz340 = 0x7b75,
178         hz349 = 0x7b37,         /* .23 F1  */
179         hz350 = 0x7b30,
180         hz360 = 0x7ae9,
181         hz369 = 0x7aa8,         /* .99 FS1 */
182         hz380 = 0x7a56,
183         hz392 = 0x79fa,         /* .00 G1  */
184         hz400 = 0x79bb,
185         hz415 = 0x7941,         /* .30 GS1 */
186         hz420 = 0x7918,
187         hz425 = 0x78ee,
188         hz435 = 0x7899,
189         hz440 = 0x786d,         /* .00 A1  */
190         hz445 = 0x7842,
191         hz450 = 0x7815,
192         hz452 = 0x7803,
193         hz466 = 0x7784,         /* .16 AS1 */
194         hz475 = 0x7731,
195         hz480 = 0x7701,
196         hz493 = 0x7685,         /* .88 B1  */
197         hz494 = 0x767b,
198         hz500 = 0x7640,
199         hz520 = 0x7578,
200         hz523 = 0x7559,         /* .25 C2  */
201         hz525 = 0x7544,
202         hz540 = 0x74a7,
203         hz554 = 0x7411,         /* .37 CS2 */
204         hz587 = 0x72a1,         /* .33 D2  */
205         hz590 = 0x727f,
206         hz600 = 0x720b,
207         hz620 = 0x711e,
208         hz622 = 0x7106,         /* .25 DS2 */
209         hz659 = 0x6f3b,         /* .26 E2  */
210         hz660 = 0x6f2e,
211         hz698 = 0x6d3d,         /* .46 F2  */
212         hz700 = 0x6d22,
213         hz739 = 0x6b09,         /* .99 FS2 */
214         hz740 = 0x6afa,
215         hz750 = 0x6a6c,
216         hz770 = 0x694b,
217         hz783 = 0x688b,         /* .99 G2  */
218         hz800 = 0x678d,
219         hz816 = 0x6698,
220         hz830 = 0x65bf,         /* .61 GS2 */
221         hz850 = 0x6484,
222         hz857 = 0x6414,
223         hz880 = 0x629f,         /* .00 A2  */
224         hz900 = 0x6154,
225         hz932 = 0x5f35,         /* .33 AS2 */
226         hz935 = 0x5f01,
227         hz941 = 0x5e9a,
228         hz942 = 0x5e88,
229         hz950 = 0x5dfd,
230         hz975 = 0x5c44,
231         hz1000 = 0x5a81,
232         hz1020 = 0x5912,
233         hz1050 = 0x56e2,
234         hz1100 = 0x5320,
235         hz1140 = 0x5007,
236         hz1200 = 0x4b3b,
237         hz1209 = 0x4a80,
238         hz1215 = 0x4a02,
239         hz1250 = 0x471c,
240         hz1300 = 0x42e0,
241         hz1330 = 0x4049,
242         hz1336 = 0x3fc4,
243         hz1366 = 0x3d22,
244         hz1380 = 0x3be4,
245         hz1400 = 0x3a1b,
246         hz1450 = 0x3596,
247         hz1477 = 0x331c,
248         hz1500 = 0x30fb,
249         hz1600 = 0x278d,
250         hz1633 = 0x2462,
251         hz1638 = 0x23e7,
252         hz1645 = 0x233a,
253         hz1750 = 0x18f8,
254         hz1800 = 0x1405,
255         hz1860 = 0xe0b,
256         hz2100 = 0xf5f6,
257         hz2130 = 0xf2f5,
258         hz2450 = 0xd3b3,
259         hz2750 = 0xb8e4
260 } IXJ_FREQ;
261
262 typedef enum {
263         C1 = hz261,
264         CS1 = hz277,
265         D1 = hz293,
266         DS1 = hz311,
267         E1 = hz329,
268         F1 = hz349,
269         FS1 = hz369,
270         G1 = hz392,
271         GS1 = hz415,
272         A1 = hz440,
273         AS1 = hz466,
274         B1 = hz493,
275         C2 = hz523,
276         CS2 = hz554,
277         D2 = hz587,
278         DS2 = hz622,
279         E2 = hz659,
280         F2 = hz698,
281         FS2 = hz739,
282         G2 = hz783,
283         GS2 = hz830,
284         A2 = hz880,
285         AS2 = hz932,
286 } IXJ_NOTE;
287
288 typedef struct {
289         int tone_index;
290         int freq0;
291         int gain0;
292         int freq1;
293         int gain1;
294 } IXJ_TONE;
295
296 #define IXJCTL_INIT_TONE                _IOW ('q', 0xC9, IXJ_TONE *)
297
298 /******************************************************************************
299 *
300 * The IXJCTL_TONE_CADENCE ioctl defines tone sequences used for various
301 * Call Progress Tones (CPT).  This is accomplished by setting up an array of
302 * IXJ_CADENCE_ELEMENT structures that sequentially define the states of
303 * the tone sequence.  The tone_on_time and tone_off time are in
304 * 250 microsecond intervals.  A pointer to this array is passed to the
305 * driver as the ce element of an IXJ_CADENCE structure.  The elements_used
306 * must be set to the number of IXJ_CADENCE_ELEMENTS in the array.  The
307 * termination variable defines what to do at the end of a cadence, the
308 * options are to play the cadence once and stop, to repeat the last
309 * element of the cadence indefinatly, or to repeat the entire cadence
310 * indefinatly.  The ce variable is a pointer to the array of IXJ_TONE
311 * structures.  If the freq0 variable is non-zero, the tone table contents
312 * for the tone_index are updated to the frequencies and gains defined.  It
313 * should be noted that DTMF tones cannot be reassigned, so if DTMF tone
314 * table indexs are used in a cadence the frequency and gain variables will
315 * be ignored.
316 *
317 * If the array elements contain frequency parameters the driver will
318 * initialize the needed tone table elements and begin playing the tone,
319 * there is no preset limit on the number of elements in the cadence.  If
320 * there is more than one frequency used in the cadence, sequential elements
321 * of different frequencies MUST use different tone table indexes.  Only one
322 * cadence can be played at a time.  It is possible to build complex
323 * cadences with multiple frequencies using 2 tone table indexes by
324 * alternating between them.
325 *
326 ******************************************************************************/
327
328 typedef struct {
329         int index;
330         int tone_on_time;
331         int tone_off_time;
332         int freq0;
333         int gain0;
334         int freq1;
335         int gain1;
336 } IXJ_CADENCE_ELEMENT;
337
338 typedef enum {
339         PLAY_ONCE,
340         REPEAT_LAST_ELEMENT,
341         REPEAT_ALL
342 } IXJ_CADENCE_TERM;
343
344 typedef struct {
345         int elements_used;
346         IXJ_CADENCE_TERM termination;
347         IXJ_CADENCE_ELEMENT *ce;
348 } IXJ_CADENCE;
349
350 #define IXJCTL_TONE_CADENCE             _IOW ('q', 0xCA, IXJ_CADENCE *)
351 /******************************************************************************
352 *
353 * This group of IOCTLs deal with the playback settings of the DSP
354 *
355 ******************************************************************************/
356
357 #define IXJCTL_PLAY_CODEC               PHONE_PLAY_CODEC
358 #define IXJCTL_PLAY_START               PHONE_PLAY_START
359 #define IXJCTL_PLAY_STOP                PHONE_PLAY_STOP
360 #define IXJCTL_PLAY_DEPTH               PHONE_PLAY_DEPTH
361 #define IXJCTL_PLAY_VOLUME              PHONE_PLAY_VOLUME
362 #define IXJCTL_PLAY_LEVEL               PHONE_PLAY_LEVEL
363
364 /******************************************************************************
365 *
366 * This group of IOCTLs deal with the Acoustic Echo Cancellation settings
367 * of the DSP
368 *
369 * Issueing the IXJCTL_AEC_START command with a value of AEC_OFF has the
370 * same effect as IXJCTL_AEC_STOP.  This is to simplify slider bar
371 * controls.  IXJCTL_AEC_GET_LEVEL returns the current setting of the AEC.
372 ******************************************************************************/
373 #define IXJCTL_AEC_START                _IOW ('q', 0xCB, int)
374 #define IXJCTL_AEC_STOP                 _IO  ('q', 0xCC)
375 #define IXJCTL_AEC_GET_LEVEL            _IO  ('q', 0xCD)
376
377 #define AEC_OFF   0
378 #define AEC_LOW   1
379 #define AEC_MED   2
380 #define AEC_HIGH  3
381 #define AEC_AUTO  4
382 /******************************************************************************
383 *
384 * Call Progress Tones, DTMF, etc.
385 * IXJCTL_DTMF_OOB determines if dtmf signaling is sent as Out-Of-Band
386 * only.  If you pass a 1, dtmf is suppressed from the audio stream.
387 * Tone on and off times are in 250 microsecond intervals so
388 * ioctl(ixj1, IXJCTL_SET_TONE_ON_TIME, 360);
389 * will set the tone on time of board ixj1 to 360 * 250us = 90ms
390 * the default values of tone on and off times is 840 or 210ms
391 ******************************************************************************/
392
393 #define IXJCTL_DTMF_READY               PHONE_DTMF_READY
394 #define IXJCTL_GET_DTMF                 PHONE_GET_DTMF
395 #define IXJCTL_GET_DTMF_ASCII           PHONE_GET_DTMF_ASCII
396 #define IXJCTL_DTMF_OOB                 PHONE_DTMF_OOB
397 #define IXJCTL_EXCEPTION                PHONE_EXCEPTION
398 #define IXJCTL_PLAY_TONE                PHONE_PLAY_TONE
399 #define IXJCTL_SET_TONE_ON_TIME         PHONE_SET_TONE_ON_TIME
400 #define IXJCTL_SET_TONE_OFF_TIME        PHONE_SET_TONE_OFF_TIME
401 #define IXJCTL_GET_TONE_ON_TIME         PHONE_GET_TONE_ON_TIME
402 #define IXJCTL_GET_TONE_OFF_TIME        PHONE_GET_TONE_OFF_TIME
403 #define IXJCTL_GET_TONE_STATE           PHONE_GET_TONE_STATE
404 #define IXJCTL_BUSY                     PHONE_BUSY
405 #define IXJCTL_RINGBACK                 PHONE_RINGBACK
406 #define IXJCTL_DIALTONE                 PHONE_DIALTONE
407 #define IXJCTL_CPT_STOP                 PHONE_CPT_STOP
408
409 /******************************************************************************
410 * LineJack specific IOCTLs
411 *
412 * The lsb 4 bits of the LED argument represent the state of each of the 4
413 * LED's on the LineJack
414 ******************************************************************************/
415
416 #define IXJCTL_SET_LED                  _IOW ('q', 0xCE, int)
417 #define IXJCTL_MIXER                    _IOW ('q', 0xCF, int)
418
419 /******************************************************************************
420
421 * The master volume controls use attenuation with 32 levels from 0 to -62dB
422 * with steps of 2dB each, the defines should be OR'ed together then sent
423 * as the parameter to the mixer command to change the mixer settings.
424
425 ******************************************************************************/
426 #define MIXER_MASTER_L          0x0100
427 #define MIXER_MASTER_R          0x0200
428 #define ATT00DB                 0x00
429 #define ATT02DB                 0x01
430 #define ATT04DB                 0x02
431 #define ATT06DB                 0x03
432 #define ATT08DB                 0x04
433 #define ATT10DB                 0x05
434 #define ATT12DB                 0x06
435 #define ATT14DB                 0x07
436 #define ATT16DB                 0x08
437 #define ATT18DB                 0x09
438 #define ATT20DB                 0x0A
439 #define ATT22DB                 0x0B
440 #define ATT24DB                 0x0C
441 #define ATT26DB                 0x0D
442 #define ATT28DB                 0x0E
443 #define ATT30DB                 0x0F
444 #define ATT32DB                 0x10
445 #define ATT34DB                 0x11
446 #define ATT36DB                 0x12
447 #define ATT38DB                 0x13
448 #define ATT40DB                 0x14
449 #define ATT42DB                 0x15
450 #define ATT44DB                 0x16
451 #define ATT46DB                 0x17
452 #define ATT48DB                 0x18
453 #define ATT50DB                 0x19
454 #define ATT52DB                 0x1A
455 #define ATT54DB                 0x1B
456 #define ATT56DB                 0x1C
457 #define ATT58DB                 0x1D
458 #define ATT60DB                 0x1E
459 #define ATT62DB                 0x1F
460 #define MASTER_MUTE             0x80
461
462 /******************************************************************************
463
464 * The input volume controls use gain with 32 levels from +12dB to -50dB
465 * with steps of 2dB each, the defines should be OR'ed together then sent
466 * as the parameter to the mixer command to change the mixer settings.
467
468 ******************************************************************************/
469 #define MIXER_PORT_CD_L         0x0600
470 #define MIXER_PORT_CD_R         0x0700
471 #define MIXER_PORT_LINE_IN_L    0x0800
472 #define MIXER_PORT_LINE_IN_R    0x0900
473 #define MIXER_PORT_POTS_REC     0x0C00
474 #define MIXER_PORT_MIC          0x0E00
475
476 #define GAIN12DB                0x00
477 #define GAIN10DB                0x01
478 #define GAIN08DB                0x02
479 #define GAIN06DB                0x03
480 #define GAIN04DB                0x04
481 #define GAIN02DB                0x05
482 #define GAIN00DB                0x06
483 #define GAIN_02DB               0x07
484 #define GAIN_04DB               0x08
485 #define GAIN_06DB               0x09
486 #define GAIN_08DB               0x0A
487 #define GAIN_10DB               0x0B
488 #define GAIN_12DB               0x0C
489 #define GAIN_14DB               0x0D
490 #define GAIN_16DB               0x0E
491 #define GAIN_18DB               0x0F
492 #define GAIN_20DB               0x10
493 #define GAIN_22DB               0x11
494 #define GAIN_24DB               0x12
495 #define GAIN_26DB               0x13
496 #define GAIN_28DB               0x14
497 #define GAIN_30DB               0x15
498 #define GAIN_32DB               0x16
499 #define GAIN_34DB               0x17
500 #define GAIN_36DB               0x18
501 #define GAIN_38DB               0x19
502 #define GAIN_40DB               0x1A
503 #define GAIN_42DB               0x1B
504 #define GAIN_44DB               0x1C
505 #define GAIN_46DB               0x1D
506 #define GAIN_48DB               0x1E
507 #define GAIN_50DB               0x1F
508 #define INPUT_MUTE              0x80
509
510 /******************************************************************************
511
512 * The POTS volume control use attenuation with 8 levels from 0dB to -28dB
513 * with steps of 4dB each, the defines should be OR'ed together then sent
514 * as the parameter to the mixer command to change the mixer settings.
515
516 ******************************************************************************/
517 #define MIXER_PORT_POTS_PLAY    0x0F00
518
519 #define POTS_ATT_00DB           0x00
520 #define POTS_ATT_04DB           0x01
521 #define POTS_ATT_08DB           0x02
522 #define POTS_ATT_12DB           0x03
523 #define POTS_ATT_16DB           0x04
524 #define POTS_ATT_20DB           0x05
525 #define POTS_ATT_24DB           0x06
526 #define POTS_ATT_28DB           0x07
527 #define POTS_MUTE               0x80
528
529 /******************************************************************************
530
531 * The DAA controls the interface to the PSTN port.  The driver loads the
532 * US coefficients by default, so if you live in a different country you
533 * need to load the set for your countries phone system.
534
535 ******************************************************************************/
536 #define IXJCTL_DAA_COEFF_SET            _IOW ('q', 0xD0, int)
537
538 #define DAA_US          1       //PITA 8kHz
539 #define DAA_UK          2       //ISAR34 8kHz
540 #define DAA_FRANCE      3       //
541 #define DAA_GERMANY     4
542 #define DAA_AUSTRALIA   5
543 #define DAA_JAPAN       6
544
545 /******************************************************************************
546
547 * Use IXJCTL_PORT to set or query the port the card is set to.  If the
548 * argument is set to PORT_QUERY, the return value of the ioctl will
549 * indicate which port is currently in use, otherwise it will change the
550 * port.
551
552 ******************************************************************************/
553 #define IXJCTL_PORT                     _IOW ('q', 0xD1, int)
554
555 #define PORT_QUERY      0
556 #define PORT_POTS       1
557 #define PORT_PSTN       2
558 #define PORT_SPEAKER    3
559 #define PORT_HANDSET    4
560
561 #define IXJCTL_PSTN_SET_STATE           PHONE_PSTN_SET_STATE
562 #define IXJCTL_PSTN_GET_STATE           PHONE_PSTN_GET_STATE
563
564 #define PSTN_ON_HOOK    0
565 #define PSTN_RINGING    1
566 #define PSTN_OFF_HOOK   2
567 #define PSTN_PULSE_DIAL 3
568
569 /******************************************************************************
570
571 * The DAA Analog GAIN sets 2 parameters at one time, the receive gain (AGRR), 
572 * and the transmit gain (AGX).  OR together the components and pass them
573 * as the parameter to IXJCTL_DAA_AGAIN.  The default setting is both at 0dB.
574
575 ******************************************************************************/
576 #define IXJCTL_DAA_AGAIN                _IOW ('q', 0xD2, int)
577
578 #define AGRR00DB        0x00    // Analog gain in receive direction 0dB
579 #define AGRR3_5DB       0x10    // Analog gain in receive direction 3.5dB
580 #define AGRR06DB        0x30    // Analog gain in receive direction 6dB
581
582 #define AGX00DB         0x00    // Analog gain in transmit direction 0dB
583 #define AGX_6DB         0x04    // Analog gain in transmit direction -6dB
584 #define AGX3_5DB        0x08    // Analog gain in transmit direction 3.5dB
585 #define AGX_2_5B        0x0C    // Analog gain in transmit direction -2.5dB
586
587 #define IXJCTL_PSTN_LINETEST            _IO  ('q', 0xD3)
588
589 #define IXJCTL_CID                      _IOR ('q', 0xD4, PHONE_CID *)
590 #define IXJCTL_VMWI                     _IOR ('q', 0xD8, int)
591 #define IXJCTL_CIDCW                    _IOW ('q', 0xD9, PHONE_CID *)
592 /******************************************************************************
593
594 * The wink duration is tunable with this ioctl.  The default wink duration  
595 * is 320ms.  You do not need to use this ioctl if you do not require a
596 * different wink duration.
597
598 ******************************************************************************/
599 #define IXJCTL_WINK_DURATION            PHONE_WINK_DURATION
600
601 /******************************************************************************
602
603 * This ioctl will connect the POTS port to the PSTN port on the LineJACK
604 * In order for this to work properly the port selection should be set to
605 * the PSTN port with IXJCTL_PORT prior to calling this ioctl.  This will
606 * enable conference calls between PSTN callers and network callers.
607 * Passing a 1 to this ioctl enables the POTS<->PSTN connection while
608 * passing a 0 turns it back off.
609
610 ******************************************************************************/
611 #define IXJCTL_POTS_PSTN                _IOW ('q', 0xD5, int)
612
613 /******************************************************************************
614 *
615 * IOCTLs added by request.
616 *
617 * IXJCTL_HZ sets the value your Linux kernel uses for HZ as defined in
618 *           /usr/include/asm/param.h, this determines the fundamental
619 *           frequency of the clock ticks on your Linux system.  The kernel
620 *           must be rebuilt if you change this value, also all modules you
621 *           use (except this one) must be recompiled.  The default value
622 *           is 100, and you only need to use this IOCTL if you use some
623 *           other value.
624 *
625 *
626 * IXJCTL_RATE sets the number of times per second that the driver polls
627 *             the DSP.  This value cannot be larger than HZ.  By
628 *             increasing both of these values, you may be able to reduce
629 *             latency because the max hang time that can exist between the
630 *             driver and the DSP will be reduced.
631 *
632 ******************************************************************************/
633
634 #define IXJCTL_HZ                       _IOW ('q', 0xE0, int)
635 #define IXJCTL_RATE                     _IOW ('q', 0xE1, int)
636 #define IXJCTL_FRAMES_READ              _IOR ('q', 0xE2, unsigned long)
637 #define IXJCTL_FRAMES_WRITTEN           _IOR ('q', 0xE3, unsigned long)
638 #define IXJCTL_READ_WAIT                _IOR ('q', 0xE4, unsigned long)
639 #define IXJCTL_WRITE_WAIT               _IOR ('q', 0xE5, unsigned long)
640 #define IXJCTL_DRYBUFFER_READ           _IOR ('q', 0xE6, unsigned long)
641 #define IXJCTL_DRYBUFFER_CLEAR          _IO  ('q', 0xE7)
642
643 /******************************************************************************
644 *
645 * The intercom IOCTL's short the output from one card to the input of the
646 * other and vice versa (actually done in the DSP read function).  It is only
647 * necessary to execute the IOCTL on one card, but it is necessary to have
648 * both devices open to be able to detect hook switch changes.  The record
649 * codec and rate of each card must match the playback codec and rate of
650 * the other card for this to work properly.
651 *
652 ******************************************************************************/
653
654 #define IXJCTL_INTERCOM_START           _IOW ('q', 0xFD, int)
655 #define IXJCTL_INTERCOM_STOP            _IOW ('q', 0xFE, int)