[rtems commit] Optional Classic Partition initialization

Sebastian Huber sebh at rtems.org
Wed Feb 3 09:31:23 UTC 2016


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

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

Optional Classic Partition initialization

Update #2408.

---

 cpukit/rtems/Makefile.am                    |  1 -
 cpukit/rtems/include/rtems/rtems/partimpl.h | 21 +--------------------
 cpukit/rtems/src/part.c                     | 13 ++++++++++---
 cpukit/rtems/src/partdata.c                 | 24 ------------------------
 cpukit/sapi/src/rtemsapi.c                  |  2 --
 cpukit/score/include/rtems/sysinit.h        |  1 +
 testsuites/sptests/spfatal13/testcase.h     |  1 +
 testsuites/sptests/spsysinit01/init.c       | 17 +++++++++++++++++
 8 files changed, 30 insertions(+), 50 deletions(-)

diff --git a/cpukit/rtems/Makefile.am b/cpukit/rtems/Makefile.am
index d28e1bd..9d79278 100644
--- a/cpukit/rtems/Makefile.am
+++ b/cpukit/rtems/Makefile.am
@@ -230,7 +230,6 @@ librtems_a_SOURCES += src/partdelete.c
 librtems_a_SOURCES += src/partgetbuffer.c
 librtems_a_SOURCES += src/partident.c
 librtems_a_SOURCES += src/partreturnbuffer.c
-librtems_a_SOURCES += src/partdata.c
 
 ## DPMEM_C_FILES
 librtems_a_SOURCES += src/dpmem.c
diff --git a/cpukit/rtems/include/rtems/rtems/partimpl.h b/cpukit/rtems/include/rtems/rtems/partimpl.h
index 0f704d2..472e06f 100644
--- a/cpukit/rtems/include/rtems/rtems/partimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/partimpl.h
@@ -34,29 +34,10 @@ extern "C" {
  */
 
 /**
- * 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.
- *
- * Partition Manager -- Instantiate Data
- */
-#ifndef RTEMS_PART_EXTERN
-#define RTEMS_PART_EXTERN extern
-#endif
-
-/**
  *  The following defines the information control block used to
  *  manage this class of objects.
  */
-RTEMS_PART_EXTERN Objects_Information _Partition_Information;
-
-/**
- *  @brief Partition Manager Initialization
- *
- *  This routine performs the initialization necessary for this manager.
- */
-void _Partition_Manager_initialization(void);
+extern Objects_Information _Partition_Information;
 
 /**
  *  @brief Allocate a buffer from the_partition.
diff --git a/cpukit/rtems/src/part.c b/cpukit/rtems/src/part.c
index 602abb8..211c117 100644
--- a/cpukit/rtems/src/part.c
+++ b/cpukit/rtems/src/part.c
@@ -20,13 +20,14 @@
 
 #include <rtems/system.h>
 #include <rtems/config.h>
+#include <rtems/sysinit.h>
 #include <rtems/rtems/status.h>
 #include <rtems/rtems/support.h>
-#include <rtems/score/address.h>
 #include <rtems/rtems/partimpl.h>
-#include <rtems/score/thread.h>
 
-void _Partition_Manager_initialization(void)
+Objects_Information _Partition_Information;
+
+static void _Partition_Manager_initialization(void)
 {
   _Objects_Initialize_information(
     &_Partition_Information,     /* object information table */
@@ -56,3 +57,9 @@ void _Partition_Manager_initialization(void)
 #endif
 
 }
+
+RTEMS_SYSINIT_ITEM(
+  _Partition_Manager_initialization,
+  RTEMS_SYSINIT_CLASSIC_PARTITION,
+  RTEMS_SYSINIT_ORDER_MIDDLE
+);
diff --git a/cpukit/rtems/src/partdata.c b/cpukit/rtems/src/partdata.c
deleted file mode 100644
index ccfc7c6..0000000
--- a/cpukit/rtems/src/partdata.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * @file
- *
- * @brief Instantiate RTEMS Partition Data
- * @ingroup ClassicPart Partitions
- */
-
-/*
- *  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 partition data */
-#define RTEMS_PART_EXTERN
-
-#include <rtems/rtems/partimpl.h>
diff --git a/cpukit/sapi/src/rtemsapi.c b/cpukit/sapi/src/rtemsapi.c
index 1d1c932..7ac509e 100644
--- a/cpukit/sapi/src/rtemsapi.c
+++ b/cpukit/sapi/src/rtemsapi.c
@@ -29,13 +29,11 @@
 #include <rtems/rtems/barrierimpl.h>
 #include <rtems/rtems/clock.h>
 #include <rtems/rtems/dpmemimpl.h>
-#include <rtems/rtems/partimpl.h>
 #include <rtems/rtems/ratemonimpl.h>
 #include <rtems/rtems/regionimpl.h>
 
 void _RTEMS_API_Initialize(void)
 {
-  _Partition_Manager_initialization();
   _Region_Manager_initialization();
   _Dual_ported_memory_Manager_initialization();
   _Rate_monotonic_Manager_initialization();
diff --git a/cpukit/score/include/rtems/sysinit.h b/cpukit/score/include/rtems/sysinit.h
index aaafec5..c51a7a2 100644
--- a/cpukit/score/include/rtems/sysinit.h
+++ b/cpukit/score/include/rtems/sysinit.h
@@ -37,6 +37,7 @@ extern "C" {
 #define RTEMS_SYSINIT_CLASSIC_EVENT              000343
 #define RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE      000344
 #define RTEMS_SYSINIT_CLASSIC_SEMAPHORE          000345
+#define RTEMS_SYSINIT_CLASSIC_PARTITION          000346
 #define RTEMS_SYSINIT_IDLE_THREADS               000380
 #define RTEMS_SYSINIT_BSP_LIBC                   000400
 #define RTEMS_SYSINIT_BEFORE_DRIVERS             000500
diff --git a/testsuites/sptests/spfatal13/testcase.h b/testsuites/sptests/spfatal13/testcase.h
index 9b229e2..b99ff4d 100644
--- a/testsuites/sptests/spfatal13/testcase.h
+++ b/testsuites/sptests/spfatal13/testcase.h
@@ -23,4 +23,5 @@
 void force_error()
 {
   /* we should not run this far */
+  rtems_partition_create(0, NULL, 0, 0, 0, NULL);
 }
diff --git a/testsuites/sptests/spsysinit01/init.c b/testsuites/sptests/spsysinit01/init.c
index f9d2701..8f73b2e 100644
--- a/testsuites/sptests/spsysinit01/init.c
+++ b/testsuites/sptests/spsysinit01/init.c
@@ -26,6 +26,7 @@
 
 #include <rtems/extensionimpl.h>
 #include <rtems/rtems/messageimpl.h>
+#include <rtems/rtems/partimpl.h>
 #include <rtems/rtems/semimpl.h>
 #include <rtems/rtems/tasksimpl.h>
 #include <rtems/rtems/timerimpl.h>
@@ -59,6 +60,8 @@ typedef enum {
   CLASSIC_MESSAGE_QUEUE_POST,
   CLASSIC_SEMAPHORE_PRE,
   CLASSIC_SEMAPHORE_POST,
+  CLASSIC_PARTITION_PRE,
+  CLASSIC_PARTITION_POST,
   IDLE_THREADS_PRE,
   IDLE_THREADS_POST,
   BSP_LIBC_PRE,
@@ -234,6 +237,18 @@ LAST(RTEMS_SYSINIT_CLASSIC_SEMAPHORE)
   next_step(CLASSIC_SEMAPHORE_POST);
 }
 
+FIRST(RTEMS_SYSINIT_CLASSIC_PARTITION)
+{
+  assert(_Partition_Information.maximum == 0);
+  next_step(CLASSIC_PARTITION_PRE);
+}
+
+LAST(RTEMS_SYSINIT_CLASSIC_PARTITION)
+{
+  assert(_Partition_Information.maximum != 0);
+  next_step(CLASSIC_PARTITION_POST);
+}
+
 FIRST(RTEMS_SYSINIT_IDLE_THREADS)
 {
   assert(_System_state_Is_before_initialization(_System_state_Get()));
@@ -321,6 +336,8 @@ static void Init(rtems_task_argument arg)
 
 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
 
+#define CONFIGURE_MAXIMUM_PARTITIONS 1
+
 #define CONFIGURE_MAXIMUM_SEMAPHORES 1
 
 #define CONFIGURE_MAXIMUM_TASKS 1




More information about the vc mailing list