From af12278f9b33d7d8dca96d3873472ef2382f3c8e Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 14 Dec 2015 15:12:39 +0100 Subject: Optional Classic Dual-Ported Memory initialization Update #2408. --- cpukit/rtems/Makefile.am | 1 - cpukit/rtems/include/rtems/rtems/dpmemimpl.h | 19 +------------------ cpukit/rtems/src/dpmem.c | 13 ++++++++++--- cpukit/rtems/src/dpmemdata.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(+), 48 deletions(-) delete mode 100644 cpukit/rtems/src/dpmemdata.c diff --git a/cpukit/rtems/Makefile.am b/cpukit/rtems/Makefile.am index c4bc9e8c60..387710c69c 100644 --- a/cpukit/rtems/Makefile.am +++ b/cpukit/rtems/Makefile.am @@ -237,7 +237,6 @@ librtems_a_SOURCES += src/dpmemdelete.c librtems_a_SOURCES += src/dpmemexternal2internal.c librtems_a_SOURCES += src/dpmemident.c librtems_a_SOURCES += src/dpmeminternal2external.c -librtems_a_SOURCES += src/dpmemdata.c ## WORKSPACE_FILES librtems_a_SOURCES += src/workspace.c diff --git a/cpukit/rtems/include/rtems/rtems/dpmemimpl.h b/cpukit/rtems/include/rtems/rtems/dpmemimpl.h index 3e0c231fad..213856dcdf 100644 --- a/cpukit/rtems/include/rtems/rtems/dpmemimpl.h +++ b/cpukit/rtems/include/rtems/rtems/dpmemimpl.h @@ -32,28 +32,11 @@ 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. - */ -#ifndef RTEMS_DPMEM_EXTERN -#define RTEMS_DPMEM_EXTERN extern -#endif - /** * @brief Define the internal Dual Ported Memory information * The following define the internal Dual Ported Memory information. */ -RTEMS_DPMEM_EXTERN Objects_Information _Dual_ported_memory_Information; - -/** - * @brief Dual Ported Memory Manager Initialization - * - * This routine performs the initialization necessary for this manager. - */ -void _Dual_ported_memory_Manager_initialization(void); +extern Objects_Information _Dual_ported_memory_Information; /** * @brief Allocates a port control block from the inactive chain diff --git a/cpukit/rtems/src/dpmem.c b/cpukit/rtems/src/dpmem.c index 9af807e951..aca71a3a1f 100644 --- a/cpukit/rtems/src/dpmem.c +++ b/cpukit/rtems/src/dpmem.c @@ -20,13 +20,14 @@ #include #include +#include #include #include -#include #include -#include -void _Dual_ported_memory_Manager_initialization(void) +Objects_Information _Dual_ported_memory_Information; + +static void _Dual_ported_memory_Manager_initialization(void) { _Objects_Initialize_information( &_Dual_ported_memory_Information, /* object information table */ @@ -45,3 +46,9 @@ void _Dual_ported_memory_Manager_initialization(void) #endif ); } + +RTEMS_SYSINIT_ITEM( + _Dual_ported_memory_Manager_initialization, + RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY, + RTEMS_SYSINIT_ORDER_MIDDLE +); diff --git a/cpukit/rtems/src/dpmemdata.c b/cpukit/rtems/src/dpmemdata.c deleted file mode 100644 index e315ef8cef..0000000000 --- a/cpukit/rtems/src/dpmemdata.c +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @file - * - * @brief Define the internal Dual Ported Memory information - * @ingroup ClassicDPMEM Dual Ported Memory - */ - -/* - * 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 semaphore data */ -#define RTEMS_DPMEM_EXTERN - -#include diff --git a/cpukit/sapi/src/rtemsapi.c b/cpukit/sapi/src/rtemsapi.c index 8699c15e0d..b6ee1d8173 100644 --- a/cpukit/sapi/src/rtemsapi.c +++ b/cpukit/sapi/src/rtemsapi.c @@ -28,12 +28,10 @@ #include #include #include -#include #include void _RTEMS_API_Initialize(void) { - _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 b0a6e3263b..60687ecb7c 100644 --- a/cpukit/score/include/rtems/sysinit.h +++ b/cpukit/score/include/rtems/sysinit.h @@ -39,6 +39,7 @@ extern "C" { #define RTEMS_SYSINIT_CLASSIC_SEMAPHORE 000345 #define RTEMS_SYSINIT_CLASSIC_PARTITION 000346 #define RTEMS_SYSINIT_CLASSIC_REGION 000347 +#define RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY 000348 #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 f1db15298f..914485e424 100644 --- a/testsuites/sptests/spsysinit01/init.c +++ b/testsuites/sptests/spsysinit01/init.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -65,6 +66,8 @@ typedef enum { CLASSIC_PARTITION_POST, CLASSIC_REGION_PRE, CLASSIC_REGION_POST, + CLASSIC_DUAL_PORTED_MEMORY_PRE, + CLASSIC_DUAL_PORTED_MEMORY_POST, IDLE_THREADS_PRE, IDLE_THREADS_POST, BSP_LIBC_PRE, @@ -264,6 +267,18 @@ LAST(RTEMS_SYSINIT_CLASSIC_REGION) next_step(CLASSIC_REGION_POST); } +FIRST(RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY) +{ + assert(_Dual_ported_memory_Information.maximum == 0); + next_step(CLASSIC_DUAL_PORTED_MEMORY_PRE); +} + +LAST(RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY) +{ + assert(_Dual_ported_memory_Information.maximum != 0); + next_step(CLASSIC_DUAL_PORTED_MEMORY_POST); +} + FIRST(RTEMS_SYSINIT_IDLE_THREADS) { assert(_System_state_Is_before_initialization(_System_state_Get())); @@ -353,6 +368,8 @@ static void Init(rtems_task_argument arg) #define CONFIGURE_MAXIMUM_PARTITIONS 1 +#define CONFIGURE_MAXIMUM_PORTS 1 + #define CONFIGURE_MAXIMUM_REGIONS 1 #define CONFIGURE_MAXIMUM_SEMAPHORES 1 -- cgit v1.2.3