summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/debug-pp.c
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2011-06-05 10:26:06 +0000
committerMarcin Bukat <marcin.bukat@gmail.com>2011-06-05 10:26:06 +0000
commitdceceef05264cdeff0e2c60b8cb00719d7d7baeb (patch)
treeeb8573dbe429755165372a91a620435e8b14e4bd /firmware/target/arm/debug-pp.c
parentdace72166e5250e2ea0a9beb6451f5e4da9e50e2 (diff)
downloadrockbox-dceceef05264cdeff0e2c60b8cb00719d7d7baeb.tar.gz
rockbox-dceceef05264cdeff0e2c60b8cb00719d7d7baeb.zip
Move dbg_hw_info() into target tree. FS#11735 by me
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29964 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/debug-pp.c')
-rw-r--r--firmware/target/arm/debug-pp.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/firmware/target/arm/debug-pp.c b/firmware/target/arm/debug-pp.c
index 3b9250c0fb..080e0ed631 100644
--- a/firmware/target/arm/debug-pp.c
+++ b/firmware/target/arm/debug-pp.c
@@ -28,8 +28,43 @@
#include "powermgmt.h"
#include "adc.h"
#include "iap.h"
+#include "hwcompat.h"
#include "debug-target.h"
+static int perfcheck(void)
+{
+ int result;
+
+ asm (
+ "mrs r2, CPSR \n"
+ "orr r0, r2, #0xc0 \n" /* disable IRQ and FIQ */
+ "msr CPSR_c, r0 \n"
+ "mov %[res], #0 \n"
+ "ldr r0, [%[timr]] \n"
+ "add r0, r0, %[tmo] \n"
+ "1: \n"
+ "add %[res], %[res], #1 \n"
+ "ldr r1, [%[timr]] \n"
+ "cmp r1, r0 \n"
+ "bmi 1b \n"
+ "msr CPSR_c, r2 \n" /* reset IRQ and FIQ state */
+ :
+ [res]"=&r"(result)
+ :
+ [timr]"r"(&USEC_TIMER),
+ [tmo]"r"(
+#if CONFIG_CPU == PP5002
+ 16000
+#else /* PP5020/5022/5024 */
+ 10226
+#endif
+ )
+ :
+ "r0", "r1", "r2"
+ );
+ return result;
+}
+
bool dbg_ports(void)
{
int line;
@@ -152,3 +187,46 @@ bool dbg_ports(void)
}
return false;
}
+
+bool dbg_hw_info(void)
+{
+ int line = 0;
+#if defined(CPU_PP502x)
+ char pp_version[] = { (PP_VER2 >> 24) & 0xff, (PP_VER2 >> 16) & 0xff,
+ (PP_VER2 >> 8) & 0xff, (PP_VER2) & 0xff,
+ (PP_VER1 >> 24) & 0xff, (PP_VER1 >> 16) & 0xff,
+ (PP_VER1 >> 8) & 0xff, (PP_VER1) & 0xff, '\0' };
+#elif CONFIG_CPU == PP5002
+ char pp_version[] = { (PP_VER4 >> 8) & 0xff, PP_VER4 & 0xff,
+ (PP_VER3 >> 8) & 0xff, PP_VER3 & 0xff,
+ (PP_VER2 >> 8) & 0xff, PP_VER2 & 0xff,
+ (PP_VER1 >> 8) & 0xff, PP_VER1 & 0xff, '\0' };
+#endif
+
+ lcd_setfont(FONT_SYSFIXED);
+ lcd_clear_display();
+
+ lcd_puts(0, line++, "[Hardware info]");
+
+#ifdef IPOD_ARCH
+ lcd_putsf(0, line++, "HW rev: 0x%08lx", IPOD_HW_REVISION);
+#endif
+
+#ifdef IPOD_COLOR
+ extern int lcd_type; /* Defined in lcd-colornano.c */
+
+ lcd_putsf(0, line++, "LCD type: %d", lcd_type);
+#endif
+
+ lcd_putsf(0, line++, "PP version: %s", pp_version);
+
+ lcd_putsf(0, line++, "Est. clock (kHz): %d", perfcheck());
+
+ lcd_update();
+
+ /* wait for exit */
+ while (button_get_w_tmo(HZ/10) != (DEBUG_CANCEL|BUTTON_REL));
+
+ lcd_setfont(FONT_UI);
+ return false;
+}