summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Arigo <markarigo@gmail.com>2007-09-06 03:28:58 +0000
committerMark Arigo <markarigo@gmail.com>2007-09-06 03:28:58 +0000
commitdbc6b4e39a8f68708bc20a7b3295662c7871856a (patch)
tree725674ac56a56c80246181f1e42342ada60b7199
parent4f3bcbbb11905c95337fcbe670a1b7da477fbf13 (diff)
downloadrockbox-dbc6b4e39a8f68708bc20a7b3295662c7871856a.tar.gz
rockbox-dbc6b4e39a8f68708bc20a7b3295662c7871856a.zip
Sansa c200 port. Rockbox works with sound. Several features are disabled including some lcd options, FM radio, recording, and all plugins. Loading the OF from the Rockbox bootloader does not work.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14625 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/SOURCES2
-rw-r--r--apps/bitmaps/native/SOURCES2
-rw-r--r--apps/bitmaps/native/rockboxlogo.132x40x16.bmpbin0 -> 15894 bytes
-rw-r--r--apps/debug_menu.c7
-rw-r--r--apps/keymaps/keymap-c200.c361
-rw-r--r--apps/lang/english.lang43
-rw-r--r--bootloader/SOURCES3
-rw-r--r--bootloader/main-pp.c40
-rw-r--r--firmware/SOURCES23
-rw-r--r--firmware/export/as3514.h2
-rw-r--r--firmware/export/config-c200.h190
-rw-r--r--firmware/export/config.h10
-rw-r--r--firmware/export/usb.h3
-rw-r--r--firmware/target/arm/crt0-pp.S2
-rw-r--r--firmware/target/arm/i2c-pp.c17
-rw-r--r--firmware/target/arm/i2s-pp.c2
-rw-r--r--firmware/target/arm/sandisk/ata-c200_e200.c27
-rw-r--r--firmware/target/arm/sandisk/backlight-c200_e200.c7
-rw-r--r--firmware/target/arm/sandisk/backlight-target.h2
-rw-r--r--firmware/target/arm/sandisk/power-c200_e200.c7
-rw-r--r--firmware/target/arm/sandisk/sansa-c200/button-c200.c62
-rw-r--r--firmware/target/arm/sandisk/sansa-c200/button-target.h53
-rw-r--r--firmware/target/arm/sandisk/sansa-c200/lcd-c200.c249
-rw-r--r--firmware/target/arm/sandisk/sansa-c200/powermgmt-c200.c58
-rw-r--r--firmware/target/arm/system-pp502x.c6
-rwxr-xr-xtools/configure29
-rw-r--r--tools/scramble.c5
27 files changed, 1159 insertions, 53 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index a8a4d0c91e..04d9e76c51 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -149,6 +149,8 @@ keymaps/keymap-h10.c
149keymaps/keymap-ifp7xx.c 149keymaps/keymap-ifp7xx.c
150#elif CONFIG_KEYPAD == SANSA_E200_PAD 150#elif CONFIG_KEYPAD == SANSA_E200_PAD
151keymaps/keymap-e200.c 151keymaps/keymap-e200.c
152#elif CONFIG_KEYPAD == SANSA_C200_PAD
153keymaps/keymap-c200.c
152#elif CONFIG_KEYPAD == ARCHOS_AV300_PAD 154#elif CONFIG_KEYPAD == ARCHOS_AV300_PAD
153keymaps/keymap-av300.c 155keymaps/keymap-av300.c
154#endif 156#endif
diff --git a/apps/bitmaps/native/SOURCES b/apps/bitmaps/native/SOURCES
index 094b2d61b1..88b60e0654 100644
--- a/apps/bitmaps/native/SOURCES
+++ b/apps/bitmaps/native/SOURCES
@@ -5,6 +5,8 @@
5rockboxlogo.112x30x1.bmp 5rockboxlogo.112x30x1.bmp
6#elif (LCD_WIDTH == 128) && (LCD_DEPTH == 16) 6#elif (LCD_WIDTH == 128) && (LCD_DEPTH == 16)
7rockboxlogo.128x40x16.bmp 7rockboxlogo.128x40x16.bmp
8#elif (LCD_WIDTH == 132) && (LCD_DEPTH == 16)
9rockboxlogo.132x40x16.bmp
8#elif (LCD_WIDTH == 138) && (LCD_DEPTH == 2) 10#elif (LCD_WIDTH == 138) && (LCD_DEPTH == 2)
9rockboxlogo.138x46x2.bmp 11rockboxlogo.138x46x2.bmp
10#elif (LCD_WIDTH == 160) && (LCD_DEPTH == 2) 12#elif (LCD_WIDTH == 160) && (LCD_DEPTH == 2)
diff --git a/apps/bitmaps/native/rockboxlogo.132x40x16.bmp b/apps/bitmaps/native/rockboxlogo.132x40x16.bmp
new file mode 100644
index 0000000000..865a8ed59d
--- /dev/null
+++ b/apps/bitmaps/native/rockboxlogo.132x40x16.bmp
Binary files differ
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 41507708d4..f8492d34b6 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -1010,7 +1010,8 @@ static bool dbg_spdif(void)
1010#elif CONFIG_KEYPAD == IRIVER_H10_PAD 1010#elif CONFIG_KEYPAD == IRIVER_H10_PAD
1011# define DEBUG_CANCEL BUTTON_REW 1011# define DEBUG_CANCEL BUTTON_REW
1012 1012
1013#elif CONFIG_KEYPAD == SANSA_E200_PAD 1013#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
1014 (CONFIG_KEYPAD == SANSA_C200_PAD)
1014# define DEBUG_CANCEL BUTTON_LEFT 1015# define DEBUG_CANCEL BUTTON_LEFT
1015#endif /* key definitios */ 1016#endif /* key definitios */
1016 1017
@@ -2007,7 +2008,7 @@ static bool dbg_save_roms(void)
2007 2008
2008 return false; 2009 return false;
2009} 2010}
2010#elif defined(CPU_PP) && !defined(SANSA_E200) 2011#elif defined(CPU_PP) && !(defined(SANSA_E200) || defined(SANSA_C200))
2011static bool dbg_save_roms(void) 2012static bool dbg_save_roms(void)
2012{ 2013{
2013 int fd; 2014 int fd;
@@ -2254,7 +2255,7 @@ static const struct the_menu_item menuitems[] = {
2254 { "LCD Power Off", dbg_lcd_power_off }, 2255 { "LCD Power Off", dbg_lcd_power_off },
2255#endif 2256#endif
2256#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || \ 2257#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || \
2257 (defined(CPU_PP) && !defined(SANSA_E200)) 2258 (defined(CPU_PP) && !(defined(SANSA_E200) || defined(SANSA_C200)))
2258 { "Dump ROM contents", dbg_save_roms }, 2259 { "Dump ROM contents", dbg_save_roms },
2259#endif 2260#endif
2260#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || defined(CPU_PP) || CONFIG_CPU == S3C2440 2261#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || defined(CPU_PP) || CONFIG_CPU == S3C2440
diff --git a/apps/keymaps/keymap-c200.c b/apps/keymaps/keymap-c200.c
new file mode 100644
index 0000000000..2141c9bf33
--- /dev/null
+++ b/apps/keymaps/keymap-c200.c
@@ -0,0 +1,361 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id:$
9 *
10 * Copyright (C) 2007 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/* Button Code Definitions for Sandisk c200 target */
20
21#include "config.h"
22#include "action.h"
23#include "button.h"
24#include "settings.h"
25
26/* {Action Code, Button code, Prereq button code } */
27
28/*
29 * The format of the list is as follows
30 * { Action Code, Button code, Prereq button code }
31 * if there's no need to check the previous button's value, use BUTTON_NONE
32 * Insert LAST_ITEM_IN_LIST at the end of each mapping
33 */
34static const struct button_mapping button_context_standard[] = {
35 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
36 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
37
38 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
39 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
40
41 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
42 { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
43 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
44
45 { ACTION_STD_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
46 { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
47 { ACTION_STD_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE },
48 { ACTION_STD_QUICKSCREEN, BUTTON_REC|BUTTON_SELECT, BUTTON_NONE },
49
50 LAST_ITEM_IN_LIST
51}; /* button_context_standard */
52
53
54static const struct button_mapping button_context_wps[] = {
55 { ACTION_WPS_PLAY, BUTTON_UP|BUTTON_REL, BUTTON_UP },
56 { ACTION_WPS_STOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
57
58 { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
59 { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
60 { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
61
62 { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
63 { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
64 { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
65
66 { ACTION_WPS_ABSETB_NEXTDIR,BUTTON_POWER|BUTTON_RIGHT, BUTTON_POWER },
67 { ACTION_WPS_ABSETA_PREVDIR,BUTTON_POWER|BUTTON_LEFT, BUTTON_POWER },
68 { ACTION_WPS_ABRESET, BUTTON_POWER|BUTTON_UP, BUTTON_POWER },
69
70 { ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
71 { ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
72
73 { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
74 { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
75
76 { ACTION_WPS_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
77 { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
78 { ACTION_WPS_PITCHSCREEN, BUTTON_SELECT|BUTTON_UP, BUTTON_SELECT },
79 { ACTION_WPS_ID3SCREEN, BUTTON_SELECT|BUTTON_DOWN, BUTTON_SELECT },
80 { ACTION_WPS_CONTEXT, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
81 { ACTION_WPS_QUICKSCREEN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
82 { ACTION_WPS_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE },
83
84 LAST_ITEM_IN_LIST
85}; /* button_context_wps */
86
87static const struct button_mapping button_context_settings[] = {
88 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
89 { ACTION_SETTINGS_RESET, BUTTON_SELECT, BUTTON_NONE },
90
91 { ACTION_SETTINGS_INC, BUTTON_DOWN, BUTTON_NONE },
92 { ACTION_SETTINGS_INCREPEAT,BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
93
94 { ACTION_SETTINGS_DEC, BUTTON_UP, BUTTON_NONE },
95 { ACTION_SETTINGS_DECREPEAT,BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
96
97 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
98 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
99
100 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
101 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
102
103 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
104}; /* button_context_settings */
105
106static const struct button_mapping button_context_list[] = {
107 { ACTION_LISTTREE_PGUP, BUTTON_REC|BUTTON_UP, BUTTON_REC },
108 { ACTION_LISTTREE_PGDOWN, BUTTON_REC|BUTTON_DOWN, BUTTON_REC },
109
110#ifdef HAVE_VOLUME_IN_LIST
111 { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
112 { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
113
114 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
115 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
116#endif
117
118 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
119}; /* button_context_list */
120
121static const struct button_mapping button_context_tree[] = {
122 { ACTION_TREE_WPS, BUTTON_REC|BUTTON_UP, BUTTON_REC },
123 { ACTION_TREE_STOP, BUTTON_REC|BUTTON_UP|BUTTON_REPEAT, BUTTON_REC|BUTTON_UP },
124
125 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
126}; /* button_context_tree */
127
128static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
129 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
130 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
131 { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
132 { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
133 { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
134
135 { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
136 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
137 { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
138 { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
139
140 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
141}; /* button_context_listtree_scroll_without_combo */
142
143static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
144 { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
145
146 { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT, BUTTON_REC },
147 { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
148
149 { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_REC },
150 { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
151
152 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
153}; /* button_context_listtree_scroll_with_combo */
154
155static const struct button_mapping button_context_yesno[] = {
156 { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
157
158 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
159}; /* button_context_settings_yesno */
160
161static const struct button_mapping button_context_quickscreen[] = {
162 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
163 { ACTION_STD_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_NONE },
164
165 { ACTION_QS_DOWNINV, BUTTON_UP|BUTTON_REL, BUTTON_NONE },
166 { ACTION_QS_DOWNINV, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
167
168 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
169 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
170
171 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
172 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
173
174 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
175 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
176
177 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
178}; /* button_context_quickscreen */
179
180static const struct button_mapping button_context_settings_right_is_inc[] = {
181 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
182 { ACTION_SETTINGS_INCREPEAT,BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
183
184 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
185 { ACTION_SETTINGS_DECREPEAT,BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
186
187 { ACTION_STD_PREV, BUTTON_UP|BUTTON_REL, BUTTON_NONE },
188 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
189
190 { ACTION_STD_NEXT, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
191 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
192
193 { ACTION_NONE, BUTTON_SELECT, BUTTON_NONE },
194 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
195
196 { ACTION_NONE, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
197 { ACTION_NONE, BUTTON_POWER, BUTTON_NONE },
198 { ACTION_STD_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_NONE },
199
200 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
201}; /* button_context_settings_right_is_inc */
202
203static const struct button_mapping button_context_settings_time[] = {
204 { ACTION_STD_PREV, BUTTON_UP|BUTTON_REL, BUTTON_NONE },
205 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
206
207 { ACTION_STD_NEXT, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
208 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
209
210 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
211}; /* button_context_settings_time */
212
213static const struct button_mapping button_context_pitchscreen[] = {
214 { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE },
215 { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
216
217 { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE },
218 { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
219
220 { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE },
221 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
222
223 { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
224 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
225
226 { ACTION_PS_RESET, BUTTON_SELECT, BUTTON_NONE },
227 { ACTION_PS_EXIT, BUTTON_POWER, BUTTON_NONE },
228
229 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
230}; /* button_context_pitchscreen */
231
232/** Recording Screen **/
233#ifdef HAVE_RECORDING
234static const struct button_mapping button_context_recscreen[] = {
235 { ACTION_STD_MENU, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
236 { ACTION_REC_PAUSE, BUTTON_UP|BUTTON_REL, BUTTON_UP },
237 { ACTION_STD_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
238 { ACTION_REC_NEWFILE, BUTTON_REC|BUTTON_REL, BUTTON_REC },
239
240 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
241 { ACTION_SETTINGS_INC, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
242
243 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
244 { ACTION_SETTINGS_DEC, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
245
246 { ACTION_STD_PREV, BUTTON_SCROLL_UP, BUTTON_NONE },
247 { ACTION_STD_PREV, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
248
249 { ACTION_STD_NEXT, BUTTON_SCROLL_DOWN, BUTTON_NONE },
250 { ACTION_STD_NEXT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT,BUTTON_NONE },
251
252 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
253}; /* button_context_recscreen */
254#endif
255
256/** FM Radio Screen **/
257#if CONFIG_TUNER
258static const struct button_mapping button_context_radio[] = {
259 { ACTION_FM_MENU, BUTTON_DOWN, BUTTON_NONE },
260 { ACTION_FM_PRESET, BUTTON_SELECT, BUTTON_NONE },
261 { ACTION_FM_STOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
262 { ACTION_FM_MODE, BUTTON_REC, BUTTON_NONE },
263 { ACTION_FM_EXIT, BUTTON_POWER, BUTTON_NONE },
264 { ACTION_FM_PLAY, BUTTON_UP|BUTTON_REL, BUTTON_UP },
265 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
266}; /* button_context_radio */
267#endif
268
269static const struct button_mapping button_context_keyboard[] = {
270 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
271 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
272
273 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
274 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
275
276 { ACTION_KBD_CURSOR_LEFT, BUTTON_REC|BUTTON_LEFT, BUTTON_NONE },
277 { ACTION_KBD_CURSOR_LEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT,BUTTON_NONE },
278
279 { ACTION_KBD_CURSOR_RIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_NONE },
280 { ACTION_KBD_CURSOR_RIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
281
282 { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE },
283 { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
284
285 { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
286 { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
287
288 { ACTION_KBD_BACKSPACE, BUTTON_REC|BUTTON_DOWN, BUTTON_NONE },
289 { ACTION_KBD_BACKSPACE, BUTTON_REC|BUTTON_DOWN|BUTTON_REPEAT,BUTTON_NONE },
290
291 { ACTION_KBD_PAGE_FLIP, BUTTON_REC|BUTTON_SELECT, BUTTON_REC },
292
293 { ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE },
294 { ACTION_KBD_DONE, BUTTON_UP, BUTTON_NONE },
295 { ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE },
296
297 LAST_ITEM_IN_LIST
298}; /* button_context_keyboard */
299
300static const struct button_mapping button_context_bmark[] = {
301 { ACTION_BMS_DELETE, BUTTON_UP, BUTTON_NONE },
302
303 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
304}; /* button_context_bmark */
305
306/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
307const struct button_mapping* get_context_mapping(int context)
308{
309 switch (context)
310 {
311 case CONTEXT_STD:
312 return button_context_standard;
313
314 case CONTEXT_WPS:
315 return button_context_wps;
316
317 case CONTEXT_LIST:
318 return button_context_list;
319 case CONTEXT_TREE:
320 case CONTEXT_MAINMENU:
321 if (global_settings.hold_lr_for_scroll_in_list)
322 return button_context_listtree_scroll_without_combo;
323 else
324 return button_context_listtree_scroll_with_combo;
325 case CONTEXT_CUSTOM|CONTEXT_TREE:
326 return button_context_tree;
327
328 case CONTEXT_SETTINGS:
329 return button_context_settings;
330 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
331 case CONTEXT_SETTINGS_COLOURCHOOSER:
332 case CONTEXT_SETTINGS_EQ:
333 return button_context_settings_right_is_inc;
334
335 case CONTEXT_SETTINGS_TIME:
336 return button_context_settings_time;
337
338 case CONTEXT_YESNOSCREEN:
339 return button_context_yesno;
340#if CONFIG_TUNER
341 case CONTEXT_FM:
342 return button_context_radio;
343#endif
344 case CONTEXT_BOOKMARKSCREEN:
345 return button_context_bmark;
346 case CONTEXT_QUICKSCREEN:
347 return button_context_quickscreen;
348 case CONTEXT_PITCHSCREEN:
349 return button_context_pitchscreen;
350#ifdef HAVE_RECORDING
351 case CONTEXT_RECSCREEN:
352 return button_context_recscreen;
353#endif
354 case CONTEXT_KEYBOARD:
355 return button_context_keyboard;
356
357 default:
358 return button_context_standard;
359 }
360 return button_context_standard;
361}
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index cf9ce3b268..28451d0890 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -72,6 +72,7 @@
72# 72#
73# Sandisk 73# Sandisk
74# Sansa E200 e200 74# Sansa E200 e200
75# Sansa C200 c200
75# 76#
76 77
77<phrase> 78<phrase>
@@ -319,13 +320,13 @@
319 <source> 320 <source>
320 *: "PLAY = Yes" 321 *: "PLAY = Yes"
321 h100,h120,h300: "NAVI = Yes" 322 h100,h120,h300: "NAVI = Yes"
322 ipod*,x5,m5,gigabeatf,e200,h10,h10_5gb: "SELECT = Yes" 323 ipod*,x5,m5,gigabeatf,e200,c200,h10,h10_5gb: "SELECT = Yes"
323 player: "(PLAY/STOP)" 324 player: "(PLAY/STOP)"
324 </source> 325 </source>
325 <dest> 326 <dest>
326 *: "PLAY = Yes" 327 *: "PLAY = Yes"
327 h100,h120,h300: "NAVI = Yes" 328 h100,h120,h300: "NAVI = Yes"
328 ipod*,x5,m5,gigabeatf,e200,h10,h10_5gb: "SELECT = Yes" 329 ipod*,x5,m5,gigabeatf,e200,c200,h10,h10_5gb: "SELECT = Yes"
329 player: "(PLAY/STOP)" 330 player: "(PLAY/STOP)"
330 </dest> 331 </dest>
331 <voice> 332 <voice>
@@ -2421,14 +2422,14 @@
2421 h100,h120,h300: "Building database... %d found (STOP to return)" 2422 h100,h120,h300: "Building database... %d found (STOP to return)"
2422 ipod*: "Building database... %d found (PLAY/PAUSE to return)" 2423 ipod*: "Building database... %d found (PLAY/PAUSE to return)"
2423 x5,m5: "Building database... %d found (LEFT to return)" 2424 x5,m5: "Building database... %d found (LEFT to return)"
2424 h10,h10_5gb,e200: "Building database... %d found (PREV to return)" 2425 h10,h10_5gb,e200,c200: "Building database... %d found (PREV to return)"
2425 </source> 2426 </source>
2426 <dest> 2427 <dest>
2427 *: "Building database... %d found (OFF to return)" 2428 *: "Building database... %d found (OFF to return)"
2428 h100,h120,h300: "Building database... %d found (STOP to return)" 2429 h100,h120,h300: "Building database... %d found (STOP to return)"
2429 ipod*: "Building database... %d found (PLAY/PAUSE to return)" 2430 ipod*: "Building database... %d found (PLAY/PAUSE to return)"
2430 x5,m5: "Building database... %d found (LEFT to return)" 2431 x5,m5: "Building database... %d found (LEFT to return)"
2431 h10,h10_5gb,e200: "Building database... %d found (PREV to return)" 2432 h10,h10_5gb,e200,c200: "Building database... %d found (PREV to return)"
2432 </dest> 2433 </dest>
2433 <voice> 2434 <voice>
2434 *: "entries found for database" 2435 *: "entries found for database"
@@ -4179,17 +4180,17 @@
4179 *: none 4180 *: none
4180 rtc: "ON = Set" 4181 rtc: "ON = Set"
4181 h100,h120,h300: "NAVI = Set" 4182 h100,h120,h300: "NAVI = Set"
4182 ipod*,x5,m5,h10,h10_5gb,e200,gigabeatf: "SELECT = Set" 4183 ipod*,x5,m5,h10,h10_5gb,e200,c200,gigabeatf: "SELECT = Set"
4183 </source> 4184 </source>
4184 <dest> 4185 <dest>
4185 *: none 4186 *: none
4186 rtc: "ON = Set" 4187 rtc: "ON = Set"
4187 h100,h120,h300: "NAVI = Set" 4188 h100,h120,h300: "NAVI = Set"
4188 ipod*,x5,m5,h10,h10_5gb,e200,gigabeatf: "SELECT = Set" 4189 ipod*,x5,m5,h10,h10_5gb,e200,c200,gigabeatf: "SELECT = Set"
4189 </dest> 4190 </dest>
4190 <voice> 4191 <voice>
4191 *: none 4192 *: none
4192 rtc,h100,h120,h300,h10,h10_5gb,x5,m5,ipod*,e200,gigabeatf: "" 4193 rtc,h100,h120,h300,h10,h10_5gb,x5,m5,ipod*,e200,c200,gigabeatf: ""
4193 </voice> 4194 </voice>
4194</phrase> 4195</phrase>
4195<phrase> 4196<phrase>
@@ -4200,7 +4201,7 @@
4200 *: none 4201 *: none
4201 rtc: "OFF = Revert" 4202 rtc: "OFF = Revert"
4202 h100,h120,h300: "STOP = Revert" 4203 h100,h120,h300: "STOP = Revert"
4203 ipod*,e200: "MENU = Revert" 4204 ipod*,e200,c200: "MENU = Revert"
4204 x5,m5: "RECORD = Revert" 4205 x5,m5: "RECORD = Revert"
4205 h10,h10_5gb: "PREV = Revert" 4206 h10,h10_5gb: "PREV = Revert"
4206 gigabeatf: "A = Revert" 4207 gigabeatf: "A = Revert"
@@ -4209,14 +4210,14 @@
4209 *: none 4210 *: none
4210 rtc: "OFF = Revert" 4211 rtc: "OFF = Revert"
4211 h100,h120,h300: "STOP = Revert" 4212 h100,h120,h300: "STOP = Revert"
4212 ipod*,e200: "MENU = Revert" 4213 ipod*,e200,c200: "MENU = Revert"
4213 x5,m5: "RECORD = Revert" 4214 x5,m5: "RECORD = Revert"
4214 h10,h10_5gb: "PREV = Revert" 4215 h10,h10_5gb: "PREV = Revert"
4215 gigabeatf: "A = Revert" 4216 gigabeatf: "A = Revert"
4216 </dest> 4217 </dest>
4217 <voice> 4218 <voice>
4218 *: none 4219 *: none
4219 rtc,h100,h120,h300,ipod*,e200,x5,m5,h10,h10_gb,gigabeatf: "" 4220 rtc,h100,h120,h300,ipod*,e200,c200,x5,m5,h10,h10_gb,gigabeatf: ""
4220 </voice> 4221 </voice>
4221</phrase> 4222</phrase>
4222<phrase> 4223<phrase>
@@ -6951,17 +6952,17 @@
6951 user: 6952 user:
6952 <source> 6953 <source>
6953 *: none 6954 *: none
6954 e200: "mSD:" 6955 e200,c200: "mSD:"
6955 ondio*: "MMC:" 6956 ondio*: "MMC:"
6956 </source> 6957 </source>
6957 <dest> 6958 <dest>
6958 *: none 6959 *: none
6959 e200: "mSD:" 6960 e200,c200: "mSD:"
6960 ondio*: "MMC:" 6961 ondio*: "MMC:"
6961 </dest> 6962 </dest>
6962 <voice> 6963 <voice>
6963 *: none 6964 *: none
6964 e200: "micro Secure Digital card:" 6965 e200,c200: "micro Secure Digital card:"
6965 ondio*: "Multimedia card" 6966 ondio*: "Multimedia card"
6966 </voice> 6967 </voice>
6967</phrase> 6968</phrase>
@@ -8325,18 +8326,18 @@
8325 recording: "The disk is full. Press OFF to continue." 8326 recording: "The disk is full. Press OFF to continue."
8326 h100,h120,h300: "The disk is full. Press STOP to continue." 8327 h100,h120,h300: "The disk is full. Press STOP to continue."
8327 m5,x5: "The disk is full. Press POWER to continue." 8328 m5,x5: "The disk is full. Press POWER to continue."
8328 e200: "The disk is full. Press UP to continue." 8329 e200,c200: "The disk is full. Press UP to continue."
8329 </source> 8330 </source>
8330 <dest> 8331 <dest>
8331 *: none 8332 *: none
8332 recording: "The disk is full. Press OFF to continue." 8333 recording: "The disk is full. Press OFF to continue."
8333 h100,h120,h300: "The disk is full. Press STOP to continue." 8334 h100,h120,h300: "The disk is full. Press STOP to continue."
8334 m5,x5: "The disk is full. Press POWER to continue." 8335 m5,x5: "The disk is full. Press POWER to continue."
8335 e200: "The disk is full. Press UP to continue." 8336 e200,c200: "The disk is full. Press UP to continue."
8336 </dest> 8337 </dest>
8337 <voice> 8338 <voice>
8338 *: none 8339 *: none
8339 recording,h100,h120,h300,m5,x5,e200: "" 8340 recording,h100,h120,h300,m5,x5,e200,c200: ""
8340 </voice> 8341 </voice>
8341</phrase> 8342</phrase>
8342<phrase> 8343<phrase>
@@ -8427,14 +8428,14 @@
8427 player,h100,h120,h300: "STOP to abort" 8428 player,h100,h120,h300: "STOP to abort"
8428 ipod*: "PLAY/PAUSE to abort" 8429 ipod*: "PLAY/PAUSE to abort"
8429 x5,m5: "Long PLAY to abort" 8430 x5,m5: "Long PLAY to abort"
8430 h10,h10_5gb,e200: "PREV to abort" 8431 h10,h10_5gb,e200,c200: "PREV to abort"
8431 </source> 8432 </source>
8432 <dest> 8433 <dest>
8433 *: "OFF to abort" 8434 *: "OFF to abort"
8434 player,h100,h120,h300: "STOP to abort" 8435 player,h100,h120,h300: "STOP to abort"
8435 ipod*: "PLAY/PAUSE to abort" 8436 ipod*: "PLAY/PAUSE to abort"
8436 x5,m5: "Long PLAY to abort" 8437 x5,m5: "Long PLAY to abort"
8437 h10,h10_5gb,e200: "PREV to abort" 8438 h10,h10_5gb,e200,c200: "PREV to abort"
8438 </dest> 8439 </dest>
8439 <voice> 8440 <voice>
8440 *: "" 8441 *: ""
@@ -10481,17 +10482,17 @@
10481 *: none 10482 *: none
10482 recording: "The disk is full. Press OFF to continue." 10483 recording: "The disk is full. Press OFF to continue."
10483 h100,h120,h300: "The disk is full. Press STOP to continue." 10484 h100,h120,h300: "The disk is full. Press STOP to continue."
10484 m5,x5,ipod4g,ipodcolor,ipodnano,ipodvideo,e200: "The disk is full. Press LEFT to continue." 10485 m5,x5,ipod4g,ipodcolor,ipodnano,ipodvideo,e200,c200: "The disk is full. Press LEFT to continue."
10485 </source> 10486 </source>
10486 <dest> 10487 <dest>
10487 *: none 10488 *: none
10488 recording: "The disk is full. Press OFF to continue." 10489 recording: "The disk is full. Press OFF to continue."
10489 h100,h120,h300: "The disk is full. Press STOP to continue." 10490 h100,h120,h300: "The disk is full. Press STOP to continue."
10490 m5,x5,ipod4g,ipodcolor,ipodnano,ipodvideo,e200: "The disk is full. Press LEFT to continue." 10491 m5,x5,ipod4g,ipodcolor,ipodnano,ipodvideo,e200,c200: "The disk is full. Press LEFT to continue."
10491 </dest> 10492 </dest>
10492 <voice> 10493 <voice>
10493 *: none 10494 *: none
10494 recording,h100,h120,h300,m5,x5,ipod4g,ipodcolor,ipodnano,ipodvideo,e200: "" 10495 recording,h100,h120,h300,m5,x5,ipod4g,ipodcolor,ipodnano,ipodvideo,e200,c200: ""
10495 </voice> 10496 </voice>
10496</phrase> 10497</phrase>
10497<phrase> 10498<phrase>
diff --git a/bootloader/SOURCES b/bootloader/SOURCES
index 94196d387a..5d82e57309 100644
--- a/bootloader/SOURCES
+++ b/bootloader/SOURCES
@@ -4,7 +4,8 @@ common.c
4ipod.c 4ipod.c
5#elif defined(GIGABEAT_F) 5#elif defined(GIGABEAT_F)
6gigabeat.c 6gigabeat.c
7#elif defined(IRIVER_H10) || defined(IRIVER_H10_5GB) || defined(SANSA_E200) 7#elif defined(IRIVER_H10) || defined(IRIVER_H10_5GB) || \
8 defined(SANSA_E200) || defined(SANSA_C200)
8main-pp.c 9main-pp.c
9#elif defined(ELIO_TPJ1022) 10#elif defined(ELIO_TPJ1022)
10tpj1022.c 11tpj1022.c
diff --git a/bootloader/main-pp.c b/bootloader/main-pp.c
index 0fa276708c..462a82e6b7 100644
--- a/bootloader/main-pp.c
+++ b/bootloader/main-pp.c
@@ -33,7 +33,7 @@
33#include "disk.h" 33#include "disk.h"
34#include "crc32-mi4.h" 34#include "crc32-mi4.h"
35#include <string.h> 35#include <string.h>
36#ifdef SANSA_E200 36#if defined(SANSA_E200) || defined(SANSA_C200)
37#include "usb.h" 37#include "usb.h"
38#include "arcotg_udc.h" 38#include "arcotg_udc.h"
39#endif 39#endif
@@ -46,6 +46,9 @@
46#elif CONFIG_KEYPAD == SANSA_E200_PAD 46#elif CONFIG_KEYPAD == SANSA_E200_PAD
47#define BOOTLOADER_BOOT_OF BUTTON_LEFT 47#define BOOTLOADER_BOOT_OF BUTTON_LEFT
48 48
49#elif CONFIG_KEYPAD == SANSA_C200_PAD
50#define BOOTLOADER_BOOT_OF BUTTON_LEFT
51
49#endif 52#endif
50 53
51/* Maximum allowed firmware image size. 10MB is more than enough */ 54/* Maximum allowed firmware image size. 10MB is more than enough */
@@ -58,7 +61,7 @@ unsigned char *loadbuffer = (unsigned char *)DRAM_START;
58char version[] = APPSVERSION; 61char version[] = APPSVERSION;
59 62
60/* Locations and sizes in hidden partition on Sansa */ 63/* Locations and sizes in hidden partition on Sansa */
61#ifdef SANSA_E200 64#if defined(SANSA_E200) || defined(SANSA_C200)
62#define PPMI_SECTOR_OFFSET 1024 65#define PPMI_SECTOR_OFFSET 1024
63#define PPMI_SECTORS 1 66#define PPMI_SECTORS 1
64#define MI4_HEADER_SECTORS 1 67#define MI4_HEADER_SECTORS 1
@@ -335,6 +338,7 @@ int load_mi4(unsigned char* buf, char* firmware, unsigned int buffer_size)
335 return EOK; 338 return EOK;
336} 339}
337 340
341#if defined(SANSA_E200) || defined(SANSA_C200)
338#ifdef SANSA_E200 342#ifdef SANSA_E200
339struct OFDB_info { 343struct OFDB_info {
340 char *version; 344 char *version;
@@ -346,6 +350,17 @@ struct OFDB_info {
346 { "PP5022AF-05.51-S301-00.12-S301.00.12E-D", 39, 0x3c5c, 0x2 }, 350 { "PP5022AF-05.51-S301-00.12-S301.00.12E-D", 39, 0x3c5c, 0x2 },
347 { "PP5022AF-05.51-S301-00.12-S301.00.12A-D", 39, 0x3c08, 0xe1 }, 351 { "PP5022AF-05.51-S301-00.12-S301.00.12A-D", 39, 0x3c08, 0xe1 },
348}; 352};
353#else /* SANSA_C200 */
354/* TODO: need to determine these for the c200 */
355struct OFDB_info {
356 char *version;
357 int version_length;
358 int sector;
359 int offset;
360} OFDatabaseOffsets[] = {
361 { "PP5022AF-05.51-S301-01.11-S301.01.11A-D", 39, 0x3c08, 0xe1 },
362};
363#endif
349 364
350/* Load mi4 firmware from a hidden disk partition */ 365/* Load mi4 firmware from a hidden disk partition */
351int load_mi4_part(unsigned char* buf, struct partinfo* pinfo, 366int load_mi4_part(unsigned char* buf, struct partinfo* pinfo,
@@ -432,18 +447,17 @@ int load_mi4_part(unsigned char* buf, struct partinfo* pinfo,
432 447
433void* main(void) 448void* main(void)
434{ 449{
435#ifndef SANSA_E200
436 char buf[256];
437 unsigned short* identify_info;
438#endif
439 int i; 450 int i;
440 int btn; 451 int btn;
441 int rc; 452 int rc;
442 int num_partitions; 453 int num_partitions;
443 struct partinfo* pinfo; 454 struct partinfo* pinfo;
444#ifdef SANSA_E200 455#if defined(SANSA_E200) || defined(SANSA_C200)
445 int usb_retry = 0; 456 int usb_retry = 0;
446 bool usb = false; 457 bool usb = false;
458#else
459 char buf[256];
460 unsigned short* identify_info;
447#endif 461#endif
448 462
449 chksum_crc32gentab (); 463 chksum_crc32gentab ();
@@ -459,7 +473,7 @@ void* main(void)
459 lcd_clear_display(); 473 lcd_clear_display();
460 474
461 btn = button_read_device(); 475 btn = button_read_device();
462#ifdef SANSA_E200 476#if defined(SANSA_E200) || defined(SANSA_C200)
463 usb_init(); 477 usb_init();
464 while ((UDC_OTGSC&0x800) && usb_retry < 5 && !usb) 478 while ((UDC_OTGSC&0x800) && usb_retry < 5 && !usb)
465 { 479 {
@@ -481,7 +495,7 @@ void* main(void)
481 printf(MODEL_NAME); 495 printf(MODEL_NAME);
482 496
483 i=ata_init(); 497 i=ata_init();
484#ifndef SANSA_E200 498#if !defined(SANSA_E200) && !defined(SANSA_C200)
485 if (i==0) { 499 if (i==0) {
486 identify_info=ata_get_identify(); 500 identify_info=ata_get_identify();
487 /* Show model */ 501 /* Show model */
@@ -525,7 +539,7 @@ void* main(void)
525 */ 539 */
526 printf("Loading original firmware..."); 540 printf("Loading original firmware...");
527 541
528#ifdef SANSA_E200 542#if defined(SANSA_E200) || defined(SANSA_C200)
529 /* First try a (hidden) firmware partition */ 543 /* First try a (hidden) firmware partition */
530 printf("Trying firmware partition"); 544 printf("Trying firmware partition");
531 pinfo = disk_partinfo(1); 545 pinfo = disk_partinfo(1);
@@ -576,7 +590,7 @@ void* main(void)
576 { 590 {
577 printf("dumping sector %d", i); 591 printf("dumping sector %d", i);
578 } 592 }
579 ata_read_sectors(pinfo->start + i,1 , sector); 593 ata_read_sectors(0, pinfo->start + i, 1, sector);
580 write(fd,sector,512); 594 write(fd,sector,512);
581 } 595 }
582 close(fd); 596 close(fd);
@@ -588,19 +602,21 @@ void* main(void)
588 printf("Can't load %s:", BOOTFILE); 602 printf("Can't load %s:", BOOTFILE);
589 printf(strerror(rc)); 603 printf(strerror(rc));
590 604
605#ifdef OLD_BOOTFILE
591 /* Try loading rockbox from old rockbox.e200/rockbox.h10 format */ 606 /* Try loading rockbox from old rockbox.e200/rockbox.h10 format */
592 rc=load_firmware(loadbuffer, OLD_BOOTFILE, MAX_LOADSIZE); 607 rc=load_firmware(loadbuffer, OLD_BOOTFILE, MAX_LOADSIZE);
593 if (rc < EOK) { 608 if (rc < EOK) {
594 printf("Can't load %s:", OLD_BOOTFILE); 609 printf("Can't load %s:", OLD_BOOTFILE);
595 error(EBOOTFILE, rc); 610 error(EBOOTFILE, rc);
596 } 611 }
612#endif
597 } 613 }
598 } 614 }
599 615
600 return (void*)loadbuffer; 616 return (void*)loadbuffer;
601} 617}
602 618
603#ifndef SANSA_E200 619#if !defined(SANSA_E200) && !defined(SANSA_C200)
604/* These functions are present in the firmware library, but we reimplement 620/* These functions are present in the firmware library, but we reimplement
605 them here because the originals do a lot more than we want */ 621 them here because the originals do a lot more than we want */
606void usb_acknowledge(void) 622void usb_acknowledge(void)
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 3b0aca79fc..7a6e253a81 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -110,7 +110,7 @@ drivers/ata_mmc.c
110#ifdef HAVE_FLASH_DISK 110#ifdef HAVE_FLASH_DISK
111drivers/ata_flash.c 111drivers/ata_flash.c
112#else /* !HAVE_FLASH_DISK */ 112#else /* !HAVE_FLASH_DISK */
113#ifndef SANSA_E200 113#if !defined(SANSA_E200) && !defined(SANSA_C200)
114drivers/ata.c 114drivers/ata.c
115#endif /* SANSA_E200 */ 115#endif /* SANSA_E200 */
116#endif /* HAVE_FLASH_DISK */ 116#endif /* HAVE_FLASH_DISK */
@@ -239,7 +239,7 @@ usbstack/drivers/device/usb_storage.c
239#if CONFIG_USBOTG == USBOTG_ISP1362 239#if CONFIG_USBOTG == USBOTG_ISP1362
240drivers/isp1362.c 240drivers/isp1362.c
241#endif 241#endif
242#if defined(SANSA_E200) || !defined(BOOTLOADER) 242#if defined(SANSA_E200) || defined(SANSA_C200) || !defined(BOOTLOADER)
243#if CONFIG_USBOTG == USBOTG_M5636 243#if CONFIG_USBOTG == USBOTG_M5636
244drivers/m5636.c 244drivers/m5636.c
245#elif CONFIG_USBOTG == USBOTG_ARC 245#elif CONFIG_USBOTG == USBOTG_ARC
@@ -319,7 +319,7 @@ target/arm/system-pp502x.c
319target/arm/crt0-pp-bl.S 319target/arm/crt0-pp-bl.S
320#else 320#else
321target/arm/pcm-pp.c 321target/arm/pcm-pp.c
322#ifndef SANSA_E200 322#if !defined(SANSA_E200) && !defined(SANSA_C200)
323target/arm/audio-pp.c 323target/arm/audio-pp.c
324#endif /* SANSA_E200 */ 324#endif /* SANSA_E200 */
325target/arm/crt0-pp.S 325target/arm/crt0-pp.S
@@ -415,6 +415,23 @@ target/arm/sandisk/audio-c200_e200.c
415#endif /* SIMULATOR */ 415#endif /* SIMULATOR */
416#endif /* SANSA_E200 */ 416#endif /* SANSA_E200 */
417 417
418#ifdef SANSA_C200
419#ifndef SIMULATOR
420target/arm/sandisk/ata-c200_e200.c
421target/arm/sandisk/sansa-c200/lcd-c200.c
422target/arm/sandisk/adc-c200_e200.c
423target/arm/sandisk/backlight-c200_e200.c
424target/arm/usb-fw-pp502x.c
425target/arm/sandisk/sansa-c200/button-c200.c
426target/arm/sandisk/power-c200_e200.c
427target/arm/sandisk/sansa-c200/powermgmt-c200.c
428target/arm/i2s-pp.c
429#ifndef BOOTLOADER
430target/arm/sandisk/audio-c200_e200.c
431#endif /* BOOTLOADER */
432#endif /* SIMULATOR */
433#endif /* SANSA_C200 */
434
418#ifdef IAUDIO_X5 435#ifdef IAUDIO_X5
419#ifndef SIMULATOR 436#ifndef SIMULATOR
420target/coldfire/ata-as-coldfire.S 437target/coldfire/ata-as-coldfire.S
diff --git a/firmware/export/as3514.h b/firmware/export/as3514.h
index c01790f082..8df228f105 100644
--- a/firmware/export/as3514.h
+++ b/firmware/export/as3514.h
@@ -70,7 +70,7 @@ extern void audiohw_set_monitor(int enable);
70#define VOLUME_MIN -735 70#define VOLUME_MIN -735
71#define VOLUME_MAX 60 71#define VOLUME_MAX 60
72 72
73#ifdef SANSA_E200 73#if defined(SANSA_E200) || defined(SANSA_C200)
74#define AS3514_I2C_ADDR 0x46 74#define AS3514_I2C_ADDR 0x46
75#endif 75#endif
76 76
diff --git a/firmware/export/config-c200.h b/firmware/export/config-c200.h
new file mode 100644
index 0000000000..c0e8753493
--- /dev/null
+++ b/firmware/export/config-c200.h
@@ -0,0 +1,190 @@
1/*
2 * This config file is for the Sandisk Sansa e200
3 */
4#define TARGET_TREE /* this target is using the target tree system */
5
6/* For Rolo and boot loader */
7#define MODEL_NUMBER 20
8#define MODEL_NAME "Sandisk Sansa c200"
9
10#define HW_SAMPR_CAPS (SAMPR_CAP_44)
11
12/* define this if you have recording possibility */
13/* TODO: #define HAVE_RECORDING */
14
15#define REC_SAMPR_CAPS (SAMPR_CAP_22)
16#define REC_FREQ_DEFAULT REC_FREQ_22 /* Default is not 44.1kHz */
17#define REC_SAMPR_DEFAULT SAMPR_22
18
19/* Define bitmask of input sources - recordable bitmask can be defined
20 explicitly if different */
21#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_FMRADIO)
22
23/* define this if you have a bitmap LCD display */
24#define HAVE_LCD_BITMAP
25
26/* define this if you have a colour LCD */
27#define HAVE_LCD_COLOR
28
29/* define this if you have a light associated with the buttons */
30/* TODO: #define HAVE_BUTTON_LIGHT */
31
32/* define this if you have access to the quickscreen */
33#define HAVE_QUICKSCREEN
34
35/* define this if you have access to the pitchscreen */
36#define HAVE_PITCHSCREEN
37
38/* define this if you would like tagcache to build on this target */
39#define HAVE_TAGCACHE
40
41/* LCD dimensions */
42#define LCD_WIDTH 132
43#define LCD_HEIGHT 80
44#define LCD_DEPTH 16 /* 65536 colours */
45#define LCD_PIXELFORMAT RGB565 /* rgb565 */
46
47/* define this if you have LCD enable function */
48/* TODO: #define HAVE_LCD_ENABLE */
49
50/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE
51 should be defined as well. */
52/* TODO: #define HAVE_LCD_SLEEP */
53
54/* define this if you can flip your LCD */
55/* TODO: #define HAVE_LCD_FLIP */
56
57/* define this if you can invert the colours on your LCD */
58/* TODO: #define HAVE_LCD_INVERT */
59
60/* Define this if your LCD can set contrast */
61/* #define HAVE_LCD_CONTRAST */
62
63#define MIN_CONTRAST_SETTING 0
64#define MAX_CONTRAST_SETTING 30
65#define DEFAULT_CONTRAST_SETTING 14 /* Match boot contrast */
66
67/* #define IRAM_LCDFRAMEBUFFER IDATA_ATTR *//* put the lcd frame buffer in IRAM */
68
69#define CONFIG_KEYPAD SANSA_C200_PAD
70
71/* Define this if you do software codec */
72#define CONFIG_CODEC SWCODEC
73
74/* There is no hardware tone control */
75#define HAVE_SW_TONE_CONTROLS
76
77/* The PP5024 has a built-in AustriaMicrosystems AS3514 */
78#define HAVE_AS3514
79
80/* define this if you have a real-time clock */
81#ifndef BOOTLOADER
82#define CONFIG_RTC RTC_AS3514
83#endif
84
85/* Define this if you have a software controlled poweroff */
86#define HAVE_SW_POWEROFF
87
88/* Some Sansa E200s seem to be FAT16 formatted */
89#define HAVE_FAT16SUPPORT
90
91/* The number of bytes reserved for loadable codecs */
92#define CODEC_SIZE 0x80000
93
94/* The number of bytes reserved for loadable plugins */
95#define PLUGIN_BUFFER_SIZE 0x80000
96
97#define AB_REPEAT_ENABLE 1
98
99/* FM Tuner */
100/* TODO: #define CONFIG_TUNER LV24020LP */
101/* TODO: #define HAVE_TUNER_PWR_CTRL */
102
103/* Define this for LCD backlight available */
104#define HAVE_BACKLIGHT
105#define HAVE_BACKLIGHT_BRIGHTNESS
106
107/* define this if you have a flash memory storage */
108#define HAVE_FLASH_STORAGE
109
110#define HAVE_MULTIVOLUME
111
112#define BATTERY_CAPACITY_DEFAULT 750 /* default battery capacity */
113#define BATTERY_CAPACITY_MIN 750 /* min. capacity selectable */
114#define BATTERY_CAPACITY_MAX 750 /* max. capacity selectable */
115#define BATTERY_CAPACITY_INC 0 /* capacity increment */
116#define BATTERY_TYPES_COUNT 1 /* only one type */
117
118/* Hardware controlled charging? FIXME */
119#define CONFIG_CHARGING CHARGING_SIMPLE
120
121/* define this if the unit can be powered or charged via USB */
122#define HAVE_USB_POWER
123
124/** Non-simulator section **/
125#ifndef SIMULATOR
126
127/* Define this if you have a PortalPlayer PP5024 */
128#define CONFIG_CPU PP5022
129
130/* Define this if you want to use the PP5024 i2c interface */
131#define CONFIG_I2C I2C_PP5024
132
133/* define this if the hardware can be powered off while charging */
134/* Sansa can't be powered off while charging */
135/* #define HAVE_POWEROFF_WHILE_CHARGING */
136
137/* The start address index for ROM builds */
138#define ROM_START 0x00000000
139
140/* Define this to the CPU frequency */
141#define CPU_FREQ 75000000
142
143/* Type of LCD TODO: hopefully the same as the x5 but check this*/
144#define CONFIG_LCD LCD_C200
145
146#define HAVE_HOTSWAP
147
148/* Offset ( in the firmware file's header ) to the file CRC and data. These are
149 only used when loading the old format rockbox.e200 file */
150#define FIRMWARE_OFFSET_FILE_CRC 0x0
151#define FIRMWARE_OFFSET_FILE_DATA 0x8
152
153/* #define USB_IPODSTYLE */
154
155/* USB On-the-go */
156#define CONFIG_USBOTG USBOTG_ARC
157
158/* enable these for the experimental usb stack
159#define HAVE_USBSTACK
160#define USBSTACK_CAPS CONTROLLER_DEVICE
161*/
162
163/* Virtual LED (icon) */
164#define CONFIG_LED LED_VIRTUAL
165
166/* Define this if you have adjustable CPU frequency */
167#define HAVE_ADJUSTABLE_CPU_FREQ
168
169#define MI4_FORMAT
170#define BOOTFILE_EXT "mi4"
171#define BOOTFILE "rockbox." BOOTFILE_EXT
172#define BOOTDIR "/.rockbox"
173
174#define ICODE_ATTR_TREMOR_NOT_MDCT
175
176#define INCLUDE_TIMEOUT_API
177
178#endif /* SIMULATOR */
179
180/** Port-specific settings **/
181
182/* Main LCD backlight brightness range and defaults */
183#define MIN_BRIGHTNESS_SETTING 1
184#define MAX_BRIGHTNESS_SETTING 12
185#define DEFAULT_BRIGHTNESS_SETTING 6
186
187/* Default recording levels */
188#define DEFAULT_REC_MIC_GAIN 23
189#define DEFAULT_REC_LEFT_GAIN 23
190#define DEFAULT_REC_RIGHT_GAIN 23
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 44583183b1..a18bf14a97 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -63,8 +63,9 @@
63#define GIGABEAT_PAD 11 63#define GIGABEAT_PAD 11
64#define IRIVER_H10_PAD 12 64#define IRIVER_H10_PAD 12
65#define SANSA_E200_PAD 13 65#define SANSA_E200_PAD 13
66#define ELIO_TPJ1022_PAD 14 66#define SANSA_C200_PAD 14
67#define ARCHOS_AV300_PAD 15 67#define ELIO_TPJ1022_PAD 15
68#define ARCHOS_AV300_PAD 16
68 69
69/* CONFIG_REMOTE_KEYPAD */ 70/* CONFIG_REMOTE_KEYPAD */
70#define H100_REMOTE 1 71#define H100_REMOTE 1
@@ -95,6 +96,7 @@
95#define LCD_H10_5GB 14 /* as used by iriver H10 5Gb */ 96#define LCD_H10_5GB 14 /* as used by iriver H10 5Gb */
96#define LCD_TPJ1022 15 /* as used by Tatung Elio TPJ-1022 */ 97#define LCD_TPJ1022 15 /* as used by Tatung Elio TPJ-1022 */
97#define LCD_DSC25 16 /* as used by Archos AV300 */ 98#define LCD_DSC25 16 /* as used by Archos AV300 */
99#define LCD_C200 17 /* as used by Sandisk Sansa c200 */
98 100
99/* LCD_PIXELFORMAT */ 101/* LCD_PIXELFORMAT */
100#define HORIZONTAL_PACKING 1 102#define HORIZONTAL_PACKING 1
@@ -191,6 +193,8 @@
191#include "config-h10_5gb.h" 193#include "config-h10_5gb.h"
192#elif defined(SANSA_E200) 194#elif defined(SANSA_E200)
193#include "config-e200.h" 195#include "config-e200.h"
196#elif defined(SANSA_C200)
197#include "config-c200.h"
194#elif defined(ELIO_TPJ1022) 198#elif defined(ELIO_TPJ1022)
195#include "config-tpj1022.h" 199#include "config-tpj1022.h"
196#else 200#else
@@ -249,7 +253,7 @@
249/* Enable the directory cache and tagcache in RAM if we have 253/* Enable the directory cache and tagcache in RAM if we have
250 * plenty of RAM. Both features can be enabled independently. */ 254 * plenty of RAM. Both features can be enabled independently. */
251#if ((defined(MEMORYSIZE) && (MEMORYSIZE > 8)) || MEM > 8) && \ 255#if ((defined(MEMORYSIZE) && (MEMORYSIZE > 8)) || MEM > 8) && \
252 !defined(BOOTLOADER) && !defined(SANSA_E200) 256 !defined(BOOTLOADER) && !defined(SANSA_E200) && !defined(SANSA_C200)
253#define HAVE_DIRCACHE 257#define HAVE_DIRCACHE
254#ifdef HAVE_TAGCACHE 258#ifdef HAVE_TAGCACHE
255#define HAVE_TC_RAMCACHE 259#define HAVE_TC_RAMCACHE
diff --git a/firmware/export/usb.h b/firmware/export/usb.h
index 82b9d36d4a..0c4231a4e5 100644
--- a/firmware/export/usb.h
+++ b/firmware/export/usb.h
@@ -50,7 +50,8 @@
50#elif CONFIG_KEYPAD == IRIVER_H10_PAD 50#elif CONFIG_KEYPAD == IRIVER_H10_PAD
51#define USBPOWER_BUTTON BUTTON_NONE 51#define USBPOWER_BUTTON BUTTON_NONE
52#define USBPOWER_BTN_IGNORE BUTTON_POWER 52#define USBPOWER_BTN_IGNORE BUTTON_POWER
53#elif CONFIG_KEYPAD == SANSA_E200_PAD 53#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
54 (CONFIG_KEYPAD == SANSA_C200_PAD)
54#define USBPOWER_BUTTON BUTTON_SELECT 55#define USBPOWER_BUTTON BUTTON_SELECT
55#define USBPOWER_BTN_IGNORE BUTTON_POWER 56#define USBPOWER_BTN_IGNORE BUTTON_POWER
56#endif 57#endif
diff --git a/firmware/target/arm/crt0-pp.S b/firmware/target/arm/crt0-pp.S
index 85dd7f8b24..c1ced11cec 100644
--- a/firmware/target/arm/crt0-pp.S
+++ b/firmware/target/arm/crt0-pp.S
@@ -60,7 +60,7 @@ start:
60.space 60*4 /* (more than enough) space for exception vectors and mi4 magic */ 60.space 60*4 /* (more than enough) space for exception vectors and mi4 magic */
61 61
62pad_skip: 62pad_skip:
63#ifdef SANSA_E200 63#if defined(SANSA_E200) || defined(SANSA_C200)
64 /* On the Sansa, copying the vectors fails if the cache is initialised */ 64 /* On the Sansa, copying the vectors fails if the cache is initialised */
65 ldr r1, =CACHE_CTRL 65 ldr r1, =CACHE_CTRL
66 mov r2, #0x0 66 mov r2, #0x0
diff --git a/firmware/target/arm/i2c-pp.c b/firmware/target/arm/i2c-pp.c
index 07fa822ab3..1cc25a1a10 100644
--- a/firmware/target/arm/i2c-pp.c
+++ b/firmware/target/arm/i2c-pp.c
@@ -198,10 +198,27 @@ void i2c_init(void)
198 outl(0x0, 0x600060a4); 198 outl(0x0, 0x600060a4);
199 outl(0x80 | (0 << 8), 0x600060a4); 199 outl(0x80 | (0 << 8), 0x600060a4);
200#elif CONFIG_I2C == I2C_PP5024 200#elif CONFIG_I2C == I2C_PP5024
201#ifdef SANSA_E200
201 /* Sansa OF sets this to 0x20 first, communicates with the AS3514 202 /* Sansa OF sets this to 0x20 first, communicates with the AS3514
202 then sets it to 0x23 - this still works fine though */ 203 then sets it to 0x23 - this still works fine though */
203 outl(0x0, 0x600060a4); 204 outl(0x0, 0x600060a4);
204 outl(0x23, 0x600060a4); 205 outl(0x23, 0x600060a4);
206#elif defined(SANSA_C200)
207 /* This is the init sequence from the Sansa c200 bootloader.
208 I'm not sure what's really necessary. */
209 pp_i2c_wait_not_busy();
210
211 outl(0, 0x600060a4);
212 outl(0x64, 0x600060a4);
213
214 outl(0x55, 0x7000c02c);
215 outl(0x54, 0x7000c030);
216
217 outl(0, 0x600060a4);
218 outl(0x1e, 0x600060a4);
219
220 pp_i2c_send(0x46, 0x24, 5);
221#endif
205#endif 222#endif
206 223
207 spinlock_init(&i2c_mutex); 224 spinlock_init(&i2c_mutex);
diff --git a/firmware/target/arm/i2s-pp.c b/firmware/target/arm/i2s-pp.c
index b9e32b8789..fc01e38e91 100644
--- a/firmware/target/arm/i2s-pp.c
+++ b/firmware/target/arm/i2s-pp.c
@@ -142,7 +142,7 @@ void i2s_reset(void)
142 IISFIFO_CFG |= 0x1100; 142 IISFIFO_CFG |= 0x1100;
143} 143}
144 144
145#ifdef SANSA_E200 145#if defined(SANSA_E200) || defined(SANSA_C200)
146void i2s_scale_attn_level(long frequency) 146void i2s_scale_attn_level(long frequency)
147{ 147{
148 unsigned int iisfifo_cfg = IISFIFO_CFG & ~0xff; 148 unsigned int iisfifo_cfg = IISFIFO_CFG & ~0xff;
diff --git a/firmware/target/arm/sandisk/ata-c200_e200.c b/firmware/target/arm/sandisk/ata-c200_e200.c
index a61e2ab610..addc490417 100644
--- a/firmware/target/arm/sandisk/ata-c200_e200.c
+++ b/firmware/target/arm/sandisk/ata-c200_e200.c
@@ -519,6 +519,7 @@ static int sd_select_bank(unsigned char bank)
519static void sd_card_mux(int card_no) 519static void sd_card_mux(int card_no)
520{ 520{
521/* Set the current card mux */ 521/* Set the current card mux */
522#ifdef SANSA_E200
522 if (card_no == 0) 523 if (card_no == 0)
523 { 524 {
524 outl(inl(0x70000080) | 0x4, 0x70000080); 525 outl(inl(0x70000080) | 0x4, 0x70000080);
@@ -543,6 +544,32 @@ static void sd_card_mux(int card_no)
543 544
544 outl(inl(0x70000014) & ~(0x3ffff), 0x70000014); 545 outl(inl(0x70000014) & ~(0x3ffff), 0x70000014);
545 } 546 }
547#else /* SANSA_C200 */
548 if (card_no == 0)
549 {
550 outl(inl(0x70000080) | 0x4, 0x70000080);
551
552 GPIOD_ENABLE &= ~0x1f;
553 GPIOD_OUTPUT_EN &= ~0x1f;
554 GPIOA_ENABLE |= 0x7a;
555 GPIOA_OUTPUT_VAL |= 0x7a;
556 GPIOA_OUTPUT_EN |= 0x7a;
557
558 outl(inl(0x70000014) & ~(0x3ffff), 0x70000014);
559 }
560 else
561 {
562 outl(inl(0x70000080) & ~0x4, 0x70000080);
563
564 GPIOA_ENABLE &= ~0x7a;
565 GPIOA_OUTPUT_EN &= ~0x7a;
566 GPIOD_ENABLE |= 0x1f;
567 GPIOD_OUTPUT_VAL |= 0x1f;
568 GPIOD_OUTPUT_EN |= 0x1f;
569
570 outl((inl(0x70000014) & ~(0x3ffff)) | 0x255aa, 0x70000014);
571 }
572#endif
546} 573}
547 574
548static void sd_init_device(int card_no) 575static void sd_init_device(int card_no)
diff --git a/firmware/target/arm/sandisk/backlight-c200_e200.c b/firmware/target/arm/sandisk/backlight-c200_e200.c
index 29c6ab4b45..411c19f7ad 100644
--- a/firmware/target/arm/sandisk/backlight-c200_e200.c
+++ b/firmware/target/arm/sandisk/backlight-c200_e200.c
@@ -36,17 +36,21 @@ void __backlight_set_brightness(int brightness)
36 36
37void __backlight_on(void) 37void __backlight_on(void)
38{ 38{
39#ifdef HAVE_LCD_ENABLE
39 lcd_enable(true); /* power on lcd */ 40 lcd_enable(true); /* power on lcd */
41#endif
40 pp_i2c_send( 0x46, 0x23, backlight_brightness); 42 pp_i2c_send( 0x46, 0x23, backlight_brightness);
41} 43}
42 44
43void __backlight_off(void) 45void __backlight_off(void)
44{ 46{
45 pp_i2c_send( 0x46, 0x23, 0x0); 47 pp_i2c_send( 0x46, 0x23, 0x0);
48#ifdef HAVE_LCD_ENABLE
46 lcd_enable(false); /* power off lcd */ 49 lcd_enable(false); /* power off lcd */
50#endif
47} 51}
48 52
49 53#ifdef HAVE_BUTTON_LIGHT
50void __button_backlight_on(void) 54void __button_backlight_on(void)
51{ 55{
52 GPIOG_OUTPUT_VAL |=0x80; 56 GPIOG_OUTPUT_VAL |=0x80;
@@ -56,3 +60,4 @@ void __button_backlight_off(void)
56{ 60{
57 GPIOG_OUTPUT_VAL &=~ 0x80; 61 GPIOG_OUTPUT_VAL &=~ 0x80;
58} 62}
63#endif
diff --git a/firmware/target/arm/sandisk/backlight-target.h b/firmware/target/arm/sandisk/backlight-target.h
index ac256036b9..1b1a6ad4e1 100644
--- a/firmware/target/arm/sandisk/backlight-target.h
+++ b/firmware/target/arm/sandisk/backlight-target.h
@@ -25,6 +25,8 @@ void __backlight_off(void);
25void __backlight_set_brightness(int brightness); 25void __backlight_set_brightness(int brightness);
26int __backlight_is_on(void); 26int __backlight_is_on(void);
27 27
28#ifdef HAVE_BUTTON_LIGHT
28void __button_backlight_on(void); 29void __button_backlight_on(void);
29void __button_backlight_off(void); 30void __button_backlight_off(void);
30#endif 31#endif
32#endif
diff --git a/firmware/target/arm/sandisk/power-c200_e200.c b/firmware/target/arm/sandisk/power-c200_e200.c
index b9a77cb9e0..cb85b117c4 100644
--- a/firmware/target/arm/sandisk/power-c200_e200.c
+++ b/firmware/target/arm/sandisk/power-c200_e200.c
@@ -53,7 +53,11 @@ void power_off(void)
53 53
54bool charger_inserted(void) 54bool charger_inserted(void)
55{ 55{
56#ifdef SANSA_E200
56 if(GPIOB_INPUT_VAL & 0x10) 57 if(GPIOB_INPUT_VAL & 0x10)
58#else /* SANSA_C200 */
59 if(GPIOH_INPUT_VAL & 0x2)
60#endif
57 return true; 61 return true;
58 return false; 62 return false;
59} 63}
@@ -63,6 +67,7 @@ void ide_power_enable(bool on)
63 (void)on; 67 (void)on;
64} 68}
65 69
70#if CONFIG_TUNER
66/** Tuner **/ 71/** Tuner **/
67static bool powered = false; 72static bool powered = false;
68 73
@@ -125,3 +130,5 @@ bool tuner_power(bool status)
125 lv24020lp_unlock(); 130 lv24020lp_unlock();
126 return old_status; 131 return old_status;
127} 132}
133
134#endif
diff --git a/firmware/target/arm/sandisk/sansa-c200/button-c200.c b/firmware/target/arm/sandisk/sansa-c200/button-c200.c
new file mode 100644
index 0000000000..eedd937699
--- /dev/null
+++ b/firmware/target/arm/sandisk/sansa-c200/button-c200.c
@@ -0,0 +1,62 @@
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#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 !(GPIOI_INPUT_VAL & 0x80);
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 ( (GPIOB_INPUT_VAL & 0x20)) btn |= BUTTON_POWER;
51 if (!(GPIOG_INPUT_VAL & 0x10)) btn |= BUTTON_UP;
52 if (!(GPIOH_INPUT_VAL & 0x01)) btn |= BUTTON_DOWN;
53 if (!(GPIOI_INPUT_VAL & 0x04)) btn |= BUTTON_LEFT;
54 if (!(GPIOG_INPUT_VAL & 0x02)) btn |= BUTTON_RIGHT;
55 if (!(GPIOL_INPUT_VAL & 0x04)) btn |= BUTTON_SELECT;
56 if (!(GPIOG_INPUT_VAL & 0x01)) btn |= BUTTON_REC;
57 if (!(GPIOL_INPUT_VAL & 0x10)) btn |= BUTTON_VOL_UP;
58 if (!(GPIOL_INPUT_VAL & 0x20)) btn |= BUTTON_VOL_DOWN;
59 }
60
61 return btn;
62}
diff --git a/firmware/target/arm/sandisk/sansa-c200/button-target.h b/firmware/target/arm/sandisk/sansa-c200/button-target.h
new file mode 100644
index 0000000000..6f42822f7f
--- /dev/null
+++ b/firmware/target/arm/sandisk/sansa-c200/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/* Sandisk Sansa c200 button codes */
33
34/* Main unit's buttons */
35#define BUTTON_REC 0x00000001
36#define BUTTON_DOWN 0x00000002
37#define BUTTON_RIGHT 0x00000004
38#define BUTTON_LEFT 0x00000008
39#define BUTTON_SELECT 0x00000010
40#define BUTTON_UP 0x00000020
41#define BUTTON_POWER 0x00000040
42#define BUTTON_VOL_UP 0x00000080
43#define BUTTON_VOL_DOWN 0x00000100
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/sandisk/sansa-c200/lcd-c200.c b/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c
new file mode 100644
index 0000000000..6626ea4e6d
--- /dev/null
+++ b/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c
@@ -0,0 +1,249 @@
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#include "config.h"
20#include "cpu.h"
21#include "lcd.h"
22#include "kernel.h"
23#include "system.h"
24
25#define LCD_BASE (*(volatile unsigned long *)(0x70003000))
26#define LCD_CMD (*(volatile unsigned long *)(0x70003008))
27#define LCD_DATA (*(volatile unsigned long *)(0x70003010))
28
29#define LCD_BUSY 0x8000
30
31/* check if number of useconds has past */
32static inline bool timer_check(int clock_start, int usecs)
33{
34 return ((int)(USEC_TIMER - clock_start)) >= usecs;
35}
36
37/* wait for LCD with timeout */
38static inline void lcd_wait_write(void)
39{
40 int start = USEC_TIMER;
41
42 do {
43 if ((LCD_BASE & LCD_BUSY) == 0)
44 break;
45 } while (timer_check(start, 1000) == 0);
46}
47
48/* send LCD data */
49static void lcd_send_data(unsigned data)
50{
51 lcd_wait_write();
52 LCD_DATA = (data >> 8) & 0xff;
53
54 lcd_wait_write();
55 LCD_DATA = data & 0xff;
56}
57
58/* send LCD command */
59static void lcd_send_command(unsigned cmd)
60{
61 lcd_wait_write();
62 LCD_CMD = cmd;
63}
64
65/* LCD init */
66void lcd_init_device(void)
67{
68 /* This is from the c200 of bootloader beginning at offset 0xbbf4 */
69 outl(inl(0x70000010) & ~0xfc000000, 0x70000010);
70 outl(inl(0x70000010), 0x70000010);
71
72 DEV_INIT &= ~0x400;
73 udelay(10000);
74
75 LCD_BASE &= ~0x4;
76 udelay(15);
77
78 LCD_BASE |= 0x4;
79 udelay(10);
80
81 LCD_BASE = 0x4687;
82 udelay(10000);
83
84 lcd_send_command(0x2c);
85 udelay(20000);
86
87 lcd_send_command(0x02);
88 lcd_send_command(0x01);
89 udelay(20000);
90
91 lcd_send_command(0x26);
92 lcd_send_command(0x01);
93 udelay(20000);
94
95 lcd_send_command(0x26);
96 lcd_send_command(0x09);
97 udelay(20000);
98
99 lcd_send_command(0x26);
100 lcd_send_command(0x0b);
101 udelay(20000);
102
103 lcd_send_command(0x26);
104 lcd_send_command(0x0f);
105 udelay(20000);
106
107 lcd_send_command(0x10);
108 lcd_send_command(0x07);
109
110 lcd_send_command(0x20);
111 lcd_send_command(0x03);
112
113 lcd_send_command(0x24);
114 lcd_send_command(0x03);
115
116 lcd_send_command(0x28);
117 lcd_send_command(0x01);
118
119 lcd_send_command(0x2a);
120 lcd_send_command(0x55);
121
122 lcd_send_command(0x30);
123 lcd_send_command(0x10);
124
125 lcd_send_command(0x32);
126 lcd_send_command(0x0e);
127
128 lcd_send_command(0x34);
129 lcd_send_command(0x0d);
130
131 lcd_send_command(0x36);
132 lcd_send_command(0);
133
134 lcd_send_command(0x40);
135 lcd_send_command(0x82);
136
137 lcd_send_command(0x43); /* vertical dimensions */
138 lcd_send_command(0x1a); /* y1 + 0x1a */
139 lcd_send_command(LCD_HEIGHT - 1 + 0x1a); /* y2 + 0x1a */
140
141 lcd_send_command(0x42); /* horizontal dimensions */
142 lcd_send_command(0); /* x1 */
143 lcd_send_command(LCD_WIDTH - 1); /* x2 */
144 udelay(100000);
145
146 lcd_send_command(0x51);
147}
148
149/*** hardware configuration ***/
150int lcd_default_contrast(void)
151{
152 return DEFAULT_CONTRAST_SETTING;
153}
154
155void lcd_set_contrast(int val)
156{
157 /* TODO: Implement lcd_set_contrast() */
158 (void)val;
159}
160
161void lcd_set_invert_display(bool yesno)
162{
163 /* TODO: Implement lcd_set_invert_display() */
164 (void)yesno;
165}
166
167/* turn the display upside down (call lcd_update() afterwards) */
168void lcd_set_flip(bool yesno)
169{
170 /* TODO: Implement lcd_set_flip() */
171 (void)yesno;
172}
173
174/*** update functions ***/
175
176/* Performance function that works with an external buffer
177 note that by and bheight are in 4-pixel units! */
178void lcd_blit(const fb_data* data, int x, int by, int width,
179 int bheight, int stride)
180{
181 /* TODO: Implement lcd_blit() */
182 (void)data;
183 (void)x;
184 (void)by;
185 (void)width;
186 (void)bheight;
187 (void)stride;
188}
189
190/* Performance function to blit a YUV bitmap directly to the LCD */
191void lcd_yuv_blit(unsigned char * const src[3],
192 int src_x, int src_y, int stride,
193 int x, int y, int width, int height)
194{
195 (void)src;
196 (void)src_x;
197 (void)src_y;
198 (void)stride;
199 (void)x;
200 (void)y;
201 (void)width;
202 (void)height;
203}
204
205/* Update the display.
206 This must be called after all other LCD functions that change the display. */
207void lcd_update(void)
208{
209 lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
210}
211
212/* Update a fraction of the display. */
213void lcd_update_rect(int x0, int y0, int width, int height)
214{
215 unsigned short *addr;
216 int c, r;
217 int x1 = (x0 + width) - 1;
218 int y1 = (y0 + height) - 1;
219
220 if ((x1 <= 0) || (y1 <= 0))
221 return;
222
223 if(y1 >= LCD_HEIGHT)
224 y1 = LCD_HEIGHT - 1;
225
226 lcd_send_command(0x43);
227 lcd_send_command(y0 + 0x1a);
228 lcd_send_command(y1 + 0x1a);
229
230 if(x1 >= LCD_WIDTH)
231 x1 = LCD_WIDTH - 1;
232
233 lcd_send_command(0x42);
234 lcd_send_command(x0);
235 lcd_send_command(x1);
236
237 addr = (unsigned short*)&lcd_framebuffer[y0][x0];
238
239 /* for each row */
240 for (r = 0; r < height; r++) {
241 /* for each column */
242 for (c = 0; c < width; c++) {
243 /* output 1 pixel */
244 lcd_send_data(*(addr++));
245 }
246
247 addr += LCD_WIDTH - width;
248 }
249}
diff --git a/firmware/target/arm/sandisk/sansa-c200/powermgmt-c200.c b/firmware/target/arm/sandisk/sansa-c200/powermgmt-c200.c
new file mode 100644
index 0000000000..1de57cb184
--- /dev/null
+++ b/firmware/target/arm/sandisk/sansa-c200/powermgmt-c200.c
@@ -0,0 +1,58 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: powermgmt-e200.c 14375 2007-08-17 06:45:18Z amiconn $
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 FIXME this is a first linear approach */
39 { 3300, 3390, 3480, 3570, 3660, 3750, 3840, 3930, 4020, 4110, 4200 },
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, 3390, 3480, 3570, 3660, 3750, 3840, 3930, 4020, 4110, 4200
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 a282564d19..465457d0e1 100644
--- a/firmware/target/arm/system-pp502x.c
+++ b/firmware/target/arm/system-pp502x.c
@@ -120,7 +120,7 @@ static void pp_set_cpu_frequency(long frequency)
120 while (test_and_set(&boostctrl_mtx.locked, 1)) ; 120 while (test_and_set(&boostctrl_mtx.locked, 1)) ;
121#endif 121#endif
122 122
123#ifdef SANSA_E200 123#if defined(SANSA_E200) || defined(SANSA_C200)
124 i2s_scale_attn_level(CPUFREQ_DEFAULT); 124 i2s_scale_attn_level(CPUFREQ_DEFAULT);
125#endif 125#endif
126 126
@@ -183,7 +183,7 @@ static void pp_set_cpu_frequency(long frequency)
183 CLCD_CLOCK_SRC; /* dummy read (to sync the write pipeline??) */ 183 CLCD_CLOCK_SRC; /* dummy read (to sync the write pipeline??) */
184 CLCD_CLOCK_SRC = clcd_clock_src; /* restore saved value */ 184 CLCD_CLOCK_SRC = clcd_clock_src; /* restore saved value */
185 185
186#ifdef SANSA_E200 186#if defined(SANSA_E200) || defined(SANSA_C200)
187 i2s_scale_attn_level(frequency); 187 i2s_scale_attn_level(frequency);
188#endif 188#endif
189 189
@@ -231,7 +231,7 @@ void system_init(void)
231 GPIOK_INT_EN = 0; 231 GPIOK_INT_EN = 0;
232 GPIOL_INT_EN = 0; 232 GPIOL_INT_EN = 0;
233 233
234#ifdef SANSA_E200 234#if defined(SANSA_E200) || defined(SANSA_C200)
235 /* outl(0x00000000, 0x6000b000); */ 235 /* outl(0x00000000, 0x6000b000); */
236 outl(inl(0x6000a000) | 0x80000000, 0x6000a000); /* Init DMA controller? */ 236 outl(inl(0x6000a000) | 0x80000000, 0x6000a000); /* Init DMA controller? */
237#endif 237#endif
diff --git a/tools/configure b/tools/configure
index 2549595a62..0aa3d21382 100755
--- a/tools/configure
+++ b/tools/configure
@@ -616,6 +616,7 @@ cat <<EOF
616 ==iAudio== ==Toshiba== ==SanDisk== 616 ==iAudio== ==Toshiba== ==SanDisk==
617 30) X5/X5V/X5L 40) Gigabeat F 50) Sansa e200 617 30) X5/X5V/X5L 40) Gigabeat F 50) Sansa e200
618 31) M5/M5L 51) Sansa e200R 618 31) M5/M5L 51) Sansa e200R
619 52) Sansa c200
619 620
620 ==Tatung== 621 ==Tatung==
621 60) Elio TPJ-1022 622 60) Elio TPJ-1022
@@ -1311,6 +1312,32 @@ EOF
1311 t_model="sansa-e200" 1312 t_model="sansa-e200"
1312 ;; 1313 ;;
1313 1314
1315 52|c200)
1316 target_id=30
1317 archos="c200"
1318 target="-DSANSA_C200"
1319 memory=32 # supposedly
1320 arm7tdmicc
1321 tool="$rootdir/tools/scramble -mi4v3 -model=c200 -type=RBOS"
1322 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1323 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1324 output="rockbox.mi4"
1325 appextra="recorder:gui"
1326 archosrom=""
1327 flash=""
1328 plugins=""
1329 swcodec="yes"
1330 boottool="$rootdir/tools/scramble -mi4v3 -model=c200 -type=RBBL"
1331 bootoutput="firmware.mi4"
1332 # toolset is the tools within the tools directory that we build for
1333 # this particular target.
1334 toolset="$genericbitmaptools scramble"
1335 # architecture, manufacturer and model for the target-tree build
1336 t_cpu="arm"
1337 t_manufacturer="sandisk"
1338 t_model="sansa-c200"
1339 ;;
1340
1314 60|tpj1022) 1341 60|tpj1022)
1315 target_id=25 1342 target_id=25
1316 archos="tpj1022" 1343 archos="tpj1022"
@@ -1453,7 +1480,7 @@ fi
1453 ;; 1480 ;;
1454 [Mm]) 1481 [Mm])
1455 appsdir='\$(ROOTDIR)/manual' 1482 appsdir='\$(ROOTDIR)/manual'
1456 firmdir='\$(ROOTDIR)/manual/platform' # No Makefile here. Effectively ignores target 1483 firmdir='\$(ROOTDIR)/manual/platform' # No Makefile here. Effectively ig:res target
1457 toolsdir=$firmdir; 1484 toolsdir=$firmdir;
1458 toolset=''; 1485 toolset='';
1459 apps="manual" 1486 apps="manual"
diff --git a/tools/scramble.c b/tools/scramble.c
index b7c8d1f41a..9f18e96e85 100644
--- a/tools/scramble.c
+++ b/tools/scramble.c
@@ -102,7 +102,8 @@ void usage(void)
102 "\t type of binary, eg. RBOS, RBBL\n" 102 "\t type of binary, eg. RBOS, RBBL\n"
103 "\t-add=X Rockbox generic \"add-up\" checksum format\n" 103 "\t-add=X Rockbox generic \"add-up\" checksum format\n"
104 "\t (X values: h100, h120, h140, h300, ipco, nano, ipvd, mn2g\n" 104 "\t (X values: h100, h120, h140, h300, ipco, nano, ipvd, mn2g\n"
105 "\t ip3g, ip4g, mini, iax5, h10, h10_5gb, tpj2, e200)\n" 105 "\t ip3g, ip4g, mini, iax5, h10, h10_5gb, tpj2,\n"
106 "\t c200, e200)\n"
106 "\nNo option results in Archos standard player/recorder format.\n"); 107 "\nNo option results in Archos standard player/recorder format.\n");
107 108
108 exit(1); 109 exit(1);
@@ -228,6 +229,8 @@ int main (int argc, char** argv)
228 modelnum = 18; 229 modelnum = 18;
229 else if(!strcmp(&argv[1][5], "1g2g")) 230 else if(!strcmp(&argv[1][5], "1g2g"))
230 modelnum = 19; 231 modelnum = 19;
232 else if(!strcmp(&argv[1][5], "c200"))
233 modelnum = 20;
231 else { 234 else {
232 fprintf(stderr, "unsupported model: %s\n", &argv[1][5]); 235 fprintf(stderr, "unsupported model: %s\n", &argv[1][5]);
233 return 2; 236 return 2;