mirror of
https://github.com/apache/nuttx.git
synced 2026-10-10 07:40:27 +00:00
sched/wdog: Improve wdog Precision
Currently, wd_timer() obtains the current systick
from the input parameter, and the wdog processes
the list without updating the systick value.
This is not incorrect, as the systick should continue
to increase while the watchdog is processing callbacks.
This patch addresses the issue by retrieving the updated
systick value after each watchdog node loop.
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
This commit is contained in:
parent
aa3cf8cb3a
commit
1217fcf907
1 changed files with 13 additions and 3 deletions
|
|
@ -137,11 +137,21 @@ static inline_function void wd_expiration(clock_t ticks)
|
|||
{
|
||||
wdog = list_first_entry(&g_wdactivelist, struct wdog_s, node);
|
||||
|
||||
/* Check if expected time is expired */
|
||||
/* Check if watchdog has expired;
|
||||
* re-evaluate after updating current ticks if needed
|
||||
*/
|
||||
|
||||
if (!clock_compare(wdog->expired, ticks))
|
||||
bool expired = clock_compare(wdog->expired, ticks);
|
||||
|
||||
if (!expired)
|
||||
{
|
||||
break;
|
||||
ticks = clock_systime_ticks();
|
||||
expired = clock_compare(wdog->expired, ticks);
|
||||
|
||||
if (!expired)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove the watchdog from the head of the list */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue