diff options
-rw-r--r-- | firmware/export/config-h300.h | 5 | ||||
-rw-r--r-- | firmware/export/config-ipodvideo.h | 7 | ||||
-rw-r--r-- | firmware/export/config-mrobe100.h | 17 | ||||
-rw-r--r-- | uisimulator/common/SOURCES | 1 | ||||
-rw-r--r-- | uisimulator/common/backlight-sim.c | 84 | ||||
-rw-r--r-- | uisimulator/common/backlight-sim.h | 54 | ||||
-rw-r--r-- | uisimulator/common/lcd-common.c | 55 | ||||
-rw-r--r-- | uisimulator/common/stubs.c | 13 | ||||
-rw-r--r-- | uisimulator/uisimulator.make | 2 |
9 files changed, 172 insertions, 66 deletions
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index ba09884957..e6e07e0bbc 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h | |||
@@ -76,6 +76,8 @@ | |||
76 | #define HAVE_BACKLIGHT_BRIGHTNESS | 76 | #define HAVE_BACKLIGHT_BRIGHTNESS |
77 | /* Which backlight fading type? */ | 77 | /* Which backlight fading type? */ |
78 | #define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_HW_REG | 78 | #define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_HW_REG |
79 | /* Define this if your LCD can be enabled/disabled */ | ||
80 | #define HAVE_LCD_ENABLE | ||
79 | 81 | ||
80 | /* Define this if you have a software controlled poweroff */ | 82 | /* Define this if you have a software controlled poweroff */ |
81 | #define HAVE_SW_POWEROFF | 83 | #define HAVE_SW_POWEROFF |
@@ -133,9 +135,6 @@ | |||
133 | 135 | ||
134 | #ifndef SIMULATOR | 136 | #ifndef SIMULATOR |
135 | 137 | ||
136 | /* Define this if your LCD can be enabled/disabled */ | ||
137 | #define HAVE_LCD_ENABLE | ||
138 | |||
139 | /* Define this if you have a Motorola SCF5249 */ | 138 | /* Define this if you have a Motorola SCF5249 */ |
140 | #define CONFIG_CPU MCF5249 | 139 | #define CONFIG_CPU MCF5249 |
141 | 140 | ||
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h index c9f97dcea5..6adcda9a1e 100644 --- a/firmware/export/config-ipodvideo.h +++ b/firmware/export/config-ipodvideo.h | |||
@@ -91,6 +91,10 @@ | |||
91 | #define HAVE_BACKLIGHT | 91 | #define HAVE_BACKLIGHT |
92 | #define HAVE_BACKLIGHT_BRIGHTNESS | 92 | #define HAVE_BACKLIGHT_BRIGHTNESS |
93 | 93 | ||
94 | /* Support for LCD sleep/BCM shutdown */ | ||
95 | #define HAVE_LCD_SLEEP | ||
96 | #define HAVE_LCD_SLEEP_SETTING | ||
97 | |||
94 | /* We can fade the backlight by using PWM */ | 98 | /* We can fade the backlight by using PWM */ |
95 | #define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_PWM | 99 | #define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_PWM |
96 | 100 | ||
@@ -208,9 +212,6 @@ | |||
208 | #define HAVE_SERIAL | 212 | #define HAVE_SERIAL |
209 | 213 | ||
210 | #ifndef BOOTLOADER | 214 | #ifndef BOOTLOADER |
211 | /* Support for LCD sleep/BCM shutdown */ | ||
212 | #define HAVE_LCD_SLEEP | ||
213 | #define HAVE_LCD_SLEEP_SETTING | ||
214 | /* The same code may also be used when shutting down the iPod */ | 215 | /* The same code may also be used when shutting down the iPod */ |
215 | #define HAVE_LCD_SHUTDOWN | 216 | #define HAVE_LCD_SHUTDOWN |
216 | #endif | 217 | #endif |
diff --git a/firmware/export/config-mrobe100.h b/firmware/export/config-mrobe100.h index e440f7c9a0..b1299a820a 100644 --- a/firmware/export/config-mrobe100.h +++ b/firmware/export/config-mrobe100.h | |||
@@ -90,6 +90,15 @@ | |||
90 | 90 | ||
91 | #define HAVE_BUTTONLIGHT_BRIGHTNESS | 91 | #define HAVE_BUTTONLIGHT_BRIGHTNESS |
92 | 92 | ||
93 | /* Define this if your LCD can be enabled/disabled */ | ||
94 | /* TODO: #define HAVE_LCD_ENABLE */ | ||
95 | |||
96 | /* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE | ||
97 | * should be defined as well. | ||
98 | * We can currently put the lcd to sleep but it won't wake up properly */ | ||
99 | /*TODO: #define HAVE_LCD_SLEEP*/ | ||
100 | /*TODO: #define HAVE_LCD_SLEEP_SETTING <= optional */ | ||
101 | |||
93 | #define BATTERY_CAPACITY_DEFAULT 720 /* default battery capacity */ | 102 | #define BATTERY_CAPACITY_DEFAULT 720 /* default battery capacity */ |
94 | 103 | ||
95 | #ifndef SIMULATOR | 104 | #ifndef SIMULATOR |
@@ -132,14 +141,6 @@ | |||
132 | #define MAX_CONTRAST_SETTING 40 | 141 | #define MAX_CONTRAST_SETTING 40 |
133 | #define DEFAULT_CONTRAST_SETTING 20 | 142 | #define DEFAULT_CONTRAST_SETTING 20 |
134 | 143 | ||
135 | /* Define this if your LCD can be enabled/disabled */ | ||
136 | /* TODO: #define HAVE_LCD_ENABLE */ | ||
137 | |||
138 | /* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE | ||
139 | * should be defined as well. | ||
140 | * We can currently put the lcd to sleep but it won't wake up properly */ | ||
141 | /*TODO: #define HAVE_LCD_SLEEP*/ | ||
142 | /*TODO: #define HAVE_LCD_SLEEP_SETTING <= optional */ | ||
143 | 144 | ||
144 | /* We're able to shut off power to the HDD */ | 145 | /* We're able to shut off power to the HDD */ |
145 | #define HAVE_ATA_POWER_OFF | 146 | #define HAVE_ATA_POWER_OFF |
diff --git a/uisimulator/common/SOURCES b/uisimulator/common/SOURCES index bda79b66b9..c1865513f9 100644 --- a/uisimulator/common/SOURCES +++ b/uisimulator/common/SOURCES | |||
@@ -9,4 +9,5 @@ sim_icons.c | |||
9 | sim_tasks.c | 9 | sim_tasks.c |
10 | stubs.c | 10 | stubs.c |
11 | powermgmt-sim.c | 11 | powermgmt-sim.c |
12 | backlight-sim.c | ||
12 | 13 | ||
diff --git a/uisimulator/common/backlight-sim.c b/uisimulator/common/backlight-sim.c new file mode 100644 index 0000000000..ec50249dde --- /dev/null +++ b/uisimulator/common/backlight-sim.c | |||
@@ -0,0 +1,84 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Thomas Martitz | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include <stdbool.h> | ||
23 | #include "config.h" | ||
24 | #include "backlight.h" | ||
25 | #include "lcd.h" | ||
26 | |||
27 | #ifdef HAVE_LCD_SLEEP | ||
28 | extern void lcd_awake(void); | ||
29 | #endif | ||
30 | /* in uisimulator/sdl/lcd-bitmap.c and lcd-charcell.c */ | ||
31 | extern void sim_backlight(int value); | ||
32 | |||
33 | void _backlight_on(void) | ||
34 | { | ||
35 | sim_backlight(100); | ||
36 | #if defined(HAVE_LCD_ENABLE) | ||
37 | lcd_enable(true); | ||
38 | #elif defined(HAVE_LCD_SLEEP) | ||
39 | lcd_awake(); | ||
40 | #endif | ||
41 | } | ||
42 | |||
43 | void _backlight_off(void) | ||
44 | { | ||
45 | sim_backlight(0); | ||
46 | #ifdef HAVE_LCD_ENABLE | ||
47 | lcd_enable(false); | ||
48 | #endif | ||
49 | } | ||
50 | |||
51 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | ||
52 | void _backlight_set_brightness(int val) | ||
53 | { | ||
54 | (void)val; | ||
55 | } | ||
56 | #endif /* HAVE_BACKLIGHT_BRIGHTNESS */ | ||
57 | #ifdef HAVE_BUTTON_LIGHT | ||
58 | void _buttonlight_on(void) | ||
59 | { | ||
60 | } | ||
61 | |||
62 | void _buttonlight_off(void) | ||
63 | { | ||
64 | } | ||
65 | |||
66 | #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS | ||
67 | void _buttonlight_set_brightness(int val) | ||
68 | { | ||
69 | (void)val; | ||
70 | } | ||
71 | #endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */ | ||
72 | #endif /* HAVE_BUTTON_LIGHT */ | ||
73 | |||
74 | #ifdef HAVE_REMOTE_LCD | ||
75 | void _remote_backlight_on(void) | ||
76 | { | ||
77 | sim_remote_backlight(100); | ||
78 | } | ||
79 | |||
80 | void _remote_backlight_off(void) | ||
81 | { | ||
82 | sim_remote_backlight(0); | ||
83 | } | ||
84 | #endif /* HAVE_REMOTE_LCD */ | ||
diff --git a/uisimulator/common/backlight-sim.h b/uisimulator/common/backlight-sim.h index 59abe36f7d..366ebf8096 100644 --- a/uisimulator/common/backlight-sim.h +++ b/uisimulator/common/backlight-sim.h | |||
@@ -5,9 +5,8 @@ | |||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id:$ |
9 | * | 9 | * |
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | ||
11 | * Copyright (C) 2009 by Thomas Martitz | 10 | * Copyright (C) 2009 by Thomas Martitz |
12 | * | 11 | * |
13 | * This program is free software; you can redistribute it and/or | 12 | * This program is free software; you can redistribute it and/or |
@@ -19,50 +18,31 @@ | |||
19 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
20 | * | 19 | * |
21 | ****************************************************************************/ | 20 | ****************************************************************************/ |
22 | #ifdef SIMULATOR | ||
23 | 21 | ||
24 | static inline void _backlight_on(void) | 22 | #ifndef BACKLIGHT_SIM_H |
25 | { | 23 | #define BACKLIGHT_SIM_H |
26 | sim_backlight(100); | 24 | |
27 | } | 25 | #include "config.h" |
26 | |||
27 | void _backlight_on(void); | ||
28 | void _backlight_off(void); | ||
28 | 29 | ||
29 | static inline void _backlight_off(void) | ||
30 | { | ||
31 | sim_backlight(0); | ||
32 | } | ||
33 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | 30 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS |
34 | static inline void _backlight_set_brightness(int val) | 31 | void _backlight_set_brightness(int val); |
35 | { | ||
36 | (void)val; | ||
37 | } | ||
38 | #endif /* HAVE_BACKLIGHT_BRIGHTNESS */ | 32 | #endif /* HAVE_BACKLIGHT_BRIGHTNESS */ |
39 | #ifdef HAVE_BUTTON_LIGHT | 33 | #ifdef HAVE_BUTTON_LIGHT |
40 | static inline void _buttonlight_on(void) | 34 | void _buttonlight_on(void); |
41 | { | 35 | void _buttonlight_off(void); |
42 | } | ||
43 | |||
44 | static inline void _buttonlight_off(void) | ||
45 | { | ||
46 | } | ||
47 | |||
48 | #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS | 36 | #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS |
49 | static inline void _buttonlight_set_brightness(int val) | 37 | void _buttonlight_set_brightness(int val); |
50 | { | ||
51 | (void)val; | ||
52 | } | ||
53 | #endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */ | 38 | #endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */ |
54 | #endif /* HAVE_BUTTON_LIGHT */ | 39 | #endif /* HAVE_BUTTON_LIGHT */ |
55 | 40 | ||
56 | #ifdef HAVE_REMOTE_LCD | 41 | #ifdef HAVE_REMOTE_LCD |
57 | static inline void _remote_backlight_on(void) | 42 | void _remote_backlight_on(void); |
58 | { | 43 | void _remote_backlight_off(void); |
59 | sim_remote_backlight(100); | ||
60 | } | ||
61 | |||
62 | static inline void _remote_backlight_off(void) | ||
63 | { | ||
64 | sim_remote_backlight(0); | ||
65 | } | ||
66 | #endif /* HAVE_REMOTE_LCD */ | 44 | #endif /* HAVE_REMOTE_LCD */ |
67 | 45 | ||
68 | #endif /* SIMULATOR */ | 46 | |
47 | #endif /* BACKLIGHT_SIM_H */ | ||
48 | |||
diff --git a/uisimulator/common/lcd-common.c b/uisimulator/common/lcd-common.c index 7d40f36b0f..52db776856 100644 --- a/uisimulator/common/lcd-common.c +++ b/uisimulator/common/lcd-common.c | |||
@@ -22,8 +22,15 @@ | |||
22 | * | 22 | * |
23 | ****************************************************************************/ | 23 | ****************************************************************************/ |
24 | 24 | ||
25 | #include "config.h" | ||
25 | #include "lcd.h" | 26 | #include "lcd.h" |
26 | #include "lcd-sdl.h" | 27 | |
28 | #ifdef HAVE_LCD_ENABLE | ||
29 | static bool lcd_enabled = false; | ||
30 | #endif | ||
31 | #ifdef HAVE_LCD_SLEEP | ||
32 | static bool lcd_sleeping = true; | ||
33 | #endif | ||
27 | 34 | ||
28 | void lcd_set_flip(bool yesno) | 35 | void lcd_set_flip(bool yesno) |
29 | { | 36 | { |
@@ -64,3 +71,49 @@ void lcd_remote_set_invert_display(bool invert) | |||
64 | (void)invert; | 71 | (void)invert; |
65 | } | 72 | } |
66 | #endif | 73 | #endif |
74 | |||
75 | #ifdef HAVE_LCD_SLEEP | ||
76 | void lcd_sleep(void) | ||
77 | { | ||
78 | lcd_sleeping = true; | ||
79 | } | ||
80 | |||
81 | void lcd_awake(void) | ||
82 | { | ||
83 | if (lcd_sleeping) | ||
84 | { | ||
85 | lcd_activation_call_hook(); | ||
86 | lcd_sleeping = false; | ||
87 | } | ||
88 | } | ||
89 | #endif | ||
90 | #ifdef HAVE_LCD_ENABLE | ||
91 | void lcd_enable(bool on) | ||
92 | { | ||
93 | if (on && !lcd_enabled) | ||
94 | { | ||
95 | #ifdef HAVE_LCD_SLEEP | ||
96 | /* lcd_awake will handle the activation call */ | ||
97 | lcd_awake(); | ||
98 | #else | ||
99 | lcd_activation_call_hook(); | ||
100 | #endif | ||
101 | } | ||
102 | lcd_enabled = on; | ||
103 | } | ||
104 | #endif | ||
105 | |||
106 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | ||
107 | bool lcd_active(void) | ||
108 | { | ||
109 | bool retval = false; | ||
110 | #ifdef HAVE_LCD_ENABLE | ||
111 | retval = lcd_enabled; | ||
112 | #endif | ||
113 | #ifdef HAVE_LCD_SLEEP | ||
114 | if (!retval) | ||
115 | retval = !lcd_sleeping; | ||
116 | #endif | ||
117 | return retval; | ||
118 | } | ||
119 | #endif | ||
diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c index 5d3c54a8d0..1d0d6c51d8 100644 --- a/uisimulator/common/stubs.c +++ b/uisimulator/common/stubs.c | |||
@@ -202,19 +202,6 @@ bool headphones_inserted(void) | |||
202 | } | 202 | } |
203 | #endif | 203 | #endif |
204 | 204 | ||
205 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | ||
206 | bool lcd_active(void) | ||
207 | { | ||
208 | return true; | ||
209 | } | ||
210 | #endif | ||
211 | |||
212 | #ifdef HAVE_LCD_SLEEP | ||
213 | void lcd_sleep(void) | ||
214 | { | ||
215 | } | ||
216 | #endif | ||
217 | |||
218 | #ifdef HAVE_SPDIF_POWER | 205 | #ifdef HAVE_SPDIF_POWER |
219 | void spdif_power_enable(bool on) | 206 | void spdif_power_enable(bool on) |
220 | { | 207 | { |
diff --git a/uisimulator/uisimulator.make b/uisimulator/uisimulator.make index f39d6e0265..9aeb02cd3d 100644 --- a/uisimulator/uisimulator.make +++ b/uisimulator/uisimulator.make | |||
@@ -28,7 +28,7 @@ $(SIMLIB): $$(SIMOBJ) $(UIBMP) | |||
28 | $(SILENT)$(shell rm -f $@) | 28 | $(SILENT)$(shell rm -f $@) |
29 | $(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null | 29 | $(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null |
30 | 30 | ||
31 | $(BUILDDIR)/$(BINARY): $$(OBJ) $(SIMLIB) $(VOICESPEEXLIB) $(FIRMLIB) | 31 | $(BUILDDIR)/$(BINARY): $$(OBJ) $(FIRMLIB) $(SIMLIB) $(VOICESPEEXLIB) |
32 | $(call PRINTS,LD $(BINARY))$(CC) -o $@ $^ $(LDOPTS) | 32 | $(call PRINTS,LD $(BINARY))$(CC) -o $@ $^ $(LDOPTS) |
33 | 33 | ||
34 | $(BUILDDIR)/uisimulator/%.o: $(ROOTDIR)/uisimulator/%.c | 34 | $(BUILDDIR)/uisimulator/%.o: $(ROOTDIR)/uisimulator/%.c |