Heiko Schocher | 9acb626 | 2006-04-20 08:42:42 +0200 | [diff] [blame] | 1 | /* |
Wolfgang Denk | b1d7135 | 2006-06-10 22:00:40 +0200 | [diff] [blame] | 2 | * (C) Copyright 2005 |
Heiko Schocher | 9acb626 | 2006-04-20 08:42:42 +0200 | [diff] [blame] | 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 | |
| 24 | #include <common.h> |
| 25 | #include <asm/m5282.h> |
| 26 | #include "VCxK.h" |
| 27 | |
| 28 | vu_char *vcxk_bws = (vu_char *)(CFG_CS3_BASE); |
| 29 | #define VCXK_BWS vcxk_bws |
| 30 | |
| 31 | static ulong vcxk_driver; |
| 32 | |
| 33 | |
| 34 | ulong search_vcxk_driver(void); |
| 35 | void vcxk_cls(void); |
| 36 | void vcxk_setbrightness(short brightness); |
| 37 | int vcxk_request(void); |
| 38 | int vcxk_acknowledge_wait(void); |
| 39 | void vcxk_clear(void); |
| 40 | |
| 41 | int init_vcxk(void) |
| 42 | { |
| 43 | VIDEO_Invert_CFG &= ~VIDEO_Invert_IO; |
| 44 | VIDEO_INVERT_PORT |= VIDEO_INVERT_PIN; |
| 45 | VIDEO_INVERT_DDR |= VIDEO_INVERT_PIN; |
| 46 | |
| 47 | VIDEO_REQUEST_PORT |= VIDEO_REQUEST_PIN; |
| 48 | VIDEO_REQUEST_DDR |= VIDEO_REQUEST_PIN; |
| 49 | |
| 50 | VIDEO_ACKNOWLEDGE_DDR &= ~VIDEO_ACKNOWLEDGE_PIN; |
| 51 | |
| 52 | vcxk_driver = search_vcxk_driver(); |
| 53 | if (vcxk_driver) |
| 54 | { |
| 55 | /* use flash resist driver */ |
| 56 | } |
| 57 | else |
| 58 | { |
| 59 | vcxk_cls(); |
| 60 | vcxk_cls(); |
| 61 | vcxk_setbrightness(1000); |
| 62 | } |
| 63 | VIDEO_ENABLE_DDR |= VIDEO_ENABLE_PIN; |
| 64 | VIDEO_ENABLE_PORT |= VIDEO_ENABLE_PIN; |
| 65 | VIDEO_ENABLE_PORT &= ~VIDEO_ENABLE_PIN; |
| 66 | return 1; |
| 67 | } |
| 68 | |
Wolfgang Denk | dd520bf | 2006-11-30 18:02:20 +0100 | [diff] [blame] | 69 | void vcxk_loadimage(ulong source) |
Heiko Schocher | 9acb626 | 2006-04-20 08:42:42 +0200 | [diff] [blame] | 70 | { |
| 71 | int cnt; |
| 72 | vcxk_acknowledge_wait(); |
| 73 | for (cnt=0; cnt<16384; cnt++) |
| 74 | { |
| 75 | VCXK_BWS[cnt*2] = (*(vu_char*) source); |
| 76 | source++; |
| 77 | } |
| 78 | vcxk_request(); |
| 79 | } |
| 80 | |
| 81 | void vcxk_cls(void) |
| 82 | { |
| 83 | vcxk_acknowledge_wait(); |
| 84 | vcxk_clear(); |
| 85 | vcxk_request(); |
| 86 | } |
| 87 | |
| 88 | void vcxk_clear(void) |
| 89 | { |
| 90 | int cnt; |
| 91 | for (cnt=0; cnt<16384; cnt++) |
| 92 | { |
| 93 | VCXK_BWS[cnt*2] = 0x00; |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | void vcxk_setbrightness(short brightness) |
| 98 | { |
| 99 | VCXK_BWS[0x8000]=(brightness >> 4) +2; |
| 100 | VCXK_BWS[0xC000]= (brightness + 23) >> 8; |
| 101 | VCXK_BWS[0xC001]= (brightness + 23) & 0xFF; |
| 102 | } |
| 103 | |
| 104 | int vcxk_request(void) |
| 105 | { |
| 106 | if (vcxk_driver) |
| 107 | { |
| 108 | /* use flash resist driver */ |
| 109 | } |
| 110 | else |
| 111 | { |
| 112 | VIDEO_REQUEST_PORT &= ~VIDEO_REQUEST_PIN; |
| 113 | VIDEO_REQUEST_PORT |= VIDEO_REQUEST_PIN; |
| 114 | } |
| 115 | return 1; |
| 116 | } |
| 117 | |
| 118 | int vcxk_acknowledge_wait(void) |
| 119 | { |
| 120 | if (vcxk_driver) |
| 121 | { |
| 122 | /* use flash resist driver */ |
| 123 | } |
| 124 | else |
| 125 | { |
| 126 | while (!(VIDEO_ACKNOWLEDGE_PORT & VIDEO_ACKNOWLEDGE_PIN)); |
| 127 | } |
| 128 | return 1; |
| 129 | } |
| 130 | |
| 131 | ulong search_vcxk_driver(void) |
| 132 | { |
| 133 | return 0; |
| 134 | } |
| 135 | |
| 136 | /* eof */ |