BOOTLOADER
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
bootloader
drivers
lcd.c
Go to the documentation of this file.
1
/******************************************************
2
* Function: s3c2440 lcd driver
3
*
4
* File: lcd.c
5
* Author: Book Chen
6
* Date: 2008.07.18
7
*******************************************************
8
*/
9
#include "
includes.h
"
10
11
#define LcdIdleState 0
12
13
//volatile static unsigned short (*pLcdBuffer)[SCR_XSIZE_TFT_640480]=(void *)0x33400000;
14
LCD_CONTROL
LcdControl
;
15
16
void
F_LcdInit
(
void
);
17
void
F_LcdSvc
(
void
);
18
INT8U
F_LcdInUseCheck
(
void
);
19
INT8U
F_LcdAllocate
(
INT16U
UserId);
20
INT8U
F_LcdRelease
(
INT16U
UserId);
21
INT8U
F_LcdEnable
(
INT16U
UserId);
22
INT8U
F_LcdDisable
(
INT16U
UserId);
23
INT8U
F_LcdLcdcon1Set
(
INT16U
UserId,
INT32U
Lcdcon1);
24
INT8U
F_LcdLcdcon2Set
(
INT16U
UserId,
INT32U
Lcdcon2);
25
INT8U
F_LcdLcdcon3Set
(
INT16U
UserId,
INT32U
Lcdcon3);
26
INT8U
F_LcdLcdcon4Set
(
INT16U
UserId,
INT32U
Lcdcon4);
27
INT8U
F_LcdLcdcon5Set
(
INT16U
UserId,
INT32U
Lcdcon5);
28
INT8U
F_LcdLcdsaddr1Set
(
INT16U
UserId,
INT32U
Lcdsaddr1);
29
INT8U
F_LcdLcdsaddr2Set
(
INT16U
UserId,
INT32U
Lcdsaddr2);
30
INT8U
F_LcdLcdsaddr3Set
(
INT16U
UserId,
INT32U
Lcdsaddr3);
31
INT8U
F_LcdRedlutSet
(
INT16U
UserId,
INT32U
Redlut);
32
INT8U
F_LcdGreenlutSet
(
INT16U
UserId,
INT32U
Greenlut);
33
INT8U
F_LcdBluelutSet
(
INT16U
UserId,
INT32U
Bluelut);
34
INT8U
F_LcdDithmodeSet
(
INT16U
UserId,
INT32U
Dithmode);
35
INT8U
F_LcdTpalSet
(
INT16U
UserId,
INT32U
Tpal);
36
INT8U
F_LcdLcdintpndSet
(
INT16U
UserId,
INT32U
Lcdintpnd);
37
INT8U
F_LcdLcdsrcpndSet
(
INT16U
UserId,
INT32U
Lcdsrcpnd);
38
INT8U
F_LcdLcdintmskSet
(
INT16U
UserId,
INT32U
Lcdintmsk);
39
INT8U
F_LcdLpcselSet
(
INT16U
UserId,
INT32U
Lpcsel);
40
41
42
void
F_LcdInit
(
void
){
43
//******
44
// GPIO port initial for LCD
45
//******
46
rGPCUP
=0xffffffff;
// disable pull up resistor for GPIO C
47
rGPCCON
=0xaaaa56a9;
// initial value of VD[7:0],LCDVF[2:0],VM,VFRAME,VLINE,VCLK,LEND
48
//rGPCCON=0xaaaaaaaa;
49
rGPDUP
=0xffffffff;
// disable pull up register for FPIO D
50
rGPDCON
=0xaaaaaaaa;
// VD[15:8]
51
//******
52
// LCD register initial
53
//******
54
LcdControl.
pLcdRegster
=(
LCD_REGISTER
*)0x4d000000;
55
LcdControl.
pLcdRegster
->
LCDCON1
=0x00000000;
56
LcdControl.
pLcdRegster
->
LCDCON2
=0x00000000;
57
LcdControl.
pLcdRegster
->
LCDCON3
=0x00000000;
58
LcdControl.
pLcdRegster
->
LCDCON4
=0x00000000;
59
LcdControl.
pLcdRegster
->
LCDCON5
=0x00000000;
60
LcdControl.
pLcdRegster
->
LCDSADDR1
=0x00000000;
61
LcdControl.
pLcdRegster
->
LCDSADDR2
=0x00000000;
62
LcdControl.
pLcdRegster
->
LCDSADDR3
=0x00000000;
63
LcdControl.
pLcdRegster
->
LCDINTMSK
=0x00000003;
64
LcdControl.
pLcdRegster
->
LPCSEL
=0x00000004;
65
LcdControl.
pLcdRegster
->
TPAL
=0;
66
67
/*LcdControl.pLcdRegster->LCDCON1=LCD_CLKVAL_0|LCD_MMODE_1|LCD_PNRMODE_3|
68
LCD_BPPMODE_9|LCD_ENVID_DISABLE;
69
LcdControl.pLcdRegster->LCDCON2=LCD_VBPD|LCD_LINEVAL|LCD_VFPD|LCD_VSPW;
70
LcdControl.pLcdRegster->LCDCON3=LCD_HBPD|LCD_HOZVAL|LCD_HFPD;
71
LcdControl.pLcdRegster->LCDCON4=LCD_MVAL|LCD_HSPW;
72
LcdControl.pLcdRegster->LCDCON5=LCD_FRM565_1|LCD_INVVCLK_1|LCD_PWREN_1|
73
LCD_HWSWP_1;
74
LcdControl.pLcdRegster->LCDSADDR1=(((INT32U)pLcdBuffer>>22)<<21)|(((INT32U)pLcdBuffer>>1)&0x1fffff);
75
LcdControl.pLcdRegster->LCDSADDR2=(((INT32U)pLcdBuffer+(LCD_HORIZONTAL_SIZE*LCD_VERTICAL_SIZE*2))>>1)&0x1fffff;
76
LcdControl.pLcdRegster->LCDSADDR3=(0<<11)|(LCD_HORIZONTAL_SIZE);
77
LcdControl.pLcdRegster->LCDINTMSK|=3;
78
LcdControl.pLcdRegster->LPCSEL&=~7;
79
LcdControl.pLcdRegster->TPAL=0;
80
*/
81
LcdControl.
InUse
=
FALSE
;
82
LcdControl.
Id
=
ID_LCD
;
83
LcdControl.
State
=
LcdIdleState
;
84
}
85
void
F_LcdSvc
(
void
){}
86
INT8U
F_LcdInUseCheck
(
void
){
87
if
(LcdControl.
InUse
==
TRUE
)
return
TRUE
;
88
else
return
FALSE
;
89
}
90
INT8U
F_LcdAllocate
(
INT16U
UserId){
91
if
(LcdControl.
InUse
==
FALSE
){
92
LcdControl.
InUse
=
TRUE
;
93
LcdControl.
UserId
=UserId;
94
return
TRUE
;
95
}
96
else
return
FALSE
;
97
}
98
INT8U
F_LcdRelease
(
INT16U
UserId){
99
if
((LcdControl.
InUse
==
TRUE
)&&(LcdControl.
UserId
==UserId)){
100
LcdControl.
InUse
=
FALSE
;
101
return
TRUE
;
102
}
103
else
return
FALSE
;
104
}
105
INT8U
F_LcdEnable
(
INT16U
UserId){
106
if
((LcdControl.
InUse
==
TRUE
)&&(LcdControl.
UserId
==UserId)){
107
LcdControl.
pLcdRegster
->
LCDCON1
|=0x01;
108
return
TRUE
;
109
}
110
else
return
FALSE
;
111
}
112
INT8U
F_LcdDisable
(
INT16U
UserId){
113
if
((LcdControl.
InUse
==
TRUE
)&&(LcdControl.
UserId
==UserId)){
114
LcdControl.
pLcdRegster
->
LCDCON1
&=~0x01;
115
return
TRUE
;
116
}
117
else
return
FALSE
;
118
}
119
INT8U
F_LcdLcdcon1Set
(
INT16U
UserId,
INT32U
Lcdcon1){
120
if
((LcdControl.
InUse
==
TRUE
)&&(LcdControl.
UserId
==UserId)){
121
LcdControl.
pLcdRegster
->
LCDCON1
=Lcdcon1;
122
return
TRUE
;
123
}
124
else
return
FALSE
;
125
}
126
INT8U
F_LcdLcdcon2Set
(
INT16U
UserId,
INT32U
Lcdcon2){
127
if
((LcdControl.
InUse
==
TRUE
)&&(LcdControl.
UserId
==UserId)){
128
LcdControl.
pLcdRegster
->
LCDCON2
=Lcdcon2;
129
return
TRUE
;
130
}
131
else
return
FALSE
;
132
}
133
INT8U
F_LcdLcdcon3Set
(
INT16U
UserId,
INT32U
Lcdcon3){
134
if
((LcdControl.
InUse
==
TRUE
)&&(LcdControl.
UserId
==UserId)){
135
LcdControl.
pLcdRegster
->
LCDCON3
=Lcdcon3;
136
return
TRUE
;
137
}
138
else
return
FALSE
;
139
}
140
INT8U
F_LcdLcdcon4Set
(
INT16U
UserId,
INT32U
Lcdcon4){
141
if
((LcdControl.
InUse
==
TRUE
)&&(LcdControl.
UserId
==UserId)){
142
LcdControl.
pLcdRegster
->
LCDCON4
=Lcdcon4;
143
return
TRUE
;
144
}
145
else
return
FALSE
;
146
}
147
INT8U
F_LcdLcdcon5Set
(
INT16U
UserId,
INT32U
Lcdcon5){
148
if
((LcdControl.
InUse
==
TRUE
)&&(LcdControl.
UserId
==UserId)){
149
LcdControl.
pLcdRegster
->
LCDCON5
=Lcdcon5;
150
return
TRUE
;
151
}
152
else
return
FALSE
;
153
}
154
INT8U
F_LcdLcdsaddr1Set
(
INT16U
UserId,
INT32U
Lcdsaddr1){
155
if
((LcdControl.
InUse
==
TRUE
)&&(LcdControl.
UserId
==UserId)){
156
LcdControl.
pLcdRegster
->
LCDSADDR1
=Lcdsaddr1;
157
return
TRUE
;
158
}
159
else
return
FALSE
;
160
}
161
INT8U
F_LcdLcdsaddr2Set
(
INT16U
UserId,
INT32U
Lcdsaddr2){
162
if
((LcdControl.
InUse
==
TRUE
)&&(LcdControl.
UserId
==UserId)){
163
LcdControl.
pLcdRegster
->
LCDSADDR2
=Lcdsaddr2;
164
return
TRUE
;
165
}
166
else
return
FALSE
;
167
}
168
INT8U
F_LcdLcdsaddr3Set
(
INT16U
UserId,
INT32U
Lcdsaddr3){
169
if
((LcdControl.
InUse
==
TRUE
)&&(LcdControl.
UserId
==UserId)){
170
LcdControl.
pLcdRegster
->
LCDSADDR3
=Lcdsaddr3;
171
return
TRUE
;
172
}
173
else
return
FALSE
;
174
}
175
INT8U
F_LcdRedlutSet
(
INT16U
UserId,
INT32U
Redlut){
176
if
((LcdControl.
InUse
==
TRUE
)&&(LcdControl.
UserId
==UserId)){
177
LcdControl.
pLcdRegster
->
REDLUT
=Redlut;
178
return
TRUE
;
179
}
180
else
return
FALSE
;
181
}
182
INT8U
F_LcdGreenlutSet
(
INT16U
UserId,
INT32U
Greenlut){
183
if
((LcdControl.
InUse
==
TRUE
)&&(LcdControl.
UserId
==UserId)){
184
LcdControl.
pLcdRegster
->
GREENLUT
=Greenlut;
185
return
TRUE
;
186
}
187
else
return
FALSE
;
188
}
189
INT8U
F_LcdBluelutSet
(
INT16U
UserId,
INT32U
Bluelut){
190
if
((LcdControl.
InUse
==
TRUE
)&&(LcdControl.
UserId
==UserId)){
191
LcdControl.
pLcdRegster
->
BLUELUT
=Bluelut;
192
return
TRUE
;
193
}
194
else
return
FALSE
;
195
}
196
INT8U
F_LcdDithmodeSet
(
INT16U
UserId,
INT32U
Dithmode){
197
if
((LcdControl.
InUse
==
TRUE
)&&(LcdControl.
UserId
==UserId)){
198
LcdControl.
pLcdRegster
->
DITHMODE
=Dithmode;
199
return
TRUE
;
200
}
201
else
return
FALSE
;
202
}
203
INT8U
F_LcdTpalSet
(
INT16U
UserId,
INT32U
Tpal){
204
if
((LcdControl.
InUse
==
TRUE
)&&(LcdControl.
UserId
==UserId)){
205
LcdControl.
pLcdRegster
->
TPAL
=Tpal;
206
return
TRUE
;
207
}
208
else
return
FALSE
;
209
}
210
INT8U
F_LcdLcdintpndSet
(
INT16U
UserId,
INT32U
Lcdintpnd){
211
if
((LcdControl.
InUse
==
TRUE
)&&(LcdControl.
UserId
==UserId)){
212
LcdControl.
pLcdRegster
->
LCDINTPND
=Lcdintpnd;
213
return
TRUE
;
214
}
215
else
return
FALSE
;
216
}
217
INT8U
F_LcdLcdsrcpndSet
(
INT16U
UserId,
INT32U
Lcdsrcpnd){
218
if
((LcdControl.
InUse
==
TRUE
)&&(LcdControl.
UserId
==UserId)){
219
LcdControl.
pLcdRegster
->
LCDSRCPND
=Lcdsrcpnd;
220
return
TRUE
;
221
}
222
else
return
FALSE
;
223
}
224
INT8U
F_LcdLcdintmskSet
(
INT16U
UserId,
INT32U
Lcdintmsk){
225
if
((LcdControl.
InUse
==
TRUE
)&&(LcdControl.
UserId
==UserId)){
226
LcdControl.
pLcdRegster
->
LCDINTMSK
=Lcdintmsk;
227
return
TRUE
;
228
}
229
else
return
FALSE
;
230
}
231
INT8U
F_LcdLpcselSet
(
INT16U
UserId,
INT32U
Lpcsel){
232
if
((LcdControl.
InUse
==
TRUE
)&&(LcdControl.
UserId
==UserId)){
233
LcdControl.
pLcdRegster
->
LPCSEL
=Lpcsel;
234
return
TRUE
;
235
}
236
else
return
FALSE
;
237
}
Generated on Wed Jun 13 2012 00:03:08 for BOOTLOADER by
1.8.1.1