VCxK.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. * (C) Copyright 2005
  3. * BuS Elektronik GmbH & Co.KG <esw@bus-elektonik.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. #include <common.h>
  24. #include <asm/m5282.h>
  25. #include "VCxK.h"
  26. vu_char *vcxk_bws = (vu_char *)(CONFIG_SYS_CS3_BASE);
  27. #define VCXK_BWS vcxk_bws
  28. static ulong vcxk_driver;
  29. ulong search_vcxk_driver(void);
  30. void vcxk_cls(void);
  31. void vcxk_setbrightness(short brightness);
  32. int vcxk_request(void);
  33. int vcxk_acknowledge_wait(void);
  34. void vcxk_clear(void);
  35. int init_vcxk(void)
  36. {
  37. VIDEO_Invert_CFG &= ~VIDEO_Invert_IO;
  38. VIDEO_INVERT_PORT |= VIDEO_INVERT_PIN;
  39. VIDEO_INVERT_DDR |= VIDEO_INVERT_PIN;
  40. VIDEO_REQUEST_PORT |= VIDEO_REQUEST_PIN;
  41. VIDEO_REQUEST_DDR |= VIDEO_REQUEST_PIN;
  42. VIDEO_ACKNOWLEDGE_DDR &= ~VIDEO_ACKNOWLEDGE_PIN;
  43. vcxk_driver = search_vcxk_driver();
  44. if (vcxk_driver)
  45. {
  46. /* use flash resist driver */
  47. }
  48. else
  49. {
  50. vcxk_cls();
  51. vcxk_cls();
  52. vcxk_setbrightness(1000);
  53. }
  54. VIDEO_ENABLE_DDR |= VIDEO_ENABLE_PIN;
  55. VIDEO_ENABLE_PORT |= VIDEO_ENABLE_PIN;
  56. VIDEO_ENABLE_PORT &= ~VIDEO_ENABLE_PIN;
  57. return 1;
  58. }
  59. void vcxk_loadimage(ulong source)
  60. {
  61. int cnt;
  62. vcxk_acknowledge_wait();
  63. for (cnt=0; cnt<16384; cnt++)
  64. {
  65. VCXK_BWS[cnt*2] = (*(vu_char*) source);
  66. source++;
  67. }
  68. vcxk_request();
  69. }
  70. void vcxk_cls(void)
  71. {
  72. vcxk_acknowledge_wait();
  73. vcxk_clear();
  74. vcxk_request();
  75. }
  76. void vcxk_clear(void)
  77. {
  78. int cnt;
  79. for (cnt=0; cnt<16384; cnt++)
  80. {
  81. VCXK_BWS[cnt*2] = 0x00;
  82. }
  83. }
  84. void vcxk_setbrightness(short brightness)
  85. {
  86. VCXK_BWS[0x8000]=(brightness >> 4) +2;
  87. VCXK_BWS[0xC000]= (brightness + 23) >> 8;
  88. VCXK_BWS[0xC001]= (brightness + 23) & 0xFF;
  89. }
  90. int vcxk_request(void)
  91. {
  92. if (vcxk_driver)
  93. {
  94. /* use flash resist driver */
  95. }
  96. else
  97. {
  98. VIDEO_REQUEST_PORT &= ~VIDEO_REQUEST_PIN;
  99. VIDEO_REQUEST_PORT |= VIDEO_REQUEST_PIN;
  100. }
  101. return 1;
  102. }
  103. int vcxk_acknowledge_wait(void)
  104. {
  105. if (vcxk_driver)
  106. {
  107. /* use flash resist driver */
  108. }
  109. else
  110. {
  111. while (!(VIDEO_ACKNOWLEDGE_PORT & VIDEO_ACKNOWLEDGE_PIN));
  112. }
  113. return 1;
  114. }
  115. ulong search_vcxk_driver(void)
  116. {
  117. return 0;
  118. }
  119. /* eof */