freemyipod r521 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r520‎ | r521 | r522 >
Date:02:31, 6 February 2011
Author:theseven
Status:new
Tags:
Comment:
emCORE: iPod Classic LCD driver: Make LCD updates more reliable. The root cause (mutexes being locked from an IRQ handler) isn't fixed yet, but the probability of triggering the clash has been reduced a lot.
Modified paths:
  • /emcore/trunk/target/ipodnano3g/lcd.c (modified) (history)

Diff [purge]

Index: emcore/trunk/target/ipodnano3g/lcd.c
@@ -93,9 +93,7 @@
9494 void displaylcd_sync() ICODE_ATTR;
9595 void displaylcd_sync()
9696 {
97 - mutex_lock(&lcd_mutex, TIMEOUT_BLOCK);
9897 while (displaylcd_busy()) sleep(100);
99 - mutex_unlock(&lcd_mutex);
10098 }
10199
102100 void displaylcd_setup(unsigned int startx, unsigned int endx,
@@ -103,8 +101,8 @@
104102 void displaylcd_setup(unsigned int startx, unsigned int endx,
105103 unsigned int starty, unsigned int endy)
106104 {
 105+ displaylcd_sync();
107106 mutex_lock(&lcd_mutex, TIMEOUT_BLOCK);
108 - displaylcd_sync();
109107 if (lcd_detect() & 2)
110108 {
111109 lcd_send_cmd(0x210);
@@ -150,7 +148,7 @@
151149 lli->nextlli = last ? NULL : &lcd_lli[i + 1];
152150 lli->control = 0x70240000 | (last ? pixels : 0xfff)
153151 | (last ? 0x80000000 : 0) | (solid ? 0 : 0x4000000);
154 - data = (void*)(((uint32_t)data) + 0x1ffe);
 152+ if (!solid) data = (void*)(((uint32_t)data) + 0x1ffe);
155153 }
156154 clean_dcache();
157155 DMAC0C4CONFIG = 0x88c1;
@@ -301,6 +299,7 @@
302300 void filllcd(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int color)
303301 {
304302 if (width * height <= 0) return;
 303+ displaylcd_sync();
305304 mutex_lock(&lcd_mutex, TIMEOUT_BLOCK);
306305 lcd_color = color;
307306 displaylcd_dither(x, y, width, height, &lcd_color, 0, 0, 0, true);