[PATCH 01/21] rtems: Move internal structures to ratemondata.h

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Nov 8 12:51:54 UTC 2018


Update #3598.
---
 cpukit/headers.am                        |   1 +
 cpukit/include/rtems/confdefs.h          |   1 +
 cpukit/include/rtems/rtems/ratemon.h     | 110 ------------------------
 cpukit/include/rtems/rtems/ratemondata.h | 140 +++++++++++++++++++++++++++++++
 cpukit/include/rtems/rtems/ratemonimpl.h |   2 +-
 cpukit/include/rtems/rtems/types.h       |   1 +
 6 files changed, 144 insertions(+), 111 deletions(-)
 create mode 100644 cpukit/include/rtems/rtems/ratemondata.h

diff --git a/cpukit/headers.am b/cpukit/headers.am
index 3c5e7fe207..6e2b690cd5 100644
--- a/cpukit/headers.am
+++ b/cpukit/headers.am
@@ -251,6 +251,7 @@ include_rtems_rtems_HEADERS += include/rtems/rtems/part.h
 include_rtems_rtems_HEADERS += include/rtems/rtems/partimpl.h
 include_rtems_rtems_HEADERS += include/rtems/rtems/partmp.h
 include_rtems_rtems_HEADERS += include/rtems/rtems/ratemon.h
+include_rtems_rtems_HEADERS += include/rtems/rtems/ratemondata.h
 include_rtems_rtems_HEADERS += include/rtems/rtems/ratemonimpl.h
 include_rtems_rtems_HEADERS += include/rtems/rtems/region.h
 include_rtems_rtems_HEADERS += include/rtems/rtems/regionimpl.h
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index b7ba7e9d11..410a4366a5 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -32,6 +32,7 @@
 #include <rtems/score/percpu.h>
 #include <rtems/score/userextimpl.h>
 #include <rtems/score/wkspace.h>
+#include <rtems/rtems/ratemondata.h>
 #include <rtems/posix/key.h>
 #include <rtems/posix/mqueue.h>
 #include <rtems/posix/pthread.h>
diff --git a/cpukit/include/rtems/rtems/ratemon.h b/cpukit/include/rtems/rtems/ratemon.h
index 738dc5244d..747d967af2 100644
--- a/cpukit/include/rtems/rtems/ratemon.h
+++ b/cpukit/include/rtems/rtems/ratemon.h
@@ -35,7 +35,6 @@
 
 #include <rtems/rtems/types.h>
 #include <rtems/rtems/status.h>
-#include <rtems/score/thread.h>
 #include <rtems/score/watchdog.h>
 
 struct rtems_printer;
@@ -60,20 +59,8 @@ extern "C" {
  */
 /**@{*/
 
-/**
- *  This is the public type used for the rate monotonic timing
- *  statistics.
- */
-#include <rtems/score/timespec.h>
-
 typedef struct timespec rtems_rate_monotonic_period_time_t RTEMS_DEPRECATED;
 
-/**
- *  This is the internal type used for the rate monotonic timing
- *  statistics.
- */
-#include <rtems/score/timestamp.h>
-
 /**
  *  The following enumerated type defines the states in which a
  *  period may be.
@@ -134,31 +121,6 @@ typedef struct {
   struct timespec total_wall_time;
 }  rtems_rate_monotonic_period_statistics;
 
-/**
- *  The following defines the INTERNAL data structure that has the
- *  statistics kept on each period instance.
- */
-typedef struct {
-  /** This field contains the number of periods executed. */
-  uint32_t     count;
-  /** This field contains the number of periods missed. */
-  uint32_t     missed_count;
-
-  /** This field contains the least amount of CPU time used in a period. */
-  Timestamp_Control min_cpu_time;
-  /** This field contains the highest amount of CPU time used in a period. */
-  Timestamp_Control max_cpu_time;
-  /** This field contains the total amount of wall time used in a period. */
-  Timestamp_Control total_cpu_time;
-
-  /** This field contains the least amount of wall time used in a period. */
-  Timestamp_Control min_wall_time;
-  /** This field contains the highest amount of wall time used in a period. */
-  Timestamp_Control max_wall_time;
-  /** This field contains the total amount of CPU time used in a period. */
-  Timestamp_Control total_wall_time;
-}  Rate_monotonic_Statistics;
-
 /**
  *  The following defines the period status structure.
  */
@@ -187,78 +149,6 @@ typedef struct {
   uint32_t                             postponed_jobs_count;
 }  rtems_rate_monotonic_period_status;
 
-/**
- * @brief The following structure defines the control block used to manage each
- * period.
- *
- * State changes are protected by the default thread lock of the owner thread.
- * The owner thread is the thread that created the period object.  The owner
- * thread field is immutable after object creation.
- */
-typedef struct {
-  /** This field is the object management portion of a Period instance. */
-  Objects_Control                         Object;
-
-  /**
-   * @brief Protects the rate monotonic period state.
-   */
-  ISR_LOCK_MEMBER(                        Lock )
-
-  /** This is the timer used to provide the unblocking mechanism. */
-  Watchdog_Control                        Timer;
-
-  /** This field indicates the current state of the period. */
-  rtems_rate_monotonic_period_states      state;
-
-  /**
-   * @brief A priority node for use by the scheduler job release and cancel
-   * operations.
-   */
-  Priority_Node                           Priority;
-
-  /**
-   * This field contains the length of the next period to be
-   * executed.
-   */
-  uint32_t                                next_length;
-
-  /**
-   * This field contains a pointer to the TCB for the thread
-   * which owns and uses this period instance.
-   */
-  Thread_Control                         *owner;
-
-  /**
-   * This field contains the cpu usage value of the owning thread when
-   * the period was initiated.  It is used to compute the period's
-   * statistics.
-   */
-  Timestamp_Control                       cpu_usage_period_initiated;
-
-  /**
-   * This field contains the wall time value when the period
-   * was initiated.  It is used to compute the period's statistics.
-   */
-  Timestamp_Control                       time_period_initiated;
-
-  /**
-   * This field contains the statistics maintained for the period.
-   */
-  Rate_monotonic_Statistics               Statistics;
-
-  /**
-   * This field contains the number of postponed jobs.
-   * When the watchdog timeout, this variable will be increased immediately.
-   */
-  uint32_t                                postponed_jobs;
-
-  /**
-   *  This field contains the tick of the latest deadline decided by the period
-   *  watchdog.
-  */
-  uint64_t                                latest_deadline;
-}   Rate_monotonic_Control;
-
 /**
  *  @brief Create a Period
  *
diff --git a/cpukit/include/rtems/rtems/ratemondata.h b/cpukit/include/rtems/rtems/ratemondata.h
new file mode 100644
index 0000000000..898fc653c1
--- /dev/null
+++ b/cpukit/include/rtems/rtems/ratemondata.h
@@ -0,0 +1,140 @@
+/**
+ * @file
+ *
+ * @ingroup ClassicRateMonImpl
+ *
+ * @brief Classic Rate Monotonic Scheduler Data Structures
+ */
+
+/* COPYRIGHT (c) 1989-2009, 2016.
+ * On-Line Applications Research Corporation (OAR).
+ * COPYRIGHT (c) 2016-2017 Kuan-Hsun Chen.
+ *
+ * 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.
+ */
+
+#ifndef _RTEMS_RTEMS_RATEMONDATA_H
+#define _RTEMS_RTEMS_RATEMONDATA_H
+
+#include <rtems/rtems/ratemon.h>
+#include <rtems/score/timestamp.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup ClassicRateMonImpl
+ *
+ * @{
+ */
+
+/**
+ *  The following defines the INTERNAL data structure that has the
+ *  statistics kept on each period instance.
+ */
+typedef struct {
+  /** This field contains the number of periods executed. */
+  uint32_t     count;
+  /** This field contains the number of periods missed. */
+  uint32_t     missed_count;
+
+  /** This field contains the least amount of CPU time used in a period. */
+  Timestamp_Control min_cpu_time;
+  /** This field contains the highest amount of CPU time used in a period. */
+  Timestamp_Control max_cpu_time;
+  /** This field contains the total amount of wall time used in a period. */
+  Timestamp_Control total_cpu_time;
+
+  /** This field contains the least amount of wall time used in a period. */
+  Timestamp_Control min_wall_time;
+  /** This field contains the highest amount of wall time used in a period. */
+  Timestamp_Control max_wall_time;
+  /** This field contains the total amount of CPU time used in a period. */
+  Timestamp_Control total_wall_time;
+}  Rate_monotonic_Statistics;
+
+/**
+ * @brief The following structure defines the control block used to manage each
+ * period.
+ *
+ * State changes are protected by the default thread lock of the owner thread.
+ * The owner thread is the thread that created the period object.  The owner
+ * thread field is immutable after object creation.
+ */
+typedef struct {
+  /** This field is the object management portion of a Period instance. */
+  Objects_Control                         Object;
+
+  /**
+   * @brief Protects the rate monotonic period state.
+   */
+  ISR_LOCK_MEMBER(                        Lock )
+
+  /** This is the timer used to provide the unblocking mechanism. */
+  Watchdog_Control                        Timer;
+
+  /** This field indicates the current state of the period. */
+  rtems_rate_monotonic_period_states      state;
+
+  /**
+   * @brief A priority node for use by the scheduler job release and cancel
+   * operations.
+   */
+  Priority_Node                           Priority;
+
+  /**
+   * This field contains the length of the next period to be
+   * executed.
+   */
+  uint32_t                                next_length;
+
+  /**
+   * This field contains a pointer to the TCB for the thread
+   * which owns and uses this period instance.
+   */
+  Thread_Control                         *owner;
+
+  /**
+   * This field contains the cpu usage value of the owning thread when
+   * the period was initiated.  It is used to compute the period's
+   * statistics.
+   */
+  Timestamp_Control                       cpu_usage_period_initiated;
+
+  /**
+   * This field contains the wall time value when the period
+   * was initiated.  It is used to compute the period's statistics.
+   */
+  Timestamp_Control                       time_period_initiated;
+
+  /**
+   * This field contains the statistics maintained for the period.
+   */
+  Rate_monotonic_Statistics               Statistics;
+
+  /**
+   * This field contains the number of postponed jobs.
+   * When the watchdog timeout, this variable will be increased immediately.
+   */
+  uint32_t                                postponed_jobs;
+
+  /**
+   *  This field contains the tick of the latest deadline decided by the period
+   *  watchdog.
+  */
+  uint64_t                                latest_deadline;
+}   Rate_monotonic_Control;
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/include/rtems/rtems/ratemonimpl.h b/cpukit/include/rtems/rtems/ratemonimpl.h
index ba38a3e61a..2a417f66c6 100644
--- a/cpukit/include/rtems/rtems/ratemonimpl.h
+++ b/cpukit/include/rtems/rtems/ratemonimpl.h
@@ -19,7 +19,7 @@
 #ifndef _RTEMS_RTEMS_RATEMONIMPL_H
 #define _RTEMS_RTEMS_RATEMONIMPL_H
 
-#include <rtems/rtems/ratemon.h>
+#include <rtems/rtems/ratemondata.h>
 #include <rtems/score/objectimpl.h>
 #include <rtems/score/schedulerimpl.h>
 #include <rtems/score/threadimpl.h>
diff --git a/cpukit/include/rtems/rtems/types.h b/cpukit/include/rtems/rtems/types.h
index bb98100ead..874b077b79 100644
--- a/cpukit/include/rtems/rtems/types.h
+++ b/cpukit/include/rtems/rtems/types.h
@@ -22,6 +22,7 @@
  *  RTEMS basic type definitions
  */
 
+#include <sys/_timespec.h>
 #include <stdint.h>
 #include <rtems/score/heap.h>
 #include <rtems/score/object.h>
-- 
2.16.4




More information about the devel mailing list