diff options
author | Christian Gmeiner <christian.gmeiner@gmail.com> | 2008-02-17 12:43:23 +0000 |
---|---|---|
committer | Christian Gmeiner <christian.gmeiner@gmail.com> | 2008-02-17 12:43:23 +0000 |
commit | 78fa347c6b2c6e0a7b0c577e98da61e270ef3589 (patch) | |
tree | b4fd4c35b6fef744fcd8881db3803f42cc1700cc /firmware/target/arm | |
parent | 8215b34fdb7228283a055b1e4f04eb15cdf89d58 (diff) | |
download | rockbox-78fa347c6b2c6e0a7b0c577e98da61e270ef3589.tar.gz rockbox-78fa347c6b2c6e0a7b0c577e98da61e270ef3589.zip |
FS#8611: move hw_info for pp targets into target tree
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16324 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm')
-rw-r--r-- | firmware/target/arm/debug-pp.c | 113 | ||||
-rw-r--r-- | firmware/target/arm/debug-target.h | 21 |
2 files changed, 134 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..313e9713f8 --- /dev/null +++ b/firmware/target/arm/debug-pp.c | |||
@@ -0,0 +1,113 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: debug-tcc780x.c 16316 2008-02-15 12:37:36Z christian $ | ||
9 | * | ||
10 | * Copyright (C) 2002 Heikki Hannikainen | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "config.h" | ||
21 | #include "system.h" | ||
22 | #include "string.h" | ||
23 | #include <stdbool.h> | ||
24 | #include "button.h" | ||
25 | #include "lcd.h" | ||
26 | #include "sprintf.h" | ||
27 | #include "font.h" | ||
28 | #include "debug-target.h" | ||
29 | |||
30 | static int perfcheck(void) | ||
31 | { | ||
32 | int result; | ||
33 | |||
34 | asm ( | ||
35 | "mrs r2, CPSR \n" | ||
36 | "orr r0, r2, #0xc0 \n" /* disable IRQ and FIQ */ | ||
37 | "msr CPSR_c, r0 \n" | ||
38 | "mov %[res], #0 \n" | ||
39 | "ldr r0, [%[timr]] \n" | ||
40 | "add r0, r0, %[tmo] \n" | ||
41 | "1: \n" | ||
42 | "add %[res], %[res], #1 \n" | ||
43 | "ldr r1, [%[timr]] \n" | ||
44 | "cmp r1, r0 \n" | ||
45 | "bmi 1b \n" | ||
46 | "msr CPSR_c, r2 \n" /* reset IRQ and FIQ state */ | ||
47 | : | ||
48 | [res]"=&r"(result) | ||
49 | : | ||
50 | [timr]"r"(&USEC_TIMER), | ||
51 | [tmo]"r"( | ||
52 | #if CONFIG_CPU == PP5002 | ||
53 | 16000 | ||
54 | #else /* PP5020/5022/5024 */ | ||
55 | 10226 | ||
56 | #endif | ||
57 | ) | ||
58 | : | ||
59 | "r0", "r1", "r2" | ||
60 | ); | ||
61 | return result; | ||
62 | } | ||
63 | |||
64 | bool __dbg_hw_info(void) | ||
65 | { | ||
66 | int line = 0; | ||
67 | char buf[32]; | ||
68 | |||
69 | #if defined(CPU_PP502x) | ||
70 | char pp_version[] = { (PP_VER2 >> 24) & 0xff, (PP_VER2 >> 16) & 0xff, | ||
71 | (PP_VER2 >> 8) & 0xff, (PP_VER2) & 0xff, | ||
72 | (PP_VER1 >> 24) & 0xff, (PP_VER1 >> 16) & 0xff, | ||
73 | (PP_VER1 >> 8) & 0xff, (PP_VER1) & 0xff, '\0' }; | ||
74 | |||
75 | #elif CONFIG_CPU == PP5002 | ||
76 | char pp_version[] = { (PP_VER4 >> 8) & 0xff, PP_VER4 & 0xff, | ||
77 | (PP_VER3 >> 8) & 0xff, PP_VER3 & 0xff, | ||
78 | (PP_VER2 >> 8) & 0xff, PP_VER2 & 0xff, | ||
79 | (PP_VER1 >> 8) & 0xff, PP_VER1 & 0xff, '\0' }; | ||
80 | #endif | ||
81 | |||
82 | lcd_setmargins(0, 0); | ||
83 | lcd_setfont(FONT_SYSFIXED); | ||
84 | lcd_clear_display(); | ||
85 | |||
86 | lcd_puts(0, line++, "[Hardware info]"); | ||
87 | |||
88 | #ifdef IPOD_ARCH | ||
89 | snprintf(buf, sizeof(buf), "HW rev: 0x%08lx", IPOD_HW_REVISION); | ||
90 | lcd_puts(0, line++, buf); | ||
91 | #endif | ||
92 | |||
93 | #ifdef IPOD_COLOR | ||
94 | extern int lcd_type; /* Defined in lcd-colornano.c */ | ||
95 | |||
96 | snprintf(buf, sizeof(buf), "LCD type: %d", lcd_type); | ||
97 | lcd_puts(0, line++, buf); | ||
98 | #endif | ||
99 | |||
100 | snprintf(buf, sizeof(buf), "PP version: %s", pp_version); | ||
101 | lcd_puts(0, line++, buf); | ||
102 | |||
103 | snprintf(buf, sizeof(buf), "Est. clock (kHz): %d", perfcheck()); | ||
104 | lcd_puts(0, line++, buf); | ||
105 | |||
106 | lcd_update(); | ||
107 | |||
108 | while (1) { | ||
109 | if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) { | ||
110 | return false; | ||
111 | } | ||
112 | } | ||
113 | } | ||
diff --git a/firmware/target/arm/debug-target.h b/firmware/target/arm/debug-target.h new file mode 100644 index 0000000000..524d3b33fc --- /dev/null +++ b/firmware/target/arm/debug-target.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: debug-tcc780x.c 16316 2008-02-15 12:37:36Z christian $ | ||
9 | * | ||
10 | * Copyright (C) 2002 Heikki Hannikainen | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #define DEBUG_CANCEL BUTTON_POWER | ||
21 | bool __dbg_hw_info(void); | ||