Skip to contentSkip to conversation

api: export LCD and video to external apps

PATCH Superseded Che-Liang Chiou 4 participants 50 messages Oct 4, 2011 – Nov 10, 2011

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover api: export LCD and video to external apps

This patch set exports LCD and video clearing and bitmap-rendering on screen functions to external apps, and provides a unified interface of accessing them.

Che-Liang Chiou (2):
lcd: video: add clear and draw bitmap declaration
api: export LCD and video to external apps

 api/Makefile         |    3 +-
 api/api.c            |   51 ++++++++++++++++++++++++++++++
 api/api_display.c    |   85 ++++++++++++++++++++++++++++++++++++++++++++++++++
 api/api_private.h    |    4 ++
 common/lcd.c         |   15 +++++---
 examples/api/demo.c  |   28 ++++++++++++++++
 examples/api/glue.c  |   31 ++++++++++++++++++
 examples/api/glue.h  |    5 +++
 include/api_public.h |   16 +++++++++
 include/lcd.h        |    2 +
 include/video.h      |    2 +
 include/video_font.h |    6 +++
 12 files changed, 241 insertions(+), 7 deletions(-)
 create mode 100644 api/api_display.c
Signature · 1 line
1.7.3.1
#1 lore raw

PATCH 1/2 lcd: video: add clear and draw bitmap declaration

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.

---
 common/lcd.c    |   15 +++++++++------
 include/lcd.h   |    2 ++
 include/video.h |    2 ++
 3 files changed, 13 insertions(+), 6 deletions(-)
common/lcd.c +9 -6
index d9cb8ca..d6e3188 100644
@@ -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,13 @@ 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 +399,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 +416,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 */
include/lcd.h +2 -0
index 0e098d9..fba4ec2 100644
@@ -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);
include/video.h +2 -0
index efcc682..6cd6f72 100644
@@ -15,5 +15,7 @@ int	video_init	(void *videobase);
 void	video_putc	(const char c);
 void	video_puts	(const char *s);
 void	video_printf	(const char *fmt, ...);
+void	video_clear	(void);
+int	video_display_bitmap(ulong bmp_image, int x, int y);
 
 #endif
Signature · 1 line
1.7.3.1
#2 lore raw

PATCH 1/2 lcd: video: add clear and draw bitmap declaration

Dear Che-Liang Chiou,

Quoted 10 lines · In message <11c2761c2883cf217a6efae98dccb83d19606927.1317715598.git.clchiou@chr…

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.

---
 common/lcd.c    |   15 +++++++++------
 include/lcd.h   |    2 ++
 include/video.h |    2 ++
 3 files changed, 13 insertions(+), 6 deletions(-)

Please run through checkpatch and fix the errors and warnings.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Plan to throw one away. You will anyway."
                              - Fred Brooks, "The Mythical Man Month"
#3 lore raw

PATCH 2/2 api: export LCD and video to external apps

In reply to Che-Liang Chiou

This patch exports LCD and video information and bitmap-rendering functions to external apps.

This patch is tested on a Seaboard, which does not have a video output. So I only tested LCD code paths.

NOTE: The Seaboard LCD driver is not yet upstreamed; the test was done in a local downstream repo.

---
 api/Makefile         |    3 +-
 api/api.c            |   51 ++++++++++++++++++++++++++++++
 api/api_display.c    |   85 ++++++++++++++++++++++++++++++++++++++++++++++++++
 api/api_private.h    |    4 ++
 examples/api/demo.c  |   28 ++++++++++++++++
 examples/api/glue.c  |   31 ++++++++++++++++++
 examples/api/glue.h  |    5 +++
 include/api_public.h |   16 +++++++++
 include/video_font.h |    6 +++
 9 files changed, 228 insertions(+), 1 deletions(-)
 create mode 100644 api/api_display.c
api/Makefile +2 -1
index 2a64c4d..0e99f74 100644
@@ -24,7 +24,8 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)libapi.o
 
-COBJS-$(CONFIG_API) += api.o api_net.o api_storage.o api_platform-$(ARCH).o
+COBJS-$(CONFIG_API) += api.o api_display.o api_net.o api_storage.o \
+		       api_platform-$(ARCH).o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
api/api.c +51 -0

63 lines not on this page · raw message

api/api_display.c new file +85 -0

85 lines not on this page · raw message

api/api_private.h +4 -0
index 94a7fc5..988f702 100644
@@ -45,4 +45,8 @@ int		dev_write_net(void *, void *, int);
 
 void dev_stor_init(void);
 
+int display_get_info(int type, struct display_info *di);
+int display_draw_bitmap(ulong bitmap, int x, int y);
+void display_clear(void);
+
 #endif /* _API_PRIVATE_H_ */
examples/api/demo.c +28 -0
index 65e7491..191bd79 100644
@@ -176,6 +176,34 @@ int main(int argc, char * const argv[])
 	while ((env = ub_env_enum(env)) != NULL)
 		printf("%s = %s\n", env, ub_env_get(env));
 
+	printf("\n*** Display ***\n");
+
+	struct display_info disinfo;
+	if (ub_display_get_info(DISPLAY_TYPE_LCD, &disinfo))
+		printf("LCD info: failed\n");
+	else {
+		printf("LCD info:\n");
+		printf("  pixel width:  %d\n", disinfo.pixel_width);
+		printf("  pixel height: %d\n", disinfo.pixel_height);
+		printf("  screen rows:  %d\n", disinfo.screen_rows);
+		printf("  screen cols:  %d\n", disinfo.screen_cols);
+	}
+	if (ub_display_get_info(DISPLAY_TYPE_VIDEO, &disinfo))
+		printf("video info: failed\n");
+	else {
+		printf("video info:\n");
+		printf("  pixel width:  %d\n", disinfo.pixel_width);
+		printf("  pixel height: %d\n", disinfo.pixel_height);
+		printf("  screen rows:  %d\n", disinfo.screen_rows);
+		printf("  screen cols:  %d\n", disinfo.screen_cols);
+	}
+
+	printf("*** Press any key to continue ***\n");
+	printf("got char 0x%x\n", ub_getc());
+
+	/* this only clears messages on screen, not on serial port */
+	ub_display_clear();
+
 	/* reset */
 	printf("\n*** Resetting board ***\n");
 	ub_reset();
examples/api/glue.c +31 -0
index eff6a7e..d907e3f 100644
@@ -402,3 +402,34 @@ const char * ub_env_enum(const char *last)
 
 	return env_name;
 }
+
+/****************************************
+ *
+ * display
+ *
+ ****************************************/
+
+int ub_display_get_info(int type, struct display_info *di)
+{
+	int err = 0;
+
+	if (!syscall(API_DISPLAY_GET_INFO, &err, (uint32_t)type, (uint32_t)di))
+		return API_ESYSC;
+
+	return err;
+}
+
+int ub_display_draw_bitmap(ulong bitmap, int x, int y)
+{
+	int err = 0;
+
+	if (!syscall(API_DISPLAY_DRAW_BITMAP, &err, bitmap, x, y))
+		return API_ESYSC;
+
+	return err;
+}
+
+void ub_display_clear(void)
+{
+	syscall(API_DISPLAY_CLEAR, NULL);
+}
examples/api/glue.h +5 -0
index 6bf47d0..e43f7d9 100644
@@ -77,4 +77,9 @@ int			ub_dev_send(int handle, void *buf, int len);
 int			ub_dev_recv(int handle, void *buf, int len, int *rlen);
 struct device_info *	ub_dev_get(int);
 
+/* display */
+int ub_display_get_info(int type, struct display_info *di);
+int ub_display_draw_bitmap(ulong bitmap, int x, int y);
+void ub_display_clear(void);
+
 #endif /* _API_GLUE_H_ */
include/api_public.h +16 -0
index 5940d81..4420c99 100644
@@ -90,6 +90,9 @@ enum {
 	API_ENV_ENUM,
 	API_ENV_GET,
 	API_ENV_SET,
+	API_DISPLAY_GET_INFO,
+	API_DISPLAY_DRAW_BITMAP,
+	API_DISPLAY_CLEAR,
 	API_MAXCALL
 };
 
@@ -152,4 +155,17 @@ struct device_info {
 	int	state;
 };
 
+#define DISPLAY_TYPE_LCD	0x0001
+#define DISPLAY_TYPE_VIDEO	0x0002
+
+struct display_info {
+	int type;
+	/* screen size in pixels */
+	int pixel_width;
+	int pixel_height;
+	/* screen size in rows and columns of text */
+	int screen_rows;
+	int screen_cols;
+};
+
 #endif /* _API_PUBLIC_H_ */
include/video_font.h +6 -0
index 706e185..5571a87 100644
@@ -29,6 +29,12 @@
 #define VIDEO_FONT_HEIGHT	16
 #define VIDEO_FONT_SIZE		(VIDEO_FONT_CHARS * VIDEO_FONT_HEIGHT)
 
+/*
+ * Adding unused attribute here so that compiler will not complain
+ * video_fontdata is not used in source files that only use
+ * VIDEO_FONT_* (e.g., api/api_display.c).
+ */
+__attribute__ ((unused))
 static unsigned char video_fontdata[VIDEO_FONT_SIZE] = {
 
 	/* 0 0x00 '^@' */
Signature · 1 line
1.7.3.1
#4 lore raw

PATCH 2/2 api: export LCD and video to external apps

Dear Che-Liang Chiou,

Quoted 8 lines · In message <ce61e361e4b8456b9e0584a72f37d2e278ff2ab1.1317715598.git.clchiou@chr…

This patch exports LCD and video information and bitmap-rendering functions to external apps.

This patch is tested on a Seaboard, which does not have a video output. So I only tested LCD code paths.

NOTE: The Seaboard LCD driver is not yet upstreamed; the test was done in a local downstream repo.

...

api/api_display.c line 32

Quoted 3 lines
api/api_display.c new file +3 -0
+	switch (type) {
+	default:
+		debug("%s: unsupport display device type: %d\n", __FILE__, type);

Line too long.

Quoted 70 lines
api/api_display.c new file +52 -0
+
+#ifdef CONFIG_LCD
+	case DISPLAY_TYPE_LCD:
+		di->pixel_width  = panel_info.vl_col;
+		di->pixel_height = panel_info.vl_row;
+		di->screen_rows = CONSOLE_ROWS;
+		di->screen_cols = CONSOLE_COLS;
+		break;
+#endif
+
+#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
+	case DISPLAY_TYPE_VIDEO:
+		di->pixel_width  = VIDEO_VISIBLE_COLS;
+		di->pixel_height = VIDEO_VISIBLE_ROWS;
+		di->screen_rows = CONSOLE_ROWS;
+		di->screen_cols = CONSOLE_COLS;
+		break;
+#endif
+	}
+
+	di->type = type;
+	return 0;
+}
+
+int display_draw_bitmap(ulong bitmap, int x, int y)
+{
+	int err = 0;
+
+	/*
+	 * Although CONFIG_LCD and CONFIG_VIDEO or CONFIG_CFB_CONSOLE
+	 * generally should not be both set, if this does happen, I think
+	 * drawing on both of them makes more sense.
+	 */
+#ifdef CONFIG_LCD
+	err |= lcd_display_bitmap(bitmap, x, y);
+#endif
+#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
+	err |= video_display_bitmap(bitmap, x, y);
+#endif
+
+	return err;
+}
+
+void display_clear(void)
+{
+#ifdef CONFIG_LCD
+	lcd_clear();
+#endif
+#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
+	video_clear();
+#endif
+}
api/api_private.h +4 -0
index 94a7fc5..988f702 100644
@@ -45,4 +45,8 @@ int		dev_write_net(void *, void *, int);
 
 void dev_stor_init(void);
 
+int display_get_info(int type, struct display_info *di);
+int display_draw_bitmap(ulong bitmap, int x, int y);
+void display_clear(void);
+
 #endif /* _API_PRIVATE_H_ */
examples/api/demo.c +0 -0
index 65e7491..191bd79 100644

examples/api/demo.c int main(int argc, char * const argv[]) · line 181

Quoted 6 lines
examples/api/demo.c +3 -0
@@ -176,6 +176,34 @@ int main(int argc, char * const argv[])
 	while ((env = ub_env_enum(env)) != NULL)
 		printf("%s = %s\n", env, ub_env_get(env));
 
+	printf("\n*** Display ***\n");
+
+	struct display_info disinfo;

Please don't mix declarations and code.

examples/api/demo.c int main(int argc, char * const argv[]) · line 184

Quoted 3 lines
examples/api/demo.c +3 -0
+	if (ub_display_get_info(DISPLAY_TYPE_LCD, &disinfo))
+		printf("LCD info: failed\n");
+	else {

Use braces in both branches. Please fix globally.

examples/api/demo.c int main(int argc, char * const argv[]) · line 205

Quoted 2 lines
examples/api/demo.c +2 -0
+	/* this only clears messages on screen, not on serial port */
+	ub_display_clear();

What happens here if no display is available?

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Randal said it would be tough to do in sed. He didn't say  he  didn't
understand  sed.  Randal  understands sed quite well. Which is why he
uses Perl. :-)         - Larry Wall in <[email protected]>
#5 lore raw

PATCH 2/2 api: export LCD and video to external apps

Dear Wolfgang Denk,

Quoted 102 lines · Wolfgang Denk

Dear Che-Liang Chiou,

Quoted 8 lines · In message <ce61e361e4b8456b9e0584a72f37d2e278ff2ab1.1317715598.git.clchiou@chr…

This patch exports LCD and video information and bitmap-rendering functions to external apps.

This patch is tested on a Seaboard, which does not have a video output. So I only tested LCD code paths.

NOTE: The Seaboard LCD driver is not yet upstreamed; the test was done in a local downstream repo.

...

Quoted 3 lines

+ ? ? switch (type) {
+ ? ? default:
+ ? ? ? ? ? ? debug("%s: unsupport display device type: %d\n", __FILE__, type);

Line too long.

Quoted 70 lines
api/api_display.c new file +52 -0
+
+#ifdef CONFIG_LCD
+ ? ? case DISPLAY_TYPE_LCD:
+ ? ? ? ? ? ? di->pixel_width ?= panel_info.vl_col;
+ ? ? ? ? ? ? di->pixel_height = panel_info.vl_row;
+ ? ? ? ? ? ? di->screen_rows = CONSOLE_ROWS;
+ ? ? ? ? ? ? di->screen_cols = CONSOLE_COLS;
+ ? ? ? ? ? ? break;
+#endif
+
+#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
+ ? ? case DISPLAY_TYPE_VIDEO:
+ ? ? ? ? ? ? di->pixel_width ?= VIDEO_VISIBLE_COLS;
+ ? ? ? ? ? ? di->pixel_height = VIDEO_VISIBLE_ROWS;
+ ? ? ? ? ? ? di->screen_rows = CONSOLE_ROWS;
+ ? ? ? ? ? ? di->screen_cols = CONSOLE_COLS;
+ ? ? ? ? ? ? break;
+#endif
+ ? ? }
+
+ ? ? di->type = type;
+ ? ? return 0;
+}
+
+int display_draw_bitmap(ulong bitmap, int x, int y)
+{
+ ? ? int err = 0;
+
+ ? ? /*
+ ? ? ?* Although CONFIG_LCD and CONFIG_VIDEO or CONFIG_CFB_CONSOLE
+ ? ? ?* generally should not be both set, if this does happen, I think
+ ? ? ?* drawing on both of them makes more sense.
+ ? ? ?*/
+#ifdef CONFIG_LCD
+ ? ? err |= lcd_display_bitmap(bitmap, x, y);
+#endif
+#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
+ ? ? err |= video_display_bitmap(bitmap, x, y);
+#endif
+
+ ? ? return err;
+}
+
+void display_clear(void)
+{
+#ifdef CONFIG_LCD
+ ? ? lcd_clear();
+#endif
+#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
+ ? ? video_clear();
+#endif
+}
api/api_private.h +4 -0
index 94a7fc5..988f702 100644
@@ -45,4 +45,8 @@ int ? ? ? ? dev_write_net(void *, void *, int);
 
 ?void dev_stor_init(void);
 
+int display_get_info(int type, struct display_info *di);
+int display_draw_bitmap(ulong bitmap, int x, int y);
+void display_clear(void);
+

?#endif /* _API_PRIVATE_H_ */

examples/api/demo.c +0 -0
index 65e7491..191bd79 100644

examples/api/demo.c int main(int argc, char * const argv[]) · line 181

Quoted 6 lines
examples/api/demo.c +3 -0
@@ -176,6 +176,34 @@ int main(int argc, char * const argv[])
 ? ? ? while ((env = ub_env_enum(env)) != NULL)
 ? ? ? ? ? ? ? printf("%s = %s\n", env, ub_env_get(env));
 
+ ? ? printf("\n*** Display ***\n");
+
+ ? ? struct display_info disinfo;

Please don't mix declarations and code.

examples/api/demo.c int main(int argc, char * const argv[]) · line 184

Quoted 3 lines
examples/api/demo.c +3 -0
+ ? ? if (ub_display_get_info(DISPLAY_TYPE_LCD, &disinfo))
+ ? ? ? ? ? ? printf("LCD info: failed\n");
+ ? ? else {
Quoted 6 lines

Use braces in both branches. ?Please fix globally.

examples/api/demo.c int main(int argc, char * const argv[]) · line 186

Quoted 2 lines
examples/api/demo.c +2 -0
+ ? ? /* this only clears messages on screen, not on serial port */
+ ? ? ub_display_clear();

What happens here if no display is available?

It is equivalent to a no-op. Or do you think we should print a warning message if no display is available?

Quoted 5 lines

Best regards,

Wolfgang Denk

Quoted 8 lines

--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Randal said it would be tough to do in sed. He didn't say ?he ?didn't understand ?sed. ?Randal ?understands sed quite well. Which is why he uses Perl. :-) ? ? ? ? - Larry Wall in <[email protected]>

Regards,
Che-Liang

#6 lore raw

PATCH 2/2 api: export LCD and video to external apps

Dear Che-liang Chiou,

Quoted 7 lines · In message <CANJuy2KuhG+4kueEupj0PBeFKJdhAJJnt_8-vULXYUXh9oCWKQ@mail.gmail.com>…
Quoted 4 lines
Quoted 2 lines

+ ub_display_clear();

What happens here if no display is available?

It is equivalent to a no-op. Or do you think we should print a warning message if no display is available?

Please either add an if() and don;t run the function at all, or add a comment that explains that this callis harmless if no display is present.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"He was so narrow minded he could see through  a  keyhole  with  both
eyes ..."
#7 lore raw

PATCH 2/2 api: export LCD and video to external apps

Hi Wolfgang Denk,

I have added following comments to this call in patch V2.
+ ? ? ? /*+ ? ? ? ?* This only clears messages on screen, not on serial port. It is+ ? ? ? ?* equivalent to a no-op if no display is available.+ ? ? ? ?*/Do you think it is sufficient?

Regards,
Che-Liang

Quoted 26 lines · Wolfgang Denk

Dear Che-liang Chiou,

Quoted 7 lines · In message <CANJuy2KuhG+4kueEupj0PBeFKJdhAJJnt_8-vULXYUXh9oCWKQ@mail.gmail.com>…
Quoted 4 lines
Quoted 2 lines

+ ? ? ? ub_display_clear();

What happens here if no display is available?

It is equivalent to a no-op. Or do you think we should print a warning message if no display is available?

Please either add an if() and don;t run the function at all, or add a comment that explains that this callis harmless if no display is present.

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "He was so narrow minded he could see through ?a ?keyhole ?with ?both eyes ..."

#8 lore raw

PATCH 2/2 api: export LCD and video to external apps

Dear Che-liang Chiou,

Quoted 8 lines · In message <CANJuy2LVSzvodiim096iqj2kJ3gGD4dR=9-bctO=HJm4nhfNxg@mail.gmail.com>…

Hi Wolfgang Denk,

I have added following comments to this call in patch V2.
+ /*+ * This only clears me=
ssages on screen, not on
serial port. It is+ * equivalent to a no-op if n=
o display is
available.+ */Do you think it is sufficient?

Yes, this is OK with me. Thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
As of 1992, they're called European Economic Community fries.
#9 lore raw

v2 cover api: export LCD and video to external apps

In reply to Che-Liang Chiou

This patch set exports LCD and video clearing and bitmap-rendering on screen functions to external apps, and provides a unified interface of accessing them.

Che-Liang Chiou (2):
lcd: video: add clear and draw bitmap declaration
api: export LCD and video to external apps

 api/Makefile         |    3 +-
 api/api.c            |   51 +++++++++++++++++++++++++++++
 api/api_display.c    |   86 ++++++++++++++++++++++++++++++++++++++++++++++++++
 api/api_private.h    |    4 ++
 common/lcd.c         |   16 ++++++---
 examples/api/demo.c  |   31 ++++++++++++++++++
 examples/api/glue.c  |   31 ++++++++++++++++++
 examples/api/glue.h  |    5 +++
 include/api_public.h |   16 +++++++++
 include/lcd.h        |    2 +
 include/video.h      |    2 +
 include/video_font.h |    6 +++
 12 files changed, 246 insertions(+), 7 deletions(-)
 create mode 100644 api/api_display.c
Signature · 1 line
1.7.3.1
#10 lore raw

PATCH v2 1/2 lcd: video: add clear and draw bitmap declaration

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.

---

Changes since V1
Fix style errors

 common/lcd.c    |   16 ++++++++++------
 include/lcd.h   |    2 ++
 include/video.h |    2 ++
 3 files changed, 14 insertions(+), 6 deletions(-)
common/lcd.c +10 -6
index d9cb8ca..20e97b9 100644
@@ -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 */
include/lcd.h +2 -0
index 0e098d9..39af14a 100644
@@ -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);
include/video.h +2 -0
index efcc682..280bb76 100644
@@ -15,5 +15,7 @@ int	video_init	(void *videobase);
 void	video_putc	(const char c);
 void	video_puts	(const char *s);
 void	video_printf	(const char *fmt, ...);
+void	video_clear(void);
+int	video_display_bitmap(ulong bmp_image, int x, int y);
 
 #endif
Signature · 1 line
1.7.3.1
#11 lore raw

PATCH v2 2/2 api: export LCD and video to external apps

In reply to Che-Liang Chiou

This patch exports LCD and video information and bitmap-rendering functions to external apps.

This patch is tested on a Seaboard, which does not have a video output. So I only tested LCD code paths.

NOTE: The Seaboard LCD driver is not yet upstreamed; the test was done in a local downstream repo.

---

Changes since V1
Fix style errors

 api/Makefile         |    3 +-
 api/api.c            |   51 +++++++++++++++++++++++++++++
 api/api_display.c    |   86 ++++++++++++++++++++++++++++++++++++++++++++++++++
 api/api_private.h    |    4 ++
 examples/api/demo.c  |   31 ++++++++++++++++++
 examples/api/glue.c  |   31 ++++++++++++++++++
 examples/api/glue.h  |    5 +++
 include/api_public.h |   16 +++++++++
 include/video_font.h |    6 +++
 9 files changed, 232 insertions(+), 1 deletions(-)
 create mode 100644 api/api_display.c
api/Makefile +2 -1
index 2a64c4d..0e99f74 100644
@@ -24,7 +24,8 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)libapi.o
 
-COBJS-$(CONFIG_API) += api.o api_net.o api_storage.o api_platform-$(ARCH).o
+COBJS-$(CONFIG_API) += api.o api_display.o api_net.o api_storage.o \
+		       api_platform-$(ARCH).o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
api/api.c +51 -0

63 lines not on this page · raw message

api/api_display.c new file +86 -0

86 lines not on this page · raw message

api/api_private.h +4 -0
index 94a7fc5..988f702 100644
@@ -45,4 +45,8 @@ int		dev_write_net(void *, void *, int);
 
 void dev_stor_init(void);
 
+int display_get_info(int type, struct display_info *di);
+int display_draw_bitmap(ulong bitmap, int x, int y);
+void display_clear(void);
+
 #endif /* _API_PRIVATE_H_ */
examples/api/demo.c +31 -0
index 65e7491..19d38f6 100644
@@ -48,6 +48,7 @@ int main(int argc, char * const argv[])
 	ulong start, now;
 	struct device_info *di;
 	lbasize_t rlen;
+	struct display_info disinfo;
 
 	if (!api_search_sig(&sig))
 		return -1;
@@ -176,6 +177,36 @@ int main(int argc, char * const argv[])
 	while ((env = ub_env_enum(env)) != NULL)
 		printf("%s = %s\n", env, ub_env_get(env));
 
+	printf("\n*** Display ***\n");
+
+	if (ub_display_get_info(DISPLAY_TYPE_LCD, &disinfo)) {
+		printf("LCD info: failed\n");
+	} else {
+		printf("LCD info:\n");
+		printf("  pixel width:  %d\n", disinfo.pixel_width);
+		printf("  pixel height: %d\n", disinfo.pixel_height);
+		printf("  screen rows:  %d\n", disinfo.screen_rows);
+		printf("  screen cols:  %d\n", disinfo.screen_cols);
+	}
+	if (ub_display_get_info(DISPLAY_TYPE_VIDEO, &disinfo)) {
+		printf("video info: failed\n");
+	} else {
+		printf("video info:\n");
+		printf("  pixel width:  %d\n", disinfo.pixel_width);
+		printf("  pixel height: %d\n", disinfo.pixel_height);
+		printf("  screen rows:  %d\n", disinfo.screen_rows);
+		printf("  screen cols:  %d\n", disinfo.screen_cols);
+	}
+
+	printf("*** Press any key to continue ***\n");
+	printf("got char 0x%x\n", ub_getc());
+
+	/*
+	 * This only clears messages on screen, not on serial port. It is
+	 * equivalent to a no-op if no display is available.
+	 */
+	ub_display_clear();
+
 	/* reset */
 	printf("\n*** Resetting board ***\n");
 	ub_reset();
examples/api/glue.c +31 -0
index eff6a7e..d907e3f 100644
@@ -402,3 +402,34 @@ const char * ub_env_enum(const char *last)
 
 	return env_name;
 }
+
+/****************************************
+ *
+ * display
+ *
+ ****************************************/
+
+int ub_display_get_info(int type, struct display_info *di)
+{
+	int err = 0;
+
+	if (!syscall(API_DISPLAY_GET_INFO, &err, (uint32_t)type, (uint32_t)di))
+		return API_ESYSC;
+
+	return err;
+}
+
+int ub_display_draw_bitmap(ulong bitmap, int x, int y)
+{
+	int err = 0;
+
+	if (!syscall(API_DISPLAY_DRAW_BITMAP, &err, bitmap, x, y))
+		return API_ESYSC;
+
+	return err;
+}
+
+void ub_display_clear(void)
+{
+	syscall(API_DISPLAY_CLEAR, NULL);
+}
examples/api/glue.h +5 -0
index 6bf47d0..e43f7d9 100644
@@ -77,4 +77,9 @@ int			ub_dev_send(int handle, void *buf, int len);
 int			ub_dev_recv(int handle, void *buf, int len, int *rlen);
 struct device_info *	ub_dev_get(int);
 
+/* display */
+int ub_display_get_info(int type, struct display_info *di);
+int ub_display_draw_bitmap(ulong bitmap, int x, int y);
+void ub_display_clear(void);
+
 #endif /* _API_GLUE_H_ */
include/api_public.h +16 -0
index 5940d81..4420c99 100644
@@ -90,6 +90,9 @@ enum {
 	API_ENV_ENUM,
 	API_ENV_GET,
 	API_ENV_SET,
+	API_DISPLAY_GET_INFO,
+	API_DISPLAY_DRAW_BITMAP,
+	API_DISPLAY_CLEAR,
 	API_MAXCALL
 };
 
@@ -152,4 +155,17 @@ struct device_info {
 	int	state;
 };
 
+#define DISPLAY_TYPE_LCD	0x0001
+#define DISPLAY_TYPE_VIDEO	0x0002
+
+struct display_info {
+	int type;
+	/* screen size in pixels */
+	int pixel_width;
+	int pixel_height;
+	/* screen size in rows and columns of text */
+	int screen_rows;
+	int screen_cols;
+};
+
 #endif /* _API_PUBLIC_H_ */
include/video_font.h +6 -0
index 706e185..5571a87 100644
@@ -29,6 +29,12 @@
 #define VIDEO_FONT_HEIGHT	16
 #define VIDEO_FONT_SIZE		(VIDEO_FONT_CHARS * VIDEO_FONT_HEIGHT)
 
+/*
+ * Adding unused attribute here so that compiler will not complain
+ * video_fontdata is not used in source files that only use
+ * VIDEO_FONT_* (e.g., api/api_display.c).
+ */
+__attribute__ ((unused))
 static unsigned char video_fontdata[VIDEO_FONT_SIZE] = {
 
 	/* 0 0x00 '^@' */
Signature · 1 line
1.7.3.1
#12 lore raw

PATCH v2 2/2 api: export LCD and video to external apps

Hi,

thanks for the patch and style fixes! I've some comments on it. Please see below.

Quoted 8 lines · On Fri, 7 Oct 2011 16:28:12 +0800 Che-Liang Chiou <[email protected]> wrote:

This patch exports LCD and video information and bitmap-rendering functions to external apps.

This patch is tested on a Seaboard, which does not have a video output. So I only tested LCD code paths.

NOTE: The Seaboard LCD driver is not yet upstreamed; the test was done in a local downstream repo.

Many boards defining CONFIG_LCD also define CONFIG_LCD_LOGO. Enabling CONFIG_API for such board configurations will break compiling, e.g.:

$ ./MAKEALL TQM823L_LCD
Configuring for TQM823L_LCD - Board: TQM823L, Options: LCD,NEC_NL6448BC20
api_display.c: In function 'display_get_info':
api_display.c:40: error: 'BMP_LOGO_HEIGHT' undeclared (first use in this function)
api_display.c:40: error: (Each undeclared identifier is reported only once
api_display.c:40: error: for each function it appears in.)
make[1]: *** [api_display.o] Error 1
make: *** [api/libapi.o] Error 2

Any idea how to fix this issue?

Similar problem exists for boards using cfb_console driver, e.g. enabling CONFIG_API breaks compiling for tqm5200 board:

$ ./MAKEALL TQM5200
Configuring for TQM5200 board...
api_display.c: In function 'display_get_info':
api_display.c:47: error: 'VIDEO_VISIBLE_COLS' undeclared (first use in this function)
api_display.c:47: error: (Each undeclared identifier is reported only once
api_display.c:47: error: for each function it appears in.)
api_display.c:48: error: 'VIDEO_VISIBLE_ROWS' undeclared (first use in this function)
make[1]: *** [api_display.o] Error 1
make: *** [api/libapi.o] Error 2

We need to resolve these issues before committing this patch, i think.

Thanks,
Anatolij

Quoted 17 lines

---

Changes since V1
Fix style errors

 api/Makefile         |    3 +-
 api/api.c            |   51 +++++++++++++++++++++++++++++
 api/api_display.c    |   86 ++++++++++++++++++++++++++++++++++++++++++++++++++
 api/api_private.h    |    4 ++
 examples/api/demo.c  |   31 ++++++++++++++++++
 examples/api/glue.c  |   31 ++++++++++++++++++
 examples/api/glue.h  |    5 +++
 include/api_public.h |   16 +++++++++
 include/video_font.h |    6 +++
 9 files changed, 232 insertions(+), 1 deletions(-)
 create mode 100644 api/api_display.c
#13 lore raw

PATCH v2 2/2 api: export LCD and video to external apps

Hi Anatolij,

Thanks for testing this patch. Please see below.

Quoted 30 lines · Anatolij Gustschin

Hi,

thanks for the patch and style fixes! I've some comments on it. Please see below.

Quoted 8 lines · On Fri, ?7 Oct 2011 16:28:12 +0800 Che-Liang Chiou <[email protected]> wrote:

This patch exports LCD and video information and bitmap-rendering functions to external apps.

This patch is tested on a Seaboard, which does not have a video output. So I only tested LCD code paths.

NOTE: The Seaboard LCD driver is not yet upstreamed; the test was done in a local downstream repo.

Many boards defining CONFIG_LCD also define CONFIG_LCD_LOGO. Enabling CONFIG_API for such board configurations will break compiling, e.g.:

$ ./MAKEALL TQM823L_LCD
Configuring for TQM823L_LCD - Board: TQM823L, Options: LCD,NEC_NL6448BC20
api_display.c: In function 'display_get_info':
api_display.c:40: error: 'BMP_LOGO_HEIGHT' undeclared (first use in this function)
api_display.c:40: error: (Each undeclared identifier is reported only once
api_display.c:40: error: for each function it appears in.)
make[1]: *** [api_display.o] Error 1
make: *** [api/libapi.o] Error 2
Quoted 2 lines

Any idea how to fix this issue?

BMP_LOGO_HEIGHT is defined bmp_logo.h, which is automatically generated by tools/bmp_logo.c when CONFIG_LCD_LOGO or CONFIG_VIDEO_LOGO is set. So I guess this is quite easy to fix. We could include bmp_logo.h in api_display.c.

Quoted 13 lines

Similar problem exists for boards using cfb_console driver, e.g. enabling CONFIG_API breaks compiling for tqm5200 board:

$ ./MAKEALL TQM5200
Configuring for TQM5200 board...
api_display.c: In function 'display_get_info':
api_display.c:47: error: 'VIDEO_VISIBLE_COLS' undeclared (first use in this function)
api_display.c:47: error: (Each undeclared identifier is reported only once
api_display.c:47: error: for each function it appears in.)
api_display.c:48: error: 'VIDEO_VISIBLE_ROWS' undeclared (first use in this function)
make[1]: *** [api_display.o] Error 1
make: *** [api/libapi.o] Error 2
Quoted 2 lines

We need to resolve these issues before committing this patch, i think.

VIDEO_VISIBLE_{COLS,ROLS} are just macros defined in cfb_console.c, this is my mistake. I should use GraphicDevice->{winSizeX,winSizeY} that are VIDEO_VISIBLE_{COLS,ROLS} defined upon.

Quoted 21 lines

Thanks,
Anatolij

Quoted 17 lines

---

Changes since V1
? Fix style errors

?api/Makefile ? ? ? ? | ? ?3 +-
?api/api.c ? ? ? ? ? ?| ? 51 +++++++++++++++++++++++++++++
?api/api_display.c ? ?| ? 86 ++++++++++++++++++++++++++++++++++++++++++++++++++
?api/api_private.h ? ?| ? ?4 ++
?examples/api/demo.c ?| ? 31 ++++++++++++++++++
?examples/api/glue.c ?| ? 31 ++++++++++++++++++
?examples/api/glue.h ?| ? ?5 +++
?include/api_public.h | ? 16 +++++++++
?include/video_font.h | ? ?6 +++

?9 files changed, 232 insertions(+), 1 deletions(-) ?create mode 100644 api/api_display.c

Regards,
Che-Liang

#14 lore raw

PATCH v2 2/2 api: export LCD and video to external apps

Hi,

On Tue, 18 Oct 2011 14:12:59 +0800
Che-liang Chiou <[email protected]> wrote:
...

Quoted 13 lines
Quoted 13 lines

Many boards defining CONFIG_LCD also define CONFIG_LCD_LOGO. Enabling CONFIG_API for such board configurations will break compiling, e.g.:

$ ./MAKEALL TQM823L_LCD
Configuring for TQM823L_LCD - Board: TQM823L, Options: LCD,NEC_NL6448BC20
api_display.c: In function 'display_get_info':
api_display.c:40: error: 'BMP_LOGO_HEIGHT' undeclared (first use in this function)
api_display.c:40: error: (Each undeclared identifier is reported only once
api_display.c:40: error: for each function it appears in.)
make[1]: *** [api_display.o] Error 1
make: *** [api/libapi.o] Error 2
Quoted 7 lines
Quoted 2 lines

Any idea how to fix this issue?

BMP_LOGO_HEIGHT is defined bmp_logo.h, which is automatically generated by tools/bmp_logo.c when CONFIG_LCD_LOGO or CONFIG_VIDEO_LOGO is set. So I guess this is quite easy to fix. We could include bmp_logo.h in api_display.c.

This won't work I'm afraid. bmp_logo.h is included elsewhere an including it in libapi will cause multiple definition of bmp_logo_bitmap' and bmp_logo_palette' compile errors.

Thanks,
Anatolij

#15 lore raw

PATCH v2 2/2 api: export LCD and video to external apps

Hi Anatolij,

Quoted 26 lines · Anatolij Gustschin

Hi,

On Tue, 18 Oct 2011 14:12:59 +0800
Che-liang Chiou <[email protected]> wrote:
...

Quoted 13 lines
Quoted 13 lines

Many boards defining CONFIG_LCD also define CONFIG_LCD_LOGO. Enabling CONFIG_API for such board configurations will break compiling, e.g.:

$ ./MAKEALL TQM823L_LCD
Configuring for TQM823L_LCD - Board: TQM823L, Options: LCD,NEC_NL6448BC20
api_display.c: In function 'display_get_info':
api_display.c:40: error: 'BMP_LOGO_HEIGHT' undeclared (first use in this function)
api_display.c:40: error: (Each undeclared identifier is reported only once
api_display.c:40: error: for each function it appears in.)
make[1]: *** [api_display.o] Error 1
make: *** [api/libapi.o] Error 2
Quoted 7 lines
Quoted 2 lines

Any idea how to fix this issue?

BMP_LOGO_HEIGHT is defined bmp_logo.h, which is automatically generated by tools/bmp_logo.c when CONFIG_LCD_LOGO or CONFIG_VIDEO_LOGO is set. So I guess this is quite easy to fix. We could include bmp_logo.h in api_display.c.

Quoted 7 lines

This won't work I'm afraid. bmp_logo.h is included elsewhere an including it in libapi will cause multiple definition of bmp_logo_bitmap' and bmp_logo_palette' compile errors.

Thanks,
Anatolij

I was planning to add a 'static __attribute__((unused))' to it to avoid this problem. What do you think?

Regards,
Che-Liang

#16 lore raw

v3 cover api: export LCD and video to external apps

In reply to Che-Liang Chiou

This patch set exports LCD and video clearing and bitmap-rendering on screen functions to external apps, and provides a unified interface of accessing them.

Che-Liang Chiou (4):
lcd: video: add clear and draw bitmap declaration
tools: logo: add static and unused to bmp arrays
video: add access to GraphicDevice struct
api: export LCD and video to external apps

 api/Makefile                  |    3 +-
 api/api.c                     |   51 +++++++++++++++++++++
 api/api_display.c             |   97 +++++++++++++++++++++++++++++++++++++++++
 api/api_private.h             |    4 ++
 board/eltec/mhpc/mhpc.c       |    7 +++
 common/lcd.c                  |   16 ++++---
 drivers/video/ati_radeon_fb.c |    5 ++
 drivers/video/ct69000.c       |    5 ++
 drivers/video/fsl_diu_fb.c    |    8 +++-
 drivers/video/mb862xx.c       |    5 ++
 drivers/video/mb86r0xgdc.c    |    5 ++
 drivers/video/mx3fb.c         |    5 ++
 drivers/video/mxc_ipuv3_fb.c  |    5 ++
 drivers/video/sed13806.c      |    6 +++
 drivers/video/sm501.c         |    5 ++
 drivers/video/smiLynxEM.c     |    5 ++
 examples/api/demo.c           |   31 +++++++++++++
 examples/api/glue.c           |   31 +++++++++++++
 examples/api/glue.h           |    5 ++
 include/api_public.h          |   16 +++++++
 include/lcd.h                 |    2 +
 include/video.h               |    2 +
 include/video_fb.h            |    6 ++-
 include/video_font.h          |    6 +++
 tools/bmp_logo.c              |    6 ++-
 25 files changed, 326 insertions(+), 11 deletions(-)
 create mode 100644 api/api_display.c
Signature · 1 line
1.7.3.1
#17 lore raw

PATCH v3 1/4 lcd: video: add clear and draw bitmap declaration

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.

---

Changes in V3
Rebase to ToT

Changes in V2
Fix style errors

 common/lcd.c    |   16 ++++++++++------
 include/lcd.h   |    2 ++
 include/video.h |    2 ++
 3 files changed, 14 insertions(+), 6 deletions(-)
common/lcd.c +10 -6
index d9cb8ca..20e97b9 100644
@@ -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 */
include/lcd.h +2 -0
index 0e098d9..39af14a 100644
@@ -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);
include/video.h +2 -0
index efcc682..280bb76 100644
@@ -15,5 +15,7 @@ int	video_init	(void *videobase);
 void	video_putc	(const char c);
 void	video_puts	(const char *s);
 void	video_printf	(const char *fmt, ...);
+void	video_clear(void);
+int	video_display_bitmap(ulong bmp_image, int x, int y);
 
 #endif
Signature · 1 line
1.7.3.1
#18 lore raw

PATCH v3 2/4 tools: logo: add static and unused to bmp arrays

In reply to Che-Liang Chiou

The generated header bmp_logo.h is useful even outside common/lcd.c for the logo dimension. However, the problem is, the generated bmp_logo.h cannot be included multiple times because bmp_logo_palette[] and bmp_logo_bitmap[] are defined in the bmp_logo.h.

We may remedy this by adding
static __attribute__((unused))
to the array definitions so that bmp_logo.h can be included multiple times, and these arrays is used in only one inclusion (lcd.c).

---

Changes in V3
Add to the patch set

 tools/bmp_logo.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
tools/bmp_logo.c +4 -2
index 47228d2..3d11284 100644
@@ -113,7 +113,8 @@ int main (int argc, char *argv[])
 		error ("Error allocating memory for file", fp);
 
 	/* read and print the palette information */
-	printf ("unsigned short bmp_logo_palette[] = {\n");
+	printf("static __attribute__((unused)) "
+			"unsigned short bmp_logo_palette[] = {\n");
 
 	for (i=0; i<n_colors; ++i) {
 		b->palette[(int)(i*3+2)] = fgetc(fp);
@@ -137,7 +138,8 @@ int main (int argc, char *argv[])
 	printf ("\n");
 	printf ("};\n");
 	printf ("\n");
-	printf ("unsigned char bmp_logo_bitmap[] = {\n");
+	printf("static __attribute__((unused)) "
+			"unsigned char bmp_logo_bitmap[] = {\n");
 	for (i=(b->height-1)*b->width; i>=0; i-=b->width) {
 		for (x = 0; x < b->width; x++) {
 			b->data[(uint16_t) i + x] = (uint8_t) fgetc (fp) \
Signature · 1 line
1.7.3.1
#19 lore raw

PATCH v3 3/4 video: add access to GraphicDevice struct

In reply to Che-Liang Chiou

video_hw_init() returns this struct, which is quite useful, but it is probably not okay to call this function multiple times. So this patch adds video_devinfo() that does nothing but return this struct.

video_devinfo() does not guarantee that this struct is initialized. It is user's responsibility to make sure that the video device is properly initialized.

---

Changes in V3
Add to the patch set

 board/eltec/mhpc/mhpc.c       |    7 +++++++
 drivers/video/ati_radeon_fb.c |    5 +++++
 drivers/video/ct69000.c       |    5 +++++
 drivers/video/fsl_diu_fb.c    |    8 +++++++-
 drivers/video/mb862xx.c       |    5 +++++
 drivers/video/mb86r0xgdc.c    |    5 +++++
 drivers/video/mx3fb.c         |    5 +++++
 drivers/video/mxc_ipuv3_fb.c  |    5 +++++
 drivers/video/sed13806.c      |    6 ++++++
 drivers/video/sm501.c         |    5 +++++
 drivers/video/smiLynxEM.c     |    5 +++++
 include/video_fb.h            |    6 +++++-
 12 files changed, 65 insertions(+), 2 deletions(-)
board/eltec/mhpc/mhpc.c +7 -0
index 7cca6b2..0d2c8c9 100644
@@ -466,6 +466,13 @@ void *video_hw_init (void)
 
 /* ------------------------------------------------------------------------- */
 
+void *video_devinfo(void)
+{
+	return (void *)&gdev;
+}
+
+/* ------------------------------------------------------------------------- */
+
 void video_set_lut (unsigned int index,
 		    unsigned char r, unsigned char g, unsigned char b)
 {
drivers/video/ati_radeon_fb.c +5 -0
index 4a9bd07..77509e1 100644
@@ -770,6 +770,11 @@ void *video_hw_init(void)
 	return ((void *) pGD);
 }
 
+void *video_devinfo(void)
+{
+	return (void *)&ctfb;
+}
+
 void video_set_lut (unsigned int index,	/* color number */
 	       unsigned char r,	/* red */
 	       unsigned char g,	/* green */
drivers/video/ct69000.c +5 -0
index 3db614d..660a64c 100644
@@ -1176,6 +1176,11 @@ video_hw_init (void)
 	return ((void *) &ctfb);
 }
 
+void *video_devinfo(void)
+{
+	return (void *)&ctfb;
+}
+
  /*******************************************************************************
 *
 * Set a RGB color in the LUT (8 bit index)
drivers/video/fsl_diu_fb.c +7 -1
index cb43904..6ed6c32 100644
@@ -367,9 +367,10 @@ int fsl_diu_init(u16 xres, u16 yres, u32 pixel_format, int gamma_fix)
 	return 0;
 }
 
+static GraphicDevice ctfb;
+
 void *video_hw_init(void)
 {
-	static GraphicDevice ctfb;
 	const char *options;
 	unsigned int depth = 0, freq = 0;
 
@@ -408,3 +409,8 @@ void *video_hw_init(void)
 
 	return &ctfb;
 }
+
+void *video_devinfo(void)
+{
+	return (void *)&ctfb;
+}
drivers/video/mb862xx.c +5 -0
index 1a4ba82..36dbdc1 100644
@@ -444,6 +444,11 @@ void *video_hw_init (void)
 	return dev;
 }
 
+void *video_devinfo(void)
+{
+	return (void *)&mb862xx;
+}
+
 /*
  * Set a RGB color in the LUT
  */
drivers/video/mb86r0xgdc.c +5 -0
index 345a73b..455aea3 100644
@@ -182,3 +182,8 @@ void *video_hw_init(void)
 
 	return pGD;
 }
+
+void *video_devinfo(void)
+{
+	return (void *)&mb86r0x;
+}
drivers/video/mx3fb.c +5 -0
index f30deb3..4ff84c8 100644
@@ -922,6 +922,11 @@ void *video_hw_init(void)
 	return (void *) &panel;
 }
 
+void *video_devinfo(void)
+{
+	return (void *)&panel;
+}
+
 void video_set_lut(unsigned int index,	/* color number */
 		    unsigned char r,	/* red */
 		    unsigned char g,	/* green */
drivers/video/mxc_ipuv3_fb.c +5 -0
index 1bee54c..fd27828 100644
@@ -590,6 +590,11 @@ void *video_hw_init(void)
 	return (void *)&panel;
 }
 
+void *video_devinfo(void)
+{
+	return (void *)&panel;
+}
+
 void video_set_lut(unsigned int index, /* color number */
 			unsigned char r,    /* red */
 			unsigned char g,    /* green */
drivers/video/sed13806.c +6 -0
index 0bf9ba6..ee7b9b9 100644
@@ -108,6 +108,12 @@ void *video_hw_init (void)
 
     return (&sed13806);
 }
+
+void *video_devinfo(void)
+{
+	return (void *)&sed13806;
+}
+
 /*-----------------------------------------------------------------------------
  * Epson_wait_idle -- Wait for hardware to become idle
  *-----------------------------------------------------------------------------
drivers/video/sm501.c +5 -0
index 42ac680..dd2a438 100644
@@ -238,3 +238,8 @@ not_pci:
 
 	return (&sm501);
 }
+
+void *video_devinfo(void)
+{
+	return (void *)&sm501;
+}
drivers/video/smiLynxEM.c +5 -0
index 2001e9c..87855eb 100644
@@ -752,6 +752,11 @@ void *video_hw_init (void)
 	return ((void*)&smi);
 }
 
+void *video_devinfo(void)
+{
+	return (void *)&smi;
+}
+
 /*******************************************************************************
  *
  * Drawing engine fill on screen region
include/video_fb.h +5 -1
index f649c54..239bf37 100644
@@ -76,7 +76,11 @@ typedef struct {
 /* Export Graphic Functions                                                   */
 /******************************************************************************/
 
-void *video_hw_init (void);       /* returns GraphicDevice struct or NULL */
+void *video_hw_init(void);        /* initializes the device and
+				     returns GraphicDevice struct or NULL */
+
+void *video_devinfo(void);        /* returns GraphicDevice struct;
+				     _no_ guarantee it is initialized! */
 
 #ifdef VIDEO_HW_BITBLT
 void video_hw_bitblt (
Signature · 1 line
1.7.3.1
#20 lore raw

PATCH v3 3/4 video: add access to GraphicDevice struct

Hi,

Quoted 14 lines · On Tue, 18 Oct 2011 17:15:37 +0800 Che-Liang Chiou <[email protected]> wrote:

video_hw_init() returns this struct, which is quite useful, but it is probably not okay to call this function multiple times. So this patch adds video_devinfo() that does nothing but return this struct.

video_devinfo() does not guarantee that this struct is initialized. It is user's responsibility to make sure that the video device is properly initialized.

---

Changes in V3
Add to the patch set

Quoted 11 lines
 board/eltec/mhpc/mhpc.c       |    7 +++++++
 drivers/video/ati_radeon_fb.c |    5 +++++
 drivers/video/ct69000.c       |    5 +++++
 drivers/video/fsl_diu_fb.c    |    8 +++++++-
 drivers/video/mb862xx.c       |    5 +++++
 drivers/video/mb86r0xgdc.c    |    5 +++++
 drivers/video/mx3fb.c         |    5 +++++
 drivers/video/mxc_ipuv3_fb.c  |    5 +++++
 drivers/video/sed13806.c      |    6 ++++++
 drivers/video/sm501.c         |    5 +++++
 drivers/video/smiLynxEM.c     |    5 +++++

NAK. Better would be to add video_devinfo() only to drivers/video/cfb_console.c since the graphic device structure pointer is stored there. We do not need to add this function to each video driver.

Anatolij

#21 lore raw

PATCH v3 4/4 api: export LCD and video to external apps

In reply to Che-Liang Chiou

This patch exports LCD and video information and bitmap-rendering functions to external apps.

This patch is tested on a Seaboard, which does not have a video output. So I only tested LCD code paths.

NOTE: The Seaboard LCD driver is not yet upstreamed; the test was done in a local downstream repo.

---

Changes in V3
Rebase to ToT

Changes in V2
Fix style errors

 api/Makefile         |    3 +-
 api/api.c            |   51 ++++++++++++++++++++++++++
 api/api_display.c    |   97 ++++++++++++++++++++++++++++++++++++++++++++++++++
 api/api_private.h    |    4 ++
 examples/api/demo.c  |   31 ++++++++++++++++
 examples/api/glue.c  |   31 ++++++++++++++++
 examples/api/glue.h  |    5 +++
 include/api_public.h |   16 ++++++++
 include/video_font.h |    6 +++
 9 files changed, 243 insertions(+), 1 deletions(-)
 create mode 100644 api/api_display.c
api/Makefile +2 -1
index 2a64c4d..0e99f74 100644
@@ -24,7 +24,8 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)libapi.o
 
-COBJS-$(CONFIG_API) += api.o api_net.o api_storage.o api_platform-$(ARCH).o
+COBJS-$(CONFIG_API) += api.o api_display.o api_net.o api_storage.o \
+		       api_platform-$(ARCH).o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
api/api.c +51 -0

63 lines not on this page · raw message

api/api_display.c new file +97 -0

97 lines not on this page · raw message

api/api_private.h +4 -0
index 94a7fc5..988f702 100644
@@ -45,4 +45,8 @@ int		dev_write_net(void *, void *, int);
 
 void dev_stor_init(void);
 
+int display_get_info(int type, struct display_info *di);
+int display_draw_bitmap(ulong bitmap, int x, int y);
+void display_clear(void);
+
 #endif /* _API_PRIVATE_H_ */
examples/api/demo.c +31 -0
index 65e7491..19d38f6 100644
@@ -48,6 +48,7 @@ int main(int argc, char * const argv[])
 	ulong start, now;
 	struct device_info *di;
 	lbasize_t rlen;
+	struct display_info disinfo;
 
 	if (!api_search_sig(&sig))
 		return -1;
@@ -176,6 +177,36 @@ int main(int argc, char * const argv[])
 	while ((env = ub_env_enum(env)) != NULL)
 		printf("%s = %s\n", env, ub_env_get(env));
 
+	printf("\n*** Display ***\n");
+
+	if (ub_display_get_info(DISPLAY_TYPE_LCD, &disinfo)) {
+		printf("LCD info: failed\n");
+	} else {
+		printf("LCD info:\n");
+		printf("  pixel width:  %d\n", disinfo.pixel_width);
+		printf("  pixel height: %d\n", disinfo.pixel_height);
+		printf("  screen rows:  %d\n", disinfo.screen_rows);
+		printf("  screen cols:  %d\n", disinfo.screen_cols);
+	}
+	if (ub_display_get_info(DISPLAY_TYPE_VIDEO, &disinfo)) {
+		printf("video info: failed\n");
+	} else {
+		printf("video info:\n");
+		printf("  pixel width:  %d\n", disinfo.pixel_width);
+		printf("  pixel height: %d\n", disinfo.pixel_height);
+		printf("  screen rows:  %d\n", disinfo.screen_rows);
+		printf("  screen cols:  %d\n", disinfo.screen_cols);
+	}
+
+	printf("*** Press any key to continue ***\n");
+	printf("got char 0x%x\n", ub_getc());
+
+	/*
+	 * This only clears messages on screen, not on serial port. It is
+	 * equivalent to a no-op if no display is available.
+	 */
+	ub_display_clear();
+
 	/* reset */
 	printf("\n*** Resetting board ***\n");
 	ub_reset();
examples/api/glue.c +31 -0
index eff6a7e..d907e3f 100644
@@ -402,3 +402,34 @@ const char * ub_env_enum(const char *last)
 
 	return env_name;
 }
+
+/****************************************
+ *
+ * display
+ *
+ ****************************************/
+
+int ub_display_get_info(int type, struct display_info *di)
+{
+	int err = 0;
+
+	if (!syscall(API_DISPLAY_GET_INFO, &err, (uint32_t)type, (uint32_t)di))
+		return API_ESYSC;
+
+	return err;
+}
+
+int ub_display_draw_bitmap(ulong bitmap, int x, int y)
+{
+	int err = 0;
+
+	if (!syscall(API_DISPLAY_DRAW_BITMAP, &err, bitmap, x, y))
+		return API_ESYSC;
+
+	return err;
+}
+
+void ub_display_clear(void)
+{
+	syscall(API_DISPLAY_CLEAR, NULL);
+}
examples/api/glue.h +5 -0
index 6bf47d0..e43f7d9 100644
@@ -77,4 +77,9 @@ int			ub_dev_send(int handle, void *buf, int len);
 int			ub_dev_recv(int handle, void *buf, int len, int *rlen);
 struct device_info *	ub_dev_get(int);
 
+/* display */
+int ub_display_get_info(int type, struct display_info *di);
+int ub_display_draw_bitmap(ulong bitmap, int x, int y);
+void ub_display_clear(void);
+
 #endif /* _API_GLUE_H_ */
include/api_public.h +16 -0
index 5940d81..4420c99 100644
@@ -90,6 +90,9 @@ enum {
 	API_ENV_ENUM,
 	API_ENV_GET,
 	API_ENV_SET,
+	API_DISPLAY_GET_INFO,
+	API_DISPLAY_DRAW_BITMAP,
+	API_DISPLAY_CLEAR,
 	API_MAXCALL
 };
 
@@ -152,4 +155,17 @@ struct device_info {
 	int	state;
 };
 
+#define DISPLAY_TYPE_LCD	0x0001
+#define DISPLAY_TYPE_VIDEO	0x0002
+
+struct display_info {
+	int type;
+	/* screen size in pixels */
+	int pixel_width;
+	int pixel_height;
+	/* screen size in rows and columns of text */
+	int screen_rows;
+	int screen_cols;
+};
+
 #endif /* _API_PUBLIC_H_ */
include/video_font.h +6 -0
index 706e185..5571a87 100644
@@ -29,6 +29,12 @@
 #define VIDEO_FONT_HEIGHT	16
 #define VIDEO_FONT_SIZE		(VIDEO_FONT_CHARS * VIDEO_FONT_HEIGHT)
 
+/*
+ * Adding unused attribute here so that compiler will not complain
+ * video_fontdata is not used in source files that only use
+ * VIDEO_FONT_* (e.g., api/api_display.c).
+ */
+__attribute__ ((unused))
 static unsigned char video_fontdata[VIDEO_FONT_SIZE] = {
 
 	/* 0 0x00 '^@' */
Signature · 1 line
1.7.3.1
#22 lore raw

PATCH v3 4/4 api: export LCD and video to external apps

Hi,

On Tue, 18 Oct 2011 17:15:38 +0800
Che-Liang Chiou <[email protected]> wrote:
...

Quoted 18 lines
(quoted diff) +18 -0
+int display_get_info(int type, struct display_info *di)
+{
+#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
+	GraphicDevice *gdev;
+#endif
+
+	switch (type) {
+	default:
+		debug("%s: unsupport display device type: %d\n",
+				__FILE__, type);
+		return API_ENODEV;
+
+#ifdef CONFIG_LCD
+	case DISPLAY_TYPE_LCD:
+		di->pixel_width  = panel_info.vl_col;
+		di->pixel_height = panel_info.vl_row;
+		di->screen_rows = CONSOLE_ROWS;
+		di->screen_cols = CONSOLE_COLS;

Review

Quoted 10 lines
(quoted diff) +10 -0
+		break;
+#endif
+
+#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
+	case DISPLAY_TYPE_VIDEO:
+		gdev = video_devinfo();
+		di->pixel_width  = gdev->winSizeX;
+		di->pixel_height = gdev->winSizeY;
+		di->screen_rows = CONSOLE_ROWS;
+		di->screen_cols = CONSOLE_COLS;

the return value of video_devinfo() should be checked before dereferencing gdev pointer (it could be NULL).

Another issue is that CONSOLE_ROWS and CONSOLE_COLS macros expand to 'panel_info' structure usage here which is only okay for CONFIG_LCD case. For CONFIG_VIDEO case these macros are defined in cfb_console.c file and thus can not be used here as you currently do (compile breakage again).

...

Review

Quoted 8 lines
(quoted diff) +8 -0
+
+void display_clear(void)
+{
+#ifdef CONFIG_LCD
+	lcd_clear();
+#endif
+#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
+	video_clear();

video_clear() is used here but it is not defined. Below is a small patch included. It shows how video_clear() could look like (but this was not tested yet).

Anatolij

drivers/video/cfb_console.c +17 -0
index 4e653b8..5336937 100644
@@ -1753,6 +1753,23 @@ static int video_init(void)
 	return 0;
 }
 
+void video_clear(void)
+{
+#ifdef VIDEO_HW_RECTFILL
+	video_hw_rectfill(VIDEO_PIXEL_SIZE,	/* bytes per pixel */
+			  0,			/* dest pos x */
+			  0,			/* dest pos y */
+			  VIDEO_VISIBLE_COLS,	/* frame width */
+			  VIDEO_VISIBLE_ROWS,	/* frame height */
+			  CONSOLE_BG_COL	/* fill color */
+		);
+#else
+	memsetl(CONSOLE_ROW_FIRST, CONSOLE_SIZE >> 2, CONSOLE_BG_COL);
+#endif
+	console_col = 0;
+	console_row = 0;
+}
+
 /*
  * Implement a weak default function for boards that optionally
  * need to skip the video initialization.
#23 lore raw

PATCH v3 4/4 api: export LCD and video to external apps

Hi Anatolij,

I remove the support of video device from the patch set since I don't have a board with video output at hand for now. I will leave this to future work.

Regards,
Che-Liang

Quoted 88 lines · Anatolij Gustschin

Hi,

On Tue, 18 Oct 2011 17:15:38 +0800
Che-Liang Chiou <[email protected]> wrote:
...

Quoted 18 lines
(quoted diff) +18 -0
+int display_get_info(int type, struct display_info *di)
+{
+#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
+ ? ? GraphicDevice *gdev;
+#endif
+
+ ? ? switch (type) {
+ ? ? default:
+ ? ? ? ? ? ? debug("%s: unsupport display device type: %d\n",
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? __FILE__, type);
+ ? ? ? ? ? ? return API_ENODEV;
+
+#ifdef CONFIG_LCD
+ ? ? case DISPLAY_TYPE_LCD:
+ ? ? ? ? ? ? di->pixel_width ?= panel_info.vl_col;
+ ? ? ? ? ? ? di->pixel_height = panel_info.vl_row;
+ ? ? ? ? ? ? di->screen_rows = CONSOLE_ROWS;
+ ? ? ? ? ? ? di->screen_cols = CONSOLE_COLS;

Review

Quoted 10 lines
(quoted diff) +10 -0
+ ? ? ? ? ? ? break;
+#endif
+
+#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
+ ? ? case DISPLAY_TYPE_VIDEO:
+ ? ? ? ? ? ? gdev = video_devinfo();
+ ? ? ? ? ? ? di->pixel_width ?= gdev->winSizeX;
+ ? ? ? ? ? ? di->pixel_height = gdev->winSizeY;
+ ? ? ? ? ? ? di->screen_rows = CONSOLE_ROWS;
+ ? ? ? ? ? ? di->screen_cols = CONSOLE_COLS;

the return value of video_devinfo() should be checked before dereferencing gdev pointer (it could be NULL).

Another issue is that CONSOLE_ROWS and CONSOLE_COLS macros expand to 'panel_info' structure usage here which is only okay for CONFIG_LCD case. For CONFIG_VIDEO case these macros are defined in cfb_console.c file and thus can not be used here as you currently do (compile breakage again).

...

Review

Quoted 8 lines
(quoted diff) +8 -0
+
+void display_clear(void)
+{
+#ifdef CONFIG_LCD
+ ? ? lcd_clear();
+#endif
+#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
+ ? ? video_clear();

video_clear() is used here but it is not defined. Below is a small patch included. It shows how video_clear() could look like (but this was not tested yet).

Anatolij

drivers/video/cfb_console.c +17 -0
index 4e653b8..5336937 100644
@@ -1753,6 +1753,23 @@ static int video_init(void)
 ? ? ? ?return 0;
 ?}
 
+void video_clear(void)
+{
+#ifdef VIDEO_HW_RECTFILL
+ ? ? ? video_hw_rectfill(VIDEO_PIXEL_SIZE, ? ? /* bytes per pixel */
+ ? ? ? ? ? ? ? ? ? ? ? ? 0, ? ? ? ? ? ? ? ? ? ?/* dest pos x */
+ ? ? ? ? ? ? ? ? ? ? ? ? 0, ? ? ? ? ? ? ? ? ? ?/* dest pos y */
+ ? ? ? ? ? ? ? ? ? ? ? ? VIDEO_VISIBLE_COLS, ? /* frame width */
+ ? ? ? ? ? ? ? ? ? ? ? ? VIDEO_VISIBLE_ROWS, ? /* frame height */
+ ? ? ? ? ? ? ? ? ? ? ? ? CONSOLE_BG_COL ? ? ? ?/* fill color */
+ ? ? ? ? ? ? ? );
+#else
+ ? ? ? memsetl(CONSOLE_ROW_FIRST, CONSOLE_SIZE >> 2, CONSOLE_BG_COL);
+#endif
+ ? ? ? console_col = 0;
+ ? ? ? console_row = 0;
+}
+

?/*
?* Implement a weak default function for boards that optionally ?* need to skip the video initialization.

#24 lore raw

v4 cover api: export LCD and video to external apps

In reply to Che-Liang Chiou

This patch set exports LCD clearing and bitmap-rendering on screen functions to external apps, and provides a unified interface of accessing them.

Che-Liang Chiou (3):
lcd: add clear and draw bitmap declaration
tools: logo: add static and unused to bmp arrays
api: export LCD device to external apps

 api/Makefile         |    3 +-
 api/api.c            |   51 +++++++++++++++++++++++++++++++++++++
 api/api_display.c    |   69 ++++++++++++++++++++++++++++++++++++++++++++++++++
 api/api_private.h    |    4 +++
 common/lcd.c         |   16 +++++++----
 examples/api/demo.c  |   31 ++++++++++++++++++++++
 examples/api/glue.c  |   31 ++++++++++++++++++++++
 examples/api/glue.h  |    5 +++
 include/api_public.h |   16 +++++++++++
 include/lcd.h        |    2 +
 include/video_font.h |    6 ++++
 tools/bmp_logo.c     |    6 +++-
 12 files changed, 231 insertions(+), 9 deletions(-)
 create mode 100644 api/api_display.c
Signature · 1 line
1.7.3.1
#25 lore raw

PATCH v4 1/3 lcd: add clear and draw bitmap declaration

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.

---

Changes in V4
Remove support of video device, which is untested and will leave to future work

Changes in V3
Rebase to ToT

Changes in V2
Fix style errors

 common/lcd.c  |   16 ++++++++++------
 include/lcd.h |    2 ++
 2 files changed, 12 insertions(+), 6 deletions(-)
common/lcd.c +10 -6
index d9cb8ca..20e97b9 100644
@@ -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 */
include/lcd.h +2 -0
index 0e098d9..39af14a 100644
@@ -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);
Signature · 1 line
1.7.3.1
#26 lore raw

PATCH v4 1/3 lcd: add clear and draw bitmap declaration

include/lcd.h

Quoted 4 lines · On Thursday 20 October 2011 01:38:44 Che-Liang Chiou wrote:
include/lcd.h +1 -0
 
+int	lcd_display_bitmap(ulong bmp_image, int x, int y);

nice. can you fix common/cmd_bmp.c while you're at it and delete the inline extern decl for this func ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111020/b568ad29/attachment.pgp

#27 lore raw

PATCH v4 2/3 tools: logo: add static and unused to bmp arrays

In reply to Che-Liang Chiou

The generated header bmp_logo.h is useful even outside common/lcd.c for the logo dimension. However, the problem is, the generated bmp_logo.h cannot be included multiple times because bmp_logo_palette[] and bmp_logo_bitmap[] are defined in the bmp_logo.h.

We may remedy this by adding
static __attribute__((unused))
to the array definitions so that bmp_logo.h can be included multiple times, and these arrays is used in only one inclusion (lcd.c).

---

Changes in V4
None

Changes in V3
Add to the patch set

 tools/bmp_logo.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
tools/bmp_logo.c +4 -2
index 47228d2..3d11284 100644
@@ -113,7 +113,8 @@ int main (int argc, char *argv[])
 		error ("Error allocating memory for file", fp);
 
 	/* read and print the palette information */
-	printf ("unsigned short bmp_logo_palette[] = {\n");
+	printf("static __attribute__((unused)) "
+			"unsigned short bmp_logo_palette[] = {\n");
 
 	for (i=0; i<n_colors; ++i) {
 		b->palette[(int)(i*3+2)] = fgetc(fp);
@@ -137,7 +138,8 @@ int main (int argc, char *argv[])
 	printf ("\n");
 	printf ("};\n");
 	printf ("\n");
-	printf ("unsigned char bmp_logo_bitmap[] = {\n");
+	printf("static __attribute__((unused)) "
+			"unsigned char bmp_logo_bitmap[] = {\n");
 	for (i=(b->height-1)*b->width; i>=0; i-=b->width) {
 		for (x = 0; x < b->width; x++) {
 			b->data[(uint16_t) i + x] = (uint8_t) fgetc (fp) \
Signature · 1 line
1.7.3.1
#28 lore raw

PATCH v4 2/3 tools: logo: add static and unused to bmp arrays

Quoted 9 lines · On Thursday 20 October 2011 01:38:45 Che-Liang Chiou wrote:

The generated header bmp_logo.h is useful even outside common/lcd.c for the logo dimension. However, the problem is, the generated bmp_logo.h cannot be included multiple times because bmp_logo_palette[] and bmp_logo_bitmap[] are defined in the bmp_logo.h.

We may remedy this by adding
static __attribute__((unused))
to the array definitions so that bmp_logo.h can be included multiple times, and these arrays is used in only one inclusion (lcd.c).

i'm not sure this is the right way to go. what if we split bmp_logo.h instead into bmp_logo_data.h (which has the array contents) and bmp_log.h (which has the defines and externs for the data arrays) ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111020/cbf75b44/attachment.pgp

#29 lore raw

PATCH v4 2/3 tools: logo: add static and unused to bmp arrays

Dear Che-Liang Chiou,

Quoted 4 lines · in message <[email protected]> Mike Frysinger wrote:

i'm not sure this is the right way to go. what if we split bmp_logo.h instead into bmp_logo_data.h (which has the array contents) and bmp_log.h (which has the defines and externs for the data arrays) ?

I support that suggestion.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Don't tell me how hard you work.  Tell me how much you get done.
                                                     -- James J. Ling
#30 lore raw

PATCH v4 3/3 api: export LCD device to external apps

In reply to Che-Liang Chiou

This patch exports LCD info-query and bitmap-rendering functions to external apps.

This patch is tested on a Seaboard. Because the LCD driver is not yet upstreamed, the test was done in a local downstream repo.

---

Changes in V4
Remove support of video device, which is untested and will leave to future work

Changes in V3
Rebase to ToT

Changes in V2
Fix style errors

 api/Makefile         |    3 +-
 api/api.c            |   51 +++++++++++++++++++++++++++++++++++++
 api/api_display.c    |   69 ++++++++++++++++++++++++++++++++++++++++++++++++++
 api/api_private.h    |    4 +++
 examples/api/demo.c  |   31 ++++++++++++++++++++++
 examples/api/glue.c  |   31 ++++++++++++++++++++++
 examples/api/glue.h  |    5 +++
 include/api_public.h |   16 +++++++++++
 include/video_font.h |    6 ++++
 9 files changed, 215 insertions(+), 1 deletions(-)
 create mode 100644 api/api_display.c
api/Makefile +2 -1
index 2a64c4d..0e99f74 100644
@@ -24,7 +24,8 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)libapi.o
 
-COBJS-$(CONFIG_API) += api.o api_net.o api_storage.o api_platform-$(ARCH).o
+COBJS-$(CONFIG_API) += api.o api_display.o api_net.o api_storage.o \
+		       api_platform-$(ARCH).o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
api/api.c +51 -0

63 lines not on this page · raw message

api/api_display.c new file +69 -0

69 lines not on this page · raw message

api/api_private.h +4 -0
index 94a7fc5..988f702 100644
@@ -45,4 +45,8 @@ int		dev_write_net(void *, void *, int);
 
 void dev_stor_init(void);
 
+int display_get_info(int type, struct display_info *di);
+int display_draw_bitmap(ulong bitmap, int x, int y);
+void display_clear(void);
+
 #endif /* _API_PRIVATE_H_ */
examples/api/demo.c +31 -0
index 65e7491..19d38f6 100644
@@ -48,6 +48,7 @@ int main(int argc, char * const argv[])
 	ulong start, now;
 	struct device_info *di;
 	lbasize_t rlen;
+	struct display_info disinfo;
 
 	if (!api_search_sig(&sig))
 		return -1;
@@ -176,6 +177,36 @@ int main(int argc, char * const argv[])
 	while ((env = ub_env_enum(env)) != NULL)
 		printf("%s = %s\n", env, ub_env_get(env));
 
+	printf("\n*** Display ***\n");
+
+	if (ub_display_get_info(DISPLAY_TYPE_LCD, &disinfo)) {
+		printf("LCD info: failed\n");
+	} else {
+		printf("LCD info:\n");
+		printf("  pixel width:  %d\n", disinfo.pixel_width);
+		printf("  pixel height: %d\n", disinfo.pixel_height);
+		printf("  screen rows:  %d\n", disinfo.screen_rows);
+		printf("  screen cols:  %d\n", disinfo.screen_cols);
+	}
+	if (ub_display_get_info(DISPLAY_TYPE_VIDEO, &disinfo)) {
+		printf("video info: failed\n");
+	} else {
+		printf("video info:\n");
+		printf("  pixel width:  %d\n", disinfo.pixel_width);
+		printf("  pixel height: %d\n", disinfo.pixel_height);
+		printf("  screen rows:  %d\n", disinfo.screen_rows);
+		printf("  screen cols:  %d\n", disinfo.screen_cols);
+	}
+
+	printf("*** Press any key to continue ***\n");
+	printf("got char 0x%x\n", ub_getc());
+
+	/*
+	 * This only clears messages on screen, not on serial port. It is
+	 * equivalent to a no-op if no display is available.
+	 */
+	ub_display_clear();
+
 	/* reset */
 	printf("\n*** Resetting board ***\n");
 	ub_reset();
examples/api/glue.c +31 -0
index eff6a7e..d907e3f 100644
@@ -402,3 +402,34 @@ const char * ub_env_enum(const char *last)
 
 	return env_name;
 }
+
+/****************************************
+ *
+ * display
+ *
+ ****************************************/
+
+int ub_display_get_info(int type, struct display_info *di)
+{
+	int err = 0;
+
+	if (!syscall(API_DISPLAY_GET_INFO, &err, (uint32_t)type, (uint32_t)di))
+		return API_ESYSC;
+
+	return err;
+}
+
+int ub_display_draw_bitmap(ulong bitmap, int x, int y)
+{
+	int err = 0;
+
+	if (!syscall(API_DISPLAY_DRAW_BITMAP, &err, bitmap, x, y))
+		return API_ESYSC;
+
+	return err;
+}
+
+void ub_display_clear(void)
+{
+	syscall(API_DISPLAY_CLEAR, NULL);
+}
examples/api/glue.h +5 -0
index 6bf47d0..e43f7d9 100644
@@ -77,4 +77,9 @@ int			ub_dev_send(int handle, void *buf, int len);
 int			ub_dev_recv(int handle, void *buf, int len, int *rlen);
 struct device_info *	ub_dev_get(int);
 
+/* display */
+int ub_display_get_info(int type, struct display_info *di);
+int ub_display_draw_bitmap(ulong bitmap, int x, int y);
+void ub_display_clear(void);
+
 #endif /* _API_GLUE_H_ */
include/api_public.h +16 -0
index 5940d81..4420c99 100644
@@ -90,6 +90,9 @@ enum {
 	API_ENV_ENUM,
 	API_ENV_GET,
 	API_ENV_SET,
+	API_DISPLAY_GET_INFO,
+	API_DISPLAY_DRAW_BITMAP,
+	API_DISPLAY_CLEAR,
 	API_MAXCALL
 };
 
@@ -152,4 +155,17 @@ struct device_info {
 	int	state;
 };
 
+#define DISPLAY_TYPE_LCD	0x0001
+#define DISPLAY_TYPE_VIDEO	0x0002
+
+struct display_info {
+	int type;
+	/* screen size in pixels */
+	int pixel_width;
+	int pixel_height;
+	/* screen size in rows and columns of text */
+	int screen_rows;
+	int screen_cols;
+};
+
 #endif /* _API_PUBLIC_H_ */
include/video_font.h +6 -0
index 706e185..5571a87 100644
@@ -29,6 +29,12 @@
 #define VIDEO_FONT_HEIGHT	16
 #define VIDEO_FONT_SIZE		(VIDEO_FONT_CHARS * VIDEO_FONT_HEIGHT)
 
+/*
+ * Adding unused attribute here so that compiler will not complain
+ * video_fontdata is not used in source files that only use
+ * VIDEO_FONT_* (e.g., api/api_display.c).
+ */
+__attribute__ ((unused))
 static unsigned char video_fontdata[VIDEO_FONT_SIZE] = {
 
 	/* 0 0x00 '^@' */
Signature · 1 line
1.7.3.1
#31 lore raw

PATCH v4 3/3 api: export LCD device to external apps

Quoted 5 lines · On Thursday 20 October 2011 01:38:46 Che-Liang Chiou wrote:
api/api.c +2 -0
 
+/*
+ * pseudo signature:

api/api.c static int API_env_enum(va_list ap) · line 567

Quoted 10 lines
api/api.c +10 -0
+ *
+ * int API_display_get_info(int type, struct display_info *di)
+ */
+static int API_display_get_info(va_list ap)
+{
+	int type;
+	struct display_info *di;
+
+	type = (int)va_arg(ap, u_int32_t);
+	di = (struct display_info *)va_arg(ap, u_int32_t);

i know you simply copied these warts from the rest of the code, but this va_arg() usage looks wrong to me. why is u_int32_t always used as the argument to va_arg() and then the return value is cast ? seems to me this code should actually read:

	type = va_arg(ap, int);
	di = va_arg(ap, struct display_info *);

could you see if that change still works for you ?

api/api.c static int API_env_enum(va_list ap) · line 586

Quoted 8 lines
api/api.c +8 -0
+static int API_display_draw_bitmap(va_list ap)
+{
+	ulong bitmap;
+	int x, y;
+
+	bitmap = (ulong)va_arg(ap, ulong);
+	if (!bitmap)
+		return API_EINVAL;

seems to me that this NULL pointer check belongs in the lcd core

api/api_display.c line 62

Quoted 11 lines
api/api_display.c new file +8 -0
 
+int display_draw_bitmap(ulong bitmap, int x, int y)
+{
+	int err = 0;
+#ifdef CONFIG_LCD
+	err |= lcd_display_bitmap(bitmap, x, y);
+#endif
+	return err;
+}

i think this should read:
int display_draw_bitmap(ulong bitmap, int x, int y) {

#ifdef CONFIG_LCD
	return lcd_display_bitmap(bitmap, x, y);
#else
	return API_ENODEV;

#endif
}

include/video_font.h line 38

Quoted 10 lines
include/video_font.h +6 -0
 
+/*
+ * Adding unused attribute here so that compiler will not complain
+ * video_fontdata is not used in source files that only use
+ * VIDEO_FONT_* (e.g., api/api_display.c).
+ */
+__attribute__ ((unused))
 static unsigned char video_fontdata[VIDEO_FONT_SIZE] = {

i don't think this is right. we should split the data from the rest of the defines/structs.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111020/53c09ffb/attachment.pgp

#32 lore raw

v5 cover export LCD device to external apps

In reply to Che-Liang Chiou

This patch set exports LCD clearing and bitmap-rendering on screen functions to external apps, and provides a unified interface of accessing them.

Che-Liang Chiou (4):
lcd: add clear and draw bitmap declaration
tools: logo: split bmp arrays from bmp_logo.h
font: split font data from video_font.h
api: export LCD device to external apps

 Makefile                        |    1 +
 api/Makefile                    |    3 +-
 api/api.c                       |   47 +
 api/api_display.c               |   74 +
 api/api_private.h               |    4 +
 arch/powerpc/cpu/mpc8xx/video.c |    1 +
 board/mcc200/lcd.c              |    4 +-
 common/cmd_bmp.c                |    4 +-
 common/lcd.c                    |   16 +-
 drivers/video/cfb_console.c     |    2 +
 drivers/video/sed156x.c         |    1 +
 examples/api/demo.c             |   31 +
 examples/api/glue.c             |   31 +
 examples/api/glue.h             |    5 +
 include/api_public.h            |   16 +
 include/lcd.h                   |    2 +
 include/video_font.h            | 4614 +--------------------------------------
 include/video_font_data.h       | 4639 +++++++++++++++++++++++++++++++++++++++
 tools/Makefile                  |    8 +-
 tools/bmp_logo.c                |   80 +-
 20 files changed, 4940 insertions(+), 4643 deletions(-)
 create mode 100644 api/api_display.c
 create mode 100644 include/video_font_data.h
Signature · 1 line
1.7.3.1
#33 lore raw

PATCH v5 1/4 lcd: add clear and draw bitmap declaration

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.

---

Changes in V5
Remove inline extern declaration from cmd_bmp.c

Changes in V4
Remove support of video device, which is untested and will leave to future work

Changes in V3
Rebase to ToT

Changes in V2
Fix style errors

 common/cmd_bmp.c |    4 +---
 common/lcd.c     |   14 ++++++++++----
 include/lcd.h    |    2 ++
 3 files changed, 13 insertions(+), 7 deletions(-)
common/cmd_bmp.c +1 -3
index 23fc82f..682f395 100644
@@ -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);
 
common/lcd.c +10 -4
index d9cb8ca..6d91310 100644
@@ -353,7 +353,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,8 +401,7 @@ static int lcd_clear (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]
 
 	console_col = 0;
 	console_row = 0;
-
-	return (0);
+	lcd_sync();
 }
 
 U_BOOT_CMD(
@@ -413,7 +419,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 */
include/lcd.h +2 -0
index 0e098d9..39af14a 100644
@@ -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);
Signature · 1 line
1.7.3.1
#35 lore raw

PATCH v6 1/4 lcd: add clear and draw bitmap declaration

In reply to Che-Liang Chiou

From: Che-liang Chiou <[email protected]>

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.

---
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(-)
common/cmd_bmp.c +1 -3
index 23fc82f..682f395 100644
@@ -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);
 
common/lcd.c +10 -6
index d9cb8ca..20e97b9 100644
@@ -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 */
include/lcd.h +2 -0
index 89cc90c..83b50f4 100644
@@ -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);
Signature · 1 line
1.7.1
#36 lore raw

PATCH v6 1/4 lcd: add clear and draw bitmap declaration

Quoted 26 lines · On Sun, 30 Oct 2011 19:21:14 +0100 Anatolij Gustschin <[email protected]> wrote:

From: Che-liang Chiou <[email protected]>

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.

---
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

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

Applied to u-boot-video/master, thanks.

Anatolij

#37 lore raw

PATCH v5 2/4 tools: logo: split bmp arrays from bmp_logo.h

In reply to Che-Liang Chiou

The generated header bmp_logo.h is useful even outside common/lcd.c for the logo dimension. However, the problem is, the generated bmp_logo.h cannot be included multiple times because bmp_logo_palette[] and bmp_logo_bitmap[] are defined in the bmp_logo.h.

This patch fixes this by defining these arrays in another header bmp_logo_data.h and in bmp_logo.h only declaring these arrays.

---

Changes in V5
Split bmp arrays from bmp_logo.h to bmp_logo_data.h

Changes in V4
None

Changes in V3
Add to the patch set

 Makefile                    |    1 +
 common/lcd.c                |    1 +
 drivers/video/cfb_console.c |    1 +
 tools/Makefile              |    8 ++++-
 tools/bmp_logo.c            |   80 ++++++++++++++++++++++++++++++++-----------
 5 files changed, 70 insertions(+), 21 deletions(-)
Makefile +1 -0
index e9a153c..d35f2b5 100644
@@ -947,6 +947,7 @@ clean:
 	       $(obj)arch/blackfin/cpu/bootrom-asm-offsets.[chs]	  \
 	       $(obj)arch/blackfin/cpu/init.{lds,elf}
 	@rm -f $(obj)include/bmp_logo.h
+	@rm -f $(obj)include/bmp_logo_data.h
 	@rm -f $(obj)lib/asm-offsets.s
 	@rm -f $(obj)include/generated/asm-offsets.h
 	@rm -f $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
common/lcd.c +1 -0
index 6d91310..dd4d37b 100644
@@ -63,6 +63,7 @@
 /************************************************************************/
 #ifdef CONFIG_LCD_LOGO
 # include <bmp_logo.h>		/* Get logo data, width and height	*/
+# include <bmp_logo_data.h>
 # if (CONSOLE_COLOR_WHITE >= BMP_LOGO_OFFSET) && (LCD_BPP != LCD_COLOR16)
 #  error Default Color Map overlaps with Logo Color Map
 # endif
drivers/video/cfb_console.c +1 -0
index 4e653b8..8d0c496 100644
@@ -285,6 +285,7 @@ void console_cursor(int state);
 #ifdef	CONFIG_VIDEO_LOGO
 #ifdef	CONFIG_VIDEO_BMP_LOGO
 #include <bmp_logo.h>
+#include <bmp_logo_data.h>
 #define VIDEO_LOGO_WIDTH	BMP_LOGO_WIDTH
 #define VIDEO_LOGO_HEIGHT	BMP_LOGO_HEIGHT
 #define VIDEO_LOGO_LUT_OFFSET	BMP_LOGO_OFFSET
tools/Makefile +7 -1
index fc741d3..f750ad2 100644
@@ -110,8 +110,11 @@ LIBFDT_OBJ_FILES-y += fdt_wip.o
 
 # Generated LCD/video logo
 LOGO_H = $(OBJTREE)/include/bmp_logo.h
+LOGO_DATA_H = $(OBJTREE)/include/bmp_logo_data.h
 LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_H)
+LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_DATA_H)
 LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_H)
+LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_DATA_H)
 
 ifeq ($(LOGO_BMP),)
 LOGO_BMP= logos/denx.bmp
@@ -234,7 +237,10 @@ else
 endif
 
 $(LOGO_H):	$(obj)bmp_logo $(LOGO_BMP)
-	$(obj)./bmp_logo $(LOGO_BMP) >$@
+	$(obj)./bmp_logo --gen-info $(LOGO_BMP) > $@
+
+$(LOGO_DATA_H):	$(obj)bmp_logo $(LOGO_BMP)
+	$(obj)./bmp_logo --gen-data $(LOGO_BMP) > $@
 
 #########################################################################
 
tools/bmp_logo.c +60 -20

142 lines not on this page · raw message

Signature · 1 line
1.7.3.1
#39 lore raw

PATCH v6 2/4 tools: logo: split bmp arrays from bmp_logo.h

In reply to Che-Liang Chiou

From: Che-liang Chiou <[email protected]>

The generated header bmp_logo.h is useful even outside common/lcd.c for the logo dimension. However, the problem is, the generated bmp_logo.h cannot be included multiple times because bmp_logo_palette[] and bmp_logo_bitmap[] are defined in the bmp_logo.h.

This patch fixes this by defining these arrays in another header bmp_logo_data.h and in bmp_logo.h only declaring these arrays.

---
Changes since V5:
- add bmp_logo_data.h to .gitignore

 Makefile                    |    1 +
 common/lcd.c                |    1 +
 drivers/video/cfb_console.c |    1 +
 include/.gitignore          |    1 +
 tools/Makefile              |    8 ++++-
 tools/bmp_logo.c            |   80 ++++++++++++++++++++++++++++++++-----------
 6 files changed, 71 insertions(+), 21 deletions(-)
Makefile +1 -0
index 9ef33f9..b620e75 100644
@@ -866,6 +866,7 @@ clean:
 	       $(obj)arch/blackfin/cpu/bootrom-asm-offsets.[chs]	  \
 	       $(obj)arch/blackfin/cpu/init.{lds,elf}
 	@rm -f $(obj)include/bmp_logo.h
+	@rm -f $(obj)include/bmp_logo_data.h
 	@rm -f $(obj)lib/asm-offsets.s
 	@rm -f $(obj)include/generated/asm-offsets.h
 	@rm -f $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
common/lcd.c +1 -0
index 20e97b9..504b8f6 100644
@@ -63,6 +63,7 @@
 /************************************************************************/
 #ifdef CONFIG_LCD_LOGO
 # include <bmp_logo.h>		/* Get logo data, width and height	*/
+# include <bmp_logo_data.h>
 # if (CONSOLE_COLOR_WHITE >= BMP_LOGO_OFFSET) && (LCD_BPP != LCD_COLOR16)
 #  error Default Color Map overlaps with Logo Color Map
 # endif
drivers/video/cfb_console.c +1 -0
index 1863563..24e5761 100644
@@ -285,6 +285,7 @@ void console_cursor(int state);
 #ifdef	CONFIG_VIDEO_LOGO
 #ifdef	CONFIG_VIDEO_BMP_LOGO
 #include <bmp_logo.h>
+#include <bmp_logo_data.h>
 #define VIDEO_LOGO_WIDTH	BMP_LOGO_WIDTH
 #define VIDEO_LOGO_HEIGHT	BMP_LOGO_HEIGHT
 #define VIDEO_LOGO_LUT_OFFSET	BMP_LOGO_OFFSET
include/.gitignore +1 -0
index ec224c5..7cd3e90 100644
@@ -1,5 +1,6 @@
 /autoconf.mk*
 /asm
 /bmp_logo.h
+/bmp_logo_data.h
 /config.h
 /config.mk
tools/Makefile +7 -1
index df56a25..948ec19 100644
@@ -111,8 +111,11 @@ LIBFDT_OBJ_FILES-y += fdt_wip.o
 
 # Generated LCD/video logo
 LOGO_H = $(OBJTREE)/include/bmp_logo.h
+LOGO_DATA_H = $(OBJTREE)/include/bmp_logo_data.h
 LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_H)
+LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_DATA_H)
 LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_H)
+LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_DATA_H)
 
 ifeq ($(LOGO_BMP),)
 LOGO_BMP= logos/denx.bmp
@@ -236,7 +239,10 @@ else
 endif
 
 $(LOGO_H):	$(obj)bmp_logo $(LOGO_BMP)
-	$(obj)./bmp_logo $(LOGO_BMP) >$@
+	$(obj)./bmp_logo --gen-info $(LOGO_BMP) > $@
+
+$(LOGO_DATA_H):	$(obj)bmp_logo $(LOGO_BMP)
+	$(obj)./bmp_logo --gen-data $(LOGO_BMP) > $@
 
 #########################################################################
 
tools/bmp_logo.c +60 -20

142 lines not on this page · raw message

Signature · 1 line
1.7.1
#40 lore raw

PATCH v6 2/4 tools: logo: split bmp arrays from bmp_logo.h

Quoted 17 lines · On Sun, 30 Oct 2011 19:24:59 +0100 Anatolij Gustschin <[email protected]> wrote:

From: Che-liang Chiou <[email protected]>

The generated header bmp_logo.h is useful even outside common/lcd.c for the logo dimension. However, the problem is, the generated bmp_logo.h cannot be included multiple times because bmp_logo_palette[] and bmp_logo_bitmap[] are defined in the bmp_logo.h.

This patch fixes this by defining these arrays in another header bmp_logo_data.h and in bmp_logo.h only declaring these arrays.

---
Changes since V5:
- add bmp_logo_data.h to .gitignore

Quoted 7 lines
 Makefile                    |    1 +
 common/lcd.c                |    1 +
 drivers/video/cfb_console.c |    1 +
 include/.gitignore          |    1 +
 tools/Makefile              |    8 ++++-
 tools/bmp_logo.c            |   80 ++++++++++++++++++++++++++++++++-----------
 6 files changed, 71 insertions(+), 21 deletions(-)

Applied to u-boot-video/master, thanks.

Anatolij

#41 lore raw

PATCH v5 3/4 font: split font data from video_font.h

In reply to Che-Liang Chiou

While video_font.h is useful even without referencing the font data, it is not possible to be included multiple times because it defines font data array right in the header.

This patch splits the font data array into video_font_data.h and so now video_font.h can be included multiple times. This at least solves the code duplication in board/mcc200/lcd.c.

---

Changes in V5
Split font arrays from video_font.h to video_font_data.h

 arch/powerpc/cpu/mpc8xx/video.c |    1 +
 board/mcc200/lcd.c              |    4 +-
 common/lcd.c                    |    1 +
 drivers/video/cfb_console.c     |    1 +
 drivers/video/sed156x.c         |    1 +
 include/video_font.h            | 4614 +--------------------------------------
 include/video_font_data.h       | 4639 +++++++++++++++++++++++++++++++++++++++
 7 files changed, 4647 insertions(+), 4614 deletions(-)
 create mode 100644 include/video_font_data.h
arch/powerpc/cpu/mpc8xx/video.c +1 -0
index 7725c67..1bbf4cc 100644
@@ -125,6 +125,7 @@ DECLARE_GLOBAL_DATA_PTR;
 /************************************************************************/
 
 #include <video_font.h>			/* Get font data, width and height */
+#include <video_font_data.h>
 
 #ifdef CONFIG_VIDEO_LOGO
 #include <video_logo.h>			/* Get logo data, width and height */
board/mcc200/lcd.c +3 -1
index 726366d..d8f754c 100644
@@ -55,6 +55,9 @@
 #define PSOC_RETRIES	10	/* each of PSOC_WAIT_TIME */
 #define PSOC_WAIT_TIME	10	/* usec */
 
+#include <video_font.h>
+#define FONT_WIDTH	VIDEO_FONT_WIDTH
+
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
@@ -185,7 +188,6 @@ void lcd_enable (void)
 }
 #ifdef CONFIG_PROGRESSBAR
 
-#define FONT_WIDTH      8 /* the same as VIDEO_FONT_WIDTH in video_font.h */
 void show_progress (int size, int tot)
 {
 	int cnt;
common/lcd.c +1 -0
index dd4d37b..0edeb89 100644
@@ -57,6 +57,7 @@
 /* ** FONT DATA								*/
 /************************************************************************/
 #include <video_font.h>		/* Get font data, width and height	*/
+#include <video_font_data.h>
 
 /************************************************************************/
 /* ** LOGO DATA								*/
drivers/video/cfb_console.c +1 -0
index 8d0c496..9c6d89e 100644
@@ -202,6 +202,7 @@
 #include <linux/types.h>
 #include <stdio_dev.h>
 #include <video_font.h>
+#include <video_font_data.h>
 
 #if defined(CONFIG_CMD_DATE)
 #include <rtc.h>
drivers/video/sed156x.c +1 -0
index 707250d..a610b74 100644
@@ -41,6 +41,7 @@
 
 /* include the font data */
 #include <video_font.h>
+#include <video_font_data.h>
 
 #if VIDEO_FONT_WIDTH != 8 || VIDEO_FONT_HEIGHT != 16
 #error Expecting VIDEO_FONT_WIDTH == 8 && VIDEO_FONT_HEIGHT == 16
include/video_font.h +1 -4613

2,956 lines not on this page · raw message

include/video_font_data.h new file +4639 -0

4,639 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.3.1

Part of the diff is not shown here. View the raw message.

#43 lore raw

PATCH v5 3/4 font: split font data from video_font.h

In reply to Che-Liang Chiou

Hi,

On Fri, 21 Oct 2011 17:04:21 +0800
Che-Liang Chiou <[email protected]> wrote:
...

Quoted 4 lines
 include/video_font.h            | 4614 +--------------------------------------
 include/video_font_data.h       | 4639 +++++++++++++++++++++++++++++++++++++++
 7 files changed, 4647 insertions(+), 4614 deletions(-)
 create mode 100644 include/video_font_data.h

Please next time additionally use '-C' Option for 'git format-patch ...' when generating patches with code movement. It will produce smaller patches, e.g.:
...

 include/video_font.h                        | 4614 +--------------------------
 include/{video_font.h => video_font_data.h} |    9 +-
 7 files changed, 10 insertions(+), 4621 deletions(-)
 copy include/{video_font.h => video_font_data.h} (99%)

But you do not have to resubmit this patch, I think.

Thanks,
Anatolij

#44 lore raw

PATCH v5 3/4 font: split font data from video_font.h

Hi,

Quoted 1 line · Anatolij Gustschin

Please next time additionally use '-C' Option for 'git format-patch ...'

Thanks for the advice. I will add -C option.

Regards,
Che-Liang

#45 lore raw

PATCH v5 3/4 font: split font data from video_font.h

In reply to Che-Liang Chiou
Quoted 14 lines · On Fri, 21 Oct 2011 17:04:21 +0800 Che-Liang Chiou <[email protected]> wrote:

While video_font.h is useful even without referencing the font data, it is not possible to be included multiple times because it defines font data array right in the header.

This patch splits the font data array into video_font_data.h and so now video_font.h can be included multiple times. This at least solves the code duplication in board/mcc200/lcd.c.

---

Changes in V5
Split font arrays from video_font.h to video_font_data.h

Quoted 9 lines
 arch/powerpc/cpu/mpc8xx/video.c |    1 +
 board/mcc200/lcd.c              |    4 +-
 common/lcd.c                    |    1 +
 drivers/video/cfb_console.c     |    1 +
 drivers/video/sed156x.c         |    1 +
 include/video_font.h            | 4614 +--------------------------------------
 include/video_font_data.h       | 4639 +++++++++++++++++++++++++++++++++++++++
 7 files changed, 4647 insertions(+), 4614 deletions(-)
 create mode 100644 include/video_font_data.h

Applied to u-boot-video/master, thanks.

Anatolij

#46 lore raw

PATCH v5 4/4 api: export LCD device to external apps

In reply to Che-Liang Chiou

This patch exports LCD info-query and bitmap-rendering functions to external apps.

This patch is tested on a Seaboard. Because the LCD driver is not yet upstreamed, the test was done in a local downstream repo.

---

Changes in V5
Clean up logic

Changes in V4
Remove support of video device, which is untested and will leave to future work

Changes in V3
Rebase to ToT

Changes in V2
Fix style errors

 api/Makefile         |    3 +-
 api/api.c            |   47 +++++++++++++++++++++++++++++++
 api/api_display.c    |   74 ++++++++++++++++++++++++++++++++++++++++++++++++++
 api/api_private.h    |    4 +++
 examples/api/demo.c  |   31 +++++++++++++++++++++
 examples/api/glue.c  |   31 +++++++++++++++++++++
 examples/api/glue.h  |    5 +++
 include/api_public.h |   16 +++++++++++
 8 files changed, 210 insertions(+), 1 deletions(-)
 create mode 100644 api/api_display.c
api/Makefile +2 -1
index 2a64c4d..0e99f74 100644
@@ -24,7 +24,8 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)libapi.o
 
-COBJS-$(CONFIG_API) += api.o api_net.o api_storage.o api_platform-$(ARCH).o
+COBJS-$(CONFIG_API) += api.o api_display.o api_net.o api_storage.o \
+		       api_platform-$(ARCH).o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
api/api.c +47 -0

59 lines not on this page · raw message

api/api_display.c new file +74 -0

74 lines not on this page · raw message

api/api_private.h +4 -0
index 94a7fc5..988f702 100644
@@ -45,4 +45,8 @@ int		dev_write_net(void *, void *, int);
 
 void dev_stor_init(void);
 
+int display_get_info(int type, struct display_info *di);
+int display_draw_bitmap(ulong bitmap, int x, int y);
+void display_clear(void);
+
 #endif /* _API_PRIVATE_H_ */
examples/api/demo.c +31 -0
index 65e7491..19d38f6 100644
@@ -48,6 +48,7 @@ int main(int argc, char * const argv[])
 	ulong start, now;
 	struct device_info *di;
 	lbasize_t rlen;
+	struct display_info disinfo;
 
 	if (!api_search_sig(&sig))
 		return -1;
@@ -176,6 +177,36 @@ int main(int argc, char * const argv[])
 	while ((env = ub_env_enum(env)) != NULL)
 		printf("%s = %s\n", env, ub_env_get(env));
 
+	printf("\n*** Display ***\n");
+
+	if (ub_display_get_info(DISPLAY_TYPE_LCD, &disinfo)) {
+		printf("LCD info: failed\n");
+	} else {
+		printf("LCD info:\n");
+		printf("  pixel width:  %d\n", disinfo.pixel_width);
+		printf("  pixel height: %d\n", disinfo.pixel_height);
+		printf("  screen rows:  %d\n", disinfo.screen_rows);
+		printf("  screen cols:  %d\n", disinfo.screen_cols);
+	}
+	if (ub_display_get_info(DISPLAY_TYPE_VIDEO, &disinfo)) {
+		printf("video info: failed\n");
+	} else {
+		printf("video info:\n");
+		printf("  pixel width:  %d\n", disinfo.pixel_width);
+		printf("  pixel height: %d\n", disinfo.pixel_height);
+		printf("  screen rows:  %d\n", disinfo.screen_rows);
+		printf("  screen cols:  %d\n", disinfo.screen_cols);
+	}
+
+	printf("*** Press any key to continue ***\n");
+	printf("got char 0x%x\n", ub_getc());
+
+	/*
+	 * This only clears messages on screen, not on serial port. It is
+	 * equivalent to a no-op if no display is available.
+	 */
+	ub_display_clear();
+
 	/* reset */
 	printf("\n*** Resetting board ***\n");
 	ub_reset();
examples/api/glue.c +31 -0
index eff6a7e..d907e3f 100644
@@ -402,3 +402,34 @@ const char * ub_env_enum(const char *last)
 
 	return env_name;
 }
+
+/****************************************
+ *
+ * display
+ *
+ ****************************************/
+
+int ub_display_get_info(int type, struct display_info *di)
+{
+	int err = 0;
+
+	if (!syscall(API_DISPLAY_GET_INFO, &err, (uint32_t)type, (uint32_t)di))
+		return API_ESYSC;
+
+	return err;
+}
+
+int ub_display_draw_bitmap(ulong bitmap, int x, int y)
+{
+	int err = 0;
+
+	if (!syscall(API_DISPLAY_DRAW_BITMAP, &err, bitmap, x, y))
+		return API_ESYSC;
+
+	return err;
+}
+
+void ub_display_clear(void)
+{
+	syscall(API_DISPLAY_CLEAR, NULL);
+}
examples/api/glue.h +5 -0
index 6bf47d0..e43f7d9 100644
@@ -77,4 +77,9 @@ int			ub_dev_send(int handle, void *buf, int len);
 int			ub_dev_recv(int handle, void *buf, int len, int *rlen);
 struct device_info *	ub_dev_get(int);
 
+/* display */
+int ub_display_get_info(int type, struct display_info *di);
+int ub_display_draw_bitmap(ulong bitmap, int x, int y);
+void ub_display_clear(void);
+
 #endif /* _API_GLUE_H_ */
include/api_public.h +16 -0
index 5940d81..4420c99 100644
@@ -90,6 +90,9 @@ enum {
 	API_ENV_ENUM,
 	API_ENV_GET,
 	API_ENV_SET,
+	API_DISPLAY_GET_INFO,
+	API_DISPLAY_DRAW_BITMAP,
+	API_DISPLAY_CLEAR,
 	API_MAXCALL
 };
 
@@ -152,4 +155,17 @@ struct device_info {
 	int	state;
 };
 
+#define DISPLAY_TYPE_LCD	0x0001
+#define DISPLAY_TYPE_VIDEO	0x0002
+
+struct display_info {
+	int type;
+	/* screen size in pixels */
+	int pixel_width;
+	int pixel_height;
+	/* screen size in rows and columns of text */
+	int screen_rows;
+	int screen_cols;
+};
+
 #endif /* _API_PUBLIC_H_ */
Signature · 1 line
1.7.3.1
#47 lore raw

PATCH v5 4/4 api: export LCD device to external apps

Quoted 22 lines · On Fri, 21 Oct 2011 17:04:22 +0800 Che-Liang Chiou <[email protected]> wrote:

This patch exports LCD info-query and bitmap-rendering functions to external apps.

This patch is tested on a Seaboard. Because the LCD driver is not yet upstreamed, the test was done in a local downstream repo.

---

Changes in V5
Clean up logic

Changes in V4
Remove support of video device, which is untested and will leave to future work

Changes in V3
Rebase to ToT

Changes in V2
Fix style errors

Quoted 10 lines
 api/Makefile         |    3 +-
 api/api.c            |   47 +++++++++++++++++++++++++++++++
 api/api_display.c    |   74 ++++++++++++++++++++++++++++++++++++++++++++++++++
 api/api_private.h    |    4 +++
 examples/api/demo.c  |   31 +++++++++++++++++++++
 examples/api/glue.c  |   31 +++++++++++++++++++++
 examples/api/glue.h  |    5 +++
 include/api_public.h |   16 +++++++++++
 8 files changed, 210 insertions(+), 1 deletions(-)
 create mode 100644 api/api_display.c

Applied to u-boot-video/master, thanks.

Anatolij

#48 lore raw

PATCH v5 1/4 lcd: add clear and draw bitmap declaration

In reply to Che-Liang Chiou

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.

---

Changes in V5
Remove inline extern declaration from cmd_bmp.c

Changes in V4
Remove support of video device, which is untested and will leave to future work

Changes in V3
Rebase to ToT

Changes in V2
Fix style errors

 common/cmd_bmp.c |    4 +---
 common/lcd.c     |   14 ++++++++++----
 include/lcd.h    |    2 ++
 3 files changed, 13 insertions(+), 7 deletions(-)
common/cmd_bmp.c +1 -3
index 23fc82f..682f395 100644
@@ -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);
 
common/lcd.c +9 -2
index d9cb8ca..6d91310 100644
@@ -353,7 +353,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 */
@@ -413,7 +419,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 */
include/lcd.h +2 -0
index 0e098d9..39af14a 100644
@@ -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);
Signature · 1 line
1.7.3.1
#49 lore raw

PATCH v5 1/4 lcd: add clear and draw bitmap declaration

Quoted 3 lines · On Friday 21 October 2011 05:07:03 Che-Liang Chiou wrote:

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.

seems like you sent out the same patch a few min before this. was this posting an accident ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111030/642d1436/attachment.pgp