22 lines
579 B
C
22 lines
579 B
C
#include "dynmem.h"
|
|
#include "global_state.h"
|
|
#include "utils.h"
|
|
|
|
#if !defined(ETHLIB_MEMORY_POOL_ATTRIBUTES) || (ETHLIB_MEMORY_POOL_ATTRIBUTES == none)
|
|
static uint8_t sDynMemPool[ETHLIB_MEMORY_POOL_TOTAL_SIZE];
|
|
#elif
|
|
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);
|
|
} |