diff options
author | Jens Arnold <amiconn@rockbox.org> | 2008-03-12 23:08:33 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2008-03-12 23:08:33 +0000 |
commit | 17bc340f1f0571dc90c91e6f39f93448151d557e (patch) | |
tree | 53fccad5fe81875497f717f9fe71b498bde5fc83 /firmware/target/coldfire/iaudio/lcd-remote-iaudio.c | |
parent | 579089afa546d72c0a05815ed3abfff069ed520b (diff) | |
download | rockbox-17bc340f1f0571dc90c91e6f39f93448151d557e.tar.gz rockbox-17bc340f1f0571dc90c91e6f39f93448151d557e.zip |
Make the LCD remote work in the iAudio M3, M5 and X5 bootloaders. * Fix viewport related init bug in the 2 bit vertically interleaved LCD driver. * Fix low bat warning in iaudio bootloader - voltages are in millivolts now.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16648 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/coldfire/iaudio/lcd-remote-iaudio.c')
-rw-r--r-- | firmware/target/coldfire/iaudio/lcd-remote-iaudio.c | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/firmware/target/coldfire/iaudio/lcd-remote-iaudio.c b/firmware/target/coldfire/iaudio/lcd-remote-iaudio.c index 9940017dd9..3c14bb61a0 100644 --- a/firmware/target/coldfire/iaudio/lcd-remote-iaudio.c +++ b/firmware/target/coldfire/iaudio/lcd-remote-iaudio.c | |||
@@ -59,7 +59,6 @@ static int cached_contrast = DEFAULT_REMOTE_CONTRAST_SETTING; | |||
59 | 59 | ||
60 | bool remote_initialized = false; | 60 | bool remote_initialized = false; |
61 | 61 | ||
62 | static void remote_tick(void); | ||
63 | 62 | ||
64 | /* Standard low-level byte writer. Requires CLK high on entry */ | 63 | /* Standard low-level byte writer. Requires CLK high on entry */ |
65 | static inline void _write_byte(unsigned data) | 64 | static inline void _write_byte(unsigned data) |
@@ -269,9 +268,10 @@ void lcd_remote_write_command_ex(int cmd, int data) | |||
269 | CS_HI; | 268 | CS_HI; |
270 | } | 269 | } |
271 | 270 | ||
272 | void lcd_remote_write_data(const unsigned char* p_bytes, int count) | 271 | void lcd_remote_write_data(const fb_remote_data *p_words, int count) |
273 | { | 272 | { |
274 | const unsigned char *p_end = p_bytes + count; | 273 | const unsigned char *p_bytes = (const unsigned char *)p_words; |
274 | const unsigned char *p_end = (const unsigned char *)(p_words + count); | ||
275 | 275 | ||
276 | RS_HI; | 276 | RS_HI; |
277 | CS_LO; | 277 | CS_LO; |
@@ -320,24 +320,6 @@ bool remote_detect(void) | |||
320 | return (GPIO_READ & 0x01000000)?false:true; | 320 | return (GPIO_READ & 0x01000000)?false:true; |
321 | } | 321 | } |
322 | 322 | ||
323 | void lcd_remote_init_device(void) | ||
324 | { | ||
325 | or_l(0x0000e000, &GPIO_OUT); | ||
326 | or_l(0x0000e000, &GPIO_ENABLE); | ||
327 | or_l(0x0000e000, &GPIO_FUNCTION); | ||
328 | |||
329 | or_l(0x00000020, &GPIO1_OUT); | ||
330 | or_l(0x00000020, &GPIO1_ENABLE); | ||
331 | or_l(0x00000020, &GPIO1_FUNCTION); | ||
332 | |||
333 | and_l(~0x01000000, &GPIO_OUT); | ||
334 | and_l(~0x01000000, &GPIO_ENABLE); | ||
335 | or_l(0x01000000, &GPIO_FUNCTION); | ||
336 | |||
337 | lcd_remote_clear_display(); | ||
338 | tick_add_task(remote_tick); | ||
339 | } | ||
340 | |||
341 | void lcd_remote_on(void) | 323 | void lcd_remote_on(void) |
342 | { | 324 | { |
343 | CS_HI; | 325 | CS_HI; |
@@ -356,7 +338,7 @@ void lcd_remote_on(void) | |||
356 | lcd_remote_write_command(LCD_SET_BIAS | 6); /* 1/11 */ | 338 | lcd_remote_write_command(LCD_SET_BIAS | 6); /* 1/11 */ |
357 | 339 | ||
358 | lcd_remote_write_command(LCD_CONTROL_POWER | 7); /* All circuits ON */ | 340 | lcd_remote_write_command(LCD_CONTROL_POWER | 7); /* All circuits ON */ |
359 | 341 | ||
360 | sleep(30); | 342 | sleep(30); |
361 | 343 | ||
362 | lcd_remote_write_command_ex(LCD_SET_GRAY | 0, 0x00); | 344 | lcd_remote_write_command_ex(LCD_SET_GRAY | 0, 0x00); |
@@ -393,6 +375,7 @@ void lcd_remote_poweroff(void) | |||
393 | lcd_remote_write_command(LCD_SET_POWER_SAVE | 1); | 375 | lcd_remote_write_command(LCD_SET_POWER_SAVE | 1); |
394 | } | 376 | } |
395 | 377 | ||
378 | #ifndef BOOTLOADER | ||
396 | /* Monitor remote hotswap */ | 379 | /* Monitor remote hotswap */ |
397 | static void remote_tick(void) | 380 | static void remote_tick(void) |
398 | { | 381 | { |
@@ -430,6 +413,29 @@ static void remote_tick(void) | |||
430 | } | 413 | } |
431 | } | 414 | } |
432 | } | 415 | } |
416 | #endif | ||
417 | |||
418 | void lcd_remote_init_device(void) | ||
419 | { | ||
420 | or_l(0x0000e000, &GPIO_OUT); | ||
421 | or_l(0x0000e000, &GPIO_ENABLE); | ||
422 | or_l(0x0000e000, &GPIO_FUNCTION); | ||
423 | |||
424 | or_l(0x00000020, &GPIO1_OUT); | ||
425 | or_l(0x00000020, &GPIO1_ENABLE); | ||
426 | or_l(0x00000020, &GPIO1_FUNCTION); | ||
427 | |||
428 | and_l(~0x01000000, &GPIO_OUT); | ||
429 | and_l(~0x01000000, &GPIO_ENABLE); | ||
430 | or_l(0x01000000, &GPIO_FUNCTION); | ||
431 | |||
432 | lcd_remote_clear_display(); | ||
433 | #ifdef BOOTLOADER | ||
434 | lcd_remote_on(); | ||
435 | #else | ||
436 | tick_add_task(remote_tick); | ||
437 | #endif | ||
438 | } | ||
433 | 439 | ||
434 | /* Update the display. | 440 | /* Update the display. |
435 | This must be called after all other LCD functions that change the display. */ | 441 | This must be called after all other LCD functions that change the display. */ |
@@ -445,8 +451,7 @@ void lcd_remote_update(void) | |||
445 | have to update one page at a time. */ | 451 | have to update one page at a time. */ |
446 | lcd_remote_write_command(LCD_SET_PAGE | (y>5?y+2:y)); | 452 | lcd_remote_write_command(LCD_SET_PAGE | (y>5?y+2:y)); |
447 | lcd_remote_write_command_ex(LCD_SET_COLUMN | 0, 0); | 453 | lcd_remote_write_command_ex(LCD_SET_COLUMN | 0, 0); |
448 | lcd_remote_write_data((unsigned char *)lcd_remote_framebuffer[y], | 454 | lcd_remote_write_data(lcd_remote_framebuffer[y], LCD_REMOTE_WIDTH); |
449 | LCD_REMOTE_WIDTH*2); | ||
450 | } | 455 | } |
451 | } | 456 | } |
452 | } | 457 | } |
@@ -478,9 +483,8 @@ void lcd_remote_update_rect(int x, int y, int width, int height) | |||
478 | lcd_remote_write_command_ex(LCD_SET_COLUMN | ((x >> 4) & 0xf), | 483 | lcd_remote_write_command_ex(LCD_SET_COLUMN | ((x >> 4) & 0xf), |
479 | x & 0xf); | 484 | x & 0xf); |
480 | 485 | ||
481 | lcd_remote_write_data ( | 486 | lcd_remote_write_data(&lcd_remote_framebuffer[y][x], width); |
482 | (unsigned char *)&lcd_remote_framebuffer[y][x], width*2); | 487 | } |
483 | } | ||
484 | } | 488 | } |
485 | } | 489 | } |
486 | 490 | ||