]> git.sur5r.net Git - u-boot/blobdiff - common/lcd.c
Merge branch 'master' of git://www.denx.de/git/u-boot-mips
[u-boot] / common / lcd.c
index 7bf7a63fd7b99dcff0eb0a6fa4e0ff37ced4bf05..914dc2ef7ca5b1f30d1238317213e32650c9018d 100644 (file)
@@ -50,7 +50,6 @@
 #include <lcdvideo.h>
 #endif
 
-
 #ifdef CONFIG_LCD
 
 /************************************************************************/
@@ -68,6 +67,8 @@
 # endif
 #endif
 
+DECLARE_GLOBAL_DATA_PTR;
+
 ulong lcd_setmem (ulong addr);
 
 static void lcd_drawchars (ushort x, ushort y, uchar *str, int count);
@@ -279,9 +280,9 @@ static void lcd_drawchars (ushort x, ushort y, uchar *str, int count)
 static inline void lcd_puts_xy (ushort x, ushort y, uchar *s)
 {
 #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
-       lcd_drawchars (x, y+BMP_LOGO_HEIGHT, s, strlen (s));
+       lcd_drawchars (x, y+BMP_LOGO_HEIGHT, s, strlen ((char *)s));
 #else
-       lcd_drawchars (x, y, s, strlen (s));
+       lcd_drawchars (x, y, s, strlen ((char *)s));
 #endif
 }
 
@@ -339,8 +340,6 @@ static void test_pattern (void)
 
 int drv_lcd_init (void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-
        device_t lcddev;
        int rc;
 
@@ -526,7 +525,7 @@ void bitmap_plot (int x, int y)
                sizeof(bmp_logo_palette)/(sizeof(ushort)));
 
        bmap = &bmp_logo_bitmap[0];
-       fb   = (char *)(lcd_base + y * lcd_line_length + x);
+       fb   = (uchar *)(lcd_base + y * lcd_line_length + x);
 
        if (NBITS(panel_info.vl_bpix) < 12) {
                /* Leave room for default color map */
@@ -572,20 +571,23 @@ void bitmap_plot (int x, int y)
 #endif /* CONFIG_LCD_LOGO */
 
 /*----------------------------------------------------------------------*/
-#if (CONFIG_COMMANDS & CFG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN)
+#if defined(CONFIG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN)
 /*
  * Display the BMP file located at address bmp_image.
  * Only uncompressed.
  */
 int lcd_display_bitmap(ulong bmp_image, int x, int y)
 {
+#if !defined(CONFIG_MCC200)
        ushort *cmap;
+#endif
        ushort i, j;
        uchar *fb;
        bmp_image_t *bmp=(bmp_image_t *)bmp_image;
        uchar *bmap;
        ushort padded_line;
        unsigned long width, height;
+       unsigned long pwidth = panel_info.vl_col;
        unsigned colors,bpix;
        unsigned long compression;
 #if defined(CONFIG_PXA250)
@@ -624,6 +626,8 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
        debug ("Display-bmp: %d x %d  with %d colors\n",
                (int)width, (int)height, (int)colors);
 
+#if !defined(CONFIG_MCC200)
+       /* MCC200 LCD doesn't need CMAP, supports 1bpp b&w only */
        if (bpix==8) {
 #if defined(CONFIG_PXA250)
                cmap = (ushort *)fbi->palette;
@@ -652,10 +656,30 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 #endif
                }
        }
+#endif
+
+       /*
+        *  BMP format for Monochrome assumes that the state of a
+        * pixel is described on a per Bit basis, not per Byte.
+        *  So, in case of Monochrome BMP we should align widths
+        * on a byte boundary and convert them from Bit to Byte
+        * units.
+        *  Probably, PXA250 and MPC823 process 1bpp BMP images in
+        * their own ways, so make the converting to be MCC200
+        * specific.
+        */
+#if defined(CONFIG_MCC200)
+       if (bpix==1)
+       {
+               width = ((width + 7) & ~7) >> 3;
+               x     = ((x + 7) & ~7) >> 3;
+               pwidth= ((pwidth + 7) & ~7) >> 3;
+       }
+#endif
 
        padded_line = (width&0x3) ? ((width&~0x3)+4) : (width);
-       if ((x + width)>panel_info.vl_col)
-               width = panel_info.vl_col - x;
+       if ((x + width)>pwidth)
+               width = pwidth - x;
        if ((y + height)>panel_info.vl_row)
                height = panel_info.vl_row - y;
 
@@ -667,7 +691,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
                for (j = 0; j < width ; j++)
 #if defined(CONFIG_PXA250)
                        *(fb++)=*(bmap++);
-#elif defined(CONFIG_MPC823)
+#elif defined(CONFIG_MPC823) || defined(CONFIG_MCC200)
                        *(fb++)=255-*(bmap++);
 #endif
                bmap += (width - padded_line);
@@ -676,14 +700,12 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 
        return (0);
 }
-#endif /* (CONFIG_COMMANDS & CFG_CMD_BMP) || CONFIG_SPLASH_SCREEN */
+#endif
 
 
 static void *lcd_logo (void)
 {
 #ifdef CONFIG_LCD_INFO
-       DECLARE_GLOBAL_DATA_PTR;
-
        char info[80];
        char temp[32];
 #endif /* CONFIG_LCD_INFO */
@@ -710,15 +732,15 @@ static void *lcd_logo (void)
 #ifdef CONFIG_MPC823
 # ifdef CONFIG_LCD_INFO
        sprintf (info, "%s (%s - %s) ", U_BOOT_VERSION, __DATE__, __TIME__);
-       lcd_drawchars (LCD_INFO_X, LCD_INFO_Y, info, strlen(info));
+       lcd_drawchars (LCD_INFO_X, LCD_INFO_Y, (uchar *)info, strlen(info));
 
        sprintf (info, "(C) 2004 DENX Software Engineering");
        lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT,
-                                       info, strlen(info));
+                                       (uchar *)info, strlen(info));
 
        sprintf (info, "    Wolfgang DENK, wd@denx.de");
        lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 2,
-                                       info, strlen(info));
+                                       (uchar *)info, strlen(info));
 #  ifdef CONFIG_LCD_INFO_BELOW_LOGO
        sprintf (info, "MPC823 CPU at %s MHz",
                strmhz(temp, gd->cpu_clk));
@@ -737,7 +759,7 @@ static void *lcd_logo (void)
                gd->ram_size >> 20,
                gd->bd->bi_flashsize >> 20 );
        lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 4,
-                                       info, strlen(info));
+                                       (uchar *)info, strlen(info));
 
 #  endif /* CONFIG_LCD_INFO_BELOW_LOGO */
 # endif /* CONFIG_LCD_INFO */