video, cfb_console: make background and foreground color configurable
authorHeiko Schocher <hs@denx.de>
Tue, 22 Oct 2013 09:06:06 +0000 (11:06 +0200)
committerAnatolij Gustschin <agust@denx.de>
Wed, 30 Oct 2013 09:48:37 +0000 (10:48 +0100)
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
drivers/video/cfb_console.c
include/video_fb.h

diff --git a/README b/README
index f0eedbb9dc055a06348c7542b8ea88f224d108bf..91c3ac0fa729fcb011a8faaf51713c550e1ecc3c 100644 (file)
--- a/README
+++ b/README
@@ -705,6 +705,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
index a2946c71f643032f6edc14890fdb4ab52a2b5c85..6db40735961e934a2f57e82c0a1dfe3f77037e9d 100644 (file)
@@ -2108,6 +2108,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;
@@ -2194,6 +2212,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");
@@ -2297,21 +2317,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
-}
index 028e2a6aea4c772846d383ed830183499c0af707..6cd4e377c20cc99a066035ead783bb83e8cc59ed 100644 (file)
 #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