freemyipod r746 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r745‎ | r746 | r747 >
Date:04:01, 13 July 2011
Author:theseven
Status:new
Tags:
Comment:
emCORE: iPod Classic: Make use of the LCD controller's RGB666 capabilities
UMSboot: iPod Classic: Take account for potentially changed LCDCON value
Modified paths:
  • /emcore/trunk/target/ipodnano3g/lcd.c (modified) (history)
  • /emcore/trunk/target/ipodnano3g/s5l8702.h (modified) (history)
  • /umsboot/target/ipodclassic/lcd.c (modified) (history)
  • /umsboot/target/ipodclassic/s5l8702.h (modified) (history)

Diff [purge]

Index: umsboot/target/ipodclassic/lcd.c
@@ -91,6 +91,8 @@
9292 unsigned int starty, unsigned int endy, void* data, int color)
9393 {
9494 displaylcd_sync();
 95+ while (!(LCDSTATUS & 0x2));
 96+ LCDCON = 0x80100db0;
9597 if (lcd_detect() & 2)
9698 {
9799 lcd_send_cmd(0x210);
Index: umsboot/target/ipodclassic/s5l8702.h
@@ -528,6 +528,7 @@
529529
530530
531531 /////LCD/////
 532+#define LCDCON (*((uint32_t volatile*)(0x38300000)))
532533 #define LCDWCMD (*((uint32_t volatile*)(0x38300004)))
533534 #define LCDSTATUS (*((uint32_t volatile*)(0x3830001c)))
534535 #define LCDWDATA (*((uint32_t volatile*)(0x38300040)))
Index: emcore/trunk/target/ipodnano3g/lcd.c
@@ -136,6 +136,8 @@
137137 displaylcd_sync();
138138 }
139139 else while (DMAC0C4CONFIG & 1);
 140+ while (!(LCDSTATUS & 0x2));
 141+ LCDCON = 0x80100db0;
140142 if (lcd_detect() & 2)
141143 {
142144 lcd_send_cmd(0x210);
@@ -265,6 +267,12 @@
266268 __asm__ volatile(" movne r10, #3 \n");
267269 __asm__ volatile(" moveq r10, #0 \n");
268270 __asm__ volatile(" ldr r9, =0x38300040 \n");
 271+ __asm__ volatile("displaylcd_dither_wait : \n");
 272+ __asm__ volatile(" ldr r4, [r9,#-0x24] \n");
 273+ __asm__ volatile(" tst r4, #2 \n");
 274+ __asm__ volatile(" beq displaylcd_dither_wait \n");
 275+ __asm__ volatile(" ldr r4, =0x81104eb0 \n");
 276+ __asm__ volatile(" str r4, [r9,#-0x40] \n");
269277 __asm__ volatile("displaylcd_dither_y: \n");
270278 __asm__ volatile(" ldr lr, [sp] \n");
271279 __asm__ volatile(" mov r4, #0 \n");
@@ -272,7 +280,6 @@
273281 __asm__ volatile(" mov r6, #0 \n");
274282 __asm__ volatile(" mov r7, r8 \n");
275283 __asm__ volatile("displaylcd_dither_x: \n");
276 - __asm__ volatile(" mov r2, #0 \n");
277284 __asm__ volatile(" ldrb r1, [r3], #1 \n");
278285 __asm__ volatile(" ldrsb r0, [r7] \n");
279286 __asm__ volatile(" add r1, r1, r4 \n");
@@ -280,10 +287,10 @@
281288 __asm__ volatile(" cmp r1, #0xff \n");
282289 __asm__ volatile(" mvnhi r1, r1,asr#31 \n");
283290 __asm__ volatile(" andhi r1, r1, #0xff \n");
284 - __asm__ volatile(" mov r0, r1,lsr#3 \n");
285 - __asm__ volatile(" orr r2, r0,lsl#11 \n");
286 - __asm__ volatile(" sub r1, r1, r0,lsl#3 \n");
287 - __asm__ volatile(" sub r1, r1, r0,lsr#2 \n");
 291+ __asm__ volatile(" mov r0, r1,lsr#2 \n");
 292+ __asm__ volatile(" mov r2, r0,lsl#18 \n");
 293+ __asm__ volatile(" sub r1, r1, r0,lsl#2 \n");
 294+ __asm__ volatile(" sub r1, r1, r0,lsr#4 \n");
288295 __asm__ volatile(" mov r4, r4,lsr#1 \n");
289296 __asm__ volatile(" add r4, r4, r1,lsr#2 \n");
290297 __asm__ volatile(" strb r4, [r7], #1 \n");
@@ -296,7 +303,7 @@
297304 __asm__ volatile(" mvnhi r1, r1,asr#31 \n");
298305 __asm__ volatile(" andhi r1, r1, #0xff \n");
299306 __asm__ volatile(" mov r0, r1,lsr#2 \n");
300 - __asm__ volatile(" orr r2, r0,lsl#5 \n");
 307+ __asm__ volatile(" orr r2, r2, r0,lsl#10 \n");
301308 __asm__ volatile(" sub r1, r1, r0,lsl#2 \n");
302309 __asm__ volatile(" sub r1, r1, r0,lsr#4 \n");
303310 __asm__ volatile(" mov r5, r5,lsr#1 \n");
@@ -310,14 +317,18 @@
311318 __asm__ volatile(" cmp r1, #0xff \n");
312319 __asm__ volatile(" mvnhi r1, r1,asr#31 \n");
313320 __asm__ volatile(" andhi r1, r1, #0xff \n");
314 - __asm__ volatile(" mov r0, r1,lsr#3 \n");
315 - __asm__ volatile(" orr r2, r0 \n");
316 - __asm__ volatile(" sub r1, r1, r0,lsl#3 \n");
317 - __asm__ volatile(" sub r1, r1, r0,lsr#2 \n");
 321+ __asm__ volatile(" mov r0, r1,lsr#2 \n");
 322+ __asm__ volatile(" orr r2, r2, r0,lsl#2 \n");
 323+ __asm__ volatile(" sub r1, r1, r0,lsl#2 \n");
 324+ __asm__ volatile(" sub r1, r1, r0,lsr#4 \n");
318325 __asm__ volatile(" mov r6, r6,lsr#1 \n");
319326 __asm__ volatile(" add r6, r6, r1,lsr#2 \n");
320327 __asm__ volatile(" strb r6, [r7], #1 \n");
321328 __asm__ volatile(" mov r6, r1,asr#1 \n");
 329+ __asm__ volatile("displaylcd_dither_wait2: \n");
 330+ __asm__ volatile(" ldr r0, [r9,#-0x24] \n");
 331+ __asm__ volatile(" tst r0, #0x10 \n");
 332+ __asm__ volatile(" bne displaylcd_dither_wait2 \n");
322333 __asm__ volatile(" str r2, [r9] \n");
323334 __asm__ volatile(" sub r3, r3, r10 \n");
324335 __asm__ volatile(" subs lr, lr, #1 \n");
@@ -354,6 +365,8 @@
355366 {
356367 mutex_lock(&lcd_mutex, TIMEOUT_BLOCK);
357368 displaylcd_sync();
 369+ while (!(LCDSTATUS & 0x2));
 370+ LCDCON = 0x80100db0;
358371 uint32_t type = lcd_detect();
359372 if (type & 2)
360373 {
Index: emcore/trunk/target/ipodnano3g/s5l8702.h
@@ -768,14 +768,14 @@
769769
770770
771771 /////UART/////
772 -#define ULCON (*((uint32_t volatile*)0x3cc00000))
773 -#define UCON (*((uint32_t volatile*)0x3cc00004))
774 -#define UFCON (*((uint32_t volatile*)0x3cc00008))
775 -#define UMCON (*((uint32_t volatile*)0x3cc0000c))
776 -#define UFSTAT (*((uint32_t volatile*)0x3cc00018))
777 -#define UTXH (*((uint8_t volatile*)0x3cc00020))
778 -#define URXH (*((uint8_t volatile*)0x3cc00024))
779 -#define UBRDIV (*((uint32_t volatile*)0x3cc00028))
 772+#define ULCON (*((uint32_t volatile*)0x3cc00000))
 773+#define UCON (*((uint32_t volatile*)0x3cc00004))
 774+#define UFCON (*((uint32_t volatile*)0x3cc00008))
 775+#define UMCON (*((uint32_t volatile*)0x3cc0000c))
 776+#define UFSTAT (*((uint32_t volatile*)0x3cc00018))
 777+#define UTXH (*((uint8_t volatile*)0x3cc00020))
 778+#define URXH (*((uint8_t volatile*)0x3cc00024))
 779+#define UBRDIV (*((uint32_t volatile*)0x3cc00028))
780780
781781
782782 /////CLOCK GATES/////