Fixed tools/env utilities
[u-boot-openmoko/mini2440.git] / common / cmd_vfd.c
blob29c349dab9c5d21e59dcb084c15cf7e505803b02
1 /*
2 * (C) Copyright 2001
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
6 * project.
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.
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.
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
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.
32 * This rather crudely requires that each bitmap be included as a
33 * header file.
35 #include <common.h>
36 #include <command.h>
38 #if defined(CONFIG_CMD_VFD)
40 #include <vfd_logo.h>
41 #define VFD_TEST_LOGO_BMPNR 0
42 #define VFD_REMOTE_LOGO_BMPNR 1
44 extern int transfer_pic(unsigned char, unsigned char *, int, int);
46 int trab_vfd (ulong bitmap);
48 int do_vfd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
50 ulong bitmap;
52 if (argc != 2) {
53 printf ("Usage:\n%s\n", cmdtp->usage);
54 return 1;
57 if (argv[1][0] == '/') { /* select bitmap by number */
58 bitmap = simple_strtoul(argv[1]+1, NULL, 10);
59 return (trab_vfd(bitmap));
62 /* display bitmap at given address */
63 bitmap = simple_strtoul(argv[1], NULL, 16);
64 transfer_pic(3, (uchar *)bitmap, VFD_LOGO_HEIGHT, VFD_LOGO_WIDTH);
65 return 0;
68 U_BOOT_CMD(
69 vfd, 2, 0, do_vfd,
70 "vfd - load a bitmap to the VFDs on TRAB\n",
71 "/N\n"
72 " - load bitmap N to the VFDs (N is _decimal_ !!!)\n"
73 "vfd ADDR\n"
74 " - load bitmap at address ADDR\n"
76 #endif
78 #ifdef CONFIG_VFD
79 int trab_vfd (ulong bitmap)
81 uchar *addr;
82 char *s;
84 switch (bitmap) {
85 case VFD_TEST_LOGO_BMPNR:
86 if ((s = getenv ("bitmap0")) != NULL) {
87 addr = (uchar *)simple_strtoul (s, NULL, 16);
88 } else {
89 addr = &vfd_test_logo_bitmap[0];
91 break;
92 case VFD_REMOTE_LOGO_BMPNR:
93 if ((s = getenv ("bitmap1")) != NULL) {
94 addr = (uchar *)simple_strtoul (s, NULL, 16);
95 } else {
96 addr = &vfd_remote_logo_bitmap[0];
98 break;
99 default:
100 printf("Unknown bitmap %ld\n", bitmap);
101 return 1;
103 transfer_pic(3, addr, VFD_LOGO_HEIGHT, VFD_LOGO_WIDTH);
104 return 0;
106 #endif /* CONFIG_VFD */