cmd: add clear screen 'cls' command
PATCH 1/1 cmd: add clear screen 'cls' command
Add common clear screen command for configurations CONFIG_DM_VIDEO, CONFIG_LCD and CONFIG_CFB_CONSOLE.
Remove the existing cls command implementation from lcd.c code and activate the command for all boards enabling CONFIG_LCD for compatibility reasons.
--- cmd/Kconfig | 7 ++++ cmd/Makefile | 1 + cmd/cls.c | 35 +++++++++++++++++++ common/lcd.c | 8 ----- configs/at91sam9261ek_dataflash_cs0_defconfig | 1 + configs/at91sam9261ek_dataflash_cs3_defconfig | 1 + configs/at91sam9261ek_nandflash_defconfig | 1 + configs/at91sam9263ek_dataflash_cs0_defconfig | 1 + configs/at91sam9263ek_dataflash_defconfig | 1 + configs/at91sam9263ek_nandflash_defconfig | 1 + configs/at91sam9263ek_norflash_boot_defconfig | 1 + configs/at91sam9263ek_norflash_defconfig | 1 + configs/at91sam9g10ek_dataflash_cs0_defconfig | 1 + configs/at91sam9g10ek_dataflash_cs3_defconfig | 1 + configs/at91sam9g10ek_nandflash_defconfig | 1 + configs/at91sam9m10g45ek_mmc_defconfig | 1 + configs/at91sam9m10g45ek_nandflash_defconfig | 1 + configs/at91sam9n12ek_mmc_defconfig | 1 + configs/at91sam9n12ek_nandflash_defconfig | 1 + configs/at91sam9n12ek_spiflash_defconfig | 1 + configs/at91sam9rlek_dataflash_defconfig | 1 + configs/at91sam9rlek_mmc_defconfig | 1 + configs/at91sam9rlek_nandflash_defconfig | 1 + configs/brxre1_defconfig | 1 + configs/cm_t3517_defconfig | 1 + configs/cm_t35_defconfig | 1 + configs/peach-pi_defconfig | 1 + configs/peach-pit_defconfig | 1 + configs/picosam9g45_defconfig | 1 + configs/pm9261_defconfig | 1 + configs/pm9263_defconfig | 1 + configs/snow_defconfig | 1 + configs/spring_defconfig | 1 + configs/zipitz2_defconfig | 1 + 34 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 cmd/cls.c
cmd/Kconfig +7 -0
@@ -1372,6 +1372,13 @@ config CMD_CONITRACE Enable the 'conitrace' command which displays the codes received from the console input as hexadecimal numbers. +config CMD_CLS + bool "Enable clear screen command 'cls'" + depends on CFB_CONSOLE || DM_VIDEO || LCD || VIDEO + help + Enable the 'cls' command which clears the screen contents + on video frame buffer. + config CMD_DISPLAY bool "Enable the 'display' command, for character displays" help
cmd/Makefile +1 -0
@@ -32,6 +32,7 @@ obj-$(CONFIG_CMD_BTRFS) += btrfs.o obj-$(CONFIG_CMD_CACHE) += cache.o obj-$(CONFIG_CMD_CBFS) += cbfs.o obj-$(CONFIG_CMD_CLK) += clk.o +obj-$(CONFIG_CMD_CLS) += cls.o obj-$(CONFIG_CMD_CONFIG) += config.o obj-$(CONFIG_CMD_CONITRACE) += conitrace.o obj-$(CONFIG_CMD_CONSOLE) += console.o
cmd/cls.c new file +35 -0
@@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* (C) Copyright 2018 +* DENX Software Engineering, Anatolij Gustschin <[email protected]> +* +* cls - clear screen command +*/ +#include <common.h> +#include <command.h> +#include <dm.h> +#include <lcd.h> +#include <video.h> + +static int do_video_clear (cmd_tbl_t *cmdtp,int flag,int argc, +char *const argv[]) +{ +#if defined(CONFIG_DM_VIDEO ) +struct udevice *dev; + +if (uclass_first_device_err (UCLASS_VIDEO , &dev)) +return CMD_RET_FAILURE ; + +if (video_clear (dev)) +return CMD_RET_FAILURE ; +#elif defined(CONFIG_CFB_CONSOLE ) +video_clear (); +#elif defined(CONFIG_LCD ) +lcd_clear (); +#else +return CMD_RET_FAILURE ; +#endif +return CMD_RET_SUCCESS ; +} + +U_BOOT_CMD (cls,1 ,1 , do_video_clear,"clear screen" ,"" );
common/lcd.c +0 -8
@@ -242,14 +242,6 @@ void lcd_clear(void)lcd_sync (); } -static int do_lcd_clear (cmd_tbl_t *cmdtp,int flag,int argc, -char *const argv[]) -{ -lcd_clear (); -return 0 ; -} -U_BOOT_CMD (cls,1 ,1 , do_lcd_clear,"clear screen" ,"" ); -static int lcd_init (void *lcdbase) {debug ("[LCD] Initializing LCD frambuffer at %p\n" , lcdbase);
configs/at91sam9261ek_dataflash_cs0_defconfig +1 -0
@@ -17,6 +17,7 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_SYS_PROMPT="U-Boot> " # CONFIG_CMD_BDI is not set +CONFIG_CMD_CLS=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_LOADS is not set CONFIG_CMD_NAND=y
configs/at91sam9261ek_dataflash_cs3_defconfig +1 -0
@@ -17,6 +17,7 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_SYS_PROMPT="U-Boot> " # CONFIG_CMD_BDI is not set +CONFIG_CMD_CLS=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_LOADS is not set CONFIG_CMD_NAND=y
configs/at91sam9261ek_nandflash_defconfig +1 -0
@@ -17,6 +17,7 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_SYS_PROMPT="U-Boot> " # CONFIG_CMD_BDI is not set +CONFIG_CMD_CLS=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_LOADS is not set CONFIG_CMD_NAND=y
configs/at91sam9263ek_dataflash_cs0_defconfig +1 -0
@@ -19,6 +19,7 @@ CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="U-Boot> " # CONFIG_CMD_BDI is not set CONFIG_CMD_BOOTZ=y +CONFIG_CMD_CLS=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_LOADS is not set CONFIG_CMD_MMC=y
configs/at91sam9263ek_dataflash_defconfig +1 -0
@@ -19,6 +19,7 @@ CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="U-Boot> " # CONFIG_CMD_BDI is not set CONFIG_CMD_BOOTZ=y +CONFIG_CMD_CLS=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_LOADS is not set CONFIG_CMD_MMC=y
configs/at91sam9263ek_nandflash_defconfig +1 -0
@@ -19,6 +19,7 @@ CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="U-Boot> " # CONFIG_CMD_BDI is not set CONFIG_CMD_BOOTZ=y +CONFIG_CMD_CLS=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_LOADS is not set CONFIG_CMD_MMC=y
configs/at91sam9263ek_norflash_boot_defconfig +1 -0
@@ -17,6 +17,7 @@ CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="U-Boot> " # CONFIG_CMD_BDI is not set CONFIG_CMD_BOOTZ=y +CONFIG_CMD_CLS=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_LOADS is not set CONFIG_CMD_MMC=y
configs/at91sam9263ek_norflash_defconfig +1 -0
@@ -17,6 +17,7 @@ CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="U-Boot> " # CONFIG_CMD_BDI is not set CONFIG_CMD_BOOTZ=y +CONFIG_CMD_CLS=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_LOADS is not set CONFIG_CMD_MMC=y
configs/at91sam9g10ek_dataflash_cs0_defconfig +1 -0
@@ -17,6 +17,7 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_SYS_PROMPT="U-Boot> " # CONFIG_CMD_BDI is not set +CONFIG_CMD_CLS=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_LOADS is not set CONFIG_CMD_NAND=y
configs/at91sam9g10ek_dataflash_cs3_defconfig +1 -0
@@ -17,6 +17,7 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_SYS_PROMPT="U-Boot> " # CONFIG_CMD_BDI is not set +CONFIG_CMD_CLS=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_LOADS is not set CONFIG_CMD_NAND=y
configs/at91sam9g10ek_nandflash_defconfig +1 -0
@@ -17,6 +17,7 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_SYS_PROMPT="U-Boot> " # CONFIG_CMD_BDI is not set +CONFIG_CMD_CLS=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_LOADS is not set CONFIG_CMD_NAND=y
configs/at91sam9m10g45ek_mmc_defconfig +1 -0
@@ -19,6 +19,7 @@ CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="U-Boot> " # CONFIG_CMD_BDI is not set CONFIG_CMD_BOOTZ=y +CONFIG_CMD_CLS=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_FLASH is not set # CONFIG_CMD_LOADS is not set
configs/at91sam9m10g45ek_nandflash_defconfig +1 -0
@@ -19,6 +19,7 @@ CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="U-Boot> " # CONFIG_CMD_BDI is not set CONFIG_CMD_BOOTZ=y +CONFIG_CMD_CLS=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_FLASH is not set # CONFIG_CMD_LOADS is not set
configs/at91sam9n12ek_mmc_defconfig +1 -0
@@ -16,6 +16,7 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="U-Boot> " CONFIG_CMD_BOOTZ=y +CONFIG_CMD_CLS=y # CONFIG_CMD_FLASH is not set CONFIG_CMD_MMC=y CONFIG_CMD_NAND=y
configs/at91sam9n12ek_nandflash_defconfig +1 -0
@@ -16,6 +16,7 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="U-Boot> " CONFIG_CMD_BOOTZ=y +CONFIG_CMD_CLS=y # CONFIG_CMD_FLASH is not set CONFIG_CMD_MMC=y CONFIG_CMD_NAND=y
configs/at91sam9n12ek_spiflash_defconfig +1 -0
@@ -16,6 +16,7 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="U-Boot> " CONFIG_CMD_BOOTZ=y +CONFIG_CMD_CLS=y # CONFIG_CMD_FLASH is not set CONFIG_CMD_MMC=y CONFIG_CMD_NAND=y
configs/at91sam9rlek_dataflash_defconfig +1 -0
@@ -19,6 +19,7 @@ CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="U-Boot> " # CONFIG_CMD_BDI is not set CONFIG_CMD_BOOTZ=y +CONFIG_CMD_CLS=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_LOADS is not set CONFIG_CMD_MMC=y
configs/at91sam9rlek_mmc_defconfig +1 -0
@@ -19,6 +19,7 @@ CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="U-Boot> " # CONFIG_CMD_BDI is not set CONFIG_CMD_BOOTZ=y +CONFIG_CMD_CLS=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_LOADS is not set CONFIG_CMD_MMC=y
configs/at91sam9rlek_nandflash_defconfig +1 -0
@@ -19,6 +19,7 @@ CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="U-Boot> " # CONFIG_CMD_BDI is not set CONFIG_CMD_BOOTZ=y +CONFIG_CMD_CLS=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_LOADS is not set CONFIG_CMD_MMC=y
configs/brxre1_defconfig +1 -0
@@ -27,6 +27,7 @@ CONFIG_HUSH_PARSER=y # CONFIG_CMD_BOOTD is not set # CONFIG_CMD_BOOTM is not set CONFIG_CMD_BOOTZ=y +CONFIG_CMD_CLS=y # CONFIG_CMD_GO is not set # CONFIG_CMD_IMI is not set # CONFIG_CMD_XIMG is not set
configs/cm_t3517_defconfig +1 -0
@@ -11,6 +11,7 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="CM-T3517 # " CONFIG_CMD_BOOTZ=y +CONFIG_CMD_CLS=y CONFIG_CMD_EEPROM=y CONFIG_CMD_EEPROM_LAYOUT=y CONFIG_EEPROM_LAYOUT_HELP_STRING="v1, v2, v3"
configs/cm_t35_defconfig +1 -0
@@ -12,6 +12,7 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="CM-T3x # " CONFIG_CMD_BOOTZ=y +CONFIG_CMD_CLS=y CONFIG_CMD_EEPROM=y CONFIG_CMD_EEPROM_LAYOUT=y CONFIG_EEPROM_LAYOUT_HELP_STRING="v1, v2, v3"
configs/peach-pi_defconfig +1 -0
@@ -12,6 +12,7 @@ CONFIG_FIT_BEST_MATCH=y CONFIG_SILENT_CONSOLE=y # CONFIG_SPL_FRAMEWORK is not set CONFIG_SYS_PROMPT="Peach-Pi # " +CONFIG_CMD_CLS=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y
configs/peach-pit_defconfig +1 -0
@@ -11,6 +11,7 @@ CONFIG_FIT_BEST_MATCH=y CONFIG_SILENT_CONSOLE=y # CONFIG_SPL_FRAMEWORK is not set CONFIG_SYS_PROMPT="Peach-Pit # " +CONFIG_CMD_CLS=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y
configs/picosam9g45_defconfig +1 -0
@@ -24,6 +24,7 @@ CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="U-Boot> " # CONFIG_CMD_BDI is not set CONFIG_CMD_BOOTZ=y +CONFIG_CMD_CLS=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_FLASH is not set # CONFIG_CMD_LOADS is not set
configs/pm9261_defconfig +1 -0
@@ -15,6 +15,7 @@ CONFIG_BOARD_EARLY_INIT_F=y # CONFIG_AUTO_COMPLETE is not set CONFIG_SYS_PROMPT="pm9261> " # CONFIG_CMD_BDI is not set +CONFIG_CMD_CLS=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_LOADS is not set CONFIG_CMD_NAND=y
configs/pm9263_defconfig +1 -0
@@ -14,6 +14,7 @@ CONFIG_BOARD_EARLY_INIT_F=y # CONFIG_AUTO_COMPLETE is not set CONFIG_SYS_PROMPT="u-boot-pm9263> " # CONFIG_CMD_BDI is not set +CONFIG_CMD_CLS=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_LOADS is not set CONFIG_CMD_NAND=y
configs/snow_defconfig +1 -0
@@ -17,6 +17,7 @@ CONFIG_FIT_BEST_MATCH=y CONFIG_SILENT_CONSOLE=y # CONFIG_SPL_FRAMEWORK is not set CONFIG_SYS_PROMPT="snow # " +CONFIG_CMD_CLS=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y
configs/spring_defconfig +1 -0
@@ -17,6 +17,7 @@ CONFIG_FIT_BEST_MATCH=y CONFIG_SILENT_CONSOLE=y # CONFIG_SPL_FRAMEWORK is not set CONFIG_SYS_PROMPT="spring # " +CONFIG_CMD_CLS=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y
configs/zipitz2_defconfig +1 -0
@@ -10,6 +10,7 @@ CONFIG_HUSH_PARSER=y # CONFIG_CMDLINE_EDITING is not set # CONFIG_AUTO_COMPLETE is not set CONFIG_SYS_PROMPT="$ " +CONFIG_CMD_CLS=y CONFIG_CMD_MMC=y CONFIG_CMD_SPI=y CONFIG_CMD_USB=y
Signature · 1 line
2.17.1
PATCH 1/1 cmd: add clear screen 'cls' command
Hi Anatolij
Quoted 52 lines
From: Anatolij Gustschin <[email protected]>
Sent: samedi 17 novembre 2018 15:30Add common clear screen command for configurations
CONFIG_DM_VIDEO,CONFIG_LCDandCONFIG_CFB_CONSOLE.Remove the existing cls command implementation from
lcd.ccode and activate the command for all boards enablingCONFIG_LCDfor compatibility reasons.Signed-off-by Anatolij Gustschin <[email protected]>--- cmd/Kconfig | 7 ++++ cmd/Makefile | 1 + cmd/cls.c | 35 +++++++++++++++++++ common/lcd.c | 8 ----- configs/at91sam9261ek_dataflash_cs0_defconfig | 1 + configs/at91sam9261ek_dataflash_cs3_defconfig | 1 + configs/at91sam9261ek_nandflash_defconfig | 1 + configs/at91sam9263ek_dataflash_cs0_defconfig | 1 + configs/at91sam9263ek_dataflash_defconfig | 1 + configs/at91sam9263ek_nandflash_defconfig | 1 + configs/at91sam9263ek_norflash_boot_defconfig | 1 + configs/at91sam9263ek_norflash_defconfig | 1 + configs/at91sam9g10ek_dataflash_cs0_defconfig | 1 + configs/at91sam9g10ek_dataflash_cs3_defconfig | 1 + configs/at91sam9g10ek_nandflash_defconfig | 1 + configs/at91sam9m10g45ek_mmc_defconfig | 1 + configs/at91sam9m10g45ek_nandflash_defconfig | 1 + configs/at91sam9n12ek_mmc_defconfig | 1 + configs/at91sam9n12ek_nandflash_defconfig | 1 + configs/at91sam9n12ek_spiflash_defconfig | 1 + configs/at91sam9rlek_dataflash_defconfig | 1 + configs/at91sam9rlek_mmc_defconfig | 1 + configs/at91sam9rlek_nandflash_defconfig | 1 + configs/brxre1_defconfig | 1 + configs/cm_t3517_defconfig | 1 + configs/cm_t35_defconfig | 1 + configs/peach-pi_defconfig | 1 + configs/peach-pit_defconfig | 1 + configs/picosam9g45_defconfig | 1 + configs/pm9261_defconfig | 1 + configs/pm9263_defconfig | 1 + configs/snow_defconfig | 1 + configs/spring_defconfig | 1 + configs/zipitz2_defconfig | 1 + 34 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 cmd/cls.ccmd/Kconfig +0
-0
cmd/Kconfig config CMD_CONITRACE · line 1377
Quoted 6 lines
cmd/Kconfig +3
-0@@ -1372,6 +1372,13 @@ config CMD_CONITRACE Enable the 'conitrace' command which displays the codes received from the console input as hexadecimal numbers. +config CMD_CLS + bool "Enable clear screen command 'cls'" + depends on CFB_CONSOLE || DM_VIDEO || LCD || VIDEO
Just a minor remark, you can also add :
default y if !DM_VIDEO
To avoid the defconfig modifications in the patch.
(lcd.o if compiled ifndef CONFIG_DM_VIDEO) / command previously always define in this case) But you prefer perhaps to have clear CONFIG_CMD configuration in each defconfig.
cmd/Makefile
Quoted 11 lines
cmd/Kconfig +4
-0+ help + Enable the 'cls' command which clears the screen contents + on video frame buffer. + config CMD_DISPLAY bool "Enable the 'display' command, for character displays" helpcmd/Makefile index 12a1330b06..2cb07df3c8 renamed from cmd/Makefile +0
-0100644
cmd/Makefile +0
-0
But Ok for the rest.
Tested on my board (stm32mp157_ev1 with DM_VIDEO activated)
Regards, Patrick.
PATCH 1/1 cmd: add clear screen 'cls' command
Hi Patrick,
On Mon, 19 Nov 2018 18:09:12 +0000
Patrick DELAUNAY patrick.delaunay at st.com wrote:
...
Quoted 7 lines
cmd/Kconfig config CMD_CONITRACE · line 1377
Quoted 3 lines
cmd/Kconfig +3
-0+config CMD_CLS + bool "Enable clear screen command 'cls'" + depends on CFB_CONSOLE || DM_VIDEO || LCD || VIDEOJust a minor remark, you can also add :
default y if !DM_VIDEO
There are also a few boards with DM_VIDEO and LCD both enabled:
$ git grep CONFIG_LCD `git grep DM_VIDEO=y configs/ | awk -F : '{print $1}'`
configs/peach-pi_defconfig:CONFIG_LCD=y
configs/peach-pit_defconfig:CONFIG_LCD=y
configs/snow_defconfig:CONFIG_LCD=y
configs/spring_defconfig:CONFIG_LCD=yso using y if !DM_VIDEO would disable the command for them.
Quoted 3 lines
To avoid the defconfig modifications in the patch.
(lcd.o if compiled ifndefCONFIG_DM_VIDEO) / command previously always define in this case) But you prefer perhaps to have clearCONFIG_CMDconfiguration in each defconfig.
I'd like to reduce the defconfig size, so v2 patch uses "default y if LCD" to auto-select the command (compatibility for existing CONFIG_LCD users). For other configurations the command should be enabled in defconfig by users, when needed.
...
Quoted 6 lines
But Ok for the rest.
Tested on my board (stm32mp157_ev1withDM_VIDEOactivated)Regards, Patrick.
Tested-by Patrick.Delaunay <[email protected]>
Thanks for testing it!
--
Anatolij