diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2009-01-08 10:15:32 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2009-01-08 10:15:32 +0000 |
commit | 4ed78f5c72649002d78d48d9a117826a5d9c36f9 (patch) | |
tree | 7ebe8ac19acabd74117a638da8dbb0c1cedf2600 /firmware/target/sh | |
parent | 32d9752dcc73fd1aaa81d484c3d426ca7856b146 (diff) | |
download | rockbox-4ed78f5c72649002d78d48d9a117826a5d9c36f9.tar.gz 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.c | 74 |
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 */ | |||
283 | void UIE (unsigned int pc) __attribute__((section(".text"))); | 283 | void UIE (unsigned int pc) __attribute__((section(".text"))); |
284 | void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */ | 284 | void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */ |
285 | { | 285 | { |
286 | #if CONFIG_LED == LED_REAL | ||
287 | bool state = false; | ||
288 | int i = 0; | ||
289 | #endif | ||
290 | unsigned int n; | 286 | unsigned int n; |
291 | char str[32]; | 287 | char str[32]; |
292 | 288 | ||
@@ -305,35 +301,13 @@ void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */ | |||
305 | lcd_puts(0,1,str); | 301 | lcd_puts(0,1,str); |
306 | lcd_update (); | 302 | lcd_update (); |
307 | 303 | ||
308 | while (1) | 304 | /* try to restart firmware if ON is pressed */ |
309 | { | 305 | system_exception_wait(); |
310 | #if CONFIG_LED == LED_REAL | ||
311 | if (--i <= 0) | ||
312 | { | ||
313 | state = !state; | ||
314 | led(state); | ||
315 | i = 240000; | ||
316 | } | ||
317 | #endif | ||
318 | 306 | ||
319 | /* try to restart firmware if ON is pressed */ | 307 | /* enable the watchguard timer, but don't service it */ |
320 | #if CONFIG_KEYPAD == PLAYER_PAD | 308 | RSTCSR_W = 0x5a40; /* Reset enabled, power-on reset */ |
321 | if (!(PADRL & 0x20)) | 309 | TCSR_W = 0xa560; /* Watchdog timer mode, timer enabled, sysclk/2 */ |
322 | #elif CONFIG_KEYPAD == RECORDER_PAD | 310 | while (1); |
323 | #ifdef HAVE_FMADC | ||
324 | if (!(PCDR & 0x0008)) | ||
325 | #else | ||
326 | if (!(PBDRH & 0x01)) | ||
327 | #endif | ||
328 | #elif CONFIG_KEYPAD == ONDIO_PAD | ||
329 | if (!(PCDR & 0x0008)) | ||
330 | #endif | ||
331 | { | ||
332 | /* enable the watchguard timer, but don't service it */ | ||
333 | RSTCSR_W = 0x5a40; /* Reset enabled, power-on reset */ | ||
334 | TCSR_W = 0xa560; /* Watchdog timer mode, timer enabled, sysclk/2 */ | ||
335 | } | ||
336 | } | ||
337 | } | 311 | } |
338 | 312 | ||
339 | void system_init(void) | 313 | void system_init(void) |
@@ -378,6 +352,42 @@ void system_reboot (void) | |||
378 | "r"(*(int*)0),"r"(4)); | 352 | "r"(*(int*)0),"r"(4)); |
379 | } | 353 | } |
380 | 354 | ||
355 | void system_exception_wait(void) | ||
356 | { | ||
357 | #if (CONFIG_LED == LED_REAL) | ||
358 | bool state = false; | ||
359 | int i = 0; | ||
360 | #endif | ||
361 | |||
362 | while (1) | ||
363 | { | ||
364 | #if (CONFIG_LED == LED_REAL) | ||
365 | if (--i <= 0) | ||
366 | { | ||
367 | state = !state; | ||
368 | led(state); | ||
369 | i = 240000; | ||
370 | } | ||
371 | #endif | ||
372 | |||
373 | #if CONFIG_KEYPAD == PLAYER_PAD | ||
374 | /* Player */ | ||
375 | if (!(PADRL & 0x20)) | ||
376 | #elif CONFIG_KEYPAD == RECORDER_PAD | ||
377 | /* Recorder */ | ||
378 | #ifdef HAVE_FMADC | ||
379 | if (!(PCDR & 0x0008)) | ||
380 | #else | ||
381 | if (!(PBDRH & 0x01)) | ||
382 | #endif | ||
383 | #elif CONFIG_KEYPAD == ONDIO_PAD | ||
384 | /* Ondio */ | ||
385 | if (!(PCDR & 0x0008)) | ||
386 | #endif /* CONFIG_KEYPAD */ | ||
387 | return; | ||
388 | } | ||
389 | } | ||
390 | |||
381 | /* Utilise the user break controller to catch invalid memory accesses. */ | 391 | /* Utilise the user break controller to catch invalid memory accesses. */ |
382 | int system_memory_guard(int newmode) | 392 | int system_memory_guard(int newmode) |
383 | { | 393 | { |