1 | /* $Id: fsw_base.h 29125 2010-05-06 09:43:05Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * fsw_base.h - Base definitions switch.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | /*-
|
---|
19 | * This code is based on:
|
---|
20 | *
|
---|
21 | * Copyright (c) 2006 Christoph Pfisterer
|
---|
22 | *
|
---|
23 | * Redistribution and use in source and binary forms, with or without
|
---|
24 | * modification, are permitted provided that the following conditions are
|
---|
25 | * met:
|
---|
26 | *
|
---|
27 | * * Redistributions of source code must retain the above copyright
|
---|
28 | * notice, this list of conditions and the following disclaimer.
|
---|
29 | *
|
---|
30 | * * Redistributions in binary form must reproduce the above copyright
|
---|
31 | * notice, this list of conditions and the following disclaimer in the
|
---|
32 | * documentation and/or other materials provided with the
|
---|
33 | * distribution.
|
---|
34 | *
|
---|
35 | * * Neither the name of Christoph Pfisterer nor the names of the
|
---|
36 | * contributors may be used to endorse or promote products derived
|
---|
37 | * from this software without specific prior written permission.
|
---|
38 | *
|
---|
39 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
---|
40 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
---|
41 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
---|
42 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
---|
43 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
45 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
46 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
47 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
48 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
---|
49 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
50 | */
|
---|
51 |
|
---|
52 | #ifndef _FSW_BASE_H_
|
---|
53 | #define _FSW_BASE_H_
|
---|
54 |
|
---|
55 | #ifdef VBOX
|
---|
56 | #include "VBoxFswParam.h"
|
---|
57 | #endif
|
---|
58 |
|
---|
59 | #ifndef FSW_DEBUG_LEVEL
|
---|
60 | /**
|
---|
61 | * Global debugging level. Can be set locally for the scope of a single
|
---|
62 | * file by defining the macro before fsw_base.h is included.
|
---|
63 | */
|
---|
64 | #define FSW_DEBUG_LEVEL 1
|
---|
65 | #endif
|
---|
66 |
|
---|
67 |
|
---|
68 | #ifdef HOST_EFI
|
---|
69 | #include "fsw_efi_base.h"
|
---|
70 | #endif
|
---|
71 |
|
---|
72 | #ifdef HOST_POSIX
|
---|
73 | #include "fsw_posix_base.h"
|
---|
74 | #endif
|
---|
75 |
|
---|
76 | // message printing
|
---|
77 |
|
---|
78 | #if FSW_DEBUG_LEVEL >= 1
|
---|
79 | #define FSW_MSG_ASSERT(params) FSW_MSGFUNC params
|
---|
80 | #else
|
---|
81 | #define FSW_MSG_ASSERT(params)
|
---|
82 | #endif
|
---|
83 |
|
---|
84 | #if FSW_DEBUG_LEVEL >= 2
|
---|
85 | #define FSW_MSG_DEBUG(params) FSW_MSGFUNC params
|
---|
86 | #else
|
---|
87 | #define FSW_MSG_DEBUG(params)
|
---|
88 | #endif
|
---|
89 |
|
---|
90 | #if FSW_DEBUG_LEVEL >= 3
|
---|
91 | #define FSW_MSG_DEBUGV(params) FSW_MSGFUNC params
|
---|
92 | #else
|
---|
93 | #define FSW_MSG_DEBUGV(params)
|
---|
94 | #endif
|
---|
95 |
|
---|
96 |
|
---|
97 | // Documentation for system-dependent defines
|
---|
98 |
|
---|
99 | /**
|
---|
100 | * \typedef fsw_s8
|
---|
101 | * Signed 8-bit integer.
|
---|
102 | */
|
---|
103 |
|
---|
104 | /**
|
---|
105 | * \typedef fsw_u8
|
---|
106 | * Unsigned 8-bit integer.
|
---|
107 | */
|
---|
108 |
|
---|
109 | /**
|
---|
110 | * \typedef fsw_s16
|
---|
111 | * Signed 16-bit integer.
|
---|
112 | */
|
---|
113 |
|
---|
114 | /**
|
---|
115 | * \typedef fsw_u16
|
---|
116 | * Unsigned 16-bit integer.
|
---|
117 | */
|
---|
118 |
|
---|
119 | /**
|
---|
120 | * \typedef fsw_s32
|
---|
121 | * Signed 32-bit integer.
|
---|
122 | */
|
---|
123 |
|
---|
124 | /**
|
---|
125 | * \typedef fsw_u32
|
---|
126 | * Unsigned 32-bit integer.
|
---|
127 | */
|
---|
128 |
|
---|
129 | /**
|
---|
130 | * \typedef fsw_s64
|
---|
131 | * Signed 64-bit integer.
|
---|
132 | */
|
---|
133 |
|
---|
134 | /**
|
---|
135 | * \typedef fsw_u64
|
---|
136 | * Unsigned 64-bit integer.
|
---|
137 | */
|
---|
138 |
|
---|
139 |
|
---|
140 | /**
|
---|
141 | * \def fsw_alloc(size,ptrptr)
|
---|
142 | * Allocate memory on the heap. This function or macro allocates \a size
|
---|
143 | * bytes of memory using host-specific methods. The address of the
|
---|
144 | * allocated memory block is stored into the pointer variable pointed
|
---|
145 | * to by \a ptrptr. A status code is returned; FSW_SUCCESS if the block
|
---|
146 | * was allocated or FSW_OUT_OF_MEMORY if there is not enough memory
|
---|
147 | * to allocated the requested block.
|
---|
148 | */
|
---|
149 |
|
---|
150 | /**
|
---|
151 | * \def fsw_free(ptr)
|
---|
152 | * Release allocated memory. This function or macro returns an allocated
|
---|
153 | * memory block to the heap for reuse. Does not return a status.
|
---|
154 | */
|
---|
155 |
|
---|
156 | /**
|
---|
157 | * \def fsw_memcpy(dest,src,size)
|
---|
158 | * Copies a block of memory from \a src to \a dest. The two memory blocks
|
---|
159 | * must not overlap, or the result of the operation will be undefined.
|
---|
160 | * Does not return a status.
|
---|
161 | */
|
---|
162 |
|
---|
163 | /**
|
---|
164 | * \def fsw_memeq(dest,src,size)
|
---|
165 | * Compares two blocks of memory for equality. Returns boolean true if the
|
---|
166 | * memory blocks are equal, boolean false if they are different.
|
---|
167 | */
|
---|
168 |
|
---|
169 | /**
|
---|
170 | * \def fsw_memzero(dest,size)
|
---|
171 | * Initializes a block of memory with zeros. Does not return a status.
|
---|
172 | */
|
---|
173 |
|
---|
174 |
|
---|
175 | #endif
|
---|