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