summaryrefslogtreecommitdiffstats
path: root/firmware/debug.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-07-02 15:58:56 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-07-02 15:58:56 +0000
commit2ced9de17bf6a5603039c80ce242f39ffe68acfe (patch)
treeadfe7d46679251ca3bd8322f4b978140b67dc68e /firmware/debug.c
parentd506e7a3577bc20a0b72084d0315ce93334ceeeb (diff)
downloadrockbox-2ced9de17bf6a5603039c80ce242f39ffe68acfe.tar.gz
rockbox-2ced9de17bf6a5603039c80ce242f39ffe68acfe.tar.bz2
rockbox-2ced9de17bf6a5603039c80ce242f39ffe68acfe.zip
Added recorder debug code
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1302 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/debug.c')
-rw-r--r--firmware/debug.c70
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];
#endif
#ifndef SIMULATOR /* allow non archos platforms to display output */
+#ifdef ARCHOS_RECORDER
+#include "kernel.h"
+#include "button.h"
+#include "system.h"
+#include "lcd.h"
+#include "adc.h"
+#endif
void debug_init(void)
{
@@ -207,6 +214,69 @@ void debugf(char *fmt, ...)
#endif
}
+/*---------------------------------------------------*/
+/* SPECIAL DEBUG STUFF */
+/*---------------------------------------------------*/
+#ifdef ARCHOS_RECORDER
+extern int ata_device;
+extern int ata_io_address;
+
+/* Test code!!! */
+void dbg_ports(void)
+{
+ unsigned short porta;
+ unsigned short portb;
+ unsigned char portc;
+ char buf[32];
+ int button;
+
+ lcd_clear_display();
+
+ while(1)
+ {
+ porta = PADR;
+ portb = PBDR;
+ portc = PCDR;
+
+ snprintf(buf, 32, "PADR: %04x", porta);
+ lcd_puts(0, 0, buf);
+ snprintf(buf, 32, "PBDR: %04x", portb);
+ lcd_puts(0, 1, buf);
+
+ snprintf(buf, 32, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4));
+ lcd_puts(0, 3, buf);
+ snprintf(buf, 32, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5));
+ lcd_puts(0, 4, buf);
+ snprintf(buf, 32, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6));
+ lcd_puts(0, 5, buf);
+ snprintf(buf, 32, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7));
+ lcd_puts(0, 6, buf);
+
+ snprintf(buf, 32, "%s : 0x%x",
+ ata_device?"slave":"master", ata_io_address);
+ lcd_puts(0, 7, buf);
+
+ lcd_update();
+ sleep(HZ/10);
+
+ button = button_get(false);
+
+ switch(button)
+ {
+ case BUTTON_ON:
+ /* Toggle the charger */
+ PBDR ^= 0x20;
+ break;
+
+ case BUTTON_OFF:
+ /* Disable the charger */
+ PBDR |= 0x20;
+ return;
+ }
+ }
+}
+#endif
+
#else /* SIMULATOR code coming up */
void debug_init(void)