Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenff_memory.h
Go to the documentation of this file.
00001 /***************************************************************************** 00002 * FullFAT - High Performance, Thread-Safe Embedded FAT File-System * 00003 * Copyright (C) 2009 James Walmsley (james@worm.me.uk) * 00004 * * 00005 * This program is free software: you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation, either version 3 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 00017 * * 00018 * IMPORTANT NOTICE: * 00019 * ================= * 00020 * Alternative Licensing is available directly from the Copyright holder, * 00021 * (James Walmsley). For more information consult LICENSING.TXT to obtain * 00022 * a Commercial license. * 00023 * * 00024 * See RESTRICTIONS.TXT for extra restrictions on the use of FullFAT. * 00025 * * 00026 * Removing the above notice is illegal and will invalidate this license. * 00027 ***************************************************************************** 00028 * See http://worm.me.uk/fullfat for more information. * 00029 * Or http://fullfat.googlecode.com/ for latest releases and the wiki. * 00030 *****************************************************************************/ 00031 00038 #ifndef _FF_MEMORY_H_ 00039 #define _FF_MEMORY_H_ 00040 00041 #include "ff_config.h" 00042 #include "ff_types.h" 00043 00044 #ifdef __REACTOS__ 00045 // defined in fullfat.c 00046 void *FF_Malloc(FF_T_UINT32 allocSize); 00047 void FF_Free(void *pBuffer); 00048 #endif 00049 00050 /* 00051 HT changed type of aOffset to u32 00052 */ 00053 //---------- PROTOTYPES 00054 00055 #if defined(FF_LITTLE_ENDIAN) 00056 00057 typedef struct { 00058 FF_T_UINT8 u8_0; 00059 FF_T_UINT8 u8_1; 00060 } FF_T_SHORT; 00061 00062 typedef struct { 00063 FF_T_UINT8 u8_0; 00064 FF_T_UINT8 u8_1; 00065 FF_T_UINT8 u8_2; 00066 FF_T_UINT8 u8_3; 00067 } FF_T_LONG; 00068 00069 #elif defined(FF_BIG_ENDIAN) 00070 00071 typedef struct { 00072 FF_T_UINT8 u8_1; 00073 FF_T_UINT8 u8_0; 00074 } FF_T_SHORT; 00075 00076 typedef struct { 00077 FF_T_UINT8 u8_3; 00078 FF_T_UINT8 u8_2; 00079 FF_T_UINT8 u8_1; 00080 FF_T_UINT8 u8_0; 00081 } FF_T_LONG; 00082 00083 #else 00084 00085 #error Little or Big Endian? - Please set an endianess in ff_config.h 00086 00087 #endif 00088 00090 typedef union { 00091 FF_T_UINT16 u16; 00092 FF_T_SHORT bytes; 00093 } FF_T_UN16; 00094 00096 typedef union { 00097 FF_T_UINT32 u32; 00098 FF_T_LONG bytes; 00099 } FF_T_UN32; 00100 00101 /* HT inlined these functions: 00102 */ 00103 00104 #ifdef FF_INLINE_MEMORY_ACCESS 00105 00106 FF_INLINE FF_T_UINT8 FF_getChar(FF_T_UINT8 *pBuffer, FF_T_UINT32 aOffset) 00107 { 00108 return (FF_T_UINT8) (pBuffer[aOffset]); 00109 } 00110 00111 FF_INLINE FF_T_UINT16 FF_getShort(FF_T_UINT8 *pBuffer, FF_T_UINT32 aOffset) 00112 { 00113 FF_T_UN16 u16; 00114 pBuffer += aOffset; 00115 u16.bytes.u8_1 = pBuffer[1]; 00116 u16.bytes.u8_0 = pBuffer[0]; 00117 return u16.u16; 00118 } 00119 00120 FF_INLINE FF_T_UINT32 FF_getLong(FF_T_UINT8 *pBuffer, FF_T_UINT32 aOffset) { 00121 FF_T_UN32 u32; 00122 pBuffer += aOffset; 00123 u32.bytes.u8_3 = pBuffer[3]; 00124 u32.bytes.u8_2 = pBuffer[2]; 00125 u32.bytes.u8_1 = pBuffer[1]; 00126 u32.bytes.u8_0 = pBuffer[0]; 00127 return u32.u32; 00128 } 00129 00130 FF_INLINE void FF_putChar(FF_T_UINT8 *pBuffer, FF_T_UINT32 aOffset, FF_T_UINT8 Value) { 00131 pBuffer[aOffset] = Value; 00132 } 00133 00134 FF_INLINE void FF_putShort(FF_T_UINT8 *pBuffer, FF_T_UINT32 aOffset, FF_T_UINT16 Value) { 00135 FF_T_UN16 u16; 00136 u16.u16 = Value; 00137 pBuffer += aOffset; 00138 pBuffer[0] = u16.bytes.u8_0; 00139 pBuffer[1] = u16.bytes.u8_1; 00140 } 00141 00142 FF_INLINE void FF_putLong(FF_T_UINT8 *pBuffer, FF_T_UINT32 aOffset, FF_T_UINT32 Value) { 00143 FF_T_UN32 u32; 00144 u32.u32 = Value; 00145 pBuffer += aOffset; 00146 pBuffer[0] = u32.bytes.u8_0; 00147 pBuffer[1] = u32.bytes.u8_1; 00148 pBuffer[2] = u32.bytes.u8_2; 00149 pBuffer[3] = u32.bytes.u8_3; 00150 } 00151 00152 #else 00153 00154 FF_T_UINT8 FF_getChar(FF_T_UINT8 *pBuffer, FF_T_UINT32 aOffset); 00155 FF_T_UINT16 FF_getShort(FF_T_UINT8 *pBuffer, FF_T_UINT32 aOffset); 00156 FF_T_UINT32 FF_getLong(FF_T_UINT8 *pBuffer, FF_T_UINT32 aOffset); 00157 void FF_putChar(FF_T_UINT8 *pBuffer, FF_T_UINT32 aOffset, FF_T_UINT8 Value); 00158 void FF_putShort(FF_T_UINT8 *pBuffer, FF_T_UINT32 aOffset, FF_T_UINT16 Value); 00159 void FF_putLong(FF_T_UINT8 *pBuffer, FF_T_UINT32 aOffset, FF_T_UINT32 Value); 00160 00161 00162 #endif 00163 00164 #endif 00165 Generated on Mon May 28 2012 04:32:56 for ReactOS by
1.7.6.1
|