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