mirror of
https://github.com/apache/nuttx.git
synced 2026-09-27 10:46:02 +08:00
boards/boardctl:common boardctl to read reset cause.
Signed-off-by: 田昕 <tianxin7@xiaomi.com>
This commit is contained in:
@@ -96,6 +96,10 @@
|
||||
# include <nuttx/irq.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BOARDCTL_RESET_CAUSE
|
||||
# include <sys/boardctl.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
*
|
||||
@@ -819,6 +823,20 @@ void board_crashdump(uintptr_t currentsp, FAR void *tcb,
|
||||
void board_init_rngseed(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_reset_cause
|
||||
*
|
||||
* Description:
|
||||
* This interface may be used by application specific logic to get the
|
||||
* cause of last reset. Support for this function is required by
|
||||
* board-level logic if CONFIG_BOARDCTL_RESET is selected.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BOARDCTL_RESET_CAUSE
|
||||
int board_reset_cause(FAR struct boardioc_reset_cause_s *cause);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+41
-1
@@ -180,6 +180,12 @@
|
||||
* 1=locked.
|
||||
* CONFIGURATION: CONFIG_BOARDCTL_TESTSET
|
||||
* DEPENDENCIES: Architecture-specific logic provides up_testset()
|
||||
*
|
||||
* CMD: BOARDIOC_RESET_CAUSE
|
||||
* DESCRIPTION: Get the cause of last-time board reset
|
||||
* ARG: A pointer to an instance of struct boardioc_reset_cause_s
|
||||
* CONFIGURATION: CONFIG_BOARDCTL_RESET_CAUSE
|
||||
* DEPENDENCIES: Board logic must provide the board_reset_cause() interface.
|
||||
*/
|
||||
|
||||
#define BOARDIOC_INIT _BOARDIOC(0x0001)
|
||||
@@ -202,6 +208,7 @@
|
||||
#define BOARDIOC_UNIQUEKEY _BOARDIOC(0x0012)
|
||||
#define BOARDIOC_SWITCH_BOOT _BOARDIOC(0x0013)
|
||||
#define BOARDIOC_BOOT_IMAGE _BOARDIOC(0x0014)
|
||||
#define BOARDIOC_RESET_CAUSE _BOARDIOC(0x0015)
|
||||
|
||||
/* If CONFIG_BOARDCTL_IOCTL=y, then board-specific commands will be support.
|
||||
* In this case, all commands not recognized by boardctl() will be forwarded
|
||||
@@ -210,7 +217,7 @@
|
||||
* User defined board commands may begin with this value:
|
||||
*/
|
||||
|
||||
#define BOARDIOC_USER _BOARDIOC(0x0015)
|
||||
#define BOARDIOC_USER _BOARDIOC(0x0016)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Type Definitions
|
||||
@@ -403,6 +410,39 @@ struct boardioc_boot_info_s
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BOARDCTL_RESET_CAUSE
|
||||
/* Describes the reason of last reset */
|
||||
|
||||
enum boardioc_reset_cause_e
|
||||
{
|
||||
BOARDIOC_RESETCAUSE_NONE = 0,
|
||||
BOARDIOC_RESETCAUSE_SYS_CHIPPOR, /* chip power on */
|
||||
BOARDIOC_RESETCAUSE_SYS_RWDT, /* RTC watchdog system reset */
|
||||
BOARDIOC_RESETCAUSE_SYS_BOR, /* brown-out system reset */
|
||||
BOARDIOC_RESETCAUSE_CORE_SOFT, /* software core reset */
|
||||
BOARDIOC_RESETCAUSE_CORE_DPSP, /* deep-sleep core reset */
|
||||
BOARDIOC_RESETCAUSE_CORE_MWDT, /* main watchdog core reset */
|
||||
BOARDIOC_RESETCAUSE_CORE_RWDT, /* RTC watchdog core reset */
|
||||
BOARDIOC_RESETCAUSE_CPU_MWDT, /* main watchdog cpu reset */
|
||||
BOARDIOC_RESETCAUSE_CPU_SOFT, /* software cpu reset */
|
||||
BOARDIOC_RESETCAUSE_CPU_RWDT /* RTC watchdog cpu reset */
|
||||
};
|
||||
|
||||
enum boardioc_softreset_subreason_e
|
||||
{
|
||||
BOARDIOC_SOFTRESETCAUSE_USER_REBOOT = 0,
|
||||
BOARDIOC_SOFTRESETCAUSE_PANIC,
|
||||
BOARDIOC_SOFTRESETCAUSE_ASSERT
|
||||
};
|
||||
|
||||
struct boardioc_reset_cause_s
|
||||
{
|
||||
enum boardioc_reset_cause_e cause; /* The reason of last reset */
|
||||
uint32_t flag; /* watchdog number when watchdog reset,
|
||||
* or soft-reset subreason */
|
||||
};
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user