Fix reds and yellows (hopefully). Some targets apparently didn't properly #ifdef lcd_enable and lcd_sleep code out, so that it got partly active in the bootloader; rename the ui simulator stub fixes most reds; for the clip: move the hook code into lcd-1bit-vert.c which should fix the bootloader red.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20333 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2009-03-17 03:36:36 +00:00
parent 68f9ef2d57
commit 4ed387d603
16 changed files with 78 additions and 46 deletions

View file

@ -95,6 +95,25 @@ void LCDFN(init)(void)
#endif #endif
} }
#ifdef MAIN_LCD
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
static void (*lcd_activation_hook)(void) = NULL;
void lcd_activation_set_hook(void (*func)(void))
{
lcd_activation_hook = func;
}
void lcd_activation_call_hook(void)
{
void (*func)(void) = lcd_activation_hook;
if (func != NULL)
func();
}
#endif
#endif
/*** parameter handling ***/ /*** parameter handling ***/
void LCDFN(set_drawmode)(int mode) void LCDFN(set_drawmode)(int mode)

View file

@ -70,7 +70,8 @@
#define LCD_PIXELFORMAT RGB565 /* rgb565 */ #define LCD_PIXELFORMAT RGB565 /* rgb565 */
/* Define this if your LCD can be enabled/disabled */ /* Define this if your LCD can be enabled/disabled */
#define HAVE_LCD_ENABLE /* Disabled until properly working
#define HAVE_LCD_ENABLE */
#define CONFIG_KEYPAD CREATIVEZVM_PAD #define CONFIG_KEYPAD CREATIVEZVM_PAD
#define HAVE_HEADPHONE_DETECTION #define HAVE_HEADPHONE_DETECTION

View file

@ -54,10 +54,11 @@
#define HAVE_LCD_ENABLE #define HAVE_LCD_ENABLE
/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE /* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE
should be defined as well. */ should be defined as well.
#define HAVE_LCD_SLEEP #define HAVE_LCD_SLEEP
#define HAVE_LCD_SLEEP_SETTING #define HAVE_LCD_SLEEP_SETTING
#endif #endif
*/
/* define this if you can flip your LCD */ /* define this if you can flip your LCD */
#define HAVE_LCD_FLIP #define HAVE_LCD_FLIP

View file

@ -54,10 +54,11 @@
#define HAVE_LCD_ENABLE #define HAVE_LCD_ENABLE
/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE /* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE
should be defined as well. */ should be defined as well.
#define HAVE_LCD_SLEEP #define HAVE_LCD_SLEEP
#define HAVE_LCD_SLEEP_SETTING #define HAVE_LCD_SLEEP_SETTING
#endif #endif
*/
/* define this if you can flip your LCD */ /* define this if you can flip your LCD */
#define HAVE_LCD_FLIP #define HAVE_LCD_FLIP

View file

@ -160,22 +160,6 @@ void lcd_set_flip(bool yesno)
} }
#ifdef HAVE_LCD_ENABLE #ifdef HAVE_LCD_ENABLE
static void (*lcd_activation_hook)(void) = NULL;
void lcd_activation_set_hook(void (*func)(void))
{
lcd_activation_hook = func;
}
void lcd_activation_call_hook(void)
{
void (*func)(void) = lcd_activation_hook;
if (func != NULL)
func();
}
void lcd_enable(bool enable) void lcd_enable(bool enable)
{ {
if(display_on == enable) if(display_on == enable)

View file

@ -321,6 +321,7 @@ void lcd_init_device(void)
_display_on(); _display_on();
} }
#if defined(HAVE_LCD_ENABLE)
void lcd_enable(bool on) void lcd_enable(bool on)
{ {
if(display_on!=on) if(display_on!=on)
@ -337,16 +338,15 @@ void lcd_enable(bool on)
} }
} }
} }
#endif
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
bool lcd_active(void) bool lcd_active(void)
{ {
return display_on; return display_on;
} }
void lcd_sleep(void) #endif
{
/* TODO */
}
/*** update functions ***/ /*** update functions ***/

View file

@ -185,6 +185,7 @@ static void _display_on(void)
lcd_update(); lcd_update();
} }
#if defined(HAVE_LCD_ENABLE)
void lcd_enable(bool on) void lcd_enable(bool on)
{ {
if (display_on == on) if (display_on == on)
@ -217,16 +218,14 @@ void lcd_enable(bool on)
display_on = false; display_on = false;
} }
} }
#endif
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
bool lcd_active(void) bool lcd_active(void)
{ {
return display_on; return display_on;
} }
#endif
void lcd_sleep(void)
{
/* TODO */
}
/*** update functions ***/ /*** update functions ***/

View file

@ -597,6 +597,11 @@ void lcd_sleep(void)
mutex_unlock(&lcdstate_lock); mutex_unlock(&lcdstate_lock);
} }
bool lcd_active(void)
{
return lcd_state.display;
}
#ifdef HAVE_LCD_SHUTDOWN #ifdef HAVE_LCD_SHUTDOWN
void lcd_shutdown(void) void lcd_shutdown(void)
{ {

View file

@ -352,6 +352,7 @@ static void lcd_display_off(void)
lcd_write_reg(R_DISP_CONTROL, 0x0000); lcd_write_reg(R_DISP_CONTROL, 0x0000);
} }
#if defined(HAVE_LCD_ENABLE)
void lcd_enable(bool on) void lcd_enable(bool on)
{ {
if (on == display_on) if (on == display_on)
@ -370,12 +371,9 @@ void lcd_enable(bool on)
lcd_display_off(); lcd_display_off();
} }
} }
#endif
bool lcd_active(void) #ifdef HAVE_LCD_SLEEP
{
return display_on;
}
void lcd_sleep(void) void lcd_sleep(void)
{ {
if (power_on) if (power_on)
@ -385,6 +383,14 @@ void lcd_sleep(void)
/* BT2-0=000, DC2-0=000, AP2-0=000, SLP=0, STB=1 */ /* BT2-0=000, DC2-0=000, AP2-0=000, SLP=0, STB=1 */
lcd_write_reg(R_POWER_CONTROL1, 0x0001); lcd_write_reg(R_POWER_CONTROL1, 0x0001);
} }
#endif
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
bool lcd_active(void)
{
return display_on;
}
#endif
/*** update functions ***/ /*** update functions ***/

View file

@ -42,10 +42,12 @@ extern struct viewport* current_vp;
extern void lcd_copy_buffer_rect(fb_data *dst, const fb_data *src, extern void lcd_copy_buffer_rect(fb_data *dst, const fb_data *src,
int width, int height); int width, int height);
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
bool lcd_active(void) bool lcd_active(void)
{ {
return lcd_on; return lcd_on;
} }
#endif
static unsigned int LCDBANK(unsigned int address) static unsigned int LCDBANK(unsigned int address)
{ {
@ -278,6 +280,7 @@ void lcd_init_device(void)
LCD_SPI_init(); LCD_SPI_init();
} }
#if defined(HAVE_LCD_SLEEP)
void lcd_sleep(void) void lcd_sleep(void)
{ {
if (lcd_powered) if (lcd_powered)
@ -289,7 +292,9 @@ void lcd_sleep(void)
LCD_SPI_powerdown(); LCD_SPI_powerdown();
} }
} }
#endif
#if defined(HAVE_LCD_ENABLE)
void lcd_enable(bool state) void lcd_enable(bool state)
{ {
if (state == lcd_on) if (state == lcd_on)
@ -315,6 +320,7 @@ void lcd_enable(bool state)
lcd_on = false; lcd_on = false;
} }
} }
#endif
void lcd_set_flip(bool yesno) { void lcd_set_flip(bool yesno) {
if (!lcd_on) if (!lcd_on)

View file

@ -190,6 +190,7 @@ void lcd_set_invert_display(bool yesno)
(void)yesno; (void)yesno;
} }
#if defined(HAVE_LCD_ENABLE)
void lcd_enable(bool yesno) void lcd_enable(bool yesno)
{ {
if (yesno == is_lcd_enabled) if (yesno == is_lcd_enabled)
@ -206,11 +207,14 @@ void lcd_enable(bool yesno)
lcd_send_command(R_STANDBY_ON); lcd_send_command(R_STANDBY_ON);
} }
} }
#endif
bool lcd_enabled(void) #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
bool lcd_active(void)
{ {
return is_lcd_enabled; return is_lcd_enabled;
} }
#endif
/* turn the display upside down (call lcd_update() afterwards) */ /* turn the display upside down (call lcd_update() afterwards) */

View file

@ -22,11 +22,11 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
****************************************************************************/ ****************************************************************************/
#include "lcd.h"
#include "system.h"
#include <string.h> #include <string.h>
#include "backlight-target.h"
#include "cpu.h" #include "cpu.h"
#include "system.h"
#include "backlight-target.h"
#include "lcd.h"
/* Power and display status */ /* Power and display status */
static bool power_on = false; /* Is the power turned on? */ static bool power_on = false; /* Is the power turned on? */
@ -427,7 +427,7 @@ void lcd_init_device(void)
LCD_REG_6 |= 1; /* Start DMA */ LCD_REG_6 |= 1; /* Start DMA */
} }
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
void lcd_enable(bool on) void lcd_enable(bool on)
{ {
if (on == display_on) if (on == display_on)
@ -455,7 +455,7 @@ bool lcd_active(void)
{ {
return display_on; return display_on;
} }
#endif
void lcd_sleep(void) void lcd_sleep(void)
{ {
LCD_REG_6 &= ~1; LCD_REG_6 &= ~1;

View file

@ -46,7 +46,7 @@ volatile bool lcd_poweroff = false;
extern unsigned fg_pattern; extern unsigned fg_pattern;
extern unsigned bg_pattern; extern unsigned bg_pattern;
bool lcd_enabled(void) bool lcd_active(void)
{ {
return lcd_on; return lcd_on;
} }

View file

@ -374,6 +374,7 @@ void lcd_init_device(void)
#endif #endif
} }
#if defined(HAVE_LCD_ENABLE)
void lcd_enable(bool on) void lcd_enable(bool on)
{ {
if (on == display_on) if (on == display_on)
@ -392,12 +393,10 @@ void lcd_enable(bool on)
lcd_display_off(); lcd_display_off();
} }
} }
#endif
bool lcd_active(void)
{
return display_on;
}
#if defined(HAVE_LCD_SLEEP)
void lcd_sleep(void) void lcd_sleep(void)
{ {
if (power_on) if (power_on)
@ -407,7 +406,14 @@ void lcd_sleep(void)
/* BT2-0=000, DC2-0=000, AP2-0=000, SLP=0, STB=1 */ /* BT2-0=000, DC2-0=000, AP2-0=000, SLP=0, STB=1 */
lcd_write_reg(R_POWER_CONTROL1, 0x0001); lcd_write_reg(R_POWER_CONTROL1, 0x0001);
} }
#endif
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
bool lcd_active(void)
{
return display_on;
}
#endif
/*** update functions ***/ /*** update functions ***/
/* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. /* Line write helper function for lcd_yuv_blit. Write two lines of yuv420.

View file

@ -24,7 +24,7 @@
#include <stdbool.h> #include <stdbool.h>
void lcd_enable(bool state); void lcd_enable(bool state);
bool lcd_enabled(void); bool lcd_active(void);
void lcd_init_device(void); void lcd_init_device(void);

View file

@ -202,7 +202,7 @@ bool headphones_inserted(void)
} }
#endif #endif
#ifdef HAVE_LCD_ENABLE #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
bool lcd_enabled(void) bool lcd_enabled(void)
{ {
return true; return true;