s5pc110: font: bug fix and code clean.
authordaeinki <inki.dae@samsung.com>
Tue, 15 Sep 2009 02:39:41 +0000 (11:39 +0900)
committerdaeinki <inki.dae@samsung.com>
Tue, 15 Sep 2009 02:39:41 +0000 (11:39 +0900)
Signed-off-by: daeinki <inki.dae@samsung.com>
drivers/video/fbutils.c
drivers/video/fbutils.h [moved from drivers/video/font.h with 94% similarity]
drivers/video/font_8x16.c
drivers/video/font_8x8.c
drivers/video/s5p-fb.c

index 2e04630..99a6a9c 100644 (file)
 #include <common.h>
 #include <version.h>
 #include <stdarg.h>
+#include <malloc.h>
 #include <linux/types.h>
 #include <asm/io.h>
 #include <lcd.h>
 #include <asm/global_data.h>
 
-#include "font.h"
+#include "fbutils.h"
 
-#define XORMODE                        0x800000000
+#define XORMODE                        0x80000000
 #define CARRIAGE_RETURN                10
 
 extern struct fbcon_font_desc font_vga_8x16;
@@ -46,15 +47,15 @@ static int bytes_per_pixel;
 static unsigned char **line_addr;
 
 static unsigned int g_default_x, g_default_y;
-static unsigned char color_index;
+static unsigned int color_index;
 
 static unsigned colormap [256];
 extern vidinfo_t panel_info;
 static gd_t *g_gd;
 
-static char red_length = 8, red_offset = 0;
+static char red_length = 8, red_offset = 16;
 static char green_length = 8, green_offset = 8;
-static char blue_length = 8, blue_offset = 16;
+static char blue_length = 8, blue_offset = 0;
 
 static unsigned int color_table_8[MAX_INDEX_TABLE] ={
        0x000000,       /* BLACK */
@@ -65,7 +66,7 @@ static unsigned int color_table_8[MAX_INDEX_TABLE] ={
        0xff00ff,       /* MAGENTA */
        0x00ffff,       /* AQUA */
        0xffffff,       /* WHITE */
-       0x800000000     /* XORMODE */
+       0x80000000      /* XORMODE */
 };
 
 static unsigned int g_x, g_y;
@@ -155,15 +156,15 @@ static inline void __setpixel (union multiptr loc, unsigned xormode, unsigned co
 
 static void pixel(int x, int y)
 {
-       unsigned xormode;
+       unsigned int xormode;
        union multiptr loc;
 
        if ((x < 0) || ((__u32)x >= panel_info.vl_width) ||
            (y < 0) || ((__u32)y >= panel_info.vl_height))
                return;
 
-       xormode = color_index & XORMODE;
-       color_index &= ~XORMODE;
+       xormode = (unsigned int)(color_index & XORMODE);
+       color_index &= (unsigned int)~XORMODE;
 
        loc.p8 = line_addr [y] + x * bytes_per_pixel;
        __setpixel (loc, xormode, colormap[color_index]);
@@ -181,9 +182,10 @@ static void put_char(int c)
 
        for (i = 0; i < font_vga_8x16.height; i++) {
                bits = font_vga_8x16.data [font_vga_8x16.height * c + i];
-               for (j = 0; j < font_vga_8x16.width; j++, bits <<= 1)
-                       if (bits & 0x80)
-                               pixel (g_x + j, g_y + i);
+               for (j = 0; j < font_vga_8x16.width; j++, bits <<= 1) {
+                               if (bits & 0x80)
+                                       pixel (g_x + j, g_y + i);
+               }
        }
 }
 
@@ -205,11 +207,20 @@ void init_font(void)
 
        g_gd = (gd_t *)(_armboot_start - CONFIG_SYS_MALLOC_LEN - sizeof(gd_t));
 
-       line_addr = malloc(sizeof(__u32) * panel_info.vl_height);
+       line_addr = (unsigned char **)malloc(sizeof(__u32) * panel_info.vl_height);
 
        for (y = 0; y < panel_info.vl_height; y++, addr += line_length) {
-               line_addr[y] = g_gd->fb_base + addr;
+               line_addr[y] = (unsigned char *)(g_gd->fb_base + addr);
        }
 
        make_color_table();
 }
+
+void exit_font(void)
+{
+       if (line_addr)
+               free(line_addr);
+
+       g_default_x = g_default_y = 0;
+       g_x = g_y = 0;
+}
similarity index 94%
rename from drivers/video/font.h
rename to drivers/video/fbutils.h
index 83ca044..ba12364 100644 (file)
@@ -42,14 +42,12 @@ enum {
 /* max index color count */
 #define MAX_INDEX_TABLE                (8 + 1)
 
-#define XORMODE 0x800000000
-
-#define X_IVAL 8
-#define Y_IVAL 12
-
 /* initialize font module and then create color table. */
 void init_font(void);
 
+/* exit font module. */
+void exit_font(void);
+
 /* set font color */
 void set_font_color(unsigned char index);
 
index 26a34bc..1433123 100644 (file)
@@ -4,7 +4,7 @@
 /*                                            */
 /**********************************************/
 
-#include "font.h"
+#include "fbutils.h"
 
 #define FONTDATAMAX 4096
 
index ff0701a..d6846ca 100644 (file)
@@ -4,7 +4,7 @@
 /*                                            */
 /**********************************************/
 
-#include "font.h"
+#include "fbutils.h"
 
 #define FONTDATAMAX 2048
 
index 05ffad0..da9b5b5 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "s5p-fb.h"
 #include "opening_wvga_32.h"
-#include "font.h"
+#include "fbutils.h"
 //#include "logo_rgb24_wvga_portrait.h"
 //#include "opening_logo_rgb24_143_44.h"
 
@@ -233,7 +233,9 @@ void lcd_ctrl_init(void *lcdbase)
        fb_printf("Framebuffer initialization is completed.\n");
 
        set_font_color(FONT_WHITE);
-       fb_printf("Kernel/BSP");
+       fb_printf("Kernel/BSP.");
+
+       exit_font();
 }
 
 void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blud)