[rtems commit] Use linker set for Classic User Tasks init

Sebastian Huber sebh at rtems.org
Wed Feb 3 09:35:49 UTC 2016


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Jan 26 11:10:43 2016 +0100

Use linker set for Classic User Tasks init

Update #2408.

---

 cpukit/rtems/include/rtems/rtems/tasks.h |  9 ---------
 cpukit/rtems/src/tasks.c                 | 16 ----------------
 cpukit/sapi/include/confdefs.h           |  9 +++++----
 cpukit/score/include/rtems/sysinit.h     |  1 +
 testsuites/sptests/spsysinit01/init.c    | 14 ++++++++++++++
 5 files changed, 20 insertions(+), 29 deletions(-)

diff --git a/cpukit/rtems/include/rtems/rtems/tasks.h b/cpukit/rtems/include/rtems/rtems/tasks.h
index 45c01c4..11e2780 100644
--- a/cpukit/rtems/include/rtems/rtems/tasks.h
+++ b/cpukit/rtems/include/rtems/rtems/tasks.h
@@ -584,15 +584,6 @@ typedef struct {
 }  RTEMS_API_Control;
 
 /**
- *  When the user configures a set of Classic API initialization tasks,
- *  This variable will point to the method used to initialize them.
- *
- *  @note It is instantiated and initialized by confdefs.h based upon
- *        application requirements.
- */
-extern void (*_RTEMS_tasks_Initialize_user_tasks_p)(void);
-
-/**
  *  @brief _RTEMS_tasks_Initialize_user_tasks_body
  *
  *  This routine creates and starts all configured user
diff --git a/cpukit/rtems/src/tasks.c b/cpukit/rtems/src/tasks.c
index 2a5c5da..832228e 100644
--- a/cpukit/rtems/src/tasks.c
+++ b/cpukit/rtems/src/tasks.c
@@ -32,7 +32,6 @@
 #include <rtems/score/threadimpl.h>
 #include <rtems/score/userextimpl.h>
 #include <rtems/score/wkspace.h>
-#include <rtems/score/apiext.h>
 
 Thread_Information _RTEMS_tasks_Information;
 
@@ -161,13 +160,6 @@ static void _RTEMS_tasks_Switch_extension(
 #define RTEMS_TASKS_SWITCH_EXTENSION NULL
 #endif
 
-API_extensions_Control _RTEMS_tasks_API_extensions = {
-  #if defined(FUNCTIONALITY_NOT_CURRENTLY_USED_BY_ANY_API)
-    .predriver_hook = NULL,
-  #endif
-  .postdriver_hook = _RTEMS_tasks_Initialize_user_tasks
-};
-
 User_extensions_Control _RTEMS_tasks_User_extensions = {
   { NULL, NULL },
   { { NULL, NULL }, RTEMS_TASKS_SWITCH_EXTENSION },
@@ -205,8 +197,6 @@ static void _RTEMS_tasks_Manager_initialization(void)
 
   _User_extensions_Add_API_set( &_RTEMS_tasks_User_extensions );
 
-  _API_extensions_Add( &_RTEMS_tasks_API_extensions );
-
   /*
    *  Register the MP Process Packet routine.
    */
@@ -220,12 +210,6 @@ static void _RTEMS_tasks_Manager_initialization(void)
 
 }
 
-void _RTEMS_tasks_Initialize_user_tasks( void )
-{
-  if ( _RTEMS_tasks_Initialize_user_tasks_p )
-    (*_RTEMS_tasks_Initialize_user_tasks_p)();
-}
-
 RTEMS_SYSINIT_ITEM(
   _RTEMS_tasks_Manager_initialization,
   RTEMS_SYSINIT_CLASSIC_TASKS,
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index aa705e4..62db039 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -3445,10 +3445,11 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
 #ifdef CONFIGURE_INIT
   #if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) || \
       defined(CONFIGURE_HAS_OWN_INIT_TASK_TABLE)
-    void (*_RTEMS_tasks_Initialize_user_tasks_p)(void) =
-              _RTEMS_tasks_Initialize_user_tasks_body;
-  #else
-    void (*_RTEMS_tasks_Initialize_user_tasks_p)(void) = NULL;
+    RTEMS_SYSINIT_ITEM(
+      _RTEMS_tasks_Initialize_user_tasks_body,
+      RTEMS_SYSINIT_CLASSIC_USER_TASKS,
+      RTEMS_SYSINIT_ORDER_MIDDLE
+    );
   #endif
 #endif
 
diff --git a/cpukit/score/include/rtems/sysinit.h b/cpukit/score/include/rtems/sysinit.h
index 37f001a..84eec29 100644
--- a/cpukit/score/include/rtems/sysinit.h
+++ b/cpukit/score/include/rtems/sysinit.h
@@ -69,6 +69,7 @@ extern "C" {
 #define RTEMS_SYSINIT_DRVMGR_LEVEL_3             000703
 #define RTEMS_SYSINIT_DRVMGR_LEVEL_4             000704
 #define RTEMS_SYSINIT_MP_FINALIZE                000705
+#define RTEMS_SYSINIT_CLASSIC_USER_TASKS         000706
 #define RTEMS_SYSINIT_STD_FILE_DESCRIPTORS       000800
 
 /*
diff --git a/testsuites/sptests/spsysinit01/init.c b/testsuites/sptests/spsysinit01/init.c
index cdaaacb..0acb567 100644
--- a/testsuites/sptests/spsysinit01/init.c
+++ b/testsuites/sptests/spsysinit01/init.c
@@ -132,6 +132,8 @@ typedef enum {
   BSP_PRE_DRIVERS_POST,
   DEVICE_DRIVERS_PRE,
   DEVICE_DRIVERS_POST,
+  CLASSIC_USER_TASKS_PRE,
+  CLASSIC_USER_TASKS_POST,
   STD_FILE_DESCRIPTORS_PRE,
   STD_FILE_DESCRIPTORS_POST,
   INIT_TASK,
@@ -604,6 +606,18 @@ LAST(RTEMS_SYSINIT_DEVICE_DRIVERS)
   next_step(DEVICE_DRIVERS_POST);
 }
 
+FIRST(RTEMS_SYSINIT_CLASSIC_USER_TASKS)
+{
+  assert(_Objects_Active_count(&_RTEMS_tasks_Information.Objects) == 0);
+  next_step(CLASSIC_USER_TASKS_PRE);
+}
+
+LAST(RTEMS_SYSINIT_CLASSIC_USER_TASKS)
+{
+  assert(_Objects_Active_count(&_RTEMS_tasks_Information.Objects) == 1);
+  next_step(CLASSIC_USER_TASKS_POST);
+}
+
 FIRST(RTEMS_SYSINIT_STD_FILE_DESCRIPTORS)
 {
   struct stat st;



More information about the vc mailing list