summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-02-18 16:38:16 +0000
committerThomas Martitz <kugel@rockbox.org>2009-02-18 16:38:16 +0000
commit30255d53daf8184a33631893b0bf214f8973c329 (patch)
tree01024ee7d1cc1a381a9a4cebcc995f343987d990
parent6a3779b5431cccbd1af822e7362c7955ee90d4d7 (diff)
downloadrockbox-30255d53daf8184a33631893b0bf214f8973c329.tar.gz
rockbox-30255d53daf8184a33631893b0bf214f8973c329.zip
Get rid of disabling irq. Simply blocking does it too, it also caused problems (particulary with scrolling lines).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20040 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c29
-rw-r--r--firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c18
2 files changed, 26 insertions, 21 deletions
diff --git a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c
index ea06551d24..60a32b510b 100644
--- a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c
+++ b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c
@@ -36,6 +36,10 @@
36static bool display_on = false; /* is the display turned on? */ 36static bool display_on = false; /* is the display turned on? */
37static bool display_flipped = false; 37static bool display_flipped = false;
38static int y_offset = 0; /* needed for flip */ 38static int y_offset = 0; /* needed for flip */
39/* we need to write a red pixel for correct button reads
40 * (see lcd_button_support()), but that must not happen while the lcd is updating
41 * so block lcd_button_support the during updates */
42static volatile bool lcd_busy = false;
39 43
40/* register defines */ 44/* register defines */
41#define R_START_OSC 0x00 45#define R_START_OSC 0x00
@@ -365,12 +369,10 @@ void lcd_update(void)
365{ 369{
366 if (!display_on) 370 if (!display_on)
367 return; 371 return;
368 372
369 /* we must disable interrupts because buttondriver also writes to lcd */
370 disable_irq();
371
372 lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ); 373 lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ);
373 374
375 lcd_busy = true;
374 /* Set start position and window */ 376 /* Set start position and window */
375 lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (LCD_WIDTH-1) << 8); 377 lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (LCD_WIDTH-1) << 8);
376 lcd_write_reg(R_VERT_RAM_ADDR_POS, 378 lcd_write_reg(R_VERT_RAM_ADDR_POS,
@@ -381,7 +383,7 @@ void lcd_update(void)
381 383
382 lcd_write_data((unsigned short *)lcd_framebuffer, LCD_WIDTH*LCD_HEIGHT); 384 lcd_write_data((unsigned short *)lcd_framebuffer, LCD_WIDTH*LCD_HEIGHT);
383 385
384 enable_irq(); 386 lcd_busy = false;
385} /* lcd_update */ 387} /* lcd_update */
386 388
387 389
@@ -393,7 +395,7 @@ void lcd_update_rect(int x, int y, int width, int height)
393 395
394 if (!display_on) 396 if (!display_on)
395 return; 397 return;
396 398
397 if (x + width > LCD_WIDTH) 399 if (x + width > LCD_WIDTH)
398 width = LCD_WIDTH - x; /* Clip right */ 400 width = LCD_WIDTH - x; /* Clip right */
399 if (x < 0) 401 if (x < 0)
@@ -409,10 +411,8 @@ void lcd_update_rect(int x, int y, int width, int height)
409 if (y >= ymax) 411 if (y >= ymax)
410 return; /* nothing left to do */ 412 return; /* nothing left to do */
411 413
412 /* we must disable interrupts because buttondriver also writes to lcd */
413 disable_irq();
414
415 lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ); 414 lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ);
415 lcd_busy = true;
416 /* Set start position and window */ 416 /* Set start position and window */
417 lcd_write_reg(R_HORIZ_RAM_ADDR_POS, 417 lcd_write_reg(R_HORIZ_RAM_ADDR_POS,
418 ((x + width-1) << 8) | x); 418 ((x + width-1) << 8) | x);
@@ -430,8 +430,8 @@ void lcd_update_rect(int x, int y, int width, int height)
430 ptr += LCD_WIDTH; 430 ptr += LCD_WIDTH;
431 } 431 }
432 while (++y < ymax); 432 while (++y < ymax);
433 433
434 enable_irq(); 434 lcd_busy = false;
435} /* lcd_update_rect */ 435} /* lcd_update_rect */
436 436
437/* writes one read pixel outside the visible area, needed for correct dbop reads */ 437/* writes one read pixel outside the visible area, needed for correct dbop reads */
@@ -440,9 +440,12 @@ void lcd_button_support(void)
440 int x=LCD_HEIGHT+1; 440 int x=LCD_HEIGHT+1;
441 int y=LCD_WIDTH+1; 441 int y=LCD_WIDTH+1;
442 int width=1; 442 int width=1;
443 int height=1; 443 int height=1;
444 unsigned short data = (0xf<<12); 444 unsigned short data = (0xf<<12);
445 445
446 if (lcd_busy)
447 return;
448
446 lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ); 449 lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ);
447 /* Set start position and window */ 450 /* Set start position and window */
448 lcd_write_reg(R_HORIZ_RAM_ADDR_POS, 451 lcd_write_reg(R_HORIZ_RAM_ADDR_POS,
diff --git a/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c b/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c
index f9de3c3117..7443426c25 100644
--- a/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c
+++ b/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c
@@ -41,8 +41,10 @@
41static bool display_on = false; /* is the display turned on? */ 41static bool display_on = false; /* is the display turned on? */
42static bool display_flipped = false; 42static bool display_flipped = false;
43static int xoffset = 20; /* needed for flip */ 43static int xoffset = 20; /* needed for flip */
44 44/* we need to write a red pixel for correct button reads
45static volatile int _ystart, _ymax, _xstart, _xmax; 45 * (see lcd_button_support()), but that must not happen while the lcd is updating
46 * so block lcd_button_support the during updates */
47static volatile bool lcd_busy = false;
46 48
47static void as3525_dbop_init(void) 49static void as3525_dbop_init(void)
48{ 50{
@@ -285,8 +287,7 @@ void lcd_update(void)
285 287
286 lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ); 288 lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ);
287 289
288 /* we must disable interrupts because buttondriver also writes to lcd */ 290 lcd_busy = true;
289 disable_irq();
290 lcd_window_x(0, LCD_WIDTH - 1); 291 lcd_window_x(0, LCD_WIDTH - 1);
291 lcd_window_y(0, LCD_HEIGHT - 1); 292 lcd_window_y(0, LCD_HEIGHT - 1);
292 293
@@ -295,7 +296,7 @@ void lcd_update(void)
295 296
296 /* Write data */ 297 /* Write data */
297 lcd_write_data((unsigned short *)lcd_framebuffer, LCD_WIDTH*LCD_HEIGHT); 298 lcd_write_data((unsigned short *)lcd_framebuffer, LCD_WIDTH*LCD_HEIGHT);
298 enable_irq(); 299 lcd_busy = false;
299} 300}
300 301
301/* Update a fraction of the display. */ 302/* Update a fraction of the display. */
@@ -327,8 +328,7 @@ void lcd_update_rect(int x, int y, int width, int height)
327 328
328 lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ); 329 lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ);
329 330
330 /* we must disable interrupts because buttondriver also writes to lcd */ 331 lcd_busy = true;
331 disable_irq();
332 lcd_window_x(x, xmax); 332 lcd_window_x(x, xmax);
333 lcd_window_y(y, ymax); 333 lcd_window_y(y, ymax);
334 334
@@ -343,13 +343,15 @@ void lcd_update_rect(int x, int y, int width, int height)
343 ptr += LCD_WIDTH; 343 ptr += LCD_WIDTH;
344 } 344 }
345 while (++y <= ymax); 345 while (++y <= ymax);
346 enable_irq(); 346 lcd_busy = false;
347} 347}
348 348
349/* writes one read pixel outside the visible area, needed for correct dbop reads */ 349/* writes one read pixel outside the visible area, needed for correct dbop reads */
350void lcd_button_support(void) 350void lcd_button_support(void)
351{ 351{
352 fb_data data = 0xf<<12; 352 fb_data data = 0xf<<12;
353 if (lcd_busy)
354 return;
353 lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ); 355 lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ);
354 /* Set start position and window */ 356 /* Set start position and window */
355 357