APP_MEM

Defines

SRAM_SECT_BEG
SRAM_SECT_END
PSRAM_RET_SECT_BEG
PSRAM_RET_SECT_END
PSRAM_NON_RET_SECT_BEG
PSRAM_NON_RET_SECT_END
PSRAM_RET_SECT_X_BEG
PSRAM_RET_SECT_X_END
PSRAM_HEAP_SECT_BEG
PSRAM_HEAP_SECT_END
ALIGN_4
ALIGN_32
app_mem_is_sysheap(p)

Check if p is in the sysheap.

app_mem_is_in_memheap(heap, ptr)

Check if p is in the memheap(heap).

app_memcpy
app_memset
sys_heap_get_ie(p, ie)

redefine ezip mem alloc/free which defined in SDK.

MEM_SET_HEADER_IE(p, ie, x)
MEM_GET_HEADER_IE(p, ie)
app_mem_get_size(p)
RET_ADDR
RET_ADDR_TRACE(p)

RET_ADDR_TRACE used for memory trace.

PSRAM_CACHE_SIZE
FORCE_REUSE_ANIM_BUF
SIMULATOR_MEM_LEAKAGE_MALLOC(mode, x)
SIMULATOR_MEM_LEAKAGE_CALLOC(mode, x, y)
SIMULATOR_MEM_LEAKAGE_REALLOC(mode, x, y)
SIMULATOR_MEM_LEAKAGE_FREE(mode, x)
MEM_SET_REF_COUNT(p, count)

Enums

enum image_cache_t

Values:

enumerator CACHE_NONE

none

enumerator CACHE_SYSHEAP

Apply memory block in system heap.

enumerator CACHE_SRAM

Apply memory block in sram heap.

enumerator CACHE_PSRAM

Apply memory block in psram heap.

enum svg_mem_mode_t

Values:

enumerator FIX_MODE_NONE
enumerator FIX_MODE_REUSE_ANIM_BUF
enum mem_aysnc_type_t

Values:

enumerator MEM_ASYN_IMG
enumerator MEM_ASYN_FONT

Functions

rt_uint32_t rt_mem_available_size(void)

Get the available size of system_heap's memory block.

rt_uint32_t rt_mem_header_size(void)

Get the header size of system_heap's memory block.

rt_uint32_t rt_mem_ret_addr_offset(void)

Get the offset of system_heap's return_address.

返回值:

offset -- the relative offset of return_address in struct heap_mem

uint8_t rt_mem_is_sysheap(void *ptr)

Check if memory block is in system_heap.

参数:
  • uint8_t -- 0: not in system_heap; 1: in system_heap.

void *app_sram_alloc(rt_size_t size)

Allocate mem from sram_memheap. These memory are used for DMA or performance related scenarios.

参数:
  • size -- Size of the memory to allocate in bytes

返回值:

pointer -- to the allocated memory

void *app_sram_realloc(void *ptr, rt_size_t newsize)

Reallocate mem from sram_memheap. Reallocate a memory with a new size. The old content will be kept.

参数:
  • ptr -- pointer to an allocated memory. Its content will be copied to the new memory block and freed

  • newsize -- the desired new size in byte

返回值:

pointer -- Pointer of reallocated memory.

void *app_sram_calloc(rt_size_t count, rt_size_t size)

Allocate mem from sram_memheap. The allocated memory is filled with bytes of value zero.

参数:
  • count -- Number of objects to allocate.

  • size -- Size of the objects to allocate.

返回值:

pointer -- Pointer of reallocated memory.

void app_sram_free(void *ptr)

Aree mem from sram_memheap.

参数:
  • ptr -- the address of memory which will be released.

void *app_malloc(uint32_t size)

Allocate mem sequentially from block_mem/sys_heap/sram_memheap/psram_memheap.

参数:
  • size -- Size of the memory to allocate in bytes

返回值:

pointer -- Pointer of allocated memory.

void *app_calloc(uint32_t count, uint32_t size)

Allocate mem sequentially from block_mem/sys_heap/sram_memheap/psram_memheap. The allocated memory is filled with bytes of value zero.

参数:
  • count -- Number of objects to allocate.

  • size -- Size of the objects to allocate.

返回值:

pointer -- Pointer of allocated memory.

void *app_realloc(void *ptr, uint32_t new_size)

Reallocate mem sequentially from block_mem/sys_heap/sram_memheap/psram_memheap. Reallocate a memory with a new size. The old content will be kept.

参数:
  • ptr -- pointer to an allocated memory. Its content will be copied to the new memory block and freed

  • newsize -- the desired new size in byte

返回值:

pointer -- Pointer of allocated memory.

void app_free(void *p)

This function will release the previously allocated memory block by app_malloc/app_calloc/app_realloc. The released memory block is taken back to memheap.

参数:
  • p -- the address of memory which will be released.

char *app_strdup(const char *s)

brief Duplicate a string using application-specific memory allocation. This function creates a dynamically allocated copy of the input string. It safely handles NULL inputs and ensures the copied string is null-terminated. Memory allocated by this function should be freed with app_free() to avoid leaks.

参见

app_free() - Corresponding function to free the allocated memory.

备注

Uses app_malloc() for memory allocation, which may have specific behaviors (e.g., tracking, alignment) depending on the application's memory management system.

参数:
  • s -- Input string to duplicate. If NULL, the function returns NULL.

返回:

Pointer to the newly allocated string, or NULL if allocation fails.

void *app_cache_alloc(size_t size, uint16_t cache_type)

Allocate mem sequentially from sram_memheap/psram_memheap.

参数:
  • size -- Size of the memory to allocate in bytes

  • cache_type -- Allocted memory type, CACHE_SRAM or CACHE_PSRAM

返回值:

pointer -- Pointer of allocated memory.

void *app_cache_calloc(rt_size_t count, rt_size_t size, uint16_t cache_type)

Allocate mem sequentially from sram_memheap/psram_memheap. The allocated memory is filled with bytes of value zero.

参数:
  • size -- Size of the memory to allocate in bytes

  • cache_type -- Allocted memory type, CACHE_SRAM or CACHE_PSRAM

返回值:

pointer -- Pointer of allocated memory.

void *app_cache_realloc(void *ptr, size_t nbytes)

Reallocate mem sequentially from sram_memheap/psram_memheap. Reallocate a memory with a new size. The old content will be kept.

参数:
  • ptr -- Pointer to an allocated memory. Its content will be copied to the new memory block and freed

  • nbytes -- The desired new size in byte

返回值:

pointer -- Pointer of allocated memory.

void app_cache_free(void *p)

This function will release the previously allocated memory block by app_cache_alloc/app_cache_calloc/app_cache_realloc. The released memory block is taken back to sram_memheap/psram_memheap.

参数:
  • p -- the address of memory which will be released

lv_img_dsc_t *app_cache_copy_alloc(lv_obj_t *src_img, uint16_t cache_type)

Allocated cache copy of image in sram_memheap/psram_memheap. especially for rotating image, to accelerate rotating.

参数:
  • src_img -- Pointer to img_obj.

  • cache_type -- Allocted memory type, CACHE_SRAM or CACHE_PSRAM

返回值:

pointer -- Pointer of allocated memory, which type is lv_img_dsc_t.

void app_cache_copy_free(lv_img_dsc_t *rel_mem)

Free cache copy of image, which allocated using app_cache_copy_alloc.

参数:
  • rel_mem -- Pointer of allocated memory, which type is lv_img_dsc_t.

void *app_anim_buf_alloc(size_t nbytes, uint8_t index)

Allocate fixed_length memory for switch_animation's snapshot.

参数:
  • nbytes -- Size of snapshot memory.

  • index -- Snapshot index

void *app_anim_buf_alloc_ext(size_t nbytes, uint8_t index)

Allocate variable_length memory for switch_animation's snapshot.

参数:
  • nbytes -- Size of snapshot memory.

  • index -- Snapshot index

void *app_anim_buf_free(void *ptr)

Free snapshot memory. NOTE: not applied!!! only for check overflow.

参数:
  • ptr -- Snapshot pointer to be free, which successsful apply by app_anim_buf_alloc_ext

int app_anim_buf_set_as_memheap(int as_memheap)

Temporarily set anim_buf to memheap. Once app_cache_xxx fails to allocate memory, use anim_buf for memory allocation.

参数:
  • as_memheap -- Enable or Disable.

void *app_anim_alloc(size_t size)
void *app_anim_calloc(rt_size_t count, rt_size_t size)
void *app_anim_realloc(void *ptr, size_t nbytes)
void app_anim_free(void *ptr)
char *app_anim_strdup(const char *s)
void app_svg_memheap_config(svg_mem_mode_t mode, size_t max_num, size_t fixed_size)

Provide a mechanism for sequentially allocating fixed-length memory blocks. Important Note: The memory blocks must be freed in reverse order of their allocation; otherwise, subsequent allocations will fail. This mechanism is primarily designed for SVG parsing.

void *app_svg_alloc(size_t nbytes)
void app_svg_free(void *ptr)
void app_mem_flush_cache(void *data, uint32_t size)

D-Cache Clean by address.

参数:
  • data -- Address

  • size -- Size of memory block (in number of bytes)

void app_mem_invalid_icache(void *data, uint32_t size)

I-Cache Invalid by address.

参数:
  • data -- Address

  • size -- Size of memory block (in number of bytes)

uint32_t app_mem_get_size(void *p)

Get mem size.

void *ft_scalloc(rt_size_t count, rt_size_t size)

Provide mem alloc for freetype.

void *ft_srealloc(void *ptr, rt_size_t nbytes)
void ft_sfree(void *ptr)
void *sifli_memcpy(void *dst, const void *src, rt_ubase_t count)

sifli_memxxx is DMA operation function.

void *sifli_memset(void *s, int c, rt_ubase_t count)
void app_mem_free_asyn_node(void)
void app_mem_set_ref_count(void *ptr, int ref_count, int type)
void app_mem_insert_asyn_node(void *ptr, void (*)(void*))

警告

doxygenfile: Cannot find file "app_bmem.h