diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-11-12 09:04:06 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-11-12 09:04:06 +0000 |
commit | 42510d9e783f72a4945019bdcec19b9b60156aa1 (patch) | |
tree | eeb516381492d5a5e5cda64b7db5f5b122100825 | |
parent | bca1f64d136a6f34618aba60417870acccd8b483 (diff) | |
download | rockbox-42510d9e783f72a4945019bdcec19b9b60156aa1.tar.gz rockbox-42510d9e783f72a4945019bdcec19b9b60156aa1.zip |
Added '*PANIC*' string. Line is now wrapped on recorders. LED blinks slowly to indicate controlled state.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2835 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/panic.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/firmware/panic.c b/firmware/panic.c index 3dd5e157bf..df8afdfda3 100644 --- a/firmware/panic.c +++ b/firmware/panic.c | |||
@@ -19,10 +19,12 @@ | |||
19 | 19 | ||
20 | #include <stdio.h> | 20 | #include <stdio.h> |
21 | #include <stdarg.h> | 21 | #include <stdarg.h> |
22 | #include <string.h> | ||
22 | #include "panic.h" | 23 | #include "panic.h" |
23 | #include "lcd.h" | 24 | #include "lcd.h" |
24 | #include "font.h" | 25 | #include "font.h" |
25 | #include "debug.h" | 26 | #include "debug.h" |
27 | #include "led.h" | ||
26 | 28 | ||
27 | static char panic_buf[128]; | 29 | static char panic_buf[128]; |
28 | 30 | ||
@@ -34,6 +36,8 @@ void panicf( char *fmt, ...) | |||
34 | va_list ap; | 36 | va_list ap; |
35 | 37 | ||
36 | #ifndef SIMULATOR | 38 | #ifndef SIMULATOR |
39 | bool state = false; | ||
40 | |||
37 | /* Disable interrupts */ | 41 | /* Disable interrupts */ |
38 | asm volatile ("ldc\t%0,sr" : : "r"(15<<4)); | 42 | asm volatile ("ldc\t%0,sr" : : "r"(15<<4)); |
39 | #endif | 43 | #endif |
@@ -44,17 +48,36 @@ void panicf( char *fmt, ...) | |||
44 | 48 | ||
45 | #ifdef HAVE_LCD_CHARCELLS | 49 | #ifdef HAVE_LCD_CHARCELLS |
46 | lcd_double_height(false); | 50 | lcd_double_height(false); |
47 | lcd_puts(0,0,panic_buf); | 51 | lcd_puts(0,0,"*PANIC*"); |
52 | lcd_puts(0,1,panic_buf); | ||
48 | #elif defined(HAVE_LCD_BITMAP) | 53 | #elif defined(HAVE_LCD_BITMAP) |
49 | lcd_clear_display(); | 54 | lcd_clear_display(); |
50 | |||
51 | lcd_setfont(FONT_SYSFIXED); | 55 | lcd_setfont(FONT_SYSFIXED); |
52 | lcd_putsxy(0,0,panic_buf); | 56 | lcd_puts(0,0,"*PANIC*"); |
57 | { | ||
58 | /* wrap panic line */ | ||
59 | int i, y=1, len = strlen(panic_buf); | ||
60 | for (i=0; i<len; i+=18) { | ||
61 | unsigned char c = panic_buf[i+18]; | ||
62 | panic_buf[i+18] = 0; | ||
63 | lcd_puts(0,y++,panic_buf+i); | ||
64 | panic_buf[i+18] = c; | ||
65 | } | ||
66 | } | ||
53 | lcd_update(); | 67 | lcd_update(); |
54 | 68 | ||
55 | #else | 69 | #else |
56 | /* no LCD */ | 70 | /* no LCD */ |
57 | #endif | 71 | #endif |
58 | DEBUGF(panic_buf); | 72 | DEBUGF(panic_buf); |
59 | while(1); | 73 | while (1) |
74 | { | ||
75 | #ifndef SIMULATOR | ||
76 | volatile int i; | ||
77 | led (state); | ||
78 | state = state?false:true; | ||
79 | |||
80 | for (i = 0; i < 400000; ++i); | ||
81 | #endif | ||
82 | } | ||
60 | } | 83 | } |