summaryrefslogtreecommitdiff
path: root/board/mcc200/lcd.c
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 /board/mcc200/lcd.c
parent203c37b8c5556aad1901ce4954792afd718c7d42 (diff)
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 'board/mcc200/lcd.c')
-rw-r--r--board/mcc200/lcd.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/board/mcc200/lcd.c b/board/mcc200/lcd.c
index d8f754c4a1..893f4b7cb8 100644
--- a/board/mcc200/lcd.c
+++ b/board/mcc200/lcd.c
@@ -21,6 +21,7 @@
#include <common.h>
#include <lcd.h>
#include <mpc5xxx.h>
+#include <malloc.h>
#ifdef CONFIG_LCD
@@ -210,4 +211,23 @@ void show_progress (int size, int tot)
}
#endif
+
+int bmp_display(ulong addr, int x, int y)
+{
+ int ret;
+ bmp_image_t *bmp = (bmp_image_t *)addr;
+
+ if (!bmp) {
+ printf("There is no valid bmp file at the given address\n");
+ return 1;
+ }
+
+ ret = lcd_display_bitmap((ulong)bmp, x, y);
+
+ if ((unsigned long)bmp != addr)
+ free(bmp);
+
+ return ret;
+}
+
#endif /* CONFIG_LCD */