Patchwork [U-Boot,1/3] video, cfb_console: make background and foreground color configurable

login
register
mail settings
Submitter Heiko Schocher
Date Sept. 10, 2013, 11:42 a.m.
Message ID <1378813334-23919-1-git-send-email-hs@denx.de>
Download mbox | patch
Permalink /patch/273850/
State Superseded
Delegated to: Anatolij Gustschin
Headers show

Comments

Heiko Schocher - Sept. 10, 2013, 11:42 a.m.
make CONSOLE_BG_COL/CONSOLE_FG_COL configurable through board config file.
Clear video screen in video_init().

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Anatolij Gustschin <agust@denx.de>
---
 README                      |  5 +++++
 drivers/video/cfb_console.c | 38 ++++++++++++++++++++------------------
 include/video_fb.h          |  5 +++++
 3 Dateien geändert, 30 Zeilen hinzugefügt(+), 18 Zeilen entfernt(-)

Patch

diff --git a/README b/README
index a30ea31..f3aaffc 100644
--- a/README
+++ b/README
@@ -691,6 +691,11 @@  The following options need to be configured:
 		the "silent" environment variable. See
 		doc/README.silent for more information.
 
+		CONFIG_SYS_CONSOLE_BG_COL: define the backgroundcolor, default
+			is 0x00.
+		CONFIG_SYS_CONSOLE_FG_COL: define the foregroundcolor, default
+			is 0xa0.
+
 - Console Baudrate:
 		CONFIG_BAUDRATE - in bps
 		Select one of the baudrates listed in
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index 822ed28..289c487 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -2091,6 +2091,24 @@  defined(CONFIG_SANDBOX) || defined(CONFIG_X86)
 	return 0;
 }
 
+void video_clear(void)
+{
+	if (!video_fb_address)
+		return;
+#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 */
+			  bgx			/* fill color */
+	);
+#else
+	memsetl(video_fb_address,
+		(VIDEO_VISIBLE_ROWS * VIDEO_LINE_LEN) / sizeof(int), bgx);
+#endif
+}
+
 static int video_init(void)
 {
 	unsigned char color8;
@@ -2177,6 +2195,8 @@  static int video_init(void)
 	}
 	eorx = fgx ^ bgx;
 
+	video_clear();
+
 #ifdef CONFIG_VIDEO_LOGO
 	/* Plot the logo and get start point of console */
 	debug("Video: Drawing the logo ...\n");
@@ -2280,21 +2300,3 @@  int video_get_screen_columns(void)
 {
 	return CONSOLE_COLS;
 }
-
-void video_clear(void)
-{
-	if (!video_fb_address)
-		return;
-#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 */
-			  bgx			/* fill color */
-	);
-#else
-	memsetl(video_fb_address,
-		(VIDEO_VISIBLE_ROWS * VIDEO_LINE_LEN) / sizeof(int), bgx);
-#endif
-}
diff --git a/include/video_fb.h b/include/video_fb.h
index 028e2a6..6cd4e37 100644
--- a/include/video_fb.h
+++ b/include/video_fb.h
@@ -18,8 +18,13 @@ 
 #ifndef _VIDEO_FB_H_
 #define _VIDEO_FB_H_
 
+#if defined(CONFIG_SYS_CONSOLE_FG_COL) && defined(CONFIG_SYS_CONSOLE_BG_COL)
+#define CONSOLE_BG_COL            CONFIG_SYS_CONSOLE_BG_COL
+#define CONSOLE_FG_COL            CONFIG_SYS_CONSOLE_FG_COL
+#else
 #define CONSOLE_BG_COL            0x00
 #define CONSOLE_FG_COL            0xa0
+#endif
 
 /*
  * Graphic Data Format (GDF) bits for VIDEO_DATA_FORMAT