cmd_vfd.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. * Command to load a splash screen to the VFDs.
  25. * NOTE that this will be controlled by a key combination when
  26. * the keyboard stuff works. For now the user has to enter a
  27. * bitmap number (only VFD_TEST_LOGO is supported now - 16.10.2002).
  28. * Added VFD_REMOTE_LOGO (same as VFD_TEST_LOGO but a different color)
  29. * on 20.10.2002.
  30. *
  31. * This rather crudely requires that each bitmap be included as a
  32. * header file.
  33. */
  34. #include <common.h>
  35. #include <command.h>
  36. #if defined(CONFIG_CMD_VFD)
  37. #include <vfd_logo.h>
  38. #define VFD_TEST_LOGO_BMPNR 0
  39. #define VFD_REMOTE_LOGO_BMPNR 1
  40. extern int transfer_pic(unsigned char, unsigned char *, int, int);
  41. int trab_vfd (ulong bitmap);
  42. int do_vfd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
  43. {
  44. ulong bitmap;
  45. if (argc != 2) {
  46. printf ("Usage:\n%s\n", cmdtp->usage);
  47. return 1;
  48. }
  49. if (argv[1][0] == '/') { /* select bitmap by number */
  50. bitmap = simple_strtoul(argv[1]+1, NULL, 10);
  51. return (trab_vfd(bitmap));
  52. }
  53. /* display bitmap at given address */
  54. bitmap = simple_strtoul(argv[1], NULL, 16);
  55. transfer_pic(3, (uchar *)bitmap, VFD_LOGO_HEIGHT, VFD_LOGO_WIDTH);
  56. return 0;
  57. }
  58. U_BOOT_CMD(
  59. vfd, 2, 0, do_vfd,
  60. "vfd - load a bitmap to the VFDs on TRAB\n",
  61. "/N\n"
  62. " - load bitmap N to the VFDs (N is _decimal_ !!!)\n"
  63. "vfd ADDR\n"
  64. " - load bitmap at address ADDR\n"
  65. );
  66. #endif
  67. #ifdef CONFIG_VFD
  68. int trab_vfd (ulong bitmap)
  69. {
  70. uchar *addr;
  71. char *s;
  72. switch (bitmap) {
  73. case VFD_TEST_LOGO_BMPNR:
  74. if ((s = getenv ("bitmap0")) != NULL) {
  75. addr = (uchar *)simple_strtoul (s, NULL, 16);
  76. } else {
  77. addr = &vfd_test_logo_bitmap[0];
  78. }
  79. break;
  80. case VFD_REMOTE_LOGO_BMPNR:
  81. if ((s = getenv ("bitmap1")) != NULL) {
  82. addr = (uchar *)simple_strtoul (s, NULL, 16);
  83. } else {
  84. addr = &vfd_remote_logo_bitmap[0];
  85. }
  86. break;
  87. default:
  88. printf("Unknown bitmap %ld\n", bitmap);
  89. return 1;
  90. }
  91. transfer_pic(3, addr, VFD_LOGO_HEIGHT, VFD_LOGO_WIDTH);
  92. return 0;
  93. }
  94. #endif /* CONFIG_VFD */