aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-10-06 08:36:06 -0600
committerAnatolij Gustschin <agust@denx.de>2022-10-30 19:55:22 +0100
commitf029f90e7df9ad566d0bb7f9ea80de108be67fb0 (patch)
treee8f95b21b1aa85abc073e7d003937bf0fc148bb1 /cmd
parent92fd6a12206718948ba0f8f8bf1db89f6f73112c (diff)
downloadu-boot-f029f90e7df9ad566d0bb7f9ea80de108be67fb0.zip
u-boot-f029f90e7df9ad566d0bb7f9ea80de108be67fb0.tar.gz
u-boot-f029f90e7df9ad566d0bb7f9ea80de108be67fb0.tar.bz2
video: Move the console commands to cmd/
Move these commands and the implementation to the cmd/ directory, which is where most commands are kept. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> [agust: keep vidconsole_position_cursor() in vidconsole uclass] Signed-off-by: Anatolij Gustschin <agust@denx.de>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/Kconfig12
-rw-r--r--cmd/Makefile2
-rw-r--r--cmd/video.c61
3 files changed, 75 insertions, 0 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 41cf1d4..51dbbf8 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -2161,6 +2161,18 @@ config CMD_UUID
The two commands are very similar except for the endianness of the
output.
+config CMD_VIDCONSOLE
+ bool "lcdputs and setcurs"
+ depends on DM_VIDEO
+ default y
+ help
+ Enabling this will provide 'setcurs' and 'lcdputs' commands which
+ support cursor positioning and drawing strings on the video
+ console (framebuffer).
+
+ The name 'lcdputs' is a bit of a misnomer, but so named because the
+ video device is often an LCD.
+
endmenu
source "cmd/ti/Kconfig"
diff --git a/cmd/Makefile b/cmd/Makefile
index c95e09d..ac9226f 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -178,6 +178,8 @@ obj-$(CONFIG_CMD_WDT) += wdt.o
obj-$(CONFIG_CMD_LZMADEC) += lzmadec.o
obj-$(CONFIG_CMD_UFS) += ufs.o
obj-$(CONFIG_CMD_USB) += usb.o disk.o
+obj-$(CONFIG_CMD_VIDCONSOLE) += video.o
+
obj-$(CONFIG_CMD_FASTBOOT) += fastboot.o
obj-$(CONFIG_CMD_FS_UUID) += fs_uuid.o
diff --git a/cmd/video.c b/cmd/video.c
new file mode 100644
index 0000000..942f81c
--- /dev/null
+++ b/cmd/video.c
@@ -0,0 +1,61 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * video commands
+ *
+ * Copyright 2022 Google LLC
+ * Written by Simon Glass <sjg@chromium.org>
+ */
+
+#include <common.h>
+#include <command.h>
+#include <dm.h>
+#include <video.h>
+#include <video_console.h>
+
+static int do_video_setcursor(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ unsigned int col, row;
+ struct udevice *dev;
+
+ if (argc != 3)
+ return CMD_RET_USAGE;
+
+ if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev))
+ return CMD_RET_FAILURE;
+ col = dectoul(argv[1], NULL);
+ row = dectoul(argv[2], NULL);
+ vidconsole_position_cursor(dev, col, row);
+
+ return 0;
+}
+
+static int do_video_puts(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ struct udevice *dev;
+ int ret;
+
+ if (argc != 2)
+ return CMD_RET_USAGE;
+
+ if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev))
+ return CMD_RET_FAILURE;
+ ret = vidconsole_put_string(dev, argv[1]);
+ if (!ret)
+ ret = video_sync(dev->parent, false);
+
+ return ret ? CMD_RET_FAILURE : 0;
+}
+
+U_BOOT_CMD(
+ setcurs, 3, 1, do_video_setcursor,
+ "set cursor position within screen",
+ " <col> <row> in character"
+);
+
+U_BOOT_CMD(
+ lcdputs, 2, 1, do_video_puts,
+ "print string on video framebuffer",
+ " <string>"
+);