summaryrefslogtreecommitdiff
path: root/firmware/target/arm/iriver/h10/lcd-h10.c
diff options
context:
space:
mode:
authorBarry Wardell <rockbox@barrywardell.net>2006-09-04 23:10:27 +0000
committerBarry Wardell <rockbox@barrywardell.net>2006-09-04 23:10:27 +0000
commit9b1dd444b005c9f99318c7a31c9f81a846d5e5af (patch)
tree1dc2f9fb2e1577f6e6ca9ae7e5096c8bf8321d82 /firmware/target/arm/iriver/h10/lcd-h10.c
parent7c587a25e595ea9495af2fa9e3272b9c901ddded (diff)
downloadrockbox-9b1dd444b005c9f99318c7a31c9f81a846d5e5af.tar.gz
rockbox-9b1dd444b005c9f99318c7a31c9f81a846d5e5af.zip
Fix display bugs with H10 LCDs (both 20GB and 5/6GB models). The 20GB LCD is actually a 128x160 LCD rotated 90 degrees, so we need to take account of this. The 5/6GB LCD is not rotated by 90 degrees but was treated as if it was (FS #5925, patch thanks to Thilo-Alexander Ginkel)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10886 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/iriver/h10/lcd-h10.c')
-rw-r--r--firmware/target/arm/iriver/h10/lcd-h10.c66
1 files changed, 55 insertions, 11 deletions
diff --git a/firmware/target/arm/iriver/h10/lcd-h10.c b/firmware/target/arm/iriver/h10/lcd-h10.c
index a791009b33..64e8f5d8b9 100644
--- a/firmware/target/arm/iriver/h10/lcd-h10.c
+++ b/firmware/target/arm/iriver/h10/lcd-h10.c
@@ -104,8 +104,8 @@ static inline bool timer_check(int clock_start, int usecs)
104#define R_GATE_SCAN_START_POS 0x40 104#define R_GATE_SCAN_START_POS 0x40
105#define R_1ST_SCR_DRV_POS 0x42 105#define R_1ST_SCR_DRV_POS 0x42
106#define R_2ND_SCR_DRV_POS 0x43 106#define R_2ND_SCR_DRV_POS 0x43
107#define R_VERT_RAM_ADDR_POS 0x44 107#define R_HORIZ_RAM_ADDR_POS 0x44
108#define R_HORIZ_RAM_ADDR_POS 0x45 108#define R_VERT_RAM_ADDR_POS 0x45
109 109
110#endif 110#endif
111 111
@@ -219,18 +219,40 @@ void lcd_yuv_blit(unsigned char * const src[3],
219 y0 = y; 219 y0 = y;
220 y1 = y + height - 1; 220 y1 = y + height - 1;
221 221
222 /* max horiz << 8 | start horiz */ 222#if CONFIG_LCD == LCD_H10_5GB
223 /* start horiz << 8 | max horiz */
223 lcd_send_cmd(R_HORIZ_RAM_ADDR_POS); 224 lcd_send_cmd(R_HORIZ_RAM_ADDR_POS);
225 lcd_send_data((x0 << 8) | x1);
226
227 /* start vert << 8 | max vert */
228 lcd_send_cmd(R_VERT_RAM_ADDR_POS);
224 lcd_send_data((y0 << 8) | y1); 229 lcd_send_data((y0 << 8) | y1);
225 /* max vert << 8 | start vert */ 230
231 /* start horiz << 8 | start vert */
232 lcd_send_cmd(R_RAM_ADDR_SET);
233 lcd_send_data(((x0 << 8) | y0));
234
235#elif CONFIG_LCD == LCD_H10_20GB
236 /* The 20GB LCD is actually 128x160 but rotated 90 degrees so the origin
237 * is actually the bottom left and horizontal and vertical are swapped.
238 * Rockbox expects the origin to be the top left so we need to use
239 * 127 - y instead of just y */
240
241 /* start horiz << 8 | max horiz */
242 lcd_send_cmd(R_HORIZ_RAM_ADDR_POS);
243 lcd_send_data(((127-y1) << 8) | (127-y0));
244
245 /* start vert << 8 | max vert */
226 lcd_send_cmd(R_VERT_RAM_ADDR_POS); 246 lcd_send_cmd(R_VERT_RAM_ADDR_POS);
227 lcd_send_data((x0 << 8) | x1); 247 lcd_send_data((x0 << 8) | x1);
228 248
229 /* position cursor (set AD0-AD15) */ 249 /* position cursor (set AD0-AD15) */
230 /* start vert << 8 | start horiz */ 250 /* start horiz << 8 | start vert */
231 lcd_send_cmd(R_RAM_ADDR_SET); 251 lcd_send_cmd(R_RAM_ADDR_SET);
232 lcd_send_data(((y0 << 8) | x0)); 252 lcd_send_data((((127-y0) << 8) | x0));
233 253
254#endif /* CONFIG_LCD */
255
234 /* start drawing */ 256 /* start drawing */
235 lcd_send_cmd(R_WRITE_DATA_2_GRAM); 257 lcd_send_cmd(R_WRITE_DATA_2_GRAM);
236 258
@@ -390,17 +412,39 @@ void lcd_update_rect(int x0, int y0, int width, int height)
390 x1 = t; 412 x1 = t;
391 } 413 }
392 414
393 /* max horiz << 8 | start horiz */ 415#if CONFIG_LCD == LCD_H10_5GB
416 /* start horiz << 8 | max horiz */
394 lcd_send_cmd(R_HORIZ_RAM_ADDR_POS); 417 lcd_send_cmd(R_HORIZ_RAM_ADDR_POS);
418 lcd_send_data((x0 << 8) | x1);
419
420 /* start vert << 8 | max vert */
421 lcd_send_cmd(R_VERT_RAM_ADDR_POS);
395 lcd_send_data((y0 << 8) | y1); 422 lcd_send_data((y0 << 8) | y1);
396 /* max vert << 8 | start vert */ 423
424 /* start horiz << 8 | start vert */
425 lcd_send_cmd(R_RAM_ADDR_SET);
426 lcd_send_data(((x0 << 8) | y0));
427
428#elif CONFIG_LCD == LCD_H10_20GB
429 /* The 20GB LCD is actually 128x160 but rotated 90 degrees so the origin
430 * is actually the bottom left and horizontal and vertical are swapped.
431 * Rockbox expects the origin to be the top left so we need to use
432 * 127 - y instead of just y */
433
434 /* start horiz << 8 | max horiz */
435 lcd_send_cmd(R_HORIZ_RAM_ADDR_POS);
436 lcd_send_data(((127-y1) << 8) | (127-y0));
437
438 /* start vert << 8 | max vert */
397 lcd_send_cmd(R_VERT_RAM_ADDR_POS); 439 lcd_send_cmd(R_VERT_RAM_ADDR_POS);
398 lcd_send_data((x0 << 8) | x1); 440 lcd_send_data((x0 << 8) | x1);
399 441
400 /* position cursor (set AD0-AD15) */ 442 /* position cursor (set AD0-AD15) */
401 /* start vert << 8 | start horiz */ 443 /* start horiz << 8 | start vert */
402 lcd_send_cmd(R_RAM_ADDR_SET); 444 lcd_send_cmd(R_RAM_ADDR_SET);
403 lcd_send_data(((y0 << 8) | x0)); 445 lcd_send_data((((127-y0) << 8) | x0));
446
447#endif /* CONFIG_LCD */
404 448
405 /* start drawing */ 449 /* start drawing */
406 lcd_send_cmd(R_WRITE_DATA_2_GRAM); 450 lcd_send_cmd(R_WRITE_DATA_2_GRAM);