Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[linux/fpc-iii.git] / drivers / isdn / hardware / eicon / io.h
blob01deced18ab83634aa761e748b02ee31cab9482a
2 /*
4 Copyright (c) Eicon Networks, 2002.
6 This source file is supplied for the use with
7 Eicon Networks range of DIVA Server Adapters.
9 Eicon File Revision : 2.1
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.
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.
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.
26 #ifndef __DIVA_XDI_COMMON_IO_H_INC__ /* { */
27 #define __DIVA_XDI_COMMON_IO_H_INC__
29 maximum = 16 adapters
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 Special OS memory support structures
44 -------------------------------------------------------------------------- */
45 #define MAX_MAPPED_ENTRIES 8
46 typedef struct {
47 void *Address;
48 dword Length;
49 } ADAPTER_MEMORY;
50 /* --------------------------------------------------------------------------
51 Configuration of XDI clients carried by XDI
52 -------------------------------------------------------------------------- */
53 #define DIVA_XDI_CAPI_CFG_1_DYNAMIC_L1_ON 0x01
54 #define DIVA_XDI_CAPI_CFG_1_GROUP_POPTIMIZATION_ON 0x02
55 typedef struct _diva_xdi_capi_cfg {
56 byte cfg_1;
57 } diva_xdi_capi_cfg_t;
58 /* --------------------------------------------------------------------------
59 Main data structure kept per adapter
60 -------------------------------------------------------------------------- */
61 struct _ISDN_ADAPTER {
62 void (*DIRequest)(PISDN_ADAPTER, ENTITY *);
63 int State; /* from NT4 1.srv, a good idea, but a poor achievement */
64 int Initialized;
65 int RegisteredWithDidd;
66 int Unavailable; /* callback function possible? */
67 int ResourcesClaimed;
68 int PnpBiosConfigUsed;
69 dword Logging;
70 dword features;
71 char ProtocolIdString[80];
73 remember mapped memory areas
75 ADAPTER_MEMORY MappedMemory[MAX_MAPPED_ENTRIES];
76 CARD_PROPERTIES Properties;
77 dword cardType;
78 dword protocol_id; /* configured protocol identifier */
79 char protocol_name[8]; /* readable name of protocol */
80 dword BusType;
81 dword BusNumber;
82 dword slotNumber;
83 dword slotId;
84 dword ControllerNumber; /* for QUADRO cards only */
85 PISDN_ADAPTER MultiMaster; /* for 4-BRI card only - use MultiMaster or QuadroList */
86 PADAPTER_LIST_ENTRY QuadroList; /* for QUADRO card only */
87 PDEVICE_OBJECT DeviceObject;
88 dword DeviceId;
89 diva_os_adapter_irq_info_t irq_info;
90 dword volatile IrqCount;
91 int trapped;
92 dword DspCodeBaseAddr;
93 dword MaxDspCodeSize;
94 dword downloadAddr;
95 dword DspCodeBaseAddrTable[4]; /* add. for MultiMaster */
96 dword MaxDspCodeSizeTable[4]; /* add. for MultiMaster */
97 dword downloadAddrTable[4]; /* add. for MultiMaster */
98 dword MemoryBase;
99 dword MemorySize;
100 byte __iomem *Address;
101 byte __iomem *Config;
102 byte __iomem *Control;
103 byte __iomem *reset;
104 byte __iomem *port;
105 byte __iomem *ram;
106 byte __iomem *cfg;
107 byte __iomem *prom;
108 byte __iomem *ctlReg;
109 struct pc_maint *pcm;
110 diva_os_dependent_devica_name_t os_name;
111 byte Name[32];
112 dword serialNo;
113 dword ANum;
114 dword ArchiveType; /* ARCHIVE_TYPE_NONE ..._SINGLE ..._USGEN ..._MULTI */
115 char *ProtocolSuffix; /* internal protocolfile table */
116 char Archive[32];
117 char Protocol[32];
118 char AddDownload[32]; /* Dsp- or other additional download files */
119 char Oad1[ISDN_MAX_NUM_LEN];
120 char Osa1[ISDN_MAX_NUM_LEN];
121 char Oad2[ISDN_MAX_NUM_LEN];
122 char Osa2[ISDN_MAX_NUM_LEN];
123 char Spid1[ISDN_MAX_NUM_LEN];
124 char Spid2[ISDN_MAX_NUM_LEN];
125 byte nosig;
126 byte BriLayer2LinkCount; /* amount of TEI's that adapter will support in P2MP mode */
127 dword Channels;
128 dword tei;
129 dword nt2;
130 dword TerminalCount;
131 dword WatchDog;
132 dword Permanent;
133 dword BChMask; /* B channel mask for unchannelized modes */
134 dword StableL2;
135 dword DidLen;
136 dword NoOrderCheck;
137 dword ForceLaw; /* VoiceCoding - default:0, a-law: 1, my-law: 2 */
138 dword SigFlags;
139 dword LowChannel;
140 dword NoHscx30;
141 dword ProtVersion;
142 dword crc4;
143 dword L1TristateOrQsig; /* enable Layer 1 Tristate (bit 2)Or Qsig params (bit 0,1)*/
144 dword InitialDspInfo;
145 dword ModemGuardTone;
146 dword ModemMinSpeed;
147 dword ModemMaxSpeed;
148 dword ModemOptions;
149 dword ModemOptions2;
150 dword ModemNegotiationMode;
151 dword ModemModulationsMask;
152 dword ModemTransmitLevel;
153 dword FaxOptions;
154 dword FaxMaxSpeed;
155 dword Part68LevelLimiter;
156 dword UsEktsNumCallApp;
157 byte UsEktsFeatAddConf;
158 byte UsEktsFeatRemoveConf;
159 byte UsEktsFeatCallTransfer;
160 byte UsEktsFeatMsgWaiting;
161 byte QsigDialect;
162 byte ForceVoiceMailAlert;
163 byte DisableAutoSpid;
164 byte ModemCarrierWaitTimeSec;
165 byte ModemCarrierLossWaitTimeTenthSec;
166 byte PiafsLinkTurnaroundInFrames;
167 byte DiscAfterProgress;
168 byte AniDniLimiter[3];
169 byte TxAttenuation; /* PRI/E1 only: attenuate TX signal */
170 word QsigFeatures;
171 dword GenerateRingtone;
172 dword SupplementaryServicesFeatures;
173 dword R2Dialect;
174 dword R2CasOptions;
175 dword FaxV34Options;
176 dword DisabledDspMask;
177 dword AdapterTestMask;
178 dword DspImageLength;
179 word AlertToIn20mSecTicks;
180 word ModemEyeSetup;
181 byte R2CtryLength;
182 byte CCBSRelTimer;
183 byte *PcCfgBufferFile;/* flexible parameter via file */
184 byte *PcCfgBuffer; /* flexible parameter via multistring */
185 diva_os_dump_file_t dump_file; /* dump memory to file at lowest irq level */
186 diva_os_board_trace_t board_trace; /* traces from the board */
187 diva_os_spin_lock_t isr_spin_lock;
188 diva_os_spin_lock_t data_spin_lock;
189 diva_os_soft_isr_t req_soft_isr;
190 diva_os_soft_isr_t isr_soft_isr;
191 diva_os_atomic_t in_dpc;
192 PBUFFER RBuffer; /* Copy of receive lookahead buffer */
193 word e_max;
194 word e_count;
195 E_INFO *e_tbl;
196 word assign; /* list of pending ASSIGNs */
197 word head; /* head of request queue */
198 word tail; /* tail of request queue */
199 ADAPTER a; /* not a separate structure */
200 void (*out)(ADAPTER *a);
201 byte (*dpc)(ADAPTER *a);
202 byte (*tst_irq)(ADAPTER *a);
203 void (*clr_irq)(ADAPTER *a);
204 int (*load)(PISDN_ADAPTER);
205 int (*mapmem)(PISDN_ADAPTER);
206 int (*chkIrq)(PISDN_ADAPTER);
207 void (*disIrq)(PISDN_ADAPTER);
208 void (*start)(PISDN_ADAPTER);
209 void (*stop)(PISDN_ADAPTER);
210 void (*rstFnc)(PISDN_ADAPTER);
211 void (*trapFnc)(PISDN_ADAPTER);
212 dword (*DetectDsps)(PISDN_ADAPTER);
213 void (*os_trap_nfy_Fnc)(PISDN_ADAPTER, dword);
214 diva_os_isr_callback_t diva_isr_handler;
215 dword sdram_bar; /* must be 32 bit */
216 dword fpga_features;
217 volatile int pcm_pending;
218 volatile void *pcm_data;
219 diva_xdi_capi_cfg_t capi_cfg;
220 dword tasks;
221 void *dma_map;
222 int (*DivaAdapterTestProc)(PISDN_ADAPTER);
223 void *AdapterTestMemoryStart;
224 dword AdapterTestMemoryLength;
225 const byte *cfg_lib_memory_init;
226 dword cfg_lib_memory_init_length;
228 /* ---------------------------------------------------------------------
229 Entity table
230 --------------------------------------------------------------------- */
231 struct e_info_s {
232 ENTITY *e;
233 byte next; /* chaining index */
234 word assign_ref; /* assign reference */
236 /* ---------------------------------------------------------------------
237 S-cards shared ram structure for loading
238 --------------------------------------------------------------------- */
239 struct s_load {
240 byte ctrl;
241 byte card;
242 byte msize;
243 byte fill0;
244 word ebit;
245 word elocl;
246 word eloch;
247 byte reserved[20];
248 word signature;
249 byte fill[224];
250 byte b[256];
252 #define PR_RAM ((struct pr_ram *)0)
253 #define RAM ((struct dual *)0)
254 /* ---------------------------------------------------------------------
255 platform specific conversions
256 --------------------------------------------------------------------- */
257 extern void *PTR_P(ADAPTER *a, ENTITY *e, void *P);
258 extern void *PTR_X(ADAPTER *a, ENTITY *e);
259 extern void *PTR_R(ADAPTER *a, ENTITY *e);
260 extern void CALLBACK(ADAPTER *a, ENTITY *e);
261 extern void set_ram(void **adr_ptr);
262 /* ---------------------------------------------------------------------
263 ram access functions for io mapped cards
264 --------------------------------------------------------------------- */
265 byte io_in(ADAPTER *a, void *adr);
266 word io_inw(ADAPTER *a, void *adr);
267 void io_in_buffer(ADAPTER *a, void *adr, void *P, word length);
268 void io_look_ahead(ADAPTER *a, PBUFFER *RBuffer, ENTITY *e);
269 void io_out(ADAPTER *a, void *adr, byte data);
270 void io_outw(ADAPTER *a, void *adr, word data);
271 void io_out_buffer(ADAPTER *a, void *adr, void *P, word length);
272 void io_inc(ADAPTER *a, void *adr);
273 void bri_in_buffer(PISDN_ADAPTER IoAdapter, dword Pos,
274 void *Buf, dword Len);
275 int bri_out_buffer(PISDN_ADAPTER IoAdapter, dword Pos,
276 void *Buf, dword Len, int Verify);
277 /* ---------------------------------------------------------------------
278 ram access functions for memory mapped cards
279 --------------------------------------------------------------------- */
280 byte mem_in(ADAPTER *a, void *adr);
281 word mem_inw(ADAPTER *a, void *adr);
282 void mem_in_buffer(ADAPTER *a, void *adr, void *P, word length);
283 void mem_look_ahead(ADAPTER *a, PBUFFER *RBuffer, ENTITY *e);
284 void mem_out(ADAPTER *a, void *adr, byte data);
285 void mem_outw(ADAPTER *a, void *adr, word data);
286 void mem_out_buffer(ADAPTER *a, void *adr, void *P, word length);
287 void mem_inc(ADAPTER *a, void *adr);
288 void mem_in_dw(ADAPTER *a, void *addr, dword *data, int dwords);
289 void mem_out_dw(ADAPTER *a, void *addr, const dword *data, int dwords);
290 /* ---------------------------------------------------------------------
291 functions exported by io.c
292 --------------------------------------------------------------------- */
293 extern IDI_CALL Requests[MAX_ADAPTER];
294 extern void DIDpcRoutine(struct _diva_os_soft_isr *psoft_isr,
295 void *context);
296 extern void request(PISDN_ADAPTER, ENTITY *);
297 /* ---------------------------------------------------------------------
298 trapFn helpers, used to recover debug trace from dead card
299 --------------------------------------------------------------------- */
300 typedef struct {
301 word *buf;
302 word cnt;
303 word out;
304 } Xdesc;
305 extern void dump_trap_frame(PISDN_ADAPTER IoAdapter, byte __iomem *exception);
306 extern void dump_xlog_buffer(PISDN_ADAPTER IoAdapter, Xdesc *xlogDesc);
307 /* --------------------------------------------------------------------- */
308 #endif /* } __DIVA_XDI_COMMON_IO_H_INC__ */