[rtems commit] config: Add _Watchdog_Microseconds_per_tick

Sebastian Huber sebh at rtems.org
Tue Feb 25 11:32:18 UTC 2020


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Feb 13 17:16:15 2020 +0100

config: Add _Watchdog_Microseconds_per_tick

Move the microseconds per tick configuration constant out of the
configuration table.

Add WATCHDOG_MICROSECONDS_PER_TICK_DEFAULT and use it to provide a
default definition of the watchdog ticks constants.

Update #3875.

---

 cpukit/include/rtems/confdefs.h            | 17 ++++++++++-------
 cpukit/include/rtems/config.h              | 10 ++--------
 cpukit/include/rtems/score/watchdogticks.h |  8 ++++++++
 3 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index 6a8b9ec..1254e3d 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -1955,7 +1955,16 @@ extern "C" {
   #error "The CONFIGURE_MICROSECONDS_PER_TICK must be positive"
 #endif
 
-#define _CONFIGURE_TICKS_PER_SECOND (1000000 / CONFIGURE_MICROSECONDS_PER_TICK)
+#ifdef CONFIGURE_INIT
+  const uint32_t _Watchdog_Microseconds_per_tick =
+    CONFIGURE_MICROSECONDS_PER_TICK;
+
+  const uint32_t _Watchdog_Nanoseconds_per_tick =
+    (uint32_t) 1000 * CONFIGURE_MICROSECONDS_PER_TICK;
+
+  const uint32_t _Watchdog_Ticks_per_second =
+    1000000 / CONFIGURE_MICROSECONDS_PER_TICK;
+#endif
 
 /** The configures the number of clock ticks per timeslice. */
 #ifndef CONFIGURE_TICKS_PER_TIMESLICE
@@ -2452,11 +2461,6 @@ struct _reent *__getreent(void)
       sizeof( Thread_queue_Configured_heads );
   #endif
 
-  const uint32_t _Watchdog_Nanoseconds_per_tick =
-    (uint32_t) 1000 * CONFIGURE_MICROSECONDS_PER_TICK;
-
-  const uint32_t _Watchdog_Ticks_per_second = _CONFIGURE_TICKS_PER_SECOND;
-
   const size_t _Thread_Initial_thread_count =
     rtems_resource_maximum_per_allocation( _CONFIGURE_TASKS ) +
     rtems_resource_maximum_per_allocation( CONFIGURE_MAXIMUM_POSIX_THREADS );
@@ -2622,7 +2626,6 @@ struct _reent *__getreent(void)
    */
   const rtems_configuration_table Configuration = {
     CONFIGURE_EXECUTIVE_RAM_SIZE,             /* required RTEMS workspace */
-    CONFIGURE_MICROSECONDS_PER_TICK,          /* microseconds per clock tick */
     CONFIGURE_TICKS_PER_TIMESLICE,            /* ticks per timeslice quantum */
     CONFIGURE_IDLE_TASK_BODY,                 /* user's IDLE task */
     CONFIGURE_IDLE_TASK_STACK_SIZE,           /* IDLE task stack size */
diff --git a/cpukit/include/rtems/config.h b/cpukit/include/rtems/config.h
index d9f91db..8491736 100644
--- a/cpukit/include/rtems/config.h
+++ b/cpukit/include/rtems/config.h
@@ -87,12 +87,6 @@ typedef struct {
   uintptr_t                      work_space_size;
 
   /** 
-   * This field specifies the number of microseconds which elapse
-   * between clock ticks.  This is the basis for RTEMS timing.
-   */
-  uint32_t                       microseconds_per_tick;
-
-  /** 
    * This field specifies the number of ticks in each task's timeslice.
    */
   uint32_t                       ticks_per_timeslice;
@@ -162,9 +156,9 @@ uintptr_t rtems_configuration_get_stack_space_size( void );
 uint32_t rtems_configuration_get_maximum_extensions( void );
 
 #define rtems_configuration_get_microseconds_per_tick() \
-        (Configuration.microseconds_per_tick)
+        (_Watchdog_Microseconds_per_tick)
 #define rtems_configuration_get_milliseconds_per_tick() \
-        (Configuration.microseconds_per_tick / 1000)
+        (_Watchdog_Microseconds_per_tick / 1000)
 #define rtems_configuration_get_nanoseconds_per_tick() \
         (_Watchdog_Nanoseconds_per_tick)
 
diff --git a/cpukit/include/rtems/score/watchdogticks.h b/cpukit/include/rtems/score/watchdogticks.h
index e7cf3f3..226de39 100644
--- a/cpukit/include/rtems/score/watchdogticks.h
+++ b/cpukit/include/rtems/score/watchdogticks.h
@@ -50,6 +50,14 @@ typedef uint32_t   Watchdog_Interval;
 extern volatile Watchdog_Interval _Watchdog_Ticks_since_boot;
 
 /**
+ * @brief The watchdog microseconds per tick.
+ *
+ * This constant is defined by the application configuration via
+ * <rtems/confdefs.h>.
+ */
+extern const uint32_t _Watchdog_Microseconds_per_tick;
+
+/**
  * @brief The watchdog nanoseconds per tick.
  *
  * This constant is defined by the application configuration via



More information about the vc mailing list