ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / drivers / isdn / hardware / eicon / io.h
1
2 /*
3  *
4   Copyright (c) Eicon Networks, 2002.
5  *
6   This source file is supplied for the use with
7   Eicon Networks range of DIVA Server Adapters.
8  *
9   Eicon File Revision :    2.1
10  *
11   This program is free software; you can redistribute it and/or modify
12   it under the terms of the GNU General Public License as published by
13   the Free Software Foundation; either version 2, or (at your option)
14   any later version.
15  *
16   This program is distributed in the hope that it will be useful,
17   but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
18   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19   See the GNU General Public License for more details.
20  *
21   You should have received a copy of the GNU General Public License
22   along with this program; if not, write to the Free Software
23   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  *
25  */
26 #ifndef __DIVA_XDI_COMMON_IO_H_INC__ /* { */
27 #define __DIVA_XDI_COMMON_IO_H_INC__
28 /*
29  maximum = 16 adapters
30  */
31 #define DI_MAX_LINKS    MAX_ADAPTER
32 #define ISDN_MAX_NUM_LEN 60
33 /* --------------------------------------------------------------------------
34   structure for quadro card management (obsolete for
35   systems that do provide per card load event)
36   -------------------------------------------------------------------------- */
37 typedef struct {
38  dword         Num ;
39  DEVICE_NAME   DeviceName[4] ;
40  PISDN_ADAPTER QuadroAdapter[4] ;
41 } ADAPTER_LIST_ENTRY, *PADAPTER_LIST_ENTRY ;
42 /* --------------------------------------------------------------------------
43   Configuration of XDI clients carried by XDI
44   -------------------------------------------------------------------------- */
45 #define DIVA_XDI_CAPI_CFG_1_DYNAMIC_L1_ON      0x01
46 #define DIVA_XDI_CAPI_CFG_1_GROUP_POPTIMIZATION_ON 0x02
47 typedef struct _diva_xdi_capi_cfg {
48   byte cfg_1;
49 } diva_xdi_capi_cfg_t;
50 /* --------------------------------------------------------------------------
51   Main data structure kept per adapter
52   -------------------------------------------------------------------------- */
53 struct _ISDN_ADAPTER {
54  void             (* DIRequest)(PISDN_ADAPTER, ENTITY *) ;
55  int                 Initialized ;
56  int         RegisteredWithDidd ;
57  int                 Unavailable ;  /* callback function possible? */
58  int         ResourcesClaimed ;
59  int         PnpBiosConfigUsed ;
60  dword        Logging ;
61  dword        features ;
62  char        ProtocolIdString[80] ;
63  /*
64   remember mapped memory areas
65  */
66  CARD_PROPERTIES     Properties ;
67  dword               cardType ;
68  dword               protocol_id ;       /* configured protocol identifier */
69  char                protocol_name[8] ;  /* readable name of protocol */
70  dword               BusType ;
71  dword               BusNumber ;
72  dword               slotNumber ;
73  dword               slotId ;
74  dword               ControllerNumber ;  /* for QUADRO cards only */
75  PISDN_ADAPTER       MultiMaster ;       /* for 4-BRI card only - use MultiMaster or QuadroList */
76  PADAPTER_LIST_ENTRY QuadroList ;        /* for QUADRO card  only */
77  PDEVICE_OBJECT      DeviceObject ;
78  dword               DeviceId ;
79  diva_os_adapter_irq_info_t irq_info;
80  dword volatile      IrqCount ;
81  int                 trapped ;
82  dword               DspCodeBaseAddr ;
83  dword               MaxDspCodeSize ;
84  dword               downloadAddr ;
85  dword               DspCodeBaseAddrTable[4] ; /* add. for MultiMaster */
86  dword               MaxDspCodeSizeTable[4] ; /* add. for MultiMaster */
87  dword               downloadAddrTable[4] ; /* add. for MultiMaster */
88  dword               MemoryBase ;
89  dword               MemorySize ;
90  byte       *Address ;
91  byte                *Config ;
92  byte                *Control ;
93  byte       *reset ;
94  byte       *port ;
95  byte       *ram ;
96  byte       *cfg ;
97  byte       *prom ;
98  byte       *ctlReg ;
99  struct pc_maint  *pcm ;
100  diva_os_dependent_devica_name_t os_name;
101  byte                Name[32] ;
102  dword               serialNo ;
103  dword               ANum ;
104  dword               ArchiveType ; /* ARCHIVE_TYPE_NONE ..._SINGLE ..._USGEN ..._MULTI */
105  char               *ProtocolSuffix ; /* internal protocolfile table */
106  char                Archive[32] ;
107  char                Protocol[32] ;
108  char                Oad1[ISDN_MAX_NUM_LEN] ;
109  char                Osa1[ISDN_MAX_NUM_LEN] ;
110  char                Oad2[ISDN_MAX_NUM_LEN] ;
111  char                Osa2[ISDN_MAX_NUM_LEN] ;
112  char                Spid1[ISDN_MAX_NUM_LEN] ;
113  char                Spid2[ISDN_MAX_NUM_LEN] ;
114   byte                nosig ;
115   byte                BriLayer2LinkCount ; /* amount of TEI's that adapter will support in P2MP mode */
116  dword               Channels ;
117  dword               tei ;
118  dword               nt2 ;
119  dword               TerminalCount ;
120  dword               WatchDog ;
121  dword               Permanent ;
122  dword               BChMask ; /* B channel mask for unchannelized modes */
123  dword               StableL2 ;
124  dword               DidLen ;
125  dword               NoOrderCheck ;
126  dword               ForceLaw; /* VoiceCoding - default:0, a-law: 1, my-law: 2 */
127  dword               SigFlags ;
128  dword               LowChannel ;
129  dword               NoHscx30 ;
130  dword               ProtVersion ;
131  dword               crc4 ;
132  dword               L1TristateOrQsig ; /* enable Layer 1 Tristate (bit 2)Or Qsig params (bit 0,1)*/
133  dword               InitialDspInfo ;
134  dword               ModemGuardTone ;
135  dword               ModemMinSpeed ;
136  dword               ModemMaxSpeed ;
137  dword               ModemOptions ;
138  dword               ModemOptions2 ;
139  dword               ModemNegotiationMode ;
140  dword               ModemModulationsMask ;
141  dword               ModemTransmitLevel ;
142  dword               FaxOptions ;
143  dword               FaxMaxSpeed ;
144  dword               Part68LevelLimiter ;
145  dword               UsEktsNumCallApp ;
146  byte                UsEktsFeatAddConf ;
147  byte                UsEktsFeatRemoveConf ;
148  byte                UsEktsFeatCallTransfer ;
149  byte                UsEktsFeatMsgWaiting ;
150  byte                QsigDialect;
151  byte                ForceVoiceMailAlert;
152  byte                DisableAutoSpid;
153  byte                ModemCarrierWaitTimeSec;
154  byte                ModemCarrierLossWaitTimeTenthSec;
155  byte                PiafsLinkTurnaroundInFrames;
156  word                QsigFeatures;
157  dword               GenerateRingtone ;
158  diva_os_spin_lock_t isr_spin_lock;
159  diva_os_spin_lock_t data_spin_lock;
160  diva_os_soft_isr_t req_soft_isr;
161  diva_os_soft_isr_t isr_soft_isr;
162  diva_os_atomic_t  in_dpc;
163  PBUFFER             RBuffer;        /* Copy of receive lookahead buffer */
164  word                e_max;
165  word                e_count;
166  E_INFO             *e_tbl;
167  word                assign;         /* list of pending ASSIGNs  */
168  word                head;           /* head of request queue    */
169  word                tail;           /* tail of request queue    */
170  ADAPTER             a ;             /* not a separate structure */
171  void        (* out)(ADAPTER * a) ;
172  byte        (* dpc)(ADAPTER * a) ;
173  byte        (* tst_irq)(ADAPTER * a) ;
174  void        (* clr_irq)(ADAPTER * a) ;
175  int         (* load)(PISDN_ADAPTER) ;
176  int         (* mapmem)(PISDN_ADAPTER) ;
177  int         (* chkIrq)(PISDN_ADAPTER) ;
178  void        (* disIrq)(PISDN_ADAPTER) ;
179  void        (* start)(PISDN_ADAPTER) ;
180  void        (* stop)(PISDN_ADAPTER) ;
181  void        (* rstFnc)(PISDN_ADAPTER) ;
182  void        (* trapFnc)(PISDN_ADAPTER) ;
183  void        (* os_trap_nfy_Fnc)(PISDN_ADAPTER, dword) ;
184  diva_os_isr_callback_t diva_isr_handler;
185  dword               sdram_bar;
186  dword               fpga_features;
187  volatile int        pcm_pending;
188  volatile unsigned long      pcm_data;
189  diva_xdi_capi_cfg_t capi_cfg;
190  dword               tasks;
191  void*               dma_map;
192 };
193 /* ---------------------------------------------------------------------
194   Entity table
195    --------------------------------------------------------------------- */
196 struct e_info_s {
197   ENTITY *      e;
198   byte          next;                   /* chaining index           */
199   word          assign_ref;             /* assign reference         */
200 };
201 /* ---------------------------------------------------------------------
202   S-cards shared ram structure for loading
203    --------------------------------------------------------------------- */
204 struct s_load {
205  byte ctrl;
206  byte card;
207  byte msize;
208  byte fill0;
209  word ebit;
210  word elocl;
211  word eloch;
212  byte reserved[20];
213  word signature;
214  byte fill[224];
215  byte b[256];
216 };
217 #define PR_RAM  ((struct pr_ram *)0)
218 #define RAM ((struct dual *)0)
219 /* ---------------------------------------------------------------------
220   Functions for port io
221    --------------------------------------------------------------------- */
222 void outp_words_from_buffer (word* adr, byte* P, word len);
223 void inp_words_to_buffer  (word* adr, byte* P, word len);
224 /* ---------------------------------------------------------------------
225   platform specific conversions
226    --------------------------------------------------------------------- */
227 extern void * PTR_P(ADAPTER * a, ENTITY * e, void * P);
228 extern void * PTR_X(ADAPTER * a, ENTITY * e);
229 extern void * PTR_R(ADAPTER * a, ENTITY * e);
230 extern void CALLBACK(ADAPTER * a, ENTITY * e);
231 extern void set_ram(void * * adr_ptr);
232 /* ---------------------------------------------------------------------
233   ram access functions for io mapped cards
234    --------------------------------------------------------------------- */
235 byte io_in(ADAPTER * a, void * adr);
236 word io_inw(ADAPTER * a, void * adr);
237 void io_in_buffer(ADAPTER * a, void * adr, void * P, word length);
238 void io_look_ahead(ADAPTER * a, PBUFFER * RBuffer, ENTITY * e);
239 void io_out(ADAPTER * a, void * adr, byte data);
240 void io_outw(ADAPTER * a, void * adr, word data);
241 void io_out_buffer(ADAPTER * a, void * adr, void * P, word length);
242 void io_inc(ADAPTER * a, void * adr);
243 /* ---------------------------------------------------------------------
244   ram access functions for memory mapped cards
245    --------------------------------------------------------------------- */
246 byte mem_in(ADAPTER * a, void * adr);
247 word mem_inw(ADAPTER * a, void * adr);
248 void mem_in_buffer(ADAPTER * a, void * adr, void * P, word length);
249 void mem_look_ahead(ADAPTER * a, PBUFFER * RBuffer, ENTITY * e);
250 void mem_out(ADAPTER * a, void * adr, byte data);
251 void mem_outw(ADAPTER * a, void * adr, word data);
252 void mem_out_buffer(ADAPTER * a, void * adr, void * P, word length);
253 void mem_inc(ADAPTER * a, void * adr);
254 void mem_in_dw (ADAPTER *a, void *addr, dword* data, int dwords);
255 void mem_out_dw (ADAPTER *a, void *addr, const dword* data, int dwords);
256 /* ---------------------------------------------------------------------
257   functions exported by io.c
258    --------------------------------------------------------------------- */
259 extern IDI_CALL Requests[MAX_ADAPTER] ;
260 extern void     DIDpcRoutine (struct _diva_os_soft_isr* psoft_isr,
261                void* context);
262 extern void     request (PISDN_ADAPTER, ENTITY *) ;
263 /* ---------------------------------------------------------------------
264   trapFn helpers, used to recover debug trace from dead card
265    --------------------------------------------------------------------- */
266 typedef struct {
267  word *buf ;
268  word  cnt ;
269  word  out ;
270 } Xdesc ;
271 extern void     dump_trap_frame  (PISDN_ADAPTER IoAdapter, byte *exception) ;
272 extern void     dump_xlog_buffer (PISDN_ADAPTER IoAdapter, Xdesc *xlogDesc) ;
273 /* --------------------------------------------------------------------- */
274 #endif  /* } __DIVA_XDI_COMMON_IO_H_INC__ */