diff options
Diffstat (limited to 'firmware/panic.c')
-rw-r--r-- | firmware/panic.c | 72 |
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 @@ | |||
32 | #include "system.h" | 32 | #include "system.h" |
33 | 33 | ||
34 | static char panic_buf[128]; | 34 | static char panic_buf[128]; |
35 | #define LINECHARS (LCD_WIDTH/SYSFONT_WIDTH) | ||
35 | 36 | ||
36 | /* | 37 | /* |
37 | * "Dude. This is pretty fucked-up, right here." | 38 | * "Dude. This is pretty fucked-up, right here." |
@@ -41,17 +42,12 @@ void panicf( const char *fmt, ...) | |||
41 | va_list ap; | 42 | va_list ap; |
42 | 43 | ||
43 | #ifndef SIMULATOR | 44 | #ifndef SIMULATOR |
44 | #if (CONFIG_LED == LED_REAL) | ||
45 | bool state = false; | ||
46 | int i = 0; | ||
47 | #endif | ||
48 | |||
49 | /* Disable interrupts */ | 45 | /* Disable interrupts */ |
50 | #ifdef CPU_ARM | 46 | #ifdef CPU_ARM |
51 | disable_fiq(); | 47 | disable_interrupt(IRQ_FIQ_STATUS); |
52 | #endif | 48 | #else |
53 | |||
54 | set_irq_level(DISABLE_INTERRUPTS); | 49 | set_irq_level(DISABLE_INTERRUPTS); |
50 | #endif | ||
55 | #endif /* SIMULATOR */ | 51 | #endif /* SIMULATOR */ |
56 | 52 | ||
57 | va_start( ap, fmt ); | 53 | va_start( ap, fmt ); |
@@ -69,12 +65,11 @@ void panicf( const char *fmt, ...) | |||
69 | { | 65 | { |
70 | /* wrap panic line */ | 66 | /* wrap panic line */ |
71 | int i, y=1, len = strlen(panic_buf); | 67 | int i, y=1, len = strlen(panic_buf); |
72 | #define STEP (LCD_WIDTH/SYSFONT_WIDTH) | 68 | for (i=0; i<len; i+=LINECHARS) { |
73 | for (i=0; i<len; i+=STEP) { | 69 | unsigned char c = panic_buf[i+LINECHARS]; |
74 | unsigned char c = panic_buf[i+STEP]; | 70 | panic_buf[i+LINECHARS] = 0; |
75 | panic_buf[i+STEP] = 0; | ||
76 | lcd_puts(0, y++, (unsigned char *)panic_buf+i); | 71 | lcd_puts(0, y++, (unsigned char *)panic_buf+i); |
77 | panic_buf[i+STEP] = c; | 72 | panic_buf[i+LINECHARS] = c; |
78 | } | 73 | } |
79 | } | 74 | } |
80 | #else | 75 | #else |
@@ -89,52 +84,7 @@ void panicf( const char *fmt, ...) | |||
89 | ide_power_enable(false); | 84 | ide_power_enable(false); |
90 | #endif | 85 | #endif |
91 | 86 | ||
92 | while (1) | 87 | system_exception_wait(); /* if this returns, try to reboot */ |
93 | { | 88 | system_reboot(); |
94 | #ifndef SIMULATOR | 89 | while (1); /* halt */ |
95 | #if (CONFIG_LED == LED_REAL) | ||
96 | if (--i <= 0) | ||
97 | { | ||
98 | state = !state; | ||
99 | led(state); | ||
100 | i = 240000; | ||
101 | } | ||
102 | #endif | ||
103 | |||
104 | /* try to restart firmware if ON is pressed */ | ||
105 | #if defined (CPU_PP) | ||
106 | /* For now, just sleep the core */ | ||
107 | sleep_core(CURRENT_CORE); | ||
108 | #define system_reboot() nop | ||
109 | #elif defined (TOSHIBA_GIGABEAT_F) | ||
110 | if ((GPGDAT & (1 << 0)) != 0) | ||
111 | #elif defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES) | ||
112 | if ((GPIO1_READ & 0x22) == 0) /* check for ON button and !hold */ | ||
113 | #elif defined(IAUDIO_X5) || defined(IAUDIO_M5) | ||
114 | if ((GPIO_READ & 0x0c000000) == 0x08000000) /* check for ON button and !hold */ | ||
115 | #elif defined(IAUDIO_M3) | ||
116 | if ((GPIO1_READ & 0x202) == 0x200) /* check for ON button and !hold */ | ||
117 | #elif defined(COWON_D2) | ||
118 | if (GPIOA & 0x10) /* check for power button */ | ||
119 | #elif CONFIG_CPU == SH7034 | ||
120 | #if CONFIG_KEYPAD == PLAYER_PAD | ||
121 | if (!(PADRL & 0x20)) | ||
122 | #elif CONFIG_KEYPAD == RECORDER_PAD | ||
123 | #ifdef HAVE_FMADC | ||
124 | if (!(PCDR & 0x0008)) | ||
125 | #else | ||
126 | if (!(PBDRH & 0x01)) | ||
127 | #endif | ||
128 | #elif CONFIG_KEYPAD == ONDIO_PAD | ||
129 | if (!(PCDR & 0x0008)) | ||
130 | #endif /* CONFIG_KEYPAD */ | ||
131 | #elif defined(CREATIVE_ZVx) | ||
132 | if(false) | ||
133 | #elif defined(ONDA_VX747) | ||
134 | /* check for power button without including any .h file */ | ||
135 | if( (~(*(volatile unsigned int *)(0xB0010300))) & (1 << 29) ) | ||
136 | #endif /* CPU */ | ||
137 | system_reboot(); | ||
138 | #endif /* !SIMULATOR */ | ||
139 | } | ||
140 | } | 90 | } |