XFusion API v1.3.0
载入中...
搜索中...
未找到
xf_init_section.h
浏览该文件的文档.
1
12#ifndef __XF_INIT_IMPL_BY_SECTION_H__
13#define __XF_INIT_IMPL_BY_SECTION_H__
14
15/* ==================== [Includes] ========================================== */
16
17#include "../xf_init_config_internal.h"
18
19#if (XF_INIT_IMPL_METHOD == XF_INIT_IMPL_BY_SECTION) || defined(__DOXYGEN__)
20
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* ==================== [Defines] =========================================== */
35
36#if !defined(__GNUC__)
37# error "section 需要启用 GNU 特性"
38#endif
39
40/* ==================== [Typedefs] ========================================== */
41
49typedef int (*xf_init_fn_t)(void);
50
62
63/* ==================== [Global Prototypes] ================================= */
64
69
70/* ==================== [Macros] ============================================ */
71
81#define XF_INIT_EXPORT_SECTION(function, level) \
82 __used __section(".xf_auto_init." level) \
83 const xf_init_section_desc_t __xf_init_##function = { \
84 .func = (function), \
85 .func_name = XSTR(function), \
86 }
87
95#define XF_INIT_EXPORT_SECTION_SETUP(function) XF_INIT_EXPORT_SECTION(function, "1")
96
104#define XF_INIT_EXPORT_SECTION_BOARD(function) XF_INIT_EXPORT_SECTION(function, "2")
105
113#define XF_INIT_EXPORT_SECTION_PREV(function) XF_INIT_EXPORT_SECTION(function, "3")
114
122#define XF_INIT_EXPORT_SECTION_CLEANUP(function) XF_INIT_EXPORT_SECTION(function, "4")
123
131#define XF_INIT_EXPORT_SECTION_DEVICE(function) XF_INIT_EXPORT_SECTION(function, "5")
132
140#define XF_INIT_EXPORT_SECTION_COMPONENT(function) XF_INIT_EXPORT_SECTION(function, "6")
141
149#define XF_INIT_EXPORT_SECTION_ENV(function) XF_INIT_EXPORT_SECTION(function, "7")
150
158#define XF_INIT_EXPORT_SECTION_APP(function) XF_INIT_EXPORT_SECTION(function, "8")
159
160#ifdef __cplusplus
161} /* extern "C" */
162#endif
163
169#endif /* XF_INIT_IMPL_METHOD == XF_INIT_IMPL_BY_SECTION */
170
171#endif /* __XF_INIT_IMPL_BY_SECTION_H__ */
初始化函数详情结构体.
const xf_init_fn_t func
int(* xf_init_fn_t)(void)
初始化函数类型.
void xf_init_from_section(void)
section 注册的函数将会被统一在这个函数里面调用。
struct _xf_init_section_desc_t xf_init_section_desc_t
初始化函数详情结构体.