The Socrates Gameboy Advance Development Engine
The SGADE is a development library for the Nintendo Gameboy
Advance. It's free for all uses and is distributed without guarantees.
For more information visit
the SGADE page.
00001 // ---------------------------------------------------------------------------- 00013 // ---------------------------------------------------------------------------- 00014 00015 #ifndef SO_MEMORY_MANAGER_H 00016 #define SO_MEMORY_MANAGER_H 00017 00018 #ifdef __cplusplus 00019 extern "C" { 00020 #endif 00021 00022 00023 // ---------------------------------------------------------------------------- 00067 00068 // ---------------------------------------------------------------------------- 00069 00070 // ---------------------------------------------------------------------------- 00071 // Includes; 00072 // ---------------------------------------------------------------------------- 00073 00074 #include "SoSystem.h" 00075 00076 00077 // ---------------------------------------------------------------------------- 00078 // Configuration Defines 00079 // ---------------------------------------------------------------------------- 00080 00081 #ifdef SO_DEBUG 00084 #define SO_MEM_MANAGER_VERIFY 00085 #endif 00086 00090 #define SO_MEM_MANAGER_SINGLE_POOL_BASE &g_u32MemPool[0] 00091 00095 #define SO_MEM_MANAGER_SINGLE_POOL_SIZE 0x00001000 00096 00102 #define SO_MEM_MANAGER_BLOCK_BITS 3 00103 00104 // ---------------------------------------------------------------------------- 00105 // Defines 00106 // ---------------------------------------------------------------------------- 00107 00108 #ifdef SO_MEM_MANAGER_SINGLE_POOL_BASE 00111 extern u32 g_u32MemPool[]; 00112 #endif 00113 00114 00115 // ---------------------------------------------------------------------------- 00116 // Functions; 00117 // ---------------------------------------------------------------------------- 00118 00119 #ifdef SO_MEM_MANAGER_SINGLE_POOL_BASE 00120 00121 void SoMemManagerInit(void); 00122 void* SoMemManagerAlloc(u16 iSize); 00123 void SoMemManagerFree(void* pBuf); 00124 00125 #else 00126 00127 #ifdef SO_MEM_MANAGER_BLOCK_BITS 00128 void SoMemManagerInit(u32* pMemPool, u32 iBufSize); 00129 #else 00130 void SoMemManagerInit(u32* pMemPool, u32 iBufSize, u16 iBlockSize); 00131 #endif 00132 void* SoMemManagerAlloc(u32* pMemPool, u16 iSize); 00133 void SoMemManagerFree(u32* pMemPool, void* pBuf); 00134 00135 #endif 00136 00137 00138 // ---------------------------------------------------------------------------- 00139 // EOF 00140 // ---------------------------------------------------------------------------- 00141 00143 00144 #ifdef __cplusplus 00145 } // extern "C" 00146 #endif 00147 00148 #endif