1 /** 2 * @file lv_malloc_core.c 3 */ 4 5 /********************* 6 * INCLUDES 7 *********************/ 8 #include "../lv_mem.h" 9 #if LV_USE_STDLIB_MALLOC == LV_STDLIB_MICROPYTHON 10 #include "../../stdlib/lv_mem.h" 11 #include "include/lv_mp_mem_custom_include.h" 12 13 /********************* 14 * DEFINES 15 *********************/ 16 17 /********************** 18 * TYPEDEFS 19 **********************/ 20 21 /********************** 22 * STATIC PROTOTYPES 23 **********************/ 24 25 /********************** 26 * STATIC VARIABLES 27 **********************/ 28 29 /********************** 30 * MACROS 31 **********************/ 32 33 /********************** 34 * GLOBAL FUNCTIONS 35 **********************/ 36 lv_mem_init(void)37void lv_mem_init(void) 38 { 39 return; /*Nothing to init*/ 40 } 41 lv_mem_deinit(void)42void lv_mem_deinit(void) 43 { 44 return; /*Nothing to deinit*/ 45 46 } 47 lv_mem_add_pool(void * mem,size_t bytes)48lv_mem_pool_t lv_mem_add_pool(void * mem, size_t bytes) 49 { 50 /*Not supported*/ 51 LV_UNUSED(mem); 52 LV_UNUSED(bytes); 53 return NULL; 54 } 55 lv_mem_remove_pool(lv_mem_pool_t pool)56void lv_mem_remove_pool(lv_mem_pool_t pool) 57 { 58 /*Not supported*/ 59 LV_UNUSED(pool); 60 return; 61 } 62 lv_malloc_core(size_t size)63void * lv_malloc_core(size_t size) 64 { 65 #if MICROPY_MALLOC_USES_ALLOCATED_SIZE 66 return gc_alloc(size, true); 67 #else 68 return m_malloc(size); 69 #endif 70 } 71 lv_realloc_core(void * p,size_t new_size)72void * lv_realloc_core(void * p, size_t new_size) 73 { 74 75 #if MICROPY_MALLOC_USES_ALLOCATED_SIZE 76 return gc_realloc(p, new_size, true); 77 #else 78 return m_realloc(p, new_size); 79 #endif 80 } 81 lv_free_core(void * p)82void lv_free_core(void * p) 83 { 84 85 #if MICROPY_MALLOC_USES_ALLOCATED_SIZE 86 gc_free(p); 87 88 #else 89 m_free(p); 90 #endif 91 } 92 lv_mem_monitor_core(lv_mem_monitor_t * mon_p)93void lv_mem_monitor_core(lv_mem_monitor_t * mon_p) 94 { 95 /*Not supported*/ 96 LV_UNUSED(mon_p); 97 return; 98 } 99 lv_mem_test_core(void)100lv_result_t lv_mem_test_core(void) 101 { 102 /*Not supported*/ 103 return LV_RESULT_OK; 104 } 105 106 /********************** 107 * STATIC FUNCTIONS 108 **********************/ 109 110 #endif /*LV_STDLIB_MICROPYTHON*/ 111