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
 
116 theseven 37
.section .text.lcd_get_width, "ax", %progbits
38
.align 2
39
.global lcd_get_width
40
.type lcd_get_width, %function
41
lcd_get_width:
42
	mov	r0, #176
43
	mov	pc, lr
44
.size lcd_get_width, .-lcd_get_width
45
 
46
.section .text.lcd_get_height, "ax", %progbits
47
.align 2
48
.global lcd_get_height
49
.type lcd_get_height, %function
50
lcd_get_height:
51
	mov	r0, #132
52
	mov	pc, lr
53
.size lcd_get_height, .-lcd_get_height
54
 
55
.section .text.lcd_get_bytes_per_pixel, "ax", %progbits
56
.align 2
57
.global lcd_get_bytes_per_pixel
58
.type lcd_get_heightbytes_per_pixel, %function
59
lcd_get_bytes_per_pixel:
60
	mov	r0, #2
61
	mov	pc, lr
62
.size lcd_get_bytes_per_pixel, .-lcd_get_bytes_per_pixel
63
 
2 theseven 64
.section .icode.displaylcd, "ax", %progbits
65
.align 2
66
.global displaylcd
67
.type displaylcd, %function
68
displaylcd:
15 theseven 69
	stmfd	sp!, {r0-r4,lr}
2 theseven 70
	bl	displaylcd_sync
71
	bl	displaylcd_detectlcd
72
	sub	r12, r12, #0x04900000
73
	cmp	r0, #2
74
	bne	displaylcd_othertypes
75
	mov	r0, #0x50
76
	bl	displaylcd_sendlcd2c
77
	ldr	r0, [sp]
78
	bl	displaylcd_sendlcd2d
79
	mov	r0, #0x51
80
	bl	displaylcd_sendlcd2c
81
	ldr	r0, [sp,#0x04]
82
	bl	displaylcd_sendlcd2d
83
	mov	r0, #0x52
84
	bl	displaylcd_sendlcd2c
15 theseven 85
	ldr	r0, [sp,#0x08]
2 theseven 86
	bl	displaylcd_sendlcd2d
87
	mov	r0, #0x53
88
	bl	displaylcd_sendlcd2c
15 theseven 89
	ldr	r0, [sp,#0x0c]
2 theseven 90
	bl	displaylcd_sendlcd2d
91
	mov	r0, #0x20
92
	bl	displaylcd_sendlcd2c
93
	ldr	r0, [sp]
94
	bl	displaylcd_sendlcd2d
95
	mov	r0, #0x21
96
	bl	displaylcd_sendlcd2c
15 theseven 97
	ldr	r0, [sp,#0x08]
2 theseven 98
	bl	displaylcd_sendlcd2d
99
	mov	r0, #0x22
100
	bl	displaylcd_sendlcd2c
101
	b	displaylcd_blit
102
displaylcd_othertypes:
103
	mov	r0, #0x2a
104
	bl	displaylcd_sendlcdc
105
	ldr	r0, [sp]
106
	bl	displaylcd_sendlcd2d
107
	ldr	r0, [sp,#0x04]
108
	bl	displaylcd_sendlcd2d
109
	mov	r0, #0x2b
110
	bl	displaylcd_sendlcdc
15 theseven 111
	ldr	r0, [sp,#0x08]
2 theseven 112
	bl	displaylcd_sendlcd2d
15 theseven 113
	ldr	r0, [sp,#0x0c]
2 theseven 114
	bl	displaylcd_sendlcd2d
115
	mov	r0, #0x2c
116
	bl	displaylcd_sendlcdc
117
displaylcd_blit:
15 theseven 118
	ldmia	sp, {r0-r3}
2 theseven 119
	sub	r1, r0
120
	add	r1, r1, #1
121
	sub	r3, r2
122
	add	r3, r3, #1
123
	mul	r2, r1, r3
15 theseven 124
	ldr	r1, [sp,#0x18]
122 theseven 125
	cmp	r1, #-1
2 theseven 126
	bne	displaylcd_dma
127
displaylcd_pixel:
15 theseven 128
	ldr	r0, [sp,#0x1c]
2 theseven 129
	bl	displaylcd_sendlcd2d
130
	subs	r2, r2, #1
131
	bne	displaylcd_pixel
15 theseven 132
	ldmfd	sp!, {r0-r4,pc}
2 theseven 133
displaylcd_dma:
134
	mov	r4, #0x38000000
15 theseven 135
	orr	r4, r4, #0x400000
2 theseven 136
	mov	r0, #0x20000000
15 theseven 137
	orr	r0, r0, #0x190000
2 theseven 138
	str	r0, [r4,#0x104]
139
	str	r1, [r4,#0x100]
140
	mov	r0, r2,lsr#1
141
	sub	r0, r0, #1
142
	str	r0, [r4,#0x108]
143
	bl	clean_dcache
144
	mov	r0, #4
145
	str	r0, [r4,#0x114]
15 theseven 146
	ldmfd	sp!, {r0-r4,pc}
2 theseven 147
 
148
displaylcd_sendlcd2c:
149
	ldr	r4, [r12,#0x1c]
8 theseven 150
	tst	r4, #0x10
2 theseven 151
	bne	displaylcd_sendlcd2c
152
	mov	r4, r0,lsr#8
153
	str	r4, [r12,#0x04]
154
	and	r0, r0, #0xff
155
displaylcd_sendlcdc:
8 theseven 156
	ldrh	r4, [r12,#0x1c]
157
	tst	r4, #0x10
2 theseven 158
	bne	displaylcd_sendlcdc
8 theseven 159
	strh	r0, [r12,#0x04]
2 theseven 160
	mov	pc, lr
161
displaylcd_sendlcd2d:
8 theseven 162
	ldrh	r4, [r12,#0x1c]
163
	tst	r4, #0x10
2 theseven 164
	bne	displaylcd_sendlcd2d
165
	mov	r4, r0,lsr#8
8 theseven 166
	strh	r4, [r12,#0x40]
2 theseven 167
	and	r0, r0, #0xff
168
displaylcd_sendlcdd:
8 theseven 169
	ldrh	r4, [r12,#0x1c]
170
	tst	r4, #0x10
2 theseven 171
	bne	displaylcd_sendlcdd
8 theseven 172
	strh	r0, [r12,#0x40]
2 theseven 173
	mov	pc, lr
174
 
175
displaylcd_detectlcd:
176
	mov	r12, #0x3c000000
177
	orr	r12, r12, #0xf00000
178
	ldr	r0, [r12,#0xd0]
179
	bic	r0, r0, #0x0f
180
	str	r0, [r12,#0xd0]
181
	ldr	r0, [r12,#0xe0]
182
	bic	r0, r0, #0xf0
183
	str	r0, [r12,#0xe0]
184
	ldr	r0, [r12,#0xd4]
185
	and	r0, r0, #1
186
	ldr	r1, [r12,#0xe4]
187
	and	r1, r1, #2
188
	orr	r0, r0, r1
189
	mov	pc, lr
190
.size displaylcd, .-displaylcd
191
 
192
 
193
.section .icode.displaylcd_sync, "ax", %progbits
194
.align 2
195
.global displaylcd_sync
196
.type displaylcd_sync, %function
197
displaylcd_sync:
15 theseven 198
	str	lr, [sp,#-4]!
199
displaylcd_sync_wait:
2 theseven 200
	mov	r1, #0x38000000
15 theseven 201
	orr	r1, r1, #0x400000
2 theseven 202
	ldr	r0, [r1,#0x184]
15 theseven 203
	tst	r0, #0x70000
204
	ldreq	pc, [sp], #4
205
	adr	lr, displaylcd_sync_wait
206
	b	context_switch
207
.size displaylcd_sync, .-displaylcd_sync
208
 
209
.section .icode.displaylcd_busy, "ax", %progbits
210
.align 2
211
.global displaylcd_busy
212
.type displaylcd_busy, %function
213
displaylcd_busy:
214
	mov	r1, #0x38000000
215
	orr	r1, r1, #0x400000
216
	ldr	r0, [r1,#0x184]
217
	and	r0, r0, #0x70000
2 theseven 218
	mov	pc, lr
15 theseven 219
.size displaylcd_busy, .-displaylcd_busy
220
 
221
.section .icode.displaylcd_safe, "ax", %progbits
222
.align 2
223
.global displaylcd_safe
224
.type displaylcd_safe, %function
225
displaylcd_safe:
226
	mov	r1, #0x38000000
227
	orr	r1, r1, #0x400000
228
	ldr	r0, [r1,#0x184]
229
	tst	r0, #0x70000
230
	moveq	r0, #1
231
	movne	r0, #0
232
	mov	pc, lr
233
.size displaylcd_safe, .-displaylcd_safe
234
 
235
.section .icode.INT_DMA8, "ax", %progbits
236
.align 2
237
.global INT_DMA8
238
.type INT_DMA8, %function
239
INT_DMA8:
240
	str	lr, [sp,#-4]!
241
	mov	r1, #0x38000000
242
	orr	r1, r1, #0x400000
243
	mov	r0, #7
244
	str	r0, [r1,#0x114]
245
	bl	lcdconsole_callback
246
	ldr	pc, [sp], #4
247
.size INT_DMA8, .-INT_DMA8
122 theseven 248
 
249
.section .icode.lcd_translate_color, "ax", %progbits
250
.align 2
251
.global lcd_translate_color
252
.type lcd_translate_color, %function
253
lcd_translate_color:
254
	cmp	r0, #0xff
255
	moveq	r0, #-1
256
	moveq	pc, lr
257
	cmp	r0, #0
258
	movne	r0, #0xff000000
259
	orrne	r0, r0, #0xff0000
260
	mov	r2, r2,lsr#2
261
	mov	r1, r1,lsr#3
262
	orr	r0, r0, r3,lsr#3
263
	orr	r0, r0, r2,lsl#5
264
	orr	r0, r0, r1,lsl#11
265
	mov	pc, lr
266
.size lcd_translate_color, .-lcd_translate_color