// ********HEAP.H********************** // Fixed Block Size Memory Manager // Last modified 1/16/03 by Jonathan W. Valvano // Copyright 2003 by Jonathan W. Valvano, valvano@uts.cc.utexas.edu // You may use, edit, run or distribute this file // as long as the above copyright notice remains #define BLOCKSIZE 2 // Number of 16-bit words in each block #define NUMBLOCKS 3 // Number of memory blocks #define null 0 // empty pointer value // initialize the Heap // Call this once at the beginning void Heap_Init(void); // Returns a pointer to a memory block of "BlockSize" integers // The returned pointer will be null (0) if the Heap is empty unsigned short *Heap_Allocate(void); // Releases the memory block of "BlockSize" integers pointed to by "pt" // No protection, we assume "pt" points to a previously allocated block void Heap_Release(unsigned short *pt);