[PATCH 11/16] score: Add _Watchdog_Nanoseconds_per_tick
Sebastian Huber
sebastian.huber at embedded-brains.de
Mon Oct 23 13:53:42 UTC 2017
Move it from the configuration to a separate variable.
Update #3117.
Update #3182.
---
cpukit/sapi/include/confdefs.h | 4 +++-
cpukit/sapi/include/rtems/config.h | 12 +++---------
cpukit/score/include/rtems/score/watchdog.h | 8 ++++++++
testsuites/sptests/spwatchdog/init.c | 1 +
4 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index aed740b594..219260e652 100755
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -3108,6 +3108,9 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
const size_t _Thread_Control_add_on_count =
RTEMS_ARRAY_SIZE( _Thread_Control_add_ons );
+ const uint32_t _Watchdog_Nanoseconds_per_tick =
+ 1000 * CONFIGURE_MICROSECONDS_PER_TICK;
+
const uint32_t _Watchdog_Ticks_per_second = _CONFIGURE_TICKS_PER_SECOND;
const uint64_t _Watchdog_Monotonic_max_seconds =
@@ -3167,7 +3170,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
_CONFIGURE_POSIX_KEYS, /* POSIX keys are always */
CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS, /* enabled */
CONFIGURE_MICROSECONDS_PER_TICK, /* microseconds per clock tick */
- 1000 * CONFIGURE_MICROSECONDS_PER_TICK, /* nanoseconds 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/sapi/include/rtems/config.h b/cpukit/sapi/include/rtems/config.h
index 2993e70543..6b97376511 100644
--- a/cpukit/sapi/include/rtems/config.h
+++ b/cpukit/sapi/include/rtems/config.h
@@ -43,6 +43,8 @@ extern "C" {
#define rtems_resource_maximum_per_allocation(resource) \
_Objects_Maximum_per_allocation(resource)
+#include <rtems/score/watchdog.h>
+
/*
* This is kind of kludgy but it allows targets to totally ignore the
* optional APIs like POSIX safely.
@@ -165,14 +167,6 @@ typedef struct {
uint32_t microseconds_per_tick;
/**
- * This field specifies the number of nanoseconds which elapse
- * between clock ticks. This value is derived from the
- * microseconds_per_tick field and provided to avoid calculation at
- * run-time.
- */
- uint32_t nanoseconds_per_tick;
-
- /**
* This field specifies the number of ticks in each task's timeslice.
*/
uint32_t ticks_per_timeslice;
@@ -308,7 +302,7 @@ extern const rtems_configuration_table Configuration;
#define rtems_configuration_get_milliseconds_per_tick() \
(Configuration.microseconds_per_tick / 1000)
#define rtems_configuration_get_nanoseconds_per_tick() \
- (Configuration.nanoseconds_per_tick)
+ (_Watchdog_Nanoseconds_per_tick)
#define rtems_configuration_get_ticks_per_timeslice() \
(Configuration.ticks_per_timeslice)
diff --git a/cpukit/score/include/rtems/score/watchdog.h b/cpukit/score/include/rtems/score/watchdog.h
index 8c3710334b..a379bf7a23 100644
--- a/cpukit/score/include/rtems/score/watchdog.h
+++ b/cpukit/score/include/rtems/score/watchdog.h
@@ -159,6 +159,14 @@ struct Watchdog_Control {
extern volatile Watchdog_Interval _Watchdog_Ticks_since_boot;
/**
+ * @brief The watchdog nanoseconds per tick.
+ *
+ * This constant is defined by the application configuration via
+ * <rtems/confdefs.h>.
+ */
+extern const uint32_t _Watchdog_Nanoseconds_per_tick;
+
+/**
* @brief The watchdog ticks per second.
*
* This constant is defined by the application configuration via
diff --git a/testsuites/sptests/spwatchdog/init.c b/testsuites/sptests/spwatchdog/init.c
index 603e46df77..87b7ff7bae 100644
--- a/testsuites/sptests/spwatchdog/init.c
+++ b/testsuites/sptests/spwatchdog/init.c
@@ -57,6 +57,7 @@ static void test_watchdog_static_init( void )
static void test_watchdog_config( void )
{
+ rtems_test_assert( _Watchdog_Nanoseconds_per_tick == 10000000 );
rtems_test_assert( _Watchdog_Ticks_per_second == 100 );
rtems_test_assert( _Watchdog_Monotonic_max_seconds == 184467440737095516 );
}
--
2.12.3
More information about the devel
mailing list