-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers/timers/watchdog: add watchdog timer notifier chain #15387
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
Area: Drivers
Drivers issues
Area: OS Components
OS Components issues
Size: M
The size of the change in this PR is medium
labels
Dec 30, 2024
[Experimental Bot, please feedback here] Yes, this PR appears to meet the NuttX requirements, although there are a few minor points that could be improved. Strengths:
Areas for Potential Improvement:
By addressing these minor points, the PR will be even stronger and easier for reviewers to assess. Overall, it's a well-structured and informative PR submission. |
Jiaqi-YP7
force-pushed
the
add-wdt-notifier
branch
from
December 31, 2024 01:34
a554048
to
a1abcd3
Compare
Jiaqi-YP7
force-pushed
the
add-wdt-notifier
branch
from
December 31, 2024 01:37
a1abcd3
to
39436d7
Compare
acassis
approved these changes
Jan 1, 2025
xiaoxiang781216
force-pushed
the
add-wdt-notifier
branch
3 times, most recently
from
January 11, 2025 16:04
643a269
to
f1607b9
Compare
Add support for watchdog timer notifer chain so that users can customize the callback function when the watchdog timer times out which enabled by Auto-monitor Signed-off-by: yaojiaqi <yaojiaqi@lixiang.com>
xiaoxiang781216
force-pushed
the
add-wdt-notifier
branch
from
January 11, 2025 16:05
f1607b9
to
87d5afe
Compare
xiaoxiang781216
approved these changes
Jan 11, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add support for watchdog timer notifer chain so that users
can customize the callback function when the watchdog timer
times out which enabled by Auto-monitor.
Summary
Some watchdog timers support an interrupt on timeout and allow
the user to perform some custom processing actions instead of
immediately sending a reset signal. However, when watchdog
timer is managed by auto-monitor, users can no longer register
the timeout callback function implemented by users for watchdog
timer through ioctl.
Impact
We provide CONFIG_WATCHDOG_TIMEOUT_NOTIFIER to enable
or disable watchdog timer notifier chain, This option depends
on CONFIG_WATCHDOG_AUTOMONITOR.
After the watchdog timer notifier chain is enabled, user can put the
watchdog_automonitor_timeout function in the timeout interrupt handler
of the watchdog timer, for example
This function will call the function registered on the wdt notifier chain
when the watchdog timer times out.
To register the user-defined timeout callback function on the wdt
notifier chain, users should perform the following steps:
step 1:
Include necessary header files
step 2:
Define the necessary notifier_block
step 3:
Define the function to be registered. In The following example,
"The callback function registered by the user is triggered!" is
printed when the watchdog timer times out.
step 4:
Register user-defined callback functions with wdt_notifier_chain_register
*step 5(not necessary):
If users need to unregister the callback function that has been registered
on the watchdog timer notifier chain.
Testing
I verified this feature on a private platform where the WDT could support
an interrupt signal instead of a reset signal when times out.
In the test we need to register the custom timeout callback function as
described in Impact. We can add these changes in
nuttx-apps/examples/watchdog/watchdog_main.C
,this example can make watchdog timeout.
I registered The callback function shown in Impact and it just prints
"The callback function registered by the user is triggered!"
After we execute the modified watchdog_example, when the watchdog
times out, the log will show as follows: