1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Christian Gmeiner 2008-02-17 12:43:23 +00:00
parent 8215b34fdb
commit 78fa347c6b
4 changed files with 149 additions and 102 deletions

View file

@ -92,7 +92,7 @@
#include "pcf50605.h"
#endif
#if CONFIG_CPU == DM320 || CONFIG_CPU == S3C2440 || CONFIG_CPU == TCC7801
#if CONFIG_CPU == DM320 || CONFIG_CPU == S3C2440 || CONFIG_CPU == TCC7801 || defined(CPU_PP)
#include "debug-target.h"
#endif
@ -438,41 +438,6 @@ static bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device,
#endif /* (CONFIG_CPU == SH7034 || CPU_COLDFIRE) */
#ifndef SIMULATOR
#ifdef CPU_PP
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;
}
#endif
#ifdef HAVE_LCD_BITMAP
static bool dbg_hw_info(void)
@ -596,72 +561,6 @@ static bool dbg_hw_info(void)
lcd_update();
while (!(action_userabort(TIMEOUT_BLOCK)));
#elif defined(CPU_PP502x)
int line = 0;
char buf[32];
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' };
lcd_setmargins(0, 0);
lcd_setfont(FONT_SYSFIXED);
lcd_clear_display();
lcd_puts(0, line++, "[Hardware info]");
#ifdef IPOD_ARCH
snprintf(buf, sizeof(buf), "HW rev: 0x%08lx", IPOD_HW_REVISION);
lcd_puts(0, line++, buf);
#endif
#ifdef IPOD_COLOR
extern int lcd_type; /* Defined in lcd-colornano.c */
snprintf(buf, sizeof(buf), "LCD type: %d", lcd_type);
lcd_puts(0, line++, buf);
#endif
snprintf(buf, sizeof(buf), "PP version: %s", pp_version);
lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "Est. clock (kHz): %d", perfcheck());
lcd_puts(0, line++, buf);
lcd_update();
while (!(action_userabort(TIMEOUT_BLOCK)));
#elif CONFIG_CPU == PP5002
int line = 0;
char buf[32];
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' };
lcd_setmargins(0, 0);
lcd_setfont(FONT_SYSFIXED);
lcd_clear_display();
lcd_puts(0, line++, "[Hardware info]");
#ifdef IPOD_ARCH
snprintf(buf, sizeof(buf), "HW rev: 0x%08lx", IPOD_HW_REVISION);
lcd_puts(0, line++, buf);
#endif
snprintf(buf, sizeof(buf), "PP version: %s", pp_version);
lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "Est. clock (kHz): %d", perfcheck());
lcd_puts(0, line++, buf);
lcd_update();
while (!(action_userabort(TIMEOUT_BLOCK)));
#else
/* Define this function in your target tree */

View file

@ -411,6 +411,7 @@ target/sh/archos/ondio/fmradio_i2c-ondio.c
#ifdef SANSA_E200
#ifndef SIMULATOR
target/arm/debug-pp.c
target/arm/lcd-as-memframe.S
target/arm/sandisk/ata-c200_e200.c
target/arm/sandisk/sansa-e200/lcd-e200.c
@ -429,6 +430,7 @@ target/arm/sandisk/audio-c200_e200.c
#ifdef SANSA_C200
#ifndef SIMULATOR
target/arm/debug-pp.c
target/arm/sandisk/ata-c200_e200.c
target/arm/sandisk/sansa-c200/lcd-c200.c
target/arm/sandisk/sansa-c200/lcd-as-c200.S
@ -548,6 +550,7 @@ target/coldfire/iriver/h100/usb-h100.c
#ifdef IRIVER_H10
#ifndef SIMULATOR
target/arm/debug-pp.c
target/arm/ata-as-arm.S
target/arm/ata-pp5020.c
target/arm/wmcodec-pp.c
@ -566,6 +569,7 @@ target/arm/usb-fw-pp502x.c
#ifdef IRIVER_H10_5GB
#ifndef SIMULATOR
target/arm/debug-pp.c
target/arm/ata-as-arm.S
target/arm/ata-pp5020.c
target/arm/wmcodec-pp.c
@ -665,6 +669,7 @@ target/arm/tms320dm320/dsp-dm320.c
#ifdef MROBE_100
#ifndef SIMULATOR
drivers/sw_i2c.c
target/arm/debug-pp.c
target/arm/ata-as-arm.S
target/arm/ata-pp5020.c
target/arm/wmcodec-pp.c
@ -681,6 +686,7 @@ target/arm/usb-fw-pp502x.c
#ifdef ELIO_TPJ1022
#ifndef SIMULATOR
target/arm/debug-pp.c
target/arm/ata-as-arm.S
target/arm/ata-pp5020.c
target/arm/wmcodec-pp.c
@ -698,6 +704,7 @@ target/arm/usb-fw-pp502x.c
#ifdef IPOD_4G
#ifndef SIMULATOR
drivers/pcf50605.c
target/arm/debug-pp.c
target/arm/wmcodec-pp.c
target/arm/i2s-pp.c
target/arm/ata-as-arm.S
@ -716,6 +723,7 @@ target/arm/usb-fw-pp502x.c
#ifdef IPOD_COLOR
#ifndef SIMULATOR
drivers/pcf50605.c
target/arm/debug-pp.c
target/arm/ata-as-arm.S
target/arm/ata-pp5020.c
target/arm/wmcodec-pp.c
@ -733,6 +741,7 @@ target/arm/usb-fw-pp502x.c
#ifdef IPOD_NANO
#ifndef SIMULATOR
drivers/pcf50605.c
target/arm/debug-pp.c
target/arm/ata-as-arm.S
target/arm/ata-pp5020.c
target/arm/wmcodec-pp.c
@ -750,6 +759,7 @@ target/arm/usb-fw-pp502x.c
#ifdef IPOD_VIDEO
#ifndef SIMULATOR
drivers/pcf50605.c
target/arm/debug-pp.c
target/arm/ata-as-arm.S
target/arm/ata-pp5020.c
target/arm/wmcodec-pp.c
@ -768,6 +778,7 @@ target/arm/usb-fw-pp502x.c
#ifdef IPOD_3G
#ifndef SIMULATOR
drivers/pcf50605.c
target/arm/debug-pp.c
target/arm/ata-pp5002.c
target/arm/wmcodec-pp.c
target/arm/i2s-pp.c
@ -784,6 +795,7 @@ target/arm/usb-fw-pp5002.c
#ifdef IPOD_1G2G
#ifndef SIMULATOR
target/arm/debug-pp.c
target/arm/ata-pp5002.c
target/arm/wmcodec-pp.c
target/arm/i2s-pp.c
@ -801,6 +813,7 @@ target/arm/usb-fw-pp5002.c
#ifdef IPOD_MINI
#ifndef SIMULATOR
drivers/pcf50605.c
target/arm/debug-pp.c
target/arm/ata-as-arm.S
target/arm/ata-pp5020.c
target/arm/wmcodec-pp.c
@ -819,6 +832,7 @@ target/arm/usb-fw-pp502x.c
#ifdef IPOD_MINI2G
#ifndef SIMULATOR
drivers/pcf50605.c
target/arm/debug-pp.c
target/arm/ata-as-arm.S
target/arm/ata-pp5020.c
target/arm/wmcodec-pp.c

View file

@ -0,0 +1,113 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id: debug-tcc780x.c 16316 2008-02-15 12:37:36Z christian $
*
* Copyright (C) 2002 Heikki Hannikainen
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* 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 "string.h"
#include <stdbool.h>
#include "button.h"
#include "lcd.h"
#include "sprintf.h"
#include "font.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_hw_info(void)
{
int line = 0;
char buf[32];
#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_setmargins(0, 0);
lcd_setfont(FONT_SYSFIXED);
lcd_clear_display();
lcd_puts(0, line++, "[Hardware info]");
#ifdef IPOD_ARCH
snprintf(buf, sizeof(buf), "HW rev: 0x%08lx", IPOD_HW_REVISION);
lcd_puts(0, line++, buf);
#endif
#ifdef IPOD_COLOR
extern int lcd_type; /* Defined in lcd-colornano.c */
snprintf(buf, sizeof(buf), "LCD type: %d", lcd_type);
lcd_puts(0, line++, buf);
#endif
snprintf(buf, sizeof(buf), "PP version: %s", pp_version);
lcd_puts(0, line++, buf);
snprintf(buf, sizeof(buf), "Est. clock (kHz): %d", perfcheck());
lcd_puts(0, line++, buf);
lcd_update();
while (1) {
if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) {
return false;
}
}
}

View file

@ -0,0 +1,21 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id: debug-tcc780x.c 16316 2008-02-15 12:37:36Z christian $
*
* Copyright (C) 2002 Heikki Hannikainen
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#define DEBUG_CANCEL BUTTON_POWER
bool __dbg_hw_info(void);