23 lines
539 B
C
23 lines
539 B
C
#include "dynmem.h"
|
|
#include "global_state.h"
|
|
#include "utils.h"
|
|
|
|
#if !defined(ETHLIB_MEMORY_POOL_ATTRIBUTES)
|
|
static uint8_t sDynMemPool[ETHLIB_MEMORY_POOL_TOTAL_SIZE];
|
|
#else
|
|
static uint8_t sDynMemPool[ETHLIB_MEMORY_POOL_TOTAL_SIZE] __attribute__((ETHLIB_MEMORY_POOL_ATTRIBUTES));
|
|
#endif
|
|
|
|
void dynmem_init() {
|
|
E.mp = mp_init(sDynMemPool, ETHLIB_MEMORY_POOL_TOTAL_SIZE);
|
|
ASSERT_NULL(E.mp);
|
|
}
|
|
|
|
void * dynmem_alloc_(uint32_t size) {
|
|
return mp_alloc(E.mp, size);
|
|
}
|
|
|
|
void dynmem_free_(void * ptr) {
|
|
mp_free(E.mp, ptr);
|
|
}
|