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