ixj.h 29 KB

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