kernel tree reorganization stage 1: Major cvs repository work (not logged as
[dragonfly.git] / sys / net / i4b / layer1 / i4b_l1.h
1 /*
2  * Copyright (c) 2000, 2001 Hellmuth Michaelis. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23  * SUCH DAMAGE.
24  *
25  *---------------------------------------------------------------------------*
26  *
27  *      i4b_l1.h - isdn4bsd layer 1 header file
28  *      ---------------------------------------
29  *
30  * $FreeBSD: src/sys/i4b/layer1/i4b_l1.h,v 1.7.2.3 2002/04/25 12:29:55 gj Exp $
31  * $DragonFly: src/sys/net/i4b/layer1/i4b_l1.h,v 1.3 2003/08/07 21:17:25 dillon Exp $
32  *
33  *      last edit-date: [Tue Jan 23 17:04:57 2001]
34  *
35  *---------------------------------------------------------------------------*/
36
37 #ifndef _I4B_L1_H_
38 #define _I4B_L1_H_
39
40 #include "../include/i4b_l3l4.h"
41
42 #define SEC_DELAY               1000000 /* one second DELAY for DELAY*/
43
44 #define MAX_DFRAME_LEN          264     /* max length of a D frame */
45
46 #define min(a,b)                ((a)<(b)?(a):(b))
47
48 /* L1DRVR_XXXX moved to i4b_ioctl.h */
49
50 #define L0DRVR(du) (((du) >> 8) & 0xff)
51 #define L0UNIT(du) ((du) & 0xff)
52
53 #define L0DRVRUNIT(d, u) ( (((d) << 8) & 0xff00) | ((u) & 0xff))
54
55 #define L0ISICUNIT(u) ( (((L1DRVR_ISIC) << 8) & 0xff00) | ((u) & 0xff))
56 #define L0IWICUNIT(u) ( (((L1DRVR_IWIC) << 8) & 0xff00) | ((u) & 0xff))
57 #define L0IFPIUNIT(u) ( (((L1DRVR_IFPI) << 8) & 0xff00) | ((u) & 0xff))
58 #define L0IHFCUNIT(u) ( (((L1DRVR_IHFC) << 8) & 0xff00) | ((u) & 0xff))
59 #define L0IFPNPUNIT(u) ( (((L1DRVR_IFPNP) << 8) & 0xff00) | ((u) & 0xff))
60 #define L0ICCHPUNIT(u) ( (((L1DRVR_ICCHP) << 8) & 0xff00) | ((u) & 0xff))
61 #define L0ITJCUNIT(u) ( (((L1DRVR_ITJC) << 8) & 0xff00) | ((u) & 0xff))
62 #define L0IFPI2UNIT(u) ( (((L1DRVR_IFPI2) << 8) & 0xff00) | ((u) & 0xff))
63
64 /* jump table for the multiplex functions */
65 struct i4b_l1mux_func {
66         isdn_link_t * (*ret_linktab)(int, int);
67         void (*set_linktab)(int, int, drvr_link_t *);
68         int (*mph_command_req)(int, int, void *);
69         int (*ph_data_req)(int, struct mbuf *, int);
70         int (*ph_activate_req)(int);
71 };
72
73 int i4b_l1_ph_data_ind(int unit, struct mbuf *m);
74 int i4b_l1_ph_activate_ind(int unit);
75 int i4b_l1_ph_deactivate_ind(int unit);
76 int i4b_l1_mph_status_ind(int, int, int, struct i4b_l1mux_func *);
77
78 isdn_link_t *i4b_l1_ret_linktab(int unit, int channel);
79 void i4b_l1_set_linktab(int unit, int channel, drvr_link_t *dlt);
80
81 int i4b_l1_trace_ind(i4b_trace_hdr_t *, int, u_char *);
82
83 /* i4b_l1lib.c */
84
85 int i4b_l1_bchan_tel_silence(unsigned char *data, int len);
86
87 #endif /* _I4B_L1_H_ */