summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd-h300.c
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2006-11-02 20:50:50 +0000
committerJens Arnold <amiconn@rockbox.org>2006-11-02 20:50:50 +0000
commit83aded979f074b6d48cd05db8f7f991e51372e38 (patch)
treeb8bad1edd08bee7d8659cb1bb582fc305a9d70fa /firmware/drivers/lcd-h300.c
parentd86350c9fad03356990e0844f1d35502e35b1d3b (diff)
downloadrockbox-83aded979f074b6d48cd05db8f7f991e51372e38.tar.gz
rockbox-83aded979f074b6d48cd05db8f7f991e51372e38.zip
H300: (1) Use DMA for LCD updates, with auto-aligned line reads. Speeds up LCD updates by ~ 75% at 11MHz and 45MHz. Only ~ 11% speedup at 124MHz due to (2). (2) Less aggressive LCD transfer timing at 124MHz. With the previous timing, slightly corrupted display contents was reported, and with DMA transfers at least 4 waitstates are needed to make updates work at all. * A table in system-iriver.c shows settings for all integer multiples of the base clock frequency (info for developers, not yet complete).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11418 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/lcd-h300.c')
-rw-r--r--firmware/drivers/lcd-h300.c48
1 files changed, 35 insertions, 13 deletions
diff --git a/firmware/drivers/lcd-h300.c b/firmware/drivers/lcd-h300.c
index 41d2d11509..b7865fa7c5 100644
--- a/firmware/drivers/lcd-h300.c
+++ b/firmware/drivers/lcd-h300.c
@@ -368,7 +368,16 @@ void lcd_update(void)
368 /* Copy display bitmap to hardware */ 368 /* Copy display bitmap to hardware */
369 lcd_write_reg(R_RAM_ADDR_SET, xoffset << 8); 369 lcd_write_reg(R_RAM_ADDR_SET, xoffset << 8);
370 lcd_begin_write_gram(); 370 lcd_begin_write_gram();
371 lcd_write_data((unsigned short *)lcd_framebuffer, LCD_WIDTH*LCD_HEIGHT); 371
372 DAR3 = 0xf0000002;
373 SAR3 = (unsigned long)lcd_framebuffer;
374 BCR3 = LCD_WIDTH*LCD_HEIGHT*2;
375 DCR3 = DMA_AA | DMA_BWC(1)
376 | DMA_SINC | DMA_SSIZE(DMA_SIZE_LINE)
377 | DMA_DSIZE(DMA_SIZE_WORD) | DMA_START;
378
379 while (!(DSR3 & 1));
380 DSR3 = 1;
372 } 381 }
373} 382}
374 383
@@ -376,26 +385,39 @@ void lcd_update(void)
376void lcd_update_rect(int, int, int, int) ICODE_ATTR; 385void lcd_update_rect(int, int, int, int) ICODE_ATTR;
377void lcd_update_rect(int x, int y, int width, int height) 386void lcd_update_rect(int x, int y, int width, int height)
378{ 387{
388 unsigned long dma_addr;
389
379 if(display_on) { 390 if(display_on) {
380 int ymax = y + height - 1;
381 391
382 if(x + width > LCD_WIDTH) 392 if(x + width > LCD_WIDTH)
383 width = LCD_WIDTH - x; 393 width = LCD_WIDTH - x;
384 if (width <= 0) 394 if(width <= 0) /* nothing to do */
385 return; /* nothing left to do, 0 is harmful to lcd_write_data() */ 395 return;
386 if(ymax >= LCD_HEIGHT) 396 if(y + height > LCD_HEIGHT)
387 ymax = LCD_HEIGHT-1; 397 height = LCD_HEIGHT - y;
388 398
389 /* set update window */ 399 /* set update window */
390 400
391 lcd_write_reg(R_VERT_RAM_ADDR_POS,((x+xoffset+width-1) << 8) | (x+xoffset)); 401 lcd_write_reg(R_VERT_RAM_ADDR_POS,((x+xoffset+width-1) << 8) | (x+xoffset));
392 lcd_write_reg(R_RAM_ADDR_SET, ((x+xoffset) << 8) | y); 402 lcd_write_reg(R_RAM_ADDR_SET, ((x+xoffset) << 8) | y);
393 lcd_begin_write_gram(); 403 lcd_begin_write_gram();
404
405 DAR3 = 0xf0000002;
406 dma_addr = (unsigned long)&lcd_framebuffer[y][x];
407 width *= 2;
394 408
395 /* Copy specified rectangle bitmap to hardware */ 409 for (; height > 0; height--)
396 for (; y <= ymax; y++) 410 {
397 { 411 SAR3 = dma_addr;
398 lcd_write_data ((unsigned short *)&lcd_framebuffer[y][x], width); 412 BCR3 = width;
399 } 413 DCR3 = DMA_AA | DMA_BWC(1)
414 | DMA_SINC | DMA_SSIZE(DMA_SIZE_LINE)
415 | DMA_DSIZE(DMA_SIZE_WORD) | DMA_START;
416
417 dma_addr += LCD_WIDTH*2;
418
419 while (!(DSR3 & 1));
420 DSR3 = 1;
421 }
400 } 422 }
401} 423}