This section describes the M2MB APIs related to system reset functionality.
More...
This section describes the M2MB APIs related to system reset functionality.
System Reset
System reset module provides APIs to reset the system, get reset information and handling system watchdog.
- To reset the system user can call m2mb_system_reset. It will reset the system and boot up.
- To find the previous reset reason user can call m2mb_get_boot_reason.
- If the boot reason is exception, user can find the exception reason and details on exception by calling m2mb_get_exception_info. This gives the exception reason and the register details when exception happened.
- To enable/disable system watchdog user can call m2mb_wdog_enable or m2mb_wdog_disable. By default, watchdog is enabled. It monitors thread. If any thread executes more than 10sec, it resets the system. User needs to kick the watchdog if it needs more time to execute before 10sec, by calling m2mb_wdog_kick. User can check if the watchdog is enabled or not by calling m2mb_wdog_is_enable API.
◆ M2MB_ERR_LOG_MAX_FILE_NAME_LEN
#define M2MB_ERR_LOG_MAX_FILE_NAME_LEN 50 |
◆ M2MB_ERR_LOG_MAX_THREAD_NAME_LEN
#define M2MB_ERR_LOG_MAX_THREAD_NAME_LEN 20 |
◆ M2MB_SYSTEM_EXCEPTION_INFO_T
Structure defining details of exception information.
Exception information details.
◆ M2MB_SYSTEM_RESET_RESON_T
Enum defining different boot reason.
Enum defines different boot reason.
Enumerator |
---|
M2MB_SYSTEM_BOOT_REASON_PON_COLD_BOOT | Power on cold boot or hardware reset.
|
M2MB_SYSTEM_BOOT_REASON_WATCHDOG_BOOT | Reset from the Watchdog.
|
M2MB_SYSTEM_BOOT_REASON_SW_BOOT | Software cold reset.
|
M2MB_SYSTEM_BOOT_REASON_EXCEPTION_HARD_FAULT | Exception, Hard fault.
|
M2MB_SYSTEM_BOOT_REASON_EXCEPTION_MEM_FAULT | Exception, Memory management fault.
|
M2MB_SYSTEM_BOOT_REASON_EXCEPTION_USAGE_FAULT | Exception, Usage fault.
|
M2MB_SYSTEM_BOOT_REASON_EXCEPTION_BUS_FAULT | Exception, Bus fault.
|
M2MB_SYSTEM_BOOT_REASON_STANDBY_BOOT | Wakeup from Standby.
|
M2MB_SYSTEM_BOOT_REASON_UNKNOWN_BOOT | Unknown software cold boot.
|
M2MB_SYSTEM_BOOT_REASON_SIZE_ENUM | |
Definition at line 64 of file m2mb_system_reset.h.
◆ m2mb_get_boot_reason()
Boot reason.
This API gives the boot reason.
- Parameters
-
[out] | reason | Pointer to the store the boot reason. |
- Returns
- M2MB_OK if the boot reason could be found successful. M2MB_ERROR if the boot reason could not be found.
- Note
To find the boot reason and do the rest of the processing based on this.
◆ m2mb_get_exception_info()
To get the details on exception.
This API gives the reason of exception and the register detail when exception happened.
- Parameters
-
[out] | excptionInfo | Pointer to the store the boot reason. |
- Returns
- M2MB_OK if the exception details could be found successful. M2MB_ERROR if the exception details could not be found.
- Note
To find the details on exception reason for debugging purpose.
{
for( i = 0; i < 16; i++ )
}
◆ m2mb_system_reset()
System Reset API.
Resets the system.
- Returns
- None
- Note
- Once this API is called the system gets reseted, so the call does not return back to the caller. Can be used for ASSERTING the system
UINT8* pBuf = malloc(size);
◆ m2mb_wdog_disable()
To disable watchdog.
This API disables the watchdog.
- Note
- By default, watchdog is enabled and fires in 10sec. To disable the watchdog this API can be called.
VOID m2mb_wdog_disable( VOID );
◆ m2mb_wdog_enable()
To enable watchdog.
This API enables the watchdog.
- Note
- By default watchdog is enabled and fires in 10sec. The watchdog is kicked internally by the system. If a thread executes for more than 10sec without reliquencing the CPU control watchdog will fire and system would reset.
VOID m2mb_wdog_enable( VOID );
◆ m2mb_wdog_is_enable()
To find whether the watchdog is enabled or not.
This API finds out if the watchdog is enabled or not.
- Returns
- 1 if the watchdog is enabled. 0 if the watchdog is disabled.
- Note
UINT32 m2mb_wdog_is_enable( VOID );
◆ m2mb_wdog_kick()
To reset the watchdog.
This API resets the watchdog timer and start again.
- Note
- By default, watchdog is enabled and fires in 10sec. The watchdog is kicked internally by the system. If a thread executes for more than 10sec without reliquencing the CPU control watchdog will fire and system would reset.
m2mb_wdog_kick( VOID );