ixjuser.h 25 KB

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