MXC-A36-Demo/MCU/examples/turnkey/lvgl_Dashboard_8080/Src/dram_mem.c

29 lines
648 B
C
Raw Normal View History

#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include "heap.h"
#include "dram_mem.h"
#define configTOTAL_DRAM_HEAP_SIZE ( ( 12 * 1024 ) )
static bool is_mem_poll_inited = false;
__attribute__((section("dram_section"))) static uint32_t ucHeap[ (configTOTAL_DRAM_HEAP_SIZE >> 2) + 0x10];
void * dram_malloc( uint32_t xWantedSize )
{
if (is_mem_poll_inited == false) {
is_mem_poll_inited = true;
heap_mem_init(HEAP_TYPE_DRAM_BLOCK, (void *)ucHeap, configTOTAL_DRAM_HEAP_SIZE);
}
return heap_mem_alloc(HEAP_TYPE_DRAM_BLOCK, xWantedSize);
}
void dram_free( void * pv )
{
heap_mem_free(pv);
}