summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/debug-pp.c
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/arm/debug-pp.c
parent97a783a79ab53cc772545980ff4bad6a6d3b8bad (diff)
downloadrockbox-b8a7f5137b38cbfd301715bb69034467a033eccb.tar.gz
rockbox-b8a7f5137b38cbfd301715bb69034467a033eccb.zip
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/arm/debug-pp.c')
-rw-r--r--firmware/target/arm/debug-pp.c154
1 files changed, 154 insertions, 0 deletions
diff --git a/firmware/target/arm/debug-pp.c b/firmware/target/arm/debug-pp.c
new file mode 100644
index 0000000000..3b9250c0fb
--- /dev/null
+++ b/firmware/target/arm/debug-pp.c
@@ -0,0 +1,154 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2006 Dave Chapman
+ *
+ * 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 "iap.h"
+#include "debug-target.h"
+
+bool dbg_ports(void)
+{
+ int line;
+
+ lcd_clear_display();
+ lcd_setfont(FONT_SYSFIXED);
+
+ while(1)
+ {
+ line = 0;
+#if defined(CPU_PP502x)
+#if (LCD_HEIGHT >= 176) /* Only for displays with appropriate height. */
+ lcd_puts(0, line++, "GPIO ENABLE:");
+ lcd_putsf(0, line++, "A: %02x E: %02x I: %02x",
+ (unsigned int)GPIOA_ENABLE,
+ (unsigned int)GPIOE_ENABLE,
+ (unsigned int)GPIOI_ENABLE);
+ lcd_putsf(0, line++, "B: %02x F: %02x J: %02x",
+ (unsigned int)GPIOB_ENABLE,
+ (unsigned int)GPIOF_ENABLE,
+ (unsigned int)GPIOJ_ENABLE);
+ lcd_putsf(0, line++, "C: %02x G: %02x K: %02x",
+ (unsigned int)GPIOC_ENABLE,
+ (unsigned int)GPIOG_ENABLE,
+ (unsigned int)GPIOK_ENABLE);
+ lcd_putsf(0, line++, "D: %02x H: %02x L: %02x",
+ (unsigned int)GPIOD_ENABLE,
+ (unsigned int)GPIOH_ENABLE,
+ (unsigned int)GPIOL_ENABLE);
+ line++;
+#endif
+ lcd_puts(0, line++, "GPIO INPUT VAL:");
+ lcd_putsf(0, line++, "A: %02x E: %02x I: %02x",
+ (unsigned int)GPIOA_INPUT_VAL,
+ (unsigned int)GPIOE_INPUT_VAL,
+ (unsigned int)GPIOI_INPUT_VAL);
+ lcd_putsf(0, line++, "B: %02x F: %02x J: %02x",
+ (unsigned int)GPIOB_INPUT_VAL,
+ (unsigned int)GPIOF_INPUT_VAL,
+ (unsigned int)GPIOJ_INPUT_VAL);
+ lcd_putsf(0, line++, "C: %02x G: %02x K: %02x",
+ (unsigned int)GPIOC_INPUT_VAL,
+ (unsigned int)GPIOG_INPUT_VAL,
+ (unsigned int)GPIOK_INPUT_VAL);
+ lcd_putsf(0, line++, "D: %02x H: %02x L: %02x",
+ (unsigned int)GPIOD_INPUT_VAL,
+ (unsigned int)GPIOH_INPUT_VAL,
+ (unsigned int)GPIOL_INPUT_VAL);
+ line++;
+ lcd_putsf(0, line++, "GPO32_VAL: %08lx", GPO32_VAL);
+ lcd_putsf(0, line++, "GPO32_EN: %08lx", GPO32_ENABLE);
+ lcd_putsf(0, line++, "DEV_EN: %08lx", DEV_EN);
+ lcd_putsf(0, line++, "DEV_EN2: %08lx", DEV_EN2);
+ lcd_putsf(0, line++, "DEV_EN3: %08lx", inl(0x60006044)); /* to be verified */
+ lcd_putsf(0, line++, "DEV_INIT1: %08lx", DEV_INIT1);
+ lcd_putsf(0, line++, "DEV_INIT2: %08lx", DEV_INIT2);
+#ifdef ADC_ACCESSORY
+ lcd_putsf(0, line++, "ACCESSORY: %d", adc_read(ADC_ACCESSORY));
+#endif
+#ifdef IPOD_VIDEO
+ lcd_putsf(0, line++, "4066_ISTAT: %d", adc_read(ADC_4066_ISTAT));
+#endif
+
+#if defined(IPOD_ACCESSORY_PROTOCOL)
+ const unsigned char *serbuf = iap_get_serbuf();
+ lcd_putsf(0, line++, "IAP PACKET: %02x %02x %02x %02x %02x %02x %02x %02x",
+ serbuf[0], serbuf[1], serbuf[2], serbuf[3], serbuf[4], serbuf[5],
+ serbuf[6], serbuf[7]);
+#endif
+
+#if defined(IRIVER_H10) || defined(IRIVER_H10_5GB)
+ line++;
+ lcd_putsf(0, line++, "BATT: %03x UNK1: %03x",
+ adc_read(ADC_BATTERY), adc_read(ADC_UNKNOWN_1));
+ lcd_putsf(0, line++, "REM: %03x PAD: %03x",
+ adc_read(ADC_REMOTE), adc_read(ADC_SCROLLPAD));
+#elif defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330)
+ line++;
+ lcd_putsf(0, line++, "BATT: %03x UNK1: %03x",
+ adc_read(ADC_BATTERY), adc_read(ADC_UNKNOWN_1));
+#elif defined(SANSA_E200) || defined(PHILIPS_SA9200)
+ lcd_putsf(0, line++, "ADC_BVDD: %4d", adc_read(ADC_BVDD));
+ lcd_putsf(0, line++, "ADC_RTCSUP: %4d", adc_read(ADC_RTCSUP));
+ lcd_putsf(0, line++, "ADC_UVDD: %4d", adc_read(ADC_UVDD));
+ lcd_putsf(0, line++, "ADC_CHG_IN: %4d", adc_read(ADC_CHG_IN));
+ lcd_putsf(0, line++, "ADC_CVDD: %4d", adc_read(ADC_CVDD));
+ lcd_putsf(0, line++, "ADC_BATTEMP: %4d", adc_read(ADC_BATTEMP));
+ lcd_putsf(0, line++, "ADC_MICSUP1: %4d", adc_read(ADC_MICSUP1));
+ lcd_putsf(0, line++, "ADC_MICSUP2: %4d", adc_read(ADC_MICSUP2));
+ lcd_putsf(0, line++, "ADC_VBE1: %4d", adc_read(ADC_VBE1));
+ lcd_putsf(0, line++, "ADC_VBE2: %4d", adc_read(ADC_VBE2));
+ lcd_putsf(0, line++, "ADC_I_MICSUP1:%4d", adc_read(ADC_I_MICSUP1));
+#if !defined(PHILIPS_SA9200)
+ lcd_putsf(0, line++, "ADC_I_MICSUP2:%4d", adc_read(ADC_I_MICSUP2));
+ lcd_putsf(0, line++, "ADC_VBAT: %4d", adc_read(ADC_VBAT));
+#endif
+#endif
+
+#elif CONFIG_CPU == PP5002
+ lcd_putsf(0, line++, "GPIO_A: %02x GPIO_B: %02x",
+ (unsigned int)GPIOA_INPUT_VAL, (unsigned int)GPIOB_INPUT_VAL);
+ lcd_putsf(0, line++, "GPIO_C: %02x GPIO_D: %02x",
+ (unsigned int)GPIOC_INPUT_VAL, (unsigned int)GPIOD_INPUT_VAL);
+
+ lcd_putsf(0, line++, "DEV_EN: %08lx", DEV_EN);
+ lcd_putsf(0, line++, "CLOCK_ENABLE: %08lx", CLOCK_ENABLE);
+ lcd_putsf(0, line++, "CLOCK_SOURCE: %08lx", CLOCK_SOURCE);
+ lcd_putsf(0, line++, "PLL_CONTROL: %08lx", PLL_CONTROL);
+ lcd_putsf(0, line++, "PLL_DIV: %08lx", PLL_DIV);
+ lcd_putsf(0, line++, "PLL_MULT: %08lx", PLL_MULT);
+ lcd_putsf(0, line++, "TIMING1_CTL: %08lx", TIMING1_CTL);
+ lcd_putsf(0, line++, "TIMING2_CTL: %08lx", TIMING2_CTL);
+#endif
+ lcd_update();
+ if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
+ {
+ lcd_setfont(FONT_UI);
+ return false;
+ }
+ }
+ return false;
+}