X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=common%2Flcd.c;h=4b3d7dcd34b82bf6c0dce9409b557723372c854a;hb=d1fc0a31b5f307c92b7a047d4f90d5ad2e54cdcc;hp=d29308aeb6a8ab32d5c5f73c91af37f287333e20;hpb=f5bcfe151e61558572b9f9036c67d51bd831a436;p=u-boot diff --git a/common/lcd.c b/common/lcd.c index d29308aeb6..4b3d7dcd34 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -31,10 +31,6 @@ #endif #endif -#ifdef CONFIG_SANDBOX -#include -#endif - #ifndef CONFIG_LCD_ALIGNMENT #define CONFIG_LCD_ALIGNMENT PAGE_SIZE #endif @@ -70,15 +66,8 @@ void lcd_sync(void) int line_length; if (lcd_flush_dcache) - flush_dcache_range((u32)lcd_base, - (u32)(lcd_base + lcd_get_size(&line_length))); -#elif defined(CONFIG_SANDBOX) && defined(CONFIG_VIDEO_SANDBOX_SDL) - static ulong last_sync; - - if (get_timer(last_sync) > 10) { - sandbox_sdl_sync(lcd_base); - last_sync = get_timer(0); - } + flush_dcache_range((ulong)lcd_base, + (ulong)(lcd_base + lcd_get_size(&line_length))); #endif } @@ -100,13 +89,24 @@ static void lcd_stub_puts(struct stdio_dev *dev, const char *s) /* Small utility to check that you got the colours right */ #ifdef LCD_TEST_PATTERN +#if LCD_BPP == LCD_COLOR8 #define N_BLK_VERT 2 #define N_BLK_HOR 3 static int test_colors[N_BLK_HOR * N_BLK_VERT] = { CONSOLE_COLOR_RED, CONSOLE_COLOR_GREEN, CONSOLE_COLOR_YELLOW, CONSOLE_COLOR_BLUE, CONSOLE_COLOR_MAGENTA, CONSOLE_COLOR_CYAN, +}; /*LCD_BPP == LCD_COLOR8 */ + +#elif LCD_BPP == LCD_COLOR16 +#define N_BLK_VERT 2 +#define N_BLK_HOR 4 + +static int test_colors[N_BLK_HOR * N_BLK_VERT] = { + CONSOLE_COLOR_RED, CONSOLE_COLOR_GREEN, CONSOLE_COLOR_YELLOW, CONSOLE_COLOR_BLUE, + CONSOLE_COLOR_MAGENTA, CONSOLE_COLOR_CYAN, CONSOLE_COLOR_GREY, CONSOLE_COLOR_WHITE, }; +#endif /*LCD_BPP == LCD_COLOR16 */ static void test_pattern(void) { @@ -115,12 +115,15 @@ static void test_pattern(void) ushort v_step = (v_max + N_BLK_VERT - 1) / N_BLK_VERT; ushort h_step = (h_max + N_BLK_HOR - 1) / N_BLK_HOR; ushort v, h; +#if LCD_BPP == LCD_COLOR8 uchar *pix = (uchar *)lcd_base; +#elif LCD_BPP == LCD_COLOR16 + ushort *pix = (ushort *)lcd_base; +#endif printf("[LCD] Test Pattern: %d x %d [%d x %d]\n", h_max, v_max, h_step, v_step); - /* WARNING: Code silently assumes 8bit/pixel */ for (v = 0; v < v_max; ++v) { uchar iy = v / v_step; for (h = 0; h < h_max; ++h) { @@ -220,7 +223,7 @@ void lcd_clear(void) /* Paint the logo and retrieve LCD base address */ debug("[LCD] Drawing the logo...\n"); if (do_splash) { - s = getenv("splashimage"); + s = env_get("splashimage"); if (s) { do_splash = 0; addr = simple_strtoul(s, NULL, 16); @@ -559,11 +562,7 @@ __weak void lcd_set_cmap(struct bmp_image *bmp, unsigned colors) *cmap = (((cte.red) << 8) & 0xf800) | (((cte.green) << 3) & 0x07e0) | (((cte.blue) >> 3) & 0x001f); -#if defined(CONFIG_MPC823) - cmap--; -#else cmap++; -#endif } } @@ -579,7 +578,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) unsigned long pwidth = panel_info.vl_col; unsigned colors, bpix, bmp_bpix; int hdr_size; - struct bmp_color_table_entry *palette = bmp->color_table; + struct bmp_color_table_entry *palette; if (!bmp || !(bmp->header.signature[0] == 'B' && bmp->header.signature[1] == 'M')) { @@ -588,6 +587,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) return 1; } + palette = bmp->color_table; width = get_unaligned_le32(&bmp->header.width); height = get_unaligned_le32(&bmp->header.height); bmp_bpix = get_unaligned_le16(&bmp->header.bit_count); @@ -701,7 +701,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) } break; #endif /* CONFIG_BMP_16BPP */ -#if defined(CONFIG_BMP_24BMP) +#if defined(CONFIG_BMP_24BPP) case 24: for (i = 0; i < height; ++i) { for (j = 0; j < width; j++) { @@ -713,7 +713,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) fb -= lcd_line_length + width * (bpix / 8); } break; -#endif /* CONFIG_BMP_24BMP */ +#endif /* CONFIG_BMP_24BPP */ #if defined(CONFIG_BMP_32BPP) case 32: for (i = 0; i < height; ++i) {