summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2008-02-17 12:43:23 +0000
committerChristian Gmeiner <christian.gmeiner@gmail.com>2008-02-17 12:43:23 +0000
commit78fa347c6b2c6e0a7b0c577e98da61e270ef3589 (patch)
treeb4fd4c35b6fef744fcd8881db3803f42cc1700cc
parent8215b34fdb7228283a055b1e4f04eb15cdf89d58 (diff)
downloadrockbox-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
-rw-r--r--apps/debug_menu.c103
-rw-r--r--firmware/SOURCES14
-rw-r--r--firmware/target/arm/debug-pp.c113
-rw-r--r--firmware/target/arm/debug-target.h21
4 files changed, 149 insertions, 102 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 8304032599..1cedaf2b9b 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -92,7 +92,7 @@
92#include "pcf50605.h" 92#include "pcf50605.h"
93#endif 93#endif
94 94
95#if CONFIG_CPU == DM320 || CONFIG_CPU == S3C2440 || CONFIG_CPU == TCC7801 95#if CONFIG_CPU == DM320 || CONFIG_CPU == S3C2440 || CONFIG_CPU == TCC7801 || defined(CPU_PP)
96#include "debug-target.h" 96#include "debug-target.h"
97#endif 97#endif
98 98
@@ -438,41 +438,6 @@ static bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device,
438#endif /* (CONFIG_CPU == SH7034 || CPU_COLDFIRE) */ 438#endif /* (CONFIG_CPU == SH7034 || CPU_COLDFIRE) */
439 439
440#ifndef SIMULATOR 440#ifndef SIMULATOR
441#ifdef CPU_PP
442static int perfcheck(void)
443{
444 int result;
445
446 asm (
447 "mrs r2, CPSR \n"
448 "orr r0, r2, #0xc0 \n" /* disable IRQ and FIQ */
449 "msr CPSR_c, r0 \n"
450 "mov %[res], #0 \n"
451 "ldr r0, [%[timr]] \n"
452 "add r0, r0, %[tmo] \n"
453 "1: \n"
454 "add %[res], %[res], #1 \n"
455 "ldr r1, [%[timr]] \n"
456 "cmp r1, r0 \n"
457 "bmi 1b \n"
458 "msr CPSR_c, r2 \n" /* reset IRQ and FIQ state */
459 :
460 [res]"=&r"(result)
461 :
462 [timr]"r"(&USEC_TIMER),
463 [tmo]"r"(
464#if CONFIG_CPU == PP5002
465 16000
466#else /* PP5020/5022/5024 */
467 10226
468#endif
469 )
470 :
471 "r0", "r1", "r2"
472 );
473 return result;
474}
475#endif
476 441
477#ifdef HAVE_LCD_BITMAP 442#ifdef HAVE_LCD_BITMAP
478static bool dbg_hw_info(void) 443static bool dbg_hw_info(void)
@@ -597,72 +562,6 @@ static bool dbg_hw_info(void)
597 lcd_update(); 562 lcd_update();
598 563
599 while (!(action_userabort(TIMEOUT_BLOCK))); 564 while (!(action_userabort(TIMEOUT_BLOCK)));
600
601#elif defined(CPU_PP502x)
602 int line = 0;
603 char buf[32];
604 char pp_version[] = { (PP_VER2 >> 24) & 0xff, (PP_VER2 >> 16) & 0xff,
605 (PP_VER2 >> 8) & 0xff, (PP_VER2) & 0xff,
606 (PP_VER1 >> 24) & 0xff, (PP_VER1 >> 16) & 0xff,
607 (PP_VER1 >> 8) & 0xff, (PP_VER1) & 0xff, '\0' };
608
609 lcd_setmargins(0, 0);
610 lcd_setfont(FONT_SYSFIXED);
611 lcd_clear_display();
612
613 lcd_puts(0, line++, "[Hardware info]");
614
615#ifdef IPOD_ARCH
616 snprintf(buf, sizeof(buf), "HW rev: 0x%08lx", IPOD_HW_REVISION);
617 lcd_puts(0, line++, buf);
618#endif
619
620#ifdef IPOD_COLOR
621 extern int lcd_type; /* Defined in lcd-colornano.c */
622
623 snprintf(buf, sizeof(buf), "LCD type: %d", lcd_type);
624 lcd_puts(0, line++, buf);
625#endif
626
627 snprintf(buf, sizeof(buf), "PP version: %s", pp_version);
628 lcd_puts(0, line++, buf);
629
630 snprintf(buf, sizeof(buf), "Est. clock (kHz): %d", perfcheck());
631 lcd_puts(0, line++, buf);
632
633 lcd_update();
634
635 while (!(action_userabort(TIMEOUT_BLOCK)));
636
637#elif CONFIG_CPU == PP5002
638 int line = 0;
639 char buf[32];
640 char pp_version[] = { (PP_VER4 >> 8) & 0xff, PP_VER4 & 0xff,
641 (PP_VER3 >> 8) & 0xff, PP_VER3 & 0xff,
642 (PP_VER2 >> 8) & 0xff, PP_VER2 & 0xff,
643 (PP_VER1 >> 8) & 0xff, PP_VER1 & 0xff, '\0' };
644
645
646 lcd_setmargins(0, 0);
647 lcd_setfont(FONT_SYSFIXED);
648 lcd_clear_display();
649
650 lcd_puts(0, line++, "[Hardware info]");
651
652#ifdef IPOD_ARCH
653 snprintf(buf, sizeof(buf), "HW rev: 0x%08lx", IPOD_HW_REVISION);
654 lcd_puts(0, line++, buf);
655#endif
656
657 snprintf(buf, sizeof(buf), "PP version: %s", pp_version);
658 lcd_puts(0, line++, buf);
659
660 snprintf(buf, sizeof(buf), "Est. clock (kHz): %d", perfcheck());
661 lcd_puts(0, line++, buf);
662
663 lcd_update();
664
665 while (!(action_userabort(TIMEOUT_BLOCK)));
666#else 565#else
667 /* Define this function in your target tree */ 566 /* Define this function in your target tree */
668 return __dbg_hw_info(); 567 return __dbg_hw_info();
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 266c3d1f3d..695a44761a 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -411,6 +411,7 @@ target/sh/archos/ondio/fmradio_i2c-ondio.c
411 411
412#ifdef SANSA_E200 412#ifdef SANSA_E200
413#ifndef SIMULATOR 413#ifndef SIMULATOR
414target/arm/debug-pp.c
414target/arm/lcd-as-memframe.S 415target/arm/lcd-as-memframe.S
415target/arm/sandisk/ata-c200_e200.c 416target/arm/sandisk/ata-c200_e200.c
416target/arm/sandisk/sansa-e200/lcd-e200.c 417target/arm/sandisk/sansa-e200/lcd-e200.c
@@ -429,6 +430,7 @@ target/arm/sandisk/audio-c200_e200.c
429 430
430#ifdef SANSA_C200 431#ifdef SANSA_C200
431#ifndef SIMULATOR 432#ifndef SIMULATOR
433target/arm/debug-pp.c
432target/arm/sandisk/ata-c200_e200.c 434target/arm/sandisk/ata-c200_e200.c
433target/arm/sandisk/sansa-c200/lcd-c200.c 435target/arm/sandisk/sansa-c200/lcd-c200.c
434target/arm/sandisk/sansa-c200/lcd-as-c200.S 436target/arm/sandisk/sansa-c200/lcd-as-c200.S
@@ -548,6 +550,7 @@ target/coldfire/iriver/h100/usb-h100.c
548 550
549#ifdef IRIVER_H10 551#ifdef IRIVER_H10
550#ifndef SIMULATOR 552#ifndef SIMULATOR
553target/arm/debug-pp.c
551target/arm/ata-as-arm.S 554target/arm/ata-as-arm.S
552target/arm/ata-pp5020.c 555target/arm/ata-pp5020.c
553target/arm/wmcodec-pp.c 556target/arm/wmcodec-pp.c
@@ -566,6 +569,7 @@ target/arm/usb-fw-pp502x.c
566 569
567#ifdef IRIVER_H10_5GB 570#ifdef IRIVER_H10_5GB
568#ifndef SIMULATOR 571#ifndef SIMULATOR
572target/arm/debug-pp.c
569target/arm/ata-as-arm.S 573target/arm/ata-as-arm.S
570target/arm/ata-pp5020.c 574target/arm/ata-pp5020.c
571target/arm/wmcodec-pp.c 575target/arm/wmcodec-pp.c
@@ -665,6 +669,7 @@ target/arm/tms320dm320/dsp-dm320.c
665#ifdef MROBE_100 669#ifdef MROBE_100
666#ifndef SIMULATOR 670#ifndef SIMULATOR
667drivers/sw_i2c.c 671drivers/sw_i2c.c
672target/arm/debug-pp.c
668target/arm/ata-as-arm.S 673target/arm/ata-as-arm.S
669target/arm/ata-pp5020.c 674target/arm/ata-pp5020.c
670target/arm/wmcodec-pp.c 675target/arm/wmcodec-pp.c
@@ -681,6 +686,7 @@ target/arm/usb-fw-pp502x.c
681 686
682#ifdef ELIO_TPJ1022 687#ifdef ELIO_TPJ1022
683#ifndef SIMULATOR 688#ifndef SIMULATOR
689target/arm/debug-pp.c
684target/arm/ata-as-arm.S 690target/arm/ata-as-arm.S
685target/arm/ata-pp5020.c 691target/arm/ata-pp5020.c
686target/arm/wmcodec-pp.c 692target/arm/wmcodec-pp.c
@@ -698,6 +704,7 @@ target/arm/usb-fw-pp502x.c
698#ifdef IPOD_4G 704#ifdef IPOD_4G
699#ifndef SIMULATOR 705#ifndef SIMULATOR
700drivers/pcf50605.c 706drivers/pcf50605.c
707target/arm/debug-pp.c
701target/arm/wmcodec-pp.c 708target/arm/wmcodec-pp.c
702target/arm/i2s-pp.c 709target/arm/i2s-pp.c
703target/arm/ata-as-arm.S 710target/arm/ata-as-arm.S
@@ -716,6 +723,7 @@ target/arm/usb-fw-pp502x.c
716#ifdef IPOD_COLOR 723#ifdef IPOD_COLOR
717#ifndef SIMULATOR 724#ifndef SIMULATOR
718drivers/pcf50605.c 725drivers/pcf50605.c
726target/arm/debug-pp.c
719target/arm/ata-as-arm.S 727target/arm/ata-as-arm.S
720target/arm/ata-pp5020.c 728target/arm/ata-pp5020.c
721target/arm/wmcodec-pp.c 729target/arm/wmcodec-pp.c
@@ -733,6 +741,7 @@ target/arm/usb-fw-pp502x.c
733#ifdef IPOD_NANO 741#ifdef IPOD_NANO
734#ifndef SIMULATOR 742#ifndef SIMULATOR
735drivers/pcf50605.c 743drivers/pcf50605.c
744target/arm/debug-pp.c
736target/arm/ata-as-arm.S 745target/arm/ata-as-arm.S
737target/arm/ata-pp5020.c 746target/arm/ata-pp5020.c
738target/arm/wmcodec-pp.c 747target/arm/wmcodec-pp.c
@@ -750,6 +759,7 @@ target/arm/usb-fw-pp502x.c
750#ifdef IPOD_VIDEO 759#ifdef IPOD_VIDEO
751#ifndef SIMULATOR 760#ifndef SIMULATOR
752drivers/pcf50605.c 761drivers/pcf50605.c
762target/arm/debug-pp.c
753target/arm/ata-as-arm.S 763target/arm/ata-as-arm.S
754target/arm/ata-pp5020.c 764target/arm/ata-pp5020.c
755target/arm/wmcodec-pp.c 765target/arm/wmcodec-pp.c
@@ -768,6 +778,7 @@ target/arm/usb-fw-pp502x.c
768#ifdef IPOD_3G 778#ifdef IPOD_3G
769#ifndef SIMULATOR 779#ifndef SIMULATOR
770drivers/pcf50605.c 780drivers/pcf50605.c
781target/arm/debug-pp.c
771target/arm/ata-pp5002.c 782target/arm/ata-pp5002.c
772target/arm/wmcodec-pp.c 783target/arm/wmcodec-pp.c
773target/arm/i2s-pp.c 784target/arm/i2s-pp.c
@@ -784,6 +795,7 @@ target/arm/usb-fw-pp5002.c
784 795
785#ifdef IPOD_1G2G 796#ifdef IPOD_1G2G
786#ifndef SIMULATOR 797#ifndef SIMULATOR
798target/arm/debug-pp.c
787target/arm/ata-pp5002.c 799target/arm/ata-pp5002.c
788target/arm/wmcodec-pp.c 800target/arm/wmcodec-pp.c
789target/arm/i2s-pp.c 801target/arm/i2s-pp.c
@@ -801,6 +813,7 @@ target/arm/usb-fw-pp5002.c
801#ifdef IPOD_MINI 813#ifdef IPOD_MINI
802#ifndef SIMULATOR 814#ifndef SIMULATOR
803drivers/pcf50605.c 815drivers/pcf50605.c
816target/arm/debug-pp.c
804target/arm/ata-as-arm.S 817target/arm/ata-as-arm.S
805target/arm/ata-pp5020.c 818target/arm/ata-pp5020.c
806target/arm/wmcodec-pp.c 819target/arm/wmcodec-pp.c
@@ -819,6 +832,7 @@ target/arm/usb-fw-pp502x.c
819#ifdef IPOD_MINI2G 832#ifdef IPOD_MINI2G
820#ifndef SIMULATOR 833#ifndef SIMULATOR
821drivers/pcf50605.c 834drivers/pcf50605.c
835target/arm/debug-pp.c
822target/arm/ata-as-arm.S 836target/arm/ata-as-arm.S
823target/arm/ata-pp5020.c 837target/arm/ata-pp5020.c
824target/arm/wmcodec-pp.c 838target/arm/wmcodec-pp.c
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
30static 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
64bool __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
21bool __dbg_hw_info(void);