blob: f2fe353dbeb40874938d4fd96ebc9f2975a88523 [file] [log] [blame]
Heiko Schocher9acb6262006-04-20 08:42:42 +02001/*
Wolfgang Denkb1d71352006-06-10 22:00:40 +02002 * (C) Copyright 2005
Heiko Schocher9acb6262006-04-20 08:42:42 +02003 * 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
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020028vu_char *vcxk_bws = (vu_char *)(CONFIG_SYS_CS3_BASE);
Heiko Schocher9acb6262006-04-20 08:42:42 +020029#define VCXK_BWS vcxk_bws
30
31static ulong vcxk_driver;
32
33
34ulong search_vcxk_driver(void);
35void vcxk_cls(void);
36void vcxk_setbrightness(short brightness);
37int vcxk_request(void);
38int vcxk_acknowledge_wait(void);
39void vcxk_clear(void);
40
41int 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 Denkdd520bf2006-11-30 18:02:20 +010069void vcxk_loadimage(ulong source)
Heiko Schocher9acb6262006-04-20 08:42:42 +020070{
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
81void vcxk_cls(void)
82{
83 vcxk_acknowledge_wait();
84 vcxk_clear();
85 vcxk_request();
86}
87
88void vcxk_clear(void)
89{
90 int cnt;
91 for (cnt=0; cnt<16384; cnt++)
92 {
93 VCXK_BWS[cnt*2] = 0x00;
94 }
95}
96
97void 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
104int 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
118int 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
131ulong search_vcxk_driver(void)
132{
133 return 0;
134}
135
136/* eof */