2 * Copyright (C) 2013, Boundary Devices <info@boundarydevices.com>
4 * See file CREDITS for list of people who contributed to this
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., http://www.fsf.org/about/contact/
28 static struct splash_location default_splash_locations[] = {
31 .storage = SPLASH_STORAGE_SF,
32 .flags = SPLASH_STORAGE_RAW,
37 .storage = SPLASH_STORAGE_MMC,
38 .flags = SPLASH_STORAGE_FS,
43 .storage = SPLASH_STORAGE_USB,
44 .flags = SPLASH_STORAGE_FS,
49 .storage = SPLASH_STORAGE_SATA,
50 .flags = SPLASH_STORAGE_FS,
55 #if defined(CONFIG_DM_VIDEO) && defined(CONFIG_VIDEO_LOGO)
57 #include <bmp_logo_data.h>
59 static int splash_video_logo_load(void)
64 splashimage = env_get("splashimage");
68 bmp_load_addr = simple_strtoul(splashimage, 0, 16);
70 printf("Error: bad 'splashimage' address\n");
74 memcpy((void *)bmp_load_addr, bmp_logo_bitmap,
75 ARRAY_SIZE(bmp_logo_bitmap));
80 static inline int splash_video_logo_load(void) { return -ENOSYS; }
83 __weak int splash_screen_prepare(void)
85 if (CONFIG_IS_ENABLED(SPLASH_SOURCE))
86 return splash_source_load(default_splash_locations,
87 ARRAY_SIZE(default_splash_locations));
89 return splash_video_logo_load();
92 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
93 void splash_get_pos(int *x, int *y)
95 char *s = env_get("splashpos");
101 *x = BMP_ALIGN_CENTER;
103 *x = simple_strtol(s, NULL, 0);
105 s = strchr(s + 1, ',');
108 *y = BMP_ALIGN_CENTER;
110 *y = simple_strtol(s + 1, NULL, 0);
113 #endif /* CONFIG_SPLASH_SCREEN_ALIGN */
116 * Common function to show a splash image if env("splashimage") is set.
117 * Is used for both dm_video and lcd video stacks. For additional
118 * details please refer to doc/README.splashprepare.
120 #if defined(CONFIG_SPLASH_SCREEN) && defined(CONFIG_CMD_BMP)
121 int splash_display(void)
125 int x = 0, y = 0, ret;
127 s = env_get("splashimage");
131 addr = simple_strtoul(s, NULL, 16);
132 ret = splash_screen_prepare();
136 splash_get_pos(&x, &y);
138 return bmp_display(addr, x, y);