[PATCH 15/38] Optional Classic Barrier initialization

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


Update #2408.
---
 cpukit/rtems/Makefile.am                       |  1 -
 cpukit/rtems/include/rtems/rtems/barrierimpl.h | 23 +----------------------
 cpukit/rtems/src/barrier.c                     | 11 ++++++++++-
 cpukit/rtems/src/barrierdata.c                 | 26 --------------------------
 cpukit/sapi/src/rtemsapi.c                     |  2 --
 cpukit/score/include/rtems/sysinit.h           |  1 +
 testsuites/sptests/spsysinit01/init.c          | 17 +++++++++++++++++
 7 files changed, 29 insertions(+), 52 deletions(-)
 delete mode 100644 cpukit/rtems/src/barrierdata.c

diff --git a/cpukit/rtems/Makefile.am b/cpukit/rtems/Makefile.am
index 7cf28b9..a295daf 100644
--- a/cpukit/rtems/Makefile.am
+++ b/cpukit/rtems/Makefile.am
@@ -141,7 +141,6 @@ librtems_a_SOURCES += src/barrierident.c
 librtems_a_SOURCES += src/barriertranslatereturncode.c
 librtems_a_SOURCES += src/barrierrelease.c
 librtems_a_SOURCES += src/barrierwait.c
-librtems_a_SOURCES += src/barrierdata.c
 
 ## CLOCK_C_FILES
 librtems_a_SOURCES += src/clockget.c
diff --git a/cpukit/rtems/include/rtems/rtems/barrierimpl.h b/cpukit/rtems/include/rtems/rtems/barrierimpl.h
index e718028..9b22a32 100644
--- a/cpukit/rtems/include/rtems/rtems/barrierimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/barrierimpl.h
@@ -39,31 +39,10 @@ extern "C" {
  */
 
 /**
- * @brief Instantiate Barrier Data
- *
- * Barrier 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_BARRIER_EXTERN
-#define RTEMS_BARRIER_EXTERN extern
-#endif
-
-/**
  *  The following defines the information control block used to manage
  *  this class of objects.
  */
-RTEMS_BARRIER_EXTERN Objects_Information  _Barrier_Information;
-
-/**
- *  @brief _Barrier_Manager_initialization
- *
- *  This routine performs the initialization necessary for this manager.
- */
-void _Barrier_Manager_initialization(void);
+extern Objects_Information _Barrier_Information;
 
 /**
  *  @brief _Barrier_Allocate
diff --git a/cpukit/rtems/src/barrier.c b/cpukit/rtems/src/barrier.c
index e693329..6c85f47 100644
--- a/cpukit/rtems/src/barrier.c
+++ b/cpukit/rtems/src/barrier.c
@@ -20,14 +20,17 @@
 
 #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/barrierimpl.h>
 
+Objects_Information _Barrier_Information;
+
 /**
  *  @brief _Barrier_Manager_initialization
  */
-void _Barrier_Manager_initialization(void)
+static void _Barrier_Manager_initialization(void)
 {
   _Objects_Initialize_information(
     &_Barrier_Information,         /* object information table */
@@ -45,3 +48,9 @@ void _Barrier_Manager_initialization(void)
 #endif
   );
 }
+
+RTEMS_SYSINIT_ITEM(
+  _Barrier_Manager_initialization,
+  RTEMS_SYSINIT_CLASSIC_BARRIER,
+  RTEMS_SYSINIT_ORDER_MIDDLE
+);
diff --git a/cpukit/rtems/src/barrierdata.c b/cpukit/rtems/src/barrierdata.c
deleted file mode 100644
index ea42919..0000000
--- a/cpukit/rtems/src/barrierdata.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * @file
- *
- * @brief Instantiate Barrier Data
- * @ingroup ClassicBarrier Barriers
- */
-
-/*
- *  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 barrier data */
-#define RTEMS_BARRIER_EXTERN
-
-#include <rtems/system.h>
-#include <rtems/rtems/barrierimpl.h>
-
diff --git a/cpukit/sapi/src/rtemsapi.c b/cpukit/sapi/src/rtemsapi.c
index 71f392b..0fddec6 100644
--- a/cpukit/sapi/src/rtemsapi.c
+++ b/cpukit/sapi/src/rtemsapi.c
@@ -26,10 +26,8 @@
 #include <rtems/rtems/rtemsapi.h>
 
 #include <rtems/rtems/intr.h>
-#include <rtems/rtems/barrierimpl.h>
 #include <rtems/rtems/clock.h>
 
 void _RTEMS_API_Initialize(void)
 {
-  _Barrier_Manager_initialization();
 }
diff --git a/cpukit/score/include/rtems/sysinit.h b/cpukit/score/include/rtems/sysinit.h
index 3580640..faef223 100644
--- a/cpukit/score/include/rtems/sysinit.h
+++ b/cpukit/score/include/rtems/sysinit.h
@@ -41,6 +41,7 @@ extern "C" {
 #define RTEMS_SYSINIT_CLASSIC_REGION             000347
 #define RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY 000348
 #define RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC     000349
+#define RTEMS_SYSINIT_CLASSIC_BARRIER            00034a
 #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 22786bd..31e691e 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/barrierimpl.h>
 #include <rtems/rtems/dpmemimpl.h>
 #include <rtems/rtems/messageimpl.h>
 #include <rtems/rtems/partimpl.h>
@@ -71,6 +72,8 @@ typedef enum {
   CLASSIC_DUAL_PORTED_MEMORY_POST,
   CLASSIC_RATE_MONOTONIC_PRE,
   CLASSIC_RATE_MONOTONIC_POST,
+  CLASSIC_BARRIER_PRE,
+  CLASSIC_BARRIER_POST,
   IDLE_THREADS_PRE,
   IDLE_THREADS_POST,
   BSP_LIBC_PRE,
@@ -294,6 +297,18 @@ LAST(RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC)
   next_step(CLASSIC_RATE_MONOTONIC_POST);
 }
 
+FIRST(RTEMS_SYSINIT_CLASSIC_BARRIER)
+{
+  assert(_Barrier_Information.maximum == 0);
+  next_step(CLASSIC_BARRIER_PRE);
+}
+
+LAST(RTEMS_SYSINIT_CLASSIC_BARRIER)
+{
+  assert(_Barrier_Information.maximum != 0);
+  next_step(CLASSIC_BARRIER_POST);
+}
+
 FIRST(RTEMS_SYSINIT_IDLE_THREADS)
 {
   assert(_System_state_Is_before_initialization(_System_state_Get()));
@@ -379,6 +394,8 @@ static void Init(rtems_task_argument arg)
 
 #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
 
+#define CONFIGURE_MAXIMUM_BARRIERS 1
+
 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
 
 #define CONFIGURE_MAXIMUM_PARTITIONS 1
-- 
1.8.4.5




More information about the devel mailing list