HCoop
/
clinton
/
Smoothieware.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
Merge branch 'feature/e-endstop' into merge-abc-with-homing
[clinton/Smoothieware.git]
/
src
/
libs
/
ahbmalloc.cpp
1
#include
"ahbmalloc.h"
2
3
#include <cstring>
4
5
#include <cstdint>
6
// #include <stdio.h>
7
8
#include
"platform_memory.h"
9
10
void
*
ahbmalloc
(
size_t
size
,
BANK bank
)
11
{
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
}
21
}
22
23
void
ahbfree
(
void
*
ptr
,
size_t
size
)
24
{
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
}
35
}