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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [uclinux/] [uC-libc/] [include/] [linux/] [isdnif.h] - Blame information for rev 199

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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