summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2013-06-23 07:40:23 +0800
committerBernard Xiong <[email protected]>2013-06-23 07:40:23 +0800
commitf837ea41b1a263e2a3dfc2d4d4d9f0dfe31cb670 (patch)
tree41a62f419c5aa75eaa878ca313f2cf06ad58ac7e /include
parentd80a47168038a1759a5881315a19fdffa06c70e6 (diff)
Add component initialization define in rtdef.h
Diffstat (limited to 'include')
-rw-r--r--include/rtdef.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/rtdef.h b/include/rtdef.h
index 7a983efb65..f7b87cc53e 100644
--- a/include/rtdef.h
+++ b/include/rtdef.h
@@ -83,6 +83,7 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#include <stdarg.h>
#define SECTION(x) __attribute__((section(x)))
#define UNUSED __attribute__((unused))
+ #define USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n)))
#define rt_inline static __inline
/* module compiling */
@@ -128,6 +129,7 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#define SECTION(x) __attribute__((section(x)))
#define UNUSED __attribute__((unused))
+ #define USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n)))
#define rt_inline static __inline
#define RTT_API
@@ -147,6 +149,23 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#define RTT_API
#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 */
#define RT_EVENT_LENGTH 32