[U-Boot] [PATCH v6 1/4] lcd: add clear and draw bitmap declaration

Anatolij Gustschin
2011-10-30T18:21:14Z

From: Che-liang Chiou <clchiou@chromium.org>

The functions for clearing and drawing bitmaps on the screen were not
exposed publicly and are made public in this patch in preparation for
implementing the display interface of api_public.h.

Signed-off-by: Che-Liang Chiou <clchiou@chromium.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
Changes since V5:
- fix compile issues:
lcd.c:81: error: conflicting types for 'lcd_clear'
/home/ag/u-boot/u-boot-video/include/lcd.h:213: error: previous declaration of 'lcd_clear' was here
lcd.c: In function 'do_lcd_clear':
lcd.c:359: error: too few arguments to function 'lcd_clear'
lcd.c: At top level:
lcd.c:364: error: conflicting types for 'lcd_clear'
lcd.c:81: error: previous declaration of 'lcd_clear' was here
lcd.c: In function 'lcd_clear':
lcd.c:405: warning: 'return' with a value, in function returning void
lcd.c: At top level:
lcd.c:408: warning: initialization from incompatible pointer type
make[1]: *** [lcd.o] Error 1
make: *** [common/libcommon.o] Error 2

common/cmd_bmp.c | 4 +---
common/lcd.c | 16 ++++++++++------
include/lcd.h | 2 ++
3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c
index 23fc82f..682f395 100644
--- a/common/cmd_bmp.c
+++ b/common/cmd_bmp.c
@@ -237,9 +237,7 @@ static int bmp_display(ulong addr, int x, int y)
}

#if defined(CONFIG_LCD)
- extern int lcd_display_bitmap (ulong, int, int);
-
- ret = lcd_display_bitmap ((unsigned long)bmp, x, y);
+ ret = lcd_display_bitmap((ulong)bmp, x, y);
#elif defined(CONFIG_VIDEO)
extern int video_display_bitmap (ulong, int, int);

diff --git a/common/lcd.c b/common/lcd.c
index d9cb8ca..20e97b9 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -78,7 +78,6 @@ static inline void lcd_putc_xy (ushort x, ushort y, uchar c);

static int lcd_init (void *lcdbase);

-static int lcd_clear (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]);
static void *lcd_logo (void);

static int lcd_getbgcolor (void);
@@ -353,7 +352,14 @@ int drv_lcd_init (void)
}

/*----------------------------------------------------------------------*/
-static int lcd_clear (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static
+int do_lcd_clear(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+{
+ lcd_clear();
+ return 0;
+}
+
+void lcd_clear(void)
{
#if LCD_BPP == LCD_MONOCHROME
/* Setting the palette */
@@ -394,12 +400,10 @@ static int lcd_clear (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]

console_col = 0;
console_row = 0;
-
- return (0);
}

U_BOOT_CMD(
- cls, 1, 1, lcd_clear,
+ cls, 1, 1, do_lcd_clear,
"clear screen",
""
);
@@ -413,7 +417,7 @@ static int lcd_init (void *lcdbase)

lcd_ctrl_init (lcdbase);
lcd_is_enabled = 1;
- lcd_clear (NULL, 1, 1, NULL); /* dummy args */
+ lcd_clear();
lcd_enable ();

/* Initialize the console */
diff --git a/include/lcd.h b/include/lcd.h
index 89cc90c..83b50f4 100644
--- a/include/lcd.h
+++ b/include/lcd.h
@@ -210,6 +210,8 @@ void lcd_disable (void);
void lcd_putc (const char c);
void lcd_puts (const char *s);
void lcd_printf (const char *fmt, ...);
+void lcd_clear(void);
+int lcd_display_bitmap(ulong bmp_image, int x, int y);

/* Allow boards to customize the information displayed */
void lcd_show_board_info(void);
--
1.7.1