1 /* ---------------------------------------------------------------------------- 2 * Copyright (c) Huawei Technologies Co., Ltd. 2013-2018. All rights reserved. 3 * Description: Type define 4 * Redistribution and use in source and binary forms, with or without modification, 5 * are permitted provided that the following conditions are met: 6 * 1. Redistributions of source code must retain the above copyright notice, this list of 7 * conditions and the following disclaimer. 8 * 2. Redistributions in binary form must reproduce the above copyright notice, this list 9 * of conditions and the following disclaimer in the documentation and/or other materials 10 * provided with the distribution. 11 * 3. Neither the name of the copyright holder nor the names of its contributors may be used 12 * to endorse or promote products derived from this software without specific prior written 13 * permission. 14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 15 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * --------------------------------------------------------------------------- */ 26 27 /** 28 * @defgroup los_typedef Type define 29 * @ingroup kernel 30 */ 31 32 #ifndef _LOS_TYPEDEF_H 33 #define _LOS_TYPEDEF_H 34 35 #include "los_builddef.h" 36 37 #ifdef __cplusplus 38 #if __cplusplus 39 extern "C" { 40 #endif /* __cplusplus */ 41 #endif /* __cplusplus */ 42 43 #ifndef LOS_TYPE_DEF 44 #define LOS_TYPE_DEF 45 46 /* type definitions */ 47 typedef unsigned char UINT8; 48 typedef unsigned short UINT16; 49 typedef unsigned int UINT32; 50 typedef signed char INT8; 51 typedef signed short INT16; 52 typedef signed int INT32; 53 typedef float FLOAT; 54 typedef double DOUBLE; 55 typedef char CHAR; 56 57 typedef unsigned int BOOL; 58 typedef unsigned long long UINT64; 59 typedef signed long long INT64; 60 typedef unsigned int UINTPTR; 61 typedef signed int INTPTR; 62 typedef UINT32 size_t; 63 64 #define VOID void 65 #endif /* end of #ifndef LOS_TYPE_DEF */ 66 67 #ifndef FALSE 68 #define FALSE ((BOOL)0) 69 #endif 70 71 #ifndef TRUE 72 #define TRUE ((BOOL)1) 73 #endif 74 75 #ifndef NULL 76 #define NULL ((VOID *)0) 77 #endif 78 79 #ifdef YES 80 #undef YES 81 #endif 82 #define YES 1 83 84 #ifdef NO 85 #undef NO 86 #endif 87 #define NO 0 88 89 #define OS_NULL_BYTE ((UINT8)0xFF) 90 #define OS_NULL_SHORT ((UINT16)0xFFFF) 91 #define OS_NULL_INT ((UINT32)0xFFFFFFFF) 92 93 #ifndef LOS_OK 94 #define LOS_OK 0U 95 #endif 96 97 #ifndef LOS_NOK 98 #define LOS_NOK 1U 99 #endif 100 101 #define OS_FAIL 1 102 #define OS_ERROR (UINT32)(-1) 103 #define OS_INVALID (UINT32)(-1) 104 105 #ifndef LOS_LABEL_DEFN 106 #define LOS_LABEL_DEFN(label) (label) 107 #endif 108 109 #ifndef LOSARC_ALIGNMENT 110 # define LOSARC_ALIGNMENT 8 111 #endif 112 // And corresponding power of two alignment 113 #ifndef LOSARC_P2ALIGNMENT 114 # define LOSARC_P2ALIGNMENT 2 115 #endif 116 117 // Give a type or object explicit minimum alignment 118 # if !defined(LOSBLD_ATTRIB_ALIGN) 119 # define LOSBLD_ATTRIB_ALIGN(__align__) __attribute__((aligned(__align__))) 120 # endif 121 122 // Assign a defined variable to a specific section 123 # if !defined(LOSBLD_ATTRIB_SECTION) 124 # define LOSBLD_ATTRIB_SECTION(__sect__) __attribute__((section (__sect__))) 125 # endif 126 127 // Tell the compiler not to throw away a variable or function. Only known 128 // available on 3.3.2 or above. Old version's didn't throw them away, 129 // but using the unused attribute should stop warnings. 130 #define LOSBLD_ATTRIB_USED __attribute__((used)) 131 132 #ifdef __cplusplus 133 #if __cplusplus 134 } 135 #endif /* __cplusplus */ 136 #endif /* __cplusplus */ 137 138 #endif /* _LOS_TYPEDEF_H */ 139