diff options
Diffstat (limited to 'firmware/target/mips/ingenic_jz47xx')
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/system-jz4740.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/system-jz4740.c b/firmware/target/mips/ingenic_jz47xx/system-jz4740.c index d676d20be6..a95a99cfc9 100644 --- a/firmware/target/mips/ingenic_jz47xx/system-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/system-jz4740.c | |||
@@ -27,6 +27,13 @@ | |||
27 | #include "system.h" | 27 | #include "system.h" |
28 | #include "kernel.h" | 28 | #include "kernel.h" |
29 | 29 | ||
30 | #define EXTENDED_EXCEPTION_DESC 0 | ||
31 | #if EXTENDED_EXCEPTION_DESC | ||
32 | #include "font.h" | ||
33 | #include "lcd.h" | ||
34 | #include "sprintf.h" | ||
35 | #endif | ||
36 | |||
30 | #define NUM_DMA 6 | 37 | #define NUM_DMA 6 |
31 | #define NUM_GPIO 128 | 38 | #define NUM_GPIO 128 |
32 | #define IRQ_MAX (IRQ_GPIO_0 + NUM_GPIO) | 39 | #define IRQ_MAX (IRQ_GPIO_0 + NUM_GPIO) |
@@ -243,7 +250,35 @@ static char* parse_exception(unsigned int cause) | |||
243 | 250 | ||
244 | void exception_handler(void* stack_ptr, unsigned int cause, unsigned int epc) | 251 | void exception_handler(void* stack_ptr, unsigned int cause, unsigned int epc) |
245 | { | 252 | { |
253 | #if EXTENDED_EXCEPTION_DESC | ||
254 | (void)epc; | ||
255 | |||
256 | /* Depends on crt0.S ! */ | ||
257 | char buffer[LCD_WIDTH/SYSFONT_WIDTH]; | ||
258 | char *registers[] = { "ra", "fp", "gp", "t9", "t8", "s7", "s6", "s5", "s4", | ||
259 | "s3", "s2", "s1", "s0", "t7", "t6", "t5", "t4", "t3", | ||
260 | "t2", "t1", "t0", "a3", "a2", "a1", "a0", "v1", "v0", | ||
261 | "$1", "LO", "HI", "STATUS", "EPC" }; | ||
262 | int i; | ||
263 | |||
264 | lcd_clear_display(); | ||
265 | lcd_setfont(FONT_SYSFIXED); | ||
266 | |||
267 | snprintf(buffer, sizeof(buffer), "0x%08x at 0x%08x", read_c0_badvaddr(), epc); | ||
268 | lcd_puts(0, 0, parse_exception(cause)); | ||
269 | lcd_puts(0, 1, buffer); | ||
270 | for(i=0; i< 0x80/4; i+=2) | ||
271 | { | ||
272 | unsigned int* ptr = (unsigned int*)(stack_ptr + i*4); | ||
273 | snprintf(buffer, sizeof(buffer), "%s: 0x%08x %s: 0x%08x", registers[i], *ptr, registers[i+1], *(ptr+1)); | ||
274 | lcd_puts(0, 3 + i/2, buffer); | ||
275 | } | ||
276 | lcd_update(); | ||
277 | |||
278 | system_exception_wait(); | ||
279 | #else | ||
246 | panicf("Exception occurred: %s [0x%08x] at 0x%08x (stack at 0x%08x)", parse_exception(cause), read_c0_badvaddr(), epc, (unsigned int)stack_ptr); | 280 | panicf("Exception occurred: %s [0x%08x] at 0x%08x (stack at 0x%08x)", parse_exception(cause), read_c0_badvaddr(), epc, (unsigned int)stack_ptr); |
281 | #endif | ||
247 | } | 282 | } |
248 | 283 | ||
249 | void tlb_refill_handler(void) | 284 | void tlb_refill_handler(void) |
@@ -507,7 +542,7 @@ void system_exception_wait(void) | |||
507 | /* check for power button without including any .h file */ | 542 | /* check for power button without including any .h file */ |
508 | while (1) | 543 | while (1) |
509 | { | 544 | { |
510 | if( (~(*(volatile unsigned int *)(0xB0010300))) & (1 << 29) ) | 545 | if( ~REG_GPIO_PXPIN(3) & (1 << 29) ) |
511 | break; | 546 | break; |
512 | } | 547 | } |
513 | } | 548 | } |