Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / isdn / hardware / eicon / divasync.h
blob0a5be7f969f212e494912f8e1a6db7b0bdaec58e
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_SYNC__H
27 #define __DIVA_SYNC__H
28 #define IDI_SYNC_REQ_REMOVE 0x00
29 #define IDI_SYNC_REQ_GET_NAME 0x01
30 #define IDI_SYNC_REQ_GET_SERIAL 0x02
31 #define IDI_SYNC_REQ_SET_POSTCALL 0x03
32 #define IDI_SYNC_REQ_GET_XLOG 0x04
33 #define IDI_SYNC_REQ_GET_FEATURES 0x05
34 #define IDI_SYNC_REQ_USB_REGISTER 0x06
35 #define IDI_SYNC_REQ_USB_RELEASE 0x07
36 #define IDI_SYNC_REQ_USB_ADD_DEVICE 0x08
37 #define IDI_SYNC_REQ_USB_START_DEVICE 0x09
38 #define IDI_SYNC_REQ_USB_STOP_DEVICE 0x0A
39 #define IDI_SYNC_REQ_USB_REMOVE_DEVICE 0x0B
40 #define IDI_SYNC_REQ_GET_CARDTYPE 0x0C
41 #define IDI_SYNC_REQ_GET_DBG_XLOG 0x0D
42 #define DIVA_USB
43 #define DIVA_USB_REQ 0xAC
44 #define DIVA_USB_TEST 0xAB
45 #define DIVA_USB_ADD_ADAPTER 0xAC
46 #define DIVA_USB_REMOVE_ADAPTER 0xAD
47 #define IDI_SYNC_REQ_SERIAL_HOOK 0x80
48 #define IDI_SYNC_REQ_XCHANGE_STATUS 0x81
49 #define IDI_SYNC_REQ_USB_HOOK 0x82
50 #define IDI_SYNC_REQ_PORTDRV_HOOK 0x83
51 #define IDI_SYNC_REQ_SLI 0x84 /* SLI request from 3signal modem drivers */
52 #define IDI_SYNC_REQ_RECONFIGURE 0x85
53 #define IDI_SYNC_REQ_RESET 0x86
54 #define IDI_SYNC_REQ_GET_85X_DEVICE_DATA 0x87
55 #define IDI_SYNC_REQ_LOCK_85X 0x88
56 #define IDI_SYNC_REQ_DIVA_85X_USB_DATA_EXCHANGE 0x99
57 #define IDI_SYNC_REQ_DIPORT_EXCHANGE_REQ 0x98
58 #define IDI_SYNC_REQ_GET_85X_EXT_PORT_TYPE 0xA0
59 /******************************************************************************/
60 #define IDI_SYNC_REQ_XDI_GET_EXTENDED_FEATURES 0x92
62 To receive XDI features:
63 1. set 'buffer_length_in_bytes' to length of you buffer
64 2. set 'features' to pointer to your buffer
65 3. issue synchronous request to XDI
66 4. Check that feature 'DIVA_XDI_EXTENDED_FEATURES_VALID' is present
67 after call. This feature does indicate that your request
68 was processed and XDI does support this synchronous request
69 5. if on return bit 31 (0x80000000) in 'buffer_length_in_bytes' is
70 set then provided buffer was too small, and bits 30-0 does
71 contain necessary length of buffer.
72 in this case only features that do find place in the buffer
73 are indicated to caller
75 typedef struct _diva_xdi_get_extended_xdi_features {
76 dword buffer_length_in_bytes;
77 byte *features;
78 } diva_xdi_get_extended_xdi_features_t;
80 features[0]
82 #define DIVA_XDI_EXTENDED_FEATURES_VALID 0x01
83 #define DIVA_XDI_EXTENDED_FEATURE_CMA 0x02
84 #define DIVA_XDI_EXTENDED_FEATURE_SDRAM_BAR 0x04
85 #define DIVA_XDI_EXTENDED_FEATURE_CAPI_PRMS 0x08
86 #define DIVA_XDI_EXTENDED_FEATURE_NO_CANCEL_RC 0x10
87 #define DIVA_XDI_EXTENDED_FEATURE_RX_DMA 0x20
88 #define DIVA_XDI_EXTENDED_FEATURE_MANAGEMENT_DMA 0x40
89 #define DIVA_XDI_EXTENDED_FEATURE_WIDE_ID 0x80
90 #define DIVA_XDI_EXTENDED_FEATURES_MAX_SZ 1
91 /******************************************************************************/
92 #define IDI_SYNC_REQ_XDI_GET_ADAPTER_SDRAM_BAR 0x93
93 typedef struct _diva_xdi_get_adapter_sdram_bar {
94 dword bar;
95 } diva_xdi_get_adapter_sdram_bar_t;
96 /******************************************************************************/
97 #define IDI_SYNC_REQ_XDI_GET_CAPI_PARAMS 0x94
99 CAPI Parameters will be written in the caller's buffer
101 typedef struct _diva_xdi_get_capi_parameters {
102 dword structure_length;
103 byte flag_dynamic_l1_down;
104 byte group_optimization_enabled;
105 } diva_xdi_get_capi_parameters_t;
106 /******************************************************************************/
107 #define IDI_SYNC_REQ_XDI_GET_LOGICAL_ADAPTER_NUMBER 0x95
109 Get logical adapter number, as assigned by XDI
110 'controller' is starting with zero 'sub' controller number
111 in case of one adapter that supports multiple interfaces
112 'controller' is zero for Master adapter (and adapter that supports
113 only one interface)
115 typedef struct _diva_xdi_get_logical_adapter_number {
116 dword logical_adapter_number;
117 dword controller;
118 dword total_controllers;
119 } diva_xdi_get_logical_adapter_number_s_t;
120 /******************************************************************************/
121 #define IDI_SYNC_REQ_UP1DM_OPERATION 0x96
122 /******************************************************************************/
123 #define IDI_SYNC_REQ_DMA_DESCRIPTOR_OPERATION 0x97
124 #define IDI_SYNC_REQ_DMA_DESCRIPTOR_ALLOC 0x01
125 #define IDI_SYNC_REQ_DMA_DESCRIPTOR_FREE 0x02
126 typedef struct _diva_xdi_dma_descriptor_operation {
127 int operation;
128 int descriptor_number;
129 void* descriptor_address;
130 dword descriptor_magic;
131 } diva_xdi_dma_descriptor_operation_t;
132 /******************************************************************************/
133 #define IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY 0x01
134 #define IDI_SYNC_REQ_DIDD_REMOVE_ADAPTER_NOTIFY 0x02
135 #define IDI_SYNC_REQ_DIDD_ADD_ADAPTER 0x03
136 #define IDI_SYNC_REQ_DIDD_REMOVE_ADAPTER 0x04
137 #define IDI_SYNC_REQ_DIDD_READ_ADAPTER_ARRAY 0x05
138 #define IDI_SYNC_REQ_DIDD_GET_CFG_LIB_IFC 0x10
139 typedef struct _diva_didd_adapter_notify {
140 dword handle; /* Notification handle */
141 void * callback;
142 void * context;
143 } diva_didd_adapter_notify_t;
144 typedef struct _diva_didd_add_adapter {
145 void * descriptor;
146 } diva_didd_add_adapter_t;
147 typedef struct _diva_didd_remove_adapter {
148 IDI_CALL p_request;
149 } diva_didd_remove_adapter_t;
150 typedef struct _diva_didd_read_adapter_array {
151 void * buffer;
152 dword length;
153 } diva_didd_read_adapter_array_t;
154 typedef struct _diva_didd_get_cfg_lib_ifc {
155 void* ifc;
156 } diva_didd_get_cfg_lib_ifc_t;
157 /******************************************************************************/
158 #define IDI_SYNC_REQ_XDI_GET_STREAM 0x91
159 #define DIVA_XDI_SYNCHRONOUS_SERVICE 0x01
160 #define DIVA_XDI_DMA_SERVICE 0x02
161 #define DIVA_XDI_AUTO_SERVICE 0x03
162 #define DIVA_ISTREAM_COMPLETE_NOTIFY 0
163 #define DIVA_ISTREAM_COMPLETE_READ 1
164 #define DIVA_ISTREAM_COMPLETE_WRITE 2
165 typedef struct _diva_xdi_stream_interface {
166 unsigned char Id; /* filled by XDI client */
167 unsigned char provided_service; /* filled by XDI */
168 unsigned char requested_service; /* filled by XDI Client */
169 void* xdi_context; /* filled by XDI */
170 void* client_context; /* filled by XDI client */
171 int (*write)(void* context,
172 int Id,
173 void* data,
174 int length,
175 int final,
176 byte usr1,
177 byte usr2);
178 int (*read)(void* context,
179 int Id,
180 void* data,
181 int max_length,
182 int* final,
183 byte* usr1,
184 byte* usr2);
185 int (*complete)(void* client_context,
186 int Id,
187 int what,
188 void* data,
189 int length,
190 int* final);
191 } diva_xdi_stream_interface_t;
192 /******************************************************************************/
194 * IDI_SYNC_REQ_SERIAL_HOOK - special interface for the DIVA Mobile card
196 typedef struct
197 { unsigned char LineState; /* Modem line state (STATUS_R) */
198 #define SERIAL_GSM_CELL 0x01 /* GSM or CELL cable attached */
199 unsigned char CardState; /* PCMCIA card state (0 = down) */
200 unsigned char IsdnState; /* ISDN layer 1 state (0 = down)*/
201 unsigned char HookState; /* current logical hook state */
202 #define SERIAL_ON_HOOK 0x02 /* set in DIVA CTRL_R register */
203 } SERIAL_STATE;
204 typedef int ( * SERIAL_INT_CB) (void *Context) ;
205 typedef int ( * SERIAL_DPC_CB) (void *Context) ;
206 typedef unsigned char ( * SERIAL_I_SYNC) (void *Context) ;
207 typedef struct
208 { /* 'Req' and 'Rc' must be at the same place as in the ENTITY struct */
209 unsigned char Req; /* request (must be always 0) */
210 unsigned char Rc; /* return code (is the request) */
211 unsigned char Function; /* private function code */
212 #define SERIAL_HOOK_ATTACH 0x81
213 #define SERIAL_HOOK_STATUS 0x82
214 #define SERIAL_HOOK_I_SYNC 0x83
215 #define SERIAL_HOOK_NOECHO 0x84
216 #define SERIAL_HOOK_RING 0x85
217 #define SERIAL_HOOK_DETACH 0x8f
218 unsigned char Flags; /* function refinements */
219 /* parameters passed by the the ATTACH request */
220 SERIAL_INT_CB InterruptHandler; /* called on each interrupt */
221 SERIAL_DPC_CB DeferredHandler; /* called on hook state changes */
222 void *HandlerContext; /* context for both handlers */
223 /* return values for both the ATTACH and the STATUS request */
224 unsigned long IoBase; /* IO port assigned to UART */
225 SERIAL_STATE State;
226 /* parameters and return values for the I_SYNC function */
227 SERIAL_I_SYNC SyncFunction; /* to be called synchronized */
228 void *SyncContext; /* context for this function */
229 unsigned char SyncResult; /* return value of function */
230 } SERIAL_HOOK;
232 * IDI_SYNC_REQ_XCHANGE_STATUS - exchange the status between IDI and WMP
233 * IDI_SYNC_REQ_RECONFIGURE - reconfiguration of IDI from WMP
235 typedef struct
236 { /* 'Req' and 'Rc' must be at the same place as in the ENTITY struct */
237 unsigned char Req; /* request (must be always 0) */
238 unsigned char Rc; /* return code (is the request) */
239 #define DRIVER_STATUS_BOOT 0xA1
240 #define DRIVER_STATUS_INIT_DEV 0xA2
241 #define DRIVER_STATUS_RUNNING 0xA3
242 #define DRIVER_STATUS_SHUTDOWN 0xAF
243 #define DRIVER_STATUS_TRAPPED 0xAE
244 unsigned char wmpStatus; /* exported by WMP */
245 unsigned char idiStatus; /* exported by IDI */
246 unsigned long wizProto ; /* from WMP registry to IDI */
247 /* the cardtype value is defined by cardtype.h */
248 unsigned long cardType ; /* from IDI registry to WMP */
249 unsigned long nt2 ; /* from IDI registry to WMP */
250 unsigned long permanent ; /* from IDI registry to WMP */
251 unsigned long stableL2 ; /* from IDI registry to WMP */
252 unsigned long tei ; /* from IDI registry to WMP */
253 #define CRC4_MASK 0x00000003
254 #define L1_TRISTATE_MASK 0x00000004
255 #define WATCHDOG_MASK 0x00000008
256 #define NO_ORDER_CHECK_MASK 0x00000010
257 #define LOW_CHANNEL_MASK 0x00000020
258 #define NO_HSCX30_MASK 0x00000040
259 #define MODE_MASK 0x00000080
260 #define SET_BOARD 0x00001000
261 #define SET_CRC4 0x00030000
262 #define SET_L1_TRISTATE 0x00040000
263 #define SET_WATCHDOG 0x00080000
264 #define SET_NO_ORDER_CHECK 0x00100000
265 #define SET_LOW_CHANNEL 0x00200000
266 #define SET_NO_HSCX30 0x00400000
267 #define SET_MODE 0x00800000
268 #define SET_PROTO 0x02000000
269 #define SET_CARDTYPE 0x04000000
270 #define SET_NT2 0x08000000
271 #define SET_PERMANENT 0x10000000
272 #define SET_STABLEL2 0x20000000
273 #define SET_TEI 0x40000000
274 #define SET_NUMBERLEN 0x80000000
275 unsigned long Flag ; /* |31-Type-16|15-Mask-0| */
276 unsigned long NumberLen ; /* reconfiguration: union is empty */
277 union {
278 struct { /* possible reconfiguration, but ... ; SET_BOARD */
279 unsigned long SerialNumber ;
280 char *pCardname ; /* di_defs.h: BOARD_NAME_LENGTH */
281 } board ;
282 struct { /* reset: need resources */
283 void * pRawResources ;
284 void * pXlatResources ;
285 } res ;
286 struct { /* reconfiguration: wizProto == PROTTYPE_RBSCAS */
287 #define GLARE_RESOLVE_MASK 0x00000001
288 #define DID_MASK 0x00000002
289 #define BEARER_CAP_MASK 0x0000000c
290 #define SET_GLARE_RESOLVE 0x00010000
291 #define SET_DID 0x00020000
292 #define SET_BEARER_CAP 0x000c0000
293 unsigned long Flag ; /* |31-Type-16|15-VALUE-0| */
294 unsigned short DigitTimeout ;
295 unsigned short AnswerDelay ;
296 } rbs ;
297 struct { /* reconfiguration: wizProto == PROTTYPE_QSIG */
298 #define CALL_REF_LENGTH1_MASK 0x00000001
299 #define BRI_CHANNEL_ID_MASK 0x00000002
300 #define SET_CALL_REF_LENGTH 0x00010000
301 #define SET_BRI_CHANNEL_ID 0x00020000
302 unsigned long Flag ; /* |31-Type-16|15-VALUE-0| */
303 } qsig ;
304 struct { /* reconfiguration: NumberLen != 0 */
305 #define SET_SPID1 0x00010000
306 #define SET_NUMBER1 0x00020000
307 #define SET_SUBADDRESS1 0x00040000
308 #define SET_SPID2 0x00100000
309 #define SET_NUMBER2 0x00200000
310 #define SET_SUBADDRESS2 0x00400000
311 #define MASK_SET 0xffff0000
312 unsigned long Flag ; /* |31-Type-16|15-Channel-0| */
313 unsigned char *pBuffer ; /* number value */
314 } isdnNo ;
316 parms
318 } isdnProps ;
320 * IDI_SYNC_REQ_PORTDRV_HOOK - signal plug/unplug (Award Cardware only)
322 typedef void ( * PORTDRV_HOOK_CB) (void *Context, int Plug) ;
323 typedef struct
324 { /* 'Req' and 'Rc' must be at the same place as in the ENTITY struct */
325 unsigned char Req; /* request (must be always 0) */
326 unsigned char Rc; /* return code (is the request) */
327 unsigned char Function; /* private function code */
328 unsigned char Flags; /* function refinements */
329 PORTDRV_HOOK_CB Callback; /* to be called on plug/unplug */
330 void *Context; /* context for callback */
331 unsigned long Info; /* more info if needed */
332 } PORTDRV_HOOK ;
333 /* Codes for the 'Rc' element in structure below. */
334 #define SLI_INSTALL (0xA1)
335 #define SLI_UNINSTALL (0xA2)
336 typedef int ( * SLIENTRYPOINT)(void* p3SignalAPI, void* pContext);
337 typedef struct
338 { /* 'Req' and 'Rc' must be at the same place as in the ENTITY struct */
339 unsigned char Req; /* request (must be always 0) */
340 unsigned char Rc; /* return code (is the request) */
341 unsigned char Function; /* private function code */
342 unsigned char Flags; /* function refinements */
343 SLIENTRYPOINT Callback; /* to be called on plug/unplug */
344 void *Context; /* context for callback */
345 unsigned long Info; /* more info if needed */
346 } SLIENTRYPOINT_REQ ;
347 /******************************************************************************/
349 * Definitions for DIVA USB
351 typedef int ( * USB_SEND_REQ) (unsigned char PipeIndex, unsigned char Type,void *Data, int sizeData);
352 typedef int ( * USB_START_DEV) (void *Adapter, void *Ipac) ;
353 /* called from WDM */
354 typedef void ( * USB_RECV_NOTIFY) (void *Ipac, void *msg) ;
355 typedef void ( * USB_XMIT_NOTIFY) (void *Ipac, unsigned char PipeIndex) ;
356 /******************************************************************************/
358 * Parameter description for synchronous requests.
360 * Sorry, must repeat some parts of di_defs.h here because
361 * they are not defined for all operating environments
363 typedef union
364 { ENTITY Entity;
365 struct
366 { /* 'Req' and 'Rc' are at the same place as in the ENTITY struct */
367 unsigned char Req; /* request (must be always 0) */
368 unsigned char Rc; /* return code (is the request) */
369 } Request;
370 struct
371 { unsigned char Req; /* request (must be always 0) */
372 unsigned char Rc; /* return code (0x01) */
373 unsigned char name[BOARD_NAME_LENGTH];
374 } GetName;
375 struct
376 { unsigned char Req; /* request (must be always 0) */
377 unsigned char Rc; /* return code (0x02) */
378 unsigned long serial; /* serial number */
379 } GetSerial;
380 struct
381 { unsigned char Req; /* request (must be always 0) */
382 unsigned char Rc; /* return code (0x02) */
383 unsigned long lineIdx;/* line, 0 if card has only one */
384 } GetLineIdx;
385 struct
386 { unsigned char Req; /* request (must be always 0) */
387 unsigned char Rc; /* return code (0x02) */
388 unsigned long cardtype;/* card type */
389 } GetCardType;
390 struct
391 { unsigned short command;/* command = 0x0300 */
392 unsigned short dummy; /* not used */
393 IDI_CALL callback;/* routine to call back */
394 ENTITY *contxt; /* ptr to entity to use */
395 } PostCall;
396 struct
397 { unsigned char Req; /* request (must be always 0) */
398 unsigned char Rc; /* return code (0x04) */
399 unsigned char pcm[1]; /* buffer (a pc_maint struct) */
400 } GetXlog;
401 struct
402 { unsigned char Req; /* request (must be always 0) */
403 unsigned char Rc; /* return code (0x05) */
404 unsigned short features;/* feature defines see below */
405 } GetFeatures;
406 SERIAL_HOOK SerialHook;
407 /* Added for DIVA USB */
408 struct
409 { unsigned char Req;
410 unsigned char Rc;
411 USB_SEND_REQ UsbSendRequest; /* function in Diva Usb WDM driver in usb_os.c, */
412 /* called from usb_drv.c to send a message to our device */
413 /* eg UsbSendRequest (USB_PIPE_SIGNAL, USB_IPAC_START, 0, 0) ; */
414 USB_RECV_NOTIFY usb_recv; /* called from usb_os.c to pass a received message and ptr to IPAC */
415 /* on to usb_drv.c by a call to usb_recv(). */
416 USB_XMIT_NOTIFY usb_xmit; /* called from usb_os.c in DivaUSB.sys WDM to indicate a completed transmit */
417 /* to usb_drv.c by a call to usb_xmit(). */
418 USB_START_DEV UsbStartDevice; /* Start the USB Device, in usb_os.c */
419 IDI_CALL callback; /* routine to call back */
420 ENTITY *contxt; /* ptr to entity to use */
421 void ** ipac_ptr; /* pointer to struct IPAC in VxD */
422 } Usb_Msg_old;
423 /* message used by WDM and VXD to pass pointers of function and IPAC* */
424 struct
425 { unsigned char Req;
426 unsigned char Rc;
427 USB_SEND_REQ pUsbSendRequest;/* function in Diva Usb WDM driver in usb_os.c, */
428 /* called from usb_drv.c to send a message to our device */
429 /* eg UsbSendRequest (USB_PIPE_SIGNAL, USB_IPAC_START, 0, 0) ; */
430 USB_RECV_NOTIFY p_usb_recv; /* called from usb_os.c to pass a received message and ptr to IPAC */
431 /* on to usb_drv.c by a call to usb_recv(). */
432 USB_XMIT_NOTIFY p_usb_xmit; /* called from usb_os.c in DivaUSB.sys WDM to indicate a completed transmit */
433 /* to usb_drv.c by a call to usb_xmit().*/
434 void *ipac_ptr; /* &Diva.ipac pointer to struct IPAC in VxD */
435 } Usb_Msg;
436 PORTDRV_HOOK PortdrvHook;
437 SLIENTRYPOINT_REQ sliEntryPointReq;
438 struct {
439 unsigned char Req;
440 unsigned char Rc;
441 diva_xdi_stream_interface_t info;
442 } xdi_stream_info;
443 struct {
444 unsigned char Req;
445 unsigned char Rc;
446 diva_xdi_get_extended_xdi_features_t info;
447 } xdi_extended_features;
448 struct {
449 unsigned char Req;
450 unsigned char Rc;
451 diva_xdi_get_adapter_sdram_bar_t info;
452 } xdi_sdram_bar;
453 struct {
454 unsigned char Req;
455 unsigned char Rc;
456 diva_xdi_get_capi_parameters_t info;
457 } xdi_capi_prms;
458 struct {
459 ENTITY e;
460 diva_didd_adapter_notify_t info;
461 } didd_notify;
462 struct {
463 ENTITY e;
464 diva_didd_add_adapter_t info;
465 } didd_add_adapter;
466 struct {
467 ENTITY e;
468 diva_didd_remove_adapter_t info;
469 } didd_remove_adapter;
470 struct {
471 ENTITY e;
472 diva_didd_read_adapter_array_t info;
473 } didd_read_adapter_array;
474 struct {
475 ENTITY e;
476 diva_didd_get_cfg_lib_ifc_t info;
477 } didd_get_cfg_lib_ifc;
478 struct {
479 unsigned char Req;
480 unsigned char Rc;
481 diva_xdi_get_logical_adapter_number_s_t info;
482 } xdi_logical_adapter_number;
483 struct {
484 unsigned char Req;
485 unsigned char Rc;
486 diva_xdi_dma_descriptor_operation_t info;
487 } xdi_dma_descriptor_operation;
488 } IDI_SYNC_REQ;
489 /******************************************************************************/
490 #endif /* __DIVA_SYNC__H */