summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorNikita Kiryanov <nikita@compulab.co.il>2012-08-09 00:14:53 +0000
committerAnatolij Gustschin <agust@denx.de>2012-09-05 10:28:31 +0200
commitbfdcc65e1163b4891643c2a670570c478b9af2a4 (patch)
treeca8acbcacc8093af6234fe0c2606518027ada790 /common
parent203c37b8c5556aad1901ce4954792afd718c7d42 (diff)
downloadblackbird-obmc-uboot-bfdcc65e1163b4891643c2a670570c478b9af2a4.tar.gz
blackbird-obmc-uboot-bfdcc65e1163b4891643c2a670570c478b9af2a4.zip
common lcd: simplify lcd_display_bitmap
Move highly platform dependant code into its own functions to reduce the number of #ifdefs in lcd_display_bitmap To avoid breaking the mcc200 board which does not #define CONFIG_CMD_BMP, this patch also implements bmp_display() for mcc200. Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Diffstat (limited to 'common')
-rw-r--r--common/lcd.c44
1 files changed, 27 insertions, 17 deletions
diff --git a/common/lcd.c b/common/lcd.c
index 0f93eae9df..88dfa51d77 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -636,6 +636,29 @@ static void splash_align_axis(int *axis, unsigned long panel_size,
}
#endif
+#if defined CONFIG_CPU_PXA || defined(CONFIG_ATMEL_LCD)
+#define FB_PUT_BYTE(fb, from) *(fb)++ = *(from)++
+#elif defined(CONFIG_MPC823) || defined(CONFIG_MCC200)
+#define FB_PUT_BYTE(fb, from) *(fb)++ = (255 - *(from)++)
+#endif
+
+#if defined(CONFIG_BMP_16BPP)
+#if defined(CONFIG_ATMEL_LCD_BGR555)
+static inline void fb_put_word(uchar **fb, uchar **from)
+{
+ *(*fb)++ = (((*from)[0] & 0x1f) << 2) | ((*from)[1] & 0x03);
+ *(*fb)++ = ((*from)[0] & 0xe0) | (((*from)[1] & 0x7c) >> 2);
+ *from += 2;
+}
+#else
+static inline void fb_put_word(uchar **fb, uchar **from)
+{
+ *(*fb)++ = *(*from)++;
+ *(*fb)++ = *(*from)++;
+}
+#endif
+#endif /* CONFIG_BMP_16BPP */
+
int lcd_display_bitmap(ulong bmp_image, int x, int y)
{
#if !defined(CONFIG_MCC200)
@@ -761,11 +784,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
WATCHDOG_RESET();
for (j = 0; j < width; j++) {
if (bpix != 16) {
-#if defined(CONFIG_CPU_PXA) || defined(CONFIG_ATMEL_LCD)
- *(fb++) = *(bmap++);
-#elif defined(CONFIG_MPC823) || defined(CONFIG_MCC200)
- *(fb++) = 255 - *(bmap++);
-#endif
+ FB_PUT_BYTE(fb, bmap);
} else {
*(uint16_t *)fb = cmap_base[*(bmap++)];
fb += sizeof(uint16_t) / sizeof(*fb);
@@ -780,18 +799,9 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
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
- }
+ for (j = 0; j < width; j++)
+ fb_put_word(&fb, &bmap);
+
bmap += (padded_line - width) * 2;
fb -= (width * 2 + lcd_line_length);
}
OpenPOWER on IntegriCloud