summaryrefslogtreecommitdiff
path: root/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c')
-rw-r--r--firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c44
1 files changed, 21 insertions, 23 deletions
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c
index d1c41d652f..7b177f4fc4 100644
--- a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c
+++ b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c
@@ -312,10 +312,12 @@ void lcd_init_device(void)
312 PCON13 &= ~0xf; /* Set pin 0 to input */ 312 PCON13 &= ~0xf; /* Set pin 0 to input */
313 PCON14 &= ~0xf0; /* Set pin 1 to input */ 313 PCON14 &= ~0xf0; /* Set pin 1 to input */
314 314
315 if (((PDAT13 & 1) == 0) && ((PDAT14 & 2) == 2)) 315 if (((PDAT13 & 1) == 0) && ((PDAT14 & 2) == 2)) {
316 lcd_type = 0; /* Similar to ILI9320 - aka "type 2" */ 316 lcd_type = 0; /* Similar to ILI9320 - aka "type 2" */
317 else 317 } else {
318 lcd_type = 1; /* Similar to LDS176 - aka "type 7" */ 318 lcd_type = 1; /* Similar to LDS176 - aka "type 7" */
319 LCD_PHTIME = 0x22; /* Set Phase Time reg (relevant for LCD IF speed) */
320 }
319 321
320 LCD_CON |= 0x100; /* use 16 bit bus width, little endian */ 322 LCD_CON |= 0x100; /* use 16 bit bus width, little endian */
321 323
@@ -337,6 +339,11 @@ void lcd_update(void)
337 lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); 339 lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
338} 340}
339 341
342/* Line write helper function. */
343extern void lcd_write_line(const fb_data *addr,
344 int pixelcount,
345 const unsigned int lcd_base_addr);
346
340/* Update a fraction of the display. */ 347/* Update a fraction of the display. */
341void lcd_update_rect(int, int, int, int) ICODE_ATTR; 348void lcd_update_rect(int, int, int, int) ICODE_ATTR;
342void lcd_update_rect(int x, int y, int width, int height) 349void lcd_update_rect(int x, int y, int width, int height)
@@ -344,7 +351,9 @@ void lcd_update_rect(int x, int y, int width, int height)
344 int y0, x0, y1, x1; 351 int y0, x0, y1, x1;
345 fb_data* p; 352 fb_data* p;
346 353
347 width = (width + 1) & ~1; /* ensure width is even */ 354 /* Both x and width need to be preprocessed due to asm optimizations */
355 x = x & ~1; /* ensure x is even */
356 width = (width + 3) & ~3; /* ensure width is a multiple of 4 */
348 357
349 x0 = x; /* start horiz */ 358 x0 = x; /* start horiz */
350 y0 = y; /* start vert */ 359 y0 = y; /* start vert */
@@ -376,33 +385,22 @@ void lcd_update_rect(int x, int y, int width, int height)
376 385
377 /* Copy display bitmap to hardware */ 386 /* Copy display bitmap to hardware */
378 p = &lcd_framebuffer[y0][x0]; 387 p = &lcd_framebuffer[y0][x0];
379 if (LCD_WIDTH == width) 388 if (LCD_WIDTH == width) {
380 { 389 /* Write all lines at once */
381 x1 = height*LCD_WIDTH/4; 390 lcd_write_line(p, height*LCD_WIDTH, LCD_BASE);
382 do {
383 while (LCD_STATUS & 0x08); /* wait while FIFO is half full */
384 lcd_write_pixel(*(p++));
385 lcd_write_pixel(*(p++));
386 lcd_write_pixel(*(p++));
387 lcd_write_pixel(*(p++));
388 } while (--x1 > 0);
389 } else { 391 } else {
390 y1 = height; 392 y1 = height;
391 do { 393 do {
392 x1 = width/2; /* width is forced to even to allow speed up */ 394 /* Write a single line */
393 do { 395 lcd_write_line(p, width, LCD_BASE);
394 while (LCD_STATUS & 0x08); /* wait while FIFO is half full */ 396 p += LCD_WIDTH;
395 lcd_write_pixel(*(p++));
396 lcd_write_pixel(*(p++));
397 } while (--x1 > 0 );
398 p += LCD_WIDTH - width;
399 } while (--y1 > 0 ); 397 } while (--y1 > 0 );
400 } 398 }
401} 399}
402 400
403/* Line write helper function for lcd_yuv_blit. Writes two lines of yuv420. */ 401/* Line write helper function for lcd_yuv_blit. Writes two lines of yuv420. */
404extern void lcd_write_yuv420_lines(unsigned char const * const src[3], 402extern void lcd_write_yuv420_lines(unsigned char const * const src[3],
405 unsigned lcd_baseadress, 403 const unsigned int lcd_baseadress,
406 int width, 404 int width,
407 int stride); 405 int stride);
408 406