1
0
Fork 0
forked from len0rd/rockbox

Add (some of the) debug menu to sims

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11120 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Steve Bavin 2006-10-04 07:29:50 +00:00
parent 8428c14687
commit 2c2b50a458
3 changed files with 61 additions and 25 deletions

View file

@ -18,7 +18,6 @@
****************************************************************************/ ****************************************************************************/
#include "config.h" #include "config.h"
#ifndef SIMULATOR
#include <stdio.h> #include <stdio.h>
#include <stdbool.h> #include <stdbool.h>
#include <string.h> #include <string.h>
@ -28,22 +27,14 @@
#include "kernel.h" #include "kernel.h"
#include "sprintf.h" #include "sprintf.h"
#include "action.h" #include "action.h"
#include "adc.h"
#include "mas.h"
#include "power.h"
#include "usb.h"
#include "rtc.h"
#include "debug.h" #include "debug.h"
#include "thread.h" #include "thread.h"
#include "powermgmt.h" #include "powermgmt.h"
#include "system.h" #include "system.h"
#include "font.h" #include "font.h"
#include "disk.h"
#include "audio.h" #include "audio.h"
#include "mp3_playback.h" #include "mp3_playback.h"
#include "settings.h" #include "settings.h"
#include "ata.h"
#include "fat.h"
#include "dir.h" #include "dir.h"
#include "panic.h" #include "panic.h"
#include "screens.h" #include "screens.h"
@ -53,19 +44,29 @@
#include "tagcache.h" #include "tagcache.h"
#include "lcd-remote.h" #include "lcd-remote.h"
#include "crc32.h" #include "crc32.h"
#include "eeprom_24cxx.h"
#include "logf.h" #include "logf.h"
#ifndef SIMULATOR
#ifdef HAVE_LCD_BITMAP #include "disk.h"
#include "widgets.h" #include "adc.h"
#include "peakmeter.h" #include "power.h"
#include "usb.h"
#include "rtc.h"
#include "ata.h"
#include "fat.h"
#include "mas.h"
#include "eeprom_24cxx.h"
#ifdef HAVE_MMC
#include "ata_mmc.h"
#endif #endif
#ifdef CONFIG_TUNER #ifdef CONFIG_TUNER
#include "tuner.h" #include "tuner.h"
#include "radio.h" #include "radio.h"
#endif #endif
#ifdef HAVE_MMC #endif
#include "ata_mmc.h"
#ifdef HAVE_LCD_BITMAP
#include "widgets.h"
#include "peakmeter.h"
#endif #endif
#include "logfdisp.h" #include "logfdisp.h"
#if CONFIG_CODEC == SWCODEC #if CONFIG_CODEC == SWCODEC
@ -92,6 +93,7 @@ char thread_status_char(int status)
return '?'; return '?';
} }
#ifndef SIMULATOR
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
/* Test code!!! */ /* Test code!!! */
bool dbg_os(void) bool dbg_os(void)
@ -214,9 +216,10 @@ bool dbg_os(void)
return false; return false;
} }
#endif /* !HAVE_LCD_BITMAP */ #endif /* !HAVE_LCD_BITMAP */
#endif /* !SIMULATOR */
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
#if CONFIG_CODEC != SWCODEC #if CONFIG_CODEC != SWCODEC
#ifndef SIMULATOR
bool dbg_audio_thread(void) bool dbg_audio_thread(void)
{ {
char buf[32]; char buf[32];
@ -263,6 +266,7 @@ bool dbg_audio_thread(void)
} }
return false; return false;
} }
#endif /* !SIMULATOR */
#else /* CONFIG_CODEC == SWCODEC */ #else /* CONFIG_CODEC == SWCODEC */
extern size_t filebuflen; extern size_t filebuflen;
/* This is a size_t, but call it a long so it puts a - when it's bad. */ /* This is a size_t, but call it a long so it puts a - when it's bad. */
@ -272,8 +276,10 @@ static unsigned int ticks, boost_ticks;
void dbg_audio_task(void) void dbg_audio_task(void)
{ {
#ifndef SIMULATOR
if(FREQ > CPUFREQ_NORMAL) if(FREQ > CPUFREQ_NORMAL)
boost_ticks++; boost_ticks++;
#endif
ticks++; ticks++;
} }
@ -316,14 +322,14 @@ bool dbg_audio_thread(void)
bufused = bufsize - pcmbuf_free(); bufused = bufsize - pcmbuf_free();
snprintf(buf, sizeof(buf), "pcm: %7ld/%7ld", bufused, bufsize); snprintf(buf, sizeof(buf), "pcm: %7ld/%7ld", (long) bufused, (long) bufsize);
lcd_puts(0, line++, buf); lcd_puts(0, line++, buf);
/* Playable space left */ /* Playable space left */
scrollbar(0, line*8, LCD_WIDTH, 6, bufsize, 0, bufused, HORIZONTAL); scrollbar(0, line*8, LCD_WIDTH, 6, bufsize, 0, bufused, HORIZONTAL);
line++; line++;
snprintf(buf, sizeof(buf), "codec: %8ld/%8ld", filebufused, filebuflen); snprintf(buf, sizeof(buf), "codec: %8ld/%8ld", filebufused, (long) filebuflen);
lcd_puts(0, line++, buf); lcd_puts(0, line++, buf);
/* Playable space left */ /* Playable space left */
@ -334,9 +340,11 @@ bool dbg_audio_thread(void)
snprintf(buf, sizeof(buf), "track count: %2d", audio_track_count()); snprintf(buf, sizeof(buf), "track count: %2d", audio_track_count());
lcd_puts(0, line++, buf); lcd_puts(0, line++, buf);
#ifndef SIMULATOR
snprintf(buf, sizeof(buf), "cpu freq: %3dMHz", snprintf(buf, sizeof(buf), "cpu freq: %3dMHz",
(int)((FREQ + 500000) / 1000000)); (int)((FREQ + 500000) / 1000000));
lcd_puts(0, line++, buf); lcd_puts(0, line++, buf);
#endif
snprintf(buf, sizeof(buf), "boost ratio: %3d%%", snprintf(buf, sizeof(buf), "boost ratio: %3d%%",
boost_ticks * 100 / ticks); boost_ticks * 100 / ticks);
@ -388,6 +396,7 @@ bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device,
unsigned addr1, unsigned addr2) unsigned addr1, unsigned addr2)
{ {
#ifndef SIMULATOR
#if (CONFIG_CPU == PP5002) || (CONFIG_CPU == PP5020) #if (CONFIG_CPU == PP5002) || (CONFIG_CPU == PP5020)
/* TODO: Implement for iPod */ /* TODO: Implement for iPod */
(void)p_manufacturer; (void)p_manufacturer;
@ -454,6 +463,12 @@ bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device,
*p_device = id; *p_device = id;
return true; /* success */ return true; /* success */
} }
#endif
#else
(void) p_manufacturer;
(void) p_device;
(void) addr1;
(void) addr2;
#endif #endif
return false; /* fail */ return false; /* fail */
} }
@ -717,6 +732,7 @@ bool dbg_hw_info(void)
} }
#endif /* !HAVE_LCD_BITMAP */ #endif /* !HAVE_LCD_BITMAP */
#ifndef SIMULATOR
bool dbg_partitions(void) bool dbg_partitions(void)
{ {
int partition=0; int partition=0;
@ -768,6 +784,7 @@ bool dbg_partitions(void)
} }
return false; return false;
} }
#endif
#if defined(CPU_COLDFIRE) && defined(HAVE_SPDIF_OUT) #if defined(CPU_COLDFIRE) && defined(HAVE_SPDIF_OUT)
bool dbg_spdif(void) bool dbg_spdif(void)
@ -920,9 +937,11 @@ bool dbg_spdif(void)
lcd_puts(0, line++, buf); lcd_puts(0, line++, buf);
line++; line++;
#ifndef SIMULATOR
snprintf(buf, sizeof(buf), "Measured freq: %ldHz", snprintf(buf, sizeof(buf), "Measured freq: %ldHz",
(long)((long long)FREQMEAS*CPU_FREQ/((1 << 15)*3*(1 << 13))/128)); (long)((long long)FREQMEAS*CPU_FREQ/((1 << 15)*3*(1 << 13))/128));
lcd_puts(0, line++, buf); lcd_puts(0, line++, buf);
#endif
lcd_update(); lcd_update();
@ -1285,6 +1304,7 @@ bool dbg_cpufreq(void)
} }
#endif /* HAVE_ADJUSTABLE_CPU_FREQ */ #endif /* HAVE_ADJUSTABLE_CPU_FREQ */
#ifndef SIMULATOR
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
/* /*
* view_battery() shows a automatically scaled graph of the battery voltage * view_battery() shows a automatically scaled graph of the battery voltage
@ -1473,6 +1493,7 @@ bool view_battery(void)
} }
#endif /* HAVE_LCD_BITMAP */ #endif /* HAVE_LCD_BITMAP */
#endif
static bool view_runtime(void) static bool view_runtime(void)
{ {
@ -1559,6 +1580,7 @@ static bool view_runtime(void)
return false; return false;
} }
#ifndef SIMULATOR
#ifdef HAVE_MMC #ifdef HAVE_MMC
bool dbg_mmc_info(void) bool dbg_mmc_info(void)
{ {
@ -1713,7 +1735,7 @@ static bool dbg_disk_info(void)
case 2: case 2:
snprintf(buf, sizeof buf, "%ld MB", snprintf(buf, sizeof buf, "%ld MB",
((unsigned long)identify_info[61] << 16 | ((mak)identify_info[61] << 16 |
(unsigned long)identify_info[60]) / 2048 ); (unsigned long)identify_info[60]) / 2048 );
lcd_puts(0, y++, "Size"); lcd_puts(0, y++, "Size");
lcd_puts(0, y++, buf); lcd_puts(0, y++, buf);
@ -1825,6 +1847,7 @@ static bool dbg_disk_info(void)
return false; return false;
} }
#endif /* !HAVE_MMC */ #endif /* !HAVE_MMC */
#endif /* !SIMULATOR */
#ifdef HAVE_DIRCACHE #ifdef HAVE_DIRCACHE
static bool dbg_dircache_info(void) static bool dbg_dircache_info(void)
@ -1995,6 +2018,7 @@ bool dbg_save_roms(void)
} }
#endif /* CPU */ #endif /* CPU */
#ifndef SIMULATOR
#ifdef CONFIG_TUNER #ifdef CONFIG_TUNER
bool dbg_fm_radio(void) bool dbg_fm_radio(void)
{ {
@ -2035,6 +2059,7 @@ bool dbg_fm_radio(void)
return false; return false;
} }
#endif /* CONFIG_TUNER */ #endif /* CONFIG_TUNER */
#endif /* !SIMULATOR */
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
extern bool do_screendump_instead_of_usb; extern bool do_screendump_instead_of_usb;
@ -2128,32 +2153,46 @@ bool debug_menu(void)
#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
{ "Catch mem accesses", dbg_set_memory_guard }, { "Catch mem accesses", dbg_set_memory_guard },
#endif #endif
#ifndef SIMULATOR
{ "View OS stacks", dbg_os }, { "View OS stacks", dbg_os },
#endif
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
#ifndef SIMULATOR
{ "View battery", view_battery }, { "View battery", view_battery },
#endif
{ "Screendump", dbg_screendump }, { "Screendump", dbg_screendump },
#endif #endif
#ifndef SIMULATOR
{ "View HW info", dbg_hw_info }, { "View HW info", dbg_hw_info },
#endif
#ifndef SIMULATOR
{ "View partitions", dbg_partitions }, { "View partitions", dbg_partitions },
#endif
#ifndef SIMULATOR
#ifdef HAVE_MMC #ifdef HAVE_MMC
{ "View MMC info", dbg_mmc_info }, { "View MMC info", dbg_mmc_info },
#else #else
{ "View disk info", dbg_disk_info }, { "View disk info", dbg_disk_info },
#endif #endif
#endif
#ifdef HAVE_DIRCACHE #ifdef HAVE_DIRCACHE
{ "View dircache info", dbg_dircache_info }, { "View dircache info", dbg_dircache_info },
#endif #endif
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
{ "View tagcache info", dbg_tagcache_info }, { "View tagcache info", dbg_tagcache_info },
#if CONFIG_CODEC == SWCODEC || !defined(SIMULATOR)
{ "View audio thread", dbg_audio_thread }, { "View audio thread", dbg_audio_thread },
#endif
#ifdef PM_DEBUG #ifdef PM_DEBUG
{ "pm histogram", peak_meter_histogram}, { "pm histogram", peak_meter_histogram},
#endif /* PM_DEBUG */ #endif /* PM_DEBUG */
#endif /* HAVE_LCD_BITMAP */ #endif /* HAVE_LCD_BITMAP */
{ "View runtime", view_runtime }, { "View runtime", view_runtime },
#ifndef SIMULATOR
#ifdef CONFIG_TUNER #ifdef CONFIG_TUNER
{ "FM Radio", dbg_fm_radio }, { "FM Radio", dbg_fm_radio },
#endif #endif
#endif
#if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) #if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
{ "Write back EEPROM", dbg_write_eeprom }, { "Write back EEPROM", dbg_write_eeprom },
#endif #endif
@ -2170,5 +2209,3 @@ bool debug_menu(void)
return result; return result;
} }
#endif /* SIMULATOR */

View file

@ -23,10 +23,10 @@ bool debug_menu(void);
#ifndef SIMULATOR #ifndef SIMULATOR
extern bool dbg_ports(void); extern bool dbg_ports(void);
extern bool dbg_partitions(void);
#ifdef CONFIG_RTC #ifdef CONFIG_RTC
extern bool dbg_rtc(void); extern bool dbg_rtc(void);
#endif #endif
#endif #endif
extern bool dbg_partitions(void);
#endif #endif

View file

@ -349,9 +349,8 @@ bool info_menu(void)
static const struct menu_item items[] = { static const struct menu_item items[] = {
{ ID2P(LANG_INFO_MENU), show_info }, { ID2P(LANG_INFO_MENU), show_info },
{ ID2P(LANG_VERSION), show_credits }, { ID2P(LANG_VERSION), show_credits },
#ifndef SIMULATOR
{ ID2P(LANG_DEBUG), debug_menu }, { ID2P(LANG_DEBUG), debug_menu },
#else #ifdef SIMULATOR
{ ID2P(LANG_USB), simulate_usb }, { ID2P(LANG_USB), simulate_usb },
#ifdef ROCKBOX_HAS_LOGF #ifdef ROCKBOX_HAS_LOGF
{"logf", logfdisplay }, {"logf", logfdisplay },