XFusion API v1.3.0
载入中...
搜索中...
未找到
xf_init_registry.h
浏览该文件的文档.
1
12#ifndef __XF_INIT_REGISTRY_H__
13#define __XF_INIT_REGISTRY_H__
14
15/* ==================== [Includes] ========================================== */
16
17#include "../xf_init_config_internal.h"
18#include "xf_utils.h"
19
20#if (XF_INIT_IMPL_METHOD == XF_INIT_IMPL_BY_REGISTRY) \
21 || (XF_INIT_IMPL_METHOD == XF_INIT_IMPL_BY_CONSTRUCTOR) \
22 || defined(__DOXYGEN__)
23
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37/* ==================== [Defines] =========================================== */
38
39#if defined(__GNUC__) && !defined(__constructor) && XF_INIT_IMPL_METHOD == XF_INIT_IMPL_BY_CONSTRUCTOR
40# define __constructor __attribute__((constructor))
41#else
42# define __constructor
43#endif
44
45/* ==================== [Typedefs] ========================================== */
46
62
70typedef int (*xf_init_fn_t)(void);
71
83
93
94/* ==================== [Global Prototypes] ================================= */
95
103
108void xf_init_from_registry(void);
109
110/* ==================== [Macros] ============================================ */
111
112#define XF_INIT_EXPORT_REGISTRY(type, function) \
113 void __used __constructor __xf_init_registry_##function(void) { \
114 static const xf_init_registry_desc_t CONCAT(__xf_init_desc_, function) = { \
115 .func = (function), \
116 .func_name = XSTR(function), \
117 };\
118 static xf_init_registry_desc_node_t CONCAT(__xf_init_desc_node_, function) = { \
119 .node = XF_LIST_HEAD_INIT(CONCAT(__xf_init_desc_node_, function).node), \
120 .p_desc = &CONCAT(__xf_init_desc_, function), \
121 };\
122 xf_init_registry_register_desc_node(&CONCAT(__xf_init_desc_node_, function), XF_INIT_REGISTRY_TYPE_##type); \
123 }
124
132#define XF_INIT_EXPORT_REGISTRY_SETUP(function) XF_INIT_EXPORT_REGISTRY(SETUP, function)
133
141#define XF_INIT_EXPORT_REGISTRY_BOARD(function) XF_INIT_EXPORT_REGISTRY(BOARD, function)
142
150#define XF_INIT_EXPORT_REGISTRY_PREV(function) XF_INIT_EXPORT_REGISTRY(PREV, function)
151
159#define XF_INIT_EXPORT_REGISTRY_CLEANUP(function) XF_INIT_EXPORT_REGISTRY(CLEANUP, function)
160
168#define XF_INIT_EXPORT_REGISTRY_DEVICE(function) XF_INIT_EXPORT_REGISTRY(DEVICE, function)
169
177#define XF_INIT_EXPORT_REGISTRY_COMPONENT(function) XF_INIT_EXPORT_REGISTRY(COMPONENT, function)
178
186#define XF_INIT_EXPORT_REGISTRY_ENV(function) XF_INIT_EXPORT_REGISTRY(ENV, function)
187
195#define XF_INIT_EXPORT_REGISTRY_APP(function) XF_INIT_EXPORT_REGISTRY(APP, function)
196
197#ifdef __cplusplus
198} /* extern "C" */
199#endif
200
206#endif /* (XF_INIT_IMPL_METHOD == XF_INIT_IMPL_BY_REGISTRY) \
207 || (XF_INIT_IMPL_METHOD == XF_INIT_IMPL_BY_CONSTRUCTOR) \
208 || defined(__DOXYGEN__) */
209
210#endif /* __XF_INIT_REGISTRY_H__ */
初始化函数链表结构体.
const xf_init_registry_desc_t *const p_desc
初始化函数详情结构体.
const xf_init_fn_t func
双向链表结构体.
Definition xf_list.h:64
enum _xf_init_registry_type_t xf_init_registry_type_t
初始化功能类型。
void xf_init_registry_register_desc_node(xf_init_registry_desc_node_t *p_desc_node, xf_init_registry_type_t type)
(内部函数)注册初始化函数,无需直接调用,使用宏调用
_xf_init_registry_type_t
初始化功能类型。
@ XF_INIT_REGISTRY_TYPE_SETUP
@ XF_INIT_REGISTRY_TYPE_APP
@ XF_INIT_REGISTRY_TYPE_MAX
@ XF_INIT_REGISTRY_TYPE_DEVICE
@ XF_INIT_REGISTRY_TYPE_PREV
@ XF_INIT_REGISTRY_TYPE_BOARD
@ XF_INIT_REGISTRY_TYPE_CLEANUP
@ XF_INIT_REGISTRY_TYPE_ENV
@ XF_INIT_REGISTRY_TYPE_COMPONENT
int(* xf_init_fn_t)(void)
初始化函数类型.
struct _xf_init_registry_desc_t xf_init_registry_desc_t
初始化函数详情结构体.
struct _xf_init_registry_desc_node_t xf_init_registry_desc_node_t
初始化函数链表结构体.
void xf_init_from_registry(void)
注册函数收集后,统一在此调用初始化函数