freemyipod r748 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r747‎ | r748 | r749 >
Date:04:13, 13 July 2011
Author:theseven
Status:new
Tags:
Comment:
emCORE: iPod Nano 4G: Make use of the LCD controller's RGB666 capabilities
UMSboot: iPod Nano 4G: Take account for potentially changed LCDCON value
Modified paths:
  • /emcore/trunk/target/ipodnano4g/lcd.c (modified) (history)

Diff [purge]

Index: emcore/trunk/target/ipodnano4g/lcd.c
@@ -89,6 +89,10 @@
9090
9191 void lcd_shutdown()
9292 {
 93+ mutex_lock(&lcd_mutex, TIMEOUT_BLOCK);
 94+ displaylcd_sync();
 95+ while (!(LCDSTATUS & 0x2));
 96+ LCDCON = 0x41100db8;
9397 }
9498
9599 bool displaylcd_busy() ICODE_ATTR;
@@ -116,6 +120,8 @@
117121 displaylcd_sync();
118122 }
119123 else while (DMAC0C4CONFIG & 1);
 124+ while (!(LCDSTATUS & 0x2));
 125+ LCDCON = 0x41100db8;
120126 lcd_send_cmd(0x2a);
121127 lcd_send_data(startx);
122128 lcd_send_data(endx);
@@ -140,7 +146,7 @@
141147 lli->nextlli = last ? NULL : &lcd_lli[i + 1];
142148 lli->control = 0x70240000 | (last ? pixels : 0xfff)
143149 | (last ? 0x80000000 : 0) | (solid ? 0 : 0x4000000);
144 - if (!solid) data = (void*)(((uint32_t)data) + 0x1ffe);
 150+ if (!solid) data += 0x1ffe;
145151 }
146152 clean_dcache();
147153 DMAC0C4CONFIG = 0x88c1;
@@ -157,7 +163,7 @@
158164 }
159165
160166 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)
162168 {
163169 int pixels = (endx - startx + 1) * (endy - starty + 1);
164170 if (pixels <= 0) return;
@@ -223,6 +229,12 @@
224230 __asm__ volatile(" movne r10, #3 \n");
225231 __asm__ volatile(" moveq r10, #0 \n");
226232 __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");
227239 __asm__ volatile("displaylcd_dither_y: \n");
228240 __asm__ volatile(" ldr lr, [sp] \n");
229241 __asm__ volatile(" mov r4, #0 \n");
@@ -230,7 +242,6 @@
231243 __asm__ volatile(" mov r6, #0 \n");
232244 __asm__ volatile(" mov r7, r8 \n");
233245 __asm__ volatile("displaylcd_dither_x: \n");
234 - __asm__ volatile(" mov r2, #0 \n");
235246 __asm__ volatile(" ldrb r1, [r3], #1 \n");
236247 __asm__ volatile(" ldrsb r0, [r7] \n");
237248 __asm__ volatile(" add r1, r1, r4 \n");
@@ -238,10 +249,10 @@
239250 __asm__ volatile(" cmp r1, #0xff \n");
240251 __asm__ volatile(" mvnhi r1, r1,asr#31 \n");
241252 __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");
246257 __asm__ volatile(" mov r4, r4,lsr#1 \n");
247258 __asm__ volatile(" add r4, r4, r1,lsr#2 \n");
248259 __asm__ volatile(" strb r4, [r7], #1 \n");
@@ -254,7 +265,7 @@
255266 __asm__ volatile(" mvnhi r1, r1,asr#31 \n");
256267 __asm__ volatile(" andhi r1, r1, #0xff \n");
257268 __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");
259270 __asm__ volatile(" sub r1, r1, r0,lsl#2 \n");
260271 __asm__ volatile(" sub r1, r1, r0,lsr#4 \n");
261272 __asm__ volatile(" mov r5, r5,lsr#1 \n");
@@ -268,18 +279,18 @@
269280 __asm__ volatile(" cmp r1, #0xff \n");
270281 __asm__ volatile(" mvnhi r1, r1,asr#31 \n");
271282 __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");
276287 __asm__ volatile(" mov r6, r6,lsr#1 \n");
277288 __asm__ volatile(" add r6, r6, r1,lsr#2 \n");
278289 __asm__ volatile(" strb r6, [r7], #1 \n");
279 - __asm__ volatile("displaylcd_dither_waitlcd: \n");
 290+ __asm__ volatile("displaylcd_dither_wait2: \n");
280291 __asm__ volatile(" ldr r0, [r9,#-0x24] \n");
281292 __asm__ volatile(" mov r6, r1,asr#1 \n");
282293 __asm__ volatile(" tst r0, #0x10 \n");
283 - __asm__ volatile(" bne displaylcd_dither_waitlcd\n");
 294+ __asm__ volatile(" bne displaylcd_dither_wait2 \n");
284295 __asm__ volatile(" str r2, [r9] \n");
285296 __asm__ volatile(" sub r3, r3, r10 \n");
286297 __asm__ volatile(" subs lr, lr, #1 \n");