OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [linux/] [isdnif.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
/* $Id: isdnif.h,v 1.1 2005-12-20 11:32:24 jcastillo Exp $
2
 *
3
 * Linux ISDN subsystem
4
 *
5
 * Definition of the interface between the subsystem and its low-level drivers.
6
 *
7
 * Copyright 1994-1998  by Fritz Elfert (fritz@isdn4linux.de)
8
 * Copyright 1995,96    Thinking Objects Software GmbH Wuerzburg
9
 *
10
 * This program is free software; you can redistribute it and/or modify
11
 * it under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation; either version 2, or (at your option)
13
 * any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program; if not, write to the Free Software
22
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23
 *
24
 * $Log: not supported by cvs2svn $
25
 * Revision 1.1.1.1  2001/09/10 07:44:43  simons
26
 * Initial import
27
 *
28
 * Revision 1.1.1.1  2001/07/02 17:57:59  simons
29
 * Initial revision
30
 *
31
 * Revision 1.20.2.2  1998/11/05 22:13:33  fritz
32
 * Changed mail-address.
33
 *
34
 * Revision 1.20.2.1  1998/03/07 23:00:50  tsbogend
35
 * added defines for Linux/Alpha 2.0.x with alpha-patches
36
 *
37
 * Revision 1.20  1997/05/27 15:18:06  fritz
38
 * Added changes for recent 2.1.x kernels:
39
 *   changed return type of isdn_close
40
 *   queue_task_* -> queue_task
41
 *   clear/set_bit -> test_and_... where apropriate.
42
 *   changed type of hard_header_cache parameter.
43
 *
44
 * Revision 1.19  1997/03/25 23:13:56  keil
45
 * NI-1 US protocol
46
 *
47
 * Revision 1.18  1997/03/04 22:09:18  calle
48
 * Change macros copy_from_user and copy_to_user in inline function.
49
 * These are now correct replacements of the functions for 2.1.xx
50
 *
51
 * Revision 1.17  1997/02/10 21:12:53  fritz
52
 * More setup-interface changes.
53
 *
54
 * Revision 1.16  1997/02/10 19:42:57  fritz
55
 * New interface for reporting incoming calls.
56
 *
57
 * Revision 1.15  1997/02/09 00:18:42  keil
58
 * leased line support
59
 *
60
 * Revision 1.14  1997/02/03 23:43:00  fritz
61
 * Misc changes for Kernel 2.1.X compatibility.
62
 *
63
 * Revision 1.13  1996/11/13 02:39:59  fritz
64
 * More compatibility changes.
65
 *
66
 * Revision 1.12  1996/11/06 17:38:48  keil
67
 * more changes for 2.1.X
68
 *
69
 * Revision 1.11  1996/10/23 11:59:42  fritz
70
 * More compatibility changes.
71
 *
72
 * Revision 1.10  1996/10/22 23:14:19  fritz
73
 * Changes for compatibility to 2.0.X and 2.1.X kernels.
74
 *
75
 * Revision 1.9  1996/06/06 21:24:24  fritz
76
 * Started adding support for suspend/resume.
77
 *
78
 * Revision 1.8  1996/05/18 01:45:37  fritz
79
 * More spelling corrections.
80
 *
81
 * Revision 1.7  1996/05/18 01:37:19  fritz
82
 * Added spelling corrections and some minor changes
83
 * to stay in sync with kernel.
84
 *
85
 * Revision 1.6  1996/05/17 03:59:28  fritz
86
 * Marked rcvcallb and writebuf obsolete.
87
 *
88
 * Revision 1.5  1996/05/01 11:43:54  fritz
89
 * Removed STANDALONE
90
 *
91
 * Revision 1.4  1996/05/01 11:38:40  fritz
92
 * Added ISDN_FEATURE_L2_TRANS
93
 *
94
 * Revision 1.3  1996/04/29 22:57:54  fritz
95
 * Added driverId and channel parameters to
96
 * writecmd() and readstat().
97
 * Added constant for voice-support.
98
 *
99
 * Revision 1.2  1996/04/20 17:02:40  fritz
100
 * Changes to support skbuffs for Lowlevel-Drivers.
101
 * Misc. typos
102
 *
103
 * Revision 1.1  1996/01/09 05:50:51  fritz
104
 * Initial revision
105
 *
106
 */
107
 
108
#ifndef isdnif_h
109
#define isdnif_h
110
 
111
/*
112
 * Values for general protocol-selection
113
 */
114
#define ISDN_PTYPE_UNKNOWN   0   /* Protocol undefined   */
115
#define ISDN_PTYPE_1TR6      1   /* german 1TR6-protocol */
116
#define ISDN_PTYPE_EURO      2   /* EDSS1-protocol       */
117
#define ISDN_PTYPE_LEASED    3   /* for leased lines     */
118
#define ISDN_PTYPE_NI1       4   /* US NI-1 protocol     */
119
 
120
/*
121
 * Values for Layer-2-protocol-selection
122
 */
123
#define ISDN_PROTO_L2_X75I   0   /* X75/LAPB with I-Frames      */
124
#define ISDN_PROTO_L2_X75UI  1   /* X75/LAPB with UI-Frames     */
125
#define ISDN_PROTO_L2_X75BUI 2   /* X75/LAPB with UI-Frames     */
126
#define ISDN_PROTO_L2_HDLC   3   /* HDLC                        */
127
#define ISDN_PROTO_L2_TRANS  4   /* Transparent (Voice)         */
128
 
129
/*
130
 * Values for Layer-3-protocol-selection
131
 */
132
#define ISDN_PROTO_L3_TRANS  0   /* Transparent                 */
133
 
134
#ifdef __KERNEL__
135
 
136
#include <linux/skbuff.h>
137
 
138
/*
139
 * Commands from linklevel to lowlevel
140
 *
141
 */
142
#define ISDN_CMD_IOCTL   0       /* Perform ioctl                         */
143
#define ISDN_CMD_DIAL     1       /* Dial out                              */
144
#define ISDN_CMD_ACCEPTD  2       /* Accept an incoming call on D-Chan.    */
145
#define ISDN_CMD_ACCEPTB  3       /* Request B-Channel connect.            */
146
#define ISDN_CMD_HANGUP   4       /* Hangup                                */
147
#define ISDN_CMD_CLREAZ   5       /* Clear EAZ(s) of channel               */
148
#define ISDN_CMD_SETEAZ   6       /* Set EAZ(s) of channel                 */
149
#define ISDN_CMD_GETEAZ   7       /* Get EAZ(s) of channel                 */
150
#define ISDN_CMD_SETSIL   8       /* Set Service-Indicator-List of channel */
151
#define ISDN_CMD_GETSIL   9       /* Get Service-Indicator-List of channel */
152
#define ISDN_CMD_SETL2   10       /* Set B-Chan. Layer2-Parameter          */
153
#define ISDN_CMD_GETL2   11       /* Get B-Chan. Layer2-Parameter          */
154
#define ISDN_CMD_SETL3   12       /* Set B-Chan. Layer3-Parameter          */
155
#define ISDN_CMD_GETL3   13       /* Get B-Chan. Layer3-Parameter          */
156
#define ISDN_CMD_LOCK    14       /* Signal usage by upper levels          */
157
#define ISDN_CMD_UNLOCK  15       /* Release usage-lock                    */
158
#define ISDN_CMD_SUSPEND 16       /* Suspend connection                    */
159
#define ISDN_CMD_RESUME  17       /* Resume connection                     */
160
 
161
/*
162
 * Status-Values delivered from lowlevel to linklevel via
163
 * statcallb().
164
 *
165
 */
166
#define ISDN_STAT_STAVAIL 256    /* Raw status-data available             */
167
#define ISDN_STAT_ICALL   257    /* Incoming call detected                */
168
#define ISDN_STAT_RUN     258    /* Signal protocol-code is running       */
169
#define ISDN_STAT_STOP    259    /* Signal halt of protocol-code          */
170
#define ISDN_STAT_DCONN   260    /* Signal D-Channel connect              */
171
#define ISDN_STAT_BCONN   261    /* Signal B-Channel connect              */
172
#define ISDN_STAT_DHUP    262    /* Signal D-Channel disconnect           */
173
#define ISDN_STAT_BHUP    263    /* Signal B-Channel disconnect           */
174
#define ISDN_STAT_CINF    264    /* Charge-Info                           */
175
#define ISDN_STAT_LOAD    265    /* Signal new lowlevel-driver is loaded  */
176
#define ISDN_STAT_UNLOAD  266    /* Signal unload of lowlevel-driver      */
177
#define ISDN_STAT_BSENT   267    /* Signal packet sent                    */
178
#define ISDN_STAT_NODCH   268    /* Signal no D-Channel                   */
179
#define ISDN_STAT_ADDCH   269    /* Add more Channels                     */
180
#define ISDN_STAT_CAUSE   270    /* Cause-Message                         */
181
 
182
/*
183
 * Values for feature-field of interface-struct.
184
 */
185
/* Layer 2 */
186
#define ISDN_FEATURE_L2_X75I    (0x0001 << ISDN_PROTO_L2_X75I)
187
#define ISDN_FEATURE_L2_X75UI   (0x0001 << ISDN_PROTO_L2_X75UI)
188
#define ISDN_FEATURE_L2_X75BUI  (0x0001 << ISDN_PROTO_L2_X75BUI)
189
#define ISDN_FEATURE_L2_HDLC    (0x0001 << ISDN_PROTO_L2_HDLC)
190
#define ISDN_FEATURE_L2_TRANS   (0x0001 << ISDN_PROTO_L2_TRANS)
191
 
192
/* Layer 3 */
193
#define ISDN_FEATURE_L3_TRANS   (0x0100 << ISDN_PROTO_L3_TRANS)
194
 
195
/* Signaling */
196
#define ISDN_FEATURE_P_UNKNOWN  (0x1000 << ISDN_PTYPE_UNKNOWN)
197
#define ISDN_FEATURE_P_1TR6     (0x1000 << ISDN_PTYPE_1TR6)
198
#define ISDN_FEATURE_P_EURO     (0x1000 << ISDN_PTYPE_EURO)
199
#define ISDN_FEATURE_P_NI1      (0x1000 << ISDN_PTYPE_NI1)
200
 
201
typedef struct setup_parm {
202
    char phone[32];         /* Remote Phone-Number */
203
    char eazmsn[32];        /* Local EAZ or MSN    */
204
    unsigned char si1;      /* Service Indicator 1 */
205
    unsigned char si2;      /* Service Indicator 2 */
206
    unsigned char plan;     /* Numbering plan      */
207
    unsigned char screen;   /* Screening info      */
208
} setup_parm;
209
 
210
/*
211
 * Structure for exchanging above infos
212
 *
213
 */
214
typedef struct {
215
  int   driver;                  /* Lowlevel-Driver-ID                    */
216
  int   command;                 /* Command or Status (see above)         */
217
  ulong arg;                     /* Additional Data                       */
218
  union {
219
        char  num[50];               /* Additional Data                       */
220
        setup_parm setup;
221
  } parm;
222
} isdn_ctrl;
223
 
224
/*
225
 * The interface-struct itself (initialized at load-time of lowlevel-driver)
226
 *
227
 * See Documentation/isdn/INTERFACE for a description, how the communication
228
 * between the ISDN subsystem and its drivers is done.
229
 *
230
 */
231
typedef struct {
232
  /* Number of channels supported by this driver
233
   */
234
  int channels;
235
 
236
  /*
237
   * Maximum Size of transmit/receive-buffer this driver supports.
238
   */
239
  int maxbufsize;
240
 
241
  /* Feature-Flags for this driver.
242
   * See defines ISDN_FEATURE_... for Values
243
   */
244
  unsigned long features;
245
 
246
  /*
247
   * Needed for calculating
248
   * dev->hard_header_len = linklayer header + hl_hdrlen;
249
   * Drivers, not supporting sk_buff's should set this to 0.
250
   */
251
  unsigned short hl_hdrlen;
252
 
253
  /* Receive-Callback
254
   * Parameters:
255
   *             int    Driver-ID
256
   *             int    local channel-number (0 ...)
257
   *             u_char pointer to received data (in Kernel-Space, volatile)
258
   *             int    length of data
259
   *
260
   * NOTE: This callback is obsolete, and will be removed when all
261
   *       current LL-drivers support rcvcall_skb. Do NOT use for new
262
   *       drivers.
263
   */
264
  void (*rcvcallb)(int, int, u_char*, int);
265
 
266
  /*
267
   * Receive-Callback using sk_buff's
268
   * Parameters:
269
   *             int                    Driver-ID
270
   *             int                    local channel-number (0 ...)
271
   *             struct sk_buff *skb    received Data
272
   */
273
  void (*rcvcallb_skb)(int, int, struct sk_buff *);
274
 
275
  /* Status-Callback
276
   * Parameters:
277
   *             isdn_ctrl*
278
   *                   driver  = Driver ID.
279
   *                   command = One of above ISDN_STAT_... constants.
280
   *                   arg     = depending on status-type.
281
   *                   num     = depending on status-type.
282
   */
283
  int (*statcallb)(isdn_ctrl*);
284
  /* Send command
285
   * Parameters:
286
   *             isdn_ctrl*
287
   *                   driver  = Driver ID.
288
   *                   command = One of above ISDN_CMD_... constants.
289
   *                   arg     = depending on command.
290
   *                   num     = depending on command.
291
   */
292
  int (*command)(isdn_ctrl*);
293
  /* Send Data
294
   * Parameters:
295
   *             int    driverId
296
   *             int    local channel-number (0 ...)
297
   *             u_char pointer to data
298
   *             int    length of data
299
   *             int    Flag: 0 = Call form Kernel-Space (use memcpy,
300
   *                              no schedule allowed)
301
   *                          1 = Data is in User-Space (use memcpy_fromfs,
302
   *                              may schedule)
303
   *
304
   * NOTE: This call is obsolete, and will be removed when all
305
   *       current LL-drivers support writebuf_skb. Do NOT use for new
306
   *       drivers.
307
   */
308
  int (*writebuf)(int, int, const u_char*, int, int);
309
 
310
  /*
311
   * Send data using sk_buff's
312
   * Parameters:
313
   *             int                    driverId
314
   *             int                    local channel-number (0...)
315
   *             struct sk_buff *skb    Data to send
316
   */
317
  int (*writebuf_skb) (int, int, struct sk_buff *);
318
 
319
  /* Send raw D-Channel-Commands
320
   * Parameters:
321
   *             u_char pointer data
322
   *             int    length of data
323
   *             int    Flag: 0 = Call form Kernel-Space (use memcpy,
324
   *                              no schedule allowed)
325
   *                          1 = Data is in User-Space (use memcpy_fromfs,
326
   *                              may schedule)
327
   *             int    driverId
328
   *             int    local channel-number (0 ...)
329
   */
330
  int (*writecmd)(const u_char*, int, int, int, int);
331
  /* Read raw Status replies
332
   *             u_char pointer data (volatile)
333
   *             int    length of buffer
334
   *             int    Flag: 0 = Call form Kernel-Space (use memcpy,
335
   *                              no schedule allowed)
336
   *                          1 = Data is in User-Space (use memcpy_fromfs,
337
   *                              may schedule)
338
   *             int    driverId
339
   *             int    local channel-number (0 ...)
340
   */
341
  int (*readstat)(u_char*, int, int, int, int);
342
  char id[20];
343
} isdn_if;
344
 
345
/*
346
 * Function which must be called by lowlevel-driver at loadtime with
347
 * the following fields of above struct set:
348
 *
349
 * channels     Number of channels that will be supported.
350
 * hl_hdrlen    Space to preserve in sk_buff's when sending. Drivers, not
351
 *              supporting sk_buff's should set this to 0.
352
 * command      Address of Command-Handler.
353
 * features     Bitwise coded Features of this driver. (use ISDN_FEATURE_...)
354
 * writebuf     Address of Send-Command-Handler. OBSOLETE do NOT use anymore.
355
 * writebuf_skb Address of Skbuff-Send-Handler. (NULL if not supported)
356
 * writecmd        "    "  D-Channel  " which accepts raw D-Ch-Commands.
357
 * readstat        "    "  D-Channel  " which delivers raw Status-Data.
358
 *
359
 * The linklevel-driver fills the following fields:
360
 *
361
 * channels      Driver-ID assigned to this driver. (Must be used on all
362
 *               subsequent callbacks.
363
 * rcvcallb      Address of handler for received data. OBSOLETE, do NOT use anymore.
364
 * rcvcallb_skb  Address of handler for received Skbuff's. (NULL if not supp.)
365
 * statcallb        "    "     "    for status-changes.
366
 *
367
 */
368
extern int register_isdn(isdn_if*);
369
 
370
/* Compatibility Linux-2.0.X <-> Linux-2.1.X */
371
 
372
#ifndef LINUX_VERSION_CODE
373
#include <linux/version.h>
374
#endif
375
#if (LINUX_VERSION_CODE < 0x020100)
376
#include <linux/mm.h>
377
 
378
static inline unsigned long copy_from_user(void *to, const void *from, unsigned long n)
379
{
380
        int i;
381
        if ((i = verify_area(VERIFY_READ, from, n)) != 0)
382
                return i;
383
        memcpy_fromfs(to, from, n);
384
        return 0;
385
}
386
 
387
static inline unsigned long copy_to_user(void *to, const void *from, unsigned long n)
388
{
389
        int i;
390
        if ((i = verify_area(VERIFY_WRITE, to, n)) != 0)
391
                return i;
392
        memcpy_tofs(to, from, n);
393
        return 0;
394
}
395
 
396
#define GET_USER(x, addr) ( x = get_user(addr) )
397
#ifdef __alpha__ /* needed for 2.0.x with alpha-patches */
398
#define RWTYPE long
399
#define LSTYPE long
400
#define RWARG unsigned long
401
#else
402
#define RWTYPE int
403
#define LSTYPE int
404
#define RWARG int
405
#endif
406
#define LSARG off_t
407
#else
408
#include <asm/uaccess.h>
409
#define GET_USER get_user
410
#define PUT_USER put_user
411
#define RWTYPE long
412
#define LSTYPE long long
413
#define RWARG unsigned long
414
#define LSARG long long
415
#endif
416
 
417
#if (LINUX_VERSION_CODE < 0x02010F)
418
#define SET_SKB_FREE(x) ( x->free = 1 )
419
#else
420
#define SET_SKB_FREE(x)
421
#endif
422
 
423
#if (LINUX_VERSION_CODE < 0x02011F)
424
#define CLOSETYPE void
425
#define CLOSEVAL
426
#else
427
#define CLOSETYPE int
428
#define CLOSEVAL (0)
429
#endif
430
 
431
#if (LINUX_VERSION_CODE < 0x020125)
432
#define test_and_clear_bit clear_bit
433
#define test_and_set_bit set_bit
434
#endif
435
 
436
#endif /* __KERNEL__ */
437
#endif /* isdnif_h */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.