ixjuser.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831
  1. /******************************************************************************
  2. $Id$
  3. $Log$
  4. Revision 1.16 2003/02/12 13:59:14 matteo
  5. mer feb 12 14:56:57 CET 2003
  6. Revision 1.1.1.1 2003/02/12 13:59:14 matteo
  7. mer feb 12 14:56:57 CET 2003
  8. Revision 1.1 1999/12/01 05:25:58 markster
  9. Start on the Internet Phone Jack channel
  10. Revision 3.0 1999/11/18 22:21:43 root
  11. Added isapnp kernel module support.
  12. Revision 2.5 1999/11/09 15:42:06 root
  13. Fixed convert code for older PhoneJACK cards.
  14. Fixed G723.1 5.3 record bug.
  15. Revision 2.4 1999/11/02 20:17:20 root
  16. Fixed hookswitch bug for PhoneJACK
  17. Added filter exception bit code.
  18. Revision 2.3 1999/11/01 23:22:02 root
  19. Added tone cadence generation.
  20. Fixed hookswitch detection when PORT != POTS
  21. Fixed ringing when PORT != POTS
  22. Revision 2.2 1999/10/13 05:33:31 root
  23. Added G.729A/B codec.
  24. Fixed G.728 codec.
  25. Revision 2.1 1999/10/11 19:29:46 root
  26. Enhanced PSTN ring detection
  27. Added Caller ID recognition
  28. Added wink detection
  29. Revision 2.0 1999/09/18 03:29:15 root
  30. Added PSTN Support
  31. Enhanced mixer functions
  32. Fixed LineJACK and PhoneJACK Lite not reporting second IO range in p/proc/ioports
  33. Added DSP Volume controls
  34. Revision 1.23 1999/08/16 16:37:27 root
  35. Added drybuffer ioctls
  36. Added card type ioctl
  37. Revision 1.22 1999/08/14 05:15:58 root
  38. Fixed select timeout problems. Was using the wrong wait queues.
  39. Revision 1.21 1999/08/04 22:53:43 root
  40. Added levels to AEC
  41. Revision 1.20 1999/07/28 20:32:23 root
  42. Added non-blocking rings
  43. Added ring cadence
  44. Revision 1.19 1999/07/14 21:08:10 root
  45. fixed rcsid
  46. Revision 1.18 1999/07/14 21:03:33 root
  47. added rcsid
  48. Revision 1.17 1999/07/12 20:20:00 root
  49. Continuing work on 20ms and 10ms linear modes.
  50. Revision 1.16 1999/07/09 19:13:50 root
  51. Added IXJCTL_RATE to set the rate the DSP is polled.
  52. Added 20ms and 10ms linear modes for LineJack and PhoneJack Lite.
  53. Revision 1.15 1999/07/08 02:21:20 root
  54. Async Notification on hookswitch changes.
  55. Added IXJ_EXCEPTION bitfield structure for select exception sets
  56. Added IXJCTL_DTMFASCII ioctl
  57. Revision 1.14 1999/07/06 23:20:52 root
  58. *** empty log message ***
  59. Revision 1.14 1999/07/06 21:48:38 root
  60. Fixed lockups in linear modes during write.
  61. Revision 1.13 1999/06/28 18:30:44 root
  62. Added buffer depth commands to reduce latency in compressed modes.
  63. Revision 1.12 1999/06/25 21:03:18 root
  64. Close device properly.
  65. Started Mixer code for LineJack
  66. Revision 1.11 1999/06/24 21:51:21 root
  67. bug fixes
  68. Revision 1.10 1999/06/17 18:23:16 root
  69. Added tone generation.
  70. Fixed LineJack hookswitch again.
  71. Revision 1.9 1999/06/09 14:18:15 root
  72. Fixed duplicate IOCTL numbers
  73. Revision 1.8 1999/06/09 14:13:29 root
  74. Added DTMF Recognition with Async Notification
  75. Revision 1.7 1999/06/03 16:50:43 root
  76. Added IXJCTL_HZ to allow changing the HZ value the driver uses.
  77. Revision 1.6 1999/05/31 17:56:07 root
  78. All linear modes now work properly.
  79. Revision 1.5 1999/05/25 14:05:44 root
  80. Added multiple codec selections.
  81. Revision 1.4 1999/04/28 03:43:52 root
  82. More work on echo cancellation
  83. Revision 1.3 1999/04/27 17:17:12 root
  84. added AEC
  85. Revision 1.2 1999/04/22 11:43:52 root
  86. Fixed stability problems
  87. Revision 1.1 1999/03/25 21:52:42 root
  88. Initial revision
  89. *
  90. * IOCTL's used for the Quicknet Cards
  91. *
  92. * If you use the IXJCTL_TESTRAM command, the card must be power cycled to
  93. * reset the SRAM values before futher use.
  94. *
  95. ******************************************************************************/
  96. static char ixjuser_h_rcsid[] = "$Id$";
  97. #define IXJCTL_DSP_RESET _IO ('q', 0x80)
  98. #define IXJCTL_RING _IO ('q', 0x82)
  99. #define IXJCTL_HOOKSTATE _IO ('q', 0x83)
  100. #define IXJCTL_MAXRINGS _IOW ('q', 0x84, char)
  101. #define IXJCTL_RING_CADENCE _IOW ('q', 0x85, short)
  102. #define IXJCTL_RING_START _IO ('q', 0x86)
  103. #define IXJCTL_RING_STOP _IO ('q', 0x87)
  104. #define IXJCTL_CARDTYPE _IOR ('q', 0x88, int)
  105. #define IXJCTL_DSP_TYPE _IOR ('q', 0x8C, int)
  106. #define IXJCTL_DSP_VERSION _IOR ('q', 0x8D, int)
  107. #define IXJCTL_DSP_IDLE _IO ('q', 0x8E)
  108. #define IXJCTL_TESTRAM _IO ('q', 0x8F)
  109. /******************************************************************************
  110. *
  111. * This group of IOCTLs deal with the record settings of the DSP
  112. *
  113. * The IXJCTL_REC_DEPTH command sets the internal buffer depth of the DSP.
  114. * Setting a lower depth reduces latency, but increases the demand of the
  115. * application to service the driver without frame loss. The DSP has 480
  116. * bytes of physical buffer memory for the record channel so the true
  117. * maximum limit is determined by how many frames will fit in the buffer.
  118. *
  119. * 1 uncompressed (480 byte) 16-bit linear frame.
  120. * 2 uncompressed (240 byte) 8-bit A-law/mu-law frames.
  121. * 15 TrueSpeech 8.5 frames.
  122. * 20 TrueSpeech 6.3,5.3,4.8 or 4.1 frames.
  123. *
  124. * The default in the driver is currently set to 2 frames.
  125. *
  126. * The IXJCTL_REC_VOLUME and IXJCTL_PLAY_VOLUME commands both use a Q8
  127. * number as a parameter, 0x100 scales the signal by 1.0, 0x200 scales the
  128. * signal by 2.0, 0x80 scales the signal by 0.5. No protection is given
  129. * against over-scaling, if the multiplication factor times the input
  130. * signal exceeds 16 bits, overflow distortion will occur. The default
  131. * setting is 0x100 (1.0).
  132. *
  133. * The IXJCTL_REC_LEVEL returns the average signal level (not r.m.s.) on
  134. * the most recently recorded frame as a 16 bit value.
  135. ******************************************************************************/
  136. #define IXJCTL_REC_CODEC _IOW ('q', 0x90, int)
  137. #define IXJCTL_REC_START _IO ('q', 0x92)
  138. #define IXJCTL_REC_STOP _IO ('q', 0x93)
  139. #define IXJCTL_REC_DEPTH _IOW ('q', 0x94, int)
  140. #define IXJCTL_FRAME _IOW ('q', 0x95, int)
  141. #define IXJCTL_REC_VOLUME _IOW ('q', 0x96, int)
  142. #define IXJCTL_REC_LEVEL _IO ('q', 0x97)
  143. typedef enum{
  144. f300_640 = 4, f300_500, f1100, f350, f400, f480, f440, f620, f20_50,
  145. f133_200, f300, f300_420, f330, f300_425, f330_440, f340, f350_400,
  146. f350_440, f350_450, f360, f380_420, f392, f400_425, f400_440, f400_450,
  147. f420, f425, f425_450, f425_475, f435, f440_450, f440_480, f445, f450,
  148. f452, f475, f480_620, f494, f500, f520, f523, f525, f540_660, f587,
  149. f590, f600, f660, f700, f740, f750, f750_1450, f770, f800, f816, f850,
  150. f857_1645, f900, f900_1300, f935_1215, f941_1477, f942, f950, f950_1400,
  151. f975, f1000, f1020, f1050, f1100_1750, f1140, f1200, f1209, f1330, f1336,
  152. lf1366, f1380, f1400, f1477, f1600, f1633_1638, f1800, f1860
  153. }IXJ_FILTER_FREQ;
  154. typedef struct
  155. {
  156. unsigned int filter;
  157. IXJ_FILTER_FREQ freq;
  158. char enable;
  159. }IXJ_FILTER;
  160. #define IXJCTL_SET_FILTER _IOW ('q', 0x98, IXJ_FILTER *)
  161. #define IXJCTL_GET_FILTER_HIST _IOW ('q', 0x9B, int)
  162. /******************************************************************************
  163. *
  164. * This IOCTL allows you to reassign values in the tone index table. The
  165. * tone table has 32 entries (0 - 31), but the driver only allows entries
  166. * 13 - 27 to be modified, entry 0 is reserved for silence and 1 - 12 are
  167. * the standard DTMF digits and 28 - 31 are the DTMF tones for A, B, C & D.
  168. * The positions used internally for Call Progress Tones are as follows:
  169. * Dial Tone - 25
  170. * Ring Back - 26
  171. * Busy Signal - 27
  172. *
  173. * The freq values are calculated as:
  174. * freq = cos(2 * PI * frequency / 8000)
  175. *
  176. * The most commonly needed values are already calculated and listed in the
  177. * enum IXJ_TONE_FREQ. Each tone index can have two frequencies with
  178. * different gains, if you are only using a single frequency set the unused
  179. * one to 0.
  180. *
  181. * The gain values range from 0 to 15 indicating +6dB to -24dB in 2dB
  182. * increments.
  183. *
  184. ******************************************************************************/
  185. typedef enum
  186. {
  187. hz20 = 0x7ffa,
  188. hz50 = 0x7fe5,
  189. hz133 = 0x7f4c,
  190. hz200 = 0x7e6b,
  191. hz261 = 0x7d50, /* .63 C1 */
  192. hz277 = 0x7cfa, /* .18 CS1 */
  193. hz293 = 0x7c9f, /* .66 D1 */
  194. hz300 = 0x7c75,
  195. hz311 = 0x7c32, /* .13 DS1 */
  196. hz329 = 0x7bbf, /* .63 E1 */
  197. hz330 = 0x7bb8,
  198. hz340 = 0x7b75,
  199. hz349 = 0x7b37, /* .23 F1 */
  200. hz350 = 0x7b30,
  201. hz360 = 0x7ae9,
  202. hz369 = 0x7aa8, /* .99 FS1 */
  203. hz380 = 0x7a56,
  204. hz392 = 0x79fa, /* .00 G1 */
  205. hz400 = 0x79bb,
  206. hz415 = 0x7941, /* .30 GS1 */
  207. hz420 = 0x7918,
  208. hz425 = 0x78ee,
  209. hz435 = 0x7899,
  210. hz440 = 0x786d, /* .00 A1 */
  211. hz445 = 0x7842,
  212. hz450 = 0x7815,
  213. hz452 = 0x7803,
  214. hz466 = 0x7784, /* .16 AS1 */
  215. hz475 = 0x7731,
  216. hz480 = 0x7701,
  217. hz493 = 0x7685, /* .88 B1 */
  218. hz494 = 0x767b,
  219. hz500 = 0x7640,
  220. hz520 = 0x7578,
  221. hz523 = 0x7559, /* .25 C2 */
  222. hz525 = 0x7544,
  223. hz540 = 0x74a7,
  224. hz554 = 0x7411, /* .37 CS2 */
  225. hz587 = 0x72a1, /* .33 D2 */
  226. hz590 = 0x727f,
  227. hz600 = 0x720b,
  228. hz620 = 0x711e,
  229. hz622 = 0x7106, /* .25 DS2 */
  230. hz659 = 0x6f3b, /* .26 E2 */
  231. hz660 = 0x6f2e,
  232. hz698 = 0x6d3d, /* .46 F2 */
  233. hz700 = 0x6d22,
  234. hz739 = 0x6b09, /* .99 FS2 */
  235. hz740 = 0x6afa,
  236. hz750 = 0x6a6c,
  237. hz770 = 0x694b,
  238. hz783 = 0x688b, /* .99 G2 */
  239. hz800 = 0x678d,
  240. hz816 = 0x6698,
  241. hz830 = 0x65bf, /* .61 GS2 */
  242. hz850 = 0x6484,
  243. hz857 = 0x6414,
  244. hz880 = 0x629f, /* .00 A2 */
  245. hz900 = 0x6154,
  246. hz932 = 0x5f35, /* .33 AS2 */
  247. hz935 = 0x5f01,
  248. hz941 = 0x5e9a,
  249. hz942 = 0x5e88,
  250. hz950 = 0x5dfd,
  251. hz975 = 0x5c44,
  252. hz1000 = 0x5a81,
  253. hz1020 = 0x5912,
  254. hz1050 = 0x56e2,
  255. hz1100 = 0x5320,
  256. hz1140 = 0x5007,
  257. hz1200 = 0x4b3b,
  258. hz1209 = 0x4a80,
  259. hz1215 = 0x4a02,
  260. hz1250 = 0x471c,
  261. hz1300 = 0x42e0,
  262. hz1330 = 0x4049,
  263. hz1336 = 0x3fc4,
  264. hz1366 = 0x3d22,
  265. hz1380 = 0x3be4,
  266. hz1400 = 0x3a1b,
  267. hz1450 = 0x3596,
  268. hz1477 = 0x331c,
  269. hz1500 = 0x30fb,
  270. hz1600 = 0x278d,
  271. hz1633 = 0x2462,
  272. hz1638 = 0x23e7,
  273. hz1645 = 0x233a,
  274. hz1750 = 0x18f8,
  275. hz1800 = 0x1405,
  276. hz1860 = 0xe0b,
  277. hz2100 = 0xf5f6,
  278. hz2450 = 0xd3b3
  279. }IXJ_FREQ;
  280. typedef enum
  281. {
  282. C1 = hz261,
  283. CS1 = hz277,
  284. D1 = hz293,
  285. DS1 = hz311,
  286. E1 = hz329,
  287. F1 = hz349,
  288. FS1 = hz369,
  289. G1 = hz392,
  290. GS1 = hz415,
  291. A1 = hz440,
  292. AS1 = hz466,
  293. B1 = hz493,
  294. C2 = hz523,
  295. CS2 = hz554,
  296. D2 = hz587,
  297. DS2 = hz622,
  298. E2 = hz659,
  299. F2 = hz698,
  300. FS2 = hz739,
  301. G2 = hz783,
  302. GS2 = hz830,
  303. A2 = hz880,
  304. AS2 = hz932,
  305. }IXJ_NOTE;
  306. typedef struct
  307. {
  308. int tone_index;
  309. int freq0;
  310. int gain0;
  311. int freq1;
  312. int gain1;
  313. }IXJ_TONE;
  314. #define IXJCTL_INIT_TONE _IOW ('q', 0x99, IXJ_TONE *)
  315. /******************************************************************************
  316. *
  317. * The IXJCTL_TONE_CADENCE ioctl defines tone sequences used for various
  318. * Call Progress Tones (CPT). This is accomplished by setting up an array of
  319. * IXJ_CADENCE_ELEMENT structures that sequentially define the states of
  320. * the tone sequence. The tone_on_time and tone_off time are in
  321. * 250 microsecond intervals. A pointer to this array is passed to the
  322. * driver as the ce element of an IXJ_CADENCE structure. The elements_used
  323. * must be set to the number of IXJ_CADENCE_ELEMENTS in the array. The
  324. * termination variable defines what to do at the end of a cadence, the
  325. * options are to play the cadence once and stop, to repeat the last
  326. * element of the cadence indefinatly, or to repeat the entire cadence
  327. * indefinatly. The ce variable is a pointer to the array of IXJ_TONE
  328. * structures. If the freq0 variable is non-zero, the tone table contents
  329. * for the tone_index are updated to the frequencies and gains defined. It
  330. * should be noted that DTMF tones cannot be reassigned, so if DTMF tone
  331. * table indexs are used in a cadence the frequency and gain variables will
  332. * be ignored.
  333. *
  334. * If the array elements contain frequency parameters the driver will
  335. * initialize the needed tone table elements and begin playing the tone,
  336. * there is no preset limit on the number of elements in the cadence. If
  337. * there is more than one frequency used in the cadence, sequential elements
  338. * of different frequencies MUST use different tone table indexes. Only one
  339. * cadence can be played at a time. It is possible to build complex
  340. * cadences with multiple frequencies using 2 tone table indexes by
  341. * alternating between them.
  342. *
  343. ******************************************************************************/
  344. typedef struct
  345. {
  346. int index;
  347. int tone_on_time;
  348. int tone_off_time;
  349. int freq0;
  350. int gain0;
  351. int freq1;
  352. int gain1;
  353. }IXJ_CADENCE_ELEMENT;
  354. typedef enum
  355. {
  356. PLAY_ONCE,
  357. REPEAT_LAST_ELEMENT,
  358. REPEAT_ALL
  359. }IXJ_CADENCE_TERM;
  360. typedef struct
  361. {
  362. int elements_used;
  363. IXJ_CADENCE_TERM termination;
  364. IXJ_CADENCE_ELEMENT *ce;
  365. }IXJ_CADENCE;
  366. #define IXJCTL_TONE_CADENCE _IOW ('q', 0x9A, IXJ_CADENCE *)
  367. /******************************************************************************
  368. *
  369. * This group of IOCTLs deal with the playback settings of the DSP
  370. *
  371. ******************************************************************************/
  372. #define IXJCTL_PLAY_CODEC _IOW ('q', 0xA0, int)
  373. #define IXJCTL_PLAY_START _IO ('q', 0xA2)
  374. #define IXJCTL_PLAY_STOP _IO ('q', 0xA3)
  375. #define IXJCTL_PLAY_DEPTH _IOW ('q', 0xA4, int)
  376. #define IXJCTL_PLAY_VOLUME _IOW ('q', 0xA5, int)
  377. #define IXJCTL_PLAY_LEVEL _IO ('q', 0xA6)
  378. /******************************************************************************
  379. *
  380. * This group of IOCTLs deal with the Acoustic Echo Cancellation settings
  381. * of the DSP
  382. *
  383. * Issueing the IXJCTL_AEC_START command with a value of AEC_OFF has the
  384. * same effect as IXJCTL_AEC_STOP. This is to simplify slider bar
  385. * controls.
  386. ******************************************************************************/
  387. #define IXJCTL_AEC_START _IOW ('q', 0xB0, int)
  388. #define IXJCTL_AEC_STOP _IO ('q', 0xB1)
  389. #define AEC_OFF 0
  390. #define AEC_LOW 1
  391. #define AEC_MED 2
  392. #define AEC_HIGH 3
  393. /******************************************************************************
  394. *
  395. * Call Progress Tones, DTMF, etc.
  396. * Tone on and off times are in 250 microsecond intervals so
  397. * ioctl(ixj1, IXJCTL_SET_TONE_ON_TIME, 360);
  398. * will set the tone on time of board ixj1 to 360 * 250us = 90ms
  399. * the default values of tone on and off times is 840 or 210ms
  400. ******************************************************************************/
  401. #define IXJCTL_DTMF_READY _IOR ('q', 0xC0, int)
  402. #define IXJCTL_GET_DTMF _IOR ('q', 0xC1, int)
  403. #define IXJCTL_GET_DTMF_ASCII _IOR ('q', 0xC2, int)
  404. #define IXJCTL_EXCEPTION _IOR ('q', 0xC4, int)
  405. #define IXJCTL_PLAY_TONE _IOW ('q', 0xC6, char)
  406. #define IXJCTL_SET_TONE_ON_TIME _IOW ('q', 0xC7, int)
  407. #define IXJCTL_SET_TONE_OFF_TIME _IOW ('q', 0xC8, int)
  408. #define IXJCTL_GET_TONE_ON_TIME _IO ('q', 0xC9)
  409. #define IXJCTL_GET_TONE_OFF_TIME _IO ('q', 0xCA)
  410. #define IXJCTL_GET_TONE_STATE _IO ('q', 0xCB)
  411. #define IXJCTL_BUSY _IO ('q', 0xCC)
  412. #define IXJCTL_RINGBACK _IO ('q', 0xCD)
  413. #define IXJCTL_DIALTONE _IO ('q', 0xCE)
  414. // This IOCTL replaced both IXJCTL_BUSY_STOP and IXJCTL_RINGBACK_STOP and
  415. // should be used from now on to stop all Call Progress Tones. It will
  416. // actually abort any tone, regardless of time left in the tone_on_time
  417. // and tone_off_time counters.
  418. #define IXJCTL_CPT_STOP _IO ('q', 0xCF)
  419. /******************************************************************************
  420. * LineJack specific IOCTLs
  421. *
  422. * The lsb 4 bits of the LED argument represent the state of each of the 4
  423. * LED's on the LineJack
  424. ******************************************************************************/
  425. #define IXJCTL_SET_LED _IOW ('q', 0xD0, int)
  426. #define IXJCTL_MIXER _IOW ('q', 0xD1, int)
  427. /******************************************************************************
  428. *
  429. * The master volume controls use attenuation with 32 levels from 0 to -62dB
  430. * with steps of 2dB each, the defines should be OR'ed together then sent
  431. * as the parameter to the mixer command to change the mixer settings.
  432. *
  433. ******************************************************************************/
  434. #define MIXER_MASTER_L 0x0100
  435. #define MIXER_MASTER_R 0x0200
  436. #define ATT00DB 0x00
  437. #define ATT02DB 0x01
  438. #define ATT04DB 0x02
  439. #define ATT06DB 0x03
  440. #define ATT08DB 0x04
  441. #define ATT10DB 0x05
  442. #define ATT12DB 0x06
  443. #define ATT14DB 0x07
  444. #define ATT16DB 0x08
  445. #define ATT18DB 0x09
  446. #define ATT20DB 0x0A
  447. #define ATT22DB 0x0B
  448. #define ATT24DB 0x0C
  449. #define ATT26DB 0x0D
  450. #define ATT28DB 0x0E
  451. #define ATT30DB 0x0F
  452. #define ATT32DB 0x10
  453. #define ATT34DB 0x11
  454. #define ATT36DB 0x12
  455. #define ATT38DB 0x13
  456. #define ATT40DB 0x14
  457. #define ATT42DB 0x15
  458. #define ATT44DB 0x16
  459. #define ATT46DB 0x17
  460. #define ATT48DB 0x18
  461. #define ATT50DB 0x19
  462. #define ATT52DB 0x1A
  463. #define ATT54DB 0x1B
  464. #define ATT56DB 0x1C
  465. #define ATT58DB 0x1D
  466. #define ATT60DB 0x1E
  467. #define ATT62DB 0x1F
  468. #define MASTER_MUTE 0x80
  469. /******************************************************************************
  470. *
  471. * The input volume controls use gain with 32 levels from +12dB to -50dB
  472. * with steps of 2dB each, the defines should be OR'ed together then sent
  473. * as the parameter to the mixer command to change the mixer settings.
  474. *
  475. ******************************************************************************/
  476. #define MIXER_PORT_CD_L 0x0600
  477. #define MIXER_PORT_CD_R 0x0700
  478. #define MIXER_PORT_LINE_IN_L 0x0800
  479. #define MIXER_PORT_LINE_IN_R 0x0900
  480. #define MIXER_PORT_POTS_REC 0x0C00
  481. #define MIXER_PORT_MIC 0x0E00
  482. #define GAIN12DB 0x00
  483. #define GAIN10DB 0x01
  484. #define GAIN08DB 0x02
  485. #define GAIN06DB 0x03
  486. #define GAIN04DB 0x04
  487. #define GAIN02DB 0x05
  488. #define GAIN00DB 0x06
  489. #define GAIN_02DB 0x07
  490. #define GAIN_04DB 0x08
  491. #define GAIN_06DB 0x09
  492. #define GAIN_08DB 0x0A
  493. #define GAIN_10DB 0x0B
  494. #define GAIN_12DB 0x0C
  495. #define GAIN_14DB 0x0D
  496. #define GAIN_16DB 0x0E
  497. #define GAIN_18DB 0x0F
  498. #define GAIN_20DB 0x10
  499. #define GAIN_22DB 0x11
  500. #define GAIN_24DB 0x12
  501. #define GAIN_26DB 0x13
  502. #define GAIN_28DB 0x14
  503. #define GAIN_30DB 0x15
  504. #define GAIN_32DB 0x16
  505. #define GAIN_34DB 0x17
  506. #define GAIN_36DB 0x18
  507. #define GAIN_38DB 0x19
  508. #define GAIN_40DB 0x1A
  509. #define GAIN_42DB 0x1B
  510. #define GAIN_44DB 0x1C
  511. #define GAIN_46DB 0x1D
  512. #define GAIN_48DB 0x1E
  513. #define GAIN_50DB 0x1F
  514. #define INPUT_MUTE 0x80
  515. /******************************************************************************
  516. *
  517. * The POTS volume control use attenuation with 8 levels from 0dB to -28dB
  518. * with steps of 4dB each, the defines should be OR'ed together then sent
  519. * as the parameter to the mixer command to change the mixer settings.
  520. *
  521. ******************************************************************************/
  522. #define MIXER_PORT_POTS_PLAY 0x0F00
  523. #define POTS_ATT_00DB 0x00
  524. #define POTS_ATT_04DB 0x01
  525. #define POTS_ATT_08DB 0x02
  526. #define POTS_ATT_12DB 0x03
  527. #define POTS_ATT_16DB 0x04
  528. #define POTS_ATT_20DB 0x05
  529. #define POTS_ATT_24DB 0x06
  530. #define POTS_ATT_28DB 0x07
  531. #define POTS_MUTE 0x80
  532. /******************************************************************************
  533. *
  534. * The DAA controls the interface to the PSTN port. The driver loads the
  535. * US coefficients by default, so if you live in a different country you
  536. * need to load the set for your countries phone system.
  537. *
  538. ******************************************************************************/
  539. #define IXJCTL_DAA_COEFF_SET _IOW ('q', 0xD2, int)
  540. #define DAA_US 1 //PITA 8kHz
  541. #define DAA_UK 2 //ISAR34 8kHz
  542. #define DAA_FRANCE 3 //
  543. #define DAA_GERMANY 4
  544. #define DAA_AUSTRALIA 5
  545. #define DAA_JAPAN 6
  546. /******************************************************************************
  547. *
  548. * Use IXJCTL_PORT to set or query the port the card is set to. If the
  549. * argument is set to PORT_QUERY, the return value of the ioctl will
  550. * indicate which port is currently in use, otherwise it will change the
  551. * port.
  552. *
  553. ******************************************************************************/
  554. #define IXJCTL_PORT _IOW ('q', 0xD3, int)
  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. #define IXJCTL_PSTN_SET_STATE _IOW ('q', 0xD4, int)
  561. #define IXJCTL_PSTN_GET_STATE _IO ('q', 0xD5)
  562. #define PSTN_ON_HOOK 0
  563. #define PSTN_RINGING 1
  564. #define PSTN_OFF_HOOK 2
  565. #define PSTN_PULSE_DIAL 3
  566. /******************************************************************************
  567. *
  568. * The DAA Analog GAIN sets 2 parameters at one time, the recieve gain (AGRR),
  569. * and the transmit gain (AGX). OR together the components and pass them
  570. * as the parameter to IXJCTL_DAA_AGAIN. The default setting is both at 0dB.
  571. *
  572. ******************************************************************************/
  573. #define IXJCTL_DAA_AGAIN _IOW ('q', 0xD6, int)
  574. #define AGRR00DB 0x00 // Analog gain in recieve direction 0dB
  575. #define AGRR3_5DB 0x10 // Analog gain in recieve direction 3.5dB
  576. #define AGRR06DB 0x30 // Analog gain in recieve direction 6dB
  577. #define AGX00DB 0x00 // Analog gain in transmit direction 0dB
  578. #define AGX_6DB 0x04 // Analog gain in transmit direction -6dB
  579. #define AGX3_5DB 0x08 // Analog gain in transmit direction 3.5dB
  580. #define AGX_2_5B 0x0C // Analog gain in transmit direction -2.5dB
  581. #define IXJCTL_PSTN_LINETEST _IO ('q', 0xD7)
  582. typedef struct
  583. {
  584. char month[3];
  585. char day[3];
  586. char hour[3];
  587. char min[3];
  588. int numlen;
  589. char number[11];
  590. int namelen;
  591. char name[80];
  592. }IXJ_CID;
  593. #define IXJCTL_CID _IOR ('q', 0xD8, IXJ_CID *)
  594. /******************************************************************************
  595. *
  596. * The wink duration is tunable with this ioctl. The default wink duration
  597. * is 320ms. You do not need to use this ioctl if you do not require a
  598. * different wink duration.
  599. *
  600. ******************************************************************************/
  601. #define IXJCTL_WINK_DURATION _IOW ('q', 0xD9, int)
  602. /******************************************************************************
  603. *
  604. * This ioctl will connect the POTS port to the PSTN port on the LineJACK
  605. * In order for this to work properly the port selection should be set to
  606. * the PSTN port with IXJCTL_PORT prior to calling this ioctl. This will
  607. * enable conference calls between PSTN callers and network callers.
  608. * Passing a 1 to this ioctl enables the POTS<->PSTN connection while
  609. * passing a 0 turns it back off.
  610. *
  611. ******************************************************************************/
  612. #define IXJCTL_POTS_PSTN _IOW ('q', 0xDA, int)
  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. #define IXJCTL_HZ _IOW ('q', 0xE0, int)
  634. #define IXJCTL_RATE _IOW ('q', 0xE1, int)
  635. #define IXJCTL_FRAMES_READ _IOR ('q', 0xE2, unsigned long)
  636. #define IXJCTL_FRAMES_WRITTEN _IOR ('q', 0xE3, unsigned long)
  637. #define IXJCTL_READ_WAIT _IOR ('q', 0xE4, unsigned long)
  638. #define IXJCTL_WRITE_WAIT _IOR ('q', 0xE5, unsigned long)
  639. #define IXJCTL_DRYBUFFER_READ _IOR ('q', 0xE6, unsigned long)
  640. #define IXJCTL_DRYBUFFER_CLEAR _IO ('q', 0xE7)
  641. /******************************************************************************
  642. *
  643. * The defined CODECs that can be used with the IXJCTL_REC_CODEC and
  644. * IXJ_PLAY_CODEC IOCTLs.
  645. *
  646. * PCM uLaw mode is a "pass through" mode.
  647. *
  648. * 16 bit linear data is signed integer (2's complement form), positive
  649. * full scale is 7FFFH, negative full scale is 8000H, zero is 0000H
  650. *
  651. * 8 bit linear data is signed byte (2's complement form), positive
  652. * full scale is 7FH, negative full scale is 80H, zero is 00H
  653. *
  654. * 8 bit linear WSS data is unsigned byte, positive full scale is FFH,
  655. * negative full scale is 00H, zero is 80H. This is the format used for
  656. * 8-bit WAVE format data (Windows Sound System). Data can be converted
  657. * between the two 8-bit formats by simply inverting the ms bit.
  658. *
  659. * G729 currently works most reliably with 10ms frames. Use 20ms and 30ms
  660. * at your own risk. If you really need larger frame sizes you can
  661. * concatenate multiple 10ms frames.
  662. *
  663. ******************************************************************************/
  664. typedef enum{ // Bytes per 30ms audio frame
  665. G723_63 = 1, // 24
  666. G723_53 = 2, // 20
  667. TS85 = 3, // 32 Does not currently work on LineJack
  668. TS48 = 4, // 18
  669. TS41 = 5, // 16
  670. G728 = 6, // 96 LineJack only!
  671. G729 = 7, // 30 LineJack only!
  672. ULAW = 8, // 240
  673. ALAW = 9, // 240 not implemented DO NOT USE!
  674. LINEAR16= 10, // 480
  675. LINEAR8 = 11, // 240
  676. WSS = 12 // 240
  677. }IXJ_CODEC;
  678. /******************************************************************************
  679. *
  680. * The intercom IOCTL's short the output from one card to the input of the
  681. * other and vice versa (actually done in the DSP read function). It is only
  682. * necessary to execute the IOCTL on one card, but it is necessary to have
  683. * both devices open to be able to detect hook switch changes. The record
  684. * codec and rate of each card must match the playback codec and rate of
  685. * the other card for this to work properly.
  686. *
  687. ******************************************************************************/
  688. #define IXJCTL_INTERCOM_START _IOW ('q', 0xFD, int)
  689. #define IXJCTL_INTERCOM_STOP _IOW ('q', 0xFE, int)
  690. /******************************************************************************
  691. *
  692. * This IOCTL will decrement the module usage counter so you can force
  693. * the module to unload after a program bombs.
  694. *
  695. ******************************************************************************/
  696. #define IXJCTL_MODRESET _IO ('q', 0xFF)
  697. /******************************************************************************
  698. *
  699. * Various Defines used for the Quicknet Cards
  700. *
  701. ******************************************************************************/
  702. #define SYNC_MODE_CODEC 0
  703. #define SYNC_MODE_DATA 1
  704. #define SYNC_MODE_POLL 2
  705. #define SYNC_MODE_HOST 3
  706. #define RECORD_SYNC_MODE 0x5100
  707. #define PLAYBACK_SYNC_MODE 0x5200
  708. #define USA_RING_CADENCE 0xC0C0
  709. /******************************************************************************
  710. *
  711. * The exception structure allows us to multiplex multiple events onto the
  712. * select() exception set. If any of these flags are set select() will
  713. * return with a positive indication on the exception set. The dtmf_ready
  714. * bit indicates if there is data waiting in the DTMF buffer. The
  715. * hookstate bit is set if there is a change in hookstate status, it does not
  716. * indicate the current state of the hookswitch. The pstn_ring bit
  717. * indicates that the DAA on a LineJACK card has detected ring voltage on
  718. * the PSTN port. The caller_id bit indicates that caller_id data has been
  719. * recieved and is available. The pstn_wink bit indicates that the DAA on
  720. * the LineJACK has recieved a wink from the telco switch. The f0, f1, f2
  721. * and f3 bits indicate that the filter has been triggered by detecting the
  722. * frequency programmed into that filter.
  723. *
  724. ******************************************************************************/
  725. typedef struct
  726. {
  727. unsigned int dtmf_ready:1;
  728. unsigned int hookstate:1;
  729. unsigned int pstn_ring:1;
  730. unsigned int caller_id:1;
  731. unsigned int pstn_wink:1;
  732. unsigned int f0:1;
  733. unsigned int f1:1;
  734. unsigned int f2:1;
  735. unsigned int f3:1;
  736. unsigned int reserved:23;
  737. }IXJ_EXCEPT;
  738. typedef union
  739. {
  740. IXJ_EXCEPT bits;
  741. unsigned int bytes;
  742. }IXJ_EXCEPTION;