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
ResetReason HAL API
[Hal]
Low-level interface to the ResetReason of a target. More...
Modules | |
ResetReason HAL tests | |
Greentea tests for the ResetReason HAL. | |
Enumerations | |
enum | reset_reason_t { RESET_REASON_POWER_ON, RESET_REASON_PIN_RESET, RESET_REASON_BROWN_OUT, RESET_REASON_SOFTWARE, RESET_REASON_WATCHDOG, RESET_REASON_LOCKUP, RESET_REASON_WAKE_LOW_POWER, RESET_REASON_ACCESS_ERROR, RESET_REASON_BOOT_ERROR, RESET_REASON_MULTIPLE, RESET_REASON_PLATFORM, RESET_REASON_UNKNOWN } |
Definitions of different reset reasons. More... | |
Functions | |
reset_reason_t | hal_reset_reason_get (void) |
Fetch the reset reason for the last system reset. | |
uint32_t | hal_reset_reason_get_raw (void) |
Fetch the raw platform specific reset reason register value. | |
void | hal_reset_reason_clear (void) |
Clear the reset reason from registers. |
Detailed Description
Low-level interface to the ResetReason of a target.
This module provides a platform-independent method of checking the cause of the last system reset.
# Defined behavior * The function hal_reset_reason_clear clears the ResetReason registers for the next system boot. * By the time the user calls hal_reset_reason_get to read the value, some other part of the application may have cleared the value. Therefore, though there may have been a reset reason in the registers when the system started, the reason may not be available when the user comes to check it.
# Undefined behavior * There is no guarantee that the function hal_reset_reason_get will return the same value when you call it repeatedly. Store the value for later use instead of calling the function repeatedly. * The function hal_reset_reason_clear may not clear the ResetReason register in time for the next system boot.
# Notes * The contents of the targets ResetReason register may be cleared by some subsystem before it first gets called. This returns a RESET_REASON_UNKNOWN value to the user. To avoid this, the user should call the ResetReason API as early as possible at boot time. * If the target doesn't support clearing reset registers, hal_reset_reason_get seems to erroneously return a reset reason even after clearing.
Enumeration Type Documentation
enum reset_reason_t |
Definitions of different reset reasons.
- Enumerator:
Definition at line 76 of file reset_reason_api.h.
Function Documentation
void hal_reset_reason_clear | ( | void | ) |
Clear the reset reason from registers.
Reset the value of the reset status registers. The reset reason persists between system resets on certain platforms, so the registers should be cleared before the system resets. Failing to do so may make it difficult to determine the cause of any subsequent system resets.
reset_reason_t hal_reset_reason_get | ( | void | ) |
Fetch the reset reason for the last system reset.
This function must return the contents of the system reset reason registers cast to an appropriate platform independent reset reason. If multiple reset reasons are set, this function should return RESET_REASON_MULTIPLE. If the reset reason does not match any existing platform independent value, this function should return RESET_REASON_PLATFORM. If no reset reason can be determined, this function should return RESET_REASON_UNKNOWN.
This function is not idempotent; there is no guarantee the system reset reason will not be cleared between calls to this function altering the return value between calls.
Note: Some platforms contain reset reason registers that persist through system resets. If the registers haven't been cleared before calling this function, multiple reasons may be set within the registers. If multiple reset reasons are detected, this function returns RESET_REASON_MULTIPLE.
- Returns:
- enum containing the last reset reason for the board.
uint32_t hal_reset_reason_get_raw | ( | void | ) |
Fetch the raw platform specific reset reason register value.
This function must return the raw contents of the system reset reason registers cast to a uint32_t value. If the platform contains reset reasons that span multiple registers/addresses, the value should be concatenated into the return type.
This function is not idempotent; there is no guarantee the system reset reason will not be cleared between calls to this function altering the return value between calls.
- Returns:
- value containing the reset reason register for the given platform. If the platform contains reset reasons across multiple registers, they will be concatenated here.
Generated on Tue Jul 12 2022 13:55:25 by
