Re: [PATCH 10/18] config: Add _Watchdog_Microseconds_per_tick

2020-02-15 Thread Sebastian Huber

On 16/02/2020 00:25, Chris Johns wrote:


On 2020-02-15 03:02, Sebastian Huber wrote:

Move the microseconds per tick configuration constant out of the
configuration table.
This is necessary to split up the confdefs.h file in easier to review 
pieces.


Add WATCHDOG_MICROSECONDS_PER_TICK_DEFAULT and use it to provide a
default definition of the watchdog ticks constants.
The benefit is that the application configuration object file will only 
include data structures which have a user-defined value. After reading 
this again, I think this part of the patch makes no sense, since most 
users define this to option to 1000.


What is the purpose and/or use for this change? 
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 10/18] config: Add _Watchdog_Microseconds_per_tick

2020-02-15 Thread Chris Johns

On 2020-02-15 03:02, Sebastian Huber wrote:

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.


What is the purpose and/or use for this change?

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 10/18] config: Add _Watchdog_Microseconds_per_tick

2020-02-14 Thread Sebastian Huber
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/Makefile.am |  1 +
 cpukit/include/rtems/confdefs.h| 25 ++
 cpukit/include/rtems/config.h  | 10 ++--
 cpukit/include/rtems/score/watchdogticks.h | 13 ++
 cpukit/score/src/watchdogticksdefault.c| 41 ++
 5 files changed, 71 insertions(+), 19 deletions(-)
 create mode 100644 cpukit/score/src/watchdogticksdefault.c

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 1d3935776b..c3bdd284cd 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -1001,6 +1001,7 @@ librtemscpu_a_SOURCES += score/src/coretodhookrun.c
 librtemscpu_a_SOURCES += score/src/coretodhookunregister.c
 librtemscpu_a_SOURCES += score/src/watchdogremove.c
 librtemscpu_a_SOURCES += score/src/watchdogtick.c
+librtemscpu_a_SOURCES += score/src/watchdogticksdefault.c
 librtemscpu_a_SOURCES += score/src/watchdogtickssinceboot.c
 librtemscpu_a_SOURCES += score/src/userextaddset.c
 librtemscpu_a_SOURCES += score/src/userext.c
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index 0181af356a..4c2c80b2a9 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -1964,10 +1964,8 @@ extern "C" {
 /**@{*/
 
 /** The configures the number of microseconds per clock tick. */
-#ifndef CONFIGURE_MICROSECONDS_PER_TICK
-  #define CONFIGURE_MICROSECONDS_PER_TICK \
-  RTEMS_MILLISECONDS_TO_MICROSECONDS(10)
-#endif
+#if defined(CONFIGURE_MICROSECONDS_PER_TICK) && \
+  CONFIGURE_MICROSECONDS_PER_TICK != WATCHDOG_MICROSECONDS_PER_TICK_DEFAULT
 
 #if 100 % CONFIGURE_MICROSECONDS_PER_TICK != 0
   #warning "The clock ticks per second is not an integer"
@@ -1977,7 +1975,18 @@ extern "C" {
   #error "The CONFIGURE_MICROSECONDS_PER_TICK must be positive"
 #endif
 
-#define _CONFIGURE_TICKS_PER_SECOND (100 / 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 =
+100 / CONFIGURE_MICROSECONDS_PER_TICK;
+#endif
+
+#endif /* CONFIGURE_MICROSECONDS_PER_TICK */
 
 /** The configures the number of clock ticks per timeslice. */
 #ifndef CONFIGURE_TICKS_PER_TIMESLICE
@@ -2474,11 +2483,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 );
@@ -2644,7 +2648,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 d9f91db741..84917366f3 100644
--- a/cpukit/include/rtems/config.h
+++ b/cpukit/include/rtems/config.h
@@ -86,12 +86,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.
*/
@@ -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 e7cf3f3ea3..eaeddb5e6b 100644
--- a/cpukit/include/rtems/score/watchdogticks.h
+++ b/cpukit/include/rtems/score/watchdogticks.h
@@ -42,6 +42,11 @@ typedef