Index: emcore/trunk/target/ipodnano4g/lcd.c |
— | — | @@ -89,6 +89,10 @@ |
90 | 90 | |
91 | 91 | void lcd_shutdown() |
92 | 92 | { |
| 93 | + mutex_lock(&lcd_mutex, TIMEOUT_BLOCK); |
| 94 | + displaylcd_sync(); |
| 95 | + while (!(LCDSTATUS & 0x2)); |
| 96 | + LCDCON = 0x41100db8; |
93 | 97 | } |
94 | 98 | |
95 | 99 | bool displaylcd_busy() ICODE_ATTR; |
— | — | @@ -116,6 +120,8 @@ |
117 | 121 | displaylcd_sync(); |
118 | 122 | } |
119 | 123 | else while (DMAC0C4CONFIG & 1); |
| 124 | + while (!(LCDSTATUS & 0x2)); |
| 125 | + LCDCON = 0x41100db8; |
120 | 126 | lcd_send_cmd(0x2a); |
121 | 127 | lcd_send_data(startx); |
122 | 128 | lcd_send_data(endx); |
— | — | @@ -140,7 +146,7 @@ |
141 | 147 | lli->nextlli = last ? NULL : &lcd_lli[i + 1]; |
142 | 148 | lli->control = 0x70240000 | (last ? pixels : 0xfff) |
143 | 149 | | (last ? 0x80000000 : 0) | (solid ? 0 : 0x4000000); |
144 | | - if (!solid) data = (void*)(((uint32_t)data) + 0x1ffe); |
| 150 | + if (!solid) data += 0x1ffe; |
145 | 151 | } |
146 | 152 | clean_dcache(); |
147 | 153 | DMAC0C4CONFIG = 0x88c1; |
— | — | @@ -157,7 +163,7 @@ |
158 | 164 | } |
159 | 165 | |
160 | 166 | void displaylcd_safe_native(unsigned int startx, unsigned int endx, |
161 | | - unsigned int starty, unsigned int endy, void* data) |
| 167 | + unsigned int starty, unsigned int endy, void* data) |
162 | 168 | { |
163 | 169 | int pixels = (endx - startx + 1) * (endy - starty + 1); |
164 | 170 | if (pixels <= 0) return; |
— | — | @@ -223,6 +229,12 @@ |
224 | 230 | __asm__ volatile(" movne r10, #3 \n"); |
225 | 231 | __asm__ volatile(" moveq r10, #0 \n"); |
226 | 232 | __asm__ volatile(" ldr r9, =0x38300040 \n"); |
| 233 | + __asm__ volatile("displaylcd_dither_wait : \n"); |
| 234 | + __asm__ volatile(" ldr r4, [r9,#-0x24] \n"); |
| 235 | + __asm__ volatile(" tst r4, #2 \n"); |
| 236 | + __asm__ volatile(" beq displaylcd_dither_wait \n"); |
| 237 | + __asm__ volatile(" ldr r4, =0x41104eb8 \n"); |
| 238 | + __asm__ volatile(" str r4, [r9,#-0x40] \n"); |
227 | 239 | __asm__ volatile("displaylcd_dither_y: \n"); |
228 | 240 | __asm__ volatile(" ldr lr, [sp] \n"); |
229 | 241 | __asm__ volatile(" mov r4, #0 \n"); |
— | — | @@ -230,7 +242,6 @@ |
231 | 243 | __asm__ volatile(" mov r6, #0 \n"); |
232 | 244 | __asm__ volatile(" mov r7, r8 \n"); |
233 | 245 | __asm__ volatile("displaylcd_dither_x: \n"); |
234 | | - __asm__ volatile(" mov r2, #0 \n"); |
235 | 246 | __asm__ volatile(" ldrb r1, [r3], #1 \n"); |
236 | 247 | __asm__ volatile(" ldrsb r0, [r7] \n"); |
237 | 248 | __asm__ volatile(" add r1, r1, r4 \n"); |
— | — | @@ -238,10 +249,10 @@ |
239 | 250 | __asm__ volatile(" cmp r1, #0xff \n"); |
240 | 251 | __asm__ volatile(" mvnhi r1, r1,asr#31 \n"); |
241 | 252 | __asm__ volatile(" andhi r1, r1, #0xff \n"); |
242 | | - __asm__ volatile(" mov r0, r1,lsr#3 \n"); |
243 | | - __asm__ volatile(" orr r2, r0,lsl#11 \n"); |
244 | | - __asm__ volatile(" sub r1, r1, r0,lsl#3 \n"); |
245 | | - __asm__ volatile(" sub r1, r1, r0,lsr#2 \n"); |
| 253 | + __asm__ volatile(" mov r0, r1,lsr#2 \n"); |
| 254 | + __asm__ volatile(" mov r2, r0,lsl#18 \n"); |
| 255 | + __asm__ volatile(" sub r1, r1, r0,lsl#2 \n"); |
| 256 | + __asm__ volatile(" sub r1, r1, r0,lsr#4 \n"); |
246 | 257 | __asm__ volatile(" mov r4, r4,lsr#1 \n"); |
247 | 258 | __asm__ volatile(" add r4, r4, r1,lsr#2 \n"); |
248 | 259 | __asm__ volatile(" strb r4, [r7], #1 \n"); |
— | — | @@ -254,7 +265,7 @@ |
255 | 266 | __asm__ volatile(" mvnhi r1, r1,asr#31 \n"); |
256 | 267 | __asm__ volatile(" andhi r1, r1, #0xff \n"); |
257 | 268 | __asm__ volatile(" mov r0, r1,lsr#2 \n"); |
258 | | - __asm__ volatile(" orr r2, r0,lsl#5 \n"); |
| 269 | + __asm__ volatile(" orr r2, r2, r0,lsl#10 \n"); |
259 | 270 | __asm__ volatile(" sub r1, r1, r0,lsl#2 \n"); |
260 | 271 | __asm__ volatile(" sub r1, r1, r0,lsr#4 \n"); |
261 | 272 | __asm__ volatile(" mov r5, r5,lsr#1 \n"); |
— | — | @@ -268,18 +279,18 @@ |
269 | 280 | __asm__ volatile(" cmp r1, #0xff \n"); |
270 | 281 | __asm__ volatile(" mvnhi r1, r1,asr#31 \n"); |
271 | 282 | __asm__ volatile(" andhi r1, r1, #0xff \n"); |
272 | | - __asm__ volatile(" mov r0, r1,lsr#3 \n"); |
273 | | - __asm__ volatile(" orr r2, r0 \n"); |
274 | | - __asm__ volatile(" sub r1, r1, r0,lsl#3 \n"); |
275 | | - __asm__ volatile(" sub r1, r1, r0,lsr#2 \n"); |
| 283 | + __asm__ volatile(" mov r0, r1,lsr#2 \n"); |
| 284 | + __asm__ volatile(" orr r2, r2, r0,lsl#2 \n"); |
| 285 | + __asm__ volatile(" sub r1, r1, r0,lsl#2 \n"); |
| 286 | + __asm__ volatile(" sub r1, r1, r0,lsr#4 \n"); |
276 | 287 | __asm__ volatile(" mov r6, r6,lsr#1 \n"); |
277 | 288 | __asm__ volatile(" add r6, r6, r1,lsr#2 \n"); |
278 | 289 | __asm__ volatile(" strb r6, [r7], #1 \n"); |
279 | | - __asm__ volatile("displaylcd_dither_waitlcd: \n"); |
| 290 | + __asm__ volatile("displaylcd_dither_wait2: \n"); |
280 | 291 | __asm__ volatile(" ldr r0, [r9,#-0x24] \n"); |
281 | 292 | __asm__ volatile(" mov r6, r1,asr#1 \n"); |
282 | 293 | __asm__ volatile(" tst r0, #0x10 \n"); |
283 | | - __asm__ volatile(" bne displaylcd_dither_waitlcd\n"); |
| 294 | + __asm__ volatile(" bne displaylcd_dither_wait2 \n"); |
284 | 295 | __asm__ volatile(" str r2, [r9] \n"); |
285 | 296 | __asm__ volatile(" sub r3, r3, r10 \n"); |
286 | 297 | __asm__ volatile(" subs lr, lr, #1 \n"); |