Fork of Smoothie to port to mbed non-LPC targets.
Fork of Smoothie by
libs/ahbmalloc.cpp
- Committer:
- Bigcheese
- Date:
- 2014-03-02
- Revision:
- 3:f151d08d335c
- Parent:
- 2:1df0b61d3b5a
File content as of revision 3:f151d08d335c:
#include "ahbmalloc.h" #include <cstring> #include <cstdint> // #include <stdio.h> #include "platform_memory.h" void* ahbmalloc(size_t size, BANK bank) { switch(bank) { case AHB_BANK_0: return AHB0.alloc(size); case AHB_BANK_1: return AHB1.alloc(size); default: return NULL; } } void ahbfree(void* ptr, size_t size) { MemoryPool* m = MemoryPool::first; while (m) { if (m->has(ptr)) { m->dealloc(ptr); return; } m = m->next; } }