aboutsummaryrefslogtreecommitdiffstats
path: root/src/sam3/main.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-12-30 11:43:46 -0500
committerKevin O'Connor <kevin@koconnor.net>2019-01-07 19:34:31 -0500
commit8e0eb0d57473e85570dd99f4ebbcf5d6f290d455 (patch)
tree994eaf87a0105a6c3461c35893aad9a02138d807 /src/sam3/main.c
parent02c558652f4f5a34655635d56e581ae03d9f42b7 (diff)
downloadkutter-8e0eb0d57473e85570dd99f4ebbcf5d6f290d455.tar.gz
kutter-8e0eb0d57473e85570dd99f4ebbcf5d6f290d455.tar.xz
kutter-8e0eb0d57473e85570dd99f4ebbcf5d6f290d455.zip
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>
Diffstat (limited to 'src/sam3/main.c')
-rw-r--r--src/sam3/main.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/sam3/main.c b/src/sam3/main.c
index 68949ce7..1b9375db 100644
--- a/src/sam3/main.c
+++ b/src/sam3/main.c
@@ -4,6 +4,7 @@
//
// 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 "internal.h" // WDT
#include "sched.h" // sched_main
@@ -58,7 +59,11 @@ enable_pclock(uint32_t id)
void
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");