From 97d94ff3e96c86d2a23b26efe48a9386c16a915a Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 14 Dec 2015 15:27:56 +0100 Subject: [PATCH] Optional Classic Barrier initialization Update #2408. --- cpukit/rtems/Makefile.am | 1 - .../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 7cf28b93a1..a295dafddc 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 e718028715..9b22a32d09 100644 --- a/cpukit/rtems/include/rtems/rtems/barrierimpl.h +++ b/cpukit/rtems/include/rtems/rtems/barrierimpl.h @@ -38,32 +38,11 @@ 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 e69332989c..6c85f4743e 100644 --- a/cpukit/rtems/src/barrier.c +++ b/cpukit/rtems/src/barrier.c @@ -20,14 +20,17 @@ #include #include +#include #include #include #include +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 ea42919f48..0000000000 --- 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 -#include - diff --git a/cpukit/sapi/src/rtemsapi.c b/cpukit/sapi/src/rtemsapi.c index 71f392bb04..0fddec67e9 100644 --- a/cpukit/sapi/src/rtemsapi.c +++ b/cpukit/sapi/src/rtemsapi.c @@ -26,10 +26,8 @@ #include #include -#include #include 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 35806407a1..faef223658 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 22786bd081..31e691ea4c 100644 --- a/testsuites/sptests/spsysinit01/init.c +++ b/testsuites/sptests/spsysinit01/init.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -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