summaryrefslogtreecommitdiff
path: root/firmware/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/debug.c')
-rw-r--r--firmware/debug.c179
1 files changed, 0 insertions, 179 deletions
diff --git a/firmware/debug.c b/firmware/debug.c
index a7923ac237..83eb149706 100644
--- a/firmware/debug.c
+++ b/firmware/debug.c
@@ -29,12 +29,7 @@ static char debugbuf[200];
29 29
30#ifndef SIMULATOR /* allow non archos platforms to display output */ 30#ifndef SIMULATOR /* allow non archos platforms to display output */
31#include "kernel.h" 31#include "kernel.h"
32#include "button.h"
33#include "system.h" 32#include "system.h"
34#include "lcd.h"
35#include "adc.h"
36#include "mas.h"
37#include "power.h"
38 33
39void debug_init(void) 34void debug_init(void)
40{ 35{
@@ -214,180 +209,6 @@ void debugf(char *fmt, ...)
214#endif 209#endif
215} 210}
216 211
217/*---------------------------------------------------*/
218/* SPECIAL DEBUG STUFF */
219/*---------------------------------------------------*/
220extern int ata_device;
221extern int ata_io_address;
222
223#ifdef ARCHOS_RECORDER
224/* Test code!!! */
225void dbg_ports(void)
226{
227 unsigned short porta;
228 unsigned short portb;
229 unsigned char portc;
230 char buf[32];
231 int button;
232 int battery_voltage;
233 int batt_int, batt_frac;
234 bool charge_status = false;
235 bool ide_status = true;
236
237 lcd_clear_display();
238
239 while(1)
240 {
241 porta = PADR;
242 portb = PBDR;
243 portc = PCDR;
244
245 snprintf(buf, 32, "PADR: %04x", porta);
246 lcd_puts(0, 0, buf);
247 snprintf(buf, 32, "PBDR: %04x", portb);
248 lcd_puts(0, 1, buf);
249
250 snprintf(buf, 32, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4));
251 lcd_puts(0, 2, buf);
252 snprintf(buf, 32, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5));
253 lcd_puts(0, 3, buf);
254 snprintf(buf, 32, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6));
255 lcd_puts(0, 4, buf);
256 snprintf(buf, 32, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7));
257 lcd_puts(0, 5, buf);
258
259 battery_voltage = (adc_read(6) * BATTERY_SCALE_FACTOR) / 10000;
260 batt_int = battery_voltage / 100;
261 batt_frac = battery_voltage % 100;
262
263 snprintf(buf, 32, "Batt: %d.%02dV %d%% ", batt_int, batt_frac,
264 battery_level());
265 lcd_puts(0, 6, buf);
266
267 snprintf(buf, 32, "ATA: %s, 0x%x",
268 ata_device?"slave":"master", ata_io_address);
269 lcd_puts(0, 7, buf);
270
271 lcd_update();
272 sleep(HZ/10);
273
274 button = button_get(false);
275
276 switch(button)
277 {
278 case BUTTON_ON:
279 charge_status = charge_status?false:true;
280 charger_enable(charge_status);
281 break;
282
283 case BUTTON_UP:
284 ide_status = ide_status?false:true;
285 ide_power_enable(ide_status);
286 break;
287
288 case BUTTON_OFF:
289 charger_enable(false);
290 ide_power_enable(true);
291 return;
292 }
293 }
294}
295#else
296void dbg_ports(void)
297{
298 unsigned short porta;
299 unsigned short portb;
300 unsigned char portc;
301 char buf[32];
302 unsigned long crc_count;
303 int button;
304 int battery_voltage;
305 int batt_int, batt_frac;
306 int currval = 0;
307
308 lcd_clear_display();
309
310 while(1)
311 {
312 porta = PADR;
313 portb = PBDR;
314 portc = PCDR;
315
316 switch(currval)
317 {
318 case 0:
319 snprintf(buf, 32, "PADR: %04x ", porta);
320 break;
321 case 1:
322 snprintf(buf, 32, "PBDR: %04x ", portb);
323 break;
324 case 2:
325 snprintf(buf, 32, "AN0: %03x ", adc_read(0));
326 break;
327 case 3:
328 snprintf(buf, 32, "AN1: %03x ", adc_read(1));
329 break;
330 case 4:
331 snprintf(buf, 32, "AN2: %03x ", adc_read(2));
332 break;
333 case 5:
334 snprintf(buf, 32, "AN3: %03x ", adc_read(3));
335 break;
336 case 6:
337 snprintf(buf, 32, "AN4: %03x ", adc_read(4));
338 break;
339 case 7:
340 snprintf(buf, 32, "AN5: %03x ", adc_read(5));
341 break;
342 case 8:
343 snprintf(buf, 32, "AN6: %03x ", adc_read(6));
344 break;
345 case 9:
346 snprintf(buf, 32, "AN7: %03x ", adc_read(7));
347 break;
348 case 10:
349 snprintf(buf, 32, "%s, 0x%x ",
350 ata_device?"slv":"mst", ata_io_address);
351 break;
352 case 11:
353 mas_readmem(MAS_BANK_D0, 0x303, &crc_count, 1);
354
355 snprintf(buf, 32, "CRC: %d ", crc_count);
356 break;
357 }
358 lcd_puts(0, 0, buf);
359
360 battery_voltage = (adc_read(6) * BATTERY_SCALE_FACTOR) / 10000;
361 batt_int = battery_voltage / 100;
362 batt_frac = battery_voltage % 100;
363
364 snprintf(buf, 32, "Batt: %d.%02dV", batt_int, batt_frac);
365 lcd_puts(0, 1, buf);
366
367 sleep(HZ/5);
368
369 button = button_get(false);
370
371 switch(button)
372 {
373 case BUTTON_STOP:
374 return;
375
376 case BUTTON_LEFT:
377 currval--;
378 if(currval < 0)
379 currval = 11;
380 break;
381
382 case BUTTON_RIGHT:
383 currval++;
384 if(currval > 11)
385 currval = 0;
386 break;
387 }
388 }
389}
390#endif
391 212
392#else /* SIMULATOR code coming up */ 213#else /* SIMULATOR code coming up */
393 214