]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/lcd.c
common/lcd.c: cleanup use of global variables
[karo-tx-uboot.git] / common / lcd.c
index 66d4f94f9eae0dcf8e8d57f9327f29b84f67019f..b09e45fc18ddf7df71432da30d06a5956e1d9be5 100644 (file)
@@ -33,6 +33,8 @@
 #include <common.h>
 #include <command.h>
 #include <stdarg.h>
+#include <search.h>
+#include <env_callback.h>
 #include <linux/types.h>
 #include <stdio_dev.h>
 #if defined(CONFIG_POST)
@@ -97,6 +99,9 @@ static int lcd_getbgcolor(void);
 static void lcd_setfgcolor(int color);
 static void lcd_setbgcolor(int color);
 
+static int lcd_color_fg;
+static int lcd_color_bg;
+
 char lcd_is_enabled = 0;
 
 static char lcd_flush_dcache;  /* 1 to flush dcache after each lcd update */
@@ -532,12 +537,10 @@ static void lcd_setbgcolor(int color)
 
 /*----------------------------------------------------------------------*/
 
-#ifdef NOT_USED_SO_FAR
-static int lcd_getfgcolor(void)
+int lcd_getfgcolor(void)
 {
        return lcd_color_fg;
 }
-#endif /* NOT_USED_SO_FAR */
 
 /*----------------------------------------------------------------------*/
 
@@ -1034,6 +1037,18 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 }
 #endif
 
+#ifdef CONFIG_SPLASH_SCREEN_PREPARE
+static inline int splash_screen_prepare(void)
+{
+       return board_splash_screen_prepare();
+}
+#else
+static inline int splash_screen_prepare(void)
+{
+       return 0;
+}
+#endif
+
 static void *lcd_logo(void)
 {
 #ifdef CONFIG_SPLASH_SCREEN
@@ -1045,6 +1060,9 @@ static void *lcd_logo(void)
                int x = 0, y = 0;
                do_splash = 0;
 
+               if (splash_screen_prepare())
+                       return (void *)gd->fb_base;
+
                addr = simple_strtoul (s, NULL, 16);
 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
                s = getenv("splashpos");
@@ -1084,6 +1102,30 @@ static void *lcd_logo(void)
 #endif /* CONFIG_LCD_LOGO && !CONFIG_LCD_INFO_BELOW_LOGO */
 }
 
+#ifdef CONFIG_SPLASHIMAGE_GUARD
+static int on_splashimage(const char *name, const char *value, enum env_op op,
+       int flags)
+{
+       ulong addr;
+       int aligned;
+
+       if (op == env_op_delete)
+               return 0;
+
+       addr = simple_strtoul(value, NULL, 16);
+       /* See README.displaying-bmps */
+       aligned = (addr % 4 == 2);
+       if (!aligned) {
+               printf("Invalid splashimage value. Value must be 16 bit aligned, but not 32 bit aligned\n");
+               return -1;
+       }
+
+       return 0;
+}
+
+U_BOOT_ENV_CALLBACK(splashimage, on_splashimage);
+#endif
+
 void lcd_position_cursor(unsigned col, unsigned row)
 {
        console_col = min(col, CONSOLE_COLS - 1);