[rtems commit] Optional Classic Rate Monotonic initialization

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


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

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

Optional Classic Rate Monotonic initialization

Update #2408.

---

 cpukit/rtems/Makefile.am                       |  1 -
 cpukit/rtems/include/rtems/rtems/ratemonimpl.h | 21 +--------------------
 cpukit/rtems/src/ratemon.c                     | 13 ++++++++++---
 cpukit/rtems/src/ratemondata.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(+), 50 deletions(-)

diff --git a/cpukit/rtems/Makefile.am b/cpukit/rtems/Makefile.am
index 387710c..7cf28b9 100644
--- a/cpukit/rtems/Makefile.am
+++ b/cpukit/rtems/Makefile.am
@@ -128,7 +128,6 @@ librtems_a_SOURCES += src/ratemonreportstatistics.c
 librtems_a_SOURCES += src/ratemonident.c
 librtems_a_SOURCES += src/ratemonperiod.c
 librtems_a_SOURCES += src/ratemontimeout.c
-librtems_a_SOURCES += src/ratemondata.c
 
 ## INTR_C_FILES
 librtems_a_SOURCES += src/intrbody.c
diff --git a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
index b3aa1cf..90724a4 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
@@ -35,31 +35,12 @@ 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_RATEMON_EXTERN
-#define RTEMS_RATEMON_EXTERN extern
-#endif
-
-/**
  *  @brief Rate Monotonic Period Class Management Structure
  *
  *  This instance of Objects_Information is used to manage the
  *  set of rate monotonic period instances.
  */
-RTEMS_RATEMON_EXTERN Objects_Information _Rate_monotonic_Information;
-
-/**
- *  @brief Rate Monotonic Manager Initialization
- *
- *  This routine performs the initialization necessary for this manager.
- *
- *  @note The Rate Monotonic Manager is built on top of the Watchdog Handler
- */
-void _Rate_monotonic_Manager_initialization(void);
+extern Objects_Information _Rate_monotonic_Information;
 
 /**
  *  @brief Allocates a period control block from
diff --git a/cpukit/rtems/src/ratemon.c b/cpukit/rtems/src/ratemon.c
index ad5083f..b0d248f 100644
--- a/cpukit/rtems/src/ratemon.c
+++ b/cpukit/rtems/src/ratemon.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/isr.h>
 #include <rtems/rtems/ratemonimpl.h>
-#include <rtems/score/thread.h>
 
-void _Rate_monotonic_Manager_initialization(void)
+Objects_Information _Rate_monotonic_Information;
+
+static void _Rate_monotonic_Manager_initialization(void)
 {
   _Objects_Initialize_information(
     &_Rate_monotonic_Information,    /* object information table */
@@ -44,3 +45,9 @@ void _Rate_monotonic_Manager_initialization(void)
 #endif
   );
 }
+
+RTEMS_SYSINIT_ITEM(
+  _Rate_monotonic_Manager_initialization,
+  RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC,
+  RTEMS_SYSINIT_ORDER_MIDDLE
+);
diff --git a/cpukit/rtems/src/ratemondata.c b/cpukit/rtems/src/ratemondata.c
deleted file mode 100644
index cb4c9ca..0000000
--- a/cpukit/rtems/src/ratemondata.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- *  @file
- *
- *  @brief Instantiate RTEMS Period Data
- *  @ingroup ClassicRateMon
- */
-
-/*
- *  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 period data */
-#define RTEMS_RATEMON_EXTERN
-
-#include <rtems/rtems/ratemonimpl.h>
diff --git a/cpukit/sapi/src/rtemsapi.c b/cpukit/sapi/src/rtemsapi.c
index b6ee1d8..71f392b 100644
--- a/cpukit/sapi/src/rtemsapi.c
+++ b/cpukit/sapi/src/rtemsapi.c
@@ -28,10 +28,8 @@
 #include <rtems/rtems/intr.h>
 #include <rtems/rtems/barrierimpl.h>
 #include <rtems/rtems/clock.h>
-#include <rtems/rtems/ratemonimpl.h>
 
 void _RTEMS_API_Initialize(void)
 {
-  _Rate_monotonic_Manager_initialization();
   _Barrier_Manager_initialization();
 }
diff --git a/cpukit/score/include/rtems/sysinit.h b/cpukit/score/include/rtems/sysinit.h
index 60687ec..3580640 100644
--- a/cpukit/score/include/rtems/sysinit.h
+++ b/cpukit/score/include/rtems/sysinit.h
@@ -40,6 +40,7 @@ extern "C" {
 #define RTEMS_SYSINIT_CLASSIC_PARTITION          000346
 #define RTEMS_SYSINIT_CLASSIC_REGION             000347
 #define RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY 000348
+#define RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC     000349
 #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 914485e..22786bd 100644
--- a/testsuites/sptests/spsysinit01/init.c
+++ b/testsuites/sptests/spsysinit01/init.c
@@ -28,6 +28,7 @@
 #include <rtems/rtems/dpmemimpl.h>
 #include <rtems/rtems/messageimpl.h>
 #include <rtems/rtems/partimpl.h>
+#include <rtems/rtems/ratemonimpl.h>
 #include <rtems/rtems/regionimpl.h>
 #include <rtems/rtems/semimpl.h>
 #include <rtems/rtems/tasksimpl.h>
@@ -68,6 +69,8 @@ typedef enum {
   CLASSIC_REGION_POST,
   CLASSIC_DUAL_PORTED_MEMORY_PRE,
   CLASSIC_DUAL_PORTED_MEMORY_POST,
+  CLASSIC_RATE_MONOTONIC_PRE,
+  CLASSIC_RATE_MONOTONIC_POST,
   IDLE_THREADS_PRE,
   IDLE_THREADS_POST,
   BSP_LIBC_PRE,
@@ -279,6 +282,18 @@ LAST(RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY)
   next_step(CLASSIC_DUAL_PORTED_MEMORY_POST);
 }
 
+FIRST(RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC)
+{
+  assert(_Rate_monotonic_Information.maximum == 0);
+  next_step(CLASSIC_RATE_MONOTONIC_PRE);
+}
+
+LAST(RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC)
+{
+  assert(_Rate_monotonic_Information.maximum != 0);
+  next_step(CLASSIC_RATE_MONOTONIC_POST);
+}
+
 FIRST(RTEMS_SYSINIT_IDLE_THREADS)
 {
   assert(_System_state_Is_before_initialization(_System_state_Get()));
@@ -368,6 +383,8 @@ static void Init(rtems_task_argument arg)
 
 #define CONFIGURE_MAXIMUM_PARTITIONS 1
 
+#define CONFIGURE_MAXIMUM_PERIODS 1
+
 #define CONFIGURE_MAXIMUM_PORTS 1
 
 #define CONFIGURE_MAXIMUM_REGIONS 1




More information about the vc mailing list