diff options
31 files changed, 1879 insertions, 37 deletions
diff --git a/apps/keymaps/keymap-m200.c b/apps/keymaps/keymap-m200.c new file mode 100644 index 0000000000..141905129a --- /dev/null +++ b/apps/keymaps/keymap-m200.c | |||
@@ -0,0 +1,323 @@ | |||
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 | */ | ||
34 | static const struct button_mapping button_context_standard[] = { | ||
35 | { ACTION_STD_PREV, BUTTON_VOLUP, BUTTON_NONE }, | ||
36 | { ACTION_STD_PREVREPEAT, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE }, | ||
37 | |||
38 | { ACTION_STD_NEXT, BUTTON_VOLDOWN, BUTTON_NONE }, | ||
39 | { ACTION_STD_NEXTREPEAT, BUTTON_VOLDOWN|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_MENU|BUTTON_REL, BUTTON_MENU }, | ||
46 | { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, | ||
47 | // { ACTION_STD_QUICKSCREEN, BUTTON_REC|BUTTON_SELECT, BUTTON_NONE }, | ||
48 | |||
49 | LAST_ITEM_IN_LIST | ||
50 | }; /* button_context_standard */ | ||
51 | |||
52 | |||
53 | static const struct button_mapping button_context_wps[] = { | ||
54 | { ACTION_WPS_PLAY, BUTTON_VOLUP|BUTTON_REL, BUTTON_VOLUP }, | ||
55 | { ACTION_WPS_STOP, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_VOLUP }, | ||
56 | |||
57 | { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, | ||
58 | { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
59 | { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT }, | ||
60 | |||
61 | { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, | ||
62 | { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
63 | { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT }, | ||
64 | |||
65 | { ACTION_WPS_ABSETB_NEXTDIR,BUTTON_MENU|BUTTON_RIGHT, BUTTON_MENU }, | ||
66 | { ACTION_WPS_ABSETA_PREVDIR,BUTTON_MENU|BUTTON_LEFT, BUTTON_MENU }, | ||
67 | { ACTION_WPS_ABRESET, BUTTON_MENU|BUTTON_VOLUP, BUTTON_MENU }, | ||
68 | |||
69 | { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, | ||
70 | { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, | ||
71 | { ACTION_WPS_PITCHSCREEN, BUTTON_SELECT|BUTTON_VOLUP, BUTTON_SELECT }, | ||
72 | { ACTION_WPS_ID3SCREEN, BUTTON_SELECT|BUTTON_VOLDOWN, BUTTON_SELECT }, | ||
73 | { ACTION_WPS_CONTEXT, BUTTON_VOLDOWN|BUTTON_REL, BUTTON_VOLDOWN }, | ||
74 | { ACTION_WPS_QUICKSCREEN, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_VOLDOWN }, | ||
75 | |||
76 | LAST_ITEM_IN_LIST | ||
77 | }; /* button_context_wps */ | ||
78 | |||
79 | static const struct button_mapping button_context_settings[] = { | ||
80 | { ACTION_STD_CANCEL, BUTTON_MENU, BUTTON_NONE }, | ||
81 | { ACTION_SETTINGS_RESET, BUTTON_SELECT, BUTTON_NONE }, | ||
82 | |||
83 | { ACTION_SETTINGS_INC, BUTTON_VOLUP, BUTTON_NONE }, | ||
84 | { ACTION_SETTINGS_INCREPEAT,BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE }, | ||
85 | |||
86 | { ACTION_SETTINGS_DEC, BUTTON_VOLDOWN, BUTTON_NONE }, | ||
87 | { ACTION_SETTINGS_DECREPEAT,BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
88 | |||
89 | { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE }, | ||
90 | { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
91 | |||
92 | { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE }, | ||
93 | { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
94 | |||
95 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD), | ||
96 | }; /* button_context_settings */ | ||
97 | |||
98 | static const struct button_mapping button_context_list[] = { | ||
99 | #ifdef HAVE_VOLUME_IN_LIST | ||
100 | { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
101 | { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, | ||
102 | |||
103 | { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, | ||
104 | { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
105 | #endif | ||
106 | |||
107 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
108 | }; /* button_context_list */ | ||
109 | |||
110 | static const struct button_mapping button_context_tree[] = { | ||
111 | // { ACTION_TREE_WPS, BUTTON_REC|BUTTON_VOLUP, BUTTON_REC }, | ||
112 | // { ACTION_TREE_STOP, BUTTON_REC|BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_REC|BUTTON_VOLUP }, | ||
113 | |||
114 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), | ||
115 | }; /* button_context_tree */ | ||
116 | |||
117 | static const struct button_mapping button_context_listtree_scroll_without_combo[] = { | ||
118 | { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE }, | ||
119 | { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, | ||
120 | { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT }, | ||
121 | { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
122 | { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT }, | ||
123 | |||
124 | { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE }, | ||
125 | { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, | ||
126 | { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
127 | { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT }, | ||
128 | |||
129 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE), | ||
130 | }; /* button_context_listtree_scroll_without_combo */ | ||
131 | |||
132 | static const struct button_mapping button_context_listtree_scroll_with_combo[] = { | ||
133 | { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
134 | |||
135 | // { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT, BUTTON_REC }, | ||
136 | // { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
137 | |||
138 | // { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_REC }, | ||
139 | // { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE }, | ||
140 | |||
141 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE), | ||
142 | }; /* button_context_listtree_scroll_with_combo */ | ||
143 | |||
144 | static const struct button_mapping button_context_yesno[] = { | ||
145 | { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE }, | ||
146 | |||
147 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD), | ||
148 | }; /* button_context_settings_yesno */ | ||
149 | |||
150 | static const struct button_mapping button_context_quickscreen[] = { | ||
151 | { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE }, | ||
152 | { ACTION_STD_CANCEL, BUTTON_MENU|BUTTON_REL, BUTTON_NONE }, | ||
153 | |||
154 | { ACTION_QS_DOWNINV, BUTTON_VOLUP|BUTTON_REL, BUTTON_NONE }, | ||
155 | { ACTION_QS_DOWNINV, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE }, | ||
156 | |||
157 | { ACTION_QS_DOWN, BUTTON_VOLDOWN|BUTTON_REL, BUTTON_NONE }, | ||
158 | { ACTION_QS_DOWN, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
159 | |||
160 | { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE }, | ||
161 | { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
162 | |||
163 | { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE }, | ||
164 | { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
165 | |||
166 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD), | ||
167 | }; /* button_context_quickscreen */ | ||
168 | |||
169 | static const struct button_mapping button_context_settings_right_is_inc[] = { | ||
170 | { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE }, | ||
171 | { ACTION_SETTINGS_INCREPEAT,BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
172 | |||
173 | { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE }, | ||
174 | { ACTION_SETTINGS_DECREPEAT,BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
175 | |||
176 | { ACTION_STD_CANCEL, BUTTON_MENU, BUTTON_NONE }, | ||
177 | |||
178 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD), | ||
179 | }; /* button_context_settings_right_is_inc */ | ||
180 | |||
181 | static const struct button_mapping button_context_pitchscreen[] = { | ||
182 | { ACTION_PS_INC_SMALL, BUTTON_VOLUP, BUTTON_NONE }, | ||
183 | { ACTION_PS_INC_BIG, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE }, | ||
184 | |||
185 | { ACTION_PS_DEC_SMALL, BUTTON_VOLDOWN, BUTTON_NONE }, | ||
186 | { ACTION_PS_DEC_BIG, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
187 | |||
188 | { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE }, | ||
189 | { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE }, | ||
190 | |||
191 | { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, | ||
192 | { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE }, | ||
193 | |||
194 | { ACTION_PS_RESET, BUTTON_SELECT, BUTTON_NONE }, | ||
195 | { ACTION_PS_EXIT, BUTTON_MENU, BUTTON_NONE }, | ||
196 | |||
197 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD), | ||
198 | }; /* button_context_pitchscreen */ | ||
199 | |||
200 | /** Recording Screen **/ | ||
201 | #ifdef HAVE_RECORDING | ||
202 | static const struct button_mapping button_context_recscreen[] = { | ||
203 | { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, | ||
204 | { ACTION_REC_PAUSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, | ||
205 | { ACTION_STD_CANCEL, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE }, | ||
206 | { ACTION_REC_NEWFILE, BUTTON_REC|BUTTON_REL, BUTTON_REC }, | ||
207 | |||
208 | { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE }, | ||
209 | { ACTION_SETTINGS_INCREPEAT,BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
210 | { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE }, | ||
211 | { ACTION_SETTINGS_DECREPEAT,BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
212 | |||
213 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
214 | }; /* button_context_recscreen */ | ||
215 | #endif | ||
216 | |||
217 | /** FM Radio Screen **/ | ||
218 | #if CONFIG_TUNER | ||
219 | static const struct button_mapping button_context_radio[] = { | ||
220 | { ACTION_NONE, BUTTON_VOLUP, BUTTON_NONE }, | ||
221 | { ACTION_FM_MENU, BUTTON_VOLDOWN, BUTTON_NONE }, | ||
222 | { ACTION_FM_PRESET, BUTTON_SELECT, BUTTON_NONE }, | ||
223 | { ACTION_FM_STOP, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_VOLUP }, | ||
224 | { ACTION_FM_MODE, BUTTON_REC, BUTTON_NONE }, | ||
225 | { ACTION_FM_EXIT, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, | ||
226 | { ACTION_FM_PLAY, BUTTON_VOLUP|BUTTON_REL, BUTTON_VOLUP }, | ||
227 | { ACTION_SETTINGS_INC, BUTTON_VOL_UP, BUTTON_NONE }, | ||
228 | { ACTION_SETTINGS_INCREPEAT,BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
229 | { ACTION_SETTINGS_DEC, BUTTON_VOL_DOWN, BUTTON_NONE }, | ||
230 | { ACTION_SETTINGS_DECREPEAT,BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
231 | |||
232 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS) | ||
233 | }; /* button_context_radio */ | ||
234 | #endif | ||
235 | |||
236 | static const struct button_mapping button_context_keyboard[] = { | ||
237 | { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE }, | ||
238 | { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
239 | { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, | ||
240 | { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
241 | |||
242 | // { ACTION_KBD_CURSOR_LEFT, BUTTON_REC|BUTTON_LEFT, BUTTON_NONE }, | ||
243 | // { ACTION_KBD_CURSOR_LEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT,BUTTON_NONE }, | ||
244 | // { ACTION_KBD_CURSOR_RIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_NONE }, | ||
245 | // { ACTION_KBD_CURSOR_RIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE }, | ||
246 | |||
247 | { ACTION_KBD_UP, BUTTON_VOLUP, BUTTON_NONE }, | ||
248 | { ACTION_KBD_UP, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE }, | ||
249 | { ACTION_KBD_DOWN, BUTTON_VOLDOWN, BUTTON_NONE }, | ||
250 | { ACTION_KBD_DOWN, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
251 | |||
252 | // { ACTION_KBD_BACKSPACE, BUTTON_REC|BUTTON_VOLDOWN, BUTTON_NONE }, | ||
253 | // { ACTION_KBD_BACKSPACE, BUTTON_REC|BUTTON_VOLDOWN|BUTTON_REPEAT,BUTTON_NONE }, | ||
254 | |||
255 | // { ACTION_KBD_PAGE_FLIP, BUTTON_REC|BUTTON_SELECT, BUTTON_REC }, | ||
256 | |||
257 | { ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE }, | ||
258 | { ACTION_KBD_DONE, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, | ||
259 | { ACTION_KBD_ABORT, BUTTON_MENU, BUTTON_NONE }, | ||
260 | |||
261 | LAST_ITEM_IN_LIST | ||
262 | }; /* button_context_keyboard */ | ||
263 | |||
264 | static const struct button_mapping button_context_bmark[] = { | ||
265 | // { ACTION_BMS_DELETE, BUTTON_REC, BUTTON_NONE }, | ||
266 | |||
267 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), | ||
268 | }; /* button_context_bmark */ | ||
269 | |||
270 | /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */ | ||
271 | const struct button_mapping* get_context_mapping(int context) | ||
272 | { | ||
273 | switch (context) | ||
274 | { | ||
275 | case CONTEXT_STD: | ||
276 | return button_context_standard; | ||
277 | |||
278 | case CONTEXT_WPS: | ||
279 | return button_context_wps; | ||
280 | |||
281 | case CONTEXT_LIST: | ||
282 | return button_context_list; | ||
283 | case CONTEXT_TREE: | ||
284 | case CONTEXT_MAINMENU: | ||
285 | if (global_settings.hold_lr_for_scroll_in_list) | ||
286 | return button_context_listtree_scroll_without_combo; | ||
287 | else | ||
288 | return button_context_listtree_scroll_with_combo; | ||
289 | case CONTEXT_CUSTOM|CONTEXT_TREE: | ||
290 | return button_context_tree; | ||
291 | |||
292 | case CONTEXT_SETTINGS: | ||
293 | case CONTEXT_SETTINGS_TIME: | ||
294 | return button_context_settings; | ||
295 | case CONTEXT_CUSTOM|CONTEXT_SETTINGS: | ||
296 | case CONTEXT_SETTINGS_COLOURCHOOSER: | ||
297 | case CONTEXT_SETTINGS_EQ: | ||
298 | return button_context_settings_right_is_inc; | ||
299 | |||
300 | case CONTEXT_YESNOSCREEN: | ||
301 | return button_context_yesno; | ||
302 | #if CONFIG_TUNER | ||
303 | case CONTEXT_FM: | ||
304 | return button_context_radio; | ||
305 | #endif | ||
306 | case CONTEXT_BOOKMARKSCREEN: | ||
307 | return button_context_bmark; | ||
308 | case CONTEXT_QUICKSCREEN: | ||
309 | return button_context_quickscreen; | ||
310 | case CONTEXT_PITCHSCREEN: | ||
311 | return button_context_pitchscreen; | ||
312 | #ifdef HAVE_RECORDING | ||
313 | case CONTEXT_RECSCREEN: | ||
314 | return button_context_recscreen; | ||
315 | #endif | ||
316 | case CONTEXT_KEYBOARD: | ||
317 | return button_context_keyboard; | ||
318 | |||
319 | default: | ||
320 | return button_context_standard; | ||
321 | } | ||
322 | return button_context_standard; | ||
323 | } | ||
diff --git a/bootloader/telechips.c b/bootloader/telechips.c index 666657565d..7563a18632 100644 --- a/bootloader/telechips.c +++ b/bootloader/telechips.c | |||
@@ -53,6 +53,64 @@ extern int line; | |||
53 | 53 | ||
54 | #define MAX_LOAD_SIZE (8*1024*1024) /* Arbitrary, but plenty. */ | 54 | #define MAX_LOAD_SIZE (8*1024*1024) /* Arbitrary, but plenty. */ |
55 | 55 | ||
56 | /* The following function is just test/development code */ | ||
57 | #ifdef CPU_TCC77X | ||
58 | void show_debug_screen(void) | ||
59 | { | ||
60 | int button; | ||
61 | int power_count = 0; | ||
62 | int count = 0; | ||
63 | bool do_power_off = false; | ||
64 | |||
65 | lcd_puts_scroll(0,0,"this is a very long line to test scrolling"); | ||
66 | while(!do_power_off) { | ||
67 | line = 1; | ||
68 | button = button_get(false); | ||
69 | |||
70 | /* Power-off if POWER button has been held for a long time | ||
71 | This loop is currently running at about 100 iterations/second | ||
72 | */ | ||
73 | if (button & POWEROFF_BUTTON) { | ||
74 | power_count++; | ||
75 | if (power_count > 200) | ||
76 | do_power_off = true; | ||
77 | } else { | ||
78 | power_count = 0; | ||
79 | } | ||
80 | |||
81 | printf("Btn: 0x%08x",button); | ||
82 | printf("Tick: %d",current_tick); | ||
83 | |||
84 | printf("GPIOA: 0x%08x",GPIOA); | ||
85 | printf("GPIOB: 0x%08x",GPIOB); | ||
86 | printf("GPIOC: 0x%08x",GPIOC); | ||
87 | printf("GPIOD: 0x%08x",GPIOD); | ||
88 | // printf("GPIOE: 0x%08x",GPIOE); | ||
89 | |||
90 | #if 0 | ||
91 | int i; | ||
92 | for (i = 0; i<4; i++) | ||
93 | { | ||
94 | printf("ADC%d: 0x%04x",i,adc_read(i)); | ||
95 | } | ||
96 | #endif | ||
97 | count++; | ||
98 | printf("Count: %d",count); | ||
99 | sleep(HZ/10); | ||
100 | |||
101 | } | ||
102 | |||
103 | lcd_clear_display(); | ||
104 | line = 0; | ||
105 | printf("POWER-OFF"); | ||
106 | |||
107 | /* Power-off */ | ||
108 | power_off(); | ||
109 | |||
110 | printf("(NOT) POWERED OFF"); | ||
111 | while (true); | ||
112 | } | ||
113 | #else /* !CPU_TCC77X */ | ||
56 | void show_debug_screen(void) | 114 | void show_debug_screen(void) |
57 | { | 115 | { |
58 | int button; | 116 | int button; |
@@ -100,7 +158,7 @@ void show_debug_screen(void) | |||
100 | printf("(NOT) POWERED OFF"); | 158 | printf("(NOT) POWERED OFF"); |
101 | while (true); | 159 | while (true); |
102 | } | 160 | } |
103 | 161 | #endif | |
104 | 162 | ||
105 | void* main(void) | 163 | void* main(void) |
106 | { | 164 | { |
@@ -111,6 +169,11 @@ void* main(void) | |||
111 | 169 | ||
112 | power_init(); | 170 | power_init(); |
113 | system_init(); | 171 | system_init(); |
172 | #ifndef COWON_D2 | ||
173 | /* The D2 doesn't enable threading or interrupts */ | ||
174 | kernel_init(); | ||
175 | enable_irq(); | ||
176 | #endif | ||
114 | lcd_init(); | 177 | lcd_init(); |
115 | 178 | ||
116 | adc_init(); | 179 | adc_init(); |
diff --git a/firmware/SOURCES b/firmware/SOURCES index 367e8c146b..5a82cd3216 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -151,6 +151,8 @@ drivers/rtc/rtc_rx5x348ab.c | |||
151 | drivers/rtc/rtc_mr100.c | 151 | drivers/rtc/rtc_mr100.c |
152 | #elif (CONFIG_RTC == RTC_MC13783) | 152 | #elif (CONFIG_RTC == RTC_MC13783) |
153 | drivers/rtc/rtc_mc13783.c | 153 | drivers/rtc/rtc_mc13783.c |
154 | #elif (CONFIG_RTC == RTC_TCC77X) | ||
155 | drivers/rtc/rtc_tcc77x.c | ||
154 | #endif /* (CONFIG_RTC == RTC_) */ | 156 | #endif /* (CONFIG_RTC == RTC_) */ |
155 | #endif /* SIMULATOR */ | 157 | #endif /* SIMULATOR */ |
156 | 158 | ||
@@ -316,7 +318,7 @@ target/arm/ffs-arm.S | |||
316 | target/arm/i2c-pp.c | 318 | target/arm/i2c-pp.c |
317 | #elif CONFIG_I2C == I2C_PNX0101 | 319 | #elif CONFIG_I2C == I2C_PNX0101 |
318 | target/arm/pnx0101/i2c-pnx0101.c | 320 | target/arm/pnx0101/i2c-pnx0101.c |
319 | #elif CONFIG_I2C == I2C_TCC780X | 321 | #elif CONFIG_I2C == I2C_TCC780X || CONFIG_I2C == I2C_TCC77X |
320 | target/arm/i2c-telechips.c | 322 | target/arm/i2c-telechips.c |
321 | #elif CONFIG_I2C == I2C_S3C2440 | 323 | #elif CONFIG_I2C == I2C_S3C2440 |
322 | /* no i2c driver yet */ | 324 | /* no i2c driver yet */ |
@@ -919,10 +921,37 @@ target/arm/pnx0101/pcm-pnx0101.c | |||
919 | #ifndef SIMULATOR | 921 | #ifndef SIMULATOR |
920 | target/arm/tcc77x/adc-tcc77x.c | 922 | target/arm/tcc77x/adc-tcc77x.c |
921 | target/arm/tcc77x/ata-nand-tcc77x.c | 923 | target/arm/tcc77x/ata-nand-tcc77x.c |
922 | target/arm/tcc77x/system-tcc77x.c | 924 | target/arm/tcc77x/kernel-tcc77x.c |
923 | target/arm/tcc77x/lcd-ssd1815.c | 925 | target/arm/tcc77x/lcd-ssd1815.c |
926 | target/arm/tcc77x/powermgmt-tcc77x.c | ||
927 | target/arm/tcc77x/system-tcc77x.c | ||
928 | target/arm/tcc77x/timer-tcc77x.c | ||
929 | target/arm/tcc77x/usb-tcc77x.c | ||
924 | target/arm/tcc77x/logikdax/button-logikdax.c | 930 | target/arm/tcc77x/logikdax/button-logikdax.c |
925 | target/arm/tcc77x/logikdax/power-logikdax.c | 931 | target/arm/tcc77x/logikdax/power-logikdax.c |
932 | #ifndef BOOTLOADER | ||
933 | target/arm/tcc77x/debug-tcc77x.c | ||
934 | target/arm/tcc77x/pcm-tcc77x.c | ||
935 | #endif /* BOOTLOADER */ | ||
936 | #endif /* SIMULATOR */ | ||
937 | #endif /* LOGIK_DAX */ | ||
938 | |||
939 | #ifdef SANSA_M200 | ||
940 | #ifndef SIMULATOR | ||
941 | target/arm/tcc77x/adc-tcc77x.c | ||
942 | target/arm/tcc77x/ata-nand-tcc77x.c | ||
943 | target/arm/tcc77x/kernel-tcc77x.c | ||
944 | target/arm/tcc77x/lcd-ssd1815.c | ||
945 | target/arm/tcc77x/powermgmt-tcc77x.c | ||
946 | target/arm/tcc77x/system-tcc77x.c | ||
947 | target/arm/tcc77x/timer-tcc77x.c | ||
948 | target/arm/tcc77x/usb-tcc77x.c | ||
949 | target/arm/tcc77x/m200/button-m200.c | ||
950 | target/arm/tcc77x/m200/power-m200.c | ||
951 | #ifndef BOOTLOADER | ||
952 | target/arm/tcc77x/debug-tcc77x.c | ||
953 | target/arm/tcc77x/pcm-tcc77x.c | ||
954 | #endif /* BOOTLOADER */ | ||
926 | #endif /* SIMULATOR */ | 955 | #endif /* SIMULATOR */ |
927 | #endif /* LOGIK_DAX */ | 956 | #endif /* LOGIK_DAX */ |
928 | 957 | ||
diff --git a/firmware/drivers/audio/tlv320.c b/firmware/drivers/audio/tlv320.c index c0f37302fc..6a22ab1c74 100644 --- a/firmware/drivers/audio/tlv320.c +++ b/firmware/drivers/audio/tlv320.c | |||
@@ -21,7 +21,9 @@ | |||
21 | #include "string.h" | 21 | #include "string.h" |
22 | #include "audio.h" | 22 | #include "audio.h" |
23 | 23 | ||
24 | #ifdef CPU_COLDFIRE | ||
24 | #include "i2c-coldfire.h" | 25 | #include "i2c-coldfire.h" |
26 | #endif | ||
25 | #include "audiohw.h" | 27 | #include "audiohw.h" |
26 | 28 | ||
27 | const struct sound_settings_info audiohw_settings[] = { | 29 | const struct sound_settings_info audiohw_settings[] = { |
@@ -73,7 +75,11 @@ static void tlv320_write_reg(unsigned reg, unsigned value) | |||
73 | data[0] = (reg << 1) | ((value >> 8) & 1); | 75 | data[0] = (reg << 1) | ((value >> 8) & 1); |
74 | data[1] = value; | 76 | data[1] = value; |
75 | 77 | ||
78 | #ifdef CPU_COLDFIRE | ||
76 | if (i2c_write(I2C_IFACE_0, TLV320_ADDR, data, 2) != 2) | 79 | if (i2c_write(I2C_IFACE_0, TLV320_ADDR, data, 2) != 2) |
80 | #else | ||
81 | #warning Implement tlv320_write_reg() | ||
82 | #endif | ||
77 | { | 83 | { |
78 | logf("tlv320 error reg=0x%x", reg); | 84 | logf("tlv320 error reg=0x%x", reg); |
79 | return; | 85 | return; |
diff --git a/firmware/drivers/rtc/rtc_tcc77x.c b/firmware/drivers/rtc/rtc_tcc77x.c new file mode 100644 index 0000000000..140adbc27b --- /dev/null +++ b/firmware/drivers/rtc/rtc_tcc77x.c | |||
@@ -0,0 +1,75 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Dave Chapman | ||
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 "rtc.h" | ||
21 | #include "system.h" | ||
22 | #include <stdbool.h> | ||
23 | |||
24 | void rtc_init(void) | ||
25 | { | ||
26 | } | ||
27 | |||
28 | int rtc_read_datetime(unsigned char* buf) | ||
29 | { | ||
30 | |||
31 | } | ||
32 | |||
33 | int rtc_write_datetime(unsigned char* buf) | ||
34 | { | ||
35 | return 1; | ||
36 | } | ||
37 | |||
38 | /** | ||
39 | * Checks to see if an alarm interrupt has triggered since last we checked. | ||
40 | */ | ||
41 | bool rtc_check_alarm_flag(void) | ||
42 | { | ||
43 | |||
44 | } | ||
45 | |||
46 | /** | ||
47 | * Enables or disables the alarm. | ||
48 | */ | ||
49 | bool rtc_enable_alarm(bool enable) | ||
50 | { | ||
51 | } | ||
52 | |||
53 | /** | ||
54 | * Check if alarm caused unit to start. | ||
55 | */ | ||
56 | bool rtc_check_alarm_started(bool release_alarm) | ||
57 | { | ||
58 | } | ||
59 | |||
60 | void rtc_set_alarm(int h, int m) | ||
61 | { | ||
62 | /* Convert to BCD */ | ||
63 | // pcf50605_write(0x12, ((m/10) << 4) | m%10); | ||
64 | // pcf50605_write(0x13, ((h/10) << 4) | h%10); | ||
65 | } | ||
66 | |||
67 | void rtc_get_alarm(int *h, int *m) | ||
68 | { | ||
69 | char buf[2]; | ||
70 | |||
71 | /* Convert from BCD */ | ||
72 | // *m = ((buf[0] >> 4) & 0x7)*10 + (buf[0] & 0x0f); | ||
73 | // *h = ((buf[1] >> 4) & 0x3)*10 + (buf[1] & 0x0f); | ||
74 | } | ||
75 | |||
diff --git a/firmware/export/config-logikdax.h b/firmware/export/config-logikdax.h index 8c6509cdaf..175bf7ccdf 100644 --- a/firmware/export/config-logikdax.h +++ b/firmware/export/config-logikdax.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #define TARGET_TREE /* this target is using the target tree system */ | 4 | #define TARGET_TREE /* this target is using the target tree system */ |
5 | 5 | ||
6 | /* For Rolo and boot loader */ | 6 | /* For Rolo and boot loader */ |
7 | #define MODEL_NUMBER 23 | 7 | #define MODEL_NUMBER 27 |
8 | 8 | ||
9 | /* define this if you have recording possibility */ | 9 | /* define this if you have recording possibility */ |
10 | //#define HAVE_RECORDING | 10 | //#define HAVE_RECORDING |
diff --git a/firmware/export/config-m200.h b/firmware/export/config-m200.h new file mode 100644 index 0000000000..760474d628 --- /dev/null +++ b/firmware/export/config-m200.h | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | * This config file is for the Sansa M200 series | ||
3 | */ | ||
4 | #define TARGET_TREE /* this target is using the target tree system */ | ||
5 | |||
6 | /* For Rolo and boot loader */ | ||
7 | #define MODEL_NUMBER 28 | ||
8 | |||
9 | /* define this if you have recording possibility */ | ||
10 | //#define HAVE_RECORDING | ||
11 | |||
12 | /* Define bitmask of input sources - recordable bitmask can be defined | ||
13 | explicitly if different */ | ||
14 | //#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_SPDIF) | ||
15 | |||
16 | /* define this if you have a bitmap LCD display */ | ||
17 | #define HAVE_LCD_BITMAP | ||
18 | |||
19 | /* define this if you can flip your LCD */ | ||
20 | #define HAVE_LCD_FLIP | ||
21 | |||
22 | /* define this if you can invert the colours on your LCD */ | ||
23 | #define HAVE_LCD_INVERT | ||
24 | |||
25 | /* define this if you have access to the quickscreen */ | ||
26 | #define HAVE_QUICKSCREEN | ||
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 | /* define this if you have a flash memory storage */ | ||
34 | #define HAVE_FLASH_STORAGE | ||
35 | |||
36 | /* LCD dimensions */ | ||
37 | #define LCD_WIDTH 128 | ||
38 | #define LCD_HEIGHT 64 | ||
39 | #define LCD_DEPTH 1 | ||
40 | |||
41 | #define LCD_PIXELFORMAT VERTICAL_PACKING | ||
42 | |||
43 | /* define this to indicate your device's keypad */ | ||
44 | #define CONFIG_KEYPAD SANSA_M200_PAD | ||
45 | |||
46 | /* define this if you have a real-time clock */ | ||
47 | #define CONFIG_RTC RTC_TCC77X | ||
48 | |||
49 | /* define this if you have RTC RAM available for settings */ | ||
50 | //#define HAVE_RTC_RAM | ||
51 | |||
52 | /* Define this if you have a software controlled poweroff */ | ||
53 | #define HAVE_SW_POWEROFF | ||
54 | |||
55 | /* The number of bytes reserved for loadable plugins */ | ||
56 | #define PLUGIN_BUFFER_SIZE 0x8000 | ||
57 | |||
58 | #define AB_REPEAT_ENABLE 1 | ||
59 | |||
60 | /* Define this if you do software codec */ | ||
61 | #define CONFIG_CODEC SWCODEC | ||
62 | |||
63 | /* Define this if you have the TLV320 audio codec */ | ||
64 | #define HAVE_TLV320 | ||
65 | |||
66 | /* TLV320 has no tone controls, so we use the software ones */ | ||
67 | #define HAVE_SW_TONE_CONTROLS | ||
68 | |||
69 | /* Define this for LCD backlight available */ | ||
70 | #define HAVE_BACKLIGHT | ||
71 | |||
72 | #define CONFIG_I2C I2C_TCC77X | ||
73 | |||
74 | #define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */ | ||
75 | #define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */ | ||
76 | #define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ | ||
77 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ | ||
78 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | ||
79 | |||
80 | /* define this if the unit should not shut down on low battery. */ | ||
81 | #define NO_LOW_BATTERY_SHUTDOWN | ||
82 | |||
83 | #ifndef SIMULATOR | ||
84 | |||
85 | /* Define this if you have a TCC773L */ | ||
86 | #define CONFIG_CPU TCC773L | ||
87 | |||
88 | /* Define this if you have ATA power-off control */ | ||
89 | #define HAVE_ATA_POWER_OFF | ||
90 | |||
91 | /* Define this to the CPU frequency */ | ||
92 | #define CPU_FREQ 120000000 | ||
93 | |||
94 | /* Offset ( in the firmware file's header ) to the file length */ | ||
95 | #define FIRMWARE_OFFSET_FILE_LENGTH 0 | ||
96 | |||
97 | /* Offset ( in the firmware file's header ) to the file CRC */ | ||
98 | #define FIRMWARE_OFFSET_FILE_CRC 4 | ||
99 | |||
100 | /* Offset ( in the firmware file's header ) to the real data */ | ||
101 | #define FIRMWARE_OFFSET_FILE_DATA 6 | ||
102 | |||
103 | /* The start address index for ROM builds */ | ||
104 | /* #define ROM_START 0x11010 for behind original Archos */ | ||
105 | #define ROM_START 0x7010 /* for behind BootBox */ | ||
106 | |||
107 | /* Software controlled LED */ | ||
108 | #define CONFIG_LED LED_VIRTUAL | ||
109 | |||
110 | #define CONFIG_LCD LCD_SSD1815 | ||
111 | |||
112 | #define BOOTFILE_EXT "m200" | ||
113 | #define BOOTFILE "rockbox." BOOTFILE_EXT | ||
114 | #define BOOTDIR "/" | ||
115 | |||
116 | #endif /* SIMULATOR */ | ||
diff --git a/firmware/export/config.h b/firmware/export/config.h index 565f8950ff..e6b84f9aaa 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -80,6 +80,7 @@ | |||
80 | #define COWOND2_PAD 22 | 80 | #define COWOND2_PAD 22 |
81 | #define IAUDIO_M3_PAD 23 | 81 | #define IAUDIO_M3_PAD 23 |
82 | #define CREATIVEZVM_PAD 24 | 82 | #define CREATIVEZVM_PAD 24 |
83 | #define SANSA_M200_PAD 25 | ||
83 | 84 | ||
84 | /* CONFIG_REMOTE_KEYPAD */ | 85 | /* CONFIG_REMOTE_KEYPAD */ |
85 | #define H100_REMOTE 1 | 86 | #define H100_REMOTE 1 |
@@ -236,6 +237,8 @@ | |||
236 | #include "config-e200.h" | 237 | #include "config-e200.h" |
237 | #elif defined(SANSA_C200) | 238 | #elif defined(SANSA_C200) |
238 | #include "config-c200.h" | 239 | #include "config-c200.h" |
240 | #elif defined(SANSA_M200) | ||
241 | #include "config-m200.h" | ||
239 | #elif defined(ELIO_TPJ1022) | 242 | #elif defined(ELIO_TPJ1022) |
240 | #include "config-tpj1022.h" | 243 | #include "config-tpj1022.h" |
241 | #elif defined(MROBE_100) | 244 | #elif defined(MROBE_100) |
diff --git a/firmware/export/tcc77x.h b/firmware/export/tcc77x.h index 1ab1888649..bde8ca255f 100644 --- a/firmware/export/tcc77x.h +++ b/firmware/export/tcc77x.h | |||
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | #define CLKCTRL (*(volatile unsigned long *)0x80000400) | 46 | #define CLKCTRL (*(volatile unsigned long *)0x80000400) |
47 | #define PLL0CFG (*(volatile unsigned long *)0x80000404) | 47 | #define PLL0CFG (*(volatile unsigned long *)0x80000404) |
48 | #define CLKDIV0 (*(volatile unsigned long *)0x8000040c) | 48 | #define CLKDIVC (*(volatile unsigned long *)0x8000040c) |
49 | #define MODECTR (*(volatile unsigned long *)0x80000410) | 49 | #define MODECTR (*(volatile unsigned long *)0x80000410) |
50 | #define BCLKCTR (*(volatile unsigned long *)0x80000414) | 50 | #define BCLKCTR (*(volatile unsigned long *)0x80000414) |
51 | #define SWRESET (*(volatile unsigned long *)0x80000418) | 51 | #define SWRESET (*(volatile unsigned long *)0x80000418) |
@@ -78,4 +78,65 @@ | |||
78 | #define CLKCFG (*(volatile unsigned long *)0xf0000020) | 78 | #define CLKCFG (*(volatile unsigned long *)0xf0000020) |
79 | #define SDCMD (*(volatile unsigned long *)0xf0000024) | 79 | #define SDCMD (*(volatile unsigned long *)0xf0000024) |
80 | 80 | ||
81 | |||
82 | /* IRQ Controller */ | ||
83 | |||
84 | #define TIMER0_IRQ_MASK (1<<6) | ||
85 | |||
86 | #define IEN (*(volatile unsigned long *)0x80000100) | ||
87 | #define CREQ (*(volatile unsigned long *)0x80000104) | ||
88 | #define IREQ (*(volatile unsigned long *)0x80000108) | ||
89 | #define IRQSEL (*(volatile unsigned long *)0x8000010c) | ||
90 | #define ICFG (*(volatile unsigned long *)0x80000110) | ||
91 | #define MREQ (*(volatile unsigned long *)0x80000114) | ||
92 | #define TSTREQ (*(volatile unsigned long *)0x80000118) | ||
93 | #define IRQ (*(volatile unsigned long *)0x80000120) | ||
94 | #define FIQ (*(volatile unsigned long *)0x80000124) | ||
95 | #define MIRQ (*(volatile unsigned long *)0x80000128) | ||
96 | #define MFIQ (*(volatile unsigned long *)0x8000012c) | ||
97 | #define TMODE (*(volatile unsigned long *)0x80000130) | ||
98 | #define SYNC (*(volatile unsigned long *)0x80000134) | ||
99 | #define WKUP (*(volatile unsigned long *)0x80000138) | ||
100 | |||
101 | /* Timer Controller */ | ||
102 | |||
103 | #define TCFG0 (*(volatile unsigned long *)0x80000200) | ||
104 | #define TCNT0 (*(volatile unsigned long *)0x80000204) | ||
105 | #define TREF0 (*(volatile unsigned long *)0x80000208) | ||
106 | #define TMREF0 (*(volatile unsigned long *)0x8000020c) | ||
107 | #define TCFG1 (*(volatile unsigned long *)0x80000210) | ||
108 | #define TCNT1 (*(volatile unsigned long *)0x80000214) | ||
109 | #define TREF1 (*(volatile unsigned long *)0x80000218) | ||
110 | #define TMREF1 (*(volatile unsigned long *)0x8000021c) | ||
111 | #define TCFG2 (*(volatile unsigned long *)0x80000220) | ||
112 | #define TCNT2 (*(volatile unsigned long *)0x80000224) | ||
113 | #define TREF2 (*(volatile unsigned long *)0x80000228) | ||
114 | #define TMREF2 (*(volatile unsigned long *)0x8000022c) | ||
115 | #define TCFG3 (*(volatile unsigned long *)0x80000230) | ||
116 | #define TCNT3 (*(volatile unsigned long *)0x80000234) | ||
117 | #define TREF3 (*(volatile unsigned long *)0x80000238) | ||
118 | #define TMREF3 (*(volatile unsigned long *)0x8000023c) | ||
119 | #define TCFG4 (*(volatile unsigned long *)0x80000240) | ||
120 | #define TCNT4 (*(volatile unsigned long *)0x80000244) | ||
121 | #define TREF4 (*(volatile unsigned long *)0x80000248) | ||
122 | #define TCFG5 (*(volatile unsigned long *)0x80000250) | ||
123 | #define TCNT5 (*(volatile unsigned long *)0x80000254) | ||
124 | #define TREF5 (*(volatile unsigned long *)0x80000258) | ||
125 | #define TIREQ (*(volatile unsigned long *)0x80000260) | ||
126 | #define TWDCFG (*(volatile unsigned long *)0x80000270) | ||
127 | #define TWDCLR (*(volatile unsigned long *)0x80000274) | ||
128 | #define TC32EN (*(volatile unsigned long *)0x80000280) | ||
129 | #define TC32LDV (*(volatile unsigned long *)0x80000284) | ||
130 | #define TC32CMP0 (*(volatile unsigned long *)0x80000288) | ||
131 | #define TC32CMP1 (*(volatile unsigned long *)0x8000028c) | ||
132 | #define TC32PCNT (*(volatile unsigned long *)0x80000290) | ||
133 | #define TC32MCNT (*(volatile unsigned long *)0x80000294) | ||
134 | #define TC32IRQ (*(volatile unsigned long *)0x80000298) | ||
135 | |||
136 | /* TIREQ flags */ | ||
137 | #define TF0 (1<<8) /* Timer 0 reference value reached */ | ||
138 | #define TF1 (1<<9) /* Timer 1 reference value reached */ | ||
139 | #define TI0 (1<<0) /* Timer 0 IRQ flag */ | ||
140 | #define TI1 (1<<1) /* Timer 1 IRQ flag */ | ||
141 | |||
81 | #endif | 142 | #endif |
diff --git a/firmware/export/timer.h b/firmware/export/timer.h index 08bf7b13e4..3613aa32d9 100644 --- a/firmware/export/timer.h +++ b/firmware/export/timer.h | |||
@@ -31,7 +31,8 @@ | |||
31 | #define TIMER_FREQ (CPU_FREQ/2) | 31 | #define TIMER_FREQ (CPU_FREQ/2) |
32 | #elif CONFIG_CPU == PNX0101 | 32 | #elif CONFIG_CPU == PNX0101 |
33 | #define TIMER_FREQ 3000000 | 33 | #define TIMER_FREQ 3000000 |
34 | #elif CONFIG_CPU == S3C2440 || CONFIG_CPU == DM320 || CONFIG_CPU == TCC7801 | 34 | #elif CONFIG_CPU == S3C2440 || CONFIG_CPU == DM320 || CONFIG_CPU == TCC7801 \ |
35 | || defined(CPU_TCC77X) | ||
35 | #include "timer-target.h" | 36 | #include "timer-target.h" |
36 | #elif defined(SIMULATOR) | 37 | #elif defined(SIMULATOR) |
37 | #define TIMER_FREQ 1000000 | 38 | #define TIMER_FREQ 1000000 |
diff --git a/firmware/target/arm/tcc77x/app.lds b/firmware/target/arm/tcc77x/app.lds new file mode 100644 index 0000000000..03a427f76b --- /dev/null +++ b/firmware/target/arm/tcc77x/app.lds | |||
@@ -0,0 +1,144 @@ | |||
1 | #include "config.h" | ||
2 | |||
3 | ENTRY(start) | ||
4 | |||
5 | OUTPUT_FORMAT(elf32-littlearm) | ||
6 | OUTPUT_ARCH(arm) | ||
7 | STARTUP(target/arm/tcc77x/crt0.o) | ||
8 | |||
9 | #define PLUGINSIZE PLUGIN_BUFFER_SIZE | ||
10 | #define CODECSIZE CODEC_SIZE | ||
11 | |||
12 | #include "imx31l.h" | ||
13 | |||
14 | #define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGINSIZE - CODECSIZE | ||
15 | |||
16 | #define DRAMORIG 0x20000000 | ||
17 | #define IRAMORIG 0x00000000 | ||
18 | #define IRAMSIZE IRAM_SIZE | ||
19 | |||
20 | /* End of the audio buffer, where the codec buffer starts */ | ||
21 | #define ENDAUDIOADDR (DRAMORIG + DRAMSIZE) | ||
22 | |||
23 | /* Where the codec buffer ends, and the plugin buffer starts */ | ||
24 | #define ENDADDR (ENDAUDIOADDR + CODECSIZE) | ||
25 | |||
26 | MEMORY | ||
27 | { | ||
28 | DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE | ||
29 | IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE | ||
30 | } | ||
31 | |||
32 | SECTIONS | ||
33 | { | ||
34 | .text : | ||
35 | { | ||
36 | loadaddress = .; | ||
37 | _loadaddress = .; | ||
38 | . = ALIGN(0x200); | ||
39 | *(.init.text) | ||
40 | *(.text*) | ||
41 | *(.glue_7) | ||
42 | *(.glue_7t) | ||
43 | . = ALIGN(0x4); | ||
44 | } > DRAM | ||
45 | |||
46 | .rodata : | ||
47 | { | ||
48 | *(.rodata) /* problems without this, dunno why */ | ||
49 | *(.rodata*) | ||
50 | *(.rodata.str1.1) | ||
51 | *(.rodata.str1.4) | ||
52 | . = ALIGN(0x4); | ||
53 | |||
54 | /* Pseudo-allocate the copies of the data sections */ | ||
55 | _datacopy = .; | ||
56 | } > DRAM | ||
57 | |||
58 | /* TRICK ALERT! For RAM execution, we put the .data section at the | ||
59 | same load address as the copy. Thus, we don't waste extra RAM | ||
60 | when we don't actually need the copy. */ | ||
61 | .data : AT ( _datacopy ) | ||
62 | { | ||
63 | _datastart = .; | ||
64 | *(.data*) | ||
65 | . = ALIGN(0x4); | ||
66 | _dataend = .; | ||
67 | } > DRAM | ||
68 | |||
69 | /DISCARD/ : | ||
70 | { | ||
71 | *(.eh_frame) | ||
72 | } | ||
73 | |||
74 | .vectors 0x0 : | ||
75 | { | ||
76 | _vectorsstart = .; | ||
77 | *(.vectors); | ||
78 | _vectorsend = .; | ||
79 | } AT> DRAM | ||
80 | |||
81 | _vectorscopy = LOADADDR(.vectors); | ||
82 | |||
83 | .iram : | ||
84 | { | ||
85 | _iramstart = .; | ||
86 | *(.icode) | ||
87 | *(.irodata) | ||
88 | *(.idata) | ||
89 | . = ALIGN(0x4); | ||
90 | _iramend = .; | ||
91 | } > DRAM | ||
92 | |||
93 | _iramcopy = LOADADDR(.iram); | ||
94 | |||
95 | .ibss (NOLOAD) : | ||
96 | { | ||
97 | _iedata = .; | ||
98 | *(.ibss) | ||
99 | . = ALIGN(0x4); | ||
100 | _iend = .; | ||
101 | } > DRAM | ||
102 | |||
103 | .stack : | ||
104 | { | ||
105 | *(.stack) | ||
106 | stackbegin = .; | ||
107 | . += 0x2000; | ||
108 | stackend = .; | ||
109 | } > DRAM | ||
110 | |||
111 | .bss : | ||
112 | { | ||
113 | _edata = .; | ||
114 | *(.bss*) | ||
115 | *(COMMON) | ||
116 | . = ALIGN(0x4); | ||
117 | _end = .; | ||
118 | } > DRAM | ||
119 | |||
120 | .audiobuf ALIGN(4) : | ||
121 | { | ||
122 | _audiobuffer = .; | ||
123 | audiobuffer = .; | ||
124 | } > DRAM | ||
125 | |||
126 | .audiobufend ENDAUDIOADDR: | ||
127 | { | ||
128 | audiobufend = .; | ||
129 | _audiobufend = .; | ||
130 | } > DRAM | ||
131 | |||
132 | .codec ENDAUDIOADDR: | ||
133 | { | ||
134 | codecbuf = .; | ||
135 | _codecbuf = .; | ||
136 | } | ||
137 | |||
138 | .plugin ENDADDR: | ||
139 | { | ||
140 | _pluginbuf = .; | ||
141 | pluginbuf = .; | ||
142 | } | ||
143 | } | ||
144 | |||
diff --git a/firmware/target/arm/tcc77x/ata-nand-tcc77x.c b/firmware/target/arm/tcc77x/ata-nand-tcc77x.c index dd0ae7a950..d7ae5d5ed6 100644 --- a/firmware/target/arm/tcc77x/ata-nand-tcc77x.c +++ b/firmware/target/arm/tcc77x/ata-nand-tcc77x.c | |||
@@ -32,6 +32,9 @@ int ata_spinup_time = 0; | |||
32 | 32 | ||
33 | long last_disk_activity = -1; | 33 | long last_disk_activity = -1; |
34 | 34 | ||
35 | /* Used to store (fake?) identify info */ | ||
36 | static unsigned short identify_info[256]; | ||
37 | |||
35 | /** static, private data **/ | 38 | /** static, private data **/ |
36 | static bool initialized = false; | 39 | static bool initialized = false; |
37 | 40 | ||
@@ -91,4 +94,11 @@ void ata_enable(bool on) | |||
91 | 94 | ||
92 | int ata_init(void) | 95 | int ata_init(void) |
93 | { | 96 | { |
97 | return 0; | ||
98 | } | ||
99 | |||
100 | /* TEMP: This will return junk, it's here for compilation only */ | ||
101 | unsigned short* ata_get_identify(void) | ||
102 | { | ||
103 | return identify_info; | ||
94 | } | 104 | } |
diff --git a/firmware/target/arm/tcc77x/boot.lds b/firmware/target/arm/tcc77x/boot.lds index 21fc7db96a..890c4ec785 100644 --- a/firmware/target/arm/tcc77x/boot.lds +++ b/firmware/target/arm/tcc77x/boot.lds | |||
@@ -10,16 +10,11 @@ STARTUP(target/arm/tcc77x/crt0.o) | |||
10 | #define DRAMORIG 0x20000000 | 10 | #define DRAMORIG 0x20000000 |
11 | #define IRAMORIG 0x00000000 | 11 | #define IRAMORIG 0x00000000 |
12 | #define IRAMSIZE 64K | 12 | #define IRAMSIZE 64K |
13 | #define FLASHORIG 0x0000000 | 13 | |
14 | #define FLASHSIZE 1M | ||
15 | 14 | ||
16 | MEMORY | 15 | MEMORY |
17 | { | 16 | { |
18 | #ifdef TCCBOOT | ||
19 | DRAM : ORIGIN = DRAMORIG + DRAMSIZE - 0x100000, LENGTH = 0x100000 | 17 | DRAM : ORIGIN = DRAMORIG + DRAMSIZE - 0x100000, LENGTH = 0x100000 |
20 | #else | ||
21 | DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE | ||
22 | #endif | ||
23 | IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE | 18 | IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE |
24 | } | 19 | } |
25 | 20 | ||
@@ -52,6 +47,7 @@ SECTIONS | |||
52 | _stackend = .; | 47 | _stackend = .; |
53 | stackend = .; | 48 | stackend = .; |
54 | } > DRAM | 49 | } > DRAM |
50 | |||
55 | .bss : { | 51 | .bss : { |
56 | _edata = .; | 52 | _edata = .; |
57 | *(.bss*); | 53 | *(.bss*); |
diff --git a/firmware/target/arm/tcc77x/crt0.S b/firmware/target/arm/tcc77x/crt0.S index e4ecb05a4e..246d02a1d7 100644 --- a/firmware/target/arm/tcc77x/crt0.S +++ b/firmware/target/arm/tcc77x/crt0.S | |||
@@ -29,6 +29,11 @@ | |||
29 | 29 | ||
30 | .section .init.text,"ax",%progbits | 30 | .section .init.text,"ax",%progbits |
31 | 31 | ||
32 | .extern irq | ||
33 | .extern fiq | ||
34 | .extern UIE | ||
35 | .extern main | ||
36 | |||
32 | .global start | 37 | .global start |
33 | 38 | ||
34 | /* Telechips firmware files start with a 32-byte header, as part of the code. */ | 39 | /* Telechips firmware files start with a 32-byte header, as part of the code. */ |
@@ -44,7 +49,8 @@ start: | |||
44 | .word 0 /* Saved entrypoint of original firmware*/ | 49 | .word 0 /* Saved entrypoint of original firmware*/ |
45 | .word 0 /* Location in RAM of the start of our bootloader */ | 50 | .word 0 /* Location in RAM of the start of our bootloader */ |
46 | #else | 51 | #else |
47 | ldr pc, =start_loc /* jump to the main entry point */ | 52 | // ldr pc, =start_loc /* jump to the main entry point */ |
53 | b start_loc | ||
48 | 54 | ||
49 | .word 0xffff0601 /* Unknown magic */ | 55 | .word 0xffff0601 /* Unknown magic */ |
50 | .word 0x3a726556 /* "Ver:" */ | 56 | .word 0x3a726556 /* "Ver:" */ |
@@ -65,21 +71,40 @@ start: | |||
65 | start_loc: | 71 | start_loc: |
66 | 72 | ||
67 | #ifdef BOOTLOADER | 73 | #ifdef BOOTLOADER |
74 | |||
75 | /* | ||
76 | If we are appended to the OF (i.e. dual-booting), do a simple GPIO | ||
77 | button check, and branch to the OF's entry point (saved by mktccboot) | ||
78 | if not active | ||
79 | */ | ||
80 | |||
68 | #ifdef TCCBOOT | 81 | #ifdef TCCBOOT |
69 | #ifdef LOGIK_DAX | ||
70 | mov r0, #0x80000000 | 82 | mov r0, #0x80000000 |
71 | ldr r0, [r0, #0x300] /* Read GPIO A */ | 83 | #ifdef LOGIK_DAX |
84 | ldr r0, [r0, #0x300] /* Hold button is GPIO A, pin 0x2 */ | ||
72 | tst r0, #0x2 | 85 | tst r0, #0x2 |
73 | ldrne pc, [pc, #-28] /* Jump to original firmware if HOLD button not pressed */ | 86 | #elif defined(SANSA_M200) |
87 | ldr r0, [r0, #0x310] /* Hold button is GPIO B, pin 0x200 */ | ||
88 | tst r0, #0x200 | ||
74 | #else | 89 | #else |
75 | #error No bootup key detection implemented for this target | 90 | #error No bootup key detection implemented for this target |
76 | #endif | 91 | #endif |
77 | 92 | ||
78 | /* Copy bootloader to safe area - 0x21000000 (DRAM) */ | 93 | ldrne pc, [pc, #-28] /* Jump to OF if HOLD button not pressed */ |
79 | /* TODO: Adjust this for other targets - DRAM + DRAMSIZE - 0x100000 */ | 94 | #endif /* TCCBOOT */ |
80 | ldr r0, [pc, #-28] | 95 | |
81 | mov r1, #0x20000000 | 96 | /* We are now definitely executing the bootloader, so we relocate to the |
82 | add r1, r1, #0x100000 | 97 | linked address (see boot.lds) - 1MB from the end of DRAM. |
98 | */ | ||
99 | |||
100 | #ifdef TCCBOOT | ||
101 | ldr r0, [pc, #-28] /* mktccboot fills in the load address */ | ||
102 | #else | ||
103 | mov r0, #0x20000000 /* Otherwise, load address is the start of DRAM */ | ||
104 | #endif | ||
105 | mov r1, #0x20000000 /* Destination: 1MB from end of DRAM */ | ||
106 | add r1, r1, #((MEM - 1) * 0x100000) | ||
107 | |||
83 | ldr r2, =_dataend | 108 | ldr r2, =_dataend |
84 | 1: | 109 | 1: |
85 | cmp r2, r1 | 110 | cmp r2, r1 |
@@ -88,16 +113,14 @@ start_loc: | |||
88 | bhi 1b | 113 | bhi 1b |
89 | 114 | ||
90 | ldr pc, =copied_start /* jump to the relocated start_loc: */ | 115 | ldr pc, =copied_start /* jump to the relocated start_loc: */ |
91 | |||
92 | copied_start: | 116 | copied_start: |
93 | #endif | 117 | #endif /* BOOTLOADER */ |
94 | #else | ||
95 | /* We don't use interrupts in the bootloader */ | ||
96 | 118 | ||
97 | /* Set up stack for IRQ mode */ | 119 | /* Set up stack for IRQ mode */ |
98 | mov r0,#0xd2 | 120 | mov r0,#0xd2 |
99 | msr cpsr, r0 | 121 | msr cpsr, r0 |
100 | ldr sp, =irq_stack | 122 | ldr sp, =irq_stack |
123 | |||
101 | /* Set up stack for FIQ mode */ | 124 | /* Set up stack for FIQ mode */ |
102 | mov r0,#0xd1 | 125 | mov r0,#0xd1 |
103 | msr cpsr, r0 | 126 | msr cpsr, r0 |
@@ -110,13 +133,22 @@ copied_start: | |||
110 | mov r0,#0xdb | 133 | mov r0,#0xdb |
111 | msr cpsr, r0 | 134 | msr cpsr, r0 |
112 | ldr sp, =irq_stack | 135 | ldr sp, =irq_stack |
113 | #endif | ||
114 | 136 | ||
115 | /* Switch to supervisor mode */ | 137 | /* Switch to supervisor mode */ |
116 | mov r0,#0xd3 | 138 | mov r0,#0xd3 |
117 | msr cpsr, r0 | 139 | msr cpsr, r0 |
118 | ldr sp, =stackend | 140 | ldr sp, =stackend |
119 | 141 | ||
142 | /* Copy exception handler code to address 0 */ | ||
143 | mov r2, #0x0 | ||
144 | ldr r3, =vectors_start | ||
145 | ldr r4, =vectors_end | ||
146 | 1: | ||
147 | cmp r4, r3 | ||
148 | ldrhi r5, [r3], #4 | ||
149 | strhi r5, [r2], #4 | ||
150 | bhi 1b | ||
151 | |||
120 | /* Initialise bss section to zero */ | 152 | /* Initialise bss section to zero */ |
121 | ldr r2, =_edata | 153 | ldr r2, =_edata |
122 | ldr r3, =_end | 154 | ldr r3, =_end |
@@ -139,9 +171,68 @@ copied_start: | |||
139 | bl main | 171 | bl main |
140 | /* main() should never return */ | 172 | /* main() should never return */ |
141 | 173 | ||
142 | #ifndef BOOTLOADER | 174 | /* Exception handlers. Will be copied to address 0 after memory remapping */ |
143 | /* We don't use interrupts in the bootloader */ | 175 | vectors_start: |
176 | ldr pc, [pc, #24] | ||
177 | ldr pc, [pc, #24] | ||
178 | ldr pc, [pc, #24] | ||
179 | ldr pc, [pc, #24] | ||
180 | ldr pc, [pc, #24] | ||
181 | ldr pc, [pc, #24] | ||
182 | ldr pc, [pc, #24] | ||
183 | ldr pc, [pc, #24] | ||
184 | |||
185 | /* Exception vectors */ | ||
186 | .global vectors | ||
187 | vectors: | ||
188 | .word start | ||
189 | .word undef_instr_handler | ||
190 | .word software_int_handler | ||
191 | .word prefetch_abort_handler | ||
192 | .word data_abort_handler | ||
193 | .word reserved_handler | ||
194 | .word irq_handler | ||
195 | .word fiq_handler | ||
196 | vectors_end: | ||
197 | |||
198 | .text | ||
199 | |||
200 | /* All illegal exceptions call into UIE with exception address as first | ||
201 | parameter. This is calculated differently depending on which exception | ||
202 | we're in. Second parameter is exception number, used for a string lookup | ||
203 | in UIE. | ||
204 | */ | ||
205 | undef_instr_handler: | ||
206 | mov r0, lr | ||
207 | mov r1, #0 | ||
208 | b UIE | ||
144 | 209 | ||
210 | /* We run supervisor mode most of the time, and should never see a software | ||
211 | exception being thrown. Perhaps make it illegal and call UIE? | ||
212 | */ | ||
213 | software_int_handler: | ||
214 | reserved_handler: | ||
215 | movs pc, lr | ||
216 | |||
217 | prefetch_abort_handler: | ||
218 | sub r0, lr, #4 | ||
219 | mov r1, #1 | ||
220 | b UIE | ||
221 | |||
222 | data_abort_handler: | ||
223 | sub r0, lr, #8 | ||
224 | mov r1, #2 | ||
225 | b UIE | ||
226 | |||
227 | irq_handler: | ||
228 | stmfd sp!, {r0-r3, r12, lr} | ||
229 | bl irq | ||
230 | ldmfd sp!, {r0-r3, r12, lr} | ||
231 | subs pc, lr, #4 | ||
232 | |||
233 | /* Align stacks to cache line boundary */ | ||
234 | .balign 16 | ||
235 | |||
145 | /* 256 words of IRQ stack */ | 236 | /* 256 words of IRQ stack */ |
146 | .space 256*4 | 237 | .space 256*4 |
147 | irq_stack: | 238 | irq_stack: |
@@ -150,4 +241,3 @@ irq_stack: | |||
150 | .space 256*4 | 241 | .space 256*4 |
151 | fiq_stack: | 242 | fiq_stack: |
152 | 243 | ||
153 | #endif | ||
diff --git a/firmware/target/arm/tcc77x/debug-target.h b/firmware/target/arm/tcc77x/debug-target.h new file mode 100644 index 0000000000..07e8fc4322 --- /dev/null +++ b/firmware/target/arm/tcc77x/debug-target.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Karl Kurbjun | ||
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 | bool __dbg_hw_info(void); | ||
21 | bool __dbg_ports(void); | ||
22 | |||
diff --git a/firmware/target/arm/tcc77x/debug-tcc77x.c b/firmware/target/arm/tcc77x/debug-tcc77x.c new file mode 100644 index 0000000000..dc3db3926f --- /dev/null +++ b/firmware/target/arm/tcc77x/debug-tcc77x.c | |||
@@ -0,0 +1,81 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Rob Purchase | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "config.h" | ||
21 | #include "cpu.h" | ||
22 | #include "system.h" | ||
23 | #include "string.h" | ||
24 | #include <stdbool.h> | ||
25 | #include "button.h" | ||
26 | #include "lcd.h" | ||
27 | #include "sprintf.h" | ||
28 | #include "font.h" | ||
29 | #include "debug-target.h" | ||
30 | #include "adc.h" | ||
31 | |||
32 | bool __dbg_ports(void) | ||
33 | { | ||
34 | return false; | ||
35 | } | ||
36 | |||
37 | bool __dbg_hw_info(void) | ||
38 | { | ||
39 | int line = 0, i, button, oldline; | ||
40 | bool done=false; | ||
41 | char buf[100]; | ||
42 | |||
43 | lcd_setmargins(0, 0); | ||
44 | lcd_setfont(FONT_SYSFIXED); | ||
45 | lcd_clear_display(); | ||
46 | |||
47 | /* Put all the static text before the while loop */ | ||
48 | lcd_puts(0, line++, "[Hardware info]"); | ||
49 | |||
50 | line++; | ||
51 | oldline=line; | ||
52 | while(!done) | ||
53 | { | ||
54 | line = oldline; | ||
55 | button = button_get(false); | ||
56 | |||
57 | button &= ~BUTTON_REPEAT; | ||
58 | |||
59 | if (button == BUTTON_SELECT) | ||
60 | done=true; | ||
61 | |||
62 | snprintf(buf, sizeof(buf), "current tick: %08x Seconds running: %08d", | ||
63 | (unsigned int)current_tick, (unsigned int)current_tick/100); lcd_puts(0, line++, buf); | ||
64 | |||
65 | snprintf(buf, sizeof(buf), "GPIOA: 0x%08x GPIOB: 0x%08x", | ||
66 | (unsigned int)GPIOA, (unsigned int)GPIOB); lcd_puts(0, line++, buf); | ||
67 | snprintf(buf, sizeof(buf), "GPIOC: 0x%08x GPIOD: 0x%08x", | ||
68 | (unsigned int)GPIOC, (unsigned int)GPIOD); lcd_puts(0, line++, buf); | ||
69 | snprintf(buf, sizeof(buf), "GPIOE: 0x%08x", | ||
70 | (unsigned int)GPIOE); lcd_puts(0, line++, buf); | ||
71 | |||
72 | for (i = 0; i<4; i++) | ||
73 | { | ||
74 | snprintf(buf, sizeof(buf), "ADC%d: 0x%04x", i, adc_read(i)); | ||
75 | lcd_puts(0, line++, buf); | ||
76 | } | ||
77 | |||
78 | lcd_update(); | ||
79 | } | ||
80 | return false; | ||
81 | } | ||
diff --git a/firmware/target/arm/tcc77x/i2c-target.h b/firmware/target/arm/tcc77x/i2c-target.h new file mode 100644 index 0000000000..4600b8a576 --- /dev/null +++ b/firmware/target/arm/tcc77x/i2c-target.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Rob Purchase | ||
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 I2C_TARGET_H | ||
20 | #define I2C_TARGET_H | ||
21 | |||
22 | /* Definitions for the TCC77X I2C bus */ | ||
23 | |||
24 | #define SDA_BIT (1<<10) | ||
25 | #define SCL_BIT (1<<11) | ||
26 | |||
27 | #define SCL (GPIOB & SCL_BIT) | ||
28 | #define SCL_HI GPIOB |= SCL_BIT | ||
29 | #define SCL_LO GPIOB &= ~SCL_BIT | ||
30 | |||
31 | #define SDA (GPIOB & SDA_BIT) | ||
32 | #define SDA_HI GPIOB |= SDA_BIT | ||
33 | #define SDA_LO GPIOB &= ~SDA_BIT | ||
34 | #define SDA_INPUT GPIOB_DIR &= ~SDA_BIT | ||
35 | #define SDA_OUTPUT GPIOB_DIR |= SDA_BIT | ||
36 | |||
37 | #endif /* I2C_TARGET_H */ | ||
diff --git a/firmware/target/arm/tcc77x/kernel-tcc77x.c b/firmware/target/arm/tcc77x/kernel-tcc77x.c new file mode 100644 index 0000000000..17c6ff0734 --- /dev/null +++ b/firmware/target/arm/tcc77x/kernel-tcc77x.c | |||
@@ -0,0 +1,45 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Rob Purchase | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "config.h" | ||
21 | #include "system.h" | ||
22 | #include "kernel.h" | ||
23 | #include "timer.h" | ||
24 | #include "thread.h" | ||
25 | |||
26 | void tick_start(unsigned int interval_in_ms) | ||
27 | { | ||
28 | /* configure Timer T-Clock to 2Mhz (clock source 4 (Xin) divided by 6) */ | ||
29 | PCLKCFG4 = (1 << 31) | (4 << 28) | (5 << 16); | ||
30 | |||
31 | /* disable Timer0 */ | ||
32 | TCFG0 &= ~1; | ||
33 | |||
34 | /* set counter reference value based on 1Mhz tick */ | ||
35 | TREF0 = interval_in_ms * 1000; | ||
36 | |||
37 | /* Timer0 = reset to 0, divide=2, IRQ enable, enable (continuous) */ | ||
38 | TCFG0 = (1<<8) | (0<<4) | (1<<3) | 1; | ||
39 | |||
40 | /* Unmask timer IRQ */ | ||
41 | IEN |= TIMER0_IRQ_MASK; | ||
42 | } | ||
43 | |||
44 | /* NB: Since we are using a single timer IRQ, tick tasks are dispatched as | ||
45 | part of the central timer IRQ processing in timer-tcc77x.c */ | ||
diff --git a/firmware/target/arm/tcc77x/lcd-ssd1815.c b/firmware/target/arm/tcc77x/lcd-ssd1815.c index 4101f6ab7d..feb8bf1765 100644 --- a/firmware/target/arm/tcc77x/lcd-ssd1815.c +++ b/firmware/target/arm/tcc77x/lcd-ssd1815.c | |||
@@ -208,7 +208,7 @@ void lcd_blit_mono(const unsigned char *data, int x, int by, int width, | |||
208 | 208 | ||
209 | /* Performance function that works with an external buffer | 209 | /* Performance function that works with an external buffer |
210 | note that by and bheight are in 8-pixel units! */ | 210 | note that by and bheight are in 8-pixel units! */ |
211 | void lcd_blit_grey_phase_blit(unsigned char *values, unsigned char *phases, | 211 | void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases, |
212 | int x, int by, int width, int bheight, int stride) | 212 | int x, int by, int width, int bheight, int stride) |
213 | { | 213 | { |
214 | (void)values; | 214 | (void)values; |
diff --git a/firmware/target/arm/tcc77x/m200/adc-target.h b/firmware/target/arm/tcc77x/m200/adc-target.h new file mode 100644 index 0000000000..96fb1e44aa --- /dev/null +++ b/firmware/target/arm/tcc77x/m200/adc-target.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 Dave Chapman | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef _ADC_TARGET_H_ | ||
20 | #define _ADC_TARGET_H_ | ||
21 | |||
22 | #define NUM_ADC_CHANNELS 8 | ||
23 | |||
24 | #define ADC_BUTTONS 1 | ||
25 | |||
26 | #endif /* _ADC_TARGET_H_ */ | ||
diff --git a/firmware/target/arm/tcc77x/m200/backlight-target.h b/firmware/target/arm/tcc77x/m200/backlight-target.h new file mode 100644 index 0000000000..a54aa4686d --- /dev/null +++ b/firmware/target/arm/tcc77x/m200/backlight-target.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Dave Chapman | ||
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 | #include "tcc77x.h" | ||
23 | |||
24 | static inline bool _backlight_init(void) | ||
25 | { | ||
26 | GPIOA_DIR |= 0x40; | ||
27 | return true; | ||
28 | } | ||
29 | |||
30 | static inline void _backlight_on(void) | ||
31 | { | ||
32 | /* Enable backlight */ | ||
33 | GPIOA |= 0x40; | ||
34 | } | ||
35 | |||
36 | static inline void _backlight_off(void) | ||
37 | { | ||
38 | /* Disable backlight */ | ||
39 | GPIOA &= ~0x40; | ||
40 | } | ||
41 | |||
42 | #endif | ||
diff --git a/firmware/target/arm/tcc77x/m200/button-m200.c b/firmware/target/arm/tcc77x/m200/button-m200.c new file mode 100644 index 0000000000..fec745ae99 --- /dev/null +++ b/firmware/target/arm/tcc77x/m200/button-m200.c | |||
@@ -0,0 +1,97 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Dave Chapman | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "config.h" | ||
21 | #include "cpu.h" | ||
22 | #include "button.h" | ||
23 | #include "adc.h" | ||
24 | |||
25 | /* | ||
26 | |||
27 | Results of button testing (viewing ADC values whilst pressing buttons): | ||
28 | |||
29 | HOLD: GPIOB & 0x0200 (0=hold active, 0x0200 = hold inactive) | ||
30 | |||
31 | ADC[1]: (approx values) | ||
32 | |||
33 | Idle - 0x3ff | ||
34 | MENU - unknown | ||
35 | |||
36 | REPEAT/AB - 0x03? | ||
37 | LEFT - 0x07?-0x08? | ||
38 | SELECT - 0x0c? | ||
39 | RIGHT - 0x11? | ||
40 | |||
41 | PLAY/PAUSE - 0x17?-0x018? | ||
42 | VOL UP - 0x1e?-0x01f? | ||
43 | VOL DOWN - 0x26? | ||
44 | |||
45 | */ | ||
46 | |||
47 | void button_init_device(void) | ||
48 | { | ||
49 | /* Nothing to do */ | ||
50 | } | ||
51 | |||
52 | int button_read_device(void) | ||
53 | { | ||
54 | int btn = BUTTON_NONE; | ||
55 | int adc; | ||
56 | |||
57 | /* TODO - determine how to detect BUTTON_MENU - it doesn't appear to | ||
58 | be connected to a GPIO or to an ADC | ||
59 | */ | ||
60 | |||
61 | adc = adc_read(ADC_BUTTONS); | ||
62 | |||
63 | if (adc < 0x384) { | ||
64 | if (adc < 0x140) { | ||
65 | if (adc < 0x96) { | ||
66 | if (adc < 0x50) { | ||
67 | btn |= BUTTON_REPEATAB; /* 0x00..0x4f */ | ||
68 | } else { | ||
69 | btn |= BUTTON_LEFT; /* 0x50..0x95 */ | ||
70 | } | ||
71 | } else { | ||
72 | if (adc < 0xe0) { | ||
73 | btn |= BUTTON_SELECT; /* 0x96..0xdf */ | ||
74 | } else { | ||
75 | btn |= BUTTON_RIGHT; /* 0xe0..0x13f */ | ||
76 | } | ||
77 | } | ||
78 | } else { | ||
79 | if (adc < 0x208) { | ||
80 | if (adc < 0x1b0) { | ||
81 | btn |= BUTTON_PLAYPAUSE; /* 0x140..0x1af */ | ||
82 | } else { | ||
83 | btn |= BUTTON_VOLUP; /* 0x1b0..0x207 */ | ||
84 | } | ||
85 | } else { | ||
86 | btn |= BUTTON_VOLDOWN; /* 0x209..0x383 */ | ||
87 | } | ||
88 | } | ||
89 | } | ||
90 | |||
91 | return btn; | ||
92 | } | ||
93 | |||
94 | bool button_hold(void) | ||
95 | { | ||
96 | return (GPIOB & 0x200)?false:true; | ||
97 | } | ||
diff --git a/firmware/target/arm/tcc77x/m200/button-target.h b/firmware/target/arm/tcc77x/m200/button-target.h new file mode 100644 index 0000000000..da7c82e6b2 --- /dev/null +++ b/firmware/target/arm/tcc77x/m200/button-target.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Dave Chapman | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #ifndef _BUTTON_TARGET_H_ | ||
21 | #define _BUTTON_TARGET_H_ | ||
22 | |||
23 | #include <stdbool.h> | ||
24 | #include "config.h" | ||
25 | |||
26 | #define HAS_BUTTON_HOLD | ||
27 | |||
28 | void button_init_device(void); | ||
29 | int button_read_device(void); | ||
30 | bool button_hold(void); | ||
31 | |||
32 | /* Main unit's buttons */ | ||
33 | #define BUTTON_MENU 0x00000001 | ||
34 | #define BUTTON_VOLUP 0x00000002 | ||
35 | #define BUTTON_VOLDOWN 0x00000004 | ||
36 | #define BUTTON_PLAYPAUSE 0x00000008 | ||
37 | #define BUTTON_REPEATAB 0x00000010 | ||
38 | #define BUTTON_LEFT 0x00000020 | ||
39 | #define BUTTON_RIGHT 0x00000040 | ||
40 | #define BUTTON_SELECT 0x00000080 | ||
41 | |||
42 | #define BUTTON_MAIN (BUTTON_MENU|BUTTON_VOLUP|BUTTON_VOLDOWN\ | ||
43 | |BUTTON_PLAYPAUSE|BUTTON_REPEATAB|BUTTON_LEFT\ | ||
44 | |BUTTON_RIGHT|BUTTON_SELECT) | ||
45 | |||
46 | #define BUTTON_REMOTE 0 | ||
47 | |||
48 | /* Software power-off */ | ||
49 | #define POWEROFF_BUTTON BUTTON_MENU | ||
50 | #define POWEROFF_COUNT 40 | ||
51 | |||
52 | #endif /* _BUTTON_TARGET_H_ */ | ||
diff --git a/firmware/target/arm/tcc77x/m200/power-m200.c b/firmware/target/arm/tcc77x/m200/power-m200.c new file mode 100644 index 0000000000..df2ee10d6b --- /dev/null +++ b/firmware/target/arm/tcc77x/m200/power-m200.c | |||
@@ -0,0 +1,66 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 Dave Chapman | ||
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 <stdbool.h> | ||
22 | #include "kernel.h" | ||
23 | #include "system.h" | ||
24 | #include "power.h" | ||
25 | |||
26 | #ifndef SIMULATOR | ||
27 | |||
28 | void power_init(void) | ||
29 | { | ||
30 | } | ||
31 | |||
32 | void ide_power_enable(bool on) | ||
33 | { | ||
34 | } | ||
35 | |||
36 | bool ide_powered(void) | ||
37 | { | ||
38 | return true; | ||
39 | } | ||
40 | |||
41 | void power_off(void) | ||
42 | { | ||
43 | } | ||
44 | |||
45 | #else /* SIMULATOR */ | ||
46 | |||
47 | bool charger_inserted(void) | ||
48 | { | ||
49 | return false; | ||
50 | } | ||
51 | |||
52 | void charger_enable(bool on) | ||
53 | { | ||
54 | (void)on; | ||
55 | } | ||
56 | |||
57 | void power_off(void) | ||
58 | { | ||
59 | } | ||
60 | |||
61 | void ide_power_enable(bool on) | ||
62 | { | ||
63 | (void)on; | ||
64 | } | ||
65 | |||
66 | #endif /* SIMULATOR */ | ||
diff --git a/firmware/target/arm/tcc77x/pcm-tcc77x.c b/firmware/target/arm/tcc77x/pcm-tcc77x.c new file mode 100644 index 0000000000..953f550612 --- /dev/null +++ b/firmware/target/arm/tcc77x/pcm-tcc77x.c | |||
@@ -0,0 +1,75 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by [whoever fills in these functions] | ||
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 "system.h" | ||
20 | #include "kernel.h" | ||
21 | #include "logf.h" | ||
22 | #include "audio.h" | ||
23 | #include "sound.h" | ||
24 | #include "file.h" | ||
25 | |||
26 | void pcm_postinit(void) | ||
27 | { | ||
28 | } | ||
29 | |||
30 | const void * pcm_play_dma_get_peak_buffer(int *count) | ||
31 | { | ||
32 | (void)count; | ||
33 | return 0; | ||
34 | } | ||
35 | |||
36 | void pcm_play_dma_init(void) | ||
37 | { | ||
38 | } | ||
39 | |||
40 | void pcm_apply_settings(void) | ||
41 | { | ||
42 | } | ||
43 | |||
44 | void pcm_set_frequency(unsigned int frequency) | ||
45 | { | ||
46 | (void)frequency; | ||
47 | } | ||
48 | |||
49 | void pcm_play_dma_start(const void *addr, size_t size) | ||
50 | { | ||
51 | (void)addr; | ||
52 | (void)size; | ||
53 | } | ||
54 | |||
55 | void pcm_play_dma_stop(void) | ||
56 | { | ||
57 | } | ||
58 | |||
59 | void pcm_play_lock(void) | ||
60 | { | ||
61 | } | ||
62 | |||
63 | void pcm_play_unlock(void) | ||
64 | { | ||
65 | } | ||
66 | |||
67 | void pcm_play_dma_pause(bool pause) | ||
68 | { | ||
69 | (void)pause; | ||
70 | } | ||
71 | |||
72 | size_t pcm_get_bytes_waiting(void) | ||
73 | { | ||
74 | return 0; | ||
75 | } | ||
diff --git a/firmware/target/arm/tcc77x/powermgmt-tcc77x.c b/firmware/target/arm/tcc77x/powermgmt-tcc77x.c new file mode 100644 index 0000000000..20172c00ce --- /dev/null +++ b/firmware/target/arm/tcc77x/powermgmt-tcc77x.c | |||
@@ -0,0 +1,64 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Karl Kurbjun | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "config.h" | ||
21 | #include "adc.h" | ||
22 | #include "powermgmt.h" | ||
23 | #include "kernel.h" | ||
24 | #include "pcf50606.h" | ||
25 | |||
26 | unsigned short current_voltage = 3910; | ||
27 | |||
28 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
29 | { | ||
30 | /* FIXME: calibrate value */ | ||
31 | 3380 | ||
32 | }; | ||
33 | |||
34 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
35 | { | ||
36 | /* FIXME: calibrate value */ | ||
37 | 3300 | ||
38 | }; | ||
39 | |||
40 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
41 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
42 | { | ||
43 | /* FIXME: calibrate values. Table is "inherited" from iPod-PCF / H100 */ | ||
44 | { 3370, 3650, 3700, 3740, 3780, 3820, 3870, 3930, 4000, 4080, 4160 } | ||
45 | }; | ||
46 | |||
47 | #if CONFIG_CHARGING | ||
48 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | ||
49 | const unsigned short percent_to_volt_charge[11] = | ||
50 | { | ||
51 | /* FIXME: calibrate values. Table is "inherited" from iPod-PCF / H100 */ | ||
52 | 3370, 3650, 3700, 3740, 3780, 3820, 3870, 3930, 4000, 4080, 4160 | ||
53 | }; | ||
54 | #endif /* CONFIG_CHARGING */ | ||
55 | |||
56 | #define BATTERY_SCALE_FACTOR 6000 | ||
57 | /* full-scale ADC readout (2^10) in millivolt */ | ||
58 | |||
59 | /* Returns battery voltage from ADC [millivolts] */ | ||
60 | unsigned int battery_adc_voltage(void) | ||
61 | { | ||
62 | return current_voltage; | ||
63 | } | ||
64 | |||
diff --git a/firmware/target/arm/tcc77x/system-tcc77x.c b/firmware/target/arm/tcc77x/system-tcc77x.c index baa1641c78..7323b0ce55 100644 --- a/firmware/target/arm/tcc77x/system-tcc77x.c +++ b/firmware/target/arm/tcc77x/system-tcc77x.c | |||
@@ -21,6 +21,28 @@ | |||
21 | #include "system.h" | 21 | #include "system.h" |
22 | #include "panic.h" | 22 | #include "panic.h" |
23 | 23 | ||
24 | extern void TIMER(void); | ||
25 | |||
26 | void irq(void) | ||
27 | { | ||
28 | int irq = IREQ & 0x7fffffff; | ||
29 | CREQ = irq; /* Clears the corresponding IRQ status */ | ||
30 | |||
31 | if (irq & TIMER0_IRQ_MASK) | ||
32 | { | ||
33 | TIMER(); | ||
34 | } | ||
35 | else | ||
36 | { | ||
37 | panicf("Unhandled IRQ 0x%08X", irq); | ||
38 | } | ||
39 | } | ||
40 | |||
41 | void fiq_handler(void) | ||
42 | { | ||
43 | /* TODO */ | ||
44 | } | ||
45 | |||
24 | void system_reboot(void) | 46 | void system_reboot(void) |
25 | { | 47 | { |
26 | } | 48 | } |
@@ -49,7 +71,7 @@ static void gpio_init(void) | |||
49 | GPIOB_DIR = 0x6ffff; | 71 | GPIOB_DIR = 0x6ffff; |
50 | GPIOB = 0; | 72 | GPIOB = 0; |
51 | GPIOC_FUNC = 1; | 73 | GPIOC_FUNC = 1; |
52 | GPIOC_DIR = 0x03ffffff; /* mvn r2, 0xfc000000 */ | 74 | GPIOC_DIR = 0x03ffffff; /* mvn r2, 0xfc000000 */ |
53 | GPIOC = 0; | 75 | GPIOC = 0; |
54 | } | 76 | } |
55 | #elif defined(IAUDIO_7) | 77 | #elif defined(IAUDIO_7) |
@@ -72,6 +94,11 @@ static void gpio_init(void) | |||
72 | GPIOD_DIR = 0x3e3; | 94 | GPIOD_DIR = 0x3e3; |
73 | GPIOE_DIR = 0x88; | 95 | GPIOE_DIR = 0x88; |
74 | } | 96 | } |
97 | #elif defined(SANSA_M200) | ||
98 | static void gpio_init(void) | ||
99 | { | ||
100 | /* TODO - Implement for M200 */ | ||
101 | } | ||
75 | #endif | 102 | #endif |
76 | 103 | ||
77 | /* Second function called in the original firmware's startup code - we just | 104 | /* Second function called in the original firmware's startup code - we just |
@@ -80,14 +107,16 @@ static void clock_init(void) | |||
80 | { | 107 | { |
81 | unsigned int i; | 108 | unsigned int i; |
82 | 109 | ||
110 | /* STP = 0x1, PW = 0x04 , HLD = 0x0 */ | ||
83 | CSCFG3 = (CSCFG3 &~ 0x3fff) | 0x820; | 111 | CSCFG3 = (CSCFG3 &~ 0x3fff) | 0x820; |
84 | 112 | ||
113 | /* XIN=External main, Fcpu=Fsys, BCKDIV=1 (Fbus = Fsys / 2) */ | ||
85 | CLKCTRL = (CLKCTRL & ~0xff) | 0x14; | 114 | CLKCTRL = (CLKCTRL & ~0xff) | 0x14; |
86 | 115 | ||
87 | if (BMI & 0x20) | 116 | if (BMI & 0x20) |
88 | PCLKCFG0 = 0xc82d7000; | 117 | PCLKCFG0 = 0xc82d7000; /* EN1 = 1, XIN=Ext. main, DIV1 = 0x2d, P1 = 1 */ |
89 | else | 118 | else |
90 | PCLKCFG0 = 0xc8ba7000; | 119 | PCLKCFG0 = 0xc8ba7000; /* EN1 = 1, XIN=Ext. main, DIV1 = 0xba, P1 = 1 */ |
91 | 120 | ||
92 | MCFG |= 0x2000; | 121 | MCFG |= 0x2000; |
93 | 122 | ||
@@ -96,14 +125,20 @@ static void clock_init(void) | |||
96 | SDCFG = (SDCFG & ~0x7000) | 0x2000; | 125 | SDCFG = (SDCFG & ~0x7000) | 0x2000; |
97 | #endif | 126 | #endif |
98 | 127 | ||
128 | /* Disable PLL */ | ||
99 | PLL0CFG |= 0x80000000; | 129 | PLL0CFG |= 0x80000000; |
100 | 130 | ||
131 | /* Enable PLL, M=0xcf, P=0x13. m=M+8, p=P+2, S = 0 | ||
132 | Fout = (215/21)*12MHz = 122857142Hz */ | ||
101 | PLL0CFG = 0x0000cf13; | 133 | PLL0CFG = 0x0000cf13; |
102 | 134 | ||
103 | i = 8000; | 135 | i = 8000; |
104 | while (--i) {}; | 136 | while (--i) {}; |
105 | 137 | ||
106 | CLKDIV0 = 0x81000000; | 138 | /* Enable PLL0 */ |
139 | CLKDIVC = 0x81000000; | ||
140 | |||
141 | /* Fsys = PLL0, Fcpu = Fsys, Fbus=Fsys / 2 */ | ||
107 | CLKCTRL = 0x80000010; | 142 | CLKCTRL = 0x80000010; |
108 | 143 | ||
109 | asm volatile ( | 144 | asm volatile ( |
@@ -112,13 +147,118 @@ static void clock_init(void) | |||
112 | ); | 147 | ); |
113 | } | 148 | } |
114 | 149 | ||
150 | static void cpu_init(void) | ||
151 | { | ||
152 | /* Memory protection - see page 48 of ARM946 TRM | ||
153 | http://infocenter.arm.com/help/topic/com.arm.doc.ddi0201d/DDI0201D_arm946es_r1p1_trm.pdf | ||
154 | */ | ||
155 | asm volatile ( | ||
156 | /* Region 0 - addr=0, size=4GB, enabled */ | ||
157 | "mov r0, #0x3f \n\t" | ||
158 | "mcr p15, 0, r0, c6, c0, 0 \n\t" | ||
159 | "mcr p15, 0, r0, c6, c0, 1 \n\t" | ||
160 | |||
161 | #ifdef LOGIK_DAX | ||
162 | /* Address region 1 - addr 0x2fff0000, size=64KB, enabled*/ | ||
163 | "ldr r0, =0x2fff001f \n\t" | ||
164 | #elif defined(IAUDIO_7) | ||
165 | /* Address region 1 - addr 0x20000000, size=8KB, enabled*/ | ||
166 | "mov r0, #0x19 \n\t" | ||
167 | "add r0, r0, #0x20000000 \n\t" | ||
168 | #elif defined(SANSA_M200) | ||
169 | /* Address region 1 - addr 0x20000000, size=256MB, enabled*/ | ||
170 | "mov r0, #0x37 \n\t" | ||
171 | "add r0, r0, #0x20000000 \n\t" | ||
172 | #endif | ||
173 | "mcr p15, 0, r0, c6, c1, 0 \n\t" | ||
174 | "mcr p15, 0, r0, c6, c1, 1 \n\t" | ||
175 | |||
176 | /* Address region 2 - addr 0x30000000, size=256MB, enabled*/ | ||
177 | "mov r0, #0x37 \n\t" | ||
178 | "add r0, r0, #0x30000000 \n\t" | ||
179 | "mcr p15, 0, r0, c6, c2, 0 \n\t" | ||
180 | "mcr p15, 0, r0, c6, c2, 1 \n\t" | ||
181 | |||
182 | /* Address region 2 - addr 0x40000000, size=512MB, enabled*/ | ||
183 | "mov r0, #0x39 \n\t" | ||
184 | "add r0, r0, #0x40000000 \n\t" | ||
185 | "mcr p15, 0, r0, c6, c3, 0 \n\t" | ||
186 | "mcr p15, 0, r0, c6, c3, 1 \n\t" | ||
187 | |||
188 | /* Address region 4 - addr 0x60000000, size=256MB, enabled*/ | ||
189 | "mov r0, #0x37 \n\t" | ||
190 | "add r0, r0, #0x60000000 \n\t" | ||
191 | "mcr p15, 0, r0, c6, c4, 0 \n\t" | ||
192 | "mcr p15, 0, r0, c6, c4, 1 \n\t" | ||
193 | |||
194 | /* Address region 5 - addr 0x10000000, size=256MB, enabled*/ | ||
195 | "mov r0, #0x37 \n\t" | ||
196 | "add r0, r0, #0x10000000 \n\t" | ||
197 | "mcr p15, 0, r0, c6, c5, 0 \n\t" | ||
198 | "mcr p15, 0, r0, c6, c5, 1 \n\t" | ||
199 | |||
200 | /* Address region 6 - addr 0x80000000, size=2GB, enabled*/ | ||
201 | "mov r0, #0x37 \n\t" | ||
202 | "add r0, r0, #0x80000006 \n\t" | ||
203 | "mcr p15, 0, r0, c6, c6, 0 \n\t" | ||
204 | "mcr p15, 0, r0, c6, c6, 1 \n\t" | ||
205 | |||
206 | /* Address region 7 - addr 0x3000f000, size=4KB, enabled*/ | ||
207 | "ldr r0, =0x3000f017 \n\t" | ||
208 | "mcr p15, 0, r0, c6, c7, 0 \n\t" | ||
209 | "mcr p15, 0, r0, c6, c7, 1 \n\t" | ||
210 | |||
211 | |||
212 | /* Register 5 - Access Permission Registers */ | ||
213 | |||
214 | "ldr r0, =0xffff \n\t" | ||
215 | "mcr p15, 0, r0, c5, c0, 0 \n\t" /* write data access permission bits */ | ||
216 | "mcr p15, 0, r0, c5, c0, 1 \n\t" /* write instruction access permission bits */ | ||
217 | |||
218 | "mov r0, #0xa7 \n\t" | ||
219 | "mcr p15, 0, r0, c3, c0, 0 \n\t" /* set write buffer control register */ | ||
220 | |||
221 | #ifdef LOGIK_DAX | ||
222 | "mov r0, #0xa5 \n\t" | ||
223 | #elif defined(IAUDIO_7) || defined(SANSA_M200) | ||
224 | "mov r0, #0xa7 \n\t" | ||
225 | #elif | ||
226 | #error NOT DEFINED FOR THIS TARGET! | ||
227 | #endif | ||
228 | "mcr p15, 0, r0, c2, c0, 0 \n\t" | ||
229 | "mcr p15, 0, r0, c2, c0, 1 \n\t" | ||
230 | |||
231 | "mov r0, #0xa0000006 \n\t" | ||
232 | "mcr p15, 0, r0, c9, c1, 0 \n\t" | ||
233 | |||
234 | "ldr r1, =0x1107d \n\t" | ||
235 | "mov r0, #0x0 \n\t" | ||
236 | "mcr p15, 0, r0, c7, c5, 0 \n\t" /* Flush instruction cache */ | ||
237 | "mcr p15, 0, r0, c7, c6, 0 \n\t" /* Flush data cache */ | ||
238 | |||
239 | "mcr p15, 0, r1, c1, c0, 0 \n\t" /* CPU control bits */ | ||
240 | : : : "r0", "r1" | ||
241 | ); | ||
242 | } | ||
243 | |||
244 | |||
115 | 245 | ||
116 | void system_init(void) | 246 | void system_init(void) |
117 | { | 247 | { |
118 | /* TODO: cache init - the original firmwares have cache init code which | 248 | /* mask all interrupts */ |
119 | is called at the very start of the firmware */ | 249 | IEN = 0; |
250 | |||
251 | /* Set all interrupts as IRQ for now - some may need to be FIQ in future */ | ||
252 | IRQSEL = 0xffffffff; | ||
253 | |||
254 | /* Set master enable bit */ | ||
255 | IEN = 0x80000000; | ||
256 | |||
257 | cpu_init(); | ||
120 | clock_init(); | 258 | clock_init(); |
121 | gpio_init(); | 259 | gpio_init(); |
260 | |||
261 | enable_irq(); | ||
122 | } | 262 | } |
123 | 263 | ||
124 | int system_memory_guard(int newmode) | 264 | int system_memory_guard(int newmode) |
diff --git a/firmware/target/arm/tcc77x/timer-target.h b/firmware/target/arm/tcc77x/timer-target.h new file mode 100644 index 0000000000..db25df7cd4 --- /dev/null +++ b/firmware/target/arm/tcc77x/timer-target.h | |||
@@ -0,0 +1,39 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Karl Kurbjun | ||
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 TIMER_TARGET_H | ||
20 | #define TIMER_TARGET_H | ||
21 | |||
22 | /* timers are based on XIN (12Mhz) */ | ||
23 | #define TIMER_FREQ (12000000) | ||
24 | |||
25 | bool __timer_set(long cycles, bool set); | ||
26 | bool __timer_register(void); | ||
27 | void __timer_unregister(void); | ||
28 | |||
29 | #define __TIMER_SET(cycles, set) \ | ||
30 | __timer_set(cycles, set) | ||
31 | |||
32 | #define __TIMER_REGISTER(reg_prio, unregister_callback, cycles, \ | ||
33 | int_prio, timer_callback) \ | ||
34 | __timer_register() | ||
35 | |||
36 | #define __TIMER_UNREGISTER(...) \ | ||
37 | __timer_unregister() | ||
38 | |||
39 | #endif /* TIMER_TARGET_H */ | ||
diff --git a/firmware/target/arm/tcc77x/timer-tcc77x.c b/firmware/target/arm/tcc77x/timer-tcc77x.c new file mode 100644 index 0000000000..32010b2d25 --- /dev/null +++ b/firmware/target/arm/tcc77x/timer-tcc77x.c | |||
@@ -0,0 +1,79 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Rob Purchase | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "config.h" | ||
21 | #include "cpu.h" | ||
22 | #include "system.h" | ||
23 | #include "timer.h" | ||
24 | #include "logf.h" | ||
25 | |||
26 | /* Use the TC32 counter [sourced by Xin:12Mhz] for this timer, as it's the | ||
27 | only one that allows a 32-bit counter (Timer0-5 are 16/20 bit only). */ | ||
28 | |||
29 | bool __timer_set(long cycles, bool start) | ||
30 | { | ||
31 | #warning function not implemented | ||
32 | |||
33 | (void)cycles; | ||
34 | (void)start; | ||
35 | return false; | ||
36 | } | ||
37 | |||
38 | bool __timer_register(void) | ||
39 | { | ||
40 | #warning function not implemented | ||
41 | |||
42 | return false; | ||
43 | } | ||
44 | |||
45 | void __timer_unregister(void) | ||
46 | { | ||
47 | #warning function not implemented | ||
48 | } | ||
49 | |||
50 | |||
51 | /* Timer interrupt processing - all timers (inc. tick) have a single IRQ */ | ||
52 | |||
53 | extern void (*tick_funcs[MAX_NUM_TICK_TASKS])(void); | ||
54 | |||
55 | void TIMER(void) | ||
56 | { | ||
57 | if (TIREQ & TF0) /* Timer0 reached ref value */ | ||
58 | { | ||
59 | int i; | ||
60 | |||
61 | /* Run through the list of tick tasks */ | ||
62 | for(i = 0; i < MAX_NUM_TICK_TASKS; i++) | ||
63 | { | ||
64 | if(tick_funcs[i]) | ||
65 | { | ||
66 | tick_funcs[i](); | ||
67 | } | ||
68 | } | ||
69 | current_tick++; | ||
70 | |||
71 | /* reset Timer 0 IRQ & ref flags */ | ||
72 | TIREQ |= TI0 | TF0; | ||
73 | } | ||
74 | |||
75 | if (TC32IRQ & (1<<3)) /* end of TC32 prescale */ | ||
76 | { | ||
77 | /* dispatch timer */ | ||
78 | } | ||
79 | } | ||
diff --git a/firmware/target/arm/tcc77x/usb-tcc77x.c b/firmware/target/arm/tcc77x/usb-tcc77x.c new file mode 100644 index 0000000000..7254b919a7 --- /dev/null +++ b/firmware/target/arm/tcc77x/usb-tcc77x.c | |||
@@ -0,0 +1,36 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by [whoever fills in these functions] | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "config.h" | ||
21 | #include "usb.h" | ||
22 | |||
23 | void usb_init_device(void) | ||
24 | { | ||
25 | } | ||
26 | |||
27 | void usb_enable(bool on) | ||
28 | { | ||
29 | (void)on; | ||
30 | } | ||
31 | |||
32 | /* Always return false for now */ | ||
33 | int usb_detect(void) | ||
34 | { | ||
35 | return USB_EXTRACTED; | ||
36 | } | ||
diff --git a/tools/configure b/tools/configure index 93a0484b6a..1f71c8b51c 100755 --- a/tools/configure +++ b/tools/configure | |||
@@ -670,7 +670,7 @@ cat <<EOF | |||
670 | 30) X5/X5V/X5L 40) Gigabeat F 50) Sansa e200 | 670 | 30) X5/X5V/X5L 40) Gigabeat F 50) Sansa e200 |
671 | 31) M5/M5L 41) Gigabeat S 51) Sansa e200R | 671 | 31) M5/M5L 41) Gigabeat S 51) Sansa e200R |
672 | 32) 7 52) Sansa c200 | 672 | 32) 7 52) Sansa c200 |
673 | 33) Cowon D2 | 673 | 33) Cowon D2 53) Sansa m200 |
674 | 34) M3/M3L | 674 | 34) M3/M3L |
675 | 675 | ||
676 | ==Tatung== ==Olympus== ==Logik== | 676 | ==Tatung== ==Olympus== ==Logik== |
@@ -1550,6 +1550,30 @@ fi | |||
1550 | t_model="sansa-c200" | 1550 | t_model="sansa-c200" |
1551 | ;; | 1551 | ;; |
1552 | 1552 | ||
1553 | 53|m200) | ||
1554 | target_id=31 | ||
1555 | modelname="m200" | ||
1556 | target="-DSANSA_M200" | ||
1557 | memory=2 # always | ||
1558 | arm946cc | ||
1559 | tool="$rootdir/tools/scramble -add=m200" | ||
1560 | boottool="$rootdir/tools/scramble -tcc=crc" | ||
1561 | bootoutput="player.rom" | ||
1562 | bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" | ||
1563 | bmp2rb_native="$rootdir/tools/bmp2rb -f 0" | ||
1564 | output="rockbox.m200" | ||
1565 | appextra="recorder:gui" | ||
1566 | plugins="" | ||
1567 | swcodec="yes" | ||
1568 | # toolset is the tools within the tools directory that we build for | ||
1569 | # this particular target. | ||
1570 | toolset=$tccbitmaptools | ||
1571 | # architecture, manufacturer and model for the target-tree build | ||
1572 | t_cpu="arm" | ||
1573 | t_manufacturer="tcc77x" | ||
1574 | t_model="m200" | ||
1575 | ;; | ||
1576 | |||
1553 | 60|tpj1022) | 1577 | 60|tpj1022) |
1554 | target_id=25 | 1578 | target_id=25 |
1555 | modelname="tpj1022" | 1579 | modelname="tpj1022" |