daniel-p-carvalho opened a new pull request, #20915:
URL: https://github.com/apache/nuttx/pull/20915

   ## Summary
   
   Add `watchdog_wdog_initialize()` (`CONFIG_WATCHDOG_WDOG`), a watchdog lower
   half built on a wdog timer, like `timer_wdog.c` does for the timer interface.
   It is meant for the platforms with no watchdog hardware, such as the
   simulator: when it is not fed within its timeout it calls a handler given by
   the board, or panics if there is none. Since it relies on the system tick it
   can not detect a system where the tick stopped.
   
   The simulator uses it for `CONFIG_SIM_WATCHDOG`, where the handler makes the
   simulator exit with `CONFIG_SIM_WATCHDOG_EXITCODE`, because the simulator
   cannot reset itself. A new `sim:watchdog` configuration runs the `wdog`
   example on it.
   
   This was suggested in the review of #20782 (move the simulated watchdog to a
   common place, like `timer_wdog.c`). That PR needs it to test the task
   supervisor on the simulator.
   
   Commits: the driver, the simulator using it (with the configuration), and the
   documentation.
   
   ## Impact
   
   New option, off by default (`CONFIG_WATCHDOG_WDOG`, `CONFIG_SIM_WATCHDOG`);
   nothing changes for the existing configurations. Documentation added to the
   watchdog driver page and to the sim board page. It is not available with
   `CONFIG_WATCHDOG_AUTOMONITOR_BY_ONESHOT` and `_BY_TIMER`, which change the
   `watchdog_register()` prototype.
   
   ## Testing
   
   Host: Linux x86_64, GCC, `sim:watchdog` built with Make and with CMake;
   `sim:nsh` and `sim:watchdog-notifier` still build, no warnings.
   
   `nsh> wdog` (feeds the watchdog for 5 s, then stops; timeout 2 s):
   
   ```
     ping elapsed=4500
     NO ping elapsed=5000
     NO ping elapsed=5500
     NO ping elapsed=6000
     NO ping elapsed=6500
   Simulated watchdog expired, exit 77
   ```
   
   Also checked with a small throwaway application (not included in the PR):
   `getstatus` (flags, timeout, timeleft counting down, never above the 
timeout),
   `WDIOC_STOP` and writing `V` (no expiration afterwards), keepalive while
   stopped (no effect), `WDIOC_START` after a stop, feeding with `write()` and
   then stopping (expires), shrinking the timeout while running (expires on the
   new one), `WDIOC_SETTIMEOUT` with 0 (`EINVAL`). All as expected.
   
   Documentation: `make html` has no new warnings for the changed pages.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to