/* Zero the heap and initialize start, end and lowest-free  */
void mem_init(void)
/* Zero the heap and initialize start, end and lowest-free  */
void mem_init(void)
{
  struct mem *mem;
  LWIP_ASSERT("Sanity check alignment",
    (SIZEOF_STRUCT_MEM & (MEM_ALIGNMENT-1)) == 0);
  ram = LWIP_MEM_ALIGN(ram_heap);
  mem = (struct mem *)ram;
  mem->next = MEM_SIZE_ALIGNED;
  mem->prev = 0;
  mem->used = 0;
  ram_end = (struct mem *)&ram[MEM_SIZE_ALIGNED];
  ram_end->used = 1;
  ram_end->next = MEM_SIZE_ALIGNED;
  ram_end->prev = MEM_SIZE_ALIGNED;
  mem_sem = sys_sem_new(1);
  lfree = (struct mem *)ram;
  MEM_STATS_AVAIL(avail, MEM_SIZE_ALIGNED);
}