ixj.h 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327
  1. /******************************************************************************
  2. * ixj.h
  3. *
  4. *
  5. * Device Driver for Quicknet Technologies, Inc.'s Telephony cards
  6. * including the Internet PhoneJACK, Internet PhoneJACK Lite,
  7. * Internet PhoneJACK PCI, Internet LineJACK, Internet PhoneCARD and
  8. * SmartCABLE
  9. *
  10. * (c) Copyright 1999-2001 Quicknet Technologies, Inc.
  11. *
  12. * This program is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU General Public License
  14. * as published by the Free Software Foundation; either version
  15. * 2 of the License, or (at your option) any later version.
  16. *
  17. * Author: Ed Okerson, <eokerson@quicknet.net>
  18. *
  19. * Contributors: Greg Herlein, <gherlein@quicknet.net>
  20. * David W. Erhart, <derhart@quicknet.net>
  21. * John Sellers, <jsellers@quicknet.net>
  22. * Mike Preston, <mpreston@quicknet.net>
  23. *
  24. * More information about the hardware related to this driver can be found
  25. * at our website: http://www.quicknet.net
  26. *
  27. * Fixes:
  28. *
  29. * IN NO EVENT SHALL QUICKNET TECHNOLOGIES, INC. BE LIABLE TO ANY PARTY FOR
  30. * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
  31. * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF QUICKNET
  32. * TECHNOLOGIES, INC.HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33. *
  34. * QUICKNET TECHNOLOGIES, INC. SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  35. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  36. * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
  37. * ON AN "AS IS" BASIS, AND QUICKNET TECHNOLOGIES, INC. HAS NO OBLIGATION
  38. * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  39. *
  40. *****************************************************************************/
  41. #define IXJ_VERSION 3031
  42. #include <linux/version.h>
  43. #include <linux/types.h>
  44. #include <linux/ixjuser.h>
  45. #include <linux/phonedev.h>
  46. typedef __u16 WORD;
  47. typedef __u32 DWORD;
  48. typedef __u8 BYTE;
  49. typedef __u8 BOOL;
  50. #ifndef IXJMAX
  51. #define IXJMAX 16
  52. #endif
  53. #define TRUE 1
  54. #define FALSE 0
  55. /******************************************************************************
  56. *
  57. * This structure when unioned with the structures below makes simple byte
  58. * access to the registers easier.
  59. *
  60. ******************************************************************************/
  61. typedef struct {
  62. unsigned char low;
  63. unsigned char high;
  64. } BYTES;
  65. typedef union {
  66. BYTES bytes;
  67. short word;
  68. } IXJ_WORD;
  69. typedef struct{
  70. unsigned int b0:1;
  71. unsigned int b1:1;
  72. unsigned int b2:1;
  73. unsigned int b3:1;
  74. unsigned int b4:1;
  75. unsigned int b5:1;
  76. unsigned int b6:1;
  77. unsigned int b7:1;
  78. } IXJ_CBITS;
  79. typedef union{
  80. IXJ_CBITS cbits;
  81. char cbyte;
  82. } IXJ_CBYTE;
  83. /******************************************************************************
  84. *
  85. * This structure represents the Hardware Control Register of the CT8020/8021
  86. * The CT8020 is used in the Internet PhoneJACK, and the 8021 in the
  87. * Internet LineJACK
  88. *
  89. ******************************************************************************/
  90. typedef struct {
  91. unsigned int rxrdy:1;
  92. unsigned int txrdy:1;
  93. unsigned int status:1;
  94. unsigned int auxstatus:1;
  95. unsigned int rxdma:1;
  96. unsigned int txdma:1;
  97. unsigned int rxburst:1;
  98. unsigned int txburst:1;
  99. unsigned int dmadir:1;
  100. unsigned int cont:1;
  101. unsigned int irqn:1;
  102. unsigned int t:5;
  103. } HCRBIT;
  104. typedef union {
  105. HCRBIT bits;
  106. BYTES bytes;
  107. } HCR;
  108. /******************************************************************************
  109. *
  110. * This structure represents the Hardware Status Register of the CT8020/8021
  111. * The CT8020 is used in the Internet PhoneJACK, and the 8021 in the
  112. * Internet LineJACK
  113. *
  114. ******************************************************************************/
  115. typedef struct {
  116. unsigned int controlrdy:1;
  117. unsigned int auxctlrdy:1;
  118. unsigned int statusrdy:1;
  119. unsigned int auxstatusrdy:1;
  120. unsigned int rxrdy:1;
  121. unsigned int txrdy:1;
  122. unsigned int restart:1;
  123. unsigned int irqn:1;
  124. unsigned int rxdma:1;
  125. unsigned int txdma:1;
  126. unsigned int cohostshutdown:1;
  127. unsigned int t:5;
  128. } HSRBIT;
  129. typedef union {
  130. HSRBIT bits;
  131. BYTES bytes;
  132. } HSR;
  133. /******************************************************************************
  134. *
  135. * This structure represents the General Purpose IO Register of the CT8020/8021
  136. * The CT8020 is used in the Internet PhoneJACK, and the 8021 in the
  137. * Internet LineJACK
  138. *
  139. ******************************************************************************/
  140. typedef struct {
  141. unsigned int x:1;
  142. unsigned int gpio1:1;
  143. unsigned int gpio2:1;
  144. unsigned int gpio3:1;
  145. unsigned int gpio4:1;
  146. unsigned int gpio5:1;
  147. unsigned int gpio6:1;
  148. unsigned int gpio7:1;
  149. unsigned int xread:1;
  150. unsigned int gpio1read:1;
  151. unsigned int gpio2read:1;
  152. unsigned int gpio3read:1;
  153. unsigned int gpio4read:1;
  154. unsigned int gpio5read:1;
  155. unsigned int gpio6read:1;
  156. unsigned int gpio7read:1;
  157. } GPIOBIT;
  158. typedef union {
  159. GPIOBIT bits;
  160. BYTES bytes;
  161. unsigned short word;
  162. } GPIO;
  163. /******************************************************************************
  164. *
  165. * This structure represents the Line Monitor status response
  166. *
  167. ******************************************************************************/
  168. typedef struct {
  169. unsigned int digit:4;
  170. unsigned int cpf_valid:1;
  171. unsigned int dtmf_valid:1;
  172. unsigned int peak:1;
  173. unsigned int z:1;
  174. unsigned int f0:1;
  175. unsigned int f1:1;
  176. unsigned int f2:1;
  177. unsigned int f3:1;
  178. unsigned int frame:4;
  179. } LMON;
  180. typedef union {
  181. LMON bits;
  182. BYTES bytes;
  183. } DTMF;
  184. typedef struct {
  185. unsigned int z:7;
  186. unsigned int dtmf_en:1;
  187. unsigned int y:4;
  188. unsigned int F3:1;
  189. unsigned int F2:1;
  190. unsigned int F1:1;
  191. unsigned int F0:1;
  192. } CP;
  193. typedef union {
  194. CP bits;
  195. BYTES bytes;
  196. } CPTF;
  197. /******************************************************************************
  198. *
  199. * This structure represents the Status Control Register on the Internet
  200. * LineJACK
  201. *
  202. ******************************************************************************/
  203. typedef struct {
  204. unsigned int c0:1;
  205. unsigned int c1:1;
  206. unsigned int stereo:1;
  207. unsigned int daafsyncen:1;
  208. unsigned int led1:1;
  209. unsigned int led2:1;
  210. unsigned int led3:1;
  211. unsigned int led4:1;
  212. } PSCRWI; /* Internet LineJACK and Internet PhoneJACK Lite */
  213. typedef struct {
  214. unsigned int eidp:1;
  215. unsigned int eisd:1;
  216. unsigned int x:6;
  217. } PSCRWP; /* Internet PhoneJACK PCI */
  218. typedef union {
  219. PSCRWI bits;
  220. PSCRWP pcib;
  221. char byte;
  222. } PLD_SCRW;
  223. typedef struct {
  224. unsigned int c0:1;
  225. unsigned int c1:1;
  226. unsigned int x:1;
  227. unsigned int d0ee:1;
  228. unsigned int mixerbusy:1;
  229. unsigned int sci:1;
  230. unsigned int dspflag:1;
  231. unsigned int daaflag:1;
  232. } PSCRRI;
  233. typedef struct {
  234. unsigned int eidp:1;
  235. unsigned int eisd:1;
  236. unsigned int x:4;
  237. unsigned int dspflag:1;
  238. unsigned int det:1;
  239. } PSCRRP;
  240. typedef union {
  241. PSCRRI bits;
  242. PSCRRP pcib;
  243. char byte;
  244. } PLD_SCRR;
  245. /******************************************************************************
  246. *
  247. * These structures represents the SLIC Control Register on the
  248. * Internet LineJACK
  249. *
  250. ******************************************************************************/
  251. typedef struct {
  252. unsigned int c1:1;
  253. unsigned int c2:1;
  254. unsigned int c3:1;
  255. unsigned int b2en:1;
  256. unsigned int spken:1;
  257. unsigned int rly1:1;
  258. unsigned int rly2:1;
  259. unsigned int rly3:1;
  260. } PSLICWRITE;
  261. typedef struct {
  262. unsigned int state:3;
  263. unsigned int b2en:1;
  264. unsigned int spken:1;
  265. unsigned int c3:1;
  266. unsigned int potspstn:1;
  267. unsigned int det:1;
  268. } PSLICREAD;
  269. typedef struct {
  270. unsigned int c1:1;
  271. unsigned int c2:1;
  272. unsigned int c3:1;
  273. unsigned int b2en:1;
  274. unsigned int e1:1;
  275. unsigned int mic:1;
  276. unsigned int spk:1;
  277. unsigned int x:1;
  278. } PSLICPCI;
  279. typedef union {
  280. PSLICPCI pcib;
  281. PSLICWRITE bits;
  282. PSLICREAD slic;
  283. char byte;
  284. } PLD_SLICW;
  285. typedef union {
  286. PSLICPCI pcib;
  287. PSLICREAD bits;
  288. char byte;
  289. } PLD_SLICR;
  290. /******************************************************************************
  291. *
  292. * These structures represents the Clock Control Register on the
  293. * Internet LineJACK
  294. *
  295. ******************************************************************************/
  296. typedef struct {
  297. unsigned int clk0:1;
  298. unsigned int clk1:1;
  299. unsigned int clk2:1;
  300. unsigned int x0:1;
  301. unsigned int slic_e1:1;
  302. unsigned int x1:1;
  303. unsigned int x2:1;
  304. unsigned int x3:1;
  305. } PCLOCK;
  306. typedef union {
  307. PCLOCK bits;
  308. char byte;
  309. } PLD_CLOCK;
  310. /******************************************************************************
  311. *
  312. * These structures deal with the mixer on the Internet LineJACK
  313. *
  314. ******************************************************************************/
  315. typedef struct {
  316. unsigned short vol[10];
  317. unsigned int recsrc;
  318. unsigned int modcnt;
  319. unsigned short micpreamp;
  320. } MIX;
  321. /******************************************************************************
  322. *
  323. * These structures deal with the control logic on the Internet PhoneCARD
  324. *
  325. ******************************************************************************/
  326. typedef struct {
  327. unsigned int x0:4; /* unused bits */
  328. unsigned int ed:1; /* Event Detect */
  329. unsigned int drf:1; /* SmartCABLE Removal Flag 1=no cable */
  330. unsigned int dspf:1; /* DSP Flag 1=DSP Ready */
  331. unsigned int crr:1; /* Control Register Ready */
  332. } COMMAND_REG1;
  333. typedef union {
  334. COMMAND_REG1 bits;
  335. unsigned char byte;
  336. } PCMCIA_CR1;
  337. typedef struct {
  338. unsigned int x0:4; /* unused bits */
  339. unsigned int rstc:1; /* SmartCABLE Reset */
  340. unsigned int pwr:1; /* SmartCABLE Power */
  341. unsigned int x1:2; /* unused bits */
  342. } COMMAND_REG2;
  343. typedef union {
  344. COMMAND_REG2 bits;
  345. unsigned char byte;
  346. } PCMCIA_CR2;
  347. typedef struct {
  348. unsigned int addr:5; /* R/W SmartCABLE Register Address */
  349. unsigned int rw:1; /* Read / Write flag */
  350. unsigned int dev:2; /* 2 bit SmartCABLE Device Address */
  351. } CONTROL_REG;
  352. typedef union {
  353. CONTROL_REG bits;
  354. unsigned char byte;
  355. } PCMCIA_SCCR;
  356. typedef struct {
  357. unsigned int hsw:1;
  358. unsigned int det:1;
  359. unsigned int led2:1;
  360. unsigned int led1:1;
  361. unsigned int ring1:1;
  362. unsigned int ring0:1;
  363. unsigned int x:1;
  364. unsigned int powerdown:1;
  365. } PCMCIA_SLIC_REG;
  366. typedef union {
  367. PCMCIA_SLIC_REG bits;
  368. unsigned char byte;
  369. } PCMCIA_SLIC;
  370. typedef struct {
  371. unsigned int cpd:1; /* Chip Power Down */
  372. unsigned int mpd:1; /* MIC Bias Power Down */
  373. unsigned int hpd:1; /* Handset Drive Power Down */
  374. unsigned int lpd:1; /* Line Drive Power Down */
  375. unsigned int spd:1; /* Speaker Drive Power Down */
  376. unsigned int x:2; /* unused bits */
  377. unsigned int sr:1; /* Software Reset */
  378. } Si3CONTROL1;
  379. typedef union {
  380. Si3CONTROL1 bits;
  381. unsigned char byte;
  382. } Si3C1;
  383. typedef struct {
  384. unsigned int al:1; /* Analog Loopback DAC analog -> ADC analog */
  385. unsigned int dl2:1; /* Digital Loopback DAC -> ADC one bit */
  386. unsigned int dl1:1; /* Digital Loopback ADC -> DAC one bit */
  387. unsigned int pll:1; /* 1 = div 10, 0 = div 5 */
  388. unsigned int hpd:1; /* HPF disable */
  389. unsigned int x:3; /* unused bits */
  390. } Si3CONTROL2;
  391. typedef union {
  392. Si3CONTROL2 bits;
  393. unsigned char byte;
  394. } Si3C2;
  395. typedef struct {
  396. unsigned int iir:1; /* 1 enables IIR, 0 enables FIR */
  397. unsigned int him:1; /* Handset Input Mute */
  398. unsigned int mcm:1; /* MIC In Mute */
  399. unsigned int mcg:2; /* MIC In Gain */
  400. unsigned int lim:1; /* Line In Mute */
  401. unsigned int lig:2; /* Line In Gain */
  402. } Si3RXGAIN;
  403. typedef union {
  404. Si3RXGAIN bits;
  405. unsigned char byte;
  406. } Si3RXG;
  407. typedef struct {
  408. unsigned int hom:1; /* Handset Out Mute */
  409. unsigned int lom:1; /* Line Out Mute */
  410. unsigned int rxg:5; /* RX PGA Gain */
  411. unsigned int x:1; /* unused bit */
  412. } Si3ADCVOLUME;
  413. typedef union {
  414. Si3ADCVOLUME bits;
  415. unsigned char byte;
  416. } Si3ADC;
  417. typedef struct {
  418. unsigned int srm:1; /* Speaker Right Mute */
  419. unsigned int slm:1; /* Speaker Left Mute */
  420. unsigned int txg:5; /* TX PGA Gain */
  421. unsigned int x:1; /* unused bit */
  422. } Si3DACVOLUME;
  423. typedef union {
  424. Si3DACVOLUME bits;
  425. unsigned char byte;
  426. } Si3DAC;
  427. typedef struct {
  428. unsigned int x:5; /* unused bit */
  429. unsigned int losc:1; /* Line Out Short Circuit */
  430. unsigned int srsc:1; /* Speaker Right Short Circuit */
  431. unsigned int slsc:1; /* Speaker Left Short Circuit */
  432. } Si3STATUSREPORT;
  433. typedef union {
  434. Si3STATUSREPORT bits;
  435. unsigned char byte;
  436. } Si3STAT;
  437. typedef struct {
  438. unsigned int sot:2; /* Speaker Out Attenuation */
  439. unsigned int lot:2; /* Line Out Attenuation */
  440. unsigned int x:4; /* unused bits */
  441. } Si3ANALOGATTN;
  442. typedef union {
  443. Si3ANALOGATTN bits;
  444. unsigned char byte;
  445. } Si3AATT;
  446. /******************************************************************************
  447. *
  448. * These structures deal with the DAA on the Internet LineJACK
  449. *
  450. ******************************************************************************/
  451. typedef struct _DAA_REGS {
  452. /*----------------------------------------------- */
  453. /* SOP Registers */
  454. /* */
  455. BYTE bySOP;
  456. union _SOP_REGS {
  457. struct _SOP {
  458. union /* SOP - CR0 Register */
  459. {
  460. BYTE reg;
  461. struct _CR0_BITREGS {
  462. BYTE CLK_EXT:1; /* cr0[0:0] */
  463. BYTE RIP:1; /* cr0[1:1] */
  464. BYTE AR:1; /* cr0[2:2] */
  465. BYTE AX:1; /* cr0[3:3] */
  466. BYTE FRR:1; /* cr0[4:4] */
  467. BYTE FRX:1; /* cr0[5:5] */
  468. BYTE IM:1; /* cr0[6:6] */
  469. BYTE TH:1; /* cr0[7:7] */
  470. } bitreg;
  471. } cr0;
  472. union /* SOP - CR1 Register */
  473. {
  474. BYTE reg;
  475. struct _CR1_REGS {
  476. BYTE RM:1; /* cr1[0:0] */
  477. BYTE RMR:1; /* cr1[1:1] */
  478. BYTE No_auto:1; /* cr1[2:2] */
  479. BYTE Pulse:1; /* cr1[3:3] */
  480. BYTE P_Tone1:1; /* cr1[4:4] */
  481. BYTE P_Tone2:1; /* cr1[5:5] */
  482. BYTE E_Tone1:1; /* cr1[6:6] */
  483. BYTE E_Tone2:1; /* cr1[7:7] */
  484. } bitreg;
  485. } cr1;
  486. union /* SOP - CR2 Register */
  487. {
  488. BYTE reg;
  489. struct _CR2_REGS {
  490. BYTE Call_II:1; /* CR2[0:0] */
  491. BYTE Call_I:1; /* CR2[1:1] */
  492. BYTE Call_en:1; /* CR2[2:2] */
  493. BYTE Call_pon:1; /* CR2[3:3] */
  494. BYTE IDR:1; /* CR2[4:4] */
  495. BYTE COT_R:3; /* CR2[5:7] */
  496. } bitreg;
  497. } cr2;
  498. union /* SOP - CR3 Register */
  499. {
  500. BYTE reg;
  501. struct _CR3_REGS {
  502. BYTE DHP_X:1; /* CR3[0:0] */
  503. BYTE DHP_R:1; /* CR3[1:1] */
  504. BYTE Cal_pctl:1; /* CR3[2:2] */
  505. BYTE SEL:1; /* CR3[3:3] */
  506. BYTE TestLoops:4; /* CR3[4:7] */
  507. } bitreg;
  508. } cr3;
  509. union /* SOP - CR4 Register */
  510. {
  511. BYTE reg;
  512. struct _CR4_REGS {
  513. BYTE Fsc_en:1; /* CR4[0:0] */
  514. BYTE Int_en:1; /* CR4[1:1] */
  515. BYTE AGX:2; /* CR4[2:3] */
  516. BYTE AGR_R:2; /* CR4[4:5] */
  517. BYTE AGR_Z:2; /* CR4[6:7] */
  518. } bitreg;
  519. } cr4;
  520. union /* SOP - CR5 Register */
  521. {
  522. BYTE reg;
  523. struct _CR5_REGS {
  524. BYTE V_0:1; /* CR5[0:0] */
  525. BYTE V_1:1; /* CR5[1:1] */
  526. BYTE V_2:1; /* CR5[2:2] */
  527. BYTE V_3:1; /* CR5[3:3] */
  528. BYTE V_4:1; /* CR5[4:4] */
  529. BYTE V_5:1; /* CR5[5:5] */
  530. BYTE V_6:1; /* CR5[6:6] */
  531. BYTE V_7:1; /* CR5[7:7] */
  532. } bitreg;
  533. } cr5;
  534. union /* SOP - CR6 Register */
  535. {
  536. BYTE reg;
  537. struct _CR6_REGS {
  538. BYTE reserved:8; /* CR6[0:7] */
  539. } bitreg;
  540. } cr6;
  541. union /* SOP - CR7 Register */
  542. {
  543. BYTE reg;
  544. struct _CR7_REGS {
  545. BYTE reserved:8; /* CR7[0:7] */
  546. } bitreg;
  547. } cr7;
  548. } SOP;
  549. BYTE ByteRegs[sizeof(struct _SOP)];
  550. } SOP_REGS;
  551. /* DAA_REGS.SOP_REGS.SOP.CR5.reg */
  552. /* DAA_REGS.SOP_REGS.SOP.CR5.bitreg */
  553. /* DAA_REGS.SOP_REGS.SOP.CR5.bitreg.V_2 */
  554. /* DAA_REGS.SOP_REGS.ByteRegs[5] */
  555. /*----------------------------------------------- */
  556. /* XOP Registers */
  557. /* */
  558. BYTE byXOP;
  559. union _XOP_REGS {
  560. struct _XOP {
  561. union XOPXR0/* XOP - XR0 Register - Read values */
  562. {
  563. BYTE reg;
  564. struct _XR0_BITREGS {
  565. BYTE SI_0:1; /* XR0[0:0] - Read */
  566. BYTE SI_1:1; /* XR0[1:1] - Read */
  567. BYTE VDD_OK:1; /* XR0[2:2] - Read */
  568. BYTE Caller_ID:1; /* XR0[3:3] - Read */
  569. BYTE RING:1; /* XR0[4:4] - Read */
  570. BYTE Cadence:1; /* XR0[5:5] - Read */
  571. BYTE Wake_up:1; /* XR0[6:6] - Read */
  572. BYTE RMR:1; /* XR0[7:7] - Read */
  573. } bitreg;
  574. } xr0;
  575. union /* XOP - XR1 Register */
  576. {
  577. BYTE reg;
  578. struct _XR1_BITREGS {
  579. BYTE M_SI_0:1; /* XR1[0:0] */
  580. BYTE M_SI_1:1; /* XR1[1:1] */
  581. BYTE M_VDD_OK:1; /* XR1[2:2] */
  582. BYTE M_Caller_ID:1; /* XR1[3:3] */
  583. BYTE M_RING:1; /* XR1[4:4] */
  584. BYTE M_Cadence:1; /* XR1[5:5] */
  585. BYTE M_Wake_up:1; /* XR1[6:6] */
  586. BYTE unused:1; /* XR1[7:7] */
  587. } bitreg;
  588. } xr1;
  589. union /* XOP - XR2 Register */
  590. {
  591. BYTE reg;
  592. struct _XR2_BITREGS {
  593. BYTE CTO0:1; /* XR2[0:0] */
  594. BYTE CTO1:1; /* XR2[1:1] */
  595. BYTE CTO2:1; /* XR2[2:2] */
  596. BYTE CTO3:1; /* XR2[3:3] */
  597. BYTE CTO4:1; /* XR2[4:4] */
  598. BYTE CTO5:1; /* XR2[5:5] */
  599. BYTE CTO6:1; /* XR2[6:6] */
  600. BYTE CTO7:1; /* XR2[7:7] */
  601. } bitreg;
  602. } xr2;
  603. union /* XOP - XR3 Register */
  604. {
  605. BYTE reg;
  606. struct _XR3_BITREGS {
  607. BYTE DCR0:1; /* XR3[0:0] */
  608. BYTE DCR1:1; /* XR3[1:1] */
  609. BYTE DCI:1; /* XR3[2:2] */
  610. BYTE DCU0:1; /* XR3[3:3] */
  611. BYTE DCU1:1; /* XR3[4:4] */
  612. BYTE B_off:1; /* XR3[5:5] */
  613. BYTE AGB0:1; /* XR3[6:6] */
  614. BYTE AGB1:1; /* XR3[7:7] */
  615. } bitreg;
  616. } xr3;
  617. union /* XOP - XR4 Register */
  618. {
  619. BYTE reg;
  620. struct _XR4_BITREGS {
  621. BYTE C_0:1; /* XR4[0:0] */
  622. BYTE C_1:1; /* XR4[1:1] */
  623. BYTE C_2:1; /* XR4[2:2] */
  624. BYTE C_3:1; /* XR4[3:3] */
  625. BYTE C_4:1; /* XR4[4:4] */
  626. BYTE C_5:1; /* XR4[5:5] */
  627. BYTE C_6:1; /* XR4[6:6] */
  628. BYTE C_7:1; /* XR4[7:7] */
  629. } bitreg;
  630. } xr4;
  631. union /* XOP - XR5 Register */
  632. {
  633. BYTE reg;
  634. struct _XR5_BITREGS {
  635. BYTE T_0:1; /* XR5[0:0] */
  636. BYTE T_1:1; /* XR5[1:1] */
  637. BYTE T_2:1; /* XR5[2:2] */
  638. BYTE T_3:1; /* XR5[3:3] */
  639. BYTE T_4:1; /* XR5[4:4] */
  640. BYTE T_5:1; /* XR5[5:5] */
  641. BYTE T_6:1; /* XR5[6:6] */
  642. BYTE T_7:1; /* XR5[7:7] */
  643. } bitreg;
  644. } xr5;
  645. union /* XOP - XR6 Register - Read Values */
  646. {
  647. BYTE reg;
  648. struct _XR6_BITREGS {
  649. BYTE CPS0:1; /* XR6[0:0] */
  650. BYTE CPS1:1; /* XR6[1:1] */
  651. BYTE unused1:2; /* XR6[2:3] */
  652. BYTE CLK_OFF:1; /* XR6[4:4] */
  653. BYTE unused2:3; /* XR6[5:7] */
  654. } bitreg;
  655. } xr6;
  656. union /* XOP - XR7 Register */
  657. {
  658. BYTE reg;
  659. struct _XR7_BITREGS {
  660. BYTE unused1:1; /* XR7[0:0] */
  661. BYTE Vdd0:1; /* XR7[1:1] */
  662. BYTE Vdd1:1; /* XR7[2:2] */
  663. BYTE unused2:5; /* XR7[3:7] */
  664. } bitreg;
  665. } xr7;
  666. } XOP;
  667. BYTE ByteRegs[sizeof(struct _XOP)];
  668. } XOP_REGS;
  669. /* DAA_REGS.XOP_REGS.XOP.XR7.reg */
  670. /* DAA_REGS.XOP_REGS.XOP.XR7.bitreg */
  671. /* DAA_REGS.XOP_REGS.XOP.XR7.bitreg.Vdd0 */
  672. /* DAA_REGS.XOP_REGS.ByteRegs[7] */
  673. /*----------------------------------------------- */
  674. /* COP Registers */
  675. /* */
  676. BYTE byCOP;
  677. union _COP_REGS {
  678. struct _COP {
  679. BYTE THFilterCoeff_1[8]; /* COP - TH Filter Coefficients, CODE=0, Part 1 */
  680. BYTE THFilterCoeff_2[8]; /* COP - TH Filter Coefficients, CODE=1, Part 2 */
  681. BYTE THFilterCoeff_3[8]; /* COP - TH Filter Coefficients, CODE=2, Part 3 */
  682. BYTE RingerImpendance_1[8]; /* COP - Ringer Impendance Coefficients, CODE=3, Part 1 */
  683. BYTE IMFilterCoeff_1[8]; /* COP - IM Filter Coefficients, CODE=4, Part 1 */
  684. BYTE IMFilterCoeff_2[8]; /* COP - IM Filter Coefficients, CODE=5, Part 2 */
  685. BYTE RingerImpendance_2[8]; /* COP - Ringer Impendance Coefficients, CODE=6, Part 2 */
  686. BYTE FRRFilterCoeff[8]; /* COP - FRR Filter Coefficients, CODE=7 */
  687. BYTE FRXFilterCoeff[8]; /* COP - FRX Filter Coefficients, CODE=8 */
  688. BYTE ARFilterCoeff[4]; /* COP - AR Filter Coefficients, CODE=9 */
  689. BYTE AXFilterCoeff[4]; /* COP - AX Filter Coefficients, CODE=10 */
  690. BYTE Tone1Coeff[4]; /* COP - Tone1 Coefficients, CODE=11 */
  691. BYTE Tone2Coeff[4]; /* COP - Tone2 Coefficients, CODE=12 */
  692. BYTE LevelmeteringRinging[4]; /* COP - Levelmetering Ringing, CODE=13 */
  693. BYTE CallerID1stTone[8]; /* COP - Caller ID 1st Tone, CODE=14 */
  694. BYTE CallerID2ndTone[8]; /* COP - Caller ID 2nd Tone, CODE=15 */
  695. } COP;
  696. BYTE ByteRegs[sizeof(struct _COP)];
  697. } COP_REGS;
  698. /* DAA_REGS.COP_REGS.COP.XR7.Tone1Coeff[3] */
  699. /* DAA_REGS.COP_REGS.COP.XR7.bitreg */
  700. /* DAA_REGS.COP_REGS.COP.XR7.bitreg.Vdd0 */
  701. /* DAA_REGS.COP_REGS.ByteRegs[57] */
  702. /*----------------------------------------------- */
  703. /* CAO Registers */
  704. /* */
  705. BYTE byCAO;
  706. union _CAO_REGS {
  707. struct _CAO {
  708. BYTE CallerID[512]; /* CAO - Caller ID Bytes */
  709. } CAO;
  710. BYTE ByteRegs[sizeof(struct _CAO)];
  711. } CAO_REGS;
  712. union /* XOP - XR0 Register - Write values */
  713. {
  714. BYTE reg;
  715. struct _XR0_BITREGSW {
  716. BYTE SO_0:1; /* XR1[0:0] - Write */
  717. BYTE SO_1:1; /* XR1[1:1] - Write */
  718. BYTE SO_2:1; /* XR1[2:2] - Write */
  719. BYTE unused:5; /* XR1[3:7] - Write */
  720. } bitreg;
  721. } XOP_xr0_W;
  722. union /* XOP - XR6 Register - Write values */
  723. {
  724. BYTE reg;
  725. struct _XR6_BITREGSW {
  726. BYTE unused1:4; /* XR6[0:3] */
  727. BYTE CLK_OFF:1; /* XR6[4:4] */
  728. BYTE unused2:3; /* XR6[5:7] */
  729. } bitreg;
  730. } XOP_xr6_W;
  731. } DAA_REGS;
  732. #define ALISDAA_ID_BYTE 0x81
  733. #define ALISDAA_CALLERID_SIZE 512
  734. /*------------------------------ */
  735. /* */
  736. /* Misc definitions */
  737. /* */
  738. /* Power Up Operation */
  739. #define SOP_PU_SLEEP 0
  740. #define SOP_PU_RINGING 1
  741. #define SOP_PU_CONVERSATION 2
  742. #define SOP_PU_PULSEDIALING 3
  743. #define SOP_PU_RESET 4
  744. #define ALISDAA_CALLERID_SIZE 512
  745. #define PLAYBACK_MODE_COMPRESSED 0 /* Selects: Compressed modes, TrueSpeech 8.5-4.1, G.723.1, G.722, G.728, G.729 */
  746. #define PLAYBACK_MODE_TRUESPEECH_V40 0 /* Selects: TrueSpeech 8.5, 6.3, 5.3, 4.8 or 4.1 Kbps */
  747. #define PLAYBACK_MODE_TRUESPEECH 8 /* Selects: TrueSpeech 8.5, 6.3, 5.3, 4.8 or 4.1 Kbps Version 5.1 */
  748. #define PLAYBACK_MODE_ULAW 2 /* Selects: 64 Kbit/sec MuA-law PCM */
  749. #define PLAYBACK_MODE_ALAW 10 /* Selects: 64 Kbit/sec A-law PCM */
  750. #define PLAYBACK_MODE_16LINEAR 6 /* Selects: 128 Kbit/sec 16-bit linear */
  751. #define PLAYBACK_MODE_8LINEAR 4 /* Selects: 64 Kbit/sec 8-bit signed linear */
  752. #define PLAYBACK_MODE_8LINEAR_WSS 5 /* Selects: 64 Kbit/sec WSS 8-bit unsigned linear */
  753. #define RECORD_MODE_COMPRESSED 0 /* Selects: Compressed modes, TrueSpeech 8.5-4.1, G.723.1, G.722, G.728, G.729 */
  754. #define RECORD_MODE_TRUESPEECH 0 /* Selects: TrueSpeech 8.5, 6.3, 5.3, 4.8 or 4.1 Kbps */
  755. #define RECORD_MODE_ULAW 4 /* Selects: 64 Kbit/sec Mu-law PCM */
  756. #define RECORD_MODE_ALAW 12 /* Selects: 64 Kbit/sec A-law PCM */
  757. #define RECORD_MODE_16LINEAR 5 /* Selects: 128 Kbit/sec 16-bit linear */
  758. #define RECORD_MODE_8LINEAR 6 /* Selects: 64 Kbit/sec 8-bit signed linear */
  759. #define RECORD_MODE_8LINEAR_WSS 7 /* Selects: 64 Kbit/sec WSS 8-bit unsigned linear */
  760. enum SLIC_STATES {
  761. PLD_SLIC_STATE_OC = 0,
  762. PLD_SLIC_STATE_RINGING,
  763. PLD_SLIC_STATE_ACTIVE,
  764. PLD_SLIC_STATE_OHT,
  765. PLD_SLIC_STATE_TIPOPEN,
  766. PLD_SLIC_STATE_STANDBY,
  767. PLD_SLIC_STATE_APR,
  768. PLD_SLIC_STATE_OHTPR
  769. };
  770. enum SCI_CONTROL {
  771. SCI_End = 0,
  772. SCI_Enable_DAA,
  773. SCI_Enable_Mixer,
  774. SCI_Enable_EEPROM
  775. };
  776. enum Mode {
  777. T63, T53, T48, T40
  778. };
  779. enum Dir {
  780. V3_TO_V4, V4_TO_V3, V4_TO_V5, V5_TO_V4
  781. };
  782. typedef struct Proc_Info_Tag {
  783. enum Mode convert_mode;
  784. enum Dir convert_dir;
  785. int Prev_Frame_Type;
  786. int Current_Frame_Type;
  787. } Proc_Info_Type;
  788. enum PREVAL {
  789. NORMAL = 0,
  790. NOPOST,
  791. POSTONLY,
  792. PREERROR
  793. };
  794. enum IXJ_EXTENSIONS {
  795. G729LOADER = 0,
  796. TS85LOADER,
  797. PRE_READ,
  798. POST_READ,
  799. PRE_WRITE,
  800. POST_WRITE,
  801. PRE_IOCTL,
  802. POST_IOCTL
  803. };
  804. typedef struct {
  805. char enable;
  806. char en_filter;
  807. unsigned int filter;
  808. unsigned int state; /* State 0 when cadence has not started. */
  809. unsigned int on1; /* State 1 */
  810. unsigned long on1min; /* State 1 - 10% + jiffies */
  811. unsigned long on1dot; /* State 1 + jiffies */
  812. unsigned long on1max; /* State 1 + 10% + jiffies */
  813. unsigned int off1; /* State 2 */
  814. unsigned long off1min;
  815. unsigned long off1dot; /* State 2 + jiffies */
  816. unsigned long off1max;
  817. unsigned int on2; /* State 3 */
  818. unsigned long on2min;
  819. unsigned long on2dot;
  820. unsigned long on2max;
  821. unsigned int off2; /* State 4 */
  822. unsigned long off2min;
  823. unsigned long off2dot; /* State 4 + jiffies */
  824. unsigned long off2max;
  825. unsigned int on3; /* State 5 */
  826. unsigned long on3min;
  827. unsigned long on3dot;
  828. unsigned long on3max;
  829. unsigned int off3; /* State 6 */
  830. unsigned long off3min;
  831. unsigned long off3dot; /* State 6 + jiffies */
  832. unsigned long off3max;
  833. } IXJ_CADENCE_F;
  834. typedef struct {
  835. unsigned int busytone:1;
  836. unsigned int dialtone:1;
  837. unsigned int ringback:1;
  838. unsigned int ringing:1;
  839. unsigned int playing:1;
  840. unsigned int recording:1;
  841. unsigned int cringing:1;
  842. unsigned int play_first_frame:1;
  843. unsigned int pstn_present:1;
  844. unsigned int pstn_ringing:1;
  845. unsigned int pots_correct:1;
  846. unsigned int pots_pstn:1;
  847. unsigned int g729_loaded:1;
  848. unsigned int ts85_loaded:1;
  849. unsigned int dtmf_oob:1; /* DTMF Out-Of-Band */
  850. unsigned int pcmciascp:1; /* SmartCABLE Present */
  851. unsigned int pcmciasct:2; /* SmartCABLE Type */
  852. unsigned int pcmciastate:3; /* SmartCABLE Init State */
  853. unsigned int inwrite:1; /* Currently writing */
  854. unsigned int inread:1; /* Currently reading */
  855. unsigned int incheck:1; /* Currently checking the SmartCABLE */
  856. unsigned int cidplay:1; /* Currently playing Caller ID */
  857. unsigned int cidring:1; /* This is the ring for Caller ID */
  858. unsigned int cidsent:1; /* Caller ID has been sent */
  859. unsigned int cidcw_ack:1; /* Caller ID CW ACK (from CPE) */
  860. unsigned int firstring:1; /* First ring cadence is complete */
  861. unsigned int pstncheck:1; /* Currently checking the PSTN Line */
  862. unsigned int pstn_rmr:1;
  863. unsigned int x:3; /* unsed bits */
  864. } IXJ_FLAGS;
  865. /******************************************************************************
  866. *
  867. * This structure holds the state of all of the Quicknet cards
  868. *
  869. ******************************************************************************/
  870. typedef struct {
  871. int elements_used;
  872. IXJ_CADENCE_TERM termination;
  873. IXJ_CADENCE_ELEMENT *ce;
  874. } ixj_cadence;
  875. typedef struct {
  876. struct phone_device p;
  877. struct timer_list timer;
  878. unsigned int board;
  879. unsigned int DSPbase;
  880. unsigned int XILINXbase;
  881. unsigned int serial;
  882. atomic_t DSPWrite;
  883. struct phone_capability caplist[30];
  884. unsigned int caps;
  885. struct pnp_dev *dev;
  886. unsigned int cardtype;
  887. unsigned int rec_codec;
  888. unsigned int cid_rec_codec;
  889. unsigned int cid_rec_volume;
  890. unsigned char cid_rec_flag;
  891. signed char rec_mode;
  892. unsigned int play_codec;
  893. unsigned int cid_play_codec;
  894. unsigned int cid_play_volume;
  895. unsigned char cid_play_flag;
  896. signed char play_mode;
  897. IXJ_FLAGS flags;
  898. unsigned long busyflags;
  899. unsigned int rec_frame_size;
  900. unsigned int play_frame_size;
  901. unsigned int cid_play_frame_size;
  902. unsigned int cid_base_frame_size;
  903. unsigned long cidcw_wait;
  904. int aec_level;
  905. int cid_play_aec_level;
  906. int readers, writers;
  907. wait_queue_head_t poll_q;
  908. wait_queue_head_t read_q;
  909. char *read_buffer, *read_buffer_end;
  910. char *read_convert_buffer;
  911. size_t read_buffer_size;
  912. unsigned int read_buffer_ready;
  913. wait_queue_head_t write_q;
  914. char *write_buffer, *write_buffer_end;
  915. char *write_convert_buffer;
  916. size_t write_buffer_size;
  917. unsigned int write_buffers_empty;
  918. unsigned long drybuffer;
  919. char *write_buffer_rp, *write_buffer_wp;
  920. char dtmfbuffer[80];
  921. char dtmf_current;
  922. int dtmf_wp, dtmf_rp, dtmf_state, dtmf_proc;
  923. int tone_off_time, tone_on_time;
  924. struct fasync_struct *async_queue;
  925. unsigned long tone_start_jif;
  926. char tone_index;
  927. char tone_state;
  928. char maxrings;
  929. ixj_cadence *cadence_t;
  930. ixj_cadence *cadence_r;
  931. int tone_cadence_state;
  932. IXJ_CADENCE_F cadence_f[6];
  933. DTMF dtmf;
  934. CPTF cptf;
  935. BYTES dsp;
  936. BYTES ver;
  937. BYTES scr;
  938. BYTES ssr;
  939. BYTES baseframe;
  940. HSR hsr;
  941. GPIO gpio;
  942. PLD_SCRR pld_scrr;
  943. PLD_SCRW pld_scrw;
  944. PLD_SLICW pld_slicw;
  945. PLD_SLICR pld_slicr;
  946. PLD_CLOCK pld_clock;
  947. PCMCIA_CR1 pccr1;
  948. PCMCIA_CR2 pccr2;
  949. PCMCIA_SCCR psccr;
  950. PCMCIA_SLIC pslic;
  951. char pscdd;
  952. Si3C1 sic1;
  953. Si3C2 sic2;
  954. Si3RXG sirxg;
  955. Si3ADC siadc;
  956. Si3DAC sidac;
  957. Si3STAT sistat;
  958. Si3AATT siaatt;
  959. MIX mix;
  960. unsigned short ring_cadence;
  961. int ring_cadence_t;
  962. unsigned long ring_cadence_jif;
  963. unsigned long checkwait;
  964. int intercom;
  965. int m_hook;
  966. int r_hook;
  967. int p_hook;
  968. char pstn_envelope;
  969. char pstn_cid_intr;
  970. unsigned char fskz;
  971. unsigned char fskphase;
  972. unsigned char fskcnt;
  973. unsigned int cidsize;
  974. unsigned int cidcnt;
  975. unsigned long pstn_cid_received;
  976. PHONE_CID cid;
  977. PHONE_CID cid_send;
  978. unsigned long pstn_ring_int;
  979. unsigned long pstn_ring_start;
  980. unsigned long pstn_ring_stop;
  981. unsigned long pstn_winkstart;
  982. unsigned long pstn_last_rmr;
  983. unsigned long pstn_prev_rmr;
  984. unsigned long pots_winkstart;
  985. unsigned int winktime;
  986. unsigned long flash_end;
  987. char port;
  988. char hookstate;
  989. union telephony_exception ex;
  990. union telephony_exception ex_sig;
  991. int ixj_signals[35];
  992. IXJ_SIGDEF sigdef;
  993. char daa_mode;
  994. char daa_country;
  995. unsigned long pstn_sleeptil;
  996. DAA_REGS m_DAAShadowRegs;
  997. Proc_Info_Type Info_read;
  998. Proc_Info_Type Info_write;
  999. unsigned short frame_count;
  1000. unsigned int filter_hist[4];
  1001. unsigned char filter_en[4];
  1002. unsigned short proc_load;
  1003. unsigned long framesread;
  1004. unsigned long frameswritten;
  1005. unsigned long read_wait;
  1006. unsigned long write_wait;
  1007. unsigned long timerchecks;
  1008. unsigned long txreadycheck;
  1009. unsigned long rxreadycheck;
  1010. unsigned long statuswait;
  1011. unsigned long statuswaitfail;
  1012. unsigned long pcontrolwait;
  1013. unsigned long pcontrolwaitfail;
  1014. unsigned long iscontrolready;
  1015. unsigned long iscontrolreadyfail;
  1016. unsigned long pstnstatecheck;
  1017. #ifdef IXJ_DYN_ALLOC
  1018. short *fskdata;
  1019. #else
  1020. short fskdata[8000];
  1021. #endif
  1022. int fsksize;
  1023. int fskdcnt;
  1024. } IXJ;
  1025. typedef int (*IXJ_REGFUNC) (IXJ * j, unsigned long arg);
  1026. extern IXJ *ixj_pcmcia_probe(unsigned long, unsigned long);