Subversion Repositories freemyipod

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 theseven 1
@
2
@
3
@    Copyright 2010 TheSeven
4
@
5
@
6
@    This file is part of emBIOS.
7
@
8
@    emBIOS 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 the
11
@    License, or (at your option) any later version.
12
@
13
@    emBIOS 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.
16
@    See the GNU General Public License for more details.
17
@
18
@    You should have received a copy of the GNU General Public License
19
@    along with emBIOS.  If not, see <http://www.gnu.org/licenses/>.
20
@
21
@
22
 
23
 
15 theseven 24
.section .initcode.lcd_init, "ax", %progbits
25
.align 2
26
.global lcd_init
27
.type lcd_init, %function
28
lcd_init:
29
	mov	r1, #0x38000000
30
	orr	r1, r1, #0x400000
31
	mov	r0, #0x20000000
32
	orr	r0, r0, #0x190000
33
	str	r0, [r1,#0x104]
34
	mov	pc, lr
35
.size lcd_init, .-lcd_init
36
 
181 theseven 37
.section .icode.lcd_shutdown, "ax", %progbits
38
.align 2
39
.global lcd_shutdown
40
.type lcd_shutdown, %function
41
lcd_shutdown:
42
	stmfd	sp!, {r4, lr}
43
	bl	displaylcd_detectlcd
44
	sub	r12, r12, #0x04900000
45
	cmp	r0, #2
46
	beq	lcd_shutdown_type2
47
	mov	r0, #0x28
48
	bl	displaylcd_sendlcdc
49
	mov	r0, #0x10
50
	bl	displaylcd_sendlcdc
51
	b	lcd_shutdown_done
52
lcd_shutdown_type2:
53
	mov	r0, #0x07
54
	bl	displaylcd_sendlcd2c
55
	mov	r0, #0x200
56
	orr	r0, r0, #0x32
57
	bl	displaylcd_sendlcd2d
58
	mov	r0, #0x13
59
	bl	displaylcd_sendlcd2c
60
	mov	r0, #0x1100
61
	orr	r0, #0x37
62
	bl	displaylcd_sendlcd2d
63
	mov	r0, #0x07
64
	bl	displaylcd_sendlcd2c
65
	mov	r0, #0x200
66
	orr	r0, r0, #0x01
67
	bl	displaylcd_sendlcd2d
68
	mov	r0, #0x13
69
	bl	displaylcd_sendlcd2c
70
	mov	r0, #0x100
71
	orr	r0, #0x37
72
	bl	displaylcd_sendlcd2d
73
	mov	r0, #0x07
74
	bl	displaylcd_sendlcd2c
75
	mov	r0, #0x200
76
	bl	displaylcd_sendlcd2d
77
	mov	r0, #0x10
78
	bl	displaylcd_sendlcd2c
79
	mov	r0, #0x680
80
	bl	displaylcd_sendlcd2d
81
	mov	r0, #0x12
82
	bl	displaylcd_sendlcd2c
83
	mov	r0, #0x160
84
	bl	displaylcd_sendlcd2d
85
	mov	r0, #0x13
86
	bl	displaylcd_sendlcd2c
87
	mov	r0, #0x100
88
	orr	r0, r0, #0x27
89
	bl	displaylcd_sendlcd2d
90
	mov	r0, #0x10
91
	bl	displaylcd_sendlcd2c
92
	mov	r0, #0x600
93
	bl	displaylcd_sendlcd2d
94
lcd_shutdown_done:
95
	ldmfd	sp!, {r4, lr}
96
	mov	r0, #5120
97
	b	sleep
98
.size lcd_shutdown, .-lcd_shutdown
99
 
116 theseven 100
.section .text.lcd_get_width, "ax", %progbits
101
.align 2
102
.global lcd_get_width
103
.type lcd_get_width, %function
104
lcd_get_width:
105
	mov	r0, #176
106
	mov	pc, lr
107
.size lcd_get_width, .-lcd_get_width
108
 
109
.section .text.lcd_get_height, "ax", %progbits
110
.align 2
111
.global lcd_get_height
112
.type lcd_get_height, %function
113
lcd_get_height:
114
	mov	r0, #132
115
	mov	pc, lr
116
.size lcd_get_height, .-lcd_get_height
117
 
118
.section .text.lcd_get_bytes_per_pixel, "ax", %progbits
119
.align 2
120
.global lcd_get_bytes_per_pixel
121
.type lcd_get_heightbytes_per_pixel, %function
122
lcd_get_bytes_per_pixel:
123
	mov	r0, #2
124
	mov	pc, lr
125
.size lcd_get_bytes_per_pixel, .-lcd_get_bytes_per_pixel
126
 
2 theseven 127
.section .icode.displaylcd, "ax", %progbits
128
.align 2
129
.global displaylcd
130
.type displaylcd, %function
131
displaylcd:
15 theseven 132
	stmfd	sp!, {r0-r4,lr}
2 theseven 133
	bl	displaylcd_sync
134
	bl	displaylcd_detectlcd
135
	sub	r12, r12, #0x04900000
136
	cmp	r0, #2
137
	bne	displaylcd_othertypes
138
	mov	r0, #0x50
139
	bl	displaylcd_sendlcd2c
140
	ldr	r0, [sp]
141
	bl	displaylcd_sendlcd2d
142
	mov	r0, #0x51
143
	bl	displaylcd_sendlcd2c
144
	ldr	r0, [sp,#0x04]
145
	bl	displaylcd_sendlcd2d
146
	mov	r0, #0x52
147
	bl	displaylcd_sendlcd2c
15 theseven 148
	ldr	r0, [sp,#0x08]
2 theseven 149
	bl	displaylcd_sendlcd2d
150
	mov	r0, #0x53
151
	bl	displaylcd_sendlcd2c
15 theseven 152
	ldr	r0, [sp,#0x0c]
2 theseven 153
	bl	displaylcd_sendlcd2d
154
	mov	r0, #0x20
155
	bl	displaylcd_sendlcd2c
156
	ldr	r0, [sp]
157
	bl	displaylcd_sendlcd2d
158
	mov	r0, #0x21
159
	bl	displaylcd_sendlcd2c
15 theseven 160
	ldr	r0, [sp,#0x08]
2 theseven 161
	bl	displaylcd_sendlcd2d
162
	mov	r0, #0x22
163
	bl	displaylcd_sendlcd2c
164
	b	displaylcd_blit
165
displaylcd_othertypes:
166
	mov	r0, #0x2a
167
	bl	displaylcd_sendlcdc
168
	ldr	r0, [sp]
169
	bl	displaylcd_sendlcd2d
170
	ldr	r0, [sp,#0x04]
171
	bl	displaylcd_sendlcd2d
172
	mov	r0, #0x2b
173
	bl	displaylcd_sendlcdc
15 theseven 174
	ldr	r0, [sp,#0x08]
2 theseven 175
	bl	displaylcd_sendlcd2d
15 theseven 176
	ldr	r0, [sp,#0x0c]
2 theseven 177
	bl	displaylcd_sendlcd2d
178
	mov	r0, #0x2c
179
	bl	displaylcd_sendlcdc
180
displaylcd_blit:
15 theseven 181
	ldmia	sp, {r0-r3}
2 theseven 182
	sub	r1, r0
183
	add	r1, r1, #1
184
	sub	r3, r2
185
	add	r3, r3, #1
186
	mul	r2, r1, r3
15 theseven 187
	ldr	r1, [sp,#0x18]
122 theseven 188
	cmp	r1, #-1
2 theseven 189
	bne	displaylcd_dma
190
displaylcd_pixel:
15 theseven 191
	ldr	r0, [sp,#0x1c]
2 theseven 192
	bl	displaylcd_sendlcd2d
193
	subs	r2, r2, #1
194
	bne	displaylcd_pixel
15 theseven 195
	ldmfd	sp!, {r0-r4,pc}
2 theseven 196
displaylcd_dma:
197
	mov	r4, #0x38000000
15 theseven 198
	orr	r4, r4, #0x400000
2 theseven 199
	mov	r0, #0x20000000
15 theseven 200
	orr	r0, r0, #0x190000
2 theseven 201
	str	r0, [r4,#0x104]
202
	str	r1, [r4,#0x100]
203
	mov	r0, r2,lsr#1
204
	sub	r0, r0, #1
205
	str	r0, [r4,#0x108]
206
	bl	clean_dcache
207
	mov	r0, #4
208
	str	r0, [r4,#0x114]
15 theseven 209
	ldmfd	sp!, {r0-r4,pc}
2 theseven 210
 
211
displaylcd_sendlcd2c:
212
	ldr	r4, [r12,#0x1c]
8 theseven 213
	tst	r4, #0x10
2 theseven 214
	bne	displaylcd_sendlcd2c
215
	mov	r4, r0,lsr#8
216
	str	r4, [r12,#0x04]
217
	and	r0, r0, #0xff
218
displaylcd_sendlcdc:
8 theseven 219
	ldrh	r4, [r12,#0x1c]
220
	tst	r4, #0x10
2 theseven 221
	bne	displaylcd_sendlcdc
8 theseven 222
	strh	r0, [r12,#0x04]
2 theseven 223
	mov	pc, lr
224
displaylcd_sendlcd2d:
8 theseven 225
	ldrh	r4, [r12,#0x1c]
226
	tst	r4, #0x10
2 theseven 227
	bne	displaylcd_sendlcd2d
228
	mov	r4, r0,lsr#8
8 theseven 229
	strh	r4, [r12,#0x40]
2 theseven 230
	and	r0, r0, #0xff
231
displaylcd_sendlcdd:
8 theseven 232
	ldrh	r4, [r12,#0x1c]
233
	tst	r4, #0x10
2 theseven 234
	bne	displaylcd_sendlcdd
8 theseven 235
	strh	r0, [r12,#0x40]
2 theseven 236
	mov	pc, lr
237
 
238
displaylcd_detectlcd:
239
	mov	r12, #0x3c000000
240
	orr	r12, r12, #0xf00000
241
	ldr	r0, [r12,#0xd0]
242
	bic	r0, r0, #0x0f
243
	str	r0, [r12,#0xd0]
244
	ldr	r0, [r12,#0xe0]
245
	bic	r0, r0, #0xf0
246
	str	r0, [r12,#0xe0]
247
	ldr	r0, [r12,#0xd4]
248
	and	r0, r0, #1
249
	ldr	r1, [r12,#0xe4]
250
	and	r1, r1, #2
251
	orr	r0, r0, r1
252
	mov	pc, lr
253
.size displaylcd, .-displaylcd
254
 
255
 
256
.section .icode.displaylcd_sync, "ax", %progbits
257
.align 2
258
.global displaylcd_sync
259
.type displaylcd_sync, %function
260
displaylcd_sync:
15 theseven 261
	str	lr, [sp,#-4]!
262
displaylcd_sync_wait:
2 theseven 263
	mov	r1, #0x38000000
15 theseven 264
	orr	r1, r1, #0x400000
2 theseven 265
	ldr	r0, [r1,#0x184]
15 theseven 266
	tst	r0, #0x70000
267
	ldreq	pc, [sp], #4
268
	adr	lr, displaylcd_sync_wait
269
	b	context_switch
270
.size displaylcd_sync, .-displaylcd_sync
271
 
272
.section .icode.displaylcd_busy, "ax", %progbits
273
.align 2
274
.global displaylcd_busy
275
.type displaylcd_busy, %function
276
displaylcd_busy:
277
	mov	r1, #0x38000000
278
	orr	r1, r1, #0x400000
279
	ldr	r0, [r1,#0x184]
280
	and	r0, r0, #0x70000
2 theseven 281
	mov	pc, lr
15 theseven 282
.size displaylcd_busy, .-displaylcd_busy
283
 
284
.section .icode.displaylcd_safe, "ax", %progbits
285
.align 2
286
.global displaylcd_safe
287
.type displaylcd_safe, %function
288
displaylcd_safe:
289
	mov	r1, #0x38000000
290
	orr	r1, r1, #0x400000
291
	ldr	r0, [r1,#0x184]
292
	tst	r0, #0x70000
293
	moveq	r0, #1
294
	movne	r0, #0
295
	mov	pc, lr
296
.size displaylcd_safe, .-displaylcd_safe
297
 
298
.section .icode.INT_DMA8, "ax", %progbits
299
.align 2
300
.global INT_DMA8
301
.type INT_DMA8, %function
302
INT_DMA8:
303
	str	lr, [sp,#-4]!
304
	mov	r1, #0x38000000
305
	orr	r1, r1, #0x400000
306
	mov	r0, #7
307
	str	r0, [r1,#0x114]
308
	bl	lcdconsole_callback
309
	ldr	pc, [sp], #4
310
.size INT_DMA8, .-INT_DMA8
122 theseven 311
 
312
.section .icode.lcd_translate_color, "ax", %progbits
313
.align 2
314
.global lcd_translate_color
315
.type lcd_translate_color, %function
316
lcd_translate_color:
317
	cmp	r0, #0xff
318
	moveq	r0, #-1
319
	moveq	pc, lr
320
	cmp	r0, #0
321
	movne	r0, #0xff000000
322
	orrne	r0, r0, #0xff0000
323
	mov	r2, r2,lsr#2
324
	mov	r1, r1,lsr#3
325
	orr	r0, r0, r3,lsr#3
326
	orr	r0, r0, r2,lsl#5
327
	orr	r0, r0, r1,lsl#11
328
	mov	pc, lr
329
.size lcd_translate_color, .-lcd_translate_color