ixj.h 29 KB

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