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/10/08 00:59:45 UTC
(nuttx) 01/02: timer: set g_timer.lower after TIMER_START()
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 aff700f8cae2d2f381f1fbe07c8e695525c08c58
Author: ligd <li...@xiaomi.com>
AuthorDate: Mon Jun 3 21:06:33 2024 +0800
timer: set g_timer.lower after TIMER_START()
in case of up_perf_gettime() get non-start value
Signed-off-by: ligd <li...@xiaomi.com>
---
drivers/timers/arch_timer.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/timers/arch_timer.c b/drivers/timers/arch_timer.c
index 1f319b5717..850777c010 100644
--- a/drivers/timers/arch_timer.c
+++ b/drivers/timers/arch_timer.c
@@ -195,17 +195,17 @@ static bool timer_callback(FAR uint32_t *next_interval, FAR void *arg)
void up_timer_set_lowerhalf(FAR struct timer_lowerhalf_s *lower)
{
- g_timer.lower = lower;
-
#ifdef CONFIG_SCHED_TICKLESS
TIMER_TICK_MAXTIMEOUT(lower, &g_oneshot_maxticks);
- TIMER_TICK_SETTIMEOUT(g_timer.lower, g_oneshot_maxticks);
+ TIMER_TICK_SETTIMEOUT(lower, g_oneshot_maxticks);
#else
- TIMER_TICK_SETTIMEOUT(g_timer.lower, 1);
+ TIMER_TICK_SETTIMEOUT(lower, 1);
#endif
- TIMER_SETCALLBACK(g_timer.lower, timer_callback, NULL);
- TIMER_START(g_timer.lower);
+ TIMER_SETCALLBACK(lower, timer_callback, NULL);
+ TIMER_START(lower);
+
+ g_timer.lower = lower;
}
/****************************************************************************