Commit graph

16 commits

Author SHA1 Message Date
Fin Maaß 47424e0add task_wdt: add shell
add shell for task_wdt

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-03-22 10:24:55 +01:00
Fin Maaß 6c1e447fbe task_wdt: reformat Kconfig
reformat Kconfig for task_wdt

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-03-22 10:24:55 +01:00
Armin Brauns fdea851878 task_wdt: start feeding hardware watchdog immediately after init
Without this, the hardware watchdog would expire if no task watchdogs were
registered within one hardware watchdog period after init. Start the
background channel immediately after init to avoid this.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2024-01-02 09:52:13 +01:00
Martin Jäger 33bd2fed08 task_wdt: fix race condition for task_wdt_add function
The task_wdt_add function changes the reload_period of the channel to a
non-null value, which indicates that the channel is used. If the
function is interrupted by a task_wdt_trigger running in ISR context
before adding of the new channel has finished, the next timeout will be
scheduled based on inconsistent channel data.

Using a spinlock avoids such data races.

Fixes #61004

Signed-off-by: Martin Jäger <martin@libre.solar>
2023-10-09 16:10:00 +03:00
Pieter De Gendt 155f42a9fa task_wdt: Fix build warning on 64-bit platforms
When building for 64-bit platform (tested on native_posix_64), there
was a cast warning for different sizes.

A void * is used to store a simple ID, fixed by using uintptr_t instead.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-08-23 10:16:04 +02:00
Fabio Baltieri e24314f10f include: add more missing zephyr/ prefixes
Adds few missing zephyr/ prefixes to leftover #include statements that
either got added recently or were using double quote format.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-05-27 15:20:27 -07:00
Gerard Marull-Paretas 5113c1418d subsystems: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all subsystems code to
the new prefix <zephyr/...>. Note that the conversion has been scripted,
refer to zephyrproject-rtos#45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-09 12:07:35 +02:00
Martin Jäger 98d2d2feda task_wdt: fix overflow in current_ticks making wdt get stuck
The task_wdt was getting stuck after approx. 36 hours on e.g. nRF52840,
which has a SysTick with 32768 Hz. This corresponds to an overflow of
the uint32_t current_ticks in schedule_next_timeout.

This commit fixes the accidentally introduced narrowing conversion.

Fixes #40152

Signed-off-by: Martin Jäger <martin@libre.solar>
2021-11-22 20:22:11 -05:00
Martin Jäger f24367963e task_wdt: ensure hw wdt is started before being fed
If a fallback hardware watchdog is used, it is fed together with the
task watchdog in task_wdt_feed. However, the hardware watchdog was
not yet set up before the first call to task_wdt_feed.

This commit fixes the order of wdt_setup and task_wdt_feed calls.

Fixes #39523

Signed-off-by: Martin Jäger <martin@libre.solar>
2021-10-21 07:35:11 -04:00
Nick Ward e0f18128bf task_wdt: fix silent init failures
The task_wdt_init() API can fail to install a timeout for the fallback
hardware WDT (hw_wdt) without returning an error code.  This patch
enables task_wdt_init() to return the hw_wdt install timeout error code
if the hw_wdt install timeout fails.

Signed-off-by: Nick Ward <nick.ward@setec.com.au>
2021-10-01 15:21:32 +02:00
Andrzej Głąbek df1125a58c task_wdt: Fix the way the kernel timer is used
Do not use periodic executions of the timer handler, as in certain
circumstances (the fallback hardware watchdog used, one or more
task_wdt channel activated but none of them being ever fed) this
would lead to no callback/reset being executed for any channel.
Instead, schedule the next timeout from the timer handler function
when the function is executed for the dummy background channel or
for a channel that was deleted.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-07-07 07:44:22 -05:00
Martin Jäger a46a36a4cf task_wdt: Pause hardware wdt during debugging
Enable the option to pause the fallback hardware watchdog if the MCU is
halted by a debugger.

This fixes issue #33509 where some boards with Nordic MCUs could not be
flashed anymore after using the task watchdog sample.

Signed-off-by: Martin Jäger <martin@libre.solar>
2021-05-21 05:00:07 -05:00
Martin Jäger 79531c86a2 task_wdt: use correct hardware watchdog channel number
The hardware watchdog was always fed with channel ID 0. This is correct
in most cases, but we should still use the actual ID returned from
wdt_install_timeout.

Signed-off-by: Martin Jäger <martin@libre.solar>
2021-05-20 13:18:45 -05:00
Gerard Marull-Paretas f163bdb280 power: move reboot functionality to os lib
Reboot functionality has nothing to do with PM, so move it out to the
subsys/os folder.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 20:34:00 -04:00
Anas Nashif fe0872c0ab clocks: rename z_tick_get -> sys_clock_tick_get
Do not use z_ for internal APIs, z_ is for private APIs within one
subsystem only.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-19 11:22:17 -04:00
Martin Jäger 1aaf508bde task_wdt: add task-level watchdog subsystem
This new subsystem can be used to supervise individual threads. It
is based on a regularly updated kernel timer, whose ISR is never
actually called in regular system operation.

An existing hardware watchdog can be used as an optional fallback if
the task watchdog itself gets stuck.

Signed-off-by: Martin Jäger <martin@libre.solar>
2021-03-15 12:24:54 +01:00