xt-sdk 文档
v1.0.3
xt-sdk 嵌入式 SDK API 参考
Toggle main menu visibility
载入中...
搜索中...
未找到
xt_mem.h
浏览该文件的文档.
1
12
13
#ifndef __XT_MEM_H__
14
#define __XT_MEM_H__
15
16
/* ==================== [Includes] ========================================== */
17
18
#include <stddef.h>
19
#include <stdint.h>
20
21
#include "
xt_error.h
"
22
23
#ifdef __cplusplus
24
extern
"C"
{
25
#endif
26
33
34
/* ==================== [Defines] =========================================== */
35
36
#define XT_MEM_CAP_REGION_S (0)
37
#define XT_MEM_CAP_REGION_W (4)
38
#define XT_MEM_CAP_ALIGN_S (4)
39
#define XT_MEM_CAP_ALIGN_W (4)
40
#define XT_MEM_CAP_FLAG_S (8)
41
#define XT_MEM_CAP_FLAG_W (8)
42
43
/* 内存区域 */
44
#define XT_MEM_CAP_DEFAULT (0 << XT_MEM_CAP_REGION_S)
45
#define XT_MEM_CAP_EXTERNAL (1 << XT_MEM_CAP_REGION_S)
46
#define XT_MEM_CAP_REGION_0 (2 << XT_MEM_CAP_REGION_S)
47
#define XT_MEM_CAP_REGION_1 (3 << XT_MEM_CAP_REGION_S)
48
#define XT_MEM_CAP_REGION_2 (4 << XT_MEM_CAP_REGION_S)
49
#define XT_MEM_CAP_REGION_3 (5 << XT_MEM_CAP_REGION_S)
50
#define XT_MEM_CAP_REGION_4 (6 << XT_MEM_CAP_REGION_S)
51
#define XT_MEM_CAP_REGION_5 (7 << XT_MEM_CAP_REGION_S)
52
53
/* 内存对齐 */
54
#define XT_MEM_CAP_ALIGN_8 (0 << XT_MEM_CAP_ALIGN_S)
55
#define XT_MEM_CAP_ALIGN_16 (1 << XT_MEM_CAP_ALIGN_S)
56
#define XT_MEM_CAP_ALIGN_32 (2 << XT_MEM_CAP_ALIGN_S)
57
#define XT_MEM_CAP_ALIGN_64 (3 << XT_MEM_CAP_ALIGN_S)
58
// #define XT_MEM_CAP_ALIGN_128 (4 << XT_MEM_CAP_ALIGN_S) /*!< 128 位对齐 */
59
// #define XT_MEM_CAP_ALIGN_256 (5 << XT_MEM_CAP_ALIGN_S) /*!< 256 位对齐 */
60
// #define XT_MEM_CAP_ALIGN_512 (6 << XT_MEM_CAP_ALIGN_S) /*!< 512 位对齐 */
61
// #define XT_MEM_CAP_ALIGN_1024 (7 << XT_MEM_CAP_ALIGN_S) /*!< 1024 位对齐 */
62
63
/* 内存标志 */
64
#define XT_MEM_CAP_RESET (1 << 8)
65
#define XT_MEM_CAP_DMA (1 << 9)
66
#define XT_MEM_CAP_EXEC (1 << 10)
67
68
/* ==================== [Typedefs] ========================================== */
69
70
/* ==================== [Global Prototypes] ================================= */
71
78
void
*
xt_mem_malloc
(
size_t
size);
79
87
void
*
xt_mem_calloc
(
size_t
count,
size_t
size);
88
96
void
*
xt_mem_realloc
(
void
*ptr,
size_t
size);
97
104
xt_err_t
xt_mem_free
(
void
*ptr);
105
113
void
*
xt_mem_caps_malloc
(
size_t
size, uint32_t caps);
114
123
void
*
xt_mem_caps_realloc
(
void
*ptr,
size_t
size, uint32_t caps);
124
131
xt_err_t
xt_mem_caps_free
(
void
*ptr);
132
133
/* ==================== [Macros] ============================================ */
134
135
#define xt_malloc(size) xt_mem_malloc(size)
136
#define xt_calloc(count, size) xt_mem_calloc((count), (size))
137
#define xt_realloc(ptr, size) xt_mem_realloc((ptr), (size))
138
#define xt_free(ptr) xt_mem_free(ptr)
139
140
#define xt_caps_malloc(size, caps) xt_mem_caps_malloc((size), (caps))
141
#define xt_caps_realloc(ptr, size, caps) xt_mem_caps_realloc((ptr), (size), (caps))
142
#define xt_caps_free(ptr) xt_mem_caps_free(ptr)
143
/* xt_mem */
145
146
#ifdef __cplusplus
147
}
/* extern "C" */
148
#endif
149
150
#endif
/* __XT_MEM_H__ */
xt_err_t
int32_t xt_err_t
错误码类型
定义
xt_error.h:38
xt_mem_caps_malloc
void * xt_mem_caps_malloc(size_t size, uint32_t caps)
分配特定的内存
xt_mem_caps_free
xt_err_t xt_mem_caps_free(void *ptr)
释放内存
xt_mem_caps_realloc
void * xt_mem_caps_realloc(void *ptr, size_t size, uint32_t caps)
重新分配特定的内存
xt_mem_calloc
void * xt_mem_calloc(size_t count, size_t size)
分配并清空内存
xt_mem_realloc
void * xt_mem_realloc(void *ptr, size_t size)
重新分配内存大小
xt_mem_free
xt_err_t xt_mem_free(void *ptr)
释放内存
xt_mem_malloc
void * xt_mem_malloc(size_t size)
分配内存
xt_error.h
XTINY 错误码定义
platforms
components
xtiny
xt_mem
xt_mem.h
生成于
, 为 xt-sdk 文档使用
1.17.0