summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2010-11-06 14:24:25 +0000
committerMarcin Bukat <marcin.bukat@gmail.com>2010-11-06 14:24:25 +0000
commitb8a7f5137b38cbfd301715bb69034467a033eccb (patch)
tree5bef733ca715d7706801587137c1db40f173b6c1 /firmware/target/coldfire
parent97a783a79ab53cc772545980ff4bad6a6d3b8bad (diff)
move dbg_ports() from apps/menu_debug.c to target tree. FS#11712 by me.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28522 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/coldfire')
-rw-r--r--firmware/target/coldfire/debug-coldfire.c106
-rw-r--r--firmware/target/coldfire/debug-target.h34
2 files changed, 140 insertions, 0 deletions
diff --git a/firmware/target/coldfire/debug-coldfire.c b/firmware/target/coldfire/debug-coldfire.c
new file mode 100644
index 0000000000..0676ed0b07
--- /dev/null
+++ b/firmware/target/coldfire/debug-coldfire.c
@@ -0,0 +1,106 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2005 by Linus Nielsen Feltzing
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "config.h"
+#include "system.h"
+#include <stdbool.h>
+#include "font.h"
+#include "lcd.h"
+#include "button.h"
+#include "powermgmt.h"
+#include "adc.h"
+#include "debug-target.h"
+
+bool dbg_ports(void)
+{
+ unsigned int gpio_out;
+ unsigned int gpio1_out;
+ unsigned int gpio_read;
+ unsigned int gpio1_read;
+ unsigned int gpio_function;
+ unsigned int gpio1_function;
+ unsigned int gpio_enable;
+ unsigned int gpio1_enable;
+ int adc_battery_voltage, adc_battery_level;
+ int adc_buttons, adc_remote;
+ int line;
+
+ lcd_clear_display();
+ lcd_setfont(FONT_SYSFIXED);
+
+ while(1)
+ {
+ line = 0;
+ gpio_read = GPIO_READ;
+ gpio1_read = GPIO1_READ;
+ gpio_out = GPIO_OUT;
+ gpio1_out = GPIO1_OUT;
+ gpio_function = GPIO_FUNCTION;
+ gpio1_function = GPIO1_FUNCTION;
+ gpio_enable = GPIO_ENABLE;
+ gpio1_enable = GPIO1_ENABLE;
+
+ lcd_putsf(0, line++, "GPIO_READ: %08x", gpio_read);
+ lcd_putsf(0, line++, "GPIO_OUT: %08x", gpio_out);
+ lcd_putsf(0, line++, "GPIO_FUNC: %08x", gpio_function);
+ lcd_putsf(0, line++, "GPIO_ENA: %08x", gpio_enable);
+ lcd_putsf(0, line++, "GPIO1_READ: %08x", gpio1_read);
+ lcd_putsf(0, line++, "GPIO1_OUT: %08x", gpio1_out);
+ lcd_putsf(0, line++, "GPIO1_FUNC: %08x", gpio1_function);
+ lcd_putsf(0, line++, "GPIO1_ENA: %08x", gpio1_enable);
+
+ adc_buttons = adc_read(ADC_BUTTONS);
+ adc_remote = adc_read(ADC_REMOTE);
+ battery_read_info(&adc_battery_voltage, &adc_battery_level);
+#if defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IRIVER_H300_SERIES)
+ lcd_putsf(0, line++, "ADC_BUTTONS (%c): %02x",
+ button_scan_enabled() ? '+' : '-', adc_buttons);
+#else
+ lcd_putsf(0, line++, "ADC_BUTTONS: %02x", adc_buttons);
+#endif
+#if defined(IAUDIO_X5) || defined(IAUDIO_M5)
+ lcd_putsf(0, line++, "ADC_REMOTE (%c): %02x",
+ remote_detect() ? '+' : '-', adc_remote);
+#else
+ lcd_putsf(0, line++, "ADC_REMOTE: %02x", adc_remote);
+#endif
+#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
+ lcd_putsf(0, line++, "ADC_REMOTEDETECT: %02x",
+ adc_read(ADC_REMOTEDETECT));
+#endif
+
+ battery_read_info(&adc_battery_voltage, &adc_battery_level);
+ lcd_putsf(0, line++, "Batt: %d.%03dV %d%% ", adc_battery_voltage / 1000,
+ adc_battery_voltage % 1000, adc_battery_level);
+
+#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
+ lcd_putsf(0, line++, "remotetype: %d", remote_type());
+#endif
+
+ lcd_update();
+ if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
+ {
+ lcd_setfont(FONT_UI);
+ return false;
+ }
+ }
+ return false;
+}
diff --git a/firmware/target/coldfire/debug-target.h b/firmware/target/coldfire/debug-target.h
new file mode 100644
index 0000000000..76b502e4ff
--- /dev/null
+++ b/firmware/target/coldfire/debug-target.h
@@ -0,0 +1,34 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2010 by Marcin Bukat
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
+ (CONFIG_KEYPAD == IRIVER_H300_PAD)
+# define DEBUG_CANCEL BUTTON_OFF
+
+#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
+# define DEBUG_CANCEL BUTTON_REC
+
+#elif (CONFIG_KEYPAD == IAUDIO_M3_PAD)
+# define DEBUG_CANCEL BUTTON_RC_REC
+
+#elif (CONFIG_KEYPAD == MPIO_HD200_PAD)
+# define DEBUG_CANCEL BUTTON_REC
+#endif
+bool dbg_ports(void);