📄 ixj.h
字号:
/****************************************************************************** * ixj.h * * * Device Driver for Quicknet Technologies, Inc.'s Telephony cards * including the Internet PhoneJACK, Internet PhoneJACK Lite, * Internet PhoneJACK PCI, Internet LineJACK, Internet PhoneCARD and * SmartCABLE * * (c) Copyright 1999-2001 Quicknet Technologies, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * * Author: Ed Okerson, <eokerson@quicknet.net> * * Contributors: Greg Herlein, <gherlein@quicknet.net> * David W. Erhart, <derhart@quicknet.net> * John Sellers, <jsellers@quicknet.net> * Mike Preston, <mpreston@quicknet.net> * * More information about the hardware related to this driver can be found * at our website: http://www.quicknet.net * * Fixes: * * IN NO EVENT SHALL QUICKNET TECHNOLOGIES, INC. BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF QUICKNET * TECHNOLOGIES, INC.HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * QUICKNET TECHNOLOGIES, INC. SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND QUICKNET TECHNOLOGIES, INC. HAS NO OBLIGATION * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. * *****************************************************************************/static char ixj_h_rcsid[] = "$Id: ixj.h,v 4.1 2001/08/04 14:49:27 craigs Exp $";#define IXJ_VERSION 3031#include <linux/types.h>#include <linux/ixjuser.h>#include <linux/phonedev.h>typedef __u16 WORD;typedef __u32 DWORD;typedef __u8 BYTE;typedef __u8 BOOL;#ifndef IXJMAX#define IXJMAX 16#endif#define TRUE 1#define FALSE 0#ifndef min#define min(a,b) (((a)<(b))?(a):(b))#endif#ifndef max#define max(a,b) (((a)>(b))?(a):(b))#endif/******************************************************************************** This structure when unioned with the structures below makes simple byte* access to the registers easier.*******************************************************************************/typedef struct { unsigned char low; unsigned char high;} BYTES;typedef union { BYTES bytes; short word;} IXJ_WORD;typedef struct{ unsigned int b0:1; unsigned int b1:1; unsigned int b2:1; unsigned int b3:1; unsigned int b4:1; unsigned int b5:1; unsigned int b6:1; unsigned int b7:1;} IXJ_CBITS;typedef union{ IXJ_CBITS cbits; char cbyte;} IXJ_CBYTE;/******************************************************************************** This structure represents the Hardware Control Register of the CT8020/8021* The CT8020 is used in the Internet PhoneJACK, and the 8021 in the* Internet LineJACK*******************************************************************************/typedef struct { unsigned int rxrdy:1; unsigned int txrdy:1; unsigned int status:1; unsigned int auxstatus:1; unsigned int rxdma:1; unsigned int txdma:1; unsigned int rxburst:1; unsigned int txburst:1; unsigned int dmadir:1; unsigned int cont:1; unsigned int irqn:1; unsigned int t:5;} HCRBIT;typedef union { HCRBIT bits; BYTES bytes;} HCR;/******************************************************************************** This structure represents the Hardware Status Register of the CT8020/8021* The CT8020 is used in the Internet PhoneJACK, and the 8021 in the* Internet LineJACK*******************************************************************************/typedef struct { unsigned int controlrdy:1; unsigned int auxctlrdy:1; unsigned int statusrdy:1; unsigned int auxstatusrdy:1; unsigned int rxrdy:1; unsigned int txrdy:1; unsigned int restart:1; unsigned int irqn:1; unsigned int rxdma:1; unsigned int txdma:1; unsigned int cohostshutdown:1; unsigned int t:5;} HSRBIT;typedef union { HSRBIT bits; BYTES bytes;} HSR;/******************************************************************************** This structure represents the General Purpose IO Register of the CT8020/8021* The CT8020 is used in the Internet PhoneJACK, and the 8021 in the* Internet LineJACK*******************************************************************************/typedef struct { unsigned int x:1; unsigned int gpio1:1; unsigned int gpio2:1; unsigned int gpio3:1; unsigned int gpio4:1; unsigned int gpio5:1; unsigned int gpio6:1; unsigned int gpio7:1; unsigned int xread:1; unsigned int gpio1read:1; unsigned int gpio2read:1; unsigned int gpio3read:1; unsigned int gpio4read:1; unsigned int gpio5read:1; unsigned int gpio6read:1; unsigned int gpio7read:1;} GPIOBIT;typedef union { GPIOBIT bits; BYTES bytes; unsigned short word;} GPIO;/******************************************************************************** This structure represents the Line Monitor status response*******************************************************************************/typedef struct { unsigned int digit:4; unsigned int cpf_valid:1; unsigned int dtmf_valid:1; unsigned int peak:1; unsigned int z:1; unsigned int f0:1; unsigned int f1:1; unsigned int f2:1; unsigned int f3:1; unsigned int frame:4;} LMON;typedef union { LMON bits; BYTES bytes;} DTMF;typedef struct { unsigned int z:7; unsigned int dtmf_en:1; unsigned int y:4; unsigned int F3:1; unsigned int F2:1; unsigned int F1:1; unsigned int F0:1;} CP;typedef union { CP bits; BYTES bytes;} CPTF;/******************************************************************************** This structure represents the Status Control Register on the Internet* LineJACK*******************************************************************************/typedef struct { unsigned int c0:1; unsigned int c1:1; unsigned int stereo:1; unsigned int daafsyncen:1; unsigned int led1:1; unsigned int led2:1; unsigned int led3:1; unsigned int led4:1;} PSCRWI; /* Internet LineJACK and Internet PhoneJACK Lite */typedef struct { unsigned int eidp:1; unsigned int eisd:1; unsigned int x:6;} PSCRWP; /* Internet PhoneJACK PCI */typedef union { PSCRWI bits; PSCRWP pcib; char byte;} PLD_SCRW;typedef struct { unsigned int c0:1; unsigned int c1:1; unsigned int x:1; unsigned int d0ee:1; unsigned int mixerbusy:1; unsigned int sci:1; unsigned int dspflag:1; unsigned int daaflag:1;} PSCRRI;typedef struct { unsigned int eidp:1; unsigned int eisd:1; unsigned int x:4; unsigned int dspflag:1; unsigned int det:1;} PSCRRP;typedef union { PSCRRI bits; PSCRRP pcib; char byte;} PLD_SCRR;/******************************************************************************** These structures represents the SLIC Control Register on the* Internet LineJACK*******************************************************************************/typedef struct { unsigned int c1:1; unsigned int c2:1; unsigned int c3:1; unsigned int b2en:1; unsigned int spken:1; unsigned int rly1:1; unsigned int rly2:1; unsigned int rly3:1;} PSLICWRITE;typedef struct { unsigned int state:3; unsigned int b2en:1; unsigned int spken:1; unsigned int c3:1; unsigned int potspstn:1; unsigned int det:1;} PSLICREAD;typedef struct { unsigned int c1:1; unsigned int c2:1; unsigned int c3:1; unsigned int b2en:1; unsigned int e1:1; unsigned int mic:1; unsigned int spk:1; unsigned int x:1;} PSLICPCI;typedef union { PSLICPCI pcib; PSLICWRITE bits; PSLICREAD slic; char byte;} PLD_SLICW;typedef union { PSLICPCI pcib; PSLICREAD bits; char byte;} PLD_SLICR;/******************************************************************************** These structures represents the Clock Control Register on the* Internet LineJACK*******************************************************************************/typedef struct { unsigned int clk0:1; unsigned int clk1:1; unsigned int clk2:1; unsigned int x0:1; unsigned int slic_e1:1; unsigned int x1:1; unsigned int x2:1; unsigned int x3:1;} PCLOCK;typedef union { PCLOCK bits; char byte;} PLD_CLOCK;/******************************************************************************** These structures deal with the mixer on the Internet LineJACK*******************************************************************************/typedef struct { unsigned short vol[10]; unsigned int recsrc; unsigned int modcnt; unsigned short micpreamp;} MIX;/******************************************************************************** These structures deal with the control logic on the Internet PhoneCARD*******************************************************************************/typedef struct { unsigned int x0:4; /* unused bits */ unsigned int ed:1; /* Event Detect */ unsigned int drf:1; /* SmartCABLE Removal Flag 1=no cable */ unsigned int dspf:1; /* DSP Flag 1=DSP Ready */ unsigned int crr:1; /* Control Register Ready */} COMMAND_REG1;typedef union { COMMAND_REG1 bits; unsigned char byte;} PCMCIA_CR1;typedef struct { unsigned int x0:4; /* unused bits */ unsigned int rstc:1; /* SmartCABLE Reset */ unsigned int pwr:1; /* SmartCABLE Power */ unsigned int x1:2; /* unused bits */} COMMAND_REG2;typedef union { COMMAND_REG2 bits; unsigned char byte;} PCMCIA_CR2;typedef struct { unsigned int addr:5; /* R/W SmartCABLE Register Address */ unsigned int rw:1; /* Read / Write flag */ unsigned int dev:2; /* 2 bit SmartCABLE Device Address */} CONTROL_REG;typedef union { CONTROL_REG bits; unsigned char byte;} PCMCIA_SCCR;typedef struct { unsigned int hsw:1; unsigned int det:1; unsigned int led2:1; unsigned int led1:1; unsigned int ring1:1; unsigned int ring0:1; unsigned int x:1; unsigned int powerdown:1;} PCMCIA_SLIC_REG;typedef union { PCMCIA_SLIC_REG bits; unsigned char byte;} PCMCIA_SLIC;typedef struct { unsigned int cpd:1; /* Chip Power Down */ unsigned int mpd:1; /* MIC Bias Power Down */ unsigned int hpd:1; /* Handset Drive Power Down */ unsigned int lpd:1; /* Line Drive Power Down */ unsigned int spd:1; /* Speaker Drive Power Down */ unsigned int x:2; /* unused bits */ unsigned int sr:1; /* Software Reset */} Si3CONTROL1;typedef union { Si3CONTROL1 bits; unsigned char byte;} Si3C1;typedef struct { unsigned int al:1; /* Analog Loopback DAC analog -> ADC analog */ unsigned int dl2:1; /* Digital Loopback DAC -> ADC one bit */ unsigned int dl1:1; /* Digital Loopback ADC -> DAC one bit */ unsigned int pll:1; /* 1 = div 10, 0 = div 5 */ unsigned int hpd:1; /* HPF disable */ unsigned int x:3; /* unused bits */} Si3CONTROL2;typedef union { Si3CONTROL2 bits; unsigned char byte;} Si3C2;typedef struct { unsigned int iir:1; /* 1 enables IIR, 0 enables FIR */ unsigned int him:1; /* Handset Input Mute */ unsigned int mcm:1; /* MIC In Mute */ unsigned int mcg:2; /* MIC In Gain */ unsigned int lim:1; /* Line In Mute */ unsigned int lig:2; /* Line In Gain */} Si3RXGAIN;typedef union { Si3RXGAIN bits; unsigned char byte;} Si3RXG;typedef struct { unsigned int hom:1; /* Handset Out Mute */ unsigned int lom:1; /* Line Out Mute */ unsigned int rxg:5; /* RX PGA Gain */ unsigned int x:1; /* unused bit */} Si3ADCVOLUME;typedef union { Si3ADCVOLUME bits; unsigned char byte;} Si3ADC;typedef struct { unsigned int srm:1; /* Speaker Right Mute */ unsigned int slm:1; /* Speaker Left Mute */ unsigned int txg:5; /* TX PGA Gain */ unsigned int x:1; /* unused bit */} Si3DACVOLUME;typedef union { Si3DACVOLUME bits; unsigned char byte;} Si3DAC;typedef struct { unsigned int x:5; /* unused bit */ unsigned int losc:1; /* Line Out Short Circuit */ unsigned int srsc:1; /* Speaker Right Short Circuit */ unsigned int slsc:1; /* Speaker Left Short Circuit */} Si3STATUSREPORT;typedef union { Si3STATUSREPORT bits; unsigned char byte;} Si3STAT;typedef struct { unsigned int sot:2; /* Speaker Out Attenuation */ unsigned int lot:2; /* Line Out Attenuation */ unsigned int x:4; /* unused bits */} Si3ANALOGATTN;typedef union { Si3ANALOGATTN bits; unsigned char byte;} Si3AATT;/******************************************************************************** These structures deal with the DAA on the Internet LineJACK*******************************************************************************/typedef struct _DAA_REGS { /*----------------------------------------------- */ /* SOP Registers */ /* */ BYTE bySOP; union _SOP_REGS { struct _SOP { union /* SOP - CR0 Register */ { BYTE reg; struct _CR0_BITREGS { BYTE CLK_EXT:1; /* cr0[0:0] */ BYTE RIP:1; /* cr0[1:1] */ BYTE AR:1; /* cr0[2:2] */ BYTE AX:1; /* cr0[3:3] */ BYTE FRR:1; /* cr0[4:4] */ BYTE FRX:1; /* cr0[5:5] */ BYTE IM:1; /* cr0[6:6] */ BYTE TH:1; /* cr0[7:7] */ } bitreg; } cr0; union /* SOP - CR1 Register */ { BYTE reg; struct _CR1_REGS { BYTE RM:1; /* cr1[0:0] */ BYTE RMR:1; /* cr1[1:1] */ BYTE No_auto:1; /* cr1[2:2] */ BYTE Pulse:1; /* cr1[3:3] */ BYTE P_Tone1:1; /* cr1[4:4] */ BYTE P_Tone2:1; /* cr1[5:5] */ BYTE E_Tone1:1; /* cr1[6:6] */ BYTE E_Tone2:1; /* cr1[7:7] */ } bitreg; } cr1; union /* SOP - CR2 Register */ { BYTE reg; struct _CR2_REGS { BYTE Call_II:1; /* CR2[0:0] */ BYTE Call_I:1; /* CR2[1:1] */ BYTE Call_en:1; /* CR2[2:2] */ BYTE Call_pon:1; /* CR2[3:3] */ BYTE IDR:1; /* CR2[4:4] */ BYTE COT_R:3; /* CR2[5:7] */ } bitreg; } cr2; union /* SOP - CR3 Register */ { BYTE reg; struct _CR3_REGS { BYTE DHP_X:1; /* CR3[0:0] */ BYTE DHP_R:1; /* CR3[1:1] */ BYTE Cal_pctl:1; /* CR3[2:2] */ BYTE SEL:1; /* CR3[3:3] */ BYTE TestLoops:4; /* CR3[4:7] */ } bitreg; } cr3; union /* SOP - CR4 Register */ { BYTE reg; struct _CR4_REGS { BYTE Fsc_en:1; /* CR4[0:0] */ BYTE Int_en:1; /* CR4[1:1] */ BYTE AGX:2; /* CR4[2:3] */ BYTE AGR_R:2; /* CR4[4:5] */ BYTE AGR_Z:2; /* CR4[6:7] */ } bitreg; } cr4; union /* SOP - CR5 Register */ { BYTE reg;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -