00001 /************************************************************************** 00002 * 00003 * Copyright (C) 1999 Wittawat Yamwong 00004 * 00005 * Permission is hereby granted, free of charge, to any person obtaining a 00006 * copy of this software and associated documentation files (the "Software"), 00007 * to deal in the Software without restriction, including without limitation 00008 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00009 * and/or sell copies of the Software, and to permit persons to whom the 00010 * Software is furnished to do so, subject to the following conditions: 00011 * 00012 * The above copyright notice and this permission notice shall be included 00013 * in all copies or substantial portions of the Software. 00014 * 00015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00016 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00018 * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, 00019 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 00020 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 00021 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00022 * 00023 **************************************************************************/ 00024 00025 00033 #ifndef _U_MM_H_ 00034 #define _U_MM_H_ 00035 00036 00037 struct mem_block { 00038 struct mem_block *next, *prev; 00039 struct mem_block *next_free, *prev_free; 00040 struct mem_block *heap; 00041 int ofs,size; 00042 unsigned int free:1; 00043 unsigned int reserved:1; 00044 }; 00045 00046 00047 00052 extern struct mem_block *mmInit(int ofs, int size); 00053 00064 extern struct mem_block *mmAllocMem(struct mem_block *heap, int size, int align2, 00065 int startSearch); 00066 00072 extern int mmFreeMem(struct mem_block *b); 00073 00079 extern struct mem_block *mmFindBlock(struct mem_block *heap, int start); 00080 00084 extern void mmDestroy(struct mem_block *mmInit); 00085 00089 extern void mmDumpMemInfo(const struct mem_block *mmInit); 00090 00091 #endif