summaryrefslogtreecommitdiffstats
path: root/firmware/target/sh
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2009-01-08 10:15:32 +0000
committerMichael Sevakis <jethead71@rockbox.org>2009-01-08 10:15:32 +0000
commit4ed78f5c72649002d78d48d9a117826a5d9c36f9 (patch)
tree7ebe8ac19acabd74117a638da8dbb0c1cedf2600 /firmware/target/sh
parent32d9752dcc73fd1aaa81d484c3d426ca7856b146 (diff)
downloadrockbox-4ed78f5c72649002d78d48d9a117826a5d9c36f9.tar.gz
rockbox-4ed78f5c72649002d78d48d9a117826a5d9c36f9.tar.bz2
rockbox-4ed78f5c72649002d78d48d9a117826a5d9c36f9.zip
Clean up panicf and introduce system_exception_wait to do further target tasks and wait for a button when an unrecoverable error has occurred (panic, UIE, etc.). Returning from that function should reboot or don't return from it. Move UIE and __div0 for ARM to its own file.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19716 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/sh')
-rw-r--r--firmware/target/sh/system-sh.c74
1 files changed, 42 insertions, 32 deletions
diff --git a/firmware/target/sh/system-sh.c b/firmware/target/sh/system-sh.c
index 63703ab786..02af40282f 100644
--- a/firmware/target/sh/system-sh.c
+++ b/firmware/target/sh/system-sh.c
@@ -283,10 +283,6 @@ extern void UIE4(void); /* needed for calculating the UIE number */
void UIE (unsigned int pc) __attribute__((section(".text")));
void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */
{
-#if CONFIG_LED == LED_REAL
- bool state = false;
- int i = 0;
-#endif
unsigned int n;
char str[32];
@@ -305,35 +301,13 @@ void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */
lcd_puts(0,1,str);
lcd_update ();
- while (1)
- {
-#if CONFIG_LED == LED_REAL
- if (--i <= 0)
- {
- state = !state;
- led(state);
- i = 240000;
- }
-#endif
+ /* try to restart firmware if ON is pressed */
+ system_exception_wait();
- /* try to restart firmware if ON is pressed */
-#if CONFIG_KEYPAD == PLAYER_PAD
- if (!(PADRL & 0x20))
-#elif CONFIG_KEYPAD == RECORDER_PAD
-#ifdef HAVE_FMADC
- if (!(PCDR & 0x0008))
-#else
- if (!(PBDRH & 0x01))
-#endif
-#elif CONFIG_KEYPAD == ONDIO_PAD
- if (!(PCDR & 0x0008))
-#endif
- {
- /* enable the watchguard timer, but don't service it */
- RSTCSR_W = 0x5a40; /* Reset enabled, power-on reset */
- TCSR_W = 0xa560; /* Watchdog timer mode, timer enabled, sysclk/2 */
- }
- }
+ /* enable the watchguard timer, but don't service it */
+ RSTCSR_W = 0x5a40; /* Reset enabled, power-on reset */
+ TCSR_W = 0xa560; /* Watchdog timer mode, timer enabled, sysclk/2 */
+ while (1);
}
void system_init(void)
@@ -378,6 +352,42 @@ void system_reboot (void)
"r"(*(int*)0),"r"(4));
}
+void system_exception_wait(void)
+{
+#if (CONFIG_LED == LED_REAL)
+ bool state = false;
+ int i = 0;
+#endif
+
+ while (1)
+ {
+#if (CONFIG_LED == LED_REAL)
+ if (--i <= 0)
+ {
+ state = !state;
+ led(state);
+ i = 240000;
+ }
+#endif
+
+#if CONFIG_KEYPAD == PLAYER_PAD
+ /* Player */
+ if (!(PADRL & 0x20))
+#elif CONFIG_KEYPAD == RECORDER_PAD
+ /* Recorder */
+#ifdef HAVE_FMADC
+ if (!(PCDR & 0x0008))
+#else
+ if (!(PBDRH & 0x01))
+#endif
+#elif CONFIG_KEYPAD == ONDIO_PAD
+ /* Ondio */
+ if (!(PCDR & 0x0008))
+#endif /* CONFIG_KEYPAD */
+ return;
+ }
+}
+
/* Utilise the user break controller to catch invalid memory accesses. */
int system_memory_guard(int newmode)
{