WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
cstl_public.h
浏览该文件的文档.
1
17#ifndef CSTL_PUBLIC_H
18#define CSTL_PUBLIC_H
19
20#include <stdint.h>
21#include <stdbool.h>
22#include <stddef.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif /* __cpluscplus */
27
28/* ******************************************************************************** */
29/* 公共错误码定义 */
30/* ******************************************************************************** */
31
32enum {
36};
37
42#define CSTL_OK 0
43
48#define CSTL_ERROR (-1)
49
54#define CSTL_ERRNO_BASE (uint32_t)0x0a03u
55
60#define ERRNO_CSTL_ELEMENT_EMPTY ((CSTL_ERRNO_BASE << 16u) | ((uint32_t)ERRNO_ELEMENT_EMPTY))
61
66#define ERRNO_CSTL_INPUT_INVALID ((CSTL_ERRNO_BASE << 16u) | ((uint32_t)ERRNO_INPUT_INVALID))
67
72#define ERRNO_CSTL_NODE_CREATE_FAIL ((CSTL_ERRNO_BASE << 16u) | ((uint32_t)ERRNO_NODE_CREATE_FAIL))
73
85typedef int32_t (*CstlDataCmpFunc)(const void *data1, const void *data2);
86
104typedef int32_t (*CstlKeyCmpFunc)(uintptr_t key1, uintptr_t key2);
105
116typedef bool (*CstlMatchFunc)(const void *node, uintptr_t data);
117
126typedef void *(*CstlDupFunc)(void *ptr, size_t size);
127
135typedef void (*CstlFreeFunc)(void *ptr);
136
144typedef void *(*CstlMallocFunc)(size_t size);
145
155
165
178#define CSTL_CONTAINER_OF(ptr, type, member) \
179 ((type *)((uintptr_t)(ptr) - (uintptr_t)(&(((type *)0)->member))))
180
181#ifdef __cplusplus
182}
183#endif /* __cpluscplus */
184
185#endif /* CSTL_PUBLIC_H */
void(* CstlFreeFunc)(void *ptr)
用户内存释放函数原型
Definition cstl_public.h:135
int32_t(* CstlDataCmpFunc)(const void *data1, const void *data2)
比较函数原型
Definition cstl_public.h:85
int32_t(* CstlKeyCmpFunc)(uintptr_t key1, uintptr_t key2)
比较函数原型
Definition cstl_public.h:104
void *(* CstlMallocFunc)(size_t size)
用户内存申请函数原型
Definition cstl_public.h:144
void *(* CstlDupFunc)(void *ptr, size_t size)
用户数据拷贝函数原型
Definition cstl_public.h:126
bool(* CstlMatchFunc)(const void *node, uintptr_t data)
匹配函数原型
Definition cstl_public.h:116
@ ERRNO_NODE_CREATE_FAIL
Definition cstl_public.h:35
@ ERRNO_ELEMENT_EMPTY
Definition cstl_public.h:33
@ ERRNO_INPUT_INVALID
Definition cstl_public.h:34
key和value函数原型对
Definition cstl_public.h:161
CstlDupFunc dupFunc
Definition cstl_public.h:162
CstlFreeFunc freeFunc
Definition cstl_public.h:163
用户内存申请释放函数对
Definition cstl_public.h:151
CstlFreeFunc freeFunc
Definition cstl_public.h:153
CstlMallocFunc mallocFunc
Definition cstl_public.h:152
unsigned int uintptr_t
Definition td_type.h:65
Definition hal_uart_v151_regs_def.h:38