Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
Watchdog HAL API
[Hal]
Low-level interface to the Independent Watchdog Timer of a target. More...
Data Structures | |
| struct | watchdog_config_t |
| Watchdog configuration. More... | |
| struct | watchdog_features_t |
| Watchdog features. More... | |
Modules | |
| Watchdog HAL tests | |
Greentea tests for the Watchdog HAL. | |
Enumerations | |
| enum | watchdog_status_t { WATCHDOG_STATUS_OK, WATCHDOG_STATUS_NOT_SUPPORTED, WATCHDOG_STATUS_INVALID_ARGUMENT } |
Status of a watchdog operation. More... | |
Functions | |
| watchdog_status_t | hal_watchdog_init (const watchdog_config_t *config) |
| Initialize and start a watchdog timer with the given configuration. | |
| void | hal_watchdog_kick (void) |
| Refreshes the watchdog timer. | |
| watchdog_status_t | hal_watchdog_stop (void) |
| Stops the watchdog timer. | |
| uint32_t | hal_watchdog_get_reload_value (void) |
| Get the watchdog timer refresh value. | |
| watchdog_features_t | hal_watchdog_get_platform_features (void) |
| Get information on the current platforms supported watchdog functionality. | |
Detailed Description
Low-level interface to the Independent Watchdog Timer of a target.
This module provides platform independent access to the system watchdog timer which is an embedded peripheral that will reset the system in the case of system failures or malfunctions.
The watchdog timer initializes a system timer with a time period specified in the configuration. This timer counts down and triggers a system reset when it wraps. To prevent the system reset the timer must be continually kicked/refreshed by calling hal_watchdog_kick which will reset the countdown to the user specified reset value.
# Defined behavior * Sleep and debug modes don't stop the watchdog timer from counting down. * The function hal_watchdog_init is safe to call repeatedly. The function's implementation must not do anything if hal_watchdog_init has already initialized the hardware watchdog timer. * Maximum supported timeout is `UINT32_MAX` milliseconds; minimum timeout is 1 millisecond. * The uncalibrated watchdog should trigger at or after the timeout value multiplied by the frequency accuracy ratio of its oscillator (typical_frequency / max_frequency). * The calibrated watchdog should trigger at or after the timeout value. * The watchdog should trigger before twice the timeout value.
# Undefined behavior * Calling any function other than hal_watchdog_init or hal_watchdog_get_platform_features before you have initialized the watchdog.
# Notes * A software reset may not stop the watchdog timer; the behavior is platform specific.
Enumeration Type Documentation
| enum watchdog_status_t |
Status of a watchdog operation.
- Enumerator:
WATCHDOG_STATUS_OK Operation successful.
WATCHDOG_STATUS_NOT_SUPPORTED Operation not supported.
WATCHDOG_STATUS_INVALID_ARGUMENT Invalid argument.
Definition at line 117 of file watchdog_api.h.
Function Documentation
| watchdog_features_t hal_watchdog_get_platform_features | ( | void | ) |
Get information on the current platforms supported watchdog functionality.
- Returns:
- watchdog_feature_t indicating supported watchdog features on the current platform
| uint32_t hal_watchdog_get_reload_value | ( | void | ) |
Get the watchdog timer refresh value.
This function returns the configured refresh timeout of the watchdog timer.
- Returns:
- Reload value for the watchdog timer in milliseconds.
| watchdog_status_t hal_watchdog_init | ( | const watchdog_config_t * | config ) |
Initialize and start a watchdog timer with the given configuration.
If the watchdog timer is configured and starts successfully, this function returns WATCHDOG_STATUS_OK.
If the timeout specified is outside the range supported by the platform, it returns WATCHDOG_STATUS_INVALID_ARGUMENT.
- Parameters:
-
[in] config Configuration settings for the watchdog timer
- Returns:
- WATCHDOG_STATUS_OK if the watchdog is configured correctly and has started. Otherwise a status indicating the fault.
| void hal_watchdog_kick | ( | void | ) |
Refreshes the watchdog timer.
Call this function periodically before the watchdog times out. Otherwise, the system resets.
If a watchdog is not running, this function does nothing.
| watchdog_status_t hal_watchdog_stop | ( | void | ) |
Stops the watchdog timer.
Calling this function disables any running watchdog timers if the current platform supports them.
- Returns:
- Returns WATCHDOG_STATUS_OK if the watchdog timer was succesfully stopped, or if the timer was never started. Returns WATCHDOG_STATUS_NOT_SUPPORTED if the watchdog cannot be disabled on the current platform.
Generated on Tue Jul 12 2022 13:55:25 by
1.7.2