1 /*
2 * Copyright (c) 1997, 2000 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_global.h - i4b global include file
28 * --------------------------------------
29 *
30 * $Id: i4b_global.h,v 1.4 2002/03/30 17:54:18 martin Exp $
31 *
32 * $FreeBSD$
33 *
34 * last edit-date: [Thu Aug 24 12:38:50 2000]
35 *
36 *---------------------------------------------------------------------------*/
37
38 #ifndef _I4B_GLOBAL_H_
39 #define _I4B_GLOBAL_H_
40
41 /*---------------------------------------------------------------------------*
42 * hiding OS differences in the kernel
43 *---------------------------------------------------------------------------*/
44
45 /*---------------*/
46 /* time handling */
47 /*---------------*/
48
49 #ifdef __FreeBSD__
50 #include <sys/param.h>
51
52 #if defined(__FreeBSD_version) && __FreeBSD_version >= 400000 && __FreeBSD_version < 400011
53 #error "Unsupported FreeBSD-current version,"
54 #error "you need a FreeBSD-current >= 400011"
55 #endif
56
57 #if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
58
59 #define TIMEOUT_FUNC_T timeout_t *
60 #define SECOND time_second
61 #define MICROTIME(x) getmicrotime(&(x))
62
63 #else /* FreeBSD < 3 */
64
65 #define TIMEOUT_FUNC_T timeout_func_t
66 #define SECOND time.tv_sec
67 #define MICROTIME(x) microtime(&(x))
68
69 #endif /* >= 3 */
70 #endif /* __FreeBSD__ */
71
72 #if defined(__NetBSD__) || defined (__OpenBSD__) || defined(__bsdi__)
73
74 #define TIMEOUT_FUNC_T void *
75 #define SECOND time.tv_sec
76 #define MICROTIME(x) microtime(&(x))
77
78 #endif /* __NetBSD__ */
79
80 /*----------------*/
81 /* timer handling */
82 /*----------------*/
83
84 #if defined(__NetBSD__)
85
86 #if __NetBSD_Version__ >= 104230000
87 #define START_TIMER(XHANDLE, XF, XSC, XTIME) callout_reset(&XHANDLE, XTIME, (TIMEOUT_FUNC_T)XF, (void*)XSC)
88 #define STOP_TIMER(XHANDLE, XF, XSC) callout_stop(&XHANDLE)
89 #else
90 #define START_TIMER(XHANDLE, XF, XSC, XTIME) timeout((TIMEOUT_FUNC_T)XF, (void*)XSC, XTIME)
91 #define STOP_TIMER(XHANDLE, XF, XSC) untimeout((TIMEOUT_FUNC_T)XF, (void*)XSC)
92 #endif
93
94 #else
95 #define START_TIMER(XHANDLE, XF, XSC, XTIME) XHANDLE = timeout((TIMEOUT_FUNC_T)XF, (void*)XSC, XTIME)
96 #ifdef __FreeBSD__
97 #define STOP_TIMER(XHANDLE, XF, XSC) untimeout((TIMEOUT_FUNC_T)XF, (void*)XSC, XHANDLE)
98 #else
99 #define STOP_TIMER(XHANDLE, XF, XSC) untimeout((TIMEOUT_FUNC_T)XF, (void*)XSC)
100 #endif
101 #endif
102
103 /*----------------------*/
104 /* poll/select handling */
105 /*----------------------*/
106
107 #if (defined(__FreeBSD__) && \
108 (!defined(__FreeBSD_version) || (__FreeBSD_version < 300001))) \
109 || defined (__OpenBSD__) || defined(__bsdi__)
110 #define OS_USES_SELECT
111 #else
112 #define OS_USES_POLL
113 #endif
114
115 /*---------------------------------------------------------------------------*
116 * misc globally used things in the kernel
117 *---------------------------------------------------------------------------*/
118
119 /* timer states */
120
121 #define TIMER_IDLE 1 /* a timer is running */
122 #define TIMER_ACTIVE 2 /* a timer is idle */
123
124 /* definitions for the STATUS indications L1 -> L2 -> L3 */
125
126 #define STI_ATTACH 0 /* attach at boot time */
127 #define STI_L1STAT 1 /* layer 1 status */
128 #define STI_L2STAT 2 /* layer 2 status */
129 #define STI_TEIASG 3 /* TEI assignments */
130 #define STI_PDEACT 4 /* Layer 1 T4 expired = persistent deactivation */
131 #define STI_NOL1ACC 5 /* no outgoing L1 access possible */
132
133 /* definitions for the COMMAND requests L3 -> L2 -> L1 */
134
135 #define CMR_DOPEN 0 /* daemon opened /dev/i4b */
136 #define CMR_DCLOSE 1 /* daemon closed /dev/i4b */
137 #define CMR_SETTRACE 2 /* set D-channel and B-channel trace */
138 #define CMR_GCST 3 /* get chipset statistics */
139 #define CMR_CCST 4 /* clear chipset statistics */
140 #define CMR_SETLEDS 5 /* set LEDs (if available) */
141
142 /* param for CMR_SETLEDS: */
143 #define CMRLEDS_TEI 1 /* this controller has a TEI */
144 #define CMRLEDS_B0 2 /* first B channel is in use */
145 #define CMRLEDS_B0_IN 4 /* first B channel handles an incoming call */
146 #define CMRLEDS_B1 8 /* second B channel is in use */
147 #define CMRLEDS_B1_IN 16 /* second B channel handles an incoming call */
148
149 #endif /* _I4B_GLOBAL_H_ */
Cache object: ca3ce736fbcef3675cf0f60b6a85f25b
|