enabled specifying numeric config values using all strtof capabilities
[clinton/Smoothieware.git] / src / libs / ahbmalloc.cpp
CommitLineData
764d5be6
MM
1#include "ahbmalloc.h"
2
3077abb6 3#include <cstring>
303a5d46 4
3077abb6 5#include <cstdint>
303a5d46 6// #include <stdio.h>
303a5d46 7
3077abb6 8#include "platform_memory.h"
764d5be6
MM
9
10void* ahbmalloc(size_t size, BANK bank)
11{
3077abb6
MM
12 switch(bank)
13 {
14 case AHB_BANK_0:
15 return AHB0.alloc(size);
16 case AHB_BANK_1:
17 return AHB1.alloc(size);
18 default:
19 return NULL;
20 }
764d5be6
MM
21}
22
23void ahbfree(void* ptr, size_t size)
24{
3077abb6
MM
25 MemoryPool* m = MemoryPool::first;
26 while (m)
27 {
28 if (m->has(ptr))
29 {
30 m->dealloc(ptr);
31 return;
32 }
33 m = m->next;
34 }
764d5be6 35}