summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Arigo <markarigo@gmail.com>2008-05-21 03:55:17 +0000
committerMark Arigo <markarigo@gmail.com>2008-05-21 03:55:17 +0000
commitb4275d4941e464c851ae3f5fe33c80f56ea365e5 (patch)
tree6f82b4e9cc490bf759dc4e1c64b4416d3b2d4879
parent4c99f9a74964c4a44ca27a216f302bdc79b23121 (diff)
downloadrockbox-b4275d4941e464c851ae3f5fe33c80f56ea365e5.tar.gz
rockbox-b4275d4941e464c851ae3f5fe33c80f56ea365e5.zip
Philips GoGear SA9200 port. Working bootloader and normal builds, including sound. No touchpad now, buttons limited to using vol+/vol-/power for up/down/select. Rockbox USB is enabled since the OF is MTP only...read the warnings on the PortalPlayerUsb wiki page.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17591 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/SOURCES2
-rw-r--r--apps/debug_menu.c15
-rwxr-xr-xapps/keymaps/keymap-sa9200.c315
-rw-r--r--apps/lang/english.lang29
-rw-r--r--apps/plugins/lib/pluginlib_actions.c15
-rw-r--r--bootloader/SOURCES2
-rw-r--r--bootloader/common.c3
-rw-r--r--bootloader/main-pp.c25
-rw-r--r--firmware/SOURCES16
-rw-r--r--firmware/drivers/audio/as3514.c6
-rw-r--r--firmware/export/as3514.h2
-rwxr-xr-xfirmware/export/config-sa9200.h167
-rw-r--r--firmware/export/config.h4
-rw-r--r--firmware/export/usb.h3
-rw-r--r--firmware/target/arm/ata-sd-pp.c2
-rw-r--r--firmware/target/arm/i2c-pp.c2
-rw-r--r--firmware/target/arm/philips/app.lds198
-rw-r--r--firmware/target/arm/philips/boot.lds65
-rw-r--r--firmware/target/arm/philips/sa9200/adc-target.h43
-rw-r--r--firmware/target/arm/philips/sa9200/backlight-sa9200.c75
-rw-r--r--firmware/target/arm/philips/sa9200/backlight-target.h30
-rwxr-xr-xfirmware/target/arm/philips/sa9200/button-sa9200.c72
-rwxr-xr-xfirmware/target/arm/philips/sa9200/button-target.h53
-rwxr-xr-xfirmware/target/arm/philips/sa9200/lcd-sa9200.c205
-rw-r--r--firmware/target/arm/philips/sa9200/power-sa9200.c136
-rw-r--r--firmware/target/arm/philips/sa9200/powermgmt-sa9200.c58
-rw-r--r--firmware/target/arm/system-pp502x.c6
-rw-r--r--firmware/target/arm/usb-fw-pp502x.c5
-rwxr-xr-xtools/configure29
-rw-r--r--tools/scramble.c5
30 files changed, 1543 insertions, 45 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index c8cd03a29d..8c7cc15ecb 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -189,4 +189,6 @@ keymaps/keymap-cowond2.c
189keymaps/keymap-creativezvm.c 189keymaps/keymap-creativezvm.c
190#elif CONFIG_KEYPAD == CREATIVEZV_PAD 190#elif CONFIG_KEYPAD == CREATIVEZV_PAD
191keymaps/keymap-creativezv.c 191keymaps/keymap-creativezv.c
192#elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
193keymaps/keymap-sa9200.c
192#endif 194#endif
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index e198bfa18d..313a2aacac 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -99,7 +99,7 @@
99#include "debug-target.h" 99#include "debug-target.h"
100#endif 100#endif
101 101
102#if defined(SANSA_E200) 102#if defined(SANSA_E200) || defined(PHILIPS_SA9200)
103#include "i2c-pp.h" 103#include "i2c-pp.h"
104#include "as3514.h" 104#include "as3514.h"
105#endif 105#endif
@@ -1017,6 +1017,11 @@ static bool dbg_spdif(void)
1017#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \ 1017#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
1018 (CONFIG_KEYPAD == SANSA_C200_PAD) 1018 (CONFIG_KEYPAD == SANSA_C200_PAD)
1019# define DEBUG_CANCEL BUTTON_LEFT 1019# define DEBUG_CANCEL BUTTON_LEFT
1020
1021/* This is temporary until the SA9200 touchpad works */
1022#elif (CONFIG_KEYPAD == PHILIPS_SA9200_PAD)
1023# define DEBUG_CANCEL BUTTON_POWER
1024
1020#endif /* key definitions */ 1025#endif /* key definitions */
1021 1026
1022/* Test code!!! */ 1027/* Test code!!! */
@@ -1197,7 +1202,7 @@ bool dbg_ports(void)
1197 snprintf(buf, sizeof(buf), "REM: %03x PAD: %03x", 1202 snprintf(buf, sizeof(buf), "REM: %03x PAD: %03x",
1198 adc_read(ADC_REMOTE), adc_read(ADC_SCROLLPAD)); 1203 adc_read(ADC_REMOTE), adc_read(ADC_SCROLLPAD));
1199 lcd_puts(0, line++, buf); 1204 lcd_puts(0, line++, buf);
1200#elif defined(SANSA_E200) 1205#elif defined(SANSA_E200) || defined(PHILIPS_SA9200)
1201 snprintf(buf, sizeof(buf), "ADC_BVDD: %4d", adc_read(ADC_BVDD)); 1206 snprintf(buf, sizeof(buf), "ADC_BVDD: %4d", adc_read(ADC_BVDD));
1202 lcd_puts(0, line++, buf); 1207 lcd_puts(0, line++, buf);
1203 snprintf(buf, sizeof(buf), "ADC_RTCSUP: %4d", adc_read(ADC_RTCSUP)); 1208 snprintf(buf, sizeof(buf), "ADC_RTCSUP: %4d", adc_read(ADC_RTCSUP));
@@ -1220,6 +1225,7 @@ bool dbg_ports(void)
1220 lcd_puts(0, line++, buf); 1225 lcd_puts(0, line++, buf);
1221 snprintf(buf, sizeof(buf), "ADC_I_MICSUP1:%4d", adc_read(ADC_I_MICSUP1)); 1226 snprintf(buf, sizeof(buf), "ADC_I_MICSUP1:%4d", adc_read(ADC_I_MICSUP1));
1222 lcd_puts(0, line++, buf); 1227 lcd_puts(0, line++, buf);
1228#if !defined(PHILIPS_SA9200)
1223 snprintf(buf, sizeof(buf), "ADC_I_MICSUP2:%4d", adc_read(ADC_I_MICSUP2)); 1229 snprintf(buf, sizeof(buf), "ADC_I_MICSUP2:%4d", adc_read(ADC_I_MICSUP2));
1224 lcd_puts(0, line++, buf); 1230 lcd_puts(0, line++, buf);
1225 snprintf(buf, sizeof(buf), "ADC_VBAT: %4d", adc_read(ADC_VBAT)); 1231 snprintf(buf, sizeof(buf), "ADC_VBAT: %4d", adc_read(ADC_VBAT));
@@ -1227,6 +1233,7 @@ bool dbg_ports(void)
1227 snprintf(buf, sizeof(buf), "CHARGER: %02X/%02X", i2c_readbyte(AS3514_I2C_ADDR, AS3514_CHARGER), i2c_readbyte(AS3514_I2C_ADDR, AS3514_IRQ_ENRD0)); 1233 snprintf(buf, sizeof(buf), "CHARGER: %02X/%02X", i2c_readbyte(AS3514_I2C_ADDR, AS3514_CHARGER), i2c_readbyte(AS3514_I2C_ADDR, AS3514_IRQ_ENRD0));
1228 lcd_puts(0, line++, buf); 1234 lcd_puts(0, line++, buf);
1229#endif 1235#endif
1236#endif
1230 lcd_update(); 1237 lcd_update();
1231 if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) 1238 if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
1232 return false; 1239 return false;
@@ -2136,7 +2143,7 @@ static bool dbg_save_roms(void)
2136 2143
2137 return false; 2144 return false;
2138} 2145}
2139#elif defined(CPU_PP) && !(defined(SANSA_E200) || defined(SANSA_C200)) 2146#elif defined(CPU_PP) && !defined(HAVE_ATA_SD)
2140static bool dbg_save_roms(void) 2147static bool dbg_save_roms(void)
2141{ 2148{
2142 int fd; 2149 int fd;
@@ -2459,7 +2466,7 @@ struct the_menu_item {
2459}; 2466};
2460static const struct the_menu_item menuitems[] = { 2467static const struct the_menu_item menuitems[] = {
2461#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || \ 2468#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || \
2462 (defined(CPU_PP) && !(defined(SANSA_E200) || defined(SANSA_C200))) 2469 (defined(CPU_PP) && !defined(HAVE_ATA_SD))
2463 { "Dump ROM contents", dbg_save_roms }, 2470 { "Dump ROM contents", dbg_save_roms },
2464#endif 2471#endif
2465#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || defined(CPU_PP) \ 2472#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || defined(CPU_PP) \
diff --git a/apps/keymaps/keymap-sa9200.c b/apps/keymaps/keymap-sa9200.c
new file mode 100755
index 0000000000..c2fa6e44e8
--- /dev/null
+++ b/apps/keymaps/keymap-sa9200.c
@@ -0,0 +1,315 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 Jonathan Gordon
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/* Button Code Definitions for the Philips SA9200 target */
21#include <stdio.h>
22#include <string.h>
23#include <stdlib.h>
24
25#include "config.h"
26#include "action.h"
27#include "button.h"
28#include "settings.h"
29
30/*
31 * The format of the list is as follows
32 * { Action Code, Button code, Prereq button code }
33 * if there's no need to check the previous button's value, use BUTTON_NONE
34 * Insert LAST_ITEM_IN_LIST at the end of each mapping
35 */
36
37/* CONTEXT_CUSTOM's used in this file...
38
39CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions)
40CONTEXT_CUSTOM|CONTEXT_SETTINGS = the direction keys for the eq/col picker screens
41 i.e where up/down is inc/dec
42 CONTEXT_SETTINGS = up/down is prev/next, l/r is inc/dec
43
44*/
45
46
47static const struct button_mapping button_context_standard[] = {
48 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
49 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
50 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
51 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
52
53 { ACTION_STD_CANCEL, BUTTON_REW, BUTTON_NONE },
54 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
55
56 { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
57
58 { ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
59 { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
60
61 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
62 { ACTION_STD_OK, BUTTON_FFWD, BUTTON_NONE },
63
64 LAST_ITEM_IN_LIST
65}; /* button_context_standard */
66
67
68static const struct button_mapping button_context_wps[] = {
69 { ACTION_WPS_PLAY, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
70 { ACTION_WPS_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
71
72 { ACTION_WPS_SKIPNEXT, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD },
73 { ACTION_WPS_SKIPPREV, BUTTON_REW|BUTTON_REL, BUTTON_REW },
74
75 { ACTION_WPS_SEEKBACK, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
76 { ACTION_WPS_SEEKFWD, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE },
77 { ACTION_WPS_STOPSEEK, BUTTON_REW|BUTTON_REL, BUTTON_REW|BUTTON_REPEAT },
78 { ACTION_WPS_STOPSEEK, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD|BUTTON_REPEAT },
79
80 { ACTION_WPS_ABSETB_NEXTDIR, BUTTON_RIGHT|BUTTON_FFWD, BUTTON_NONE },
81 { ACTION_WPS_ABSETA_PREVDIR, BUTTON_RIGHT|BUTTON_REW, BUTTON_NONE },
82 { ACTION_WPS_ABRESET, BUTTON_RIGHT|BUTTON_SELECT, BUTTON_NONE },
83
84 { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
85 { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE },
86 { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
87 { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
88 { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
89 { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE },
90 { ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
91 { ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
92
93 { ACTION_WPS_PITCHSCREEN, BUTTON_RIGHT|BUTTON_UP, BUTTON_RIGHT },
94 { ACTION_WPS_PITCHSCREEN, BUTTON_RIGHT|BUTTON_DOWN, BUTTON_RIGHT },
95
96 { ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
97 { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
98 { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
99
100 { ACTION_WPS_ID3SCREEN, BUTTON_RIGHT|BUTTON_MENU, BUTTON_NONE },
101 { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
102
103 LAST_ITEM_IN_LIST
104}; /* button_context_wps */
105
106static const struct button_mapping button_context_list[] = {
107 { ACTION_LISTTREE_PGUP, BUTTON_RIGHT|BUTTON_UP, BUTTON_RIGHT },
108 { ACTION_LISTTREE_PGUP, BUTTON_UP|BUTTON_REL, BUTTON_RIGHT|BUTTON_UP },
109 { ACTION_LISTTREE_PGUP, BUTTON_RIGHT|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
110 { ACTION_LISTTREE_PGDOWN, BUTTON_RIGHT|BUTTON_DOWN, BUTTON_RIGHT },
111 { ACTION_LISTTREE_PGDOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_RIGHT|BUTTON_DOWN },
112 { ACTION_LISTTREE_PGDOWN, BUTTON_RIGHT|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
113#ifdef HAVE_VOLUME_IN_LIST
114 { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
115 { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
116 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
117 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
118#endif
119
120 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
121}; /* button_context_list */
122
123static const struct button_mapping button_context_tree[] = {
124 { ACTION_TREE_WPS, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
125 { ACTION_TREE_STOP, BUTTON_POWER, BUTTON_NONE },
126 { ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
127 { ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE },
128
129 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
130}; /* button_context_tree */
131
132static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
133 { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
134 { ACTION_TREE_PGLEFT, BUTTON_RIGHT|BUTTON_REW, BUTTON_RIGHT },
135 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_REL, BUTTON_RIGHT|BUTTON_REW },
136 { ACTION_TREE_PGLEFT, BUTTON_RIGHT|BUTTON_REW, BUTTON_REW|BUTTON_REL },
137 { ACTION_TREE_ROOT_INIT, BUTTON_RIGHT|BUTTON_REW|BUTTON_REPEAT, BUTTON_RIGHT|BUTTON_REW },
138 { ACTION_TREE_PGLEFT, BUTTON_RIGHT|BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
139 { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_FFWD, BUTTON_RIGHT },
140 { ACTION_TREE_PGRIGHT, BUTTON_FFWD|BUTTON_REL, BUTTON_RIGHT|BUTTON_FFWD },
141 { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_FFWD, BUTTON_FFWD|BUTTON_REL },
142 { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE },
143 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
144};
145
146static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
147 { ACTION_NONE, BUTTON_REW, BUTTON_NONE },
148 { ACTION_STD_CANCEL, BUTTON_REW|BUTTON_REL, BUTTON_REW },
149 { ACTION_TREE_ROOT_INIT, BUTTON_REW|BUTTON_REPEAT, BUTTON_REW },
150 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
151 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_REL, BUTTON_REW|BUTTON_REPEAT },
152 { ACTION_NONE, BUTTON_FFWD, BUTTON_NONE },
153 { ACTION_STD_OK, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD },
154 { ACTION_TREE_PGRIGHT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE },
155 { ACTION_TREE_PGRIGHT, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD|BUTTON_REPEAT },
156 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
157};
158
159static const struct button_mapping button_context_settings[] = {
160 { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
161 { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
162 { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
163 { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
164 { ACTION_STD_PREV, BUTTON_REW, BUTTON_NONE },
165 { ACTION_STD_PREVREPEAT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
166 { ACTION_STD_NEXT, BUTTON_FFWD, BUTTON_NONE },
167 { ACTION_STD_NEXTREPEAT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE },
168 { ACTION_SETTINGS_RESET, BUTTON_RIGHT, BUTTON_NONE },
169
170 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
171}; /* button_context_settings */
172
173static const struct button_mapping button_context_settings_right_is_inc[] = {
174 { ACTION_SETTINGS_INC, BUTTON_FFWD, BUTTON_NONE },
175 { ACTION_SETTINGS_INCREPEAT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE },
176 { ACTION_SETTINGS_DEC, BUTTON_REW, BUTTON_NONE },
177 { ACTION_SETTINGS_DECREPEAT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
178 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
179 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
180 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
181 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
182 { ACTION_SETTINGS_RESET, BUTTON_RIGHT, BUTTON_NONE },
183
184 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
185}; /* button_context_settingsgraphical */
186
187static const struct button_mapping button_context_yesno[] = {
188 { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
189 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
190}; /* button_context_settings_yesno */
191
192static const struct button_mapping button_context_colorchooser[] = {
193 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
194 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
195}; /* button_context_colorchooser */
196
197static const struct button_mapping button_context_eq[] = {
198 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
199 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
200}; /* button_context_eq */
201
202/** Bookmark Screen **/
203static const struct button_mapping button_context_bmark[] = {
204 { ACTION_BMS_DELETE, BUTTON_RIGHT, BUTTON_NONE },
205
206 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
207}; /* button_context_bmark */
208
209static const struct button_mapping button_context_time[] = {
210 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
211 { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
212 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS),
213}; /* button_context_time */
214
215static const struct button_mapping button_context_quickscreen[] = {
216 { ACTION_QS_DOWNINV, BUTTON_UP, BUTTON_NONE },
217 { ACTION_QS_DOWNINV, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
218 { ACTION_QS_DOWN, BUTTON_DOWN, BUTTON_NONE },
219 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
220 { ACTION_QS_LEFT, BUTTON_REW, BUTTON_NONE },
221 { ACTION_QS_LEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
222 { ACTION_QS_RIGHT, BUTTON_FFWD, BUTTON_NONE },
223 { ACTION_QS_RIGHT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE },
224 { ACTION_STD_CANCEL, BUTTON_MENU, BUTTON_NONE },
225
226 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
227}; /* button_context_quickscreen */
228
229static const struct button_mapping button_context_pitchscreen[] = {
230 { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE },
231 { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
232 { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE },
233 { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
234 { ACTION_PS_NUDGE_LEFT, BUTTON_REW, BUTTON_NONE },
235 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_REW|BUTTON_REL, BUTTON_NONE },
236 { ACTION_PS_NUDGE_RIGHT, BUTTON_FFWD, BUTTON_NONE },
237 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_FFWD|BUTTON_REL, BUTTON_NONE },
238 { ACTION_PS_TOGGLE_MODE, BUTTON_MENU, BUTTON_NONE },
239 { ACTION_PS_RESET, BUTTON_RIGHT, BUTTON_NONE },
240 { ACTION_PS_EXIT, BUTTON_POWER, BUTTON_NONE },
241
242 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
243}; /* button_context_pitchcreen */
244
245static const struct button_mapping button_context_keyboard[] = {
246 { ACTION_KBD_LEFT, BUTTON_REW, BUTTON_NONE },
247 { ACTION_KBD_LEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
248 { ACTION_KBD_RIGHT, BUTTON_FFWD, BUTTON_NONE },
249 { ACTION_KBD_RIGHT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE },
250 { ACTION_KBD_CURSOR_LEFT, BUTTON_RIGHT|BUTTON_REW, BUTTON_NONE },
251 { ACTION_KBD_CURSOR_LEFT, BUTTON_RIGHT|BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
252 { ACTION_KBD_CURSOR_RIGHT, BUTTON_RIGHT|BUTTON_FFWD, BUTTON_NONE },
253 { ACTION_KBD_CURSOR_RIGHT, BUTTON_RIGHT|BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE },
254 { ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE },
255 { ACTION_KBD_PAGE_FLIP, BUTTON_RIGHT|BUTTON_MENU, BUTTON_NONE },
256 { ACTION_KBD_DONE, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
257 { ACTION_KBD_ABORT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
258 { ACTION_KBD_BACKSPACE, BUTTON_MENU, BUTTON_NONE },
259 { ACTION_KBD_BACKSPACE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
260 { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE },
261 { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
262 { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
263 { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
264 { ACTION_KBD_MORSE_INPUT, BUTTON_RIGHT|BUTTON_POWER, BUTTON_NONE },
265 { ACTION_KBD_MORSE_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
266
267 LAST_ITEM_IN_LIST
268}; /* button_context_keyboard */
269
270const struct button_mapping* get_context_mapping(int context)
271{
272 switch (context)
273 {
274 case CONTEXT_STD:
275 return button_context_standard;
276 case CONTEXT_WPS:
277 return button_context_wps;
278
279 case CONTEXT_LIST:
280 return button_context_list;
281 case CONTEXT_MAINMENU:
282 case CONTEXT_TREE:
283 if (global_settings.hold_lr_for_scroll_in_list)
284 return button_context_listtree_scroll_without_combo;
285 else
286 return button_context_listtree_scroll_with_combo;
287 case CONTEXT_CUSTOM|CONTEXT_TREE:
288 return button_context_tree;
289
290 case CONTEXT_SETTINGS:
291 return button_context_settings;
292 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
293 return button_context_settings_right_is_inc;
294
295 case CONTEXT_SETTINGS_COLOURCHOOSER:
296 return button_context_colorchooser;
297 case CONTEXT_SETTINGS_EQ:
298 return button_context_eq;
299
300 case CONTEXT_SETTINGS_TIME:
301 return button_context_time;
302
303 case CONTEXT_YESNOSCREEN:
304 return button_context_yesno;
305 case CONTEXT_BOOKMARKSCREEN:
306 return button_context_bmark;
307 case CONTEXT_QUICKSCREEN:
308 return button_context_quickscreen;
309 case CONTEXT_PITCHSCREEN:
310 return button_context_pitchscreen;
311 case CONTEXT_KEYBOARD:
312 return button_context_keyboard;
313 }
314 return button_context_standard;
315}
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 2a087bb5cf..b0795d3e67 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -77,6 +77,9 @@
77# 77#
78# Olympus 78# Olympus
79# m:robe 100 mrobe100 79# m:robe 100 mrobe100
80#
81# Philips
82# GoGear SA9200 sa9200
80 83
81<phrase> 84<phrase>
82 id: LANG_SET_BOOL_YES 85 id: LANG_SET_BOOL_YES
@@ -323,13 +326,13 @@
323 <source> 326 <source>
324 *: "PLAY = Yes" 327 *: "PLAY = Yes"
325 h100,h120,h300: "NAVI = Yes" 328 h100,h120,h300: "NAVI = Yes"
326 ipod*,x5,m5,gigabeat*,e200,c200,h10,h10_5gb,mrobe100: "SELECT = Yes" 329 ipod*,x5,m5,gigabeat*,e200,c200,h10,h10_5gb,mrobe100,sa9200: "SELECT = Yes"
327 player: "(PLAY/STOP)" 330 player: "(PLAY/STOP)"
328 </source> 331 </source>
329 <dest> 332 <dest>
330 *: "PLAY = Yes" 333 *: "PLAY = Yes"
331 h100,h120,h300: "NAVI = Yes" 334 h100,h120,h300: "NAVI = Yes"
332 ipod*,x5,m5,gigabeat*,e200,c200,h10,h10_5gb,mrobe100: "SELECT = Yes" 335 ipod*,x5,m5,gigabeat*,e200,c200,h10,h10_5gb,mrobe100,sa9200: "SELECT = Yes"
333 player: "(PLAY/STOP)" 336 player: "(PLAY/STOP)"
334 </dest> 337 </dest>
335 <voice> 338 <voice>
@@ -2425,14 +2428,14 @@
2425 h100,h120,h300: "Building database... %d found (STOP to return)" 2428 h100,h120,h300: "Building database... %d found (STOP to return)"
2426 ipod*: "Building database... %d found (PREV to return)" 2429 ipod*: "Building database... %d found (PREV to return)"
2427 x5,m5,gigabeat*,mrobe100: "Building database... %d found (LEFT to return)" 2430 x5,m5,gigabeat*,mrobe100: "Building database... %d found (LEFT to return)"
2428 h10,h10_5gb,e200,c200: "Building database... %d found (PREV to return)" 2431 h10,h10_5gb,e200,c200,sa9200: "Building database... %d found (PREV to return)"
2429 </source> 2432 </source>
2430 <dest> 2433 <dest>
2431 *: "Building database... %d found (OFF to return)" 2434 *: "Building database... %d found (OFF to return)"
2432 h100,h120,h300: "Building database... %d found (STOP to return)" 2435 h100,h120,h300: "Building database... %d found (STOP to return)"
2433 ipod*: "Building database... %d found (PREV to return)" 2436 ipod*: "Building database... %d found (PREV to return)"
2434 x5,m5,gigabeat*,mrobe100: "Building database... %d found (LEFT to return)" 2437 x5,m5,gigabeat*,mrobe100: "Building database... %d found (LEFT to return)"
2435 h10,h10_5gb,e200,c200: "Building database... %d found (PREV to return)" 2438 h10,h10_5gb,e200,c200,sa9200: "Building database... %d found (PREV to return)"
2436 </dest> 2439 </dest>
2437 <voice> 2440 <voice>
2438 *: "entries found for database" 2441 *: "entries found for database"
@@ -3891,17 +3894,17 @@
3891 <source> 3894 <source>
3892 *: none 3895 *: none
3893 e200: "Wheel Light Timeout" 3896 e200: "Wheel Light Timeout"
3894 c200,gigabeatf,mrobe100: "Button Light Timeout" 3897 c200,gigabeatf,mrobe100,sa9200: "Button Light Timeout"
3895 </source> 3898 </source>
3896 <dest> 3899 <dest>
3897 *: none 3900 *: none
3898 e200: "Wheel Light Timeout" 3901 e200: "Wheel Light Timeout"
3899 c200,gigabeatf,mrobe100: "Button Light Timeout" 3902 c200,gigabeatf,mrobe100,sa9200: "Button Light Timeout"
3900 </dest> 3903 </dest>
3901 <voice> 3904 <voice>
3902 *: none 3905 *: none
3903 e200: "Wheel Light Timeout" 3906 e200: "Wheel Light Timeout"
3904 c200,gigabeatf,mrobe100: "Button Light Timeout" 3907 c200,gigabeatf,mrobe100,sa9200: "Button Light Timeout"
3905 </voice> 3908 </voice>
3906</phrase> 3909</phrase>
3907<phrase> 3910<phrase>
@@ -4183,17 +4186,17 @@
4183 *: none 4186 *: none
4184 rtc: "ON = Set" 4187 rtc: "ON = Set"
4185 h100,h120,h300: "NAVI = Set" 4188 h100,h120,h300: "NAVI = Set"
4186 ipod*,x5,m5,h10,h10_5gb,e200,c200,gigabeat*,mrobe100: "SELECT = Set" 4189 ipod*,x5,m5,h10,h10_5gb,e200,c200,gigabeat*,mrobe100,sa9200: "SELECT = Set"
4187 </source> 4190 </source>
4188 <dest> 4191 <dest>
4189 *: none 4192 *: none
4190 rtc: "ON = Set" 4193 rtc: "ON = Set"
4191 h100,h120,h300: "NAVI = Set" 4194 h100,h120,h300: "NAVI = Set"
4192 ipod*,x5,m5,h10,h10_5gb,e200,c200,gigabeat*,mrobe100: "SELECT = Set" 4195 ipod*,x5,m5,h10,h10_5gb,e200,c200,gigabeat*,mrobe100,sa9200: "SELECT = Set"
4193 </dest> 4196 </dest>
4194 <voice> 4197 <voice>
4195 *: none 4198 *: none
4196 rtc,h100,h120,h300,h10,h10_5gb,x5,m5,ipod*,e200,c200,gigabeat*,mrobe100: "" 4199 rtc,h100,h120,h300,h10,h10_5gb,x5,m5,ipod*,e200,c200,gigabeat*,mrobe100,sa9200: ""
4197 </voice> 4200 </voice>
4198</phrase> 4201</phrase>
4199<phrase> 4202<phrase>
@@ -4204,7 +4207,7 @@
4204 *: none 4207 *: none
4205 rtc: "OFF = Revert" 4208 rtc: "OFF = Revert"
4206 h100,h120,h300: "STOP = Revert" 4209 h100,h120,h300: "STOP = Revert"
4207 ipod*,e200,c200: "MENU = Revert" 4210 ipod*,e200,c200,sa9200: "MENU = Revert"
4208 x5,m5: "RECORD = Revert" 4211 x5,m5: "RECORD = Revert"
4209 h10,h10_5gb: "PREV = Revert" 4212 h10,h10_5gb: "PREV = Revert"
4210 gigabeatf: "A = Revert" 4213 gigabeatf: "A = Revert"
@@ -4215,7 +4218,7 @@
4215 *: none 4218 *: none
4216 rtc: "OFF = Revert" 4219 rtc: "OFF = Revert"
4217 h100,h120,h300: "STOP = Revert" 4220 h100,h120,h300: "STOP = Revert"
4218 ipod*,e200,c200: "MENU = Revert" 4221 ipod*,e200,c200,sa9200: "MENU = Revert"
4219 x5,m5: "RECORD = Revert" 4222 x5,m5: "RECORD = Revert"
4220 h10,h10_5gb: "PREV = Revert" 4223 h10,h10_5gb: "PREV = Revert"
4221 gigabeatf: "A = Revert" 4224 gigabeatf: "A = Revert"
@@ -4224,7 +4227,7 @@
4224 </dest> 4227 </dest>
4225 <voice> 4228 <voice>
4226 *: none 4229 *: none
4227 rtc,h100,h120,h300,ipod*,e200,c200,x5,m5,h10,h10_gb,gigabeat*,mrobe100: "" 4230 rtc,h100,h120,h300,ipod*,e200,c200,x5,m5,h10,h10_gb,gigabeat*,mrobe100,sa9200: ""
4228 </voice> 4231 </voice>
4229</phrase> 4232</phrase>
4230<phrase> 4233<phrase>
diff --git a/apps/plugins/lib/pluginlib_actions.c b/apps/plugins/lib/pluginlib_actions.c
index a63ffb352a..6a008303da 100644
--- a/apps/plugins/lib/pluginlib_actions.c
+++ b/apps/plugins/lib/pluginlib_actions.c
@@ -84,7 +84,8 @@ const struct button_mapping generic_directions[] =
84 || (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) \ 84 || (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) \
85 || (CONFIG_KEYPAD == SANSA_C200_PAD) \ 85 || (CONFIG_KEYPAD == SANSA_C200_PAD) \
86 || (CONFIG_KEYPAD == GIGABEAT_S_PAD) \ 86 || (CONFIG_KEYPAD == GIGABEAT_S_PAD) \
87 || (CONFIG_KEYPAD == MROBE100_PAD) 87 || (CONFIG_KEYPAD == MROBE100_PAD) \
88 || (CONFIG_KEYPAD == PHILIPS_SA9200_PAD)
88 { PLA_UP, BUTTON_UP, BUTTON_NONE}, 89 { PLA_UP, BUTTON_UP, BUTTON_NONE},
89 { PLA_DOWN, BUTTON_DOWN, BUTTON_NONE}, 90 { PLA_DOWN, BUTTON_DOWN, BUTTON_NONE},
90 { PLA_LEFT, BUTTON_LEFT, BUTTON_NONE}, 91 { PLA_LEFT, BUTTON_LEFT, BUTTON_NONE},
@@ -173,7 +174,8 @@ const struct button_mapping generic_left_right_fire[] =
173 || (CONFIG_KEYPAD == GIGABEAT_PAD) \ 174 || (CONFIG_KEYPAD == GIGABEAT_PAD) \
174 || (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) \ 175 || (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) \
175 || (CONFIG_KEYPAD == GIGABEAT_S_PAD) \ 176 || (CONFIG_KEYPAD == GIGABEAT_S_PAD) \
176 || (CONFIG_KEYPAD == MROBE100_PAD) 177 || (CONFIG_KEYPAD == MROBE100_PAD) \
178 || (CONFIG_KEYPAD == PHILIPS_SA9200_PAD)
177 { PLA_LEFT, BUTTON_LEFT, BUTTON_NONE}, 179 { PLA_LEFT, BUTTON_LEFT, BUTTON_NONE},
178 { PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE}, 180 { PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE},
179 { PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE}, 181 { PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE},
@@ -381,6 +383,12 @@ const struct button_mapping generic_actions[] =
381 {PLA_MENU, BUTTON_RC_MENU, BUTTON_NONE}, 383 {PLA_MENU, BUTTON_RC_MENU, BUTTON_NONE},
382 {PLA_FIRE, BUTTON_RC_MODE, BUTTON_NONE}, 384 {PLA_FIRE, BUTTON_RC_MODE, BUTTON_NONE},
383 {PLA_FIRE_REPEAT, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_NONE}, 385 {PLA_FIRE_REPEAT, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_NONE},
386#elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
387 {PLA_QUIT, BUTTON_POWER, BUTTON_NONE},
388 {PLA_START, BUTTON_RIGHT, BUTTON_NONE},
389 {PLA_MENU, BUTTON_MENU, BUTTON_NONE},
390 {PLA_FIRE, BUTTON_SELECT, BUTTON_NONE},
391 {PLA_FIRE_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
384#else 392#else
385 #error pluginlib_actions: Unsupported keypad 393 #error pluginlib_actions: Unsupported keypad
386#endif 394#endif
@@ -404,7 +412,8 @@ const struct button_mapping generic_increase_decrease[] =
404 || (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) \ 412 || (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) \
405 || (CONFIG_KEYPAD == ONDIO_PAD) \ 413 || (CONFIG_KEYPAD == ONDIO_PAD) \
406 || (CONFIG_KEYPAD == GIGABEAT_S_PAD) \ 414 || (CONFIG_KEYPAD == GIGABEAT_S_PAD) \
407 || (CONFIG_KEYPAD == MROBE100_PAD) 415 || (CONFIG_KEYPAD == MROBE100_PAD) \
416 || (CONFIG_KEYPAD == PHILIPS_SA9200_PAD)
408 {PLA_INC, BUTTON_UP, BUTTON_NONE}, 417 {PLA_INC, BUTTON_UP, BUTTON_NONE},
409 {PLA_DEC, BUTTON_DOWN, BUTTON_NONE}, 418 {PLA_DEC, BUTTON_DOWN, BUTTON_NONE},
410 {PLA_INC_REPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE}, 419 {PLA_INC_REPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE},
diff --git a/bootloader/SOURCES b/bootloader/SOURCES
index 40b2f5dc2a..c38b8ade1f 100644
--- a/bootloader/SOURCES
+++ b/bootloader/SOURCES
@@ -9,7 +9,7 @@ gigabeat-s.c
9../firmware/target/arm/imx31/gigabeat-s/mmu-imx31.c 9../firmware/target/arm/imx31/gigabeat-s/mmu-imx31.c
10#elif defined(IRIVER_H10) || defined(IRIVER_H10_5GB) || \ 10#elif defined(IRIVER_H10) || defined(IRIVER_H10_5GB) || \
11 defined(SANSA_E200) || defined(SANSA_C200) || \ 11 defined(SANSA_E200) || defined(SANSA_C200) || \
12 defined(MROBE_100) 12 defined(MROBE_100) || defined(PHILIPS_SA9200)
13#ifdef E200R_INSTALLER 13#ifdef E200R_INSTALLER
14main-e200r-installer.c 14main-e200r-installer.c
15#else 15#else
diff --git a/bootloader/common.c b/bootloader/common.c
index e6b8f5a7d2..66a60c5f6c 100644
--- a/bootloader/common.c
+++ b/bootloader/common.c
@@ -31,7 +31,8 @@
31/* TODO: Other bootloaders need to be adjusted to set this variable to true 31/* TODO: Other bootloaders need to be adjusted to set this variable to true
32 on a button press - currently only the ipod, H10 and Sansa versions do. */ 32 on a button press - currently only the ipod, H10 and Sansa versions do. */
33#if defined(IPOD_ARCH) || defined(IRIVER_H10) || defined(IRIVER_H10_5GB) \ 33#if defined(IPOD_ARCH) || defined(IRIVER_H10) || defined(IRIVER_H10_5GB) \
34 || defined(SANSA_E200) || defined(SANSA_C200) || defined(GIGABEAT_F) 34 || defined(SANSA_E200) || defined(SANSA_C200) || defined(GIGABEAT_F) \
35 || defined(PHILIPS_SA9200)
35bool verbose = false; 36bool verbose = false;
36#else 37#else
37bool verbose = true; 38bool verbose = true;
diff --git a/bootloader/main-pp.c b/bootloader/main-pp.c
index 07222139e7..dee728d8ed 100644
--- a/bootloader/main-pp.c
+++ b/bootloader/main-pp.c
@@ -34,11 +34,11 @@
34#include "crc32-mi4.h" 34#include "crc32-mi4.h"
35#include <string.h> 35#include <string.h>
36#include "power.h" 36#include "power.h"
37#if defined(SANSA_E200) 37#if defined(SANSA_E200) || defined(PHILIPS_SA9200)
38#include "i2c.h" 38#include "i2c.h"
39#include "backlight-target.h" 39#include "backlight-target.h"
40#endif 40#endif
41#if defined(SANSA_E200) || defined(SANSA_C200) 41#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200)
42#include "usb.h" 42#include "usb.h"
43#include "usb_drv.h" 43#include "usb_drv.h"
44#endif 44#endif
@@ -59,6 +59,8 @@ extern int show_logo(void);
59#elif CONFIG_KEYPAD == MROBE100_PAD 59#elif CONFIG_KEYPAD == MROBE100_PAD
60#define BOOTLOADER_BOOT_OF BUTTON_POWER 60#define BOOTLOADER_BOOT_OF BUTTON_POWER
61 61
62#elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
63#define BOOTLOADER_BOOT_OF BUTTON_VOL_UP
62#endif 64#endif
63 65
64/* Maximum allowed firmware image size. 10MB is more than enough */ 66/* Maximum allowed firmware image size. 10MB is more than enough */
@@ -71,7 +73,7 @@ unsigned char *loadbuffer = (unsigned char *)DRAM_START;
71char version[] = APPSVERSION; 73char version[] = APPSVERSION;
72 74
73/* Locations and sizes in hidden partition on Sansa */ 75/* Locations and sizes in hidden partition on Sansa */
74#if defined(SANSA_E200) || defined(SANSA_C200) 76#if defined(HAVE_ATA_SD)
75#define PPMI_SECTOR_OFFSET 1024 77#define PPMI_SECTOR_OFFSET 1024
76#define PPMI_SECTORS 1 78#define PPMI_SECTORS 1
77#define MI4_HEADER_SECTORS 1 79#define MI4_HEADER_SECTORS 1
@@ -351,7 +353,7 @@ int load_mi4(unsigned char* buf, char* firmware, unsigned int buffer_size)
351 return EOK; 353 return EOK;
352} 354}
353 355
354#if defined(SANSA_E200) || defined(SANSA_C200) 356#if defined(HAVE_ATA_SD)
355/* Load mi4 firmware from a hidden disk partition */ 357/* Load mi4 firmware from a hidden disk partition */
356int load_mi4_part(unsigned char* buf, struct partinfo* pinfo, 358int load_mi4_part(unsigned char* buf, struct partinfo* pinfo,
357 unsigned int buffer_size, bool disable_rebuild) 359 unsigned int buffer_size, bool disable_rebuild)
@@ -432,7 +434,7 @@ void* main(void)
432 int rc; 434 int rc;
433 int num_partitions; 435 int num_partitions;
434 struct partinfo* pinfo; 436 struct partinfo* pinfo;
435#if defined(SANSA_E200) || defined(SANSA_C200) 437#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200)
436 int usb_retry = 0; 438 int usb_retry = 0;
437 bool usb = false; 439 bool usb = false;
438#else 440#else
@@ -451,12 +453,11 @@ void* main(void)
451 show_logo(); 453 show_logo();
452 454
453 button_init(); 455 button_init();
454#if defined(SANSA_E200) 456#if defined(SANSA_E200) || defined(PHILIPS_SA9200)
455 i2c_init(); 457 i2c_init();
456 _backlight_on(); 458 _backlight_on();
457#endif 459#endif
458 460
459
460 if (button_hold()) 461 if (button_hold())
461 { 462 {
462 verbose = true; 463 verbose = true;
@@ -466,7 +467,7 @@ void* main(void)
466 sleep(HZ); 467 sleep(HZ);
467 power_off(); 468 power_off();
468 } 469 }
469 470
470 btn = button_read_device(); 471 btn = button_read_device();
471 472
472 /* Enable bootloader messages if any button is pressed */ 473 /* Enable bootloader messages if any button is pressed */
@@ -475,7 +476,7 @@ void* main(void)
475 verbose = true; 476 verbose = true;
476 } 477 }
477 478
478#if defined(SANSA_E200) || defined(SANSA_C200) 479#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200)
479#if !defined(USE_ROCKBOX_USB) 480#if !defined(USE_ROCKBOX_USB)
480 usb_init(); 481 usb_init();
481 while (usb_drv_powered() && usb_retry < 5 && !usb) 482 while (usb_drv_powered() && usb_retry < 5 && !usb)
@@ -496,7 +497,7 @@ void* main(void)
496 printf(MODEL_NAME); 497 printf(MODEL_NAME);
497 498
498 i=ata_init(); 499 i=ata_init();
499#if !defined(SANSA_E200) && !defined(SANSA_C200) 500#if !defined(HAVE_ATA_SD)
500 if (i==0) { 501 if (i==0) {
501 identify_info=ata_get_identify(); 502 identify_info=ata_get_identify();
502 /* Show model */ 503 /* Show model */
@@ -540,7 +541,7 @@ void* main(void)
540 */ 541 */
541 printf("Loading original firmware..."); 542 printf("Loading original firmware...");
542 543
543#if defined(SANSA_E200) || defined(SANSA_C200) 544#if defined(HAVE_ATA_SD)
544 /* First try a (hidden) firmware partition */ 545 /* First try a (hidden) firmware partition */
545 printf("Trying firmware partition"); 546 printf("Trying firmware partition");
546 pinfo = disk_partinfo(1); 547 pinfo = disk_partinfo(1);
@@ -617,7 +618,7 @@ void* main(void)
617 return (void*)loadbuffer; 618 return (void*)loadbuffer;
618} 619}
619 620
620#if !defined(SANSA_E200) && !defined(SANSA_C200) 621#if !defined(SANSA_E200) && !defined(SANSA_C200) && !defined(PHILIPS_SA9200)
621/* These functions are present in the firmware library, but we reimplement 622/* These functions are present in the firmware library, but we reimplement
622 them here because the originals do a lot more than we want */ 623 them here because the originals do a lot more than we want */
623void usb_acknowledge(void) 624void usb_acknowledge(void)
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 0d7261632d..bbdd0bc5a2 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -118,7 +118,7 @@ drivers/ata_flash.c
118drivers/ata.c 118drivers/ata.c
119#endif /* HAVE_MMC */ 119#endif /* HAVE_MMC */
120drivers/fat.c 120drivers/fat.c
121#ifdef HAVE_HOTSWAP 121#if defined(HAVE_HOTSWAP) || defined(HAVE_ATA_SD)
122hotswap.c 122hotswap.c
123#endif 123#endif
124#endif /* SIMULATOR */ 124#endif /* SIMULATOR */
@@ -467,6 +467,20 @@ target/arm/sandisk/audio-c200_e200.c
467#endif /* SIMULATOR */ 467#endif /* SIMULATOR */
468#endif /* SANSA_C200 */ 468#endif /* SANSA_C200 */
469 469
470#ifdef PHILIPS_SA9200
471#ifndef SIMULATOR
472target/arm/ata-sd-pp.c
473target/arm/philips/sa9200/lcd-sa9200.c
474target/arm/adc-as3514.c
475target/arm/philips/sa9200/backlight-sa9200.c
476target/arm/usb-fw-pp502x.c
477target/arm/philips/sa9200/button-sa9200.c
478target/arm/philips/sa9200/power-sa9200.c
479target/arm/philips/sa9200/powermgmt-sa9200.c
480target/arm/i2s-pp.c
481#endif /* SIMULATOR */
482#endif /* PHILIPS_SA9200 */
483
470#ifdef IAUDIO_X5 484#ifdef IAUDIO_X5
471#ifndef SIMULATOR 485#ifndef SIMULATOR
472target/coldfire/ata-as-coldfire.S 486target/coldfire/ata-as-coldfire.S
diff --git a/firmware/drivers/audio/as3514.c b/firmware/drivers/audio/as3514.c
index e1f325c3fe..b801375846 100644
--- a/firmware/drivers/audio/as3514.c
+++ b/firmware/drivers/audio/as3514.c
@@ -37,9 +37,11 @@ const struct sound_settings_info audiohw_settings[] = {
37 [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, 37 [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
38 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, 38 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
39 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100}, 39 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
40#if defined(HAVE_RECORDING)
40 [SOUND_MIC_GAIN] = {"dB", 1, 1, 0, 39, 23}, 41 [SOUND_MIC_GAIN] = {"dB", 1, 1, 0, 39, 23},
41 [SOUND_LEFT_GAIN] = {"dB", 1, 1, 0, 31, 23}, 42 [SOUND_LEFT_GAIN] = {"dB", 1, 1, 0, 31, 23},
42 [SOUND_RIGHT_GAIN] = {"dB", 1, 1, 0, 31, 23}, 43 [SOUND_RIGHT_GAIN] = {"dB", 1, 1, 0, 31, 23},
44#endif
43}; 45};
44 46
45/* Shadow registers */ 47/* Shadow registers */
@@ -112,11 +114,13 @@ int sound_val2phys(int setting, int value)
112 114
113 switch(setting) 115 switch(setting)
114 { 116 {
117#if defined(HAVE_RECORDING)
115 case SOUND_LEFT_GAIN: 118 case SOUND_LEFT_GAIN:
116 case SOUND_RIGHT_GAIN: 119 case SOUND_RIGHT_GAIN:
117 case SOUND_MIC_GAIN: 120 case SOUND_MIC_GAIN:
118 result = (value - 23) * 15; 121 result = (value - 23) * 15;
119 break; 122 break;
123#endif
120 124
121 default: 125 default:
122 result = value; 126 result = value;
@@ -292,6 +296,7 @@ void audiohw_set_sample_rate(int sampling_control)
292 (void)sampling_control; 296 (void)sampling_control;
293} 297}
294 298
299#if defined(HAVE_RECORDING)
295void audiohw_enable_recording(bool source_mic) 300void audiohw_enable_recording(bool source_mic)
296{ 301{
297 if (source_mic) { 302 if (source_mic) {
@@ -417,3 +422,4 @@ void audiohw_set_monitor(bool enable)
417 /* Sync mixer volume */ 422 /* Sync mixer volume */
418 audiohw_set_master_vol(as3514.vol_l, as3514.vol_r); 423 audiohw_set_master_vol(as3514.vol_l, as3514.vol_r);
419} 424}
425#endif /* HAVE_RECORDING */
diff --git a/firmware/export/as3514.h b/firmware/export/as3514.h
index f6f759b75c..6edb5878f3 100644
--- a/firmware/export/as3514.h
+++ b/firmware/export/as3514.h
@@ -77,7 +77,7 @@ extern void audiohw_set_sample_rate(int sampling_control);
77#define VOLUME_MIN -735 77#define VOLUME_MIN -735
78#define VOLUME_MAX 60 78#define VOLUME_MAX 60
79 79
80#if defined(SANSA_E200) || defined(SANSA_C200) 80#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200)
81#define AS3514_I2C_ADDR 0x46 81#define AS3514_I2C_ADDR 0x46
82#endif 82#endif
83 83
diff --git a/firmware/export/config-sa9200.h b/firmware/export/config-sa9200.h
new file mode 100755
index 0000000000..9cdfe6bba7
--- /dev/null
+++ b/firmware/export/config-sa9200.h
@@ -0,0 +1,167 @@
1/*
2 * This config file is for the Philips GoGear SA9200
3 */
4#define TARGET_TREE /* this target is using the target tree system */
5
6/* For Rolo and boot loader */
7#define MODEL_NUMBER 26
8#define MODEL_NAME "Philips GoGear SA200"
9
10#define HW_SAMPR_CAPS (SAMPR_CAP_44)
11
12/* define this if you have a bitmap LCD display */
13#define HAVE_LCD_BITMAP
14
15/* define this if you have a colour LCD */
16#define HAVE_LCD_COLOR
17
18/* define this if you want album art for this target */
19#define HAVE_ALBUMART
20
21/* define this if you have a light associated with the buttons */
22#define HAVE_BUTTON_LIGHT
23
24/* define this if you have access to the quickscreen */
25#define HAVE_QUICKSCREEN
26
27/* define this if you have access to the pitchscreen */
28#define HAVE_PITCHSCREEN
29
30/* define this if you would like tagcache to build on this target */
31#define HAVE_TAGCACHE
32
33/* LCD dimensions */
34#define LCD_WIDTH 128
35#define LCD_HEIGHT 160
36#define LCD_DEPTH 16 /* 65536 colours */
37#define LCD_PIXELFORMAT RGB565 /* rgb565 */
38
39/* define this if you have LCD enable function */
40/* #define HAVE_LCD_ENABLE */
41
42/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE
43 should be defined as well. */
44/* #define HAVE_LCD_SLEEP */
45
46/* define this if you can flip your LCD */
47/* #define HAVE_LCD_FLIP */
48
49/* define this if you can invert the colours on your LCD */
50/* #define HAVE_LCD_INVERT */
51
52/* #define IRAM_LCDFRAMEBUFFER IDATA_ATTR *//* put the lcd frame buffer in IRAM */
53
54#define CONFIG_KEYPAD PHILIPS_SA9200_PAD
55
56/* Define this if you do software codec */
57#define CONFIG_CODEC SWCODEC
58
59/* There is no hardware tone control */
60#define HAVE_SW_TONE_CONTROLS
61
62/* The PP5024 has a built-in AustriaMicrosystems AS3514 */
63#define HAVE_AS3514
64
65/* define this if you have a real-time clock */
66#ifndef BOOTLOADER
67#define CONFIG_RTC RTC_AS3514
68#endif
69
70/* Define this if you have a software controlled poweroff */
71#define HAVE_SW_POWEROFF
72
73/* Some Sansa E200s seem to be FAT16 formatted */
74#define HAVE_FAT16SUPPORT
75
76/* The number of bytes reserved for loadable codecs */
77#define CODEC_SIZE 0x80000
78
79/* The number of bytes reserved for loadable plugins */
80#define PLUGIN_BUFFER_SIZE 0x80000
81
82#define AB_REPEAT_ENABLE 1
83
84/* Define this for LCD backlight available */
85#define HAVE_BACKLIGHT
86#define HAVE_BACKLIGHT_BRIGHTNESS
87
88/* Main LCD backlight brightness range and defaults */
89#define MIN_BRIGHTNESS_SETTING 1
90#define MAX_BRIGHTNESS_SETTING 12
91#define DEFAULT_BRIGHTNESS_SETTING 6
92
93/* define this if you have a flash memory storage */
94#define HAVE_FLASH_STORAGE
95
96/* define this if the flash memory uses the SecureDigital Memory Card protocol */
97#define HAVE_ATA_SD
98
99#define BATTERY_CAPACITY_DEFAULT 750 /* default battery capacity */
100#define BATTERY_CAPACITY_MIN 750 /* min. capacity selectable */
101#define BATTERY_CAPACITY_MAX 750 /* max. capacity selectable */
102#define BATTERY_CAPACITY_INC 0 /* capacity increment */
103#define BATTERY_TYPES_COUNT 1 /* only one type */
104
105/* Hardware controlled charging? FIXME */
106#define CONFIG_CHARGING CHARGING_SIMPLE
107
108/* define this if the unit can be powered or charged via USB */
109#define HAVE_USB_POWER
110
111/** Non-simulator section **/
112#ifndef SIMULATOR
113
114/* Define this if you have a PortalPlayer PP5024 */
115#define CONFIG_CPU PP5024
116
117/* Define this if you want to use the PP5024 i2c interface */
118#define CONFIG_I2C I2C_PP5024
119
120/* define this if the hardware can be powered off while charging */
121/* Sansa can't be powered off while charging */
122/* #define HAVE_POWEROFF_WHILE_CHARGING */
123
124/* The start address index for ROM builds */
125#define ROM_START 0x00000000
126
127/* Define this to the CPU frequency */
128#define CPU_FREQ 75000000
129
130/* Type of LCD TODO: hopefully the same as the x5 but check this*/
131#define CONFIG_LCD LCD_SA9200
132
133/* #define USB_IPODSTYLE */
134
135/* USB On-the-go */
136#define CONFIG_USBOTG USBOTG_ARC
137
138/* enable these for the experimental usb stack */
139#define HAVE_USBSTACK
140#define USB_VENDOR_ID 0x0471
141#define USB_PRODUCT_ID 0x014f
142
143/* WARNING! Enable Rockbox USB mass storage. */
144#ifndef BOOTLOADER
145#define USE_ROCKBOX_USB
146#endif
147
148/* Virtual LED (icon) */
149#define CONFIG_LED LED_VIRTUAL
150
151/* Define this if you have adjustable CPU frequency */
152#define HAVE_ADJUSTABLE_CPU_FREQ
153
154#define MI4_FORMAT
155#define BOOTFILE_EXT "mi4"
156#define BOOTFILE "rockbox." BOOTFILE_EXT
157#define BOOTDIR "/.rockbox"
158
159/* These values are unused, but need to be defined */
160#define FIRMWARE_OFFSET_FILE_CRC 0x0
161#define FIRMWARE_OFFSET_FILE_DATA 0x8
162
163#define ICODE_ATTR_TREMOR_NOT_MDCT
164
165#define INCLUDE_TIMEOUT_API
166
167#endif /* SIMULATOR */
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 51c79abccf..c200355872 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -82,6 +82,7 @@
82#define CREATIVEZVM_PAD 24 82#define CREATIVEZVM_PAD 24
83#define SANSA_M200_PAD 25 83#define SANSA_M200_PAD 25
84#define CREATIVEZV_PAD 26 84#define CREATIVEZV_PAD 26
85#define PHILIPS_SA9200_PAD 27
85 86
86/* CONFIG_REMOTE_KEYPAD */ 87/* CONFIG_REMOTE_KEYPAD */
87#define H100_REMOTE 1 88#define H100_REMOTE 1
@@ -120,6 +121,7 @@
120#define LCD_CREATIVEZVM 22 /* as used by Creative Zen Vision:M */ 121#define LCD_CREATIVEZVM 22 /* as used by Creative Zen Vision:M */
121#define LCD_TL0350A 23 /* as used by the iAudio M3 remote, treated as main LCD */ 122#define LCD_TL0350A 23 /* as used by the iAudio M3 remote, treated as main LCD */
122#define LCD_COWOND2 24 /* as used by Cowon D2 - LTV250QV, TCC7801 driver */ 123#define LCD_COWOND2 24 /* as used by Cowon D2 - LTV250QV, TCC7801 driver */
124#define LCD_SA9200 25 /* as used by the Philips SA9200 */
123 125
124/* LCD_PIXELFORMAT */ 126/* LCD_PIXELFORMAT */
125#define HORIZONTAL_PACKING 1 127#define HORIZONTAL_PACKING 1
@@ -258,6 +260,8 @@
258#include "config-creativezvm60gb.h" 260#include "config-creativezvm60gb.h"
259#elif defined(CREATIVE_ZV) 261#elif defined(CREATIVE_ZV)
260#include "config-creativezv.h" 262#include "config-creativezv.h"
263#elif defined(PHILIPS_SA9200)
264#include "config-sa9200.h"
261#else 265#else
262/* no known platform */ 266/* no known platform */
263#endif 267#endif
diff --git a/firmware/export/usb.h b/firmware/export/usb.h
index ff1f55cd35..0590f702c5 100644
--- a/firmware/export/usb.h
+++ b/firmware/export/usb.h
@@ -60,7 +60,8 @@ enum {
60#define USBPOWER_BUTTON BUTTON_RIGHT 60#define USBPOWER_BUTTON BUTTON_RIGHT
61#define USBPOWER_BTN_IGNORE BUTTON_POWER 61#define USBPOWER_BTN_IGNORE BUTTON_POWER
62#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \ 62#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
63 (CONFIG_KEYPAD == SANSA_C200_PAD) 63 (CONFIG_KEYPAD == SANSA_C200_PAD) || \
64 (CONFIG_KEYPAD == PHILIPS_SA9200_PAD)
64#define USBPOWER_BUTTON BUTTON_SELECT 65#define USBPOWER_BUTTON BUTTON_SELECT
65#define USBPOWER_BTN_IGNORE BUTTON_POWER 66#define USBPOWER_BTN_IGNORE BUTTON_POWER
66#endif 67#endif
diff --git a/firmware/target/arm/ata-sd-pp.c b/firmware/target/arm/ata-sd-pp.c
index e4ab922f24..797a9f8e36 100644
--- a/firmware/target/arm/ata-sd-pp.c
+++ b/firmware/target/arm/ata-sd-pp.c
@@ -526,7 +526,7 @@ static int sd_select_bank(unsigned char bank)
526static void sd_card_mux(int card_no) 526static void sd_card_mux(int card_no)
527{ 527{
528/* Set the current card mux */ 528/* Set the current card mux */
529#ifdef SANSA_E200 529#if defined(SANSA_E200) || defined(PHILIPS_SA9200)
530 if (card_no == 0) 530 if (card_no == 0)
531 { 531 {
532 GPO32_VAL |= 0x4; 532 GPO32_VAL |= 0x4;
diff --git a/firmware/target/arm/i2c-pp.c b/firmware/target/arm/i2c-pp.c
index 5799d7c37f..7dbd223ddf 100644
--- a/firmware/target/arm/i2c-pp.c
+++ b/firmware/target/arm/i2c-pp.c
@@ -209,7 +209,7 @@ void i2c_init(void)
209 outl(0x0, 0x600060a4); 209 outl(0x0, 0x600060a4);
210 outl(0x80 | (0 << 8), 0x600060a4); 210 outl(0x80 | (0 << 8), 0x600060a4);
211#elif CONFIG_I2C == I2C_PP5024 211#elif CONFIG_I2C == I2C_PP5024
212#ifdef SANSA_E200 212#if defined(SANSA_E200) || defined(PHILIPS_SA9200)
213 /* Sansa OF sets this to 0x20 first, communicates with the AS3514 213 /* Sansa OF sets this to 0x20 first, communicates with the AS3514
214 then sets it to 0x23 - this still works fine though */ 214 then sets it to 0x23 - this still works fine though */
215 outl(0x0, 0x600060a4); 215 outl(0x0, 0x600060a4);
diff --git a/firmware/target/arm/philips/app.lds b/firmware/target/arm/philips/app.lds
new file mode 100644
index 0000000000..d7159e8e1e
--- /dev/null
+++ b/firmware/target/arm/philips/app.lds
@@ -0,0 +1,198 @@
1#include "config.h"
2
3ENTRY(start)
4
5OUTPUT_FORMAT(elf32-littlearm)
6OUTPUT_ARCH(arm)
7STARTUP(target/arm/crt0-pp.o)
8
9#define PLUGINSIZE PLUGIN_BUFFER_SIZE
10#define CODECSIZE CODEC_SIZE
11
12#ifdef DEBUG
13#define STUBOFFSET 0x10000
14#else
15#define STUBOFFSET 0
16#endif
17
18#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGINSIZE - STUBOFFSET - CODECSIZE
19
20#define DRAMORIG 0x00000000 + STUBOFFSET
21#define IRAMORIG 0x40000000
22#define IRAMSIZE 0xc000
23
24#ifdef CPU_PP502x
25#define NOCACHE_BASE 0x10000000
26#else
27#define NOCACHE_BASE 0x28000000
28#endif
29
30#define CACHEALIGN_SIZE 16
31
32/* End of the audio buffer, where the codec buffer starts */
33#define ENDAUDIOADDR (DRAMORIG + DRAMSIZE)
34
35/* Where the codec buffer ends, and the plugin buffer starts */
36#define ENDADDR (ENDAUDIOADDR + CODECSIZE)
37
38MEMORY
39{
40 DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
41 IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
42}
43
44SECTIONS
45{
46 .text :
47 {
48 loadaddress = .;
49 _loadaddress = .;
50 . = ALIGN(0x200);
51 *(.init.text)
52 *(.text*)
53 *(.glue_7)
54 *(.glue_7t)
55 . = ALIGN(0x4);
56 } > DRAM
57
58 .rodata :
59 {
60 *(.rodata) /* problems without this, dunno why */
61 *(.rodata*)
62 *(.rodata.str1.1)
63 *(.rodata.str1.4)
64 . = ALIGN(0x4);
65
66 /* Pseudo-allocate the copies of the data sections */
67 _datacopy = .;
68 } > DRAM
69
70 /* TRICK ALERT! For RAM execution, we put the .data section at the
71 same load address as the copy. Thus, we don't waste extra RAM
72 when we don't actually need the copy. */
73 .data : AT ( _datacopy )
74 {
75 _datastart = .;
76 *(.data*)
77 . = ALIGN(0x4);
78 _dataend = .;
79 } > DRAM
80
81#if NOCACHE_BASE != 0
82 /* .ncdata section is placed at uncached physical alias address and is
83 * loaded at the proper cached virtual address - no copying is
84 * performed in the init code */
85 .ncdata . + NOCACHE_BASE :
86 {
87 . = ALIGN(CACHEALIGN_SIZE);
88 *(.ncdata*)
89 . = ALIGN(CACHEALIGN_SIZE);
90 } AT> DRAM
91#endif
92
93 /DISCARD/ :
94 {
95 *(.eh_frame)
96 }
97
98 .vectors 0x0 :
99 {
100 _vectorsstart = .;
101 *(.vectors);
102 _vectorsend = .;
103 } AT> DRAM
104
105 _vectorscopy = LOADADDR(.vectors);
106
107 .ibss IRAMORIG (NOLOAD) :
108 {
109 _iedata = .;
110 *(.qharray)
111 *(.ibss)
112 . = ALIGN(0x4);
113 _iend = .;
114 } > IRAM
115
116 .iram _iend :
117 {
118 _iramstart = .;
119 *(.icode)
120 *(.irodata)
121 *(.idata)
122 . = ALIGN(0x4);
123 _iramend = .;
124 } > IRAM AT> DRAM
125
126 _iramcopy = LOADADDR(.iram);
127
128 .idle_stacks (NOLOAD) :
129 {
130 *(.idle_stacks)
131#if NUM_CORES > 1
132 cpu_idlestackbegin = .;
133 . += IDLE_STACK_SIZE;
134 cpu_idlestackend = .;
135#endif
136 cop_idlestackbegin = .;
137 . += IDLE_STACK_SIZE;
138 cop_idlestackend = .;
139 } > IRAM
140
141 .stack (NOLOAD) :
142 {
143 *(.stack)
144 stackbegin = .;
145 . += 0x2000;
146 stackend = .;
147 } > IRAM
148
149 /* .bss and .ncbss are treated as a single section to use one init loop to
150 * zero it - note "_edata" and "_end" */
151 .bss ADDR(.data) + SIZEOF(.data) + SIZEOF(.ncdata) +\
152 SIZEOF(.iram) + SIZEOF(.vectors) (NOLOAD) :
153 {
154 _edata = .;
155 *(.bss*)
156 *(COMMON)
157 . = ALIGN(0x4);
158 } > DRAM
159
160#if NOCACHE_BASE != 0
161 .ncbss . + NOCACHE_BASE (NOLOAD):
162 {
163 . = ALIGN(CACHEALIGN_SIZE);
164 *(.ncbss*)
165 . = ALIGN(CACHEALIGN_SIZE);
166 } AT> DRAM
167#endif
168
169 /* This will be aligned by preceding alignments */
170 .endaddr . - NOCACHE_BASE (NOLOAD) :
171 {
172 _end = .;
173 } > DRAM
174
175 .audiobuf (NOLOAD) :
176 {
177 _audiobuffer = .;
178 audiobuffer = .;
179 } > DRAM
180
181 .audiobufend ENDAUDIOADDR (NOLOAD) :
182 {
183 audiobufend = .;
184 _audiobufend = .;
185 } > DRAM
186
187 .codec ENDAUDIOADDR (NOLOAD) :
188 {
189 codecbuf = .;
190 _codecbuf = .;
191 }
192
193 .plugin ENDADDR (NOLOAD) :
194 {
195 _pluginbuf = .;
196 pluginbuf = .;
197 }
198}
diff --git a/firmware/target/arm/philips/boot.lds b/firmware/target/arm/philips/boot.lds
new file mode 100644
index 0000000000..d115aa5949
--- /dev/null
+++ b/firmware/target/arm/philips/boot.lds
@@ -0,0 +1,65 @@
1#include "config.h"
2
3ENTRY(start)
4OUTPUT_FORMAT(elf32-littlearm)
5OUTPUT_ARCH(arm)
6STARTUP(target/arm/crt0-pp-bl.o)
7
8#define DRAMSIZE (MEMORYSIZE * 0x100000)
9
10#define DRAMORIG 0x10000000
11#ifndef IRAMORIG
12#define IRAMORIG 0x40000000
13#endif
14#define IRAMSIZE 0x20000
15#define FLASHORIG 0x001f0000
16#define FLASHSIZE 2M
17
18MEMORY
19{
20 DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
21 IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
22}
23
24SECTIONS
25{
26 . = IRAMORIG;
27
28 .text : {
29 *(.init.text)
30 *(.text*)
31 *(.glue_7)
32 *(.glue_7t)
33 } > IRAM
34
35 .data : {
36 *(.icode)
37 *(.irodata)
38 *(.idata)
39 *(.data*)
40 *(.ncdata*)
41 *(.rodata*)
42 _dataend = . ;
43 } > IRAM
44
45 .stack : {
46 *(.stack)
47 _stackbegin = .;
48 stackbegin = .;
49 . += 0x2000;
50 _stackend = .;
51 stackend = .;
52 } > IRAM
53
54 /* The bss section is too large for IRAM - we just move it 16MB into the
55 DRAM */
56
57 . = DRAMORIG;
58 .bss . + (16*1024*1024) : {
59 _edata = .;
60 *(.bss*);
61 *(.ibss);
62 *(.ncbss*);
63 _end = .;
64 } > DRAM
65}
diff --git a/firmware/target/arm/philips/sa9200/adc-target.h b/firmware/target/arm/philips/sa9200/adc-target.h
new file mode 100644
index 0000000000..56efdf7574
--- /dev/null
+++ b/firmware/target/arm/philips/sa9200/adc-target.h
@@ -0,0 +1,43 @@
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/* ADC channels */
23#define NUM_ADC_CHANNELS 13
24
25#define ADC_BVDD 0 /* Battery voltage of 4V LiIo accumulator */
26#define ADC_RTCSUP 1 /* RTC backup battery voltage */
27#define ADC_UVDD 2 /* USB host voltage */
28#define ADC_CHG_IN 3 /* Charger input voltage */
29#define ADC_CVDD 4 /* Charger pump output voltage */
30#define ADC_BATTEMP 5 /* Battery charging temperature */
31#define ADC_MICSUP1 6 /* Voltage on MicSup1 for remote control
32 or external voltage measurement */
33#define ADC_MICSUP2 7 /* Voltage on MicSup1 for remote control
34 or external voltage measurement */
35#define ADC_VBE1 8 /* Measuring junction temperature @ 2uA */
36#define ADC_VBE2 9 /* Measuring junction temperature @ 1uA */
37#define ADC_I_MICSUP1 10 /* Current of MicSup1 for remote control detection */
38#define ADC_I_MICSUP2 11 /* Current of MicSup2 for remote control detection */
39#define ADC_VBAT 12 /* Single cell battery voltage */
40
41#define ADC_UNREG_POWER ADC_BVDD /* For compatibility */
42
43#endif
diff --git a/firmware/target/arm/philips/sa9200/backlight-sa9200.c b/firmware/target/arm/philips/sa9200/backlight-sa9200.c
new file mode 100644
index 0000000000..aaec8cf007
--- /dev/null
+++ b/firmware/target/arm/philips/sa9200/backlight-sa9200.c
@@ -0,0 +1,75 @@
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#include "config.h"
20#include "backlight-target.h"
21#include "system.h"
22#include "lcd.h"
23#include "backlight.h"
24#include "i2c-pp.h"
25#include "as3514.h"
26
27static unsigned short backlight_brightness = DEFAULT_BRIGHTNESS_SETTING;
28
29void _backlight_set_brightness(int brightness)
30{
31 backlight_brightness = brightness;
32
33 if (brightness > 0)
34 _backlight_on();
35 else
36 _backlight_off();
37}
38
39void _backlight_on(void)
40{
41#ifdef HAVE_LCD_SLEEP
42 backlight_lcd_sleep_countdown(false); /* stop counter */
43#endif
44#ifdef HAVE_LCD_ENABLE
45 lcd_enable(true); /* power on lcd + visible display */
46#endif
47 pp_i2c_send(AS3514_I2C_ADDR, AS3514_DCDC15, backlight_brightness);
48}
49
50void _backlight_off(void)
51{
52 pp_i2c_send(AS3514_I2C_ADDR, AS3514_DCDC15, 0x0);
53#ifdef HAVE_LCD_ENABLE
54 lcd_enable(false); /* power off visible display */
55#endif
56#ifdef HAVE_LCD_SLEEP
57 backlight_lcd_sleep_countdown(true); /* start countdown */
58#endif
59}
60
61void _buttonlight_on(void)
62{
63 GPIO_SET_BITWISE(GPIOG_OUTPUT_VAL, 0x80);
64#ifdef SANSA_C200
65 GPIO_SET_BITWISE(GPIOB_OUTPUT_VAL, 0x10); /* The "menu" backlight */
66#endif
67}
68
69void _buttonlight_off(void)
70{
71 GPIO_CLEAR_BITWISE(GPIOG_OUTPUT_VAL, 0x80);
72#ifdef SANSA_C200
73 GPIO_CLEAR_BITWISE(GPIOB_OUTPUT_VAL, 0x10); /* The "menu" backlight */
74#endif
75}
diff --git a/firmware/target/arm/philips/sa9200/backlight-target.h b/firmware/target/arm/philips/sa9200/backlight-target.h
new file mode 100644
index 0000000000..01573b8403
--- /dev/null
+++ b/firmware/target/arm/philips/sa9200/backlight-target.h
@@ -0,0 +1,30 @@
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 BACKLIGHT_TARGET_H
20#define BACKLIGHT_TARGET_H
21
22#define _backlight_init() true
23void _backlight_on(void);
24void _backlight_off(void);
25void _backlight_set_brightness(int brightness);
26int __backlight_is_on(void);
27
28void _buttonlight_on(void);
29void _buttonlight_off(void);
30#endif
diff --git a/firmware/target/arm/philips/sa9200/button-sa9200.c b/firmware/target/arm/philips/sa9200/button-sa9200.c
new file mode 100755
index 0000000000..dc9f3466c2
--- /dev/null
+++ b/firmware/target/arm/philips/sa9200/button-sa9200.c
@@ -0,0 +1,72 @@
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 c200 bootloader */
27}
28
29bool button_hold(void)
30{
31 return !(GPIOL_INPUT_VAL & 0x40);
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#ifndef BOOTLOADER
48 if (hold_button != hold_button_old)
49 backlight_hold_changed(hold_button);
50#endif
51
52 /* device buttons */
53 if (!hold_button)
54 {
55#if 0
56 if (!(GPIOB_INPUT_VAL & 0x20)) btn |= BUTTON_POWER;
57 if (!(GPIOF_INPUT_VAL & 0x10)) btn |= BUTTON_VOL_UP;
58 if (!(GPIOF_INPUT_VAL & 0x04)) btn |= BUTTON_VOL_DOWN;
59#endif
60 /* A hack until the touchpad works */
61 if (!(GPIOB_INPUT_VAL & 0x20)) btn |= BUTTON_SELECT;
62 if (!(GPIOF_INPUT_VAL & 0x10)) btn |= BUTTON_UP;
63 if (!(GPIOF_INPUT_VAL & 0x04)) btn |= BUTTON_DOWN;
64 }
65
66 return btn;
67}
68
69bool headphones_inserted(void)
70{
71 return (GPIOB_INPUT_VAL & 0x10) ? false : true;
72}
diff --git a/firmware/target/arm/philips/sa9200/button-target.h b/firmware/target/arm/philips/sa9200/button-target.h
new file mode 100755
index 0000000000..1cd6e52097
--- /dev/null
+++ b/firmware/target/arm/philips/sa9200/button-target.h
@@ -0,0 +1,53 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id:$
9 *
10 * Copyright (C) 2007 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_SELECT 0x00000002
35#define BUTTON_MENU 0x00000004
36#define BUTTON_LEFT 0x00000008
37#define BUTTON_RIGHT 0x00000010
38#define BUTTON_REW 0x00000020
39#define BUTTON_FFWD 0x00000040
40#define BUTTON_UP 0x00000080
41#define BUTTON_DOWN 0x00000100
42#define BUTTON_VOL_UP 0x00000200
43#define BUTTON_VOL_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/sa9200/lcd-sa9200.c b/firmware/target/arm/philips/sa9200/lcd-sa9200.c
new file mode 100755
index 0000000000..b06dcd952b
--- /dev/null
+++ b/firmware/target/arm/philips/sa9200/lcd-sa9200.c
@@ -0,0 +1,205 @@
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 while (LCD1_CONTROL & LCD1_BUSY_MASK);
32}
33
34/* send LCD data */
35static void lcd_send_data(unsigned data)
36{
37 lcd_wait_write();
38 LCD1_DATA = data >> 8;
39 lcd_wait_write();
40 LCD1_DATA = data & 0xff;
41}
42
43/* send LCD command */
44static void lcd_send_command(unsigned cmd)
45{
46 lcd_wait_write();
47 LCD1_CMD = cmd >> 8;
48 lcd_wait_write();
49 LCD1_CMD = cmd & 0xff;
50}
51
52static void lcd_write_reg(unsigned reg, unsigned data)
53{
54 lcd_send_command(reg);
55 lcd_send_data(data);
56}
57
58void lcd_init_device(void)
59{
60#if 0
61 /* This is the init done by the OF bootloader.
62 Re-initializing the lcd causes it to flash
63 a white screen, so for now disable this. */
64 DEV_INIT1 &= ~0x3000;
65 DEV_INIT1 = DEV_INIT1;
66 DEV_INIT2 &= ~0x400;
67
68 LCD1_CONTROL = 0x4680;
69 udelay(1500);
70 LCD1_CONTROL = 0x4684;
71
72 outl(1, 0x70003018);
73
74 LCD1_CONTROL &= ~0x200;
75 LCD1_CONTROL &= ~0x800;
76 LCD1_CONTROL &= ~0x400;
77 udelay(30000);
78
79 LCD1_CONTROL |= 0x1;
80
81 lcd_write_reg(0x0000, 0x0001);
82 udelay(50000);
83
84 lcd_write_reg(0x0011, 0x171f);
85 lcd_write_reg(0x0012, 0x0001);
86 lcd_write_reg(0x0013, 0x08cd);
87 lcd_write_reg(0x0014, 0x0416);
88 lcd_write_reg(0x0010, 0x1208);
89 udelay(50000);
90
91 lcd_write_reg(0x0013, 0x081C);
92 udelay(200000);
93
94 lcd_write_reg(0x0001, 0x0a0c);
95 lcd_write_reg(0x0002, 0x0200);
96 lcd_write_reg(0x0003, 0x1030);
97 lcd_write_reg(0x0007, 0x0005);
98 lcd_write_reg(0x0008, 0x030a);
99 lcd_write_reg(0x000b, 0x0000);
100 lcd_write_reg(0x000c, 0x0000);
101 lcd_write_reg(0x0030, 0x0000);
102 lcd_write_reg(0x0031, 0x0204);
103 lcd_write_reg(0x0032, 0x0001);
104 lcd_write_reg(0x0033, 0x0600);
105 lcd_write_reg(0x0034, 0x0607);
106 lcd_write_reg(0x0035, 0x0305);
107 lcd_write_reg(0x0036, 0x0707);
108 lcd_write_reg(0x0037, 0x0006);
109 lcd_write_reg(0x0038, 0x0400);
110 lcd_write_reg(0x0040, 0x0000);
111 lcd_write_reg(0x0042, 0x9f00);
112 lcd_write_reg(0x0043, 0x0000);
113 lcd_write_reg(0x0044, 0x7f00);
114 lcd_write_reg(0x0045, 0x9f00);
115 lcd_write_reg(0x00a8, 0x0125);
116 lcd_write_reg(0x00a9, 0x0014);
117 lcd_write_reg(0x00a7, 0x0022);
118
119 lcd_write_reg(0x0007, 0x0021);
120 udelay(40000);
121 lcd_write_reg(0x0007, 0x0023);
122 udelay(40000);
123 lcd_write_reg(0x0007, 0x1037);
124
125 lcd_write_reg(0x0021, 0x0000);
126#endif
127}
128
129/*** hardware configuration ***/
130#if 0
131int lcd_default_contrast(void)
132{
133 return DEFAULT_CONTRAST_SETTING;
134}
135#endif
136
137void lcd_set_contrast(int val)
138{
139 (void)val;
140}
141
142void lcd_set_invert_display(bool yesno)
143{
144 (void)yesno;
145}
146
147/* turn the display upside down (call lcd_update() afterwards) */
148void lcd_set_flip(bool yesno)
149{
150 (void)yesno;
151}
152
153void lcd_yuv_set_options(unsigned options)
154{
155 lcd_yuv_options = options;
156}
157
158/* Performance function to blit a YUV bitmap directly to the LCD */
159void lcd_blit_yuv(unsigned char * const src[3],
160 int src_x, int src_y, int stride,
161 int x, int y, int width, int height)
162{
163 (void)src;
164 (void)src_x;
165 (void)src_y;
166 (void)stride;
167 (void)x;
168 (void)y;
169 (void)width;
170 (void)height;
171}
172
173/* Update the display.
174 This must be called after all other LCD functions that change the display. */
175void lcd_update(void)
176{
177 lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
178}
179
180/* Update a fraction of the display. */
181void lcd_update_rect(int x, int y, int width, int height)
182{
183 const fb_data *addr;
184
185 if (x + width >= LCD_WIDTH)
186 width = LCD_WIDTH - x;
187 if (y + height >= LCD_HEIGHT)
188 height = LCD_HEIGHT - y;
189
190 if ((width <= 0) || (height <= 0))
191 return; /* Nothing left to do. */
192
193 addr = &lcd_framebuffer[y][x];
194
195 do {
196 lcd_write_reg(0x0021, ((y++ & 0xff) << 8) | (x & 0xff));
197 lcd_send_command(0x0022);
198
199 int w = width;
200 do {
201 lcd_send_data(*addr++);
202 } while (--w > 0);
203 addr += LCD_WIDTH - width;
204 } while (--height > 0);
205}
diff --git a/firmware/target/arm/philips/sa9200/power-sa9200.c b/firmware/target/arm/philips/sa9200/power-sa9200.c
new file mode 100644
index 0000000000..8c8214a7ce
--- /dev/null
+++ b/firmware/target/arm/philips/sa9200/power-sa9200.c
@@ -0,0 +1,136 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Daniel Ankers
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 <stdbool.h>
21#include "system.h"
22#include "cpu.h"
23#include "i2c-pp.h"
24#include "tuner.h"
25#include "as3514.h"
26#include "power.h"
27
28void power_init(void)
29{
30}
31
32void power_off(void)
33{
34 char byte;
35
36 /* Send shutdown command to PMU */
37 byte = i2c_readbyte(AS3514_I2C_ADDR, AS3514_SYSTEM);
38 byte &= ~0x1;
39 pp_i2c_send(AS3514_I2C_ADDR, AS3514_SYSTEM, byte);
40
41 /* Stop interrupts on both cores */
42 disable_interrupt(IRQ_FIQ_STATUS);
43 COP_INT_CLR = -1;
44 CPU_INT_CLR = -1;
45
46 /* Halt everything and wait for device to power off */
47 while (1)
48 {
49 COP_CTL = 0x40000000;
50 CPU_CTL = 0x40000000;
51 }
52}
53
54bool charger_inserted(void)
55{
56#ifdef SANSA_E200
57 if(GPIOB_INPUT_VAL & 0x10)
58#else /* SANSA_C200 */
59 if(GPIOH_INPUT_VAL & 0x2)
60#endif
61 return true;
62 return false;
63}
64
65void ide_power_enable(bool on)
66{
67 (void)on;
68}
69
70#if CONFIG_TUNER
71
72/** Tuner **/
73static bool powered = false;
74
75bool tuner_power(bool status)
76{
77 bool old_status;
78 lv24020lp_lock();
79
80 old_status = powered;
81
82 if (status != old_status)
83 {
84 if (status)
85 {
86 /* init mystery amplification device */
87#if defined(SANSA_E200)
88 GPO32_ENABLE |= 0x1;
89#else /* SANSA_C200 */
90 DEV_INIT2 &= ~0x800;
91#endif
92 udelay(5);
93
94 /* When power up, host should initialize the 3-wire bus
95 in host read mode: */
96
97 /* 1. Set direction of the DATA-line to input-mode. */
98 GPIOH_OUTPUT_EN &= ~(1 << 5);
99 GPIOH_ENABLE |= (1 << 5);
100
101 /* 2. Drive NR_W low */
102 GPIOH_OUTPUT_VAL &= ~(1 << 3);
103 GPIOH_OUTPUT_EN |= (1 << 3);
104 GPIOH_ENABLE |= (1 << 3);
105
106 /* 3. Drive CLOCK high */
107 GPIOH_OUTPUT_VAL |= (1 << 4);
108 GPIOH_OUTPUT_EN |= (1 << 4);
109 GPIOH_ENABLE |= (1 << 4);
110
111 lv24020lp_power(true);
112 }
113 else
114 {
115 lv24020lp_power(false);
116
117 /* set all as inputs */
118 GPIOH_OUTPUT_EN &= ~((1 << 5) | (1 << 3) | (1 << 4));
119 GPIOH_ENABLE &= ~((1 << 3) | (1 << 4));
120
121 /* turn off mystery amplification device */
122#if defined (SANSA_E200)
123 GPO32_ENABLE &= ~0x1;
124#else
125 DEV_INIT2 |= 0x800;
126#endif
127 }
128
129 powered = status;
130 }
131
132 lv24020lp_unlock();
133 return old_status;
134}
135
136#endif /* CONFIG_TUNER */
diff --git a/firmware/target/arm/philips/sa9200/powermgmt-sa9200.c b/firmware/target/arm/philips/sa9200/powermgmt-sa9200.c
new file mode 100644
index 0000000000..9bb70263be
--- /dev/null
+++ b/firmware/target/arm/philips/sa9200/powermgmt-sa9200.c
@@ -0,0 +1,58 @@
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 3400
28};
29
30const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
31{
32 3300
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 /* Sansa Li Ion 750mAH, took from battery benchs */
39 { 3300, 3680, 3740, 3760, 3780, 3810, 3870, 3930, 3970, 4070, 4160 },
40};
41
42/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
43const unsigned short percent_to_volt_charge[11] =
44{
45 /* Sansa Li Ion 750mAH FIXME */
46 3300, 3680, 3740, 3760, 3780, 3810, 3870, 3930, 3970, 4070, 4160
47};
48
49/* ADC should read 0x3ff=5.12V */
50#define BATTERY_SCALE_FACTOR 5125
51/* full-scale ADC readout (2^10) in millivolt */
52
53/* Returns battery voltage from ADC [millivolts] */
54unsigned int battery_adc_voltage(void)
55{
56 return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10;
57}
58
diff --git a/firmware/target/arm/system-pp502x.c b/firmware/target/arm/system-pp502x.c
index 4e3f2c0cf0..f74b0484ab 100644
--- a/firmware/target/arm/system-pp502x.c
+++ b/firmware/target/arm/system-pp502x.c
@@ -374,7 +374,7 @@ void system_init(void)
374 /* to be done */ 374 /* to be done */
375#endif 375#endif
376 376
377#if !defined(SANSA_E200) && !defined(SANSA_C200) 377#if !defined(SANSA_E200) && !defined(SANSA_C200) && !defined(PHILIPS_SA9200)
378 /* Remap the flash ROM on CPU, keep hidden from COP: 378 /* Remap the flash ROM on CPU, keep hidden from COP:
379 * 0x00000000-0x3fffffff = 0x20000000-0x23ffffff */ 379 * 0x00000000-0x3fffffff = 0x20000000-0x23ffffff */
380 MMAP1_LOGICAL = 0x20003c00; 380 MMAP1_LOGICAL = 0x20003c00;
@@ -405,7 +405,7 @@ void system_init(void)
405 GPIOK_INT_EN = 0; 405 GPIOK_INT_EN = 0;
406 GPIOL_INT_EN = 0; 406 GPIOL_INT_EN = 0;
407 407
408#if defined(SANSA_E200) || defined(SANSA_C200) 408#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200)
409 /* outl(0x00000000, 0x6000b000); */ 409 /* outl(0x00000000, 0x6000b000); */
410 outl(inl(0x6000a000) | 0x80000000, 0x6000a000); /* Init DMA controller? */ 410 outl(inl(0x6000a000) | 0x80000000, 0x6000a000); /* Init DMA controller? */
411#endif 411#endif
@@ -433,7 +433,7 @@ void system_init(void)
433void system_reboot(void) 433void system_reboot(void)
434{ 434{
435 /* Reboot */ 435 /* Reboot */
436#if defined(SANSA_E200) || defined(SANSA_C200) 436#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200)
437 CACHE_CTL &= ~CACHE_CTL_VECT_REMAP; 437 CACHE_CTL &= ~CACHE_CTL_VECT_REMAP;
438 438
439 /* Magic used by the c200 OF: 0x23066000 439 /* Magic used by the c200 OF: 0x23066000
diff --git a/firmware/target/arm/usb-fw-pp502x.c b/firmware/target/arm/usb-fw-pp502x.c
index 18ef3d234e..eae78886f4 100644
--- a/firmware/target/arm/usb-fw-pp502x.c
+++ b/firmware/target/arm/usb-fw-pp502x.c
@@ -121,6 +121,11 @@ static bool usb_pin_detect(void)
121 /* GPIO L bit 2 is usb detect */ 121 /* GPIO L bit 2 is usb detect */
122 if (GPIOL_INPUT_VAL & 0x4) 122 if (GPIOL_INPUT_VAL & 0x4)
123 retval = true; 123 retval = true;
124
125#elif defined(PHILIPS_SA9200)
126 /* GPIO F bit 7 is usb detect */
127 if (!(GPIOF_INPUT_VAL & 0x80))
128 retval = true;
124#endif 129#endif
125 130
126 return retval; 131 return retval;
diff --git a/tools/configure b/tools/configure
index 7fffcfdb6a..324e7a3cc2 100755
--- a/tools/configure
+++ b/tools/configure
@@ -676,8 +676,9 @@ cat <<EOF
676 ==Tatung== ==Olympus== ==Logik== 676 ==Tatung== ==Olympus== ==Logik==
677 60) Elio TPJ-1022 70) M:Robe 500 80) DAX 1GB MP3/DAB 677 60) Elio TPJ-1022 70) M:Robe 500 80) DAX 1GB MP3/DAB
678 71) M:Robe 100 678 71) M:Robe 100
679 ==Creative== 679
680 90) Zen Vision:M 30GB 680 ==Creative== ==Philips==
681 90) Zen Vision:M 30GB 100) GoGear SA9200
681 91) Zen Vision:M 60GB 682 91) Zen Vision:M 60GB
682 92) Zen Vision 683 92) Zen Vision
683 684
@@ -1651,6 +1652,30 @@ fi
1651 t_model="tpj1022" 1652 t_model="tpj1022"
1652 ;; 1653 ;;
1653 1654
1655 100|sa9200)
1656 target_id=41
1657 modelname="sa9200"
1658 target="-DPHILIPS_SA9200"
1659 memory=32 # supposedly
1660 arm7tdmicc
1661 tool="$rootdir/tools/scramble -mi4v3 -model=9200 -type=RBOS"
1662 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1663 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1664 output="rockbox.mi4"
1665 appextra="recorder:gui"
1666 plugins=""
1667 swcodec="yes"
1668 boottool="$rootdir/tools/scramble -mi4v3 -model=9200 -type=RBBL"
1669 bootoutput="FWImage.ebn"
1670 # toolset is the tools within the tools directory that we build for
1671 # this particular target.
1672 toolset="$genericbitmaptools scramble"
1673 # architecture, manufacturer and model for the target-tree build
1674 t_cpu="arm"
1675 t_manufacturer="philips"
1676 t_model="sa9200"
1677 ;;
1678
1654 *) 1679 *)
1655 echo "Please select a supported target platform!" 1680 echo "Please select a supported target platform!"
1656 exit 1681 exit
diff --git a/tools/scramble.c b/tools/scramble.c
index 3730f1b62a..c02c78916b 100644
--- a/tools/scramble.c
+++ b/tools/scramble.c
@@ -119,7 +119,8 @@ void usage(void)
119 "\t-add=X Rockbox generic \"add-up\" checksum format\n" 119 "\t-add=X Rockbox generic \"add-up\" checksum format\n"
120 "\t (X values: h100, h120, h140, h300, ipco, nano, ipvd, mn2g\n" 120 "\t (X values: h100, h120, h140, h300, ipco, nano, ipvd, mn2g\n"
121 "\t ip3g, ip4g, mini, iax5, iam5, iam3, h10, h10_5gb,\n" 121 "\t ip3g, ip4g, mini, iax5, iam5, iam3, h10, h10_5gb,\n"
122 "\t tpj2, c200, e200, giga, gigs, m100, m500, d2)\n"); 122 "\t tpj2, c200, e200, giga, gigs, m100, m500, d2,\n");
123 printf("\t 9200)\n");
123 printf("\nNo option results in Archos standard player/recorder format.\n"); 124 printf("\nNo option results in Archos standard player/recorder format.\n");
124 125
125 exit(1); 126 exit(1);
@@ -271,6 +272,8 @@ int main (int argc, char** argv)
271 modelnum = 24; 272 modelnum = 24;
272 else if(!strcmp(&argv[1][5], "iam3")) 273 else if(!strcmp(&argv[1][5], "iam3"))
273 modelnum = 25; 274 modelnum = 25;
275 else if(!strcmp(&argv[1][5], "9200")) /* Philips SA9200 */
276 modelnum = 26;
274 else { 277 else {
275 fprintf(stderr, "unsupported model: %s\n", &argv[1][5]); 278 fprintf(stderr, "unsupported model: %s\n", &argv[1][5]);
276 return 2; 279 return 2;