diff options
Diffstat (limited to 'firmware/target')
-rw-r--r-- | firmware/target/arm/ipod/lcd-gray.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/firmware/target/arm/ipod/lcd-gray.c b/firmware/target/arm/ipod/lcd-gray.c index 131b52da96..5cc219162c 100644 --- a/firmware/target/arm/ipod/lcd-gray.c +++ b/firmware/target/arm/ipod/lcd-gray.c | |||
@@ -53,6 +53,10 @@ | |||
53 | /* The backlight makes the LCD appear negative on the 1st/2nd gen */ | 53 | /* The backlight makes the LCD appear negative on the 1st/2nd gen */ |
54 | static bool lcd_inverted = false; | 54 | static bool lcd_inverted = false; |
55 | static bool lcd_backlit = false; | 55 | static bool lcd_backlit = false; |
56 | #if NUM_CORES > 1 | ||
57 | /* invert_display() and the lcd_blit_* functions need to be corelocked */ | ||
58 | static struct corelock cl IBSS_ATTR; | ||
59 | #endif | ||
56 | static void invert_display(void); | 60 | static void invert_display(void); |
57 | #endif | 61 | #endif |
58 | 62 | ||
@@ -112,7 +116,9 @@ static void lcd_cmd_and_data(unsigned cmd, unsigned data) | |||
112 | /* LCD init */ | 116 | /* LCD init */ |
113 | void lcd_init_device(void) | 117 | void lcd_init_device(void) |
114 | { | 118 | { |
115 | 119 | #if (NUM_CORES > 1) && defined(HAVE_BACKLIGHT_INVERSION) | |
120 | corelock_init(&cl); | ||
121 | #endif | ||
116 | #ifdef IPOD_MINI2G /* serial LCD hookup */ | 122 | #ifdef IPOD_MINI2G /* serial LCD hookup */ |
117 | lcd_wait_write(); | 123 | lcd_wait_write(); |
118 | LCD1_CONTROL = 0x01730084; /* fastest setting */ | 124 | LCD1_CONTROL = 0x01730084; /* fastest setting */ |
@@ -167,7 +173,13 @@ static void invert_display(void) | |||
167 | if (new_invert != last_invert) | 173 | if (new_invert != last_invert) |
168 | { | 174 | { |
169 | int oldlevel = disable_irq_save(); | 175 | int oldlevel = disable_irq_save(); |
176 | #if NUM_CORES > 1 | ||
177 | corelock_lock(&cl); | ||
170 | lcd_cmd_and_data(R_DISPLAY_CONTROL, new_invert? 0x0017 : 0x0015); | 178 | lcd_cmd_and_data(R_DISPLAY_CONTROL, new_invert? 0x0017 : 0x0015); |
179 | corelock_unlock(&cl); | ||
180 | #else | ||
181 | lcd_cmd_and_data(R_DISPLAY_CONTROL, new_invert? 0x0017 : 0x0015); | ||
182 | #endif | ||
171 | restore_irq(oldlevel); | 183 | restore_irq(oldlevel); |
172 | last_invert = new_invert; | 184 | last_invert = new_invert; |
173 | } | 185 | } |
@@ -254,14 +266,19 @@ void lcd_mono_data(const unsigned char *data, int count); | |||
254 | void lcd_blit_mono(const unsigned char *data, int bx, int y, int bwidth, | 266 | void lcd_blit_mono(const unsigned char *data, int bx, int y, int bwidth, |
255 | int height, int stride) | 267 | int height, int stride) |
256 | { | 268 | { |
269 | #if (NUM_CORES > 1) && defined(HAVE_BACKLIGHT_INVERSION) | ||
270 | corelock_lock(&cl); | ||
271 | #endif | ||
257 | while (height--) | 272 | while (height--) |
258 | { | 273 | { |
259 | lcd_cmd_and_data(R_RAM_ADDR_SET, (y++ << 5) + addr_offset - bx); | 274 | lcd_cmd_and_data(R_RAM_ADDR_SET, (y++ << 5) + addr_offset - bx); |
260 | lcd_prepare_cmd(R_RAM_DATA); | 275 | lcd_prepare_cmd(R_RAM_DATA); |
261 | |||
262 | lcd_mono_data(data, bwidth); | 276 | lcd_mono_data(data, bwidth); |
263 | data += stride; | 277 | data += stride; |
264 | } | 278 | } |
279 | #if (NUM_CORES > 1) && defined(HAVE_BACKLIGHT_INVERSION) | ||
280 | corelock_unlock(&cl); | ||
281 | #endif | ||
265 | } | 282 | } |
266 | 283 | ||
267 | /* Helper function for lcd_grey_phase_blit(). */ | 284 | /* Helper function for lcd_grey_phase_blit(). */ |
@@ -272,15 +289,20 @@ void lcd_grey_data(unsigned char *values, unsigned char *phases, int count); | |||
272 | void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases, | 289 | void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases, |
273 | int bx, int y, int bwidth, int height, int stride) | 290 | int bx, int y, int bwidth, int height, int stride) |
274 | { | 291 | { |
275 | while (height--) | 292 | #if (NUM_CORES > 1) && defined(HAVE_BACKLIGHT_INVERSION) |
293 | corelock_lock(&cl); | ||
294 | #endif | ||
295 | while (height--) | ||
276 | { | 296 | { |
277 | lcd_cmd_and_data(R_RAM_ADDR_SET, (y++ << 5) + addr_offset - bx); | 297 | lcd_cmd_and_data(R_RAM_ADDR_SET, (y++ << 5) + addr_offset - bx); |
278 | lcd_prepare_cmd(R_RAM_DATA); | 298 | lcd_prepare_cmd(R_RAM_DATA); |
279 | |||
280 | lcd_grey_data(values, phases, bwidth); | 299 | lcd_grey_data(values, phases, bwidth); |
281 | values += stride; | 300 | values += stride; |
282 | phases += stride; | 301 | phases += stride; |
283 | } | 302 | } |
303 | #if (NUM_CORES > 1) && defined(HAVE_BACKLIGHT_INVERSION) | ||
304 | corelock_unlock(&cl); | ||
305 | #endif | ||
284 | } | 306 | } |
285 | 307 | ||
286 | void lcd_update_rect(int x, int y, int width, int height) | 308 | void lcd_update_rect(int x, int y, int width, int height) |