summaryrefslogtreecommitdiffstats
path: root/firmware/panic.c
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/panic.c
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/panic.c')
-rw-r--r--firmware/panic.c72
1 files changed, 11 insertions, 61 deletions
diff --git a/firmware/panic.c b/firmware/panic.c
index 8fcdd24188..0223dc1494 100644
--- a/firmware/panic.c
+++ b/firmware/panic.c
@@ -32,6 +32,7 @@
#include "system.h"
static char panic_buf[128];
+#define LINECHARS (LCD_WIDTH/SYSFONT_WIDTH)
/*
* "Dude. This is pretty fucked-up, right here."
@@ -41,17 +42,12 @@ void panicf( const char *fmt, ...)
va_list ap;
#ifndef SIMULATOR
-#if (CONFIG_LED == LED_REAL)
- bool state = false;
- int i = 0;
-#endif
-
/* Disable interrupts */
#ifdef CPU_ARM
- disable_fiq();
-#endif
-
+ disable_interrupt(IRQ_FIQ_STATUS);
+#else
set_irq_level(DISABLE_INTERRUPTS);
+#endif
#endif /* SIMULATOR */
va_start( ap, fmt );
@@ -69,12 +65,11 @@ void panicf( const char *fmt, ...)
{
/* wrap panic line */
int i, y=1, len = strlen(panic_buf);
-#define STEP (LCD_WIDTH/SYSFONT_WIDTH)
- for (i=0; i<len; i+=STEP) {
- unsigned char c = panic_buf[i+STEP];
- panic_buf[i+STEP] = 0;
+ for (i=0; i<len; i+=LINECHARS) {
+ unsigned char c = panic_buf[i+LINECHARS];
+ panic_buf[i+LINECHARS] = 0;
lcd_puts(0, y++, (unsigned char *)panic_buf+i);
- panic_buf[i+STEP] = c;
+ panic_buf[i+LINECHARS] = c;
}
}
#else
@@ -89,52 +84,7 @@ void panicf( const char *fmt, ...)
ide_power_enable(false);
#endif
- while (1)
- {
-#ifndef SIMULATOR
-#if (CONFIG_LED == LED_REAL)
- if (--i <= 0)
- {
- state = !state;
- led(state);
- i = 240000;
- }
-#endif
-
- /* try to restart firmware if ON is pressed */
-#if defined (CPU_PP)
- /* For now, just sleep the core */
- sleep_core(CURRENT_CORE);
- #define system_reboot() nop
-#elif defined (TOSHIBA_GIGABEAT_F)
- if ((GPGDAT & (1 << 0)) != 0)
-#elif defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
- if ((GPIO1_READ & 0x22) == 0) /* check for ON button and !hold */
-#elif defined(IAUDIO_X5) || defined(IAUDIO_M5)
- if ((GPIO_READ & 0x0c000000) == 0x08000000) /* check for ON button and !hold */
-#elif defined(IAUDIO_M3)
- if ((GPIO1_READ & 0x202) == 0x200) /* check for ON button and !hold */
-#elif defined(COWON_D2)
- if (GPIOA & 0x10) /* check for power button */
-#elif CONFIG_CPU == SH7034
-#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 /* CONFIG_KEYPAD */
-#elif defined(CREATIVE_ZVx)
- if(false)
-#elif defined(ONDA_VX747)
- /* check for power button without including any .h file */
- if( (~(*(volatile unsigned int *)(0xB0010300))) & (1 << 29) )
-#endif /* CPU */
- system_reboot();
-#endif /* !SIMULATOR */
- }
+ system_exception_wait(); /* if this returns, try to reboot */
+ system_reboot();
+ while (1); /* halt */
}