[rtems commit] score: Refine system initialization order

Sebastian Huber sebh at rtems.org
Mon Jun 20 06:21:10 UTC 2016


Module:    rtems
Branch:    master
Commit:    bc47ec1c99cb519a26fea585c2945c47b234b941
Changeset: http://git.rtems.org/rtems/commit/?id=bc47ec1c99cb519a26fea585c2945c47b234b941

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Jun 20 06:50:12 2016 +0200

score: Refine system initialization order

---

 cpukit/score/include/rtems/sysinit.h  | 16 +++++++++++++---
 testsuites/sptests/spsysinit01/init.c | 36 +++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/cpukit/score/include/rtems/sysinit.h b/cpukit/score/include/rtems/sysinit.h
index e7b9c63..ad68c45 100644
--- a/cpukit/score/include/rtems/sysinit.h
+++ b/cpukit/score/include/rtems/sysinit.h
@@ -72,15 +72,25 @@ extern "C" {
 #define RTEMS_SYSINIT_CLASSIC_USER_TASKS         000706
 #define RTEMS_SYSINIT_POSIX_USER_THREADS         000707
 #define RTEMS_SYSINIT_STD_FILE_DESCRIPTORS       000800
+#define RTEMS_SYSINIT_LAST                       ffffff
 
 /*
  * The value of each order define must consist of exactly two hexadecimal
  * digits without a 0x-prefix.  A 0x-prefix is concatenated with the module and
  * order values to form a proper integer literal.
  */
-#define RTEMS_SYSINIT_ORDER_FIRST  00
-#define RTEMS_SYSINIT_ORDER_MIDDLE 08
-#define RTEMS_SYSINIT_ORDER_LAST   0f
+#define RTEMS_SYSINIT_ORDER_FIRST   00
+#define RTEMS_SYSINIT_ORDER_SECOND  01
+#define RTEMS_SYSINIT_ORDER_THIRD   02
+#define RTEMS_SYSINIT_ORDER_FOURTH  03
+#define RTEMS_SYSINIT_ORDER_FIFTH   04
+#define RTEMS_SYSINIT_ORDER_SIXTH   05
+#define RTEMS_SYSINIT_ORDER_SEVENTH 06
+#define RTEMS_SYSINIT_ORDER_EIGHTH  07
+#define RTEMS_SYSINIT_ORDER_NINETH  08
+#define RTEMS_SYSINIT_ORDER_TENTH   09
+#define RTEMS_SYSINIT_ORDER_MIDDLE  80
+#define RTEMS_SYSINIT_ORDER_LAST    ff
 
 typedef void ( *rtems_sysinit_handler )( void );
 
diff --git a/testsuites/sptests/spsysinit01/init.c b/testsuites/sptests/spsysinit01/init.c
index 88185da..1ce22d5 100644
--- a/testsuites/sptests/spsysinit01/init.c
+++ b/testsuites/sptests/spsysinit01/init.c
@@ -143,6 +143,18 @@ typedef enum {
 #endif /* RTEMS_POSIX_API */
   STD_FILE_DESCRIPTORS_PRE,
   STD_FILE_DESCRIPTORS_POST,
+  LAST_FIRST,
+  LAST_SECOND,
+  LAST_THIRD,
+  LAST_FOURTH,
+  LAST_FIFTH,
+  LAST_SIXTH,
+  LAST_SEVENTH,
+  LAST_EIGHTH,
+  LAST_NINETH,
+  LAST_TENTH,
+  LAST_MIDDLE,
+  LAST_LAST,
   INIT_TASK,
   DONE
 } init_step;
@@ -165,6 +177,17 @@ typedef enum {
   ); \
   static void x##_last(void)
 
+#define LAST_STEP(x) \
+  static void last_##x(void) \
+  { \
+    next_step(LAST_##x); \
+  } \
+  RTEMS_SYSINIT_ITEM( \
+    last_##x, \
+    RTEMS_SYSINIT_LAST, \
+    RTEMS_SYSINIT_ORDER_##x \
+  )
+
 static init_step step;
 
 static void next_step(init_step expected)
@@ -674,6 +697,19 @@ LAST(RTEMS_SYSINIT_STD_FILE_DESCRIPTORS)
   next_step(STD_FILE_DESCRIPTORS_POST);
 }
 
+LAST_STEP(FIRST);
+LAST_STEP(SECOND);
+LAST_STEP(THIRD);
+LAST_STEP(FOURTH);
+LAST_STEP(FIFTH);
+LAST_STEP(SIXTH);
+LAST_STEP(SEVENTH);
+LAST_STEP(EIGHTH);
+LAST_STEP(NINETH);
+LAST_STEP(TENTH);
+LAST_STEP(MIDDLE);
+LAST_STEP(LAST);
+
 static void Init(rtems_task_argument arg)
 {
 #ifdef RTEMS_POSIX_API




More information about the vc mailing list