diff options
Diffstat (limited to 'firmware/target/arm/lcd-c200_c200v2.c')
-rw-r--r-- | firmware/target/arm/lcd-c200_c200v2.c | 74 |
1 files changed, 2 insertions, 72 deletions
diff --git a/firmware/target/arm/lcd-c200_c200v2.c b/firmware/target/arm/lcd-c200_c200v2.c index 62f1dc20f6..45a37d9d7b 100644 --- a/firmware/target/arm/lcd-c200_c200v2.c +++ b/firmware/target/arm/lcd-c200_c200v2.c | |||
@@ -25,11 +25,8 @@ | |||
25 | #include "lcd.h" | 25 | #include "lcd.h" |
26 | #include "kernel.h" | 26 | #include "kernel.h" |
27 | #include "system.h" | 27 | #include "system.h" |
28 | |||
29 | #ifdef SANSA_C200V2 | 28 | #ifdef SANSA_C200V2 |
30 | /* button driver needs to know if a lcd operation is in progress */ | 29 | #include "dbop-as3525.h" |
31 | static bool lcd_busy = false; | ||
32 | static unsigned short dbop_input = 0xFFFF; | ||
33 | #endif | 30 | #endif |
34 | 31 | ||
35 | /* Display status */ | 32 | /* Display status */ |
@@ -183,45 +180,6 @@ static inline void as3525_dbop_init(void) | |||
183 | lcd_delay(20); | 180 | lcd_delay(20); |
184 | } | 181 | } |
185 | 182 | ||
186 | static unsigned short lcd_dbop_read(void) | ||
187 | { | ||
188 | unsigned int dbop_ctrl_old = DBOP_CTRL; | ||
189 | unsigned int dbop_timpol23_old = DBOP_TIMPOL_23; | ||
190 | unsigned int value; | ||
191 | |||
192 | /* make sure that the DBOP FIFO is empty */ | ||
193 | while ((DBOP_STAT & (1<<10)) == 0); | ||
194 | |||
195 | /* write DBOP_DOUT to pre-charge DBOP data lines with a high level */ | ||
196 | DBOP_TIMPOL_23 = 0xe167e167; /* no strobe towards lcd */ | ||
197 | DBOP_CTRL = (1 << 16) | /* enw=1 (enable write) */ | ||
198 | (1 << 12); /* ow=1 (16-bit data width) */ | ||
199 | DBOP_DOUT = 0xFFFF; /* all pins high */ | ||
200 | while ((DBOP_STAT & (1<<10)) == 0); | ||
201 | |||
202 | /* perform a DBOP read */ | ||
203 | DBOP_CTRL = (1 << 15) | /* strd=1 (start read) */ | ||
204 | (1 << 12) | /* ow=1 (16-bit data width) */ | ||
205 | (31 << 0); /* rs_t=31 (read DBOP at end of cycle) */ | ||
206 | while ((DBOP_STAT & (1<<16)) == 0); | ||
207 | value = DBOP_DIN; | ||
208 | |||
209 | /* restore previous values */ | ||
210 | DBOP_TIMPOL_23 = dbop_timpol23_old; | ||
211 | DBOP_CTRL = dbop_ctrl_old; | ||
212 | |||
213 | return value; | ||
214 | } | ||
215 | |||
216 | /* get the DBOP input value, either directly or cached if DBOP is busy */ | ||
217 | unsigned short int lcd_dbop_input(void) | ||
218 | { | ||
219 | if (!lcd_busy) { | ||
220 | dbop_input = lcd_dbop_read(); | ||
221 | } | ||
222 | return dbop_input; | ||
223 | } | ||
224 | |||
225 | #endif | 183 | #endif |
226 | 184 | ||
227 | /* LCD init */ | 185 | /* LCD init */ |
@@ -292,13 +250,7 @@ int lcd_default_contrast(void) | |||
292 | 250 | ||
293 | void lcd_set_contrast(int val) | 251 | void lcd_set_contrast(int val) |
294 | { | 252 | { |
295 | #ifdef SANSA_C200V2 | ||
296 | lcd_busy = true; | ||
297 | #endif | ||
298 | lcd_send_command(R_CONTRAST_CONTROL1, val); | 253 | lcd_send_command(R_CONTRAST_CONTROL1, val); |
299 | #ifdef SANSA_C200V2 | ||
300 | lcd_busy = false; | ||
301 | #endif | ||
302 | } | 254 | } |
303 | 255 | ||
304 | void lcd_set_invert_display(bool yesno) | 256 | void lcd_set_invert_display(bool yesno) |
@@ -313,9 +265,6 @@ void lcd_enable(bool yesno) | |||
313 | if (yesno == is_lcd_enabled) | 265 | if (yesno == is_lcd_enabled) |
314 | return; | 266 | return; |
315 | 267 | ||
316 | #ifdef SANSA_C200V2 | ||
317 | lcd_busy = true; | ||
318 | #endif | ||
319 | if ((is_lcd_enabled = yesno)) | 268 | if ((is_lcd_enabled = yesno)) |
320 | { | 269 | { |
321 | lcd_send_command(R_STANDBY_OFF, 0); | 270 | lcd_send_command(R_STANDBY_OFF, 0); |
@@ -326,9 +275,6 @@ void lcd_enable(bool yesno) | |||
326 | { | 275 | { |
327 | lcd_send_command(R_STANDBY_ON, 0); | 276 | lcd_send_command(R_STANDBY_ON, 0); |
328 | } | 277 | } |
329 | #ifdef SANSA_C200V2 | ||
330 | lcd_busy = false; | ||
331 | #endif | ||
332 | } | 278 | } |
333 | #endif | 279 | #endif |
334 | 280 | ||
@@ -343,18 +289,12 @@ bool lcd_active(void) | |||
343 | /* turn the display upside down (call lcd_update() afterwards) */ | 289 | /* turn the display upside down (call lcd_update() afterwards) */ |
344 | void lcd_set_flip(bool yesno) | 290 | void lcd_set_flip(bool yesno) |
345 | { | 291 | { |
346 | #ifdef SANSA_C200V2 | ||
347 | lcd_busy = true; | ||
348 | #endif | ||
349 | lcd_send_command(R_DRIVER_OUTPUT_MODE, yesno ? 0x02 : 0x07); | 292 | lcd_send_command(R_DRIVER_OUTPUT_MODE, yesno ? 0x02 : 0x07); |
350 | #ifdef SANSA_C200V2 | ||
351 | lcd_busy = false; | ||
352 | #endif | ||
353 | } | 293 | } |
354 | 294 | ||
355 | /*** update functions ***/ | 295 | /*** update functions ***/ |
356 | 296 | ||
357 | #if MEMORYSIZE > 2 | 297 | #if MEMORYSIZE > 2 /* not for C200V2 */ |
358 | void lcd_yuv_set_options(unsigned options) | 298 | void lcd_yuv_set_options(unsigned options) |
359 | { | 299 | { |
360 | lcd_yuv_options = options; | 300 | lcd_yuv_options = options; |
@@ -450,12 +390,6 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
450 | 390 | ||
451 | addr = &lcd_framebuffer[y][x]; | 391 | addr = &lcd_framebuffer[y][x]; |
452 | 392 | ||
453 | #ifdef SANSA_C200V2 | ||
454 | lcd_busy = true; | ||
455 | /* perform a dbop read before doing a potentially lengthy lcd update */ | ||
456 | dbop_input = lcd_dbop_read(); | ||
457 | #endif | ||
458 | |||
459 | if (width <= 1) { | 393 | if (width <= 1) { |
460 | /* The X end address must be larger than the X start address, so we | 394 | /* The X end address must be larger than the X start address, so we |
461 | * switch to vertical mode for single column updates and set the | 395 | * switch to vertical mode for single column updates and set the |
@@ -476,8 +410,4 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
476 | lcd_write_data(addr, width); | 410 | lcd_write_data(addr, width); |
477 | addr += LCD_WIDTH; | 411 | addr += LCD_WIDTH; |
478 | } while (--height > 0); | 412 | } while (--height > 0); |
479 | |||
480 | #ifdef SANSA_C200V2 | ||
481 | lcd_busy = false; | ||
482 | #endif | ||
483 | } | 413 | } |