wdenk | 1a4d616 | 2002-11-01 00:21:20 +0000 | [diff] [blame] | 1 | /* |
| 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 Loeliger | fd9bcaa | 2007-07-08 18:05:39 -0500 | [diff] [blame] | 38 | #if defined(CONFIG_CMD_VFD) |
wdenk | 82226bf | 2003-05-20 20:49:01 +0000 | [diff] [blame] | 39 | |
wdenk | 1a4d616 | 2002-11-01 00:21:20 +0000 | [diff] [blame] | 40 | #include <vfd_logo.h> |
| 41 | #define VFD_TEST_LOGO_BMPNR 0 |
| 42 | #define VFD_REMOTE_LOGO_BMPNR 1 |
wdenk | 1a4d616 | 2002-11-01 00:21:20 +0000 | [diff] [blame] | 43 | |
| 44 | extern int transfer_pic(unsigned char, unsigned char *, int, int); |
| 45 | |
| 46 | int trab_vfd (ulong bitmap); |
| 47 | |
Wolfgang Denk | 54841ab | 2010-06-28 22:00:46 +0200 | [diff] [blame] | 48 | int do_vfd (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
wdenk | 1a4d616 | 2002-11-01 00:21:20 +0000 | [diff] [blame] | 49 | { |
| 50 | ulong bitmap; |
| 51 | |
Wolfgang Denk | 47e26b1 | 2010-07-17 01:06:04 +0200 | [diff] [blame] | 52 | if (argc != 2) |
| 53 | return cmd_usage(cmdtp); |
wdenk | 1a4d616 | 2002-11-01 00:21:20 +0000 | [diff] [blame] | 54 | |
wdenk | 4f7cb08 | 2003-09-11 23:06:34 +0000 | [diff] [blame] | 55 | if (argv[1][0] == '/') { /* select bitmap by number */ |
wdenk | 82226bf | 2003-05-20 20:49:01 +0000 | [diff] [blame] | 56 | bitmap = simple_strtoul(argv[1]+1, NULL, 10); |
| 57 | return (trab_vfd(bitmap)); |
| 58 | } |
wdenk | 1a4d616 | 2002-11-01 00:21:20 +0000 | [diff] [blame] | 59 | |
wdenk | 82226bf | 2003-05-20 20:49:01 +0000 | [diff] [blame] | 60 | /* display bitmap at given address */ |
| 61 | bitmap = simple_strtoul(argv[1], NULL, 16); |
wdenk | c8c3a8b | 2003-05-21 20:26:20 +0000 | [diff] [blame] | 62 | transfer_pic(3, (uchar *)bitmap, VFD_LOGO_HEIGHT, VFD_LOGO_WIDTH); |
wdenk | 82226bf | 2003-05-20 20:49:01 +0000 | [diff] [blame] | 63 | return 0; |
wdenk | 1a4d616 | 2002-11-01 00:21:20 +0000 | [diff] [blame] | 64 | } |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 65 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 66 | U_BOOT_CMD( |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 67 | vfd, 2, 0, do_vfd, |
Peter Tyser | 2fb2604 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 68 | "load a bitmap to the VFDs on TRAB", |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 69 | "/N\n" |
| 70 | " - load bitmap N to the VFDs (N is _decimal_ !!!)\n" |
wdenk | 4f7cb08 | 2003-09-11 23:06:34 +0000 | [diff] [blame] | 71 | "vfd ADDR\n" |
Wolfgang Denk | a89c33d | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 72 | " - load bitmap at address ADDR" |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 73 | ); |
Jon Loeliger | 9025317 | 2007-07-10 11:02:44 -0500 | [diff] [blame] | 74 | #endif |
wdenk | 1a4d616 | 2002-11-01 00:21:20 +0000 | [diff] [blame] | 75 | |
wdenk | 1a4d616 | 2002-11-01 00:21:20 +0000 | [diff] [blame] | 76 | int trab_vfd (ulong bitmap) |
| 77 | { |
wdenk | c8c3a8b | 2003-05-21 20:26:20 +0000 | [diff] [blame] | 78 | uchar *addr; |
| 79 | char *s; |
| 80 | |
wdenk | 1a4d616 | 2002-11-01 00:21:20 +0000 | [diff] [blame] | 81 | switch (bitmap) { |
wdenk | 82226bf | 2003-05-20 20:49:01 +0000 | [diff] [blame] | 82 | case VFD_TEST_LOGO_BMPNR: |
wdenk | c8c3a8b | 2003-05-21 20:26:20 +0000 | [diff] [blame] | 83 | if ((s = getenv ("bitmap0")) != NULL) { |
| 84 | addr = (uchar *)simple_strtoul (s, NULL, 16); |
| 85 | } else { |
| 86 | addr = &vfd_test_logo_bitmap[0]; |
| 87 | } |
| 88 | break; |
wdenk | 82226bf | 2003-05-20 20:49:01 +0000 | [diff] [blame] | 89 | case VFD_REMOTE_LOGO_BMPNR: |
wdenk | c8c3a8b | 2003-05-21 20:26:20 +0000 | [diff] [blame] | 90 | if ((s = getenv ("bitmap1")) != NULL) { |
| 91 | addr = (uchar *)simple_strtoul (s, NULL, 16); |
| 92 | } else { |
| 93 | addr = &vfd_remote_logo_bitmap[0]; |
| 94 | } |
| 95 | break; |
wdenk | 82226bf | 2003-05-20 20:49:01 +0000 | [diff] [blame] | 96 | default: |
| 97 | printf("Unknown bitmap %ld\n", bitmap); |
| 98 | return 1; |
wdenk | 1a4d616 | 2002-11-01 00:21:20 +0000 | [diff] [blame] | 99 | } |
wdenk | c8c3a8b | 2003-05-21 20:26:20 +0000 | [diff] [blame] | 100 | transfer_pic(3, addr, VFD_LOGO_HEIGHT, VFD_LOGO_WIDTH); |
| 101 | return 0; |
wdenk | 1a4d616 | 2002-11-01 00:21:20 +0000 | [diff] [blame] | 102 | } |