1 /*
2 * Copyright (c) 1997, 1999 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 * $FreeBSD$
31 *
32 * last edit-date: [Mon Apr 26 11:10:26 1999]
33 *
34 *---------------------------------------------------------------------------*/
35
36 #ifndef _I4B_GLOBAL_H_
37 #define _I4B_GLOBAL_H_
38
39 /*---------------------------------------------------------------------------*
40 * hiding OS differences in the kernel
41 *---------------------------------------------------------------------------*/
42
43 /*---------------*/
44 /* time handling */
45 /*---------------*/
46
47 #ifdef __FreeBSD__
48 #include <sys/param.h>
49 #if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
50
51 #define TIMEOUT_FUNC_T timeout_t *
52 #define SECOND time_second
53 #define MICROTIME(x) getmicrotime(&(x))
54
55 #else /* FreeBSD < 3 */
56
57 #define TIMEOUT_FUNC_T timeout_func_t
58 #define SECOND time.tv_sec
59 #define MICROTIME(x) microtime(&(x))
60
61 #endif /* >= 3 */
62 #endif /* __FreeBSD__ */
63
64 #if defined(__NetBSD__) || defined (__OpenBSD__) || defined(__bsdi__)
65
66 #define TIMEOUT_FUNC_T void *
67 #define SECOND time.tv_sec
68 #define MICROTIME(x) (x) = time
69
70 #endif /* __NetBSD__ */
71
72 /*----------------------*/
73 /* poll/select handling */
74 /*----------------------*/
75
76 #if (defined(__FreeBSD__) && \
77 (!defined(__FreeBSD_version) || (__FreeBSD_version < 300001))) \
78 || defined (__OpenBSD__) || defined(__bsdi__)
79 #define OS_USES_SELECT
80 #else
81 #define OS_USES_POLL
82 #endif
83
84 /*---------------------------------------------------------------------------*
85 * misc globally used things in the kernel
86 *---------------------------------------------------------------------------*/
87
88 /* timer states */
89
90 #define TIMER_IDLE 1 /* a timer is running */
91 #define TIMER_ACTIVE 2 /* a timer is idle */
92
93 /* i4b's spl */
94
95 #define SPLI4B() splimp() /* spl for i4b */
96
97 /* critial code region handling macros */
98
99 #define CRIT_VAR int _svd_spl_ /* declare variable */
100 #define CRIT_BEG _svd_spl_ = SPLI4B() /* save spl */
101 #define CRIT_END splx(_svd_spl_) /* restore spl */
102
103 /* definitions for the STATUS indications L1 -> L2 -> L3 */
104
105 #define STI_ATTACH 0 /* attach at boot time */
106 #define STI_L1STAT 1 /* layer 1 status */
107 #define STI_L2STAT 2 /* layer 2 status */
108 #define STI_TEIASG 3 /* TEI assignments */
109 #define STI_PDEACT 4 /* Layer 1 T4 expired = persistent deactivation */
110 #define STI_NOL1ACC 5 /* no outgoing L1 access possible */
111
112 /* definitions for the COMMAND requests L3 -> L2 -> L1 */
113
114 #define CMR_DOPEN 0 /* daemon opened /dev/i4b */
115 #define CMR_DCLOSE 1 /* daemon closed /dev/i4b */
116
117 /*---------------------------------------------------------------------------
118 *
119 * Number of max supported passive card units
120 *
121 * Teles/Creatix/Neuhaus cards have a hardware limitation
122 * as one is able to set 3 (sometimes 4) different configurations by
123 * jumpers so a maximum of 3 (4) cards per ISA bus is possible.
124 * (Note: there are multiple ISA buses on some architectures)
125 *
126 *---------------------------------------------------------------------------*/
127 #define ISIC_MAXUNIT 3 /* max no of supported units 0..3 */
128
129 #endif /* _I4B_GLOBAL_H_ */
Cache object: d946b42bc881e4fd3c4906e3d7317ea1
|