diff options
Diffstat (limited to 'firmware/debug.c')
-rw-r--r-- | firmware/debug.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/firmware/debug.c b/firmware/debug.c index 00c37cc84c..c04deaa8b2 100644 --- a/firmware/debug.c +++ b/firmware/debug.c | |||
@@ -28,6 +28,13 @@ static char debugbuf[200]; | |||
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | #ifndef SIMULATOR /* allow non archos platforms to display output */ | 30 | #ifndef SIMULATOR /* allow non archos platforms to display output */ |
31 | #ifdef ARCHOS_RECORDER | ||
32 | #include "kernel.h" | ||
33 | #include "button.h" | ||
34 | #include "system.h" | ||
35 | #include "lcd.h" | ||
36 | #include "adc.h" | ||
37 | #endif | ||
31 | 38 | ||
32 | void debug_init(void) | 39 | void debug_init(void) |
33 | { | 40 | { |
@@ -207,6 +214,69 @@ void debugf(char *fmt, ...) | |||
207 | #endif | 214 | #endif |
208 | } | 215 | } |
209 | 216 | ||
217 | /*---------------------------------------------------*/ | ||
218 | /* SPECIAL DEBUG STUFF */ | ||
219 | /*---------------------------------------------------*/ | ||
220 | #ifdef ARCHOS_RECORDER | ||
221 | extern int ata_device; | ||
222 | extern int ata_io_address; | ||
223 | |||
224 | /* Test code!!! */ | ||
225 | void dbg_ports(void) | ||
226 | { | ||
227 | unsigned short porta; | ||
228 | unsigned short portb; | ||
229 | unsigned char portc; | ||
230 | char buf[32]; | ||
231 | int button; | ||
232 | |||
233 | lcd_clear_display(); | ||
234 | |||
235 | while(1) | ||
236 | { | ||
237 | porta = PADR; | ||
238 | portb = PBDR; | ||
239 | portc = PCDR; | ||
240 | |||
241 | snprintf(buf, 32, "PADR: %04x", porta); | ||
242 | lcd_puts(0, 0, buf); | ||
243 | snprintf(buf, 32, "PBDR: %04x", portb); | ||
244 | lcd_puts(0, 1, buf); | ||
245 | |||
246 | snprintf(buf, 32, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4)); | ||
247 | lcd_puts(0, 3, buf); | ||
248 | snprintf(buf, 32, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5)); | ||
249 | lcd_puts(0, 4, buf); | ||
250 | snprintf(buf, 32, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6)); | ||
251 | lcd_puts(0, 5, buf); | ||
252 | snprintf(buf, 32, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7)); | ||
253 | lcd_puts(0, 6, buf); | ||
254 | |||
255 | snprintf(buf, 32, "%s : 0x%x", | ||
256 | ata_device?"slave":"master", ata_io_address); | ||
257 | lcd_puts(0, 7, buf); | ||
258 | |||
259 | lcd_update(); | ||
260 | sleep(HZ/10); | ||
261 | |||
262 | button = button_get(false); | ||
263 | |||
264 | switch(button) | ||
265 | { | ||
266 | case BUTTON_ON: | ||
267 | /* Toggle the charger */ | ||
268 | PBDR ^= 0x20; | ||
269 | break; | ||
270 | |||
271 | case BUTTON_OFF: | ||
272 | /* Disable the charger */ | ||
273 | PBDR |= 0x20; | ||
274 | return; | ||
275 | } | ||
276 | } | ||
277 | } | ||
278 | #endif | ||
279 | |||
210 | #else /* SIMULATOR code coming up */ | 280 | #else /* SIMULATOR code coming up */ |
211 | 281 | ||
212 | void debug_init(void) | 282 | void debug_init(void) |