diff options
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/lcd-h300.c | 48 |
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) | |||
376 | void lcd_update_rect(int, int, int, int) ICODE_ATTR; | 385 | void lcd_update_rect(int, int, int, int) ICODE_ATTR; |
377 | void lcd_update_rect(int x, int y, int width, int height) | 386 | void 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 | } |