summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorMark Arigo <markarigo@gmail.com>2008-06-27 18:40:25 +0000
committerMark Arigo <markarigo@gmail.com>2008-06-27 18:40:25 +0000
commit22e7bf32b894acc1f9e2820e213f05a57bd4148c (patch)
treecdecc7a9f0db0b41d7ac55680c2b3b2212ab4dda /firmware
parent78337961b72b76c410075a0d5fe6c3cf1269b5e8 (diff)
downloadrockbox-22e7bf32b894acc1f9e2820e213f05a57bd4148c.tar.gz
rockbox-22e7bf32b894acc1f9e2820e213f05a57bd4148c.zip
My Devcon 2008 contribution: port for Philips GoGear HDD1630 (PP5022-based). Current status is that the bootloader works to load Rockbox, but dual boot does not work: it freezes after decrypting the OF. When Rockbox boots, it freezes somewhere between showing the logo and the main menu. And there's no driver for the touchpad. So lots of work left.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17809 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/SOURCES16
-rwxr-xr-xfirmware/export/config-hdd1630.h189
-rw-r--r--firmware/export/config.h4
-rw-r--r--firmware/export/usb.h3
-rw-r--r--firmware/target/arm/philips/hdd1630/adc-target.h39
-rwxr-xr-xfirmware/target/arm/philips/hdd1630/backlight-hdd1630.c49
-rwxr-xr-xfirmware/target/arm/philips/hdd1630/backlight-target.h36
-rwxr-xr-xfirmware/target/arm/philips/hdd1630/button-hdd1630.c65
-rwxr-xr-xfirmware/target/arm/philips/hdd1630/button-target.h53
-rwxr-xr-xfirmware/target/arm/philips/hdd1630/lcd-hdd1630.c266
-rwxr-xr-xfirmware/target/arm/philips/hdd1630/power-hdd1630.c58
-rw-r--r--firmware/target/arm/philips/hdd1630/powermgmt-hdd1630.c62
-rw-r--r--firmware/target/arm/usb-fw-pp502x.c5
13 files changed, 845 insertions, 0 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 2e2559477f..4dca1c1563 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -481,6 +481,22 @@ target/arm/i2s-pp.c
481#endif /* SIMULATOR */ 481#endif /* SIMULATOR */
482#endif /* PHILIPS_SA9200 */ 482#endif /* PHILIPS_SA9200 */
483 483
484#ifdef PHILIPS_HDD1630
485#ifndef SIMULATOR
486target/arm/ata-as-arm.S
487target/arm/ata-pp5020.c
488target/arm/wmcodec-pp.c
489target/arm/i2s-pp.c
490target/arm/adc-pp5020.c
491target/arm/philips/hdd1630/backlight-hdd1630.c
492target/arm/philips/hdd1630/button-hdd1630.c
493target/arm/philips/hdd1630/lcd-hdd1630.c
494target/arm/philips/hdd1630/power-hdd1630.c
495target/arm/philips/hdd1630/powermgmt-hdd1630.c
496target/arm/usb-fw-pp502x.c
497#endif /* SIMULATOR */
498#endif /* PHILIPS_HDD1630 */
499
484#ifdef IAUDIO_X5 500#ifdef IAUDIO_X5
485#ifndef SIMULATOR 501#ifndef SIMULATOR
486target/coldfire/ata-as-coldfire.S 502target/coldfire/ata-as-coldfire.S
diff --git a/firmware/export/config-hdd1630.h b/firmware/export/config-hdd1630.h
new file mode 100755
index 0000000000..19ca190a57
--- /dev/null
+++ b/firmware/export/config-hdd1630.h
@@ -0,0 +1,189 @@
1/*
2 * This config file is for the iriver H10 20Gb
3 */
4
5#define TARGET_TREE /* this target is using the target tree system */
6
7/* For Rolo and boot loader */
8#define MODEL_NUMBER 31
9#define MODEL_NAME "Philips GoGear HDD1630"
10
11/* define this if you use an ATA controller */
12#define HAVE_ATA
13
14/* define this if you have recording possibility */
15/* #define HAVE_RECORDING */
16
17/* Define bitmask of input sources - recordable bitmask can be defined
18 explicitly if different */
19#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_FMRADIO)
20
21/* define the bitmask of hardware sample rates */
22#define HW_SAMPR_CAPS (SAMPR_CAP_44)
23
24/* define the bitmask of recording sample rates */
25#define REC_SAMPR_CAPS (SAMPR_CAP_44)
26
27/* define this if you have a bitmap LCD display */
28#define HAVE_LCD_BITMAP
29
30/* define this if you have a colour LCD */
31#define HAVE_LCD_COLOR
32
33/* define this if you want album art for this target */
34#define HAVE_ALBUMART
35
36/* define this if you have access to the quickscreen */
37#define HAVE_QUICKSCREEN
38
39/* define this if you have access to the pitchscreen */
40#define HAVE_PITCHSCREEN
41
42/* define this if you would like tagcache to build on this target */
43#define HAVE_TAGCACHE
44
45/* LCD dimensions */
46#define LCD_WIDTH 128
47#define LCD_HEIGHT 128
48#define LCD_DEPTH 16 /* 65536 colours */
49#define LCD_PIXELFORMAT RGB565SWAPPED /* rgb565 byte-swapped */
50
51#ifndef BOOTLOADER
52/* Define this if your LCD can be enabled/disabled */
53/* #define HAVE_LCD_ENABLE */
54
55/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE
56 * should be defined as well.
57 * We can currently put the lcd to sleep but it won't wake up properly */
58/* #define HAVE_LCD_SLEEP */
59/* #define HAVE_LCD_SLEEP_SETTING */
60#endif
61
62/* define this if you can flip your LCD */
63/* #define HAVE_LCD_FLIP */
64
65/* define this if you can invert the colours on your LCD */
66/* #define HAVE_LCD_INVERT */
67
68/* #define IRAM_LCDFRAMEBUFFER IDATA_ATTR *//* put the lcd frame buffer in IRAM */
69
70#define CONFIG_KEYPAD PHILIPS_HDD1630_PAD
71
72/* Define this if you do software codec */
73#define CONFIG_CODEC SWCODEC
74
75/* define this if you have a real-time clock */
76#ifndef BOOTLOADER
77/* #define CONFIG_RTC RTC_E8564 */
78/* #define HAVE_RTC_ALARM */
79#endif
80
81/* Define this if you have a software controlled poweroff */
82/* #define HAVE_SW_POWEROFF */
83
84/* The number of bytes reserved for loadable codecs */
85#define CODEC_SIZE 0x80000
86
87/* The number of bytes reserved for loadable plugins */
88#define PLUGIN_BUFFER_SIZE 0x80000
89
90/* Define this if you have the WM8731 audio codec */
91#define HAVE_WM8731
92
93/* WM8731 has no tone controls, so we use the software ones */
94#define HAVE_SW_TONE_CONTROLS
95
96#define AB_REPEAT_ENABLE 1
97
98/* FM Tuner */
99/* #define CONFIG_TUNER TEA5767 */
100/* #define CONFIG_TUNER_XTAL 32768 */
101
102/* Define this for LCD backlight available */
103#define HAVE_BACKLIGHT
104/* #define HAVE_BACKLIGHT_BRIGHTNESS */
105
106/* Main LCD backlight brightness range and defaults */
107#define MIN_BRIGHTNESS_SETTING 1
108#define MAX_BRIGHTNESS_SETTING 12
109#define DEFAULT_BRIGHTNESS_SETTING 6
110
111/* define this if you have a light associated with the buttons */
112/* #define HAVE_BUTTON_LIGHT */
113
114#define AB_REPEAT_ENABLE 1
115
116#define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity */
117#define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */
118#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */
119#define BATTERY_CAPACITY_INC 50 /* capacity increment */
120#define BATTERY_TYPES_COUNT 1 /* only one type */
121
122/* Hardware controlled charging */
123/* #define CONFIG_CHARGING CHARGING_SIMPLE */
124
125/* define this if the unit can be powered or charged via USB */
126#define HAVE_USB_POWER
127
128#ifndef SIMULATOR
129
130/* Define this if you have a PortalPlayer PP5020 */
131#define CONFIG_CPU PP5022
132
133/* Define this if you want to use the PP5020 i2c interface */
134#define CONFIG_I2C I2C_PP5020
135
136/* define this if the hardware can be powered off while charging */
137#define HAVE_POWEROFF_WHILE_CHARGING
138
139/* The start address index for ROM builds */
140#define ROM_START 0x00000000
141
142/* The size of the flash ROM */
143#define FLASH_SIZE 0x100000
144
145/* Define this to the CPU frequency */
146#define CPU_FREQ 75000000
147
148/* Type of LCD */
149#define CONFIG_LCD LCD_HDD1630
150
151/* Define this if your LCD can set contrast */
152#define HAVE_LCD_CONTRAST
153
154#define MIN_CONTRAST_SETTING 0
155#define MAX_CONTRAST_SETTING 30
156#define DEFAULT_CONTRAST_SETTING 14 /* Match boot contrast */
157
158/* We're able to shut off power to the HDD */
159/* #define HAVE_ATA_POWER_OFF */
160
161/* Offset ( in the firmware file's header ) to the file CRC and data. These are
162 only used when loading the old format rockbox.e200 file */
163#define FIRMWARE_OFFSET_FILE_CRC 0x0
164#define FIRMWARE_OFFSET_FILE_DATA 0x8
165
166/* #define USB_IPODSTYLE */
167
168/* USB On-the-go */
169#define CONFIG_USBOTG USBOTG_ARC
170
171/* enable these for the experimental usb stack */
172#define HAVE_USBSTACK
173#define USB_VENDOR_ID 0x0471
174#define USB_PRODUCT_ID 0x014C
175
176/* Virtual LED (icon) */
177#define CONFIG_LED LED_VIRTUAL
178
179/* Define this if you have adjustable CPU frequency */
180#define HAVE_ADJUSTABLE_CPU_FREQ
181
182#define MI4_FORMAT
183#define BOOTFILE_EXT "mi4"
184#define BOOTFILE "rockbox." BOOTFILE_EXT
185#define BOOTDIR "/.rockbox"
186
187#define ICODE_ATTR_TREMOR_NOT_MDCT
188
189#endif
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 34d0bf27c6..1a6e5d6894 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -85,6 +85,7 @@
85#define CREATIVEZV_PAD 26 85#define CREATIVEZV_PAD 26
86#define PHILIPS_SA9200_PAD 27 86#define PHILIPS_SA9200_PAD 27
87#define SANSA_C100_PAD 28 87#define SANSA_C100_PAD 28
88#define PHILIPS_HDD1630_PAD 29
88 89
89/* CONFIG_REMOTE_KEYPAD */ 90/* CONFIG_REMOTE_KEYPAD */
90#define H100_REMOTE 1 91#define H100_REMOTE 1
@@ -125,6 +126,7 @@
125#define LCD_COWOND2 24 /* as used by Cowon D2 - LTV250QV, TCC7801 driver */ 126#define LCD_COWOND2 24 /* as used by Cowon D2 - LTV250QV, TCC7801 driver */
126#define LCD_SA9200 25 /* as used by the Philips SA9200 */ 127#define LCD_SA9200 25 /* as used by the Philips SA9200 */
127#define LCD_S6B33B2 26 /* as used by the Sansa c100 */ 128#define LCD_S6B33B2 26 /* as used by the Sansa c100 */
129#define LCD_HDD1630 27 /* as used by the Philips HDD1630 */
128 130
129/* LCD_PIXELFORMAT */ 131/* LCD_PIXELFORMAT */
130#define HORIZONTAL_PACKING 1 132#define HORIZONTAL_PACKING 1
@@ -265,6 +267,8 @@
265#include "config-creativezv.h" 267#include "config-creativezv.h"
266#elif defined(PHILIPS_SA9200) 268#elif defined(PHILIPS_SA9200)
267#include "config-sa9200.h" 269#include "config-sa9200.h"
270#elif defined(PHILIPS_HDD1630)
271#include "config-hdd1630.h"
268#elif defined(SANSA_C100) 272#elif defined(SANSA_C100)
269#include "config-c100.h" 273#include "config-c100.h"
270#else 274#else
diff --git a/firmware/export/usb.h b/firmware/export/usb.h
index 0590f702c5..05ea84148a 100644
--- a/firmware/export/usb.h
+++ b/firmware/export/usb.h
@@ -64,6 +64,9 @@ enum {
64 (CONFIG_KEYPAD == PHILIPS_SA9200_PAD) 64 (CONFIG_KEYPAD == PHILIPS_SA9200_PAD)
65#define USBPOWER_BUTTON BUTTON_SELECT 65#define USBPOWER_BUTTON BUTTON_SELECT
66#define USBPOWER_BTN_IGNORE BUTTON_POWER 66#define USBPOWER_BTN_IGNORE BUTTON_POWER
67#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
68#define USBPOWER_BUTTON BUTTON_PLAYLIST
69#define USBPOWER_BTN_IGNORE BUTTON_POWER
67#endif 70#endif
68#endif /* HAVE_USB_POWER */ 71#endif /* HAVE_USB_POWER */
69 72
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 */
37unsigned 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
26static unsigned short backlight_brightness = DEFAULT_BRIGHTNESS_SETTING;
27
28void _backlight_set_brightness(int brightness)
29{
30}
31#endif
32
33void _backlight_on(void)
34{
35}
36
37void _backlight_off(void)
38{
39}
40
41#ifdef HAVE_BUTTON_LIGHT
42void _buttonlight_on(void)
43{
44}
45
46void _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
23void _backlight_on(void);
24void _backlight_off(void);
25int __backlight_is_on(void);
26
27#ifdef HAVE_BACKLIGHT_BRIGHTNESS
28void _backlight_set_brightness(int brightness);
29#endif
30
31#ifdef HAVE_BUTTON_LIGHT
32void _buttonlight_on(void);
33void _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
24void button_init_device(void)
25{
26 /* TODO...for now, hardware initialisation is done by the bootloader */
27}
28
29bool button_hold(void)
30{
31 return !(GPIOJ_INPUT_VAL & 0x8);
32}
33
34/*
35 * Get button pressed from hardware
36 */
37int 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
62bool 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
28bool button_hold(void);
29void button_init_device(void);
30int 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 */
26static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0;
27
28/* wait for LCD */
29static 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 */
42static 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 */
49static 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
56static inline void lcd_send_pixel(unsigned pixel)
57{
58 lcd_send_data(pixel >> 8);
59 lcd_send_data(pixel);
60}
61
62void 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 ***/
187int lcd_default_contrast(void)
188{
189 return DEFAULT_CONTRAST_SETTING;
190}
191
192void lcd_set_contrast(int val)
193{
194 (void)val;
195}
196
197void lcd_set_invert_display(bool yesno)
198{
199 (void)yesno;
200}
201
202/* turn the display upside down (call lcd_update() afterwards) */
203void lcd_set_flip(bool yesno)
204{
205 (void)yesno;
206}
207
208void 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 */
214void 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. */
230void lcd_update(void)
231{
232 lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
233}
234
235/* Update a fraction of the display. */
236void 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
31bool charger_enabled;
32#endif
33
34void power_init(void)
35{
36}
37
38bool charger_inserted(void)
39{
40 return false ;
41}
42
43void ide_power_enable(bool on)
44{
45 (void)on;
46 /* We do nothing */
47}
48
49
50bool ide_powered(void)
51{
52 /* pretend we are always powered - we don't turn it off */
53 return true;
54}
55
56void 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
25const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
26{
27 3450
28};
29
30const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
31{
32 3400
33};
34
35/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
36const 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 */
43const 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] */
59unsigned int battery_adc_voltage(void)
60{
61 return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10;
62}
diff --git a/firmware/target/arm/usb-fw-pp502x.c b/firmware/target/arm/usb-fw-pp502x.c
index eae78886f4..7ea5641007 100644
--- a/firmware/target/arm/usb-fw-pp502x.c
+++ b/firmware/target/arm/usb-fw-pp502x.c
@@ -126,6 +126,11 @@ static bool usb_pin_detect(void)
126 /* GPIO F bit 7 is usb detect */ 126 /* GPIO F bit 7 is usb detect */
127 if (!(GPIOF_INPUT_VAL & 0x80)) 127 if (!(GPIOF_INPUT_VAL & 0x80))
128 retval = true; 128 retval = true;
129
130#elif defined(PHILIPS_HDD1630)
131 /* GPIO E bit 2 is usb detect */
132 if (GPIOE_INPUT_VAL & 0x4)
133 retval = true;
129#endif 134#endif
130 135
131 return retval; 136 return retval;