summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Jackson <mpfj@mimc.co.uk>2009-02-06 10:37:49 +0100
committerAnatolij Gustschin <agust@denx.de>2009-02-24 10:05:14 +0100
commita303dfb0e9a93e516ea9427b5c09543d5f74ade1 (patch)
tree3819b6d8b1d53a1e9c793fbfa976906e640052cb
parent689551c5ff1b394b88412f3df22144e79468d3a9 (diff)
downloadu-boot-imx-a303dfb0e9a93e516ea9427b5c09543d5f74ade1.zip
u-boot-imx-a303dfb0e9a93e516ea9427b5c09543d5f74ade1.tar.gz
u-boot-imx-a303dfb0e9a93e516ea9427b5c09543d5f74ade1.tar.bz2
Add 16bpp BMP support
This patch adds 16bpp BMP support to the common lcd code. Use CONFIG_BMP_16BPP and set LCD_BPP to LCD_COLOR16 to enable the code. At the moment it's only been tested on the MIMC200 AVR32 board, but extending this to other platforms should be a simple task !! Signed-off-by: Mark Jackson <mpfj@mimc.co.uk> Signed-off-by: Guennadi Liakhovetski <lg@denx.de> Acked-by: Anatolij Gustschin <agust@denx.de>
-rw-r--r--common/lcd.c51
1 files changed, 41 insertions, 10 deletions
diff --git a/common/lcd.c b/common/lcd.c
index 2bcdba2..f459a74 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -84,7 +84,7 @@ extern void lcd_enable (void);
static void *lcd_logo (void);
-#if LCD_BPP == LCD_COLOR8
+#if (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16)
extern void lcd_setcolreg (ushort regno,
ushort red, ushort green, ushort blue);
#endif
@@ -656,7 +656,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
bpix = NBITS(panel_info.vl_bpix);
- if ((bpix != 1) && (bpix != 8)) {
+ if ((bpix != 1) && (bpix != 8) && (bpix != 16)) {
printf ("Error: %d bit/pixel mode not supported by U-Boot\n",
bpix);
return 1;
@@ -738,17 +738,48 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
bmap = (uchar *)bmp + le32_to_cpu (bmp->header.data_offset);
fb = (uchar *) (lcd_base +
(y + height - 1) * lcd_line_length + x);
- for (i = 0; i < height; ++i) {
- WATCHDOG_RESET();
- for (j = 0; j < width ; j++)
+
+ switch (bpix) {
+ case 1: /* pass through */
+ case 8:
+ for (i = 0; i < height; ++i) {
+ WATCHDOG_RESET();
+ for (j = 0; j < width ; j++)
#if defined(CONFIG_PXA250) || defined(CONFIG_ATMEL_LCD)
- *(fb++) = *(bmap++);
+ *(fb++) = *(bmap++);
#elif defined(CONFIG_MPC823) || defined(CONFIG_MCC200)
- *(fb++)=255-*(bmap++);
+ *(fb++)=255-*(bmap++);
#endif
- bmap += (width - padded_line);
- fb -= (width + lcd_line_length);
- }
+ bmap += (width - padded_line);
+ fb -= (width + lcd_line_length);
+ }
+ break;
+
+#if defined(CONFIG_BMP_16BPP)
+ case 16:
+ for (i = 0; i < height; ++i) {
+ WATCHDOG_RESET();
+ for (j = 0; j < width; j++) {
+#if defined(CONFIG_ATMEL_LCD_BGR555)
+ *(fb++) = ((bmap[0] & 0x1f) << 2) |
+ (bmap[1] & 0x03);
+ *(fb++) = (bmap[0] & 0xe0) |
+ ((bmap[1] & 0x7c) >> 2);
+ bmap += 2;
+#else
+ *(fb++) = *(bmap++);
+ *(fb++) = *(bmap++);
+#endif
+ }
+ bmap += (padded_line - width) * 2;
+ fb -= (width * 2 + lcd_line_length);
+ }
+ break;
+#endif /* CONFIG_BMP_16BPP */
+
+ default:
+ break;
+ };
return (0);
}