summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrik Sikken <bertrik@sikken.nl>2009-08-08 14:37:42 +0000
committerBertrik Sikken <bertrik@sikken.nl>2009-08-08 14:37:42 +0000
commit978f3798a9f00b89ee56f42e10ba2d8daa9cffae (patch)
tree0d4cadfe7ae005b977e9d1c88da18faa5d7c3564
parent367d8148a766e5182c553b9ded9800fa61a28f5a (diff)
downloadrockbox-978f3798a9f00b89ee56f42e10ba2d8daa9cffae.tar.gz
rockbox-978f3798a9f00b89ee56f42e10ba2d8daa9cffae.zip
Apply FS#10447 - e200v2 lcd driver cleanup by Michael Chicoine
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22210 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c41
1 files changed, 26 insertions, 15 deletions
diff --git a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c
index 69e1d2504f..7f02a8b894 100644
--- a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c
+++ b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c
@@ -36,8 +36,8 @@
36static bool display_on = false; /* is the display turned on? */ 36static bool display_on = false; /* is the display turned on? */
37static bool display_flipped = false; 37static bool display_flipped = false;
38/* we need to write a red pixel for correct button reads 38/* we need to write a red pixel for correct button reads
39 * (see lcd_button_support()), but that must not happen while the lcd is updating 39 * (see lcd_button_support()), but that must not happen while the lcd is
40 * so block lcd_button_support the during updates */ 40 * updating so block lcd_button_support the during updates */
41static volatile bool lcd_busy = false; 41static volatile bool lcd_busy = false;
42 42
43/* register defines */ 43/* register defines */
@@ -113,13 +113,17 @@ static void ams3525_dbop_init(void)
113 113
114 DBOP_TIMPOL_01 = 0xe167e167; 114 DBOP_TIMPOL_01 = 0xe167e167;
115 DBOP_TIMPOL_23 = 0xe167006e; 115 DBOP_TIMPOL_23 = 0xe167006e;
116 DBOP_CTRL = (1<<18)|(1<<12)|(8<<0); /* short count, 16bit write, read-timing =8 */ 116
117 /* short count, 16bit write, read-timing =8 */
118 DBOP_CTRL = (1<<18)|(1<<12)|(8<<0);
117 119
118 GPIOB_AFSEL = 0xfc; 120 GPIOB_AFSEL = 0xfc;
119 GPIOC_AFSEL = 0xff; 121 GPIOC_AFSEL = 0xff;
120 122
121 DBOP_TIMPOL_23 = 0x6000e; 123 DBOP_TIMPOL_23 = 0x6000e;
122 DBOP_CTRL = (1<<18)|(1<<16)|(1<<12)|(8<<0);/* short count,write enable, 16bit write, read-timing =8 */ 124
125 /* short count,write enable, 16bit write, read-timing =8 */
126 DBOP_CTRL = (1<<18)|(1<<16)|(1<<12)|(8<<0);
123 DBOP_TIMPOL_01 = 0x6e167; 127 DBOP_TIMPOL_01 = 0x6e167;
124 DBOP_TIMPOL_23 = 0xa167e06f; 128 DBOP_TIMPOL_23 = 0xa167e06f;
125 129
@@ -203,9 +207,12 @@ static void lcd_window(int xmin, int ymin, int xmax, int ymax)
203 } 207 }
204 else 208 else
205 { 209 {
206 lcd_write_reg(R_HORIZ_RAM_ADDR_POS, ((LCD_WIDTH-1 - xmin) << 8) | (LCD_WIDTH-1 - xmax)); 210 lcd_write_reg(R_HORIZ_RAM_ADDR_POS,
207 lcd_write_reg(R_VERT_RAM_ADDR_POS, ((LCD_HEIGHT-1 - ymin) << 8) | (LCD_HEIGHT-1 - ymax)); 211 ((LCD_WIDTH-1 - xmin) << 8) | (LCD_WIDTH-1 - xmax));
208 lcd_write_reg(R_RAM_ADDR_SET, ((LCD_HEIGHT-1 - ymin) << 8) | (LCD_WIDTH-1 - xmin)); 212 lcd_write_reg(R_VERT_RAM_ADDR_POS,
213 ((LCD_HEIGHT-1 - ymin) << 8) | (LCD_HEIGHT-1 - ymax));
214 lcd_write_reg(R_RAM_ADDR_SET,
215 ((LCD_HEIGHT-1 - ymin) << 8) | (LCD_WIDTH-1 - xmin));
209 } 216 }
210} 217}
211 218
@@ -232,7 +239,8 @@ static void _display_on(void)
232 lcd_write_reg(R_COMPARE_REG1, 0); 239 lcd_write_reg(R_COMPARE_REG1, 0);
233 lcd_write_reg(R_COMPARE_REG2, 0); 240 lcd_write_reg(R_COMPARE_REG2, 0);
234 241
235 lcd_write_reg(R_DISP_CONTROL1, 0x0000 | r_disp_control_rev); /* GON = 0, DTE = 0, D1-0 = 00b */ 242 /* GON = 0, DTE = 0, D1-0 = 00b */
243 lcd_write_reg(R_DISP_CONTROL1, 0x0000 | r_disp_control_rev);
236 244
237 /* Front porch lines: 2; Back porch lines: 2; */ 245 /* Front porch lines: 2; Back porch lines: 2; */
238 lcd_write_reg(R_DISP_CONTROL2, 0x0203); 246 lcd_write_reg(R_DISP_CONTROL2, 0x0203);
@@ -369,10 +377,10 @@ extern void lcd_write_yuv420_lines(unsigned char const * const src[3],
369 int width, 377 int width,
370 int stride); 378 int stride);
371extern void lcd_write_yuv420_lines_odither(unsigned char const * const src[3], 379extern void lcd_write_yuv420_lines_odither(unsigned char const * const src[3],
372 int width, 380 int width,
373 int stride, 381 int stride,
374 int x_screen, /* To align dither pattern */ 382 int x_screen, /* To align dither pattern */
375 int y_screen); 383 int y_screen);
376 384
377void lcd_yuv_set_options(unsigned options) 385void lcd_yuv_set_options(unsigned options)
378{ 386{
@@ -383,9 +391,11 @@ static void lcd_window_blit(int xmin, int ymin, int xmax, int ymax)
383{ 391{
384 if (!display_flipped) 392 if (!display_flipped)
385 { 393 {
386 lcd_write_reg(R_HORIZ_RAM_ADDR_POS, ((LCD_WIDTH-1 - xmin) << 8) | (LCD_WIDTH-1 - xmax)); 394 lcd_write_reg(R_HORIZ_RAM_ADDR_POS,
395 ((LCD_WIDTH-1 - xmin) << 8) | (LCD_WIDTH-1 - xmax));
387 lcd_write_reg(R_VERT_RAM_ADDR_POS, (ymax << 8) | ymin); 396 lcd_write_reg(R_VERT_RAM_ADDR_POS, (ymax << 8) | ymin);
388 lcd_write_reg(R_RAM_ADDR_SET, (ymin << 8) | (LCD_WIDTH-1 - xmin)); 397 lcd_write_reg(R_RAM_ADDR_SET,
398 (ymin << 8) | (LCD_WIDTH-1 - xmin));
389 } 399 }
390 else 400 else
391 { 401 {
@@ -530,7 +540,8 @@ void lcd_update_rect(int x, int y, int width, int height)
530 lcd_busy = false; 540 lcd_busy = false;
531} /* lcd_update_rect */ 541} /* lcd_update_rect */
532 542
533/* writes one read pixel outside the visible area, needed for correct dbop reads */ 543/* writes one red pixel outside the visible area, needed for correct
544 * dbop reads */
534bool lcd_button_support(void) 545bool lcd_button_support(void)
535{ 546{
536 fb_data data = (0xf<<12); 547 fb_data data = (0xf<<12);