You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/09/10 15:32:43 UTC
(nuttx) 06/15: sched/wdog: move g_wdtimernested to wd_start.c
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 66871ced4d29b119159b3ab6c02892feac520760
Author: ouyangxiangzhen <ou...@xiaomi.com>
AuthorDate: Mon Jul 15 11:08:55 2024 +0800
sched/wdog: move g_wdtimernested to wd_start.c
This patch moved the g_wdtimernested to wd_start.c
Signed-off-by: ouyangxiangzhen <ou...@xiaomi.com>
Signed-off-by: ligd <li...@xiaomi.com>
---
sched/sched/sched_timerexpiration.c | 2 --
sched/wdog/wd_initialize.c | 4 ----
sched/wdog/wd_start.c | 22 ++++++++++++++++++++++
sched/wdog/wdog.h | 4 ----
4 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/sched/sched/sched_timerexpiration.c b/sched/sched/sched_timerexpiration.c
index 08fe7f0765..6c80fb2345 100644
--- a/sched/sched/sched_timerexpiration.c
+++ b/sched/sched/sched_timerexpiration.c
@@ -528,9 +528,7 @@ void nxsched_alarm_tick_expiration(clock_t ticks)
/* Process the timer ticks and set up the next interval (or not) */
- g_wdtimernested++;
nexttime = nxsched_timer_process(ticks, elapsed, false);
- g_wdtimernested--;
nxsched_timer_start(nexttime);
#ifdef CONFIG_SMP
diff --git a/sched/wdog/wd_initialize.c b/sched/wdog/wd_initialize.c
index 00c70a5be5..98d4359583 100644
--- a/sched/wdog/wd_initialize.c
+++ b/sched/wdog/wd_initialize.c
@@ -39,10 +39,6 @@
struct list_node g_wdactivelist = LIST_INITIAL_VALUE(g_wdactivelist);
-#ifdef CONFIG_SCHED_TICKLESS
-unsigned int g_wdtimernested;
-#endif
-
/****************************************************************************
* Public Functions
****************************************************************************/
diff --git a/sched/wdog/wd_start.c b/sched/wdog/wd_start.c
index 0fdb48213b..4fa0996dc3 100644
--- a/sched/wdog/wd_start.c
+++ b/sched/wdog/wd_start.c
@@ -69,6 +69,14 @@
# define CALL_FUNC(func, arg) func(arg)
#endif
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+#ifdef CONFIG_SCHED_TICKLESS
+static unsigned int g_wdtimernested;
+#endif
+
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -93,6 +101,14 @@ static inline_function void wd_expiration(clock_t ticks)
FAR struct wdog_s *wdog;
wdentry_t func;
+#ifdef CONFIG_SCHED_TICKLESS
+ /* Increment the nested watchdog timer count to handle cases where wd_start
+ * is called in the watchdog callback functions.
+ */
+
+ g_wdtimernested++;
+#endif
+
/* Process the watchdog at the head of the list as well as any
* other watchdogs that became ready to run at this time
*/
@@ -122,6 +138,12 @@ static inline_function void wd_expiration(clock_t ticks)
up_setpicbase(wdog->picbase);
CALL_FUNC(func, wdog->arg);
}
+
+#ifdef CONFIG_SCHED_TICKLESS
+ /* Decrement the nested watchdog timer count */
+
+ g_wdtimernested--;
+#endif
}
/****************************************************************************
diff --git a/sched/wdog/wdog.h b/sched/wdog/wdog.h
index a19830f348..636257cdbc 100644
--- a/sched/wdog/wdog.h
+++ b/sched/wdog/wdog.h
@@ -63,10 +63,6 @@ extern "C"
extern struct list_node g_wdactivelist;
-#ifdef CONFIG_SCHED_TICKLESS
-extern unsigned int g_wdtimernested;
-#endif
-
/****************************************************************************
* Public Function Prototypes
****************************************************************************/