diff options
author | Marcin Bukat <marcin.bukat@gmail.com> | 2011-06-05 10:26:06 +0000 |
---|---|---|
committer | Marcin Bukat <marcin.bukat@gmail.com> | 2011-06-05 10:26:06 +0000 |
commit | dceceef05264cdeff0e2c60b8cb00719d7d7baeb (patch) | |
tree | eb8573dbe429755165372a91a620435e8b14e4bd /firmware/target/arm/debug-pp.c | |
parent | dace72166e5250e2ea0a9beb6451f5e4da9e50e2 (diff) | |
download | rockbox-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.c | 78 |
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 @@ | |||
28 | #include "powermgmt.h" | 28 | #include "powermgmt.h" |
29 | #include "adc.h" | 29 | #include "adc.h" |
30 | #include "iap.h" | 30 | #include "iap.h" |
31 | #include "hwcompat.h" | ||
31 | #include "debug-target.h" | 32 | #include "debug-target.h" |
32 | 33 | ||
34 | static int perfcheck(void) | ||
35 | { | ||
36 | int result; | ||
37 | |||
38 | asm ( | ||
39 | "mrs r2, CPSR \n" | ||
40 | "orr r0, r2, #0xc0 \n" /* disable IRQ and FIQ */ | ||
41 | "msr CPSR_c, r0 \n" | ||
42 | "mov %[res], #0 \n" | ||
43 | "ldr r0, [%[timr]] \n" | ||
44 | "add r0, r0, %[tmo] \n" | ||
45 | "1: \n" | ||
46 | "add %[res], %[res], #1 \n" | ||
47 | "ldr r1, [%[timr]] \n" | ||
48 | "cmp r1, r0 \n" | ||
49 | "bmi 1b \n" | ||
50 | "msr CPSR_c, r2 \n" /* reset IRQ and FIQ state */ | ||
51 | : | ||
52 | [res]"=&r"(result) | ||
53 | : | ||
54 | [timr]"r"(&USEC_TIMER), | ||
55 | [tmo]"r"( | ||
56 | #if CONFIG_CPU == PP5002 | ||
57 | 16000 | ||
58 | #else /* PP5020/5022/5024 */ | ||
59 | 10226 | ||
60 | #endif | ||
61 | ) | ||
62 | : | ||
63 | "r0", "r1", "r2" | ||
64 | ); | ||
65 | return result; | ||
66 | } | ||
67 | |||
33 | bool dbg_ports(void) | 68 | bool dbg_ports(void) |
34 | { | 69 | { |
35 | int line; | 70 | int line; |
@@ -152,3 +187,46 @@ bool dbg_ports(void) | |||
152 | } | 187 | } |
153 | return false; | 188 | return false; |
154 | } | 189 | } |
190 | |||
191 | bool dbg_hw_info(void) | ||
192 | { | ||
193 | int line = 0; | ||
194 | #if defined(CPU_PP502x) | ||
195 | char pp_version[] = { (PP_VER2 >> 24) & 0xff, (PP_VER2 >> 16) & 0xff, | ||
196 | (PP_VER2 >> 8) & 0xff, (PP_VER2) & 0xff, | ||
197 | (PP_VER1 >> 24) & 0xff, (PP_VER1 >> 16) & 0xff, | ||
198 | (PP_VER1 >> 8) & 0xff, (PP_VER1) & 0xff, '\0' }; | ||
199 | #elif CONFIG_CPU == PP5002 | ||
200 | char pp_version[] = { (PP_VER4 >> 8) & 0xff, PP_VER4 & 0xff, | ||
201 | (PP_VER3 >> 8) & 0xff, PP_VER3 & 0xff, | ||
202 | (PP_VER2 >> 8) & 0xff, PP_VER2 & 0xff, | ||
203 | (PP_VER1 >> 8) & 0xff, PP_VER1 & 0xff, '\0' }; | ||
204 | #endif | ||
205 | |||
206 | lcd_setfont(FONT_SYSFIXED); | ||
207 | lcd_clear_display(); | ||
208 | |||
209 | lcd_puts(0, line++, "[Hardware info]"); | ||
210 | |||
211 | #ifdef IPOD_ARCH | ||
212 | lcd_putsf(0, line++, "HW rev: 0x%08lx", IPOD_HW_REVISION); | ||
213 | #endif | ||
214 | |||
215 | #ifdef IPOD_COLOR | ||
216 | extern int lcd_type; /* Defined in lcd-colornano.c */ | ||
217 | |||
218 | lcd_putsf(0, line++, "LCD type: %d", lcd_type); | ||
219 | #endif | ||
220 | |||
221 | lcd_putsf(0, line++, "PP version: %s", pp_version); | ||
222 | |||
223 | lcd_putsf(0, line++, "Est. clock (kHz): %d", perfcheck()); | ||
224 | |||
225 | lcd_update(); | ||
226 | |||
227 | /* wait for exit */ | ||
228 | while (button_get_w_tmo(HZ/10) != (DEBUG_CANCEL|BUTTON_REL)); | ||
229 | |||
230 | lcd_setfont(FONT_UI); | ||
231 | return false; | ||
232 | } | ||