1 /* 2 * Copyright 2006-2007 Advanced Micro Devices, Inc. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included in 12 * all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 * OTHER DEALINGS IN THE SOFTWARE. 21 */ 22 23 /*++ 24 25 Module Name: 26 27 CD_Common_Types.h 28 29 Abstract: 30 31 Defines common data types to use across platforms/SW components 32 33 Revision History: 34 35 NEG:17.09.2002 Initiated. 36 --*/ 37 #ifndef _COMMON_TYPES_H_ 38 #define _COMMON_TYPES_H_ 39 40 #ifdef HAVE_CONFIG_H 41 #include "config.h" 42 #endif 43 44 #ifndef LINUX 45 #if _MSC_EXTENSIONS 46 47 // 48 // use Microsoft* C complier dependent interger width types 49 // 50 // typedef unsigned __int64 uint64_t; 51 // typedef __int64 int64_t; 52 typedef unsigned __int32 uint32_t; 53 typedef __int32 int32_t; 54 #elif defined (__linux__) || defined (__NetBSD__) \ 55 || defined(__sun) || defined(__OpenBSD__) \ 56 || defined (__FreeBSD__) || defined(__DragonFly__) || defined(__GLIBC__) 57 typedef unsigned int uint32_t; 58 typedef int int32_t; 59 #else 60 typedef unsigned long uint32_t; 61 typedef signed long int32_t; 62 #endif 63 typedef unsigned char uint8_t; 64 #if (defined(__sun) && defined(_CHAR_IS_SIGNED)) 65 typedef char int8_t; 66 #else 67 typedef signed char int8_t; 68 #endif 69 typedef unsigned short uint16_t; 70 typedef signed short int16_t; 71 #endif 72 #ifndef UEFI_BUILD 73 typedef signed int intn_t; 74 typedef unsigned int uintn_t; 75 #else 76 #ifndef EFIX64 77 typedef signed int intn_t; 78 typedef unsigned int uintn_t; 79 #endif 80 #endif 81 #ifndef FGL_LINUX 82 #pragma warning ( disable : 4142 ) 83 #endif 84 85 86 #ifndef VOID 87 typedef void VOID; 88 #endif 89 #ifndef UEFI_BUILD 90 typedef intn_t INTN; 91 typedef uintn_t UINTN; 92 #else 93 #ifndef EFIX64 94 typedef intn_t INTN; 95 typedef uintn_t UINTN; 96 #endif 97 #endif 98 #ifndef BOOLEAN 99 typedef uint8_t BOOLEAN; 100 #endif 101 #ifndef INT8 102 typedef int8_t INT8; 103 #endif 104 #ifndef UINT8 105 typedef uint8_t UINT8; 106 #endif 107 #ifndef INT16 108 typedef int16_t INT16; 109 #endif 110 #ifndef UINT16 111 typedef uint16_t UINT16; 112 #endif 113 #ifndef INT32 114 typedef int32_t INT32; 115 #endif 116 #ifndef UINT32 117 typedef uint32_t UINT32; 118 #endif 119 //typedef int64_t INT64; 120 //typedef uint64_t UINT64; 121 typedef uint8_t CHAR8; 122 typedef uint16_t CHAR16; 123 #ifndef USHORT 124 typedef UINT16 USHORT; 125 #endif 126 #ifndef UCHAR 127 typedef UINT8 UCHAR; 128 #endif 129 #ifndef ULONG 130 typedef UINT32 ULONG; 131 #endif 132 133 #ifndef _WIN64 134 #ifndef ULONG_PTR 135 typedef unsigned long ULONG_PTR; 136 #endif // ULONG_PTR 137 #endif // _WIN64 138 139 //#define FAR __far 140 #ifndef TRUE 141 #define TRUE ((BOOLEAN) 1 == 1) 142 #endif 143 144 #ifndef FALSE 145 #define FALSE ((BOOLEAN) 0 == 1) 146 #endif 147 148 #ifndef NULL 149 #define NULL ((VOID *) 0) 150 #endif 151 152 //typedef UINTN CD_STATUS; 153 154 155 #ifndef FGL_LINUX 156 #pragma warning ( default : 4142 ) 157 #endif 158 159 #ifndef ATOM_BIG_ENDIAN 160 #ifdef X_BYTE_ORDER 161 #if X_BYTE_ORDER == X_BIG_ENDIAN 162 #define ATOM_BIG_ENDIAN 1 163 #endif 164 #endif 165 #endif 166 #ifndef ATOM_BIG_ENDIAN 167 #define ATOM_BIG_ENDIAN 0 168 #endif 169 170 #endif // _COMMON_TYPES_H_ 171 172 // EOF 173