[rtems commit] Optional Classic Dual-Ported Memory initialization

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


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

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

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(-)

diff --git a/cpukit/rtems/Makefile.am b/cpukit/rtems/Makefile.am
index c4bc9e8..387710c 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 3e0c231..213856d 100644
--- a/cpukit/rtems/include/rtems/rtems/dpmemimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/dpmemimpl.h
@@ -33,27 +33,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.
- */
-#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 9af807e..aca71a3 100644
--- a/cpukit/rtems/src/dpmem.c
+++ b/cpukit/rtems/src/dpmem.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/dpmemimpl.h>
-#include <rtems/score/thread.h>
 
-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 e315ef8..0000000
--- 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 <rtems/rtems/dpmemimpl.h>
diff --git a/cpukit/sapi/src/rtemsapi.c b/cpukit/sapi/src/rtemsapi.c
index 8699c15..b6ee1d8 100644
--- a/cpukit/sapi/src/rtemsapi.c
+++ b/cpukit/sapi/src/rtemsapi.c
@@ -28,12 +28,10 @@
 #include <rtems/rtems/intr.h>
 #include <rtems/rtems/barrierimpl.h>
 #include <rtems/rtems/clock.h>
-#include <rtems/rtems/dpmemimpl.h>
 #include <rtems/rtems/ratemonimpl.h>
 
 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 b0a6e32..60687ec 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 f1db152..914485e 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/dpmemimpl.h>
 #include <rtems/rtems/messageimpl.h>
 #include <rtems/rtems/partimpl.h>
 #include <rtems/rtems/regionimpl.h>
@@ -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




More information about the vc mailing list