提交 f837ea41 编写于 作者: B Bernard Xiong

Add component initialization define in rtdef.h

上级 d80a4716
...@@ -83,6 +83,7 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ ...@@ -83,6 +83,7 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#include <stdarg.h> #include <stdarg.h>
#define SECTION(x) __attribute__((section(x))) #define SECTION(x) __attribute__((section(x)))
#define UNUSED __attribute__((unused)) #define UNUSED __attribute__((unused))
#define USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n))) #define ALIGN(n) __attribute__((aligned(n)))
#define rt_inline static __inline #define rt_inline static __inline
/* module compiling */ /* module compiling */
...@@ -128,6 +129,7 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ ...@@ -128,6 +129,7 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#define SECTION(x) __attribute__((section(x))) #define SECTION(x) __attribute__((section(x)))
#define UNUSED __attribute__((unused)) #define UNUSED __attribute__((unused))
#define USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n))) #define ALIGN(n) __attribute__((aligned(n)))
#define rt_inline static __inline #define rt_inline static __inline
#define RTT_API #define RTT_API
...@@ -147,6 +149,23 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ ...@@ -147,6 +149,23 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#define RTT_API #define RTT_API
#endif #endif
/* initialization export */
#ifdef RT_USING_COMPONENTS_INIT
typedef int (*init_fn_t)(void);
#define INIT_EXPORT(fn, level) \
const init_fn_t __rt_init_##fn SECTION(".rti_fn."level) = fn
#else
#define INIT_EXPORT(fn, level)
#endif
/* board init routines will be called in board_init() function */
#define INIT_BOARD_EXPORT(fn) INIT_EXPORT(fn, "1")
/* device/component/fs/app init routines will be called in init_thread */
#define INIT_DEVICE_EXPORT(fn) INIT_EXPORT(fn, "2")
#define INIT_COMPONENT_EXPORT(fn) INIT_EXPORT(fn, "3")
#define INIT_FS_EXPORT(fn) INIT_EXPORT(fn, "4")
#define INIT_APP_EXPORT(fn) INIT_EXPORT(fn, "5")
/* event length */ /* event length */
#define RT_EVENT_LENGTH 32 #define RT_EVENT_LENGTH 32
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册