diff options
Diffstat (limited to 'firmware/target/arm/philips')
-rw-r--r-- | firmware/target/arm/philips/hdd1630/adc-target.h | 39 | ||||
-rwxr-xr-x | firmware/target/arm/philips/hdd1630/backlight-hdd1630.c | 49 | ||||
-rwxr-xr-x | firmware/target/arm/philips/hdd1630/backlight-target.h | 36 | ||||
-rwxr-xr-x | firmware/target/arm/philips/hdd1630/button-hdd1630.c | 65 | ||||
-rwxr-xr-x | firmware/target/arm/philips/hdd1630/button-target.h | 53 | ||||
-rwxr-xr-x | firmware/target/arm/philips/hdd1630/lcd-hdd1630.c | 266 | ||||
-rwxr-xr-x | firmware/target/arm/philips/hdd1630/power-hdd1630.c | 58 | ||||
-rw-r--r-- | firmware/target/arm/philips/hdd1630/powermgmt-hdd1630.c | 62 |
8 files changed, 628 insertions, 0 deletions
diff --git a/firmware/target/arm/philips/hdd1630/adc-target.h b/firmware/target/arm/philips/hdd1630/adc-target.h new file mode 100644 index 0000000000..95b911783b --- /dev/null +++ b/firmware/target/arm/philips/hdd1630/adc-target.h | |||
@@ -0,0 +1,39 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef _ADC_TARGET_H_ | ||
20 | #define _ADC_TARGET_H_ | ||
21 | |||
22 | #define ADC_ADDR (*(volatile unsigned long*)(0x7000ad00)) | ||
23 | #define ADC_STATUS (*(volatile unsigned long*)(0x7000ad04)) | ||
24 | #define ADC_DATA_1 (*(volatile unsigned long*)(0x7000ad20)) | ||
25 | #define ADC_DATA_2 (*(volatile unsigned long*)(0x7000ad24)) | ||
26 | #define ADC_INIT (*(volatile unsigned long*)(0x7000ad2c)) | ||
27 | |||
28 | #define NUM_ADC_CHANNELS 4 | ||
29 | |||
30 | #define ADC_BATTERY 0 | ||
31 | #define ADC_UNKNOWN_1 1 | ||
32 | #define ADC_UNKNOWN_2 2 | ||
33 | #define ADC_UNKNOWN_3 3 | ||
34 | #define ADC_UNREG_POWER ADC_BATTERY /* For compatibility */ | ||
35 | |||
36 | /* Force a scan now */ | ||
37 | unsigned short adc_scan(int channel); | ||
38 | |||
39 | #endif | ||
diff --git a/firmware/target/arm/philips/hdd1630/backlight-hdd1630.c b/firmware/target/arm/philips/hdd1630/backlight-hdd1630.c new file mode 100755 index 0000000000..22d31976aa --- /dev/null +++ b/firmware/target/arm/philips/hdd1630/backlight-hdd1630.c | |||
@@ -0,0 +1,49 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Mark Arigo | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "config.h" | ||
20 | #include "backlight-target.h" | ||
21 | #include "system.h" | ||
22 | #include "lcd.h" | ||
23 | #include "backlight.h" | ||
24 | |||
25 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | ||
26 | static unsigned short backlight_brightness = DEFAULT_BRIGHTNESS_SETTING; | ||
27 | |||
28 | void _backlight_set_brightness(int brightness) | ||
29 | { | ||
30 | } | ||
31 | #endif | ||
32 | |||
33 | void _backlight_on(void) | ||
34 | { | ||
35 | } | ||
36 | |||
37 | void _backlight_off(void) | ||
38 | { | ||
39 | } | ||
40 | |||
41 | #ifdef HAVE_BUTTON_LIGHT | ||
42 | void _buttonlight_on(void) | ||
43 | { | ||
44 | } | ||
45 | |||
46 | void _buttonlight_off(void) | ||
47 | { | ||
48 | } | ||
49 | #endif | ||
diff --git a/firmware/target/arm/philips/hdd1630/backlight-target.h b/firmware/target/arm/philips/hdd1630/backlight-target.h new file mode 100755 index 0000000000..3cfd085761 --- /dev/null +++ b/firmware/target/arm/philips/hdd1630/backlight-target.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Mark Arigo | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef BACKLIGHT_TARGET_H | ||
20 | #define BACKLIGHT_TARGET_H | ||
21 | |||
22 | #define _backlight_init() true | ||
23 | void _backlight_on(void); | ||
24 | void _backlight_off(void); | ||
25 | int __backlight_is_on(void); | ||
26 | |||
27 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | ||
28 | void _backlight_set_brightness(int brightness); | ||
29 | #endif | ||
30 | |||
31 | #ifdef HAVE_BUTTON_LIGHT | ||
32 | void _buttonlight_on(void); | ||
33 | void _buttonlight_off(void); | ||
34 | #endif | ||
35 | |||
36 | #endif | ||
diff --git a/firmware/target/arm/philips/hdd1630/button-hdd1630.c b/firmware/target/arm/philips/hdd1630/button-hdd1630.c new file mode 100755 index 0000000000..ac478065bc --- /dev/null +++ b/firmware/target/arm/philips/hdd1630/button-hdd1630.c | |||
@@ -0,0 +1,65 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Mark Arigo | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "system.h" | ||
21 | #include "button.h" | ||
22 | #include "backlight.h" | ||
23 | |||
24 | void button_init_device(void) | ||
25 | { | ||
26 | /* TODO...for now, hardware initialisation is done by the bootloader */ | ||
27 | } | ||
28 | |||
29 | bool button_hold(void) | ||
30 | { | ||
31 | return !(GPIOJ_INPUT_VAL & 0x8); | ||
32 | } | ||
33 | |||
34 | /* | ||
35 | * Get button pressed from hardware | ||
36 | */ | ||
37 | int button_read_device(void) | ||
38 | { | ||
39 | int btn = BUTTON_NONE; | ||
40 | static bool hold_button = false; | ||
41 | bool hold_button_old; | ||
42 | |||
43 | /* Hold */ | ||
44 | hold_button_old = hold_button; | ||
45 | hold_button = button_hold(); | ||
46 | |||
47 | /* device buttons */ | ||
48 | if (!hold_button) | ||
49 | { | ||
50 | if (!(GPIOA_INPUT_VAL & 0x01)) btn |= BUTTON_MENU; | ||
51 | if (!(GPIOA_INPUT_VAL & 0x02)) btn |= BUTTON_VOL_UP; | ||
52 | if (!(GPIOA_INPUT_VAL & 0x04)) btn |= BUTTON_VOL_DOWN; | ||
53 | if (!(GPIOA_INPUT_VAL & 0x08)) btn |= BUTTON_VIEW; | ||
54 | |||
55 | if (!(GPIOD_INPUT_VAL & 0x20)) btn |= BUTTON_PLAYLIST; | ||
56 | if (!(GPIOD_INPUT_VAL & 0x40)) btn |= BUTTON_POWER; | ||
57 | } | ||
58 | |||
59 | return btn; | ||
60 | } | ||
61 | |||
62 | bool headphones_inserted(void) | ||
63 | { | ||
64 | return true; | ||
65 | } | ||
diff --git a/firmware/target/arm/philips/hdd1630/button-target.h b/firmware/target/arm/philips/hdd1630/button-target.h new file mode 100755 index 0000000000..92c584463f --- /dev/null +++ b/firmware/target/arm/philips/hdd1630/button-target.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Mark Arigo | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #ifndef _BUTTON_TARGET_H_ | ||
21 | #define _BUTTON_TARGET_H_ | ||
22 | |||
23 | #include <stdbool.h> | ||
24 | #include "config.h" | ||
25 | |||
26 | #define HAS_BUTTON_HOLD | ||
27 | |||
28 | bool button_hold(void); | ||
29 | void button_init_device(void); | ||
30 | int button_read_device(void); | ||
31 | |||
32 | /* Main unit's buttons */ | ||
33 | #define BUTTON_POWER 0x00000001 | ||
34 | #define BUTTON_PLAYLIST 0x00000002 | ||
35 | #define BUTTON_MENU 0x00000004 | ||
36 | #define BUTTON_VIEW 0x00000008 | ||
37 | #define BUTTON_VOL_UP 0x00000010 | ||
38 | #define BUTTON_VOL_DOWN 0x00000020 | ||
39 | #define BUTTON_SELECT 0x00000040 | ||
40 | #define BUTTON_LEFT 0x00000080 | ||
41 | #define BUTTON_RIGHT 0x00000100 | ||
42 | #define BUTTON_UP 0x00000200 | ||
43 | #define BUTTON_DOWN 0x00000400 | ||
44 | |||
45 | #define BUTTON_MAIN 0x00000fff | ||
46 | |||
47 | /* No Remote control */ | ||
48 | #define BUTTON_REMOTE 0 | ||
49 | |||
50 | #define POWEROFF_BUTTON BUTTON_POWER | ||
51 | #define POWEROFF_COUNT 10 | ||
52 | |||
53 | #endif /* _BUTTON_TARGET_H_ */ | ||
diff --git a/firmware/target/arm/philips/hdd1630/lcd-hdd1630.c b/firmware/target/arm/philips/hdd1630/lcd-hdd1630.c new file mode 100755 index 0000000000..5e6d3ace42 --- /dev/null +++ b/firmware/target/arm/philips/hdd1630/lcd-hdd1630.c | |||
@@ -0,0 +1,266 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Mark Arigo | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "config.h" | ||
20 | #include "cpu.h" | ||
21 | #include "lcd.h" | ||
22 | #include "kernel.h" | ||
23 | #include "system.h" | ||
24 | |||
25 | /* Display status */ | ||
26 | static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0; | ||
27 | |||
28 | /* wait for LCD */ | ||
29 | static inline void lcd_wait_write(void) | ||
30 | { | ||
31 | int i = 0; | ||
32 | while (LCD2_PORT & LCD2_BUSY_MASK) | ||
33 | { | ||
34 | if (i < 2000) | ||
35 | i++; | ||
36 | else | ||
37 | LCD2_PORT &= ~LCD2_BUSY_MASK; | ||
38 | } | ||
39 | } | ||
40 | |||
41 | /* send LCD data */ | ||
42 | static void lcd_send_data(unsigned data) | ||
43 | { | ||
44 | lcd_wait_write(); | ||
45 | LCD2_PORT = LCD2_DATA_MASK | (data & 0xff); | ||
46 | } | ||
47 | |||
48 | /* send LCD command */ | ||
49 | static void lcd_send_cmd(unsigned cmd) | ||
50 | { | ||
51 | lcd_wait_write(); | ||
52 | LCD2_PORT = LCD2_CMD_MASK | (cmd & 0xff); | ||
53 | lcd_wait_write(); | ||
54 | } | ||
55 | |||
56 | static inline void lcd_send_pixel(unsigned pixel) | ||
57 | { | ||
58 | lcd_send_data(pixel >> 8); | ||
59 | lcd_send_data(pixel); | ||
60 | } | ||
61 | |||
62 | void lcd_init_device(void) | ||
63 | { | ||
64 | #if 0 | ||
65 | /* this sequence from the OF bootloader */ | ||
66 | |||
67 | DEV_EN2 |= 0x2000; | ||
68 | outl(inl(0x70000014) & ~0xf000000, 0x70000014); | ||
69 | outl(inl(0x70000014) | 0xa000000, 0x70000014); | ||
70 | DEV_INIT1 &= 0xc000; | ||
71 | DEV_INIT1 |= 0x8000; | ||
72 | MLCD_SCLK_DIV &= ~0x800; | ||
73 | CLCD_CLOCK_SRC |= 0xc0000000; | ||
74 | DEV_INIT2 &= ~0x400; | ||
75 | outl(inl(0x7000002c) | ((1<<4)<<24), 0x7000002c); | ||
76 | DEV_INIT2 &= ~((1<<4)<<24); | ||
77 | udelay(10000); | ||
78 | |||
79 | DEV_INIT2 |= ((1<<4)<<24); | ||
80 | outl(0x220, 0x70008a00); | ||
81 | outl(0x1f00, 0x70008a04); | ||
82 | LCD2_BLOCK_CTRL = 0x10008080; | ||
83 | LCD2_BLOCK_CONFIG = 0xF00000; | ||
84 | |||
85 | GPIOJ_ENABLE |= 0x4; | ||
86 | GPIOJ_OUTPUT_VAL |= 0x4; | ||
87 | GPIOJ_OUTPUT_EN |= 0x4; | ||
88 | |||
89 | lcd_send_cmd(0x1); | ||
90 | udelay(10000); | ||
91 | |||
92 | lcd_send_cmd(0x25); | ||
93 | lcd_send_data(0x3f); | ||
94 | |||
95 | lcd_send_cmd(0x11); | ||
96 | udelay(120000); | ||
97 | |||
98 | lcd_send_cmd(0x20); | ||
99 | lcd_send_cmd(0x38); | ||
100 | lcd_send_cmd(0x13); | ||
101 | |||
102 | lcd_send_cmd(0xb4); | ||
103 | lcd_send_data(0x2); | ||
104 | lcd_send_data(0x6); | ||
105 | lcd_send_data(0x8); | ||
106 | lcd_send_data(0xd); | ||
107 | |||
108 | lcd_send_cmd(0xb5); | ||
109 | lcd_send_data(0x2); | ||
110 | lcd_send_data(0x6); | ||
111 | lcd_send_data(0x8); | ||
112 | lcd_send_data(0xd); | ||
113 | |||
114 | lcd_send_cmd(0xb6); | ||
115 | lcd_send_data(0x19); | ||
116 | lcd_send_data(0x23); | ||
117 | lcd_send_data(0x2d); | ||
118 | |||
119 | lcd_send_cmd(0xb7); | ||
120 | lcd_send_data(0x5); | ||
121 | |||
122 | lcd_send_cmd(0xba); | ||
123 | lcd_send_data(0x7); | ||
124 | lcd_send_data(0x18); | ||
125 | |||
126 | lcd_send_cmd(0x36); | ||
127 | lcd_send_data(0); | ||
128 | |||
129 | lcd_send_cmd(0x3a); | ||
130 | lcd_send_data(0x5); | ||
131 | |||
132 | lcd_send_cmd(0x2d); | ||
133 | lcd_send_data(0x1); | ||
134 | lcd_send_data(0x2); | ||
135 | lcd_send_data(0x3); | ||
136 | lcd_send_data(0x4); | ||
137 | lcd_send_data(0x5); | ||
138 | lcd_send_data(0x6); | ||
139 | lcd_send_data(0x7); | ||
140 | lcd_send_data(0x8); | ||
141 | lcd_send_data(0x9); | ||
142 | lcd_send_data(0xa); | ||
143 | lcd_send_data(0xb); | ||
144 | lcd_send_data(0xc); | ||
145 | lcd_send_data(0xd); | ||
146 | lcd_send_data(0xe); | ||
147 | lcd_send_data(0xf); | ||
148 | lcd_send_data(0x10); | ||
149 | lcd_send_data(0x11); | ||
150 | lcd_send_data(0x12); | ||
151 | lcd_send_data(0x13); | ||
152 | lcd_send_data(0x14); | ||
153 | lcd_send_data(0x15); | ||
154 | lcd_send_data(0x16); | ||
155 | lcd_send_data(0x17); | ||
156 | lcd_send_data(0x18); | ||
157 | lcd_send_data(0x19); | ||
158 | lcd_send_data(0x1a); | ||
159 | lcd_send_data(0x1b); | ||
160 | lcd_send_data(0x1c); | ||
161 | lcd_send_data(0x1d); | ||
162 | lcd_send_data(0x1e); | ||
163 | lcd_send_data(0x1f); | ||
164 | lcd_send_data(0x20); | ||
165 | lcd_send_data(0x21); | ||
166 | lcd_send_data(0x22); | ||
167 | lcd_send_data(0x23); | ||
168 | lcd_send_data(0x24); | ||
169 | lcd_send_data(0x25); | ||
170 | lcd_send_data(0x26); | ||
171 | lcd_send_data(0x27); | ||
172 | lcd_send_data(0x28); | ||
173 | lcd_send_data(0x29); | ||
174 | lcd_send_data(0x2a); | ||
175 | lcd_send_data(0x2b); | ||
176 | lcd_send_data(0x2c); | ||
177 | lcd_send_data(0x2d); | ||
178 | lcd_send_data(0x2e); | ||
179 | lcd_send_data(0x2f); | ||
180 | lcd_send_data(0x30); | ||
181 | |||
182 | lcd_send_cmd(0x29); | ||
183 | #endif | ||
184 | } | ||
185 | |||
186 | /*** hardware configuration ***/ | ||
187 | int lcd_default_contrast(void) | ||
188 | { | ||
189 | return DEFAULT_CONTRAST_SETTING; | ||
190 | } | ||
191 | |||
192 | void lcd_set_contrast(int val) | ||
193 | { | ||
194 | (void)val; | ||
195 | } | ||
196 | |||
197 | void lcd_set_invert_display(bool yesno) | ||
198 | { | ||
199 | (void)yesno; | ||
200 | } | ||
201 | |||
202 | /* turn the display upside down (call lcd_update() afterwards) */ | ||
203 | void lcd_set_flip(bool yesno) | ||
204 | { | ||
205 | (void)yesno; | ||
206 | } | ||
207 | |||
208 | void lcd_yuv_set_options(unsigned options) | ||
209 | { | ||
210 | lcd_yuv_options = options; | ||
211 | } | ||
212 | |||
213 | /* Performance function to blit a YUV bitmap directly to the LCD */ | ||
214 | void lcd_blit_yuv(unsigned char * const src[3], | ||
215 | int src_x, int src_y, int stride, | ||
216 | int x, int y, int width, int height) | ||
217 | { | ||
218 | (void)src; | ||
219 | (void)src_x; | ||
220 | (void)src_y; | ||
221 | (void)stride; | ||
222 | (void)x; | ||
223 | (void)y; | ||
224 | (void)width; | ||
225 | (void)height; | ||
226 | } | ||
227 | |||
228 | /* Update the display. | ||
229 | This must be called after all other LCD functions that change the display. */ | ||
230 | void lcd_update(void) | ||
231 | { | ||
232 | lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); | ||
233 | } | ||
234 | |||
235 | /* Update a fraction of the display. */ | ||
236 | void lcd_update_rect(int x, int y, int width, int height) | ||
237 | { | ||
238 | const fb_data *addr; | ||
239 | |||
240 | if (x + width >= LCD_WIDTH) | ||
241 | width = LCD_WIDTH - x; | ||
242 | if (y + height >= LCD_HEIGHT) | ||
243 | height = LCD_HEIGHT - y; | ||
244 | |||
245 | if ((width <= 0) || (height <= 0)) | ||
246 | return; /* Nothing left to do. */ | ||
247 | |||
248 | addr = &lcd_framebuffer[y][x]; | ||
249 | |||
250 | lcd_send_cmd(0x2a); | ||
251 | lcd_send_data(x); | ||
252 | lcd_send_data(x + width - 1); | ||
253 | |||
254 | lcd_send_cmd(0x2b); | ||
255 | lcd_send_data(y); | ||
256 | lcd_send_data(y + height - 1); | ||
257 | |||
258 | lcd_send_cmd(0x2c); | ||
259 | do { | ||
260 | int w = width; | ||
261 | do { | ||
262 | lcd_send_pixel(*addr++); | ||
263 | } while (--w > 0); | ||
264 | addr += LCD_WIDTH - width; | ||
265 | } while (--height > 0); | ||
266 | } | ||
diff --git a/firmware/target/arm/philips/hdd1630/power-hdd1630.c b/firmware/target/arm/philips/hdd1630/power-hdd1630.c new file mode 100755 index 0000000000..6d3686ff4a --- /dev/null +++ b/firmware/target/arm/philips/hdd1630/power-hdd1630.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Mark Arigo | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "config.h" | ||
21 | #include "cpu.h" | ||
22 | #include <stdbool.h> | ||
23 | #include "adc.h" | ||
24 | #include "kernel.h" | ||
25 | #include "system.h" | ||
26 | #include "power.h" | ||
27 | #include "logf.h" | ||
28 | #include "usb.h" | ||
29 | |||
30 | #if CONFIG_CHARGING == CHARGING_CONTROL | ||
31 | bool charger_enabled; | ||
32 | #endif | ||
33 | |||
34 | void power_init(void) | ||
35 | { | ||
36 | } | ||
37 | |||
38 | bool charger_inserted(void) | ||
39 | { | ||
40 | return false ; | ||
41 | } | ||
42 | |||
43 | void ide_power_enable(bool on) | ||
44 | { | ||
45 | (void)on; | ||
46 | /* We do nothing */ | ||
47 | } | ||
48 | |||
49 | |||
50 | bool ide_powered(void) | ||
51 | { | ||
52 | /* pretend we are always powered - we don't turn it off */ | ||
53 | return true; | ||
54 | } | ||
55 | |||
56 | void power_off(void) | ||
57 | { | ||
58 | } | ||
diff --git a/firmware/target/arm/philips/hdd1630/powermgmt-hdd1630.c b/firmware/target/arm/philips/hdd1630/powermgmt-hdd1630.c new file mode 100644 index 0000000000..71781182fa --- /dev/null +++ b/firmware/target/arm/philips/hdd1630/powermgmt-hdd1630.c | |||
@@ -0,0 +1,62 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese | ||
11 | * Revisions copyright (C) 2005 by Gerald Van Baren | ||
12 | * | ||
13 | * All files in this archive are subject to the GNU General Public License. | ||
14 | * See the file COPYING in the source tree root for full license agreement. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include "config.h" | ||
22 | #include "adc.h" | ||
23 | #include "powermgmt.h" | ||
24 | |||
25 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
26 | { | ||
27 | 3450 | ||
28 | }; | ||
29 | |||
30 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
31 | { | ||
32 | 3400 | ||
33 | }; | ||
34 | |||
35 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
36 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
37 | { | ||
38 | { 3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990 }, | ||
39 | }; | ||
40 | |||
41 | #if CONFIG_CHARGING | ||
42 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | ||
43 | const unsigned short percent_to_volt_charge[11] = | ||
44 | { | ||
45 | 3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990 | ||
46 | }; | ||
47 | #endif /* CONFIG_CHARGING */ | ||
48 | |||
49 | #define BATTERY_SCALE_FACTOR 6003 | ||
50 | /* full-scale ADC readout (2^10) in millivolt */ | ||
51 | |||
52 | /* adc readout | ||
53 | * max with charger connected: 690 | ||
54 | * max fully charged: 682 | ||
55 | * min just before shutdown: 570 | ||
56 | */ | ||
57 | |||
58 | /* Returns battery voltage from ADC [millivolts] */ | ||
59 | unsigned int battery_adc_voltage(void) | ||
60 | { | ||
61 | return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; | ||
62 | } | ||