This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit efe2af643f6362d5d461049e7f9b7ea67edb0eb5
Author: ouyangxiangzhen <ouyangxiangz...@xiaomi.com>
AuthorDate: Thu May 29 14:42:45 2025 +0800

    sched/wdog: Replace periodcial timer with the wd_start_next.
    
    This commit replaced periodical timer with the wd_start_next to improve the 
timing accuracy.
    
    Signed-off-by: ouyangxiangzhen <ouyangxiangz...@xiaomi.com>
---
 sched/clock/clock_adjtime.c | 2 +-
 sched/clock/clock_perf.c    | 2 +-
 sched/sched/sched_cpuload.c | 2 +-
 sched/sched/sched_profil.c  | 2 +-
 sched/timer/timer_settime.c | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sched/clock/clock_adjtime.c b/sched/clock/clock_adjtime.c
index 0effc2e241..c7028f4fd8 100644
--- a/sched/clock/clock_adjtime.c
+++ b/sched/clock/clock_adjtime.c
@@ -135,7 +135,7 @@ static int adjtime_start(long long adjust_usec)
   if (g_adjtime_ppb != 0)
     {
       wd_start(&g_adjtime_wdog, MSEC2TICK(CONFIG_CLOCK_ADJTIME_PERIOD_MS),
-              adjtime_wdog_callback, 0);
+               adjtime_wdog_callback, 0);
     }
   else
     {
diff --git a/sched/clock/clock_perf.c b/sched/clock/clock_perf.c
index 1fd9c46eb3..372b0d8d78 100644
--- a/sched/clock/clock_perf.c
+++ b/sched/clock/clock_perf.c
@@ -64,7 +64,7 @@ static void perf_update(wdparm_t arg)
   clock_t tick = (clock_t)LONG_MAX * TICK_PER_SEC / up_perf_getfreq();
 
   perf_gettime();
-  wd_start((FAR struct wdog_s *)arg, tick, perf_update, arg);
+  wd_start_next((FAR struct wdog_s *)arg, tick, perf_update, arg);
 }
 
 /****************************************************************************
diff --git a/sched/sched/sched_cpuload.c b/sched/sched/sched_cpuload.c
index 9ded4668ac..f7811254a2 100644
--- a/sched/sched/sched_cpuload.c
+++ b/sched/sched/sched_cpuload.c
@@ -118,7 +118,7 @@ static void cpuload_callback(wdparm_t arg)
 {
   FAR struct wdog_s *wdog = (FAR struct wdog_s *)arg;
   nxsched_process_cpuload_ticks(CPULOAD_SAMPLING_PERIOD);
-  wd_start(wdog, CPULOAD_SAMPLING_PERIOD, cpuload_callback, arg);
+  wd_start_next(wdog, CPULOAD_SAMPLING_PERIOD, cpuload_callback, arg);
 }
 #endif
 
diff --git a/sched/sched/sched_profil.c b/sched/sched/sched_profil.c
index 40c276a0e7..5a07af9678 100644
--- a/sched/sched/sched_profil.c
+++ b/sched/sched/sched_profil.c
@@ -102,7 +102,7 @@ static void profil_timer_handler(wdparm_t arg)
 #endif
 
   profil_timer_handler_cpu(prof);
-  wd_start(&prof->timer, PROFTICK, profil_timer_handler, arg);
+  wd_start_next(&prof->timer, PROFTICK, profil_timer_handler, arg);
 }
 
 /****************************************************************************
diff --git a/sched/timer/timer_settime.c b/sched/timer/timer_settime.c
index 656807fe82..f69c3fa83a 100644
--- a/sched/timer/timer_settime.c
+++ b/sched/timer/timer_settime.c
@@ -128,7 +128,7 @@ static inline void timer_restart(FAR struct posix_timer_s 
*timer,
        */
 
       frame = (delay + timer->pt_delay) / timer->pt_delay;
-      timer->pt_overrun = frame - 1;
+      timer->pt_overrun   = frame - 1;
       timer->pt_expected += frame * timer->pt_delay;
 
       wd_start_abstick(&timer->pt_wdog, timer->pt_expected,

Reply via email to