TuyaOS
tuya_mem_heap.h
浏览该文件的文档.
1
11#ifndef __TUYA_MEMORY_HEAP_H__
12#define __TUYA_MEMORY_HEAP_H__
13
14#include "tuya_cloud_types.h"
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20#define MEM_HEAP_LIST_NUM (4)
21
22typedef struct {
23 void (*enter_critical)(void);
24 void (*exit_critical)(void);
25 void (*dbg_output)(char* format, ...);
27
28typedef struct {
29 unsigned long total_size; // total heap size
30 unsigned long free_size; // current free heap size
31 unsigned long free_watermark; // minimum ever free heap size
32 unsigned long max_free_block_size; //size of the largest free block
34
35typedef void* HEAP_HANDLE;
36
37int tuya_mem_heap_init(heap_context_t *ctx);
38int tuya_mem_heap_create(void *start_addr, unsigned int size, HEAP_HANDLE *handle);
39int tuya_mem_heap_delete(HEAP_HANDLE handle);
40void* tuya_mem_heap_malloc(HEAP_HANDLE handle, unsigned int size);
41void* tuya_mem_heap_calloc(HEAP_HANDLE handle, unsigned int size);
42void* tuya_mem_heap_realloc(HEAP_HANDLE handle, void *ptr, unsigned int size);
43void tuya_mem_heap_free(HEAP_HANDLE handle, void *ptr);
44void tuya_mem_heap_state(HEAP_HANDLE handle, heap_state_t *state);
45int tuya_mem_heap_available(HEAP_HANDLE handle);
46
47void* tuya_mem_heap_debug_malloc(HEAP_HANDLE handle, unsigned int size, char* filename, int line);
48void* tuya_mem_heap_debug_calloc(HEAP_HANDLE handle, unsigned int size, char* filename, int line);
49void* tuya_mem_heap_debug_realloc(HEAP_HANDLE handle, void *ptr, unsigned int size, char* filename, int line);
50int tuya_mem_heap_diagnose(HEAP_HANDLE handle);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif //__TUYA_MEMORY_HEAP_H__
57
Definition: tuya_mem_heap.h:22
Definition: tuya_mem_heap.h:28