source: SVN/cambria/redboot/packages/redboot/current/src/splash.c @ 1

Last change on this file since 1 was 1, checked in by Tim Harvey, 2 years ago

restored latest version of files from server backup

Signed-off-by: Tim Harvey <tharvey@…>

File size: 4.0 KB
Line 
1//==========================================================================
2//
3//      splash.c
4//
5//      RedBoot framebuffer snapshot/restore to flash config space
6//
7//==========================================================================
8//####ECOSGPLCOPYRIGHTBEGIN####
9// -------------------------------------------
10// This file is part of eCos, the Embedded Configurable Operating System.
11// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12//
13// eCos is free software; you can redistribute it and/or modify it under
14// the terms of the GNU General Public License as published by the Free
15// Software Foundation; either version 2 or (at your option) any later version.
16//
17// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18// WARRANTY; without even the implied warranty of MERCHANTABILITY or
19// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20// for more details.
21//
22// You should have received a copy of the GNU General Public License along
23// with eCos; if not, write to the Free Software Foundation, Inc.,
24// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25//
26// As a special exception, if other files instantiate templates or use macros
27// or inline functions from this file, or you compile this file and link it
28// with other works to produce a work based on this file, this file does not
29// by itself cause the resulting work to be covered by the GNU General Public
30// License. However the source code for this file must still be made available
31// in accordance with section (3) of the GNU General Public License.
32//
33// This exception does not invalidate any other reasons why a work based on
34// this file might be covered by the GNU General Public License.
35//
36// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37// at http://sources.redhat.com/ecos/ecos-license/
38// -------------------------------------------
39//####ECOSGPLCOPYRIGHTEND####
40//==========================================================================
41//#####DESCRIPTIONBEGIN####
42//
43// Author(s):    dwmw2
44// Contributors: dwmw2
45// Date:         2002-01-23
46// Purpose:     
47// Description: 
48//             
49// This code is part of RedBoot (tm).
50//
51//####DESCRIPTIONEND####
52//
53//==========================================================================
54
55
56#include <redboot.h>
57#include <flash_config.h>
58#include <pkgconf/io_gfx_drivers.h>
59#include <cyg/gfx/gfx_dev.h>
60
61
62RedBoot_cmd("splash",
63            "Show splash screen",
64            "",
65            do_splash_withargs
66    );
67
68RedBoot_cmd("setsplash",
69            "Set splash screen from current framebuffer contents",
70            "",
71            do_setsplash
72    );
73
74#ifdef CYGPKG_IO_GFX_BMP_SUPPORT
75RedBoot_cmd("showbmp",
76            "Display loaded Windows .BMP image",
77            "",
78            do_showbmp
79    );
80#endif
81
82void do_splash(void)
83{
84        unsigned char *image;
85        unsigned long len = CYGNUM_REDBOOT_FLASH_SPLASH_SIZE;
86
87        if (!flash_get_config("splash", &image, CONFIG_SPLASH))
88                return;
89
90        if (!cyg_io_gfx_fb) {
91                diag_printf( "Framebuffer not initialised. No splash screen\n");
92                return;
93        }
94
95        if (cyg_io_gfx_fb_size < len)
96                len = cyg_io_gfx_fb_size;
97
98        memcpy(cyg_io_gfx_fb, image, len);
99}
100
101RedBoot_init(do_splash, RedBoot_INIT_PRIO(1));
102
103void do_splash_withargs(int argc, char *argv[])
104{
105        /* Bah. */
106        do_splash();
107}
108
109
110void do_setsplash(int argc, char *argv[])
111{
112        struct config_option opt;
113
114        if (!cyg_io_gfx_fb) {
115                diag_printf("Framebuffer not initialised. Cannot snapshot\n");
116                return;
117        }
118        if (cyg_io_gfx_fb_size < CYGNUM_REDBOOT_FLASH_SPLASH_SIZE) {
119                diag_printf("Framebuffer too small. Cannot safely snapshot\n");
120                return;
121        }
122
123        opt.type = CONFIG_SPLASH;
124        opt.enable = (char *)0;
125        opt.enable_sense = 1;
126        opt.key = "splash";
127        opt.dflt = (CYG_ADDRESS)cyg_io_gfx_fb;
128
129        flash_add_config(&opt, true);
130}
131
132
133#ifdef CYGPKG_IO_GFX_BMP_SUPPORT
134void do_showbmp(int argc, char *argv[])
135{
136        if (!load_address) {
137                diag_printf("No image has been loaded\n");
138                return;
139        }
140        if (!cyg_io_gfx_fb) {
141                diag_printf("Graphics device not present/initialised\n");
142                return;
143        }
144
145        cyg_io_gfx_fill(0, 0, cyg_io_gfx_xres(), cyg_io_gfx_yres(), 0);
146        cyg_io_gfx_show_bmp(0, 0, load_address);
147}
148#endif
Note: See TracBrowser for help on using the repository browser.