summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2008-12-30 23:53:35 +0000
committerBjörn Stenberg <bjorn@haxx.se>2008-12-30 23:53:35 +0000
commit5d3a035cb3714028a659ecd8abbad034666b7b3c (patch)
tree0046652c99529f7825a7e5b54d8b96a1b0ba6cb7
parentf59724414bd241509d8f6950fa4b5465a3f26c8e (diff)
Implemented system_reboot().
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19617 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/export/as3525.h6
-rw-r--r--firmware/target/arm/as3525/system-as3525.c5
2 files changed, 11 insertions, 0 deletions
diff --git a/firmware/export/as3525.h b/firmware/export/as3525.h
index f2f16c8d23..50b1fbe06b 100644
--- a/firmware/export/as3525.h
+++ b/firmware/export/as3525.h
@@ -303,6 +303,12 @@ interface */
#define TIMER_PRESCALE_16 0x04
#define TIMER_PRESCALE_256 0x08
+
+/* Watchdog registers */
+#define WDT_LOAD (*(volatile unsigned long*)(WDT_BASE))
+#define WDT_CONTROL (*(volatile unsigned long*)(WDT_BASE+8))
+
+
/* GPIO registers */
#define GPIOA_DIR (*(volatile unsigned char*)(GPIOA_BASE+0x400))
diff --git a/firmware/target/arm/as3525/system-as3525.c b/firmware/target/arm/as3525/system-as3525.c
index f2f2c0b454..b502b22425 100644
--- a/firmware/target/arm/as3525/system-as3525.c
+++ b/firmware/target/arm/as3525/system-as3525.c
@@ -272,6 +272,11 @@ void system_init(void)
void system_reboot(void)
{
+ /* use watchdog to reset */
+ CGU_PERI |= (CGU_WDOCNT_CLOCK_ENABLE | CGU_WDOIF_CLOCK_ENABLE);
+ WDT_LOAD = 1; /* set counter to 1 */
+ WDT_CONTROL = 3; /* enable watchdog counter & reset */
+ while(1);
}
int system_memory_guard(int newmode)