[rtems commit] Optional Classic Tasks initialization

Sebastian Huber sebh at rtems.org
Wed Feb 3 09:30:19 UTC 2016


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Dec 14 14:46:10 2015 +0100

Optional Classic Tasks initialization

Update #2408.

---

 cpukit/rtems/Makefile.am                     |  1 -
 cpukit/rtems/include/rtems/rtems/tasksimpl.h | 21 +--------------------
 cpukit/rtems/src/taskdata.c                  | 25 -------------------------
 cpukit/rtems/src/tasks.c                     | 11 ++++++++++-
 cpukit/sapi/src/rtemsapi.c                   |  2 --
 cpukit/score/include/rtems/sysinit.h         |  1 +
 testsuites/sptests/spsysinit01/init.c        | 15 +++++++++++++++
 7 files changed, 27 insertions(+), 49 deletions(-)

diff --git a/cpukit/rtems/Makefile.am b/cpukit/rtems/Makefile.am
index 1659d92..d0f3907 100644
--- a/cpukit/rtems/Makefile.am
+++ b/cpukit/rtems/Makefile.am
@@ -112,7 +112,6 @@ librtems_a_SOURCES += src/taskvariabledelete.c
 librtems_a_SOURCES += src/taskvariableget.c
 librtems_a_SOURCES += src/taskvariable_invoke_dtor.c
 endif
-librtems_a_SOURCES += src/taskdata.c
 librtems_a_SOURCES += src/schedulergetprocessorset.c
 librtems_a_SOURCES += src/schedulerident.c
 
diff --git a/cpukit/rtems/include/rtems/rtems/tasksimpl.h b/cpukit/rtems/include/rtems/rtems/tasksimpl.h
index 5a493d7..3f8a873 100644
--- a/cpukit/rtems/include/rtems/rtems/tasksimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/tasksimpl.h
@@ -34,29 +34,10 @@ extern "C" {
  */
 
 /**
- *  @brief Instantiate RTEMS Classic API Tasks Data
- *
- *  This constant is defined to extern most of the time when using
- *  this header file.  However by defining it to nothing, the data
- *  declared in this header file can be instantiated.  This is done
- *  in a single per manager file.
- */
-#ifndef RTEMS_TASKS_EXTERN
-#define RTEMS_TASKS_EXTERN extern
-#endif
-
-/**
  *  The following instantiates the information control block used to
  *  manage this class of objects.
  */
-RTEMS_TASKS_EXTERN Thread_Information _RTEMS_tasks_Information;
-
-/**
- *  @brief RTEMS Task Manager Initialization
- *
- *  This routine initializes all Task Manager related data structures.
- */
-void _RTEMS_tasks_Manager_initialization(void);
+extern Thread_Information _RTEMS_tasks_Information;
 
 /**
  *  @brief RTEMS User Task Initialization
diff --git a/cpukit/rtems/src/taskdata.c b/cpukit/rtems/src/taskdata.c
deleted file mode 100644
index 505ebcd..0000000
--- a/cpukit/rtems/src/taskdata.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- *  @file
- *
- *  @brief Instantiate RTEMS Classic API Tasks Data
- *  @ingroup ClassicTasks
- */
-
-/*
- *  RTEMS Task Manager -- Instantiate Data
- *
- *  COPYRIGHT (c) 1989-2007.
- *  On-Line Applications Research Corporation (OAR).
- *
- *  The license and distribution terms for this file may be
- *  found in the file LICENSE in this distribution or at
- *  http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#define RTEMS_TASKS_EXTERN
-
-#include <rtems/rtems/tasksimpl.h>
diff --git a/cpukit/rtems/src/tasks.c b/cpukit/rtems/src/tasks.c
index ecd7d4c..8852999 100644
--- a/cpukit/rtems/src/tasks.c
+++ b/cpukit/rtems/src/tasks.c
@@ -20,6 +20,7 @@
 
 #include <rtems/system.h>
 #include <rtems/config.h>
+#include <rtems/sysinit.h>
 #include <rtems/rtems/asrimpl.h>
 #include <rtems/rtems/eventimpl.h>
 #include <rtems/rtems/signalimpl.h>
@@ -34,6 +35,8 @@
 #include <rtems/score/wkspace.h>
 #include <rtems/score/apiext.h>
 
+Thread_Information _RTEMS_tasks_Information;
+
 /*
  *  _RTEMS_tasks_Create_extension
  *
@@ -186,7 +189,7 @@ User_extensions_Control _RTEMS_tasks_User_extensions = {
   }
 };
 
-void _RTEMS_tasks_Manager_initialization(void)
+static void _RTEMS_tasks_Manager_initialization(void)
 {
   _Thread_Initialize_information(
     &_RTEMS_tasks_Information, /* object information table */
@@ -228,3 +231,9 @@ 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,
+  RTEMS_SYSINIT_ORDER_MIDDLE
+);
diff --git a/cpukit/sapi/src/rtemsapi.c b/cpukit/sapi/src/rtemsapi.c
index 93b9847..251d772 100644
--- a/cpukit/sapi/src/rtemsapi.c
+++ b/cpukit/sapi/src/rtemsapi.c
@@ -28,7 +28,6 @@
 #include <rtems/rtems/intr.h>
 #include <rtems/rtems/barrierimpl.h>
 #include <rtems/rtems/clock.h>
-#include <rtems/rtems/tasksimpl.h>
 #include <rtems/rtems/dpmemimpl.h>
 #include <rtems/rtems/eventimpl.h>
 #include <rtems/rtems/messageimpl.h>
@@ -41,7 +40,6 @@
 
 void _RTEMS_API_Initialize(void)
 {
-  _RTEMS_tasks_Manager_initialization();
   _Timer_Manager_initialization();
   _Signal_Manager_initialization();
   _Event_Manager_initialization();
diff --git a/cpukit/score/include/rtems/sysinit.h b/cpukit/score/include/rtems/sysinit.h
index ab7dfc4..bac6663 100644
--- a/cpukit/score/include/rtems/sysinit.h
+++ b/cpukit/score/include/rtems/sysinit.h
@@ -31,6 +31,7 @@ extern "C" {
 #define RTEMS_SYSINIT_INITIAL_EXTENSIONS         000300
 #define RTEMS_SYSINIT_DATA_STRUCTURES            000301
 #define RTEMS_SYSINIT_USER_EXTENSIONS            000320
+#define RTEMS_SYSINIT_CLASSIC_TASKS              000340
 #define RTEMS_SYSINIT_IDLE_THREADS               000380
 #define RTEMS_SYSINIT_BSP_LIBC                   000400
 #define RTEMS_SYSINIT_BEFORE_DRIVERS             000500
diff --git a/testsuites/sptests/spsysinit01/init.c b/testsuites/sptests/spsysinit01/init.c
index e5e72f8..4a707de 100644
--- a/testsuites/sptests/spsysinit01/init.c
+++ b/testsuites/sptests/spsysinit01/init.c
@@ -25,6 +25,7 @@
 #include <rtems/test.h>
 
 #include <rtems/extensionimpl.h>
+#include <rtems/rtems/tasksimpl.h>
 #include <rtems/score/apimutex.h>
 #include <rtems/score/sysstate.h>
 #include <rtems/score/userextimpl.h>
@@ -43,6 +44,8 @@ typedef enum {
   DATA_STRUCTURES_POST,
   USER_EXTENSIONS_PRE,
   USER_EXTENSIONS_POST,
+  CLASSIC_TASKS_PRE,
+  CLASSIC_TASKS_POST,
   IDLE_THREADS_PRE,
   IDLE_THREADS_POST,
   BSP_LIBC_PRE,
@@ -148,6 +151,18 @@ LAST(RTEMS_SYSINIT_USER_EXTENSIONS)
   next_step(USER_EXTENSIONS_POST);
 }
 
+FIRST(RTEMS_SYSINIT_CLASSIC_TASKS)
+{
+  assert(_RTEMS_tasks_Information.Objects.maximum == 0);
+  next_step(CLASSIC_TASKS_PRE);
+}
+
+LAST(RTEMS_SYSINIT_CLASSIC_TASKS)
+{
+  assert(_RTEMS_tasks_Information.Objects.maximum != 0);
+  next_step(CLASSIC_TASKS_POST);
+}
+
 FIRST(RTEMS_SYSINIT_IDLE_THREADS)
 {
   assert(_System_state_Is_before_initialization(_System_state_Get()));




More information about the vc mailing list