The real, definitive, Visual C++ support branch. Accept no substitutes
[reactos.git] / drivers / bus / acpi / include / platform / acenv.h
1 /******************************************************************************
2 *
3 * Name: acenv.h - Generation environment specific items
4 * $Revision: 1.1 $
5 *
6 *****************************************************************************/
7
8 /*
9 * Copyright (C) 2000, 2001 R. Byron Moore
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25
26 #ifndef __ACENV_H__
27 #define __ACENV_H__
28
29
30 /*
31 * Configuration for ACPI tools and utilities
32 */
33
34 #ifdef _ACPI_DUMP_APP
35 #define ACPI_DEBUG
36 #define ACPI_APPLICATION
37 #define ENABLE_DEBUGGER
38 #define ACPI_USE_SYSTEM_CLIBRARY
39 #define PARSER_ONLY
40 #endif
41
42 #ifdef _ACPI_EXEC_APP
43 #undef DEBUGGER_THREADING
44 #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
45 #define ACPI_DEBUG
46 #define ACPI_APPLICATION
47 #define ENABLE_DEBUGGER
48 #define ACPI_USE_SYSTEM_CLIBRARY
49 #endif
50
51 #ifdef _ACPI_ASL_COMPILER
52 #define ACPI_DEBUG
53 #define ACPI_APPLICATION
54 #define ENABLE_DEBUGGER
55 #define ACPI_USE_SYSTEM_CLIBRARY
56 #endif
57
58 /*
59 * Memory allocation tracking. Used only if
60 * 1) This is the debug version
61 * 2) This is NOT a 16-bit version of the code (not enough real-mode memory)
62 */
63 #ifdef ACPI_DEBUG
64 #ifndef _IA16
65 #define ACPI_DEBUG_TRACK_ALLOCATIONS
66 #endif
67 #endif
68
69 /*
70 * Environment configuration. The purpose of this file is to interface to the
71 * local generation environment.
72 *
73 * 1) ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.
74 * Otherwise, local versions of string/memory functions will be used.
75 * 2) ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and
76 * the standard header files may be used.
77 *
78 * The ACPI subsystem only uses low level C library functions that do not call
79 * operating system services and may therefore be inlined in the code.
80 *
81 * It may be necessary to tailor these include files to the target
82 * generation environment.
83 *
84 *
85 * Functions and constants used from each header:
86 *
87 * string.h: memcpy
88 * memset
89 * strcat
90 * strcmp
91 * strcpy
92 * strlen
93 * strncmp
94 * strncat
95 * strncpy
96 *
97 * stdlib.h: strtoul
98 *
99 * stdarg.h: va_list
100 * va_arg
101 * va_start
102 * va_end
103 *
104 */
105
106 /*! [Begin] no source code translation */
107
108 #ifdef _LINUX
109 #include "aclinux.h"
110
111 #elif _AED_EFI
112 #include "acefi.h"
113
114 #elif WIN32
115 #include "acwin.h"
116
117 #elif __FreeBSD__
118 #include "acfreebsd.h"
119
120 #else
121
122 /* All other environments */
123
124 #define ACPI_USE_STANDARD_HEADERS
125
126 /* Name of host operating system (returned by the _OS_ namespace object) */
127
128 #define ACPI_OS_NAME "Intel ACPI/CA Core Subsystem"
129
130 #endif
131
132
133 /*! [End] no source code translation !*/
134
135 /******************************************************************************
136 *
137 * C library configuration
138 *
139 *****************************************************************************/
140
141 #ifdef ACPI_USE_SYSTEM_CLIBRARY
142 /*
143 * Use the standard C library headers.
144 * We want to keep these to a minimum.
145 *
146 */
147
148 #ifdef ACPI_USE_STANDARD_HEADERS
149 /*
150 * Use the standard headers from the standard locations
151 */
152 #include <stdarg.h>
153 #include <stdlib.h>
154 #include <string.h>
155 #include <ctype.h>
156
157 #endif /* ACPI_USE_STANDARD_HEADERS */
158
159 /*
160 * We will be linking to the standard Clib functions
161 */
162
163 #define STRSTR(s1,s2) strstr((s1), (s2))
164 #define STRUPR(s) strupr((s))
165 #define STRLEN(s) (u32) strlen((s))
166 #define STRCPY(d,s) strcpy((d), (s))
167 #define STRNCPY(d,s,n) strncpy((d), (s), (NATIVE_INT)(n))
168 #define STRNCMP(d,s,n) strncmp((d), (s), (NATIVE_INT)(n))
169 #define STRCMP(d,s) strcmp((d), (s))
170 #define STRCAT(d,s) strcat((d), (s))
171 #define STRNCAT(d,s,n) strncat((d), (s), (NATIVE_INT)(n))
172 #define STRTOUL(d,s,n) strtoul((d), (s), (NATIVE_INT)(n))
173 #define MEMCPY(d,s,n) memcpy((d), (s), (NATIVE_INT)(n))
174 #define MEMSET(d,s,n) memset((d), (s), (NATIVE_INT)(n))
175 #define TOUPPER toupper
176 #define TOLOWER tolower
177 #define IS_XDIGIT isxdigit
178
179 /******************************************************************************
180 *
181 * Not using native C library, use local implementations
182 *
183 *****************************************************************************/
184 #else
185
186 /*
187 * Use local definitions of C library macros and functions
188 * NOTE: The function implementations may not be as efficient
189 * as an inline or assembly code implementation provided by a
190 * native C library.
191 */
192
193 #ifndef va_arg
194
195 #ifndef _VALIST
196 #define _VALIST
197 typedef char *va_list;
198 #endif /* _VALIST */
199
200 /*
201 * Storage alignment properties
202 */
203
204 #define _AUPBND (sizeof (NATIVE_INT) - 1)
205 #define _ADNBND (sizeof (NATIVE_INT) - 1)
206
207 /*
208 * Variable argument list macro definitions
209 */
210
211 #define _bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd)))
212 #define va_arg(ap, T) (*(T *)(((ap) += (_bnd (T, _AUPBND))) - (_bnd (T,_ADNBND))))
213 #define va_end(ap) (void) 0
214 #define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_bnd (A,_AUPBND))))
215
216 #endif /* va_arg */
217
218
219 #define STRSTR(s1,s2) acpi_cm_strstr ((s1), (s2))
220 #define STRUPR(s) acpi_cm_strupr ((s))
221 #define STRLEN(s) acpi_cm_strlen ((s))
222 #define STRCPY(d,s) acpi_cm_strcpy ((d), (s))
223 #define STRNCPY(d,s,n) acpi_cm_strncpy ((d), (s), (n))
224 #define STRNCMP(d,s,n) acpi_cm_strncmp ((d), (s), (n))
225 #define STRCMP(d,s) acpi_cm_strcmp ((d), (s))
226 #define STRCAT(d,s) acpi_cm_strcat ((d), (s))
227 #define STRNCAT(d,s,n) acpi_cm_strncat ((d), (s), (n))
228 #define STRTOUL(d,s,n) acpi_cm_strtoul ((d), (s),(n))
229 #define MEMCPY(d,s,n) acpi_cm_memcpy ((d), (s), (n))
230 #define MEMSET(d,v,n) acpi_cm_memset ((d), (v), (n))
231 #define TOUPPER acpi_cm_to_upper
232 #define TOLOWER acpi_cm_to_lower
233
234 #endif /* ACPI_USE_SYSTEM_CLIBRARY */
235
236
237 /******************************************************************************
238 *
239 * Assembly code macros
240 *
241 *****************************************************************************/
242
243 /*
244 * Handle platform- and compiler-specific assembly language differences.
245 * These should already have been defined by the platform includes above.
246 *
247 * Notes:
248 * 1) Interrupt 3 is used to break into a debugger
249 * 2) Interrupts are turned off during ACPI register setup
250 */
251
252 /* Unrecognized compiler, use defaults */
253 #ifndef ACPI_ASM_MACROS
254
255 #define ACPI_ASM_MACROS
256 #define causeinterrupt(level)
257 #define BREAKPOINT3
258 #define disable()
259 #define enable()
260 #define halt()
261 #define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acq)
262 #define ACPI_RELEASE_GLOBAL_LOCK(Glptr, acq)
263
264 #endif /* ACPI_ASM_MACROS */
265
266
267 #ifdef ACPI_APPLICATION
268
269 /* Don't want software interrupts within a ring3 application */
270
271 #undef causeinterrupt
272 #undef BREAKPOINT3
273 #define causeinterrupt(level)
274 #define BREAKPOINT3
275 #endif
276
277
278 /******************************************************************************
279 *
280 * Compiler-specific
281 *
282 *****************************************************************************/
283
284 /* this has been moved to compiler-specific headers, which are included from the
285 platform header. */
286
287
288 #endif /* __ACENV_H__ */