summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorBarry Wardell <rockbox@barrywardell.net>2006-08-23 09:14:28 +0000
committerBarry Wardell <rockbox@barrywardell.net>2006-08-23 09:14:28 +0000
commita64f51e67d5facee920b0fe50150e3c3776d515e (patch)
treec7d12ec02d5a8dbac35ef2f4cc11b1870889a15b /firmware
parent2e3cfafa0b1c74ec98893c07e2adf601e3501493 (diff)
downloadrockbox-a64f51e67d5facee920b0fe50150e3c3776d515e.tar.gz
rockbox-a64f51e67d5facee920b0fe50150e3c3776d515e.zip
H10 LCD fixes. Now lcd_update_rect() works as it should. 5/6GB has different register defines than 20GB.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10715 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/iriver/h10/lcd-h10.c60
1 files changed, 46 insertions, 14 deletions
diff --git a/firmware/target/arm/iriver/h10/lcd-h10.c b/firmware/target/arm/iriver/h10/lcd-h10.c
index 7367bdc09b..aa71001601 100644
--- a/firmware/target/arm/iriver/h10/lcd-h10.c
+++ b/firmware/target/arm/iriver/h10/lcd-h10.c
@@ -39,6 +39,7 @@ static inline bool timer_check(int clock_start, int usecs)
39#define LCD_CMD 0x80000000 39#define LCD_CMD 0x80000000
40#define LCD_DATA 0x81000000 40#define LCD_DATA 0x81000000
41 41
42#ifdef IRIVER_H10
42/* register defines for the Renesas HD66773R */ 43/* register defines for the Renesas HD66773R */
43#define R_START_OSC 0x00 44#define R_START_OSC 0x00
44#define R_DEVICE_CODE_READ 0x00 45#define R_DEVICE_CODE_READ 0x00
@@ -57,8 +58,8 @@ static inline bool timer_check(int clock_start, int usecs)
57#define R_VERT_SCROLL_CONTROL 0x11 58#define R_VERT_SCROLL_CONTROL 0x11
58#define R_1ST_SCR_DRV_POS 0x14 59#define R_1ST_SCR_DRV_POS 0x14
59#define R_2ND_SCR_DRV_POS 0x15 60#define R_2ND_SCR_DRV_POS 0x15
60#define R_HORIZ_RAM_ADDR_POS 0x44 61#define R_HORIZ_RAM_ADDR_POS 0x16
61#define R_VERT_RAM_ADDR_POS 0x45 62#define R_VERT_RAM_ADDR_POS 0x17
62#define R_RAM_WRITE_DATA_MASK 0x20 63#define R_RAM_WRITE_DATA_MASK 0x20
63#define R_RAM_ADDR_SET 0x21 64#define R_RAM_ADDR_SET 0x21
64#define R_WRITE_DATA_2_GRAM 0x22 65#define R_WRITE_DATA_2_GRAM 0x22
@@ -74,6 +75,39 @@ static inline bool timer_check(int clock_start, int usecs)
74#define R_GAMMA_AMP_ADJ_POS 0x3a 75#define R_GAMMA_AMP_ADJ_POS 0x3a
75#define R_GAMMA_AMP_ADJ_NEG 0x3b 76#define R_GAMMA_AMP_ADJ_NEG 0x3b
76 77
78#elif defined(IRIVER_H10_5GB)
79/* register defines for TL1771 */
80#define R_START_OSC 0x00
81#define R_DEVICE_CODE_READ 0x00
82#define R_DRV_OUTPUT_CONTROL 0x01
83#define R_DRV_AC_CONTROL 0x02
84#define R_ENTRY_MODE 0x03
85#define R_DISP_CONTROL1 0x07
86#define R_DISP_CONTROL2 0x08
87#define R_FRAME_CYCLE_CONTROL 0x0b
88#define R_POWER_CONTROL1 0x10
89#define R_POWER_CONTROL2 0x11
90#define R_POWER_CONTROL3 0x12
91#define R_POWER_CONTROL4 0x13
92#define R_POWER_CONTROL5 0x14
93#define R_RAM_ADDR_SET 0x21
94#define R_WRITE_DATA_2_GRAM 0x22
95#define R_GAMMA_FINE_ADJ_POS1 0x30
96#define R_GAMMA_FINE_ADJ_POS2 0x31
97#define R_GAMMA_FINE_ADJ_POS3 0x32
98#define R_GAMMA_GRAD_ADJ_POS 0x33
99#define R_GAMMA_FINE_ADJ_NEG1 0x34
100#define R_GAMMA_FINE_ADJ_NEG2 0x35
101#define R_GAMMA_FINE_ADJ_NEG3 0x36
102#define R_GAMMA_GRAD_ADJ_NEG 0x37
103#define R_POWER_CONTROL6 0x38
104#define R_GATE_SCAN_START_POS 0x40
105#define R_1ST_SCR_DRV_POS 0x42
106#define R_2ND_SCR_DRV_POS 0x43
107#define R_HORIZ_RAM_ADDR_POS 0x44
108#define R_VERT_RAM_ADDR_POS 0x45
109
110#endif
77 111
78static void lcd_wait_write(void) 112static void lcd_wait_write(void)
79{ 113{
@@ -171,25 +205,23 @@ void lcd_yuv_blit(unsigned char * const src[3],
171 205
172 206
173/* Update a fraction of the display. */ 207/* Update a fraction of the display. */
174void lcd_update_rect(int x, int y, int width, int height) 208void lcd_update_rect(int x0, int y0, int width, int height)
175{ 209{
176 int y0, x0, y1, x1; 210 int x1, y1;
177 /*int newx,newwidth;*/ 211 int newx,newwidth;
178 212
179 unsigned long *addr = (unsigned long *)lcd_framebuffer; 213 unsigned long *addr = (unsigned long *)lcd_framebuffer;
180 214
181 /* Ensure x and width are both even - so we can read 32-bit aligned 215 /* Ensure x and width are both even - so we can read 32-bit aligned
182 data from lcd_framebuffer */ 216 data from lcd_framebuffer */
183 /*newx=x&~1; 217 newx=x0&~1;
184 newwidth=width&~1; 218 newwidth=width&~1;
185 if (newx+newwidth < x+width) { newwidth+=2; } 219 if (newx+newwidth < x0+width) { newwidth+=2; }
186 x=newx; width=newwidth;*/ 220 x0=newx; width=newwidth;
187 221
188 /* calculate the drawing region */ 222 /* calculate the drawing region */
189 y0 = x; /* start horiz */ 223 y1 = (y0 + height) - 1; /* max vert */
190 x0 = y; /* start vert */ 224 x1 = (x0 + width) - 1; /* max horiz */
191 y1 = (x + width) - 1; /* max horiz */
192 x1 = (y + height) - 1; /* max vert */
193 225
194 226
195 /* swap max horiz < start horiz */ 227 /* swap max horiz < start horiz */
@@ -218,12 +250,12 @@ void lcd_update_rect(int x, int y, int width, int height)
218 /* position cursor (set AD0-AD15) */ 250 /* position cursor (set AD0-AD15) */
219 /* start vert << 8 | start horiz */ 251 /* start vert << 8 | start horiz */
220 lcd_send_cmd(R_RAM_ADDR_SET); 252 lcd_send_cmd(R_RAM_ADDR_SET);
221 lcd_send_data(((x0 << 8) | y0)); 253 lcd_send_data(((y0 << 8) | x0));
222 254
223 /* start drawing */ 255 /* start drawing */
224 lcd_send_cmd(R_WRITE_DATA_2_GRAM); 256 lcd_send_cmd(R_WRITE_DATA_2_GRAM);
225 257
226 addr = (unsigned long*)&lcd_framebuffer[y][x]; 258 addr = (unsigned long*)&lcd_framebuffer[y0][x0];
227 259
228 int c, r; 260 int c, r;
229 261