diff options
Diffstat (limited to 'firmware/target')
5 files changed, 62 insertions, 55 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; bool remote_initialized = false; -static void remote_tick(void); /* Standard low-level byte writer. Requires CLK high on entry */ static inline void _write_byte(unsigned data) @@ -269,9 +268,10 @@ void lcd_remote_write_command_ex(int cmd, int data) CS_HI; } -void lcd_remote_write_data(const unsigned char* p_bytes, int count) +void lcd_remote_write_data(const fb_remote_data *p_words, int count) { - const unsigned char *p_end = p_bytes + count; + const unsigned char *p_bytes = (const unsigned char *)p_words; + const unsigned char *p_end = (const unsigned char *)(p_words + count); RS_HI; CS_LO; @@ -320,24 +320,6 @@ bool remote_detect(void) return (GPIO_READ & 0x01000000)?false:true; } -void lcd_remote_init_device(void) -{ - or_l(0x0000e000, &GPIO_OUT); - or_l(0x0000e000, &GPIO_ENABLE); - or_l(0x0000e000, &GPIO_FUNCTION); - - or_l(0x00000020, &GPIO1_OUT); - or_l(0x00000020, &GPIO1_ENABLE); - or_l(0x00000020, &GPIO1_FUNCTION); - - and_l(~0x01000000, &GPIO_OUT); - and_l(~0x01000000, &GPIO_ENABLE); - or_l(0x01000000, &GPIO_FUNCTION); - - lcd_remote_clear_display(); - tick_add_task(remote_tick); -} - void lcd_remote_on(void) { CS_HI; @@ -356,7 +338,7 @@ void lcd_remote_on(void) lcd_remote_write_command(LCD_SET_BIAS | 6); /* 1/11 */ lcd_remote_write_command(LCD_CONTROL_POWER | 7); /* All circuits ON */ - + sleep(30); lcd_remote_write_command_ex(LCD_SET_GRAY | 0, 0x00); @@ -393,6 +375,7 @@ void lcd_remote_poweroff(void) lcd_remote_write_command(LCD_SET_POWER_SAVE | 1); } +#ifndef BOOTLOADER /* Monitor remote hotswap */ static void remote_tick(void) { @@ -430,6 +413,29 @@ static void remote_tick(void) } } } +#endif + +void lcd_remote_init_device(void) +{ + or_l(0x0000e000, &GPIO_OUT); + or_l(0x0000e000, &GPIO_ENABLE); + or_l(0x0000e000, &GPIO_FUNCTION); + + or_l(0x00000020, &GPIO1_OUT); + or_l(0x00000020, &GPIO1_ENABLE); + or_l(0x00000020, &GPIO1_FUNCTION); + + and_l(~0x01000000, &GPIO_OUT); + and_l(~0x01000000, &GPIO_ENABLE); + or_l(0x01000000, &GPIO_FUNCTION); + + lcd_remote_clear_display(); +#ifdef BOOTLOADER + lcd_remote_on(); +#else + tick_add_task(remote_tick); +#endif +} /* Update the display. This must be called after all other LCD functions that change the display. */ @@ -445,8 +451,7 @@ void lcd_remote_update(void) have to update one page at a time. */ lcd_remote_write_command(LCD_SET_PAGE | (y>5?y+2:y)); lcd_remote_write_command_ex(LCD_SET_COLUMN | 0, 0); - lcd_remote_write_data((unsigned char *)lcd_remote_framebuffer[y], - LCD_REMOTE_WIDTH*2); + lcd_remote_write_data(lcd_remote_framebuffer[y], LCD_REMOTE_WIDTH); } } } @@ -478,9 +483,8 @@ void lcd_remote_update_rect(int x, int y, int width, int height) lcd_remote_write_command_ex(LCD_SET_COLUMN | ((x >> 4) & 0xf), x & 0xf); - lcd_remote_write_data ( - (unsigned char *)&lcd_remote_framebuffer[y][x], width*2); - } + lcd_remote_write_data(&lcd_remote_framebuffer[y][x], width); + } } } diff --git a/firmware/target/coldfire/iaudio/lcd-remote-target.h b/firmware/target/coldfire/iaudio/lcd-remote-target.h index 86c361097b..1671082654 100644 --- a/firmware/target/coldfire/iaudio/lcd-remote-target.h +++ b/firmware/target/coldfire/iaudio/lcd-remote-target.h @@ -23,9 +23,6 @@ #define REMOTE_DEINIT_LCD 2 void lcd_remote_init_device(void); -void lcd_remote_write_command(int cmd); -void lcd_remote_write_command_ex(int cmd, int data); -void lcd_remote_write_data(const unsigned char* p_bytes, int count); bool remote_detect(void); void lcd_remote_powersave(bool on); void lcd_remote_set_contrast(int val); diff --git a/firmware/target/coldfire/iaudio/m3/lcd-m3.c b/firmware/target/coldfire/iaudio/m3/lcd-m3.c index ac60006565..d54e0596ab 100644 --- a/firmware/target/coldfire/iaudio/m3/lcd-m3.c +++ b/firmware/target/coldfire/iaudio/m3/lcd-m3.c @@ -60,7 +60,6 @@ static int cached_contrast = DEFAULT_CONTRAST_SETTING; bool initialized = false; -static void lcd_tick(void); /* Standard low-level byte writer. Requires CLK high on entry */ static inline void _write_byte(unsigned data) @@ -295,7 +294,7 @@ int lcd_default_contrast(void) return DEFAULT_CONTRAST_SETTING; } -void lcdset_contrast(int val) +void lcd_set_contrast(int val) { if (val < 0) val = 0; @@ -312,29 +311,11 @@ bool remote_detect(void) return (GPIO_READ & 0x40000000) == 0; } -void lcd_init_device(void) -{ - or_l(0x24000000, &GPIO_OUT); - or_l(0x24000000, &GPIO_ENABLE); - or_l(0x24000000, &GPIO_FUNCTION); - - or_l(0x00011000, &GPIO1_OUT); - or_l(0x00011000, &GPIO1_ENABLE); - or_l(0x00011000, &GPIO1_FUNCTION); - - and_l(~0x40000000, &GPIO_OUT); - and_l(~0x40000000, &GPIO_ENABLE); - or_l(0x40000000, &GPIO_FUNCTION); - - lcd_clear_display(); - tick_add_task(lcd_tick); -} - void lcd_on(void) { CS_HI; CLK_HI; - sleep(10); + sleep(HZ/100); lcd_write_command(LCD_SET_DUTY_RATIO); lcd_write_command(0x70); /* 1/128 */ @@ -349,7 +330,7 @@ void lcd_on(void) lcd_write_command(LCD_CONTROL_POWER | 7); /* All circuits ON */ - sleep(30); + sleep(3*HZ/100); lcd_write_command_e(LCD_SET_GRAY | 0, 0x00); lcd_write_command_e(LCD_SET_GRAY | 1, 0x00); @@ -385,6 +366,7 @@ void lcd_poweroff(void) lcd_write_command(LCD_SET_POWER_SAVE | 1); } +#ifndef BOOTLOADER /* Monitor remote hotswap */ static void lcd_tick(void) { @@ -422,6 +404,29 @@ static void lcd_tick(void) } } } +#endif + +void lcd_init_device(void) +{ + or_l(0x24000000, &GPIO_OUT); + or_l(0x24000000, &GPIO_ENABLE); + or_l(0x24000000, &GPIO_FUNCTION); + + or_l(0x00011000, &GPIO1_OUT); + or_l(0x00011000, &GPIO1_ENABLE); + or_l(0x00011000, &GPIO1_FUNCTION); + + and_l(~0x40000000, &GPIO_OUT); + and_l(~0x40000000, &GPIO_ENABLE); + or_l(0x40000000, &GPIO_FUNCTION); + + lcd_clear_display(); +#ifdef BOOTLOADER + lcd_on(); +#else + tick_add_task(lcd_tick); +#endif +} /* Update the display. This must be called after all other LCD functions that change the display. */ diff --git a/firmware/target/coldfire/iaudio/powermgmt-iaudio.c b/firmware/target/coldfire/iaudio/powermgmt-iaudio.c index 6e2b19d9b6..c4d64e6155 100644 --- a/firmware/target/coldfire/iaudio/powermgmt-iaudio.c +++ b/firmware/target/coldfire/iaudio/powermgmt-iaudio.c @@ -53,6 +53,10 @@ const unsigned short percent_to_volt_charge[11] = /* Returns battery voltage from ADC [millivolts] */ unsigned int battery_adc_voltage(void) { +#ifdef IAUDIO_M3 + return 4000; /* FIXME: fake value - no ADC yet */ +#else return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; +#endif } diff --git a/firmware/target/coldfire/iriver/lcd-remote-target.h b/firmware/target/coldfire/iriver/lcd-remote-target.h index a95f9adade..52c62d9375 100755 --- a/firmware/target/coldfire/iriver/lcd-remote-target.h +++ b/firmware/target/coldfire/iriver/lcd-remote-target.h @@ -22,9 +22,6 @@ #define REMOTE_INIT_LCD 1 #define REMOTE_DEINIT_LCD 2 -void lcd_remote_write_command(int cmd); -void lcd_remote_write_command_ex(int cmd, int data); -void lcd_remote_write_data(const unsigned char* p_bytes, int count); #ifdef HAVE_REMOTE_LCD_TICKING void lcd_remote_emireduce(bool state); #endif |