diff options
author | Michael Chicoine <mc2739@gmail.com> | 2010-06-20 18:10:15 +0000 |
---|---|---|
committer | Michael Chicoine <mc2739@gmail.com> | 2010-06-20 18:10:15 +0000 |
commit | 17a2f9d8d2dfddd8d2d81ff638e21302efef1c8e (patch) | |
tree | 661a412f4dba820f44355edb401cd8a6ac87806e /firmware | |
parent | d41612ff031ff5bbdbbdfa734b77ea68a7ed4a07 (diff) | |
download | rockbox-17a2f9d8d2dfddd8d2d81ff638e21302efef1c8e.tar.gz rockbox-17a2f9d8d2dfddd8d2d81ff638e21302efef1c8e.zip |
Revert r26350 - fixes FS#11421
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26997 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c | 59 |
1 files changed, 48 insertions, 11 deletions
diff --git a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c index 5a4c58f5b3..089a5da24c 100644 --- a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c +++ b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c | |||
@@ -75,9 +75,15 @@ static bool display_on = false; /* is the display turned on? */ | |||
75 | #define R_HORIZ_RAM_ADDR_POS 0x44 | 75 | #define R_HORIZ_RAM_ADDR_POS 0x44 |
76 | #define R_VERT_RAM_ADDR_POS 0x45 | 76 | #define R_VERT_RAM_ADDR_POS 0x45 |
77 | 77 | ||
78 | /* Flip Flag */ | ||
78 | #define R_ENTRY_MODE_HORZ_NORMAL 0x7030 | 79 | #define R_ENTRY_MODE_HORZ_NORMAL 0x7030 |
80 | #define R_ENTRY_MODE_HORZ_FLIPPED 0x7000 | ||
81 | static unsigned short r_entry_mode = R_ENTRY_MODE_HORZ_NORMAL; | ||
79 | #define R_ENTRY_MODE_VERT 0x7038 | 82 | #define R_ENTRY_MODE_VERT 0x7038 |
80 | #define R_ENTRY_MODE_SOLID_VERT 0x1038 | 83 | #define R_ENTRY_MODE_SOLID_VERT 0x1038 |
84 | #define R_ENTRY_MODE_VIDEO_NORMAL 0x7020 | ||
85 | #define R_ENTRY_MODE_VIDEO_FLIPPED 0x7010 | ||
86 | |||
81 | 87 | ||
82 | /* Reverse Flag */ | 88 | /* Reverse Flag */ |
83 | #define R_DISP_CONTROL_NORMAL 0x0004 | 89 | #define R_DISP_CONTROL_NORMAL 0x0004 |
@@ -158,17 +164,34 @@ void lcd_set_invert_display(bool yesno) | |||
158 | 164 | ||
159 | } | 165 | } |
160 | 166 | ||
167 | static bool display_flipped = false; | ||
168 | |||
161 | /* turn the display upside down */ | 169 | /* turn the display upside down */ |
162 | void lcd_set_flip(bool yesno) | 170 | void lcd_set_flip(bool yesno) |
163 | { | 171 | { |
164 | lcd_write_reg(R_DRV_OUTPUT_CONTROL, yesno ? 0x21b : 0x11b); | 172 | display_flipped = yesno; |
173 | |||
174 | r_entry_mode = yesno ? R_ENTRY_MODE_HORZ_FLIPPED : | ||
175 | R_ENTRY_MODE_HORZ_NORMAL; | ||
165 | } | 176 | } |
166 | 177 | ||
167 | static void lcd_window(int xmin, int ymin, int xmax, int ymax) | 178 | static void lcd_window(int xmin, int ymin, int xmax, int ymax) |
168 | { | 179 | { |
169 | lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (xmax << 8) | xmin); | 180 | if (!display_flipped) |
170 | lcd_write_reg(R_VERT_RAM_ADDR_POS, (ymax << 8) | ymin); | 181 | { |
171 | lcd_write_reg(R_RAM_ADDR_SET, (ymin << 8) | xmin); | 182 | lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (xmax << 8) | xmin); |
183 | lcd_write_reg(R_VERT_RAM_ADDR_POS, (ymax << 8) | ymin); | ||
184 | lcd_write_reg(R_RAM_ADDR_SET, (ymin << 8) | xmin); | ||
185 | } | ||
186 | else | ||
187 | { | ||
188 | lcd_write_reg(R_HORIZ_RAM_ADDR_POS, | ||
189 | ((LCD_WIDTH-1 - xmin) << 8) | (LCD_WIDTH-1 - xmax)); | ||
190 | lcd_write_reg(R_VERT_RAM_ADDR_POS, | ||
191 | ((LCD_HEIGHT-1 - ymin) << 8) | (LCD_HEIGHT-1 - ymax)); | ||
192 | lcd_write_reg(R_RAM_ADDR_SET, | ||
193 | ((LCD_HEIGHT-1 - ymin) << 8) | (LCD_WIDTH-1 - xmin)); | ||
194 | } | ||
172 | } | 195 | } |
173 | 196 | ||
174 | static void _display_on(void) | 197 | static void _display_on(void) |
@@ -188,7 +211,7 @@ static void _display_on(void) | |||
188 | /* Address counter updated in horizontal direction; left to right; | 211 | /* Address counter updated in horizontal direction; left to right; |
189 | * vertical increment horizontal increment. | 212 | * vertical increment horizontal increment. |
190 | * data format for 8bit transfer or spi = 65k (5,6,5) */ | 213 | * data format for 8bit transfer or spi = 65k (5,6,5) */ |
191 | lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ_NORMAL); | 214 | lcd_write_reg(R_ENTRY_MODE, r_entry_mode); |
192 | 215 | ||
193 | /* Replace data on writing to GRAM */ | 216 | /* Replace data on writing to GRAM */ |
194 | lcd_write_reg(R_COMPARE_REG1, 0); | 217 | lcd_write_reg(R_COMPARE_REG1, 0); |
@@ -329,10 +352,20 @@ void lcd_yuv_set_options(unsigned options) | |||
329 | #ifndef BOOTLOADER | 352 | #ifndef BOOTLOADER |
330 | static void lcd_window_blit(int xmin, int ymin, int xmax, int ymax) | 353 | static void lcd_window_blit(int xmin, int ymin, int xmax, int ymax) |
331 | { | 354 | { |
332 | lcd_write_reg(R_HORIZ_RAM_ADDR_POS, | 355 | if (!display_flipped) |
333 | ((LCD_WIDTH-1 - xmin) << 8) | (LCD_WIDTH-1 - xmax)); | 356 | { |
334 | lcd_write_reg(R_VERT_RAM_ADDR_POS, (ymax << 8) | ymin); | 357 | lcd_write_reg(R_HORIZ_RAM_ADDR_POS, |
335 | lcd_write_reg(R_RAM_ADDR_SET, (ymin << 8) | (LCD_WIDTH-1 - xmin)); | 358 | ((LCD_WIDTH-1 - xmin) << 8) | (LCD_WIDTH-1 - xmax)); |
359 | lcd_write_reg(R_VERT_RAM_ADDR_POS, (ymax << 8) | ymin); | ||
360 | lcd_write_reg(R_RAM_ADDR_SET, | ||
361 | (ymin << 8) | (LCD_WIDTH-1 - xmin)); | ||
362 | } | ||
363 | else | ||
364 | { | ||
365 | lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (xmax << 8) | xmin); | ||
366 | lcd_write_reg(R_VERT_RAM_ADDR_POS, (ymax << 8) | ymin); | ||
367 | lcd_write_reg(R_RAM_ADDR_SET, (ymax << 8) | xmin); | ||
368 | } | ||
336 | } | 369 | } |
337 | 370 | ||
338 | /* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ | 371 | /* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ |
@@ -365,6 +398,10 @@ void lcd_blit_yuv(unsigned char * const src[3], | |||
365 | yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1); | 398 | yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1); |
366 | yuv_src[2] = src[2] + (yuv_src[1] - src[1]); | 399 | yuv_src[2] = src[2] + (yuv_src[1] - src[1]); |
367 | 400 | ||
401 | lcd_write_reg(R_ENTRY_MODE, | ||
402 | display_flipped ? R_ENTRY_MODE_VIDEO_FLIPPED : R_ENTRY_MODE_VIDEO_NORMAL | ||
403 | ); | ||
404 | |||
368 | if (lcd_yuv_options & LCD_YUV_DITHER) | 405 | if (lcd_yuv_options & LCD_YUV_DITHER) |
369 | { | 406 | { |
370 | do | 407 | do |
@@ -409,7 +446,7 @@ void lcd_update(void) | |||
409 | if (!display_on) | 446 | if (!display_on) |
410 | return; | 447 | return; |
411 | 448 | ||
412 | lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ_NORMAL); | 449 | lcd_write_reg(R_ENTRY_MODE, r_entry_mode); |
413 | 450 | ||
414 | /* Set start position and window */ | 451 | /* Set start position and window */ |
415 | lcd_window(0, 0, LCD_WIDTH-1, LCD_HEIGHT-1); | 452 | lcd_window(0, 0, LCD_WIDTH-1, LCD_HEIGHT-1); |
@@ -447,7 +484,7 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
447 | if (y + height > LCD_HEIGHT) | 484 | if (y + height > LCD_HEIGHT) |
448 | height = LCD_HEIGHT - y; /* clip bottom */ | 485 | height = LCD_HEIGHT - y; /* clip bottom */ |
449 | 486 | ||
450 | lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ_NORMAL); | 487 | lcd_write_reg(R_ENTRY_MODE, r_entry_mode); |
451 | 488 | ||
452 | /* we need to make x and width even to enable 32bit transfers */ | 489 | /* we need to make x and width even to enable 32bit transfers */ |
453 | width = (width + (x & 1) + 1) & ~1; | 490 | width = (width + (x & 1) + 1) & ~1; |