forked from Imagelibrary/seL4
Reset SBC on kernel fault for AOS
This ensures the hardware reset is triggered when the kernel faults ensuring that the hardware is rebooted rather than causing the hardware to hang requiring a full power down (which can't currently be performed remotely) Signed-off-by: Curtis Millar <curtis@curtism.me>
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
#include <mode/machine.h>
|
||||
#include <api/debug.h>
|
||||
|
||||
void wdog_reset(void);
|
||||
|
||||
/** DONT_TRANSLATE */
|
||||
void NORETURN NO_INLINE VISIBLE halt(void)
|
||||
{
|
||||
@@ -20,6 +22,7 @@ void NORETURN NO_INLINE VISIBLE halt(void)
|
||||
debug_printKernelEntryReason();
|
||||
#endif
|
||||
#endif
|
||||
wdog_reset();
|
||||
idle_thread();
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
@@ -45,6 +45,14 @@ void init_serial(void)
|
||||
*(UART_REG(UART_MISC)) = 1;
|
||||
}
|
||||
|
||||
void wdog_reset(void)
|
||||
{
|
||||
printf("\nResetting Odroid-C2\n");
|
||||
volatile uint32_t *wdog = (volatile uint32_t *)(WDOG_PPTR);
|
||||
*wdog = (WDOG_EN | WDOG_SYS_RESET_EN | WDOG_CLK_EN |
|
||||
WDOG_CLK_DIV_EN | WDOG_SYS_RESET_NOW);
|
||||
}
|
||||
|
||||
void handleUartIRQ(void)
|
||||
{
|
||||
/* while there are chars to process */
|
||||
@@ -60,10 +68,7 @@ void handleUartIRQ(void)
|
||||
}
|
||||
if (index == strnlen(reset, 5)) {
|
||||
/* do the reset */
|
||||
printf("\nResetting Odroid-C2\n");
|
||||
volatile uint32_t *wdog = (volatile uint32_t *) (WDOG_PPTR);
|
||||
*wdog = (WDOG_EN | WDOG_SYS_RESET_EN | WDOG_CLK_EN |
|
||||
WDOG_CLK_DIV_EN | WDOG_SYS_RESET_NOW);
|
||||
wdog_reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user