1 /* 2 This file is part of UFFS, the Ultra-low-cost Flash File System. 3 4 Copyright (C) 2005-2009 Ricky Zheng <[email protected]> 5 6 UFFS is free software; you can redistribute it and/or modify it under 7 the GNU Library General Public License as published by the Free Software 8 Foundation; either version 2 of the License, or (at your option) any 9 later version. 10 11 UFFS is distributed in the hope that it will be useful, but WITHOUT 12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 or GNU Library General Public License, as applicable, for more details. 15 16 You should have received a copy of the GNU General Public License 17 and GNU Library General Public License along with UFFS; if not, write 18 to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 Boston, MA 02110-1301, USA. 20 21 As a special exception, if other files instantiate templates or use 22 macros or inline functions from this file, or you compile this file 23 and link it with other works to produce a work based on this file, 24 this file does not by itself cause the resulting work to be covered 25 by the GNU General Public License. However the source code for this 26 file must still be made available in accordance with section (3) of 27 the GNU General Public License v2. 28 29 This exception does not invalidate any other reasons why a work based 30 on this file might be covered by the GNU General Public License. 31 */ 32 33 #ifndef _UFFS_TYPES_H_ 34 #define _UFFS_TYPES_H_ 35 36 #ifdef __CDT_PARSER__ 37 #undef __cplusplus 38 #endif 39 40 #ifdef __cplusplus 41 extern "C"{ 42 #endif 43 44 #ifdef _UBASE_ 45 #include <sys/utypes.h> 46 #endif 47 48 /** 49 * \file uffs_types.h 50 * \brief basic types used on uffs 51 * \author Ricky Zheng 52 */ 53 54 /* basic types */ 55 56 /** \typedef i8 57 * \brief 8 bit integer 58 */ 59 typedef char i8; 60 61 /** \typedef u8 62 * \brief 8 bit unsigned integer 63 */ 64 typedef unsigned char u8; 65 66 /** \typedef i16 67 * \brief 16 bit integer 68 */ 69 typedef short int i16; 70 71 72 /** \typedef u16 73 * \brief 16 bit unsigned integer 74 */ 75 typedef unsigned short int u16; 76 77 78 /** \typedef i32 79 * \brief 32 bit integer 80 */ 81 typedef int i32; 82 83 /** \typedef u32 84 * \brief 32 bit unsigned integer 85 */ 86 typedef unsigned int u32; 87 88 89 #ifndef _UBASE_ 90 91 #ifndef TRUE 92 #define TRUE 1 93 #endif 94 95 #ifndef FALSE 96 #define FALSE 0 97 #endif 98 99 /* boolean type */ 100 101 /** \typedef UBOOL 102 * \brief boolean type for uffs, the value would be: #U_TRUE or #U_FALSE 103 */ 104 typedef int UBOOL; 105 106 /** \def U_TRUE 107 * \brief boolean true for uffs 108 */ 109 #define U_TRUE (TRUE) 110 111 112 /** \def U_FALSE 113 * \brief boolean false for uffs 114 */ 115 #define U_FALSE (FALSE) 116 117 118 /** \typedef URET 119 * \brief return type for uffs, should be #U_FAIL or #U_SUCC 120 */ 121 typedef int URET; 122 123 /** \def U_FAIL 124 * \brief indicator of fail 125 */ 126 #define U_FAIL -1 127 128 /** \def U_SUCC 129 * \brief indicator of successful 130 */ 131 #define U_SUCC 0 132 133 /** \def IS_SUCC(ret) 134 * \brief is it successful ? 135 */ 136 #define IS_SUCC(ret) (ret >= 0 ? U_TRUE : U_FALSE) 137 138 139 /** \def IS_FAIL(ret) 140 * \brief is it fail ? 141 */ 142 #define IS_FAIL(ret) (ret < 0 ? U_TRUE : U_FALSE) 143 144 #ifndef NULL 145 /** \def NULL 146 * \brief zero for pointer 147 */ 148 #define NULL 0 149 #endif 150 151 #endif // _UBASE_ 152 153 154 #ifdef __cplusplus 155 } 156 #endif 157 158 159 #endif 160 161