summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-07-31 12:43:06 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-07-31 12:43:06 +0000
commit60b01fa0f7e5126406d1fd2f37cce82d2faffdc4 (patch)
treeb3cea13c807d90e3c522bc60e249806f9b5cc15b
parente95d7a0e76261f936b0eee64dfa0c6090bfb1b8c (diff)
downloadrockbox-60b01fa0f7e5126406d1fd2f37cce82d2faffdc4.tar.gz
rockbox-60b01fa0f7e5126406d1fd2f37cce82d2faffdc4.zip
Straignten out some issues with HAVE_LCD_ENABLE. 1g/2g/3g had it defined but it shouldn't have been. lcd_enabled() was only available as a real function on gigabeat but others can use that too. Markup lcd.h a bit because I got a bit lost in it.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14100 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/export/config-gigabeat.h5
-rw-r--r--firmware/export/config-ipod1g2g.h3
-rw-r--r--firmware/export/config-ipod3g.h3
-rw-r--r--firmware/export/lcd.h46
-rw-r--r--firmware/target/arm/iriver/h10/lcd-h10_20gb.c5
-rw-r--r--firmware/target/arm/sandisk/sansa-e200/lcd-e200.c5
-rw-r--r--firmware/target/coldfire/iaudio/x5/lcd-x5.c5
-rw-r--r--firmware/target/coldfire/iriver/h300/lcd-h300.c5
8 files changed, 46 insertions, 31 deletions
diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h
index 241a3919d1..38be0d078f 100644
--- a/firmware/export/config-gigabeat.h
+++ b/firmware/export/config-gigabeat.h
@@ -45,8 +45,6 @@
45 45
46#define HAVE_BUTTON_LIGHT 46#define HAVE_BUTTON_LIGHT
47 47
48#define HAVE_LCD_ENABLE
49
50#define HAVE_BACKLIGHT_BRIGHTNESS 48#define HAVE_BACKLIGHT_BRIGHTNESS
51 49
52#define HAVE_BUTTONLIGHT_BRIGHTNESS 50#define HAVE_BUTTONLIGHT_BRIGHTNESS
@@ -80,6 +78,9 @@
80 78
81#ifndef SIMULATOR 79#ifndef SIMULATOR
82 80
81/* Define this if your LCD can be enabled/disabled */
82#define HAVE_LCD_ENABLE
83
83/* The LCD on a Gigabeat is 240x320 - it is portrait */ 84/* The LCD on a Gigabeat is 240x320 - it is portrait */
84#define HAVE_PORTRAIT_LCD 85#define HAVE_PORTRAIT_LCD
85 86
diff --git a/firmware/export/config-ipod1g2g.h b/firmware/export/config-ipod1g2g.h
index 188c3930f6..0eb3614dd6 100644
--- a/firmware/export/config-ipod1g2g.h
+++ b/firmware/export/config-ipod1g2g.h
@@ -70,9 +70,6 @@
70 70
71#ifndef SIMULATOR 71#ifndef SIMULATOR
72 72
73/* Define this if your LCD can be enabled/disabled */
74#define HAVE_LCD_ENABLE
75
76/* Define this if you have a PortalPlayer PP5002 */ 73/* Define this if you have a PortalPlayer PP5002 */
77#define CONFIG_CPU PP5002 74#define CONFIG_CPU PP5002
78 75
diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h
index ff91bcff49..c3e63e87e3 100644
--- a/firmware/export/config-ipod3g.h
+++ b/firmware/export/config-ipod3g.h
@@ -70,9 +70,6 @@
70 70
71#ifndef SIMULATOR 71#ifndef SIMULATOR
72 72
73/* Define this if your LCD can be enabled/disabled */
74#define HAVE_LCD_ENABLE
75
76/* Define this if you have a PortalPlayer PP5002 */ 73/* Define this if you have a PortalPlayer PP5002 */
77#define CONFIG_CPU PP5002 74#define CONFIG_CPU PP5002
78 75
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index 25ff934ea7..49256ff50f 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -35,15 +35,15 @@
35#endif 35#endif
36#else 36#else
37#include "file.h" /* for MAX_PATH; FIXME: Why does this not work for sims? */ 37#include "file.h" /* for MAX_PATH; FIXME: Why does this not work for sims? */
38#endif 38#endif /* SIMULATOR */
39 39
40#if LCD_DEPTH <=8 40#if LCD_DEPTH <=8
41typedef unsigned char fb_data; 41typedef unsigned char fb_data;
42#elif LCD_DEPTH <= 16 42#elif LCD_DEPTH <= 16
43typedef unsigned short fb_data; 43typedef unsigned short fb_data;
44#else 44#else /* LCD_DEPTH > 16 */
45typedef unsigned long fb_data; 45typedef unsigned long fb_data;
46#endif 46#endif /* LCD_DEPTH */
47 47
48/* common functions */ 48/* common functions */
49extern void lcd_write_command(int byte); 49extern void lcd_write_command(int byte);
@@ -51,12 +51,14 @@ extern void lcd_write_command_e(int cmd, int data);
51extern void lcd_write_command_ex(int cmd, int data1, int data2); 51extern void lcd_write_command_ex(int cmd, int data1, int data2);
52extern void lcd_write_data(const fb_data* p_bytes, int count); 52extern void lcd_write_data(const fb_data* p_bytes, int count);
53extern void lcd_init(void); 53extern void lcd_init(void);
54
54#ifdef SIMULATOR 55#ifdef SIMULATOR
55/* Define a dummy device specific init for the sims */ 56/* Define a dummy device specific init for the sims */
56#define lcd_init_device() 57#define lcd_init_device()
57#else 58#else
58extern void lcd_init_device(void); 59extern void lcd_init_device(void);
59#endif 60#endif /* SIMULATOR */
61
60extern void lcd_backlight(bool on); 62extern void lcd_backlight(bool on);
61extern int lcd_default_contrast(void); 63extern int lcd_default_contrast(void);
62extern void lcd_set_contrast(int val); 64extern void lcd_set_contrast(int val);
@@ -100,8 +102,8 @@ extern void lcd_update_rect(int x, int y, int width, int height);
100extern void lcd_remote_update(void); 102extern void lcd_remote_update(void);
101/* update a fraction of the screen */ 103/* update a fraction of the screen */
102extern void lcd_remote_update_rect(int x, int y, int width, int height); 104extern void lcd_remote_update_rect(int x, int y, int width, int height);
103#endif 105#endif /* HAVE_REMOTE_LCD */
104#endif 106#endif /* HAVE_LCD_BITMAP */
105 107
106#ifdef HAVE_LCD_CHARCELLS 108#ifdef HAVE_LCD_CHARCELLS
107 109
@@ -138,7 +140,7 @@ void lcd_remove_cursor(void);
138#define JUMP_SCROLL_ALWAYS 5 140#define JUMP_SCROLL_ALWAYS 5
139extern void lcd_jump_scroll(int mode); /* 0=off, 1=once, ..., ALWAYS */ 141extern void lcd_jump_scroll(int mode); /* 0=off, 1=once, ..., ALWAYS */
140extern void lcd_jump_scroll_delay(int ms); 142extern void lcd_jump_scroll_delay(int ms);
141#endif 143#endif /* HAVE_LCD_CHARCELLS */
142 144
143/* Draw modes */ 145/* Draw modes */
144#define DRMODE_COMPLEMENT 0 146#define DRMODE_COMPLEMENT 0
@@ -207,7 +209,7 @@ static inline unsigned lcd_color_to_native(unsigned color)
207#define RGB_UNPACK_RED_LCD(x) _SWAPUNPACK((x), _RGB_UNPACK_RED_LCD) 209#define RGB_UNPACK_RED_LCD(x) _SWAPUNPACK((x), _RGB_UNPACK_RED_LCD)
208#define RGB_UNPACK_GREEN_LCD(x) _SWAPUNPACK((x), _RGB_UNPACK_GREEN_LCD) 210#define RGB_UNPACK_GREEN_LCD(x) _SWAPUNPACK((x), _RGB_UNPACK_GREEN_LCD)
209#define RGB_UNPACK_BLUE_LCD(x) _SWAPUNPACK((x), _RGB_UNPACK_BLUE_LCD) 211#define RGB_UNPACK_BLUE_LCD(x) _SWAPUNPACK((x), _RGB_UNPACK_BLUE_LCD)
210#else 212#else /* LCD_PIXELFORMAT == RGB565 */
211/* RGB565 */ 213/* RGB565 */
212#define _LCD_UNSWAP_COLOR(x) (x) 214#define _LCD_UNSWAP_COLOR(x) (x)
213#define LCD_RGBPACK(r, g, b) _RGBPACK((r), (g), (b)) 215#define LCD_RGBPACK(r, g, b) _RGBPACK((r), (g), (b))
@@ -218,7 +220,7 @@ static inline unsigned lcd_color_to_native(unsigned color)
218#define RGB_UNPACK_RED_LCD(x) _RGB_UNPACK_RED_LCD(x) 220#define RGB_UNPACK_RED_LCD(x) _RGB_UNPACK_RED_LCD(x)
219#define RGB_UNPACK_GREEN_LCD(x) _RGB_UNPACK_GREEN_LCD(x) 221#define RGB_UNPACK_GREEN_LCD(x) _RGB_UNPACK_GREEN_LCD(x)
220#define RGB_UNPACK_BLUE_LCD(x) _RGB_UNPACK_BLUE_LCD(x) 222#define RGB_UNPACK_BLUE_LCD(x) _RGB_UNPACK_BLUE_LCD(x)
221#endif 223#endif /* RGB565* */
222#else 224#else
223/* other colour depths */ 225/* other colour depths */
224#endif 226#endif
@@ -231,6 +233,7 @@ static inline unsigned lcd_color_to_native(unsigned color)
231#define LCD_DEFAULT_BG LCD_RGBPACK(182, 198, 229) /* rockbox blue */ 233#define LCD_DEFAULT_BG LCD_RGBPACK(182, 198, 229) /* rockbox blue */
232 234
233#elif LCD_DEPTH > 1 /* greyscale */ 235#elif LCD_DEPTH > 1 /* greyscale */
236
234#define LCD_MAX_LEVEL ((1 << LCD_DEPTH) - 1) 237#define LCD_MAX_LEVEL ((1 << LCD_DEPTH) - 1)
235#define LCD_BRIGHTNESS(y) (((y) * LCD_MAX_LEVEL + 127) / 255) 238#define LCD_BRIGHTNESS(y) (((y) * LCD_MAX_LEVEL + 127) / 255)
236 239
@@ -240,7 +243,8 @@ static inline unsigned lcd_color_to_native(unsigned color)
240#define LCD_WHITE LCD_BRIGHTNESS(255) 243#define LCD_WHITE LCD_BRIGHTNESS(255)
241#define LCD_DEFAULT_FG LCD_BLACK 244#define LCD_DEFAULT_FG LCD_BLACK
242#define LCD_DEFAULT_BG LCD_WHITE 245#define LCD_DEFAULT_BG LCD_WHITE
243#endif 246
247#endif /* HAVE_LCD_COLOR */
244 248
245/* Frame buffer dimensions */ 249/* Frame buffer dimensions */
246#if LCD_DEPTH == 1 250#if LCD_DEPTH == 1
@@ -248,13 +252,13 @@ static inline unsigned lcd_color_to_native(unsigned color)
248#define LCD_FBWIDTH ((LCD_WIDTH+7)/8) 252#define LCD_FBWIDTH ((LCD_WIDTH+7)/8)
249#else /* LCD_PIXELFORMAT == VERTICAL_PACKING */ 253#else /* LCD_PIXELFORMAT == VERTICAL_PACKING */
250#define LCD_FBHEIGHT ((LCD_HEIGHT+7)/8) 254#define LCD_FBHEIGHT ((LCD_HEIGHT+7)/8)
251#endif 255#endif /* LCD_PIXELFORMAT */
252#elif LCD_DEPTH == 2 256#elif LCD_DEPTH == 2
253#if LCD_PIXELFORMAT == HORIZONTAL_PACKING 257#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
254#define LCD_FBWIDTH ((LCD_WIDTH+3)/4) 258#define LCD_FBWIDTH ((LCD_WIDTH+3)/4)
255#else /* LCD_PIXELFORMAT == VERTICAL_PACKING */ 259#else /* LCD_PIXELFORMAT == VERTICAL_PACKING */
256#define LCD_FBHEIGHT ((LCD_HEIGHT+3)/4) 260#define LCD_FBHEIGHT ((LCD_HEIGHT+3)/4)
257#endif 261#endif /* LCD_PIXELFORMAT */
258#endif /* LCD_DEPTH */ 262#endif /* LCD_DEPTH */
259/* Set defaults if not defined different yet. The defaults apply to both 263/* Set defaults if not defined different yet. The defaults apply to both
260 * dimensions for LCD_DEPTH >= 8 */ 264 * dimensions for LCD_DEPTH >= 8 */
@@ -271,12 +275,13 @@ extern fb_data lcd_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH];
271#ifdef HAVE_LCD_ENABLE 275#ifdef HAVE_LCD_ENABLE
272/* Enable/disable the main display. */ 276/* Enable/disable the main display. */
273extern void lcd_enable(bool on); 277extern void lcd_enable(bool on);
274#endif 278extern bool lcd_enabled(void);
279#endif /* HAVE_LCD_ENABLE */
275 280
276#ifdef HAVE_LCD_SLEEP 281#ifdef HAVE_LCD_SLEEP
277/* Put the LCD into a power saving state deeper than lcd_enable(false). */ 282/* Put the LCD into a power saving state deeper than lcd_enable(false). */
278extern void lcd_sleep(void); 283extern void lcd_sleep(void);
279#endif 284#endif /* HAVE_LCD_SLEEP */
280 285
281/* Bitmap formats */ 286/* Bitmap formats */
282enum 287enum
@@ -306,7 +311,7 @@ struct bitmap {
306extern void lcd_set_invert_display(bool yesno); 311extern void lcd_set_invert_display(bool yesno);
307#ifdef HAVE_BACKLIGHT_INVERSION 312#ifdef HAVE_BACKLIGHT_INVERSION
308extern void lcd_set_backlight_inversion(bool yesno); 313extern void lcd_set_backlight_inversion(bool yesno);
309#endif 314#endif /* HAVE_BACKLIGHT_INVERSION */
310extern void lcd_set_flip(bool yesno); 315extern void lcd_set_flip(bool yesno);
311 316
312extern void lcd_set_drawmode(int mode); 317extern void lcd_set_drawmode(int mode);
@@ -324,10 +329,10 @@ extern lcd_fastpixelfunc_type* const *lcd_fastpixelfuncs;
324#elif LCD_DEPTH > 1 329#elif LCD_DEPTH > 1
325extern lcd_pixelfunc_type* const *lcd_pixelfuncs; 330extern lcd_pixelfunc_type* const *lcd_pixelfuncs;
326extern lcd_blockfunc_type* const *lcd_blockfuncs; 331extern lcd_blockfunc_type* const *lcd_blockfuncs;
327#else 332#else /* LCD_DEPTH == 1*/
328extern lcd_pixelfunc_type* const lcd_pixelfuncs[8]; 333extern lcd_pixelfunc_type* const lcd_pixelfuncs[8];
329extern lcd_blockfunc_type* const lcd_blockfuncs[8]; 334extern lcd_blockfunc_type* const lcd_blockfuncs[8];
330#endif 335#endif /* LCD_DEPTH */
331 336
332extern void lcd_drawpixel(int x, int y); 337extern void lcd_drawpixel(int x, int y);
333extern void lcd_drawline(int x1, int y1, int x2, int y2); 338extern void lcd_drawline(int x1, int y1, int x2, int y2);
@@ -351,11 +356,6 @@ extern unsigned lcd_get_background(void);
351extern void lcd_set_drawinfo(int mode, unsigned foreground, 356extern void lcd_set_drawinfo(int mode, unsigned foreground,
352 unsigned background); 357 unsigned background);
353void lcd_set_backdrop(fb_data* backdrop); 358void lcd_set_backdrop(fb_data* backdrop);
354#if defined(TOSHIBA_GIGABEAT_F) && !defined(SIMULATOR)
355bool lcd_enabled(void);
356#else
357#define lcd_enabled() true
358#endif
359 359
360fb_data* lcd_get_backdrop(void); 360fb_data* lcd_get_backdrop(void);
361 361
@@ -372,7 +372,7 @@ extern void lcd_bitmap_transparent(const fb_data *src, int x, int y,
372#else /* LCD_DEPTH == 1 */ 372#else /* LCD_DEPTH == 1 */
373#define lcd_mono_bitmap lcd_bitmap 373#define lcd_mono_bitmap lcd_bitmap
374#define lcd_mono_bitmap_part lcd_bitmap_part 374#define lcd_mono_bitmap_part lcd_bitmap_part
375#endif 375#endif /* LCD_DEPTH */
376 376
377#endif /* HAVE_LCD_BITMAP */ 377#endif /* HAVE_LCD_BITMAP */
378 378
diff --git a/firmware/target/arm/iriver/h10/lcd-h10_20gb.c b/firmware/target/arm/iriver/h10/lcd-h10_20gb.c
index 5ef18b41ad..f6ea87c1d0 100644
--- a/firmware/target/arm/iriver/h10/lcd-h10_20gb.c
+++ b/firmware/target/arm/iriver/h10/lcd-h10_20gb.c
@@ -379,6 +379,11 @@ void lcd_enable(bool on)
379 } 379 }
380} 380}
381 381
382bool lcd_enabled(void)
383{
384 return display_on;
385}
386
382void lcd_sleep(void) 387void lcd_sleep(void)
383{ 388{
384 if (power_on) 389 if (power_on)
diff --git a/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c b/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c
index 67bca23981..ba194f3272 100644
--- a/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c
+++ b/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c
@@ -459,6 +459,11 @@ void lcd_enable(bool on)
459 } 459 }
460} 460}
461 461
462bool lcd_enabled(void)
463{
464 return display_on;
465}
466
462void lcd_sleep(void) 467void lcd_sleep(void)
463{ 468{
464 LCD_REG_6 &= ~1; 469 LCD_REG_6 &= ~1;
diff --git a/firmware/target/coldfire/iaudio/x5/lcd-x5.c b/firmware/target/coldfire/iaudio/x5/lcd-x5.c
index 92b9fde2e2..2cc5b5ba65 100644
--- a/firmware/target/coldfire/iaudio/x5/lcd-x5.c
+++ b/firmware/target/coldfire/iaudio/x5/lcd-x5.c
@@ -399,6 +399,11 @@ void lcd_enable(bool on)
399 } 399 }
400} 400}
401 401
402bool lcd_enabled(void)
403{
404 return display_on;
405}
406
402void lcd_sleep(void) 407void lcd_sleep(void)
403{ 408{
404 if (power_on) 409 if (power_on)
diff --git a/firmware/target/coldfire/iriver/h300/lcd-h300.c b/firmware/target/coldfire/iriver/h300/lcd-h300.c
index 3e5642e35d..8f76d5255a 100644
--- a/firmware/target/coldfire/iriver/h300/lcd-h300.c
+++ b/firmware/target/coldfire/iriver/h300/lcd-h300.c
@@ -284,6 +284,11 @@ void lcd_enable(bool on)
284 } 284 }
285} 285}
286 286
287bool lcd_enabled(void)
288{
289 return display_on;
290}
291
287/*** update functions ***/ 292/*** update functions ***/
288 293
289/* Performance function that works with an external buffer 294/* Performance function that works with an external buffer