freemyipod r418 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r417‎ | r418 | r419 >
Date:02:56, 8 January 2011
Author:theseven
Status:new
Tags:
Comment:
UMSboot: Fix iPod Nano 2G LCD driver
Modified paths:
  • /umsboot/target/ipodnano2g/lcd.S (modified) (history)

Diff [purge]

Index: umsboot/target/ipodnano2g/lcd.S
@@ -26,11 +26,16 @@
2727 .global lcd_init
2828 .type lcd_init, %function
2929 lcd_init:
30 - mov r1, #0x38000000
31 - orr r1, r1, #0x400000
 30+ mov r1, #0x38400000
3231 mov r0, #0x20000000
33 - orr r0, r0, #0x190000
 32+ orr r0, r0, #0x590000
3433 str r0, [r1,#0x104]
 34+ orr r1, r1, #0x200000
 35+ mov r0, #0xd00
 36+ orr r0, r0, #0x1
 37+ str r0, [r1]
 38+ mov r0, #0
 39+ str r0, [r1,#0x10]
3540 mov pc, lr
3641 .size lcd_init, .-lcd_init
3742
@@ -51,46 +56,46 @@
5257 b lcd_shutdown_done
5358 lcd_shutdown_type2:
5459 mov r0, #0x07
55 - bl displaylcd_sendlcd2c
 60+ bl displaylcd_sendlcdc
5661 mov r0, #0x200
5762 orr r0, r0, #0x32
58 - bl displaylcd_sendlcd2d
 63+ bl displaylcd_sendlcdd
5964 mov r0, #0x13
60 - bl displaylcd_sendlcd2c
 65+ bl displaylcd_sendlcdc
6166 mov r0, #0x1100
6267 orr r0, #0x37
63 - bl displaylcd_sendlcd2d
 68+ bl displaylcd_sendlcdd
6469 mov r0, #0x07
65 - bl displaylcd_sendlcd2c
 70+ bl displaylcd_sendlcdc
6671 mov r0, #0x200
6772 orr r0, r0, #0x01
68 - bl displaylcd_sendlcd2d
 73+ bl displaylcd_sendlcdd
6974 mov r0, #0x13
70 - bl displaylcd_sendlcd2c
 75+ bl displaylcd_sendlcdc
7176 mov r0, #0x100
7277 orr r0, #0x37
73 - bl displaylcd_sendlcd2d
 78+ bl displaylcd_sendlcdd
7479 mov r0, #0x07
75 - bl displaylcd_sendlcd2c
 80+ bl displaylcd_sendlcdc
7681 mov r0, #0x200
77 - bl displaylcd_sendlcd2d
 82+ bl displaylcd_sendlcdd
7883 mov r0, #0x10
79 - bl displaylcd_sendlcd2c
 84+ bl displaylcd_sendlcdc
8085 mov r0, #0x680
81 - bl displaylcd_sendlcd2d
 86+ bl displaylcd_sendlcdd
8287 mov r0, #0x12
83 - bl displaylcd_sendlcd2c
 88+ bl displaylcd_sendlcdc
8489 mov r0, #0x160
85 - bl displaylcd_sendlcd2d
 90+ bl displaylcd_sendlcdd
8691 mov r0, #0x13
87 - bl displaylcd_sendlcd2c
 92+ bl displaylcd_sendlcdc
8893 mov r0, #0x100
8994 orr r0, r0, #0x27
90 - bl displaylcd_sendlcd2d
 95+ bl displaylcd_sendlcdd
9196 mov r0, #0x10
92 - bl displaylcd_sendlcd2c
 97+ bl displaylcd_sendlcdc
9398 mov r0, #0x600
94 - bl displaylcd_sendlcd2d
 99+ bl displaylcd_sendlcdd
95100 lcd_shutdown_done:
96101 ldmfd sp!, {r4, lr}
97102 mov r0, #5120
@@ -129,7 +134,7 @@
130135 .global displaylcd
131136 .type displaylcd, %function
132137 displaylcd:
133 - stmfd sp!, {r0-r4,lr}
 138+ stmfd sp!, {r0-r5,lr}
134139 bl displaylcd_sync
135140 bl displaylcd_detectlcd
136141 sub r12, r12, #0x04900000
@@ -136,45 +141,45 @@
137142 cmp r0, #2
138143 bne displaylcd_othertypes
139144 mov r0, #0x50
140 - bl displaylcd_sendlcd2c
 145+ bl displaylcd_sendlcdc
141146 ldr r0, [sp]
142 - bl displaylcd_sendlcd2d
 147+ bl displaylcd_sendlcdd
143148 mov r0, #0x51
144 - bl displaylcd_sendlcd2c
 149+ bl displaylcd_sendlcdc
145150 ldr r0, [sp,#0x04]
146 - bl displaylcd_sendlcd2d
 151+ bl displaylcd_sendlcdd
147152 mov r0, #0x52
148 - bl displaylcd_sendlcd2c
 153+ bl displaylcd_sendlcdc
149154 ldr r0, [sp,#0x08]
150 - bl displaylcd_sendlcd2d
 155+ bl displaylcd_sendlcdd
151156 mov r0, #0x53
152 - bl displaylcd_sendlcd2c
 157+ bl displaylcd_sendlcdc
153158 ldr r0, [sp,#0x0c]
154 - bl displaylcd_sendlcd2d
 159+ bl displaylcd_sendlcdd
155160 mov r0, #0x20
156 - bl displaylcd_sendlcd2c
 161+ bl displaylcd_sendlcdc
157162 ldr r0, [sp]
158 - bl displaylcd_sendlcd2d
 163+ bl displaylcd_sendlcdd
159164 mov r0, #0x21
160 - bl displaylcd_sendlcd2c
 165+ bl displaylcd_sendlcdc
161166 ldr r0, [sp,#0x08]
162 - bl displaylcd_sendlcd2d
 167+ bl displaylcd_sendlcdd
163168 mov r0, #0x22
164 - bl displaylcd_sendlcd2c
 169+ bl displaylcd_sendlcdc
165170 b displaylcd_blit
166171 displaylcd_othertypes:
167172 mov r0, #0x2a
168173 bl displaylcd_sendlcdc
169174 ldr r0, [sp]
170 - bl displaylcd_sendlcd2d
 175+ bl displaylcd_sendlcdd
171176 ldr r0, [sp,#0x04]
172 - bl displaylcd_sendlcd2d
 177+ bl displaylcd_sendlcdd
173178 mov r0, #0x2b
174179 bl displaylcd_sendlcdc
175180 ldr r0, [sp,#0x08]
176 - bl displaylcd_sendlcd2d
 181+ bl displaylcd_sendlcdd
177182 ldr r0, [sp,#0x0c]
178 - bl displaylcd_sendlcd2d
 183+ bl displaylcd_sendlcdd
179184 mov r0, #0x2c
180185 bl displaylcd_sendlcdc
181186 displaylcd_blit:
@@ -183,56 +188,61 @@
184189 add r1, r1, #1
185190 sub r3, r2
186191 add r3, r3, #1
187 - mul r2, r1, r3
188 - ldr r1, [sp,#0x18]
 192+ mul r5, r1, r3
 193+ ldr r1, [sp,#0x1c]
 194+ add r12, r12, #0x40
 195+displaylcd_wait:
 196+ ldr r4, [r12,#-0x24]
 197+ tst r4, #8
 198+ bne displaylcd_wait
189199 cmp r1, #-1
190200 bne displaylcd_dma
 201+ ldr r0, [sp,#0x20]
 202+ movs r4, r5,lsl#31
 203+ mov r1, r0
 204+ stmcsia r12, {r0-r1}
 205+ mov r2, r0
 206+ strne r0, [r12]
 207+ mov r3, r0
191208 displaylcd_pixel:
192 - ldr r0, [sp,#0x1c]
193 - bl displaylcd_sendlcd2d
194 - subs r2, r2, #1
 209+ ldr r4, [r12,#-0x24]
 210+ tst r4, #8
195211 bne displaylcd_pixel
196 - ldmfd sp!, {r0-r4,pc}
 212+ subs r5, r5, #4
 213+ stmcsia r12, {r0-r3}
 214+ bhi displaylcd_pixel
 215+ ldmfd sp!, {r0-r5,pc}
197216 displaylcd_dma:
198 - mov r4, #0x38000000
199 - orr r4, r4, #0x400000
 217+ movs r4, r5,lsl#31
 218+ mov r4, #0x38400000
 219+ ldrcsh r2, [r1], #2
200220 mov r0, #0x20000000
201 - orr r0, r0, #0x190000
 221+ ldrcsh r3, [r1], #2
 222+ orr r0, r0, #0x590000
 223+ stmcsia r12, {r2-r3}
 224+ mov r3, r5,lsr#2
 225+ ldrneh r2, [r1], #2
 226+ sub r3, r3, #1
 227+ str r1, [r4,#0x100]
202228 str r0, [r4,#0x104]
203 - str r1, [r4,#0x100]
204 - mov r0, r2,lsr#1
205 - sub r0, r0, #1
206 - str r0, [r4,#0x108]
 229+ str r3, [r4,#0x108]
 230+ strne r2, [r12]
207231 bl clean_dcache
208232 mov r0, #4
209233 str r0, [r4,#0x114]
210 - ldmfd sp!, {r0-r4,pc}
 234+ ldmfd sp!, {r0-r5,pc}
211235
212 -displaylcd_sendlcd2c:
 236+displaylcd_sendlcdc:
213237 ldr r4, [r12,#0x1c]
214238 tst r4, #0x10
215 - bne displaylcd_sendlcd2c
216 - mov r4, r0,lsr#8
217 - str r4, [r12,#0x04]
218 - and r0, r0, #0xff
219 -displaylcd_sendlcdc:
220 - ldrh r4, [r12,#0x1c]
221 - tst r4, #0x10
222239 bne displaylcd_sendlcdc
223 - strh r0, [r12,#0x04]
 240+ str r0, [r12,#0x04]
224241 mov pc, lr
225 -displaylcd_sendlcd2d:
226 - ldrh r4, [r12,#0x1c]
227 - tst r4, #0x10
228 - bne displaylcd_sendlcd2d
229 - mov r4, r0,lsr#8
230 - strh r4, [r12,#0x40]
231 - and r0, r0, #0xff
232242 displaylcd_sendlcdd:
233 - ldrh r4, [r12,#0x1c]
 243+ ldr r4, [r12,#0x1c]
234244 tst r4, #0x10
235245 bne displaylcd_sendlcdd
236 - strh r0, [r12,#0x40]
 246+ str r0, [r12,#0x40]
237247 mov pc, lr
238248
239249 displaylcd_detectlcd:
@@ -260,8 +270,7 @@
261271 displaylcd_sync:
262272 str lr, [sp,#-4]!
263273 displaylcd_sync_wait:
264 - mov r1, #0x38000000
265 - orr r1, r1, #0x400000
 274+ mov r1, #0x38400000
266275 ldr r0, [r1,#0x184]
267276 tst r0, #0x70000
268277 ldreq pc, [sp], #4
@@ -273,8 +282,7 @@
274283 .global displaylcd_busy
275284 .type displaylcd_busy, %function
276285 displaylcd_busy:
277 - mov r1, #0x38000000
278 - orr r1, r1, #0x400000
 286+ mov r1, #0x38400000
279287 ldr r0, [r1,#0x184]
280288 and r0, r0, #0x70000
281289 mov pc, lr
@@ -285,8 +293,7 @@
286294 .global displaylcd_safe
287295 .type displaylcd_safe, %function
288296 displaylcd_safe:
289 - mov r1, #0x38000000
290 - orr r1, r1, #0x400000
 297+ mov r1, #0x38400000
291298 ldr r0, [r1,#0x184]
292299 tst r0, #0x70000
293300 moveq r0, #1
@@ -300,8 +307,7 @@
301308 .type INT_DMA8, %function
302309 INT_DMA8:
303310 str lr, [sp,#-4]!
304 - mov r1, #0x38000000
305 - orr r1, r1, #0x400000
 311+ mov r1, #0x38400000
306312 mov r0, #7
307313 str r0, [r1,#0x114]
308314 bl lcdconsole_callback