sam3: Implement board reset via SAM RSTC hardware
Use the RSTC hardware block to perform a full reset on a "reset" command. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
02c558652f
commit
8e0eb0d574
@ -4,6 +4,7 @@
|
|||||||
//
|
//
|
||||||
// This file may be distributed under the terms of the GNU GPLv3 license.
|
// This file may be distributed under the terms of the GNU GPLv3 license.
|
||||||
|
|
||||||
|
#include "board/irq.h" // irq_disable
|
||||||
#include "command.h" // DECL_CONSTANT
|
#include "command.h" // DECL_CONSTANT
|
||||||
#include "internal.h" // WDT
|
#include "internal.h" // WDT
|
||||||
#include "sched.h" // sched_main
|
#include "sched.h" // sched_main
|
||||||
@ -58,7 +59,11 @@ enable_pclock(uint32_t id)
|
|||||||
void
|
void
|
||||||
command_reset(uint32_t *args)
|
command_reset(uint32_t *args)
|
||||||
{
|
{
|
||||||
NVIC_SystemReset();
|
irq_disable();
|
||||||
|
RSTC->RSTC_CR = ((0xA5 << RSTC_CR_KEY_Pos) | RSTC_CR_PROCRST
|
||||||
|
| RSTC_CR_PERRST);
|
||||||
|
for (;;)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
DECL_COMMAND_FLAGS(command_reset, HF_IN_SHUTDOWN, "reset");
|
DECL_COMMAND_FLAGS(command_reset, HF_IN_SHUTDOWN, "reset");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user