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
 
24
.section .icode.displaylcd, "ax", %progbits
25
.align 2
26
.global displaylcd
27
.type displaylcd, %function
28
displaylcd:
29
	stmfd	sp!, {r0,r1,r4,lr}
30
	bl	displaylcd_sync
31
	bl	displaylcd_detectlcd
32
	sub	r12, r12, #0x04900000
33
	cmp	r0, #2
34
	bne	displaylcd_othertypes
35
	mov	r0, #0x50
36
	bl	displaylcd_sendlcd2c
37
	ldr	r0, [sp]
38
	bl	displaylcd_sendlcd2d
39
	mov	r0, #0x51
40
	bl	displaylcd_sendlcd2c
41
	ldr	r0, [sp,#0x04]
42
	bl	displaylcd_sendlcd2d
43
	mov	r0, #0x52
44
	bl	displaylcd_sendlcd2c
45
	mov	r0, r2
46
	bl	displaylcd_sendlcd2d
47
	mov	r0, #0x53
48
	bl	displaylcd_sendlcd2c
49
	mov	r0, r3
50
	bl	displaylcd_sendlcd2d
51
	mov	r0, #0x20
52
	bl	displaylcd_sendlcd2c
53
	ldr	r0, [sp]
54
	bl	displaylcd_sendlcd2d
55
	mov	r0, #0x21
56
	bl	displaylcd_sendlcd2c
57
	mov	r0, r2
58
	bl	displaylcd_sendlcd2d
59
	mov	r0, #0x22
60
	bl	displaylcd_sendlcd2c
61
	b	displaylcd_blit
62
displaylcd_othertypes:
63
	mov	r0, #0x2a
64
	bl	displaylcd_sendlcdc
65
	ldr	r0, [sp]
66
	bl	displaylcd_sendlcd2d
67
	ldr	r0, [sp,#0x04]
68
	bl	displaylcd_sendlcd2d
69
	mov	r0, #0x2b
70
	bl	displaylcd_sendlcdc
71
	mov	r0, r2
72
	bl	displaylcd_sendlcd2d
73
	mov	r0, r3
74
	bl	displaylcd_sendlcd2d
75
	mov	r0, #0x2c
76
	bl	displaylcd_sendlcdc
77
displaylcd_blit:
78
	ldmia	sp, {r0,r1}
79
	sub	r1, r0
80
	add	r1, r1, #1
81
	sub	r3, r2
82
	add	r3, r3, #1
83
	mul	r2, r1, r3
84
	ldr	r1, [sp,#0x10]
85
	cmp	r1, #0x40000000
86
	bne	displaylcd_dma
87
displaylcd_pixel:
88
	ldr	r0, [sp,#0x14]
89
	bl	displaylcd_sendlcd2d
90
	subs	r2, r2, #1
91
	bne	displaylcd_pixel
92
	ldmfd	sp!, {r0,r1,r4,pc}
93
displaylcd_dma:
94
	mov	r4, #0x38000000
95
	add	r4, r4, #0x400000
96
	mov	r0, #0x20000000
97
	orr	r0, r0, #0x180000
98
	str	r0, [r4,#0x104]
99
	str	r1, [r4,#0x100]
100
	mov	r0, r2,lsr#1
101
	sub	r0, r0, #1
102
	str	r0, [r4,#0x108]
103
	bl	clean_dcache
104
	mov	r0, #4
105
	str	r0, [r4,#0x114]
106
	ldmfd	sp!, {r0,r1,r4,pc}
107
 
108
displaylcd_sendlcd2c:
109
	ldr	r4, [r12,#0x1c]
110
	ands	r4, r4, #0x10
111
	bne	displaylcd_sendlcd2c
112
	mov	r4, r0,lsr#8
113
	str	r4, [r12,#0x04]
114
	and	r0, r0, #0xff
115
displaylcd_sendlcdc:
116
	ldr	r4, [r12,#0x1c]
117
	ands	r4, r4, #0x10
118
	bne	displaylcd_sendlcdc
119
	str	r0, [r12,#0x04]
120
	mov	pc, lr
121
displaylcd_sendlcd2d:
122
	ldr	r4, [r12,#0x1c]
123
	ands	r4, r4, #0x10
124
	bne	displaylcd_sendlcd2d
125
	mov	r4, r0,lsr#8
126
	str	r4, [r12,#0x40]
127
	and	r0, r0, #0xff
128
displaylcd_sendlcdd:
129
	ldr	r4, [r12,#0x1c]
130
	ands	r4, r4, #0x10
131
	bne	displaylcd_sendlcdd
132
	str	r0, [r12,#0x40]
133
	mov	pc, lr
134
 
135
displaylcd_detectlcd:
136
	mov	r12, #0x3c000000
137
	orr	r12, r12, #0xf00000
138
	ldr	r0, [r12,#0xd0]
139
	bic	r0, r0, #0x0f
140
	str	r0, [r12,#0xd0]
141
	ldr	r0, [r12,#0xe0]
142
	bic	r0, r0, #0xf0
143
	str	r0, [r12,#0xe0]
144
	ldr	r0, [r12,#0xd4]
145
	and	r0, r0, #1
146
	ldr	r1, [r12,#0xe4]
147
	and	r1, r1, #2
148
	orr	r0, r0, r1
149
	mov	pc, lr
150
.size displaylcd, .-displaylcd
151
 
152
 
153
.section .icode.displaylcd_sync, "ax", %progbits
154
.align 2
155
.global displaylcd_sync
156
.type displaylcd_sync, %function
157
displaylcd_sync:
158
	mov	r1, #0x38000000
159
	add	r1, r1, #0x400000
160
displaylcd_sync_wait:
161
	ldr	r0, [r1,#0x184]
162
	tst	r0, #0x40000
163
	bne	displaylcd_sync_wait
164
	mov	pc, lr
165
.size displaylcd_sync, .-displaylcd_sync