00001
00002
00003
00004 void bmallocinit(void)
00005
00006 ;
00007
00008 void bfree(char *addr);
00009
00010 char *bmalloc(ushort size, char *pExist);
00011
00012 char *bremalloc(ushort size, char *pExist)
00013
00014 ;
00015
00016 #ifndef IN_BMEM
00017 extern bool lk_bfree;
00018 extern bool lk_bmalloc;
00019 #endif
00020
00021 #define ALLOC_NUMBLOCKS(addr) (*((uchar*)addr - 1))
00022
00023
00024 #define SRAM_BLOCKSIZE 40
00025 #define SRAM_NUMBLOCKS (SRAM_SIZE/SRAM_BLOCKSIZE)
00026
00027 #define BMALLOC
00028 #define BREALLOC
00029 #define BREMALLOC
00030
00031
00032
00033
00034 #ifndef BMALLOC
00035 # ifdef BMEM_DEBUG
00036 # error BMEM_DEBUG defined without BMALLOC; no debug statements to enable
00037 # endif
00038 # ifdef BREALLOC
00039 # error BREALLOC defined without BMALLOC
00040 # endif
00041 # ifdef BREMALLOC
00042 # error BREMALLOC defined without BMALLOC
00043 # endif
00044 #endif
00045
00046 #ifdef BMEM_DEBUG
00047 # ifndef HOSTED_BUILD
00048
00049
00050 # endif
00051 #endif
00052
00053 #ifdef BREMALLOC
00054 # ifndef BREALLOC
00055 # error BREMALLOC defined without BREALLOC
00056 # endif
00057 #endif
00058
00059
00060
00061 #define SRAM_ADDR2BLOCK(addr) ( (addr - bheap) / SRAM_BLOCKSIZE )
00062 #define SRAM_BLOCK2ADDR(block) (bheap + (block * SRAM_BLOCKSIZE))
00063 #define SRAM_BITCLR(block) bitnclr(&(bheap_bitmap[block/8]), block % 8)
00064 #define SRAM_BITSET(block) bitnset(&(bheap_bitmap[block/8]), block % 8)
00065 #define SRAM_BITCHECK(block) bitncheck(&(bheap_bitmap[block/8]), block % 8)