From 4ed78f5c72649002d78d48d9a117826a5d9c36f9 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Thu, 8 Jan 2009 10:15:32 +0000 Subject: 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 --- firmware/target/coldfire/system-coldfire.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'firmware/target/coldfire/system-coldfire.c') diff --git a/firmware/target/coldfire/system-coldfire.c b/firmware/target/coldfire/system-coldfire.c index e04255746f..c4651a3c80 100644 --- a/firmware/target/coldfire/system-coldfire.c +++ b/firmware/target/coldfire/system-coldfire.c @@ -177,16 +177,11 @@ static void system_display_exception_info(unsigned long format, lcd_puts(0, 1, str); lcd_update(); - /* set cpu frequency to 11mhz (to prevent overheating) */ - DCR = (DCR & ~0x01ff) | 1; - PLLCR = EXCP_PLLCR; + system_exception_wait(); - while (1) - { - if ((EXCP_BUTTON_GPIO_READ & EXCP_BUTTON_MASK) == EXCP_BUTTON_VALUE) - SYPCR = 0xc0; - /* Start watchdog timer with 512 cycles timeout. Don't service it. */ - } + /* Start watchdog timer with 512 cycles timeout. Don't service it. */ + SYPCR = 0xc0; + while (1); /* We need a reset method that works in all cases. Calling system_reboot() doesn't work when we're called from the debug interrupt, because then @@ -294,6 +289,14 @@ void system_reboot (void) asm(" jmp (%a0)"); } +void system_exception_wait(void) +{ + /* set cpu frequency to 11mhz (to prevent overheating) */ + DCR = (DCR & ~0x01ff) | 1; + PLLCR = EXCP_PLLCR; + while ((EXCP_BUTTON_GPIO_READ & EXCP_BUTTON_MASK) != EXCP_BUTTON_VALUE); +} + /* Utilise the breakpoint hardware to catch invalid memory accesses. */ int system_memory_guard(int newmode) { -- cgit v1.2.3