Index: firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c =================================================================== --- firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c (revision 28794) +++ firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c (working copy) @@ -219,14 +219,10 @@ static inline void s5l_lcd_write_cmd_data(int cmd, int data) { while (LCD_STATUS & 0x10); - LCD_WCMD = cmd >> 8; - while (LCD_STATUS & 0x10); - LCD_WCMD = cmd & 0xff; + LCD_WCMD = cmd; while (LCD_STATUS & 0x10); - LCD_WDATA = data >> 8; - while (LCD_STATUS & 0x10); - LCD_WDATA = data & 0xff; + LCD_WDATA = data; } static inline void s5l_lcd_write_cmd(unsigned short cmd) @@ -238,23 +234,19 @@ static inline void s5l_lcd_write_wcmd(unsigned short cmd) { while (LCD_STATUS & 0x10); - LCD_WCMD = cmd >> 8; - while (LCD_STATUS & 0x10); - LCD_WCMD = cmd & 0xff; + LCD_WCMD = cmd; } static inline void s5l_lcd_write_data(unsigned short data) { while (LCD_STATUS & 0x10); - LCD_WDATA = data & 0xff; + LCD_WDATA = data; } static inline void s5l_lcd_write_wdata(unsigned short data) { while (LCD_STATUS & 0x10); - LCD_WDATA = data >> 8; - while (LCD_STATUS & 0x10); - LCD_WDATA = data & 0xff; + LCD_WDATA = data; } /*** hardware configuration ***/ @@ -409,6 +401,8 @@ lcd_type = 0; /* Similar to ILI9320 - aka "type 2" */ else lcd_type = 1; /* Similar to LDS176 - aka "type 7" */ + + LCD_CON |= 0x100; /* use 16 bit bus width, little endian */ lcd_ispowered = true; } @@ -417,10 +411,7 @@ static inline void lcd_write_pixel(fb_data pixel) { - while (LCD_STATUS & 0x10); - LCD_WDATA = (pixel & 0xff00) >> 8; - while (LCD_STATUS & 0x10); - LCD_WDATA = pixel & 0xff; + LCD_WDATA = pixel; } /* Update the display. @@ -435,9 +426,10 @@ void lcd_update_rect(int, int, int, int) ICODE_ATTR; void lcd_update_rect(int x, int y, int width, int height) { - int xx,yy; int y0, x0, y1, x1; fb_data* p; + + width = (width + 1) & ~1; /* ensure width is even */ x0 = x; /* start horiz */ y0 = y; /* start vert */ @@ -467,15 +459,29 @@ s5l_lcd_write_cmd(R_MEMORY_WRITE); } - /* Copy display bitmap to hardware */ p = &lcd_framebuffer[y0][x0]; - yy = height; - for (yy = y0; yy <= y1; yy++) { - for (xx = x0; xx <= x1; xx++) { + if (LCD_WIDTH == width) + { + x1 = height*LCD_WIDTH/4; + do { + while (LCD_STATUS & 0x08); /* wait while FIFO is half full */ lcd_write_pixel(*(p++)); - } - p += LCD_WIDTH - width; + lcd_write_pixel(*(p++)); + lcd_write_pixel(*(p++)); + lcd_write_pixel(*(p++)); + } while (--x1 > 0); + } else { + y1 = height; + do { + x1 = width/2; /* width is forced to even to allow speed up */ + do { + while (LCD_STATUS & 0x08); /* wait while FIFO is half full */ + lcd_write_pixel(*(p++)); + lcd_write_pixel(*(p++)); + } while (--x1 > 0 ); + p += LCD_WIDTH - width; + } while (--y1 > 0 ); } } @@ -616,6 +622,7 @@ } /* output 2 pixels */ + while (LCD_STATUS & 0x08); /* wait while FIFO is half full */ lcd_write_pixel((red1 << 11) | (green1 << 5) | blue1); lcd_write_pixel((red2 << 11) | (green2 << 5) | blue2); }