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/
27 static struct splash_location default_splash_locations[] = {
30 .storage = SPLASH_STORAGE_SF,
31 .flags = SPLASH_STORAGE_RAW,
36 .storage = SPLASH_STORAGE_MMC,
37 .flags = SPLASH_STORAGE_FS,
42 .storage = SPLASH_STORAGE_USB,
43 .flags = SPLASH_STORAGE_FS,
48 .storage = SPLASH_STORAGE_SATA,
49 .flags = SPLASH_STORAGE_FS,
54 __weak int splash_screen_prepare(void)
56 return splash_source_load(default_splash_locations,
57 ARRAY_SIZE(default_splash_locations));
60 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
61 void splash_get_pos(int *x, int *y)
63 char *s = env_get("splashpos");
69 *x = BMP_ALIGN_CENTER;
71 *x = simple_strtol(s, NULL, 0);
73 s = strchr(s + 1, ',');
76 *y = BMP_ALIGN_CENTER;
78 *y = simple_strtol(s + 1, NULL, 0);
81 #endif /* CONFIG_SPLASH_SCREEN_ALIGN */
84 * Common function to show a splash image if env("splashimage") is set.
85 * Is used for both dm_video and lcd video stacks. For additional
86 * details please refer to doc/README.splashprepare.
88 #if defined(CONFIG_SPLASH_SCREEN) && defined(CONFIG_CMD_BMP)
89 int splash_display(void)
93 int x = 0, y = 0, ret;
95 s = env_get("splashimage");
99 addr = simple_strtoul(s, NULL, 16);
100 ret = splash_screen_prepare();
104 splash_get_pos(&x, &y);
106 return bmp_display(addr, x, y);