[rtems commit] config: Add _Watchdog_Ticks_per_timeslice
Sebastian Huber
sebh at rtems.org
Tue Feb 25 11:32:18 UTC 2020
Module: rtems
Branch: master
Commit: 308a2e0fdcde94b8549dcf9dcdd42eea3cdc9f27
Changeset: http://git.rtems.org/rtems/commit/?id=308a2e0fdcde94b8549dcf9dcdd42eea3cdc9f27
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri Feb 14 12:58:21 2020 +0100
config: Add _Watchdog_Ticks_per_timeslice
Move the ticks per timeslice configuration constant out of the
configuration table.
Add WATCHDOG_TICKS_PER_TIMESLICE_DEFAULT and use it to provide a default
definition of the watchdog ticks per timeslice constant.
Update #3875.
---
cpukit/Makefile.am | 1 +
cpukit/include/rtems/confdefs.h | 11 ++++++---
cpukit/include/rtems/config.h | 7 +-----
cpukit/include/rtems/score/watchdogticks.h | 13 +++++++++++
cpukit/score/src/watchdogtimeslicedefault.c | 35 +++++++++++++++++++++++++++++
5 files changed, 58 insertions(+), 9 deletions(-)
diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 1d39357..1adcbb3 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -1002,6 +1002,7 @@ 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/watchdogtickssinceboot.c
+librtemscpu_a_SOURCES += score/src/watchdogtimeslicedefault.c
librtemscpu_a_SOURCES += score/src/userextaddset.c
librtemscpu_a_SOURCES += score/src/userext.c
librtemscpu_a_SOURCES += score/src/userextremoveset.c
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index 1254e3d..b1c3a4a 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -1967,10 +1967,16 @@ extern "C" {
#endif
/** The configures the number of clock ticks per timeslice. */
-#ifndef CONFIGURE_TICKS_PER_TIMESLICE
- #define CONFIGURE_TICKS_PER_TIMESLICE 50
+#if defined(CONFIGURE_TICKS_PER_TIMESLICE) && \
+ CONFIGURE_TICKS_PER_TIMESLICE != WATCHDOG_TICKS_PER_TIMESLICE_DEFAULT
+
+#ifdef CONFIGURE_INIT
+ const uint32_t _Watchdog_Ticks_per_timeslice =
+ CONFIGURE_TICKS_PER_TIMESLICE;
#endif
+#endif /* CONFIGURE_TICKS_PER_TIMESLICE */
+
/**@}*/ /* end of General Configuration */
/*
@@ -2626,7 +2632,6 @@ struct _reent *__getreent(void)
*/
const rtems_configuration_table Configuration = {
CONFIGURE_EXECUTIVE_RAM_SIZE, /* required RTEMS workspace */
- 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 */
#ifdef CONFIGURE_UNIFIED_WORK_AREAS /* true for unified work areas */
diff --git a/cpukit/include/rtems/config.h b/cpukit/include/rtems/config.h
index 8491736..31a667a 100644
--- a/cpukit/include/rtems/config.h
+++ b/cpukit/include/rtems/config.h
@@ -87,11 +87,6 @@ typedef struct {
uintptr_t work_space_size;
/**
- * This field specifies the number of ticks in each task's timeslice.
- */
- uint32_t ticks_per_timeslice;
-
- /**
* This element points to the BSP's optional idle task which may override
* the default one provided with RTEMS.
*/
@@ -163,7 +158,7 @@ uint32_t rtems_configuration_get_maximum_extensions( void );
(_Watchdog_Nanoseconds_per_tick)
#define rtems_configuration_get_ticks_per_timeslice() \
- (Configuration.ticks_per_timeslice)
+ (_Watchdog_Ticks_per_timeslice)
#define rtems_configuration_get_idle_task() \
(Configuration.idle_task)
diff --git a/cpukit/include/rtems/score/watchdogticks.h b/cpukit/include/rtems/score/watchdogticks.h
index 226de39..ea26519 100644
--- a/cpukit/include/rtems/score/watchdogticks.h
+++ b/cpukit/include/rtems/score/watchdogticks.h
@@ -43,6 +43,11 @@ typedef uint32_t Watchdog_Interval;
#define WATCHDOG_NO_TIMEOUT 0
/**
+ * @brief Default value for the watchdog ticks per timeslice.
+ */
+#define WATCHDOG_TICKS_PER_TIMESLICE_DEFAULT 50
+
+/**
* @brief The watchdog ticks counter.
*
* With a 1ms watchdog tick, this counter overflows after 50 days since boot.
@@ -73,6 +78,14 @@ extern const uint32_t _Watchdog_Nanoseconds_per_tick;
*/
extern const uint32_t _Watchdog_Ticks_per_second;
+/**
+ * @brief The watchdog ticks per timeslice.
+ *
+ * This constant is defined by the application configuration via
+ * <rtems/confdefs.h>.
+ */
+extern const uint32_t _Watchdog_Ticks_per_timeslice;
+
/** @} */
#ifdef __cplusplus
diff --git a/cpukit/score/src/watchdogtimeslicedefault.c b/cpukit/score/src/watchdogtimeslicedefault.c
new file mode 100644
index 0000000..91be2b5
--- /dev/null
+++ b/cpukit/score/src/watchdogtimeslicedefault.c
@@ -0,0 +1,35 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/score/watchdogticks.h>
+
+const uint32_t _Watchdog_Ticks_per_timeslice =
+ WATCHDOG_TICKS_PER_TIMESLICE_DEFAULT;
More information about the vc
mailing list