[PATCH 12/38] Optional Classic Region initialization

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Jan 26 15:37:38 UTC 2016


Update #2408.
---
 cpukit/rtems/Makefile.am                      |  1 -
 cpukit/rtems/include/rtems/rtems/regionimpl.h | 25 +------------------------
 cpukit/rtems/src/region.c                     | 13 ++++++++++---
 cpukit/rtems/src/regiondata.c                 | 24 ------------------------
 cpukit/sapi/src/rtemsapi.c                    |  2 --
 cpukit/score/include/rtems/sysinit.h          |  1 +
 testsuites/sptests/spsysinit01/init.c         | 17 +++++++++++++++++
 7 files changed, 29 insertions(+), 54 deletions(-)
 delete mode 100644 cpukit/rtems/src/regiondata.c

diff --git a/cpukit/rtems/Makefile.am b/cpukit/rtems/Makefile.am
index 9d79278..c4bc9e8 100644
--- a/cpukit/rtems/Makefile.am
+++ b/cpukit/rtems/Makefile.am
@@ -221,7 +221,6 @@ librtems_a_SOURCES += src/regiongetinfo.c
 librtems_a_SOURCES += src/regiongetfreeinfo.c
 librtems_a_SOURCES += src/regionresizesegment.c
 librtems_a_SOURCES += src/regionprocessqueue.c
-librtems_a_SOURCES += src/regiondata.c
 
 ## PARTITION_C_FILES
 librtems_a_SOURCES += src/part.c
diff --git a/cpukit/rtems/include/rtems/rtems/regionimpl.h b/cpukit/rtems/include/rtems/rtems/regionimpl.h
index 9f1c3b7..724a1c1 100644
--- a/cpukit/rtems/include/rtems/rtems/regionimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/regionimpl.h
@@ -35,33 +35,10 @@ extern "C" {
  */
 
 /**
- *  @brief Instantiate RTEMS Region Data
- *
- *  Region Manager -- Instantiate 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_REGION_EXTERN
-#define RTEMS_REGION_EXTERN extern
-#endif
-
-/**
  *  The following defines the information control block used to
  *  manage this class of objects.
  */
-RTEMS_REGION_EXTERN Objects_Information _Region_Information;
-
-/**
- *  @brief _Region_Manager_initialization
- *
- *  Region Manager
- *
- *  This routine performs the initialization necessary for this manager.
- */
-void _Region_Manager_initialization(void);
+extern Objects_Information _Region_Information;
 
 /**
  *  @brief Region_Allocate
diff --git a/cpukit/rtems/src/region.c b/cpukit/rtems/src/region.c
index 8f12b52..f1c2b23 100644
--- a/cpukit/rtems/src/region.c
+++ b/cpukit/rtems/src/region.c
@@ -20,12 +20,13 @@
 
 #include <rtems/system.h>
 #include <rtems/config.h>
+#include <rtems/sysinit.h>
 #include <rtems/rtems/status.h>
 #include <rtems/rtems/support.h>
 #include <rtems/rtems/options.h>
 #include <rtems/rtems/regionimpl.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/apimutex.h>
+
+Objects_Information _Region_Information;
 
 /*
  *  _Region_Manager_initialization
@@ -37,7 +38,7 @@
  *  Output parameters:  NONE
  */
 
-void _Region_Manager_initialization(void)
+static void _Region_Manager_initialization(void)
 {
   _Objects_Initialize_information(
     &_Region_Information,      /* object information table */
@@ -67,3 +68,9 @@ void _Region_Manager_initialization(void)
 #endif
 
 }
+
+RTEMS_SYSINIT_ITEM(
+  _Region_Manager_initialization,
+  RTEMS_SYSINIT_CLASSIC_REGION,
+  RTEMS_SYSINIT_ORDER_MIDDLE
+);
diff --git a/cpukit/rtems/src/regiondata.c b/cpukit/rtems/src/regiondata.c
deleted file mode 100644
index 1f3b6a2..0000000
--- a/cpukit/rtems/src/regiondata.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * @file
- *
- * @brief Instantiate RTEMS Region Data
- * @ingroup ClassicRegion Regions
- */
-
-/*
- *  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
-
-/* instantiate RTEMS Region data */
-#define RTEMS_REGION_EXTERN
-
-#include <rtems/rtems/regionimpl.h>
diff --git a/cpukit/sapi/src/rtemsapi.c b/cpukit/sapi/src/rtemsapi.c
index 7ac509e..8699c15 100644
--- a/cpukit/sapi/src/rtemsapi.c
+++ b/cpukit/sapi/src/rtemsapi.c
@@ -30,11 +30,9 @@
 #include <rtems/rtems/clock.h>
 #include <rtems/rtems/dpmemimpl.h>
 #include <rtems/rtems/ratemonimpl.h>
-#include <rtems/rtems/regionimpl.h>
 
 void _RTEMS_API_Initialize(void)
 {
-  _Region_Manager_initialization();
   _Dual_ported_memory_Manager_initialization();
   _Rate_monotonic_Manager_initialization();
   _Barrier_Manager_initialization();
diff --git a/cpukit/score/include/rtems/sysinit.h b/cpukit/score/include/rtems/sysinit.h
index c51a7a2..b0a6e32 100644
--- a/cpukit/score/include/rtems/sysinit.h
+++ b/cpukit/score/include/rtems/sysinit.h
@@ -38,6 +38,7 @@ extern "C" {
 #define RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE      000344
 #define RTEMS_SYSINIT_CLASSIC_SEMAPHORE          000345
 #define RTEMS_SYSINIT_CLASSIC_PARTITION          000346
+#define RTEMS_SYSINIT_CLASSIC_REGION             000347
 #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 8f73b2e..f1db152 100644
--- a/testsuites/sptests/spsysinit01/init.c
+++ b/testsuites/sptests/spsysinit01/init.c
@@ -27,6 +27,7 @@
 #include <rtems/extensionimpl.h>
 #include <rtems/rtems/messageimpl.h>
 #include <rtems/rtems/partimpl.h>
+#include <rtems/rtems/regionimpl.h>
 #include <rtems/rtems/semimpl.h>
 #include <rtems/rtems/tasksimpl.h>
 #include <rtems/rtems/timerimpl.h>
@@ -62,6 +63,8 @@ typedef enum {
   CLASSIC_SEMAPHORE_POST,
   CLASSIC_PARTITION_PRE,
   CLASSIC_PARTITION_POST,
+  CLASSIC_REGION_PRE,
+  CLASSIC_REGION_POST,
   IDLE_THREADS_PRE,
   IDLE_THREADS_POST,
   BSP_LIBC_PRE,
@@ -249,6 +252,18 @@ LAST(RTEMS_SYSINIT_CLASSIC_PARTITION)
   next_step(CLASSIC_PARTITION_POST);
 }
 
+FIRST(RTEMS_SYSINIT_CLASSIC_REGION)
+{
+  assert(_Region_Information.maximum == 0);
+  next_step(CLASSIC_REGION_PRE);
+}
+
+LAST(RTEMS_SYSINIT_CLASSIC_REGION)
+{
+  assert(_Region_Information.maximum != 0);
+  next_step(CLASSIC_REGION_POST);
+}
+
 FIRST(RTEMS_SYSINIT_IDLE_THREADS)
 {
   assert(_System_state_Is_before_initialization(_System_state_Get()));
@@ -338,6 +353,8 @@ static void Init(rtems_task_argument arg)
 
 #define CONFIGURE_MAXIMUM_PARTITIONS 1
 
+#define CONFIGURE_MAXIMUM_REGIONS 1
+
 #define CONFIGURE_MAXIMUM_SEMAPHORES 1
 
 #define CONFIGURE_MAXIMUM_TASKS 1
-- 
1.8.4.5




More information about the devel mailing list