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
 
2 theseven 132
.section .icode.displaylcd, "ax", %progbits
133
.align 2
134
.global displaylcd
135
.type displaylcd, %function
136
displaylcd:
322 theseven 137
	stmfd	sp!, {r0-r5,lr}
2 theseven 138
	bl	displaylcd_sync
139
	bl	displaylcd_detectlcd
140
	sub	r12, r12, #0x04900000
141
	cmp	r0, #2
142
	bne	displaylcd_othertypes
143
	mov	r0, #0x50
322 theseven 144
	bl	displaylcd_sendlcdc
2 theseven 145
	ldr	r0, [sp]
322 theseven 146
	bl	displaylcd_sendlcdd
2 theseven 147
	mov	r0, #0x51
322 theseven 148
	bl	displaylcd_sendlcdc
2 theseven 149
	ldr	r0, [sp,#0x04]
322 theseven 150
	bl	displaylcd_sendlcdd
2 theseven 151
	mov	r0, #0x52
322 theseven 152
	bl	displaylcd_sendlcdc
15 theseven 153
	ldr	r0, [sp,#0x08]
322 theseven 154
	bl	displaylcd_sendlcdd
2 theseven 155
	mov	r0, #0x53
322 theseven 156
	bl	displaylcd_sendlcdc
15 theseven 157
	ldr	r0, [sp,#0x0c]
322 theseven 158
	bl	displaylcd_sendlcdd
2 theseven 159
	mov	r0, #0x20
322 theseven 160
	bl	displaylcd_sendlcdc
2 theseven 161
	ldr	r0, [sp]
322 theseven 162
	bl	displaylcd_sendlcdd
2 theseven 163
	mov	r0, #0x21
322 theseven 164
	bl	displaylcd_sendlcdc
15 theseven 165
	ldr	r0, [sp,#0x08]
322 theseven 166
	bl	displaylcd_sendlcdd
2 theseven 167
	mov	r0, #0x22
322 theseven 168
	bl	displaylcd_sendlcdc
2 theseven 169
	b	displaylcd_blit
170
displaylcd_othertypes:
171
	mov	r0, #0x2a
172
	bl	displaylcd_sendlcdc
173
	ldr	r0, [sp]
322 theseven 174
	bl	displaylcd_sendlcdd
2 theseven 175
	ldr	r0, [sp,#0x04]
322 theseven 176
	bl	displaylcd_sendlcdd
2 theseven 177
	mov	r0, #0x2b
178
	bl	displaylcd_sendlcdc
15 theseven 179
	ldr	r0, [sp,#0x08]
322 theseven 180
	bl	displaylcd_sendlcdd
15 theseven 181
	ldr	r0, [sp,#0x0c]
322 theseven 182
	bl	displaylcd_sendlcdd
2 theseven 183
	mov	r0, #0x2c
184
	bl	displaylcd_sendlcdc
185
displaylcd_blit:
15 theseven 186
	ldmia	sp, {r0-r3}
2 theseven 187
	sub	r1, r0
188
	add	r1, r1, #1
189
	sub	r3, r2
190
	add	r3, r3, #1
322 theseven 191
	mul	r5, r1, r3
192
	ldr	r1, [sp,#0x1c]
193
	add	r12, r12, #0x40
194
displaylcd_wait:
195
	ldr	r4, [r12,#-0x24]
196
	tst	r4, #8
197
	bne	displaylcd_wait
122 theseven 198
	cmp	r1, #-1
2 theseven 199
	bne	displaylcd_dma
322 theseven 200
	ldr	r0, [sp,#0x20]
201
	movs	r4, r5,lsl#31
202
	mov	r1, r0
203
	stmcsia r12, {r0-r1}
204
	mov	r2, r0
205
	strne	r0, [r12]
206
	mov	r3, r0
2 theseven 207
displaylcd_pixel:
322 theseven 208
	ldr	r4, [r12,#-0x24]
209
	tst	r4, #8
2 theseven 210
	bne	displaylcd_pixel
322 theseven 211
	subs	r5, r5, #4
212
	stmcsia	r12, {r0-r3}
213
	bhi	displaylcd_pixel
214
	ldmfd	sp!, {r0-r5,pc}
2 theseven 215
displaylcd_dma:
322 theseven 216
	movs	r4, r5,lsl#31
217
	mov	r4, #0x38400000
218
	ldrcsh	r2, [r1], #2
2 theseven 219
	mov	r0, #0x20000000
322 theseven 220
	ldrcsh	r3, [r1], #2
221
	orr	r0, r0, #0x590000
222
	stmcsia r12, {r2-r3}
223
	mov	r3, r5,lsr#2
224
	ldrneh	r2, [r1], #2
225
	sub	r3, r3, #1
226
	str	r1, [r4,#0x100]
2 theseven 227
	str	r0, [r4,#0x104]
322 theseven 228
	str	r3, [r4,#0x108]
229
	strne	r2, [r12]
2 theseven 230
	bl	clean_dcache
231
	mov	r0, #4
232
	str	r0, [r4,#0x114]
322 theseven 233
	ldmfd	sp!, {r0-r5,pc}
2 theseven 234
 
322 theseven 235
displaylcd_sendlcdc:
2 theseven 236
	ldr	r4, [r12,#0x1c]
8 theseven 237
	tst	r4, #0x10
2 theseven 238
	bne	displaylcd_sendlcdc
322 theseven 239
	str	r0, [r12,#0x04]
2 theseven 240
	mov	pc, lr
241
displaylcd_sendlcdd:
322 theseven 242
	ldr	r4, [r12,#0x1c]
8 theseven 243
	tst	r4, #0x10
2 theseven 244
	bne	displaylcd_sendlcdd
322 theseven 245
	str	r0, [r12,#0x40]
2 theseven 246
	mov	pc, lr
247
 
248
displaylcd_detectlcd:
249
	mov	r12, #0x3c000000
250
	orr	r12, r12, #0xf00000
251
	ldr	r0, [r12,#0xd0]
252
	bic	r0, r0, #0x0f
253
	str	r0, [r12,#0xd0]
254
	ldr	r0, [r12,#0xe0]
255
	bic	r0, r0, #0xf0
256
	str	r0, [r12,#0xe0]
257
	ldr	r0, [r12,#0xd4]
258
	and	r0, r0, #1
259
	ldr	r1, [r12,#0xe4]
260
	and	r1, r1, #2
261
	orr	r0, r0, r1
262
	mov	pc, lr
263
.size displaylcd, .-displaylcd
264
 
265
 
266
.section .icode.displaylcd_sync, "ax", %progbits
267
.align 2
268
.global displaylcd_sync
269
.type displaylcd_sync, %function
270
displaylcd_sync:
15 theseven 271
	str	lr, [sp,#-4]!
272
displaylcd_sync_wait:
322 theseven 273
	mov	r1, #0x38400000
2 theseven 274
	ldr	r0, [r1,#0x184]
15 theseven 275
	tst	r0, #0x70000
276
	ldreq	pc, [sp], #4
277
	adr	lr, displaylcd_sync_wait
325 theseven 278
	mov	r0, #0x100
279
	b	sleep
15 theseven 280
.size displaylcd_sync, .-displaylcd_sync
281
 
282
.section .icode.displaylcd_busy, "ax", %progbits
283
.align 2
284
.global displaylcd_busy
285
.type displaylcd_busy, %function
286
displaylcd_busy:
322 theseven 287
	mov	r1, #0x38400000
15 theseven 288
	ldr	r0, [r1,#0x184]
289
	and	r0, r0, #0x70000
2 theseven 290
	mov	pc, lr
15 theseven 291
.size displaylcd_busy, .-displaylcd_busy
292
 
293
.section .icode.displaylcd_safe, "ax", %progbits
294
.align 2
295
.global displaylcd_safe
296
.type displaylcd_safe, %function
297
displaylcd_safe:
322 theseven 298
	mov	r1, #0x38400000
15 theseven 299
	ldr	r0, [r1,#0x184]
300
	tst	r0, #0x70000
301
	moveq	r0, #1
302
	movne	r0, #0
303
	mov	pc, lr
304
.size displaylcd_safe, .-displaylcd_safe
305
 
306
.section .icode.INT_DMA8, "ax", %progbits
307
.align 2
308
.global INT_DMA8
309
.type INT_DMA8, %function
310
INT_DMA8:
311
	str	lr, [sp,#-4]!
322 theseven 312
	mov	r1, #0x38400000
15 theseven 313
	mov	r0, #7
314
	str	r0, [r1,#0x114]
315
	bl	lcdconsole_callback
316
	ldr	pc, [sp], #4
317
.size INT_DMA8, .-INT_DMA8
122 theseven 318
 
319
.section .icode.lcd_translate_color, "ax", %progbits
320
.align 2
321
.global lcd_translate_color
322
.type lcd_translate_color, %function
323
lcd_translate_color:
324
	cmp	r0, #0xff
325
	moveq	r0, #-1
326
	moveq	pc, lr
327
	cmp	r0, #0
328
	movne	r0, #0xff000000
329
	orrne	r0, r0, #0xff0000
330
	mov	r2, r2,lsr#2
331
	mov	r1, r1,lsr#3
329 theseven 332
	orr	r0, r0, r3,lsr#3
333
	orr	r0, r0, r2,lsl#5
334
	orr	r0, r0, r1,lsl#11
122 theseven 335
	mov	pc, lr
336
.size lcd_translate_color, .-lcd_translate_color