ramoops: show messages on lcd
authorMinkyu Kang <mk7.kang@samsung.com>
Fri, 29 Oct 2010 11:37:51 +0000 (20:37 +0900)
committerMinkyu Kang <mk7.kang@samsung.com>
Fri, 29 Oct 2010 11:37:51 +0000 (20:37 +0900)
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
drivers/misc/ramoops.c
drivers/video/fbutils.c
include/fbutils.h

index 21d9dc5..8ac380b 100644 (file)
@@ -4,6 +4,9 @@
  */
 #include <common.h>
 #include <ramoops.h>
+#ifdef CONFIG_S5PC1XXFB
+#include <fbutils.h>
+#endif
 
 static char msg[RAMOOPS_SIZE];
 static int dumped;
@@ -11,16 +14,38 @@ static int dumped;
 static void ramoops_show(void)
 {
        int i;
+#ifdef CONFIG_S5PC1XXFB
+       unsigned int chars;
+#endif
 
        if (!dumped) {
                puts("No Messages\n");
                return;
        }
 
+#ifdef CONFIG_S5PC1XXFB
+       init_font();
+       fb_clear();
+       set_font_color(FONT_WHITE);
+       chars = get_chars();
+       printf("chars %d\n", chars);
+#endif
+
        printf("\n\n");
-       for (i = 0; i < RAMOOPS_SIZE; i++)
-               printf("%c", msg[i]);
+       for (i = 0; i < RAMOOPS_SIZE; i++) {
+               char s[1];
+               sprintf(s, "%c", msg[i]);
+               puts(s);
+#ifdef CONFIG_S5PC1XXFB
+               if (!s5p_no_lcd_support() && i > (RAMOOPS_SIZE - chars))
+                       fb_printf(s);
+#endif
+       }
        printf("\n\n");
+
+#ifdef CONFIG_S5PC1XXFB
+       exit_font();
+#endif
 }
 
 int ramoops_init(unsigned int base)
index dc7e9ae..92277fb 100644 (file)
@@ -314,3 +314,23 @@ void exit_font(void)
        g_default_x = g_default_y = 0;
        g_x = g_y = 0;
 }
+
+void fb_clear(void)
+{
+       int y;
+       int line_length = panel_info.vl_width * 4;
+
+       for (y = 0; y < panel_info.vl_height; y++)
+               memset(line_addr[y], 0x0, line_length);
+}
+
+unsigned int get_chars(void)
+{
+       int chars;
+       int lines;
+
+       chars = panel_info.vl_width / font_vga_8x16.width - 10;
+       lines = panel_info.vl_height  / (font_vga_8x16.height + 2);
+
+       return chars * lines;
+}
index 8d2c6b6..bf17360 100644 (file)
@@ -66,4 +66,9 @@ void draw_wheel(int x, int y, unsigned char color);
 /* draw progress */
 void draw_progress(int y, int per, unsigned char color);
 
+/* clear the framebuffer */
+void fb_clear(void);
+
+unsigned int get_chars(void);
+
 #endif /* _FONT_H */