blob: 84d9530aa994801130a4c6fc18ef30917a5ac5c8 [file] [log] [blame]
wdenk1a4d6162002-11-01 00:21:20 +00001/*
2 * (C) Copyright 2001
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 */
23
24/*
25 * Command to load a splash screen to the VFDs.
26 * NOTE that this will be controlled by a key combination when
27 * the keyboard stuff works. For now the user has to enter a
28 * bitmap number (only VFD_TEST_LOGO is supported now - 16.10.2002).
29 * Added VFD_REMOTE_LOGO (same as VFD_TEST_LOGO but a different color)
30 * on 20.10.2002.
31 *
32 * This rather crudely requires that each bitmap be included as a
33 * header file.
34 */
35#include <common.h>
36#include <command.h>
37
Jon Loeliger4c176342007-07-08 18:05:39 -050038#if defined(CONFIG_CMD_VFD)
wdenk26991552003-05-20 20:49:01 +000039
wdenk1a4d6162002-11-01 00:21:20 +000040#include <vfd_logo.h>
41#define VFD_TEST_LOGO_BMPNR 0
42#define VFD_REMOTE_LOGO_BMPNR 1
wdenk1a4d6162002-11-01 00:21:20 +000043
44extern int transfer_pic(unsigned char, unsigned char *, int, int);
45
46int trab_vfd (ulong bitmap);
47
48int do_vfd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
49{
50 ulong bitmap;
51
52 if (argc != 2) {
Peter Tyserddb3af92009-01-27 18:03:10 -060053 cmd_usage(cmdtp);
wdenk1a4d6162002-11-01 00:21:20 +000054 return 1;
55 }
56
wdenk4cc02a82003-09-11 23:06:34 +000057 if (argv[1][0] == '/') { /* select bitmap by number */
wdenk26991552003-05-20 20:49:01 +000058 bitmap = simple_strtoul(argv[1]+1, NULL, 10);
59 return (trab_vfd(bitmap));
60 }
wdenk1a4d6162002-11-01 00:21:20 +000061
wdenk26991552003-05-20 20:49:01 +000062 /* display bitmap at given address */
63 bitmap = simple_strtoul(argv[1], NULL, 16);
wdenk6bd7b5d2003-05-21 20:26:20 +000064 transfer_pic(3, (uchar *)bitmap, VFD_LOGO_HEIGHT, VFD_LOGO_WIDTH);
wdenk26991552003-05-20 20:49:01 +000065 return 0;
wdenk1a4d6162002-11-01 00:21:20 +000066}
wdenk57b2d802003-06-27 21:31:46 +000067
wdenkf287a242003-07-01 21:06:45 +000068U_BOOT_CMD(
Wolfgang Denka1be4762008-05-20 16:00:29 +020069 vfd, 2, 0, do_vfd,
Peter Tyserdfb72b82009-01-27 18:03:12 -060070 "load a bitmap to the VFDs on TRAB",
Wolfgang Denka1be4762008-05-20 16:00:29 +020071 "/N\n"
72 " - load bitmap N to the VFDs (N is _decimal_ !!!)\n"
wdenk4cc02a82003-09-11 23:06:34 +000073 "vfd ADDR\n"
74 " - load bitmap at address ADDR\n"
wdenk57b2d802003-06-27 21:31:46 +000075);
Jon Loeligerd704d912007-07-10 11:02:44 -050076#endif
wdenk1a4d6162002-11-01 00:21:20 +000077
wdenk1a4d6162002-11-01 00:21:20 +000078int trab_vfd (ulong bitmap)
79{
wdenk6bd7b5d2003-05-21 20:26:20 +000080 uchar *addr;
81 char *s;
82
wdenk1a4d6162002-11-01 00:21:20 +000083 switch (bitmap) {
wdenk26991552003-05-20 20:49:01 +000084 case VFD_TEST_LOGO_BMPNR:
wdenk6bd7b5d2003-05-21 20:26:20 +000085 if ((s = getenv ("bitmap0")) != NULL) {
86 addr = (uchar *)simple_strtoul (s, NULL, 16);
87 } else {
88 addr = &vfd_test_logo_bitmap[0];
89 }
90 break;
wdenk26991552003-05-20 20:49:01 +000091 case VFD_REMOTE_LOGO_BMPNR:
wdenk6bd7b5d2003-05-21 20:26:20 +000092 if ((s = getenv ("bitmap1")) != NULL) {
93 addr = (uchar *)simple_strtoul (s, NULL, 16);
94 } else {
95 addr = &vfd_remote_logo_bitmap[0];
96 }
97 break;
wdenk26991552003-05-20 20:49:01 +000098 default:
99 printf("Unknown bitmap %ld\n", bitmap);
100 return 1;
wdenk1a4d6162002-11-01 00:21:20 +0000101 }
wdenk6bd7b5d2003-05-21 20:26:20 +0000102 transfer_pic(3, addr, VFD_LOGO_HEIGHT, VFD_LOGO_WIDTH);
103 return 0;
wdenk1a4d6162002-11-01 00:21:20 +0000104}