[U-Boot] [PATCH] video: add command cls

Patrick Delaunay patrick.delaunay at st.com
Thu Nov 8 17:24:32 UTC 2018


Implement the existing command cls, for clear screen,
when CONFIG_DM_VIDEO is activated.

This command was defined for old LCD framework (not dm) in
  common/lcd.c:251
  U_BOOT_CMD(cls,	1, 1, do_lcd_clear, "clear screen", "");

This command is useful to clear existing output (vidconsole) before
to display splashscreen with bmp command.

Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
---
Example of simple splashscreen in DISTRO script: boot.scr.uimg

if load ${devtype} ${devnum}:${distro_bootpart} ${splashimage} splash.bmp
then
   env set stdout "serial"
   env set stderr "serial"
   cls
   bmp display ${splashimage}
fi

 drivers/video/video-uclass.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index 44dfa71..5fe49a5 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -300,3 +300,17 @@ UCLASS_DRIVER(video) = {
 	.per_device_auto_alloc_size	= sizeof(struct video_priv),
 	.per_device_platdata_auto_alloc_size = sizeof(struct video_uc_platdata),
 };
+
+static int do_video_clear(cmd_tbl_t *cmdtp, int flag, int argc,
+			  char *const argv[])
+{
+	struct udevice *dev;
+
+	if (uclass_first_device_err(UCLASS_VIDEO, &dev))
+		return CMD_RET_FAILURE;
+	video_clear(dev);
+
+	return 0;
+}
+
+U_BOOT_CMD(cls,	1, 1, do_video_clear, "clear screen", "");
-- 
2.7.4



More information about the U-Boot mailing list