Ooops, checked in the wrong version before :-(

This commit is contained in:
goldsimon 2007-05-11 19:42:50 +00:00
parent 6f4056cf99
commit ab4993fda2

View File

@ -60,13 +60,16 @@ struct mem {
}; };
/* All allocated blocks will be MIN_SIZE bytes big, at least! */ /* All allocated blocks will be MIN_SIZE bytes big, at least! */
#define MIN_SIZE MEM_ALIGN_SIZE(12) #ifndef MIN_SIZE
#define MIN_SIZE 12
#endif /* MIN_SIZE */
#define MIN_SIZE_ALIGNED MEM_ALIGN_SIZE(MIN_SIZE)
#define SIZEOF_STRUCT_MEM MEM_ALIGN_SIZE(sizeof(struct mem)) #define SIZEOF_STRUCT_MEM MEM_ALIGN_SIZE(sizeof(struct mem))
#define MEM_SIZE_ALIGNED MEM_ALIGN_SIZE(MEM_SIZE) #define MEM_SIZE_ALIGNED MEM_ALIGN_SIZE(MEM_SIZE)
static struct mem *ram_end; static struct mem *ram_end;
/* the heap. we need one struct mem at the end and some room for alignment */ /* the heap. we need one struct mem at the end and some room for alignment */
static u8_t ram_heap[MEM_SIZE_ALIGNED + SIZEOF_STRUCT_MEM + MEM_ALIGNMENT]; static u8_t ram_heap[MEM_SIZE_ALIGNED + (2*SIZEOF_STRUCT_MEM) + MEM_ALIGNMENT];
static u8_t *ram; /* for alignment, ram is now a pointer instead of an array */ static u8_t *ram; /* for alignment, ram is now a pointer instead of an array */
static struct mem *lfree; /* pointer to the lowest free block */ static struct mem *lfree; /* pointer to the lowest free block */
static sys_sem_t mem_sem; /* concurrent access protection */ static sys_sem_t mem_sem; /* concurrent access protection */