summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bavin <pondlife@pondlife.me>2006-10-04 07:29:50 +0000
committerSteve Bavin <pondlife@pondlife.me>2006-10-04 07:29:50 +0000
commit2c2b50a458f3f8f48bcbe77a65b9c6073b5a6f3b (patch)
tree3f7c0427d70d081915432ae05117c36e509370c2
parent8428c14687153a10420e43664ed1638179d9b7bc (diff)
downloadrockbox-2c2b50a458f3f8f48bcbe77a65b9c6073b5a6f3b.tar.gz
rockbox-2c2b50a458f3f8f48bcbe77a65b9c6073b5a6f3b.zip
Add (some of the) debug menu to sims
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11120 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/debug_menu.c81
-rw-r--r--apps/debug_menu.h2
-rw-r--r--apps/main_menu.c3
3 files changed, 61 insertions, 25 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 2cae418528..c6e92960dd 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -18,7 +18,6 @@
18 ****************************************************************************/ 18 ****************************************************************************/
19 19
20#include "config.h" 20#include "config.h"
21#ifndef SIMULATOR
22#include <stdio.h> 21#include <stdio.h>
23#include <stdbool.h> 22#include <stdbool.h>
24#include <string.h> 23#include <string.h>
@@ -28,22 +27,14 @@
28#include "kernel.h" 27#include "kernel.h"
29#include "sprintf.h" 28#include "sprintf.h"
30#include "action.h" 29#include "action.h"
31#include "adc.h"
32#include "mas.h"
33#include "power.h"
34#include "usb.h"
35#include "rtc.h"
36#include "debug.h" 30#include "debug.h"
37#include "thread.h" 31#include "thread.h"
38#include "powermgmt.h" 32#include "powermgmt.h"
39#include "system.h" 33#include "system.h"
40#include "font.h" 34#include "font.h"
41#include "disk.h"
42#include "audio.h" 35#include "audio.h"
43#include "mp3_playback.h" 36#include "mp3_playback.h"
44#include "settings.h" 37#include "settings.h"
45#include "ata.h"
46#include "fat.h"
47#include "dir.h" 38#include "dir.h"
48#include "panic.h" 39#include "panic.h"
49#include "screens.h" 40#include "screens.h"
@@ -53,19 +44,29 @@
53#include "tagcache.h" 44#include "tagcache.h"
54#include "lcd-remote.h" 45#include "lcd-remote.h"
55#include "crc32.h" 46#include "crc32.h"
56#include "eeprom_24cxx.h"
57#include "logf.h" 47#include "logf.h"
58 48#ifndef SIMULATOR
59#ifdef HAVE_LCD_BITMAP 49#include "disk.h"
60#include "widgets.h" 50#include "adc.h"
61#include "peakmeter.h" 51#include "power.h"
52#include "usb.h"
53#include "rtc.h"
54#include "ata.h"
55#include "fat.h"
56#include "mas.h"
57#include "eeprom_24cxx.h"
58#ifdef HAVE_MMC
59#include "ata_mmc.h"
62#endif 60#endif
63#ifdef CONFIG_TUNER 61#ifdef CONFIG_TUNER
64#include "tuner.h" 62#include "tuner.h"
65#include "radio.h" 63#include "radio.h"
66#endif 64#endif
67#ifdef HAVE_MMC 65#endif
68#include "ata_mmc.h" 66
67#ifdef HAVE_LCD_BITMAP
68#include "widgets.h"
69#include "peakmeter.h"
69#endif 70#endif
70#include "logfdisp.h" 71#include "logfdisp.h"
71#if CONFIG_CODEC == SWCODEC 72#if CONFIG_CODEC == SWCODEC
@@ -92,6 +93,7 @@ char thread_status_char(int status)
92 93
93 return '?'; 94 return '?';
94} 95}
96#ifndef SIMULATOR
95#ifdef HAVE_LCD_BITMAP 97#ifdef HAVE_LCD_BITMAP
96/* Test code!!! */ 98/* Test code!!! */
97bool dbg_os(void) 99bool dbg_os(void)
@@ -214,9 +216,10 @@ bool dbg_os(void)
214 return false; 216 return false;
215} 217}
216#endif /* !HAVE_LCD_BITMAP */ 218#endif /* !HAVE_LCD_BITMAP */
217 219#endif /* !SIMULATOR */
218#ifdef HAVE_LCD_BITMAP 220#ifdef HAVE_LCD_BITMAP
219#if CONFIG_CODEC != SWCODEC 221#if CONFIG_CODEC != SWCODEC
222#ifndef SIMULATOR
220bool dbg_audio_thread(void) 223bool dbg_audio_thread(void)
221{ 224{
222 char buf[32]; 225 char buf[32];
@@ -263,6 +266,7 @@ bool dbg_audio_thread(void)
263 } 266 }
264 return false; 267 return false;
265} 268}
269#endif /* !SIMULATOR */
266#else /* CONFIG_CODEC == SWCODEC */ 270#else /* CONFIG_CODEC == SWCODEC */
267extern size_t filebuflen; 271extern size_t filebuflen;
268/* This is a size_t, but call it a long so it puts a - when it's bad. */ 272/* 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;
272 276
273void dbg_audio_task(void) 277void dbg_audio_task(void)
274{ 278{
279#ifndef SIMULATOR
275 if(FREQ > CPUFREQ_NORMAL) 280 if(FREQ > CPUFREQ_NORMAL)
276 boost_ticks++; 281 boost_ticks++;
282#endif
277 283
278 ticks++; 284 ticks++;
279} 285}
@@ -316,14 +322,14 @@ bool dbg_audio_thread(void)
316 322
317 bufused = bufsize - pcmbuf_free(); 323 bufused = bufsize - pcmbuf_free();
318 324
319 snprintf(buf, sizeof(buf), "pcm: %7ld/%7ld", bufused, bufsize); 325 snprintf(buf, sizeof(buf), "pcm: %7ld/%7ld", (long) bufused, (long) bufsize);
320 lcd_puts(0, line++, buf); 326 lcd_puts(0, line++, buf);
321 327
322 /* Playable space left */ 328 /* Playable space left */
323 scrollbar(0, line*8, LCD_WIDTH, 6, bufsize, 0, bufused, HORIZONTAL); 329 scrollbar(0, line*8, LCD_WIDTH, 6, bufsize, 0, bufused, HORIZONTAL);
324 line++; 330 line++;
325 331
326 snprintf(buf, sizeof(buf), "codec: %8ld/%8ld", filebufused, filebuflen); 332 snprintf(buf, sizeof(buf), "codec: %8ld/%8ld", filebufused, (long) filebuflen);
327 lcd_puts(0, line++, buf); 333 lcd_puts(0, line++, buf);
328 334
329 /* Playable space left */ 335 /* Playable space left */
@@ -334,9 +340,11 @@ bool dbg_audio_thread(void)
334 snprintf(buf, sizeof(buf), "track count: %2d", audio_track_count()); 340 snprintf(buf, sizeof(buf), "track count: %2d", audio_track_count());
335 lcd_puts(0, line++, buf); 341 lcd_puts(0, line++, buf);
336 342
343#ifndef SIMULATOR
337 snprintf(buf, sizeof(buf), "cpu freq: %3dMHz", 344 snprintf(buf, sizeof(buf), "cpu freq: %3dMHz",
338 (int)((FREQ + 500000) / 1000000)); 345 (int)((FREQ + 500000) / 1000000));
339 lcd_puts(0, line++, buf); 346 lcd_puts(0, line++, buf);
347#endif
340 348
341 snprintf(buf, sizeof(buf), "boost ratio: %3d%%", 349 snprintf(buf, sizeof(buf), "boost ratio: %3d%%",
342 boost_ticks * 100 / ticks); 350 boost_ticks * 100 / ticks);
@@ -388,6 +396,7 @@ bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device,
388 unsigned addr1, unsigned addr2) 396 unsigned addr1, unsigned addr2)
389 397
390{ 398{
399#ifndef SIMULATOR
391#if (CONFIG_CPU == PP5002) || (CONFIG_CPU == PP5020) 400#if (CONFIG_CPU == PP5002) || (CONFIG_CPU == PP5020)
392 /* TODO: Implement for iPod */ 401 /* TODO: Implement for iPod */
393 (void)p_manufacturer; 402 (void)p_manufacturer;
@@ -455,6 +464,12 @@ bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device,
455 return true; /* success */ 464 return true; /* success */
456 } 465 }
457#endif 466#endif
467#else
468 (void) p_manufacturer;
469 (void) p_device;
470 (void) addr1;
471 (void) addr2;
472#endif
458 return false; /* fail */ 473 return false; /* fail */
459} 474}
460 475
@@ -717,6 +732,7 @@ bool dbg_hw_info(void)
717} 732}
718#endif /* !HAVE_LCD_BITMAP */ 733#endif /* !HAVE_LCD_BITMAP */
719 734
735#ifndef SIMULATOR
720bool dbg_partitions(void) 736bool dbg_partitions(void)
721{ 737{
722 int partition=0; 738 int partition=0;
@@ -768,6 +784,7 @@ bool dbg_partitions(void)
768 } 784 }
769 return false; 785 return false;
770} 786}
787#endif
771 788
772#if defined(CPU_COLDFIRE) && defined(HAVE_SPDIF_OUT) 789#if defined(CPU_COLDFIRE) && defined(HAVE_SPDIF_OUT)
773bool dbg_spdif(void) 790bool dbg_spdif(void)
@@ -920,9 +937,11 @@ bool dbg_spdif(void)
920 lcd_puts(0, line++, buf); 937 lcd_puts(0, line++, buf);
921 line++; 938 line++;
922 939
940#ifndef SIMULATOR
923 snprintf(buf, sizeof(buf), "Measured freq: %ldHz", 941 snprintf(buf, sizeof(buf), "Measured freq: %ldHz",
924 (long)((long long)FREQMEAS*CPU_FREQ/((1 << 15)*3*(1 << 13))/128)); 942 (long)((long long)FREQMEAS*CPU_FREQ/((1 << 15)*3*(1 << 13))/128));
925 lcd_puts(0, line++, buf); 943 lcd_puts(0, line++, buf);
944#endif
926 945
927 lcd_update(); 946 lcd_update();
928 947
@@ -1285,6 +1304,7 @@ bool dbg_cpufreq(void)
1285} 1304}
1286#endif /* HAVE_ADJUSTABLE_CPU_FREQ */ 1305#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
1287 1306
1307#ifndef SIMULATOR
1288#ifdef HAVE_LCD_BITMAP 1308#ifdef HAVE_LCD_BITMAP
1289/* 1309/*
1290 * view_battery() shows a automatically scaled graph of the battery voltage 1310 * view_battery() shows a automatically scaled graph of the battery voltage
@@ -1473,6 +1493,7 @@ bool view_battery(void)
1473} 1493}
1474 1494
1475#endif /* HAVE_LCD_BITMAP */ 1495#endif /* HAVE_LCD_BITMAP */
1496#endif
1476 1497
1477static bool view_runtime(void) 1498static bool view_runtime(void)
1478{ 1499{
@@ -1559,6 +1580,7 @@ static bool view_runtime(void)
1559 return false; 1580 return false;
1560} 1581}
1561 1582
1583#ifndef SIMULATOR
1562#ifdef HAVE_MMC 1584#ifdef HAVE_MMC
1563bool dbg_mmc_info(void) 1585bool dbg_mmc_info(void)
1564{ 1586{
@@ -1713,7 +1735,7 @@ static bool dbg_disk_info(void)
1713 1735
1714 case 2: 1736 case 2:
1715 snprintf(buf, sizeof buf, "%ld MB", 1737 snprintf(buf, sizeof buf, "%ld MB",
1716 ((unsigned long)identify_info[61] << 16 | 1738 ((mak)identify_info[61] << 16 |
1717 (unsigned long)identify_info[60]) / 2048 ); 1739 (unsigned long)identify_info[60]) / 2048 );
1718 lcd_puts(0, y++, "Size"); 1740 lcd_puts(0, y++, "Size");
1719 lcd_puts(0, y++, buf); 1741 lcd_puts(0, y++, buf);
@@ -1825,6 +1847,7 @@ static bool dbg_disk_info(void)
1825 return false; 1847 return false;
1826} 1848}
1827#endif /* !HAVE_MMC */ 1849#endif /* !HAVE_MMC */
1850#endif /* !SIMULATOR */
1828 1851
1829#ifdef HAVE_DIRCACHE 1852#ifdef HAVE_DIRCACHE
1830static bool dbg_dircache_info(void) 1853static bool dbg_dircache_info(void)
@@ -1995,6 +2018,7 @@ bool dbg_save_roms(void)
1995} 2018}
1996#endif /* CPU */ 2019#endif /* CPU */
1997 2020
2021#ifndef SIMULATOR
1998#ifdef CONFIG_TUNER 2022#ifdef CONFIG_TUNER
1999bool dbg_fm_radio(void) 2023bool dbg_fm_radio(void)
2000{ 2024{
@@ -2035,6 +2059,7 @@ bool dbg_fm_radio(void)
2035 return false; 2059 return false;
2036} 2060}
2037#endif /* CONFIG_TUNER */ 2061#endif /* CONFIG_TUNER */
2062#endif /* !SIMULATOR */
2038 2063
2039#ifdef HAVE_LCD_BITMAP 2064#ifdef HAVE_LCD_BITMAP
2040extern bool do_screendump_instead_of_usb; 2065extern bool do_screendump_instead_of_usb;
@@ -2128,32 +2153,46 @@ bool debug_menu(void)
2128#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) 2153#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
2129 { "Catch mem accesses", dbg_set_memory_guard }, 2154 { "Catch mem accesses", dbg_set_memory_guard },
2130#endif 2155#endif
2156#ifndef SIMULATOR
2131 { "View OS stacks", dbg_os }, 2157 { "View OS stacks", dbg_os },
2158#endif
2132#ifdef HAVE_LCD_BITMAP 2159#ifdef HAVE_LCD_BITMAP
2160#ifndef SIMULATOR
2133 { "View battery", view_battery }, 2161 { "View battery", view_battery },
2162#endif
2134 { "Screendump", dbg_screendump }, 2163 { "Screendump", dbg_screendump },
2135#endif 2164#endif
2165#ifndef SIMULATOR
2136 { "View HW info", dbg_hw_info }, 2166 { "View HW info", dbg_hw_info },
2167#endif
2168#ifndef SIMULATOR
2137 { "View partitions", dbg_partitions }, 2169 { "View partitions", dbg_partitions },
2170#endif
2171#ifndef SIMULATOR
2138#ifdef HAVE_MMC 2172#ifdef HAVE_MMC
2139 { "View MMC info", dbg_mmc_info }, 2173 { "View MMC info", dbg_mmc_info },
2140#else 2174#else
2141 { "View disk info", dbg_disk_info }, 2175 { "View disk info", dbg_disk_info },
2142#endif 2176#endif
2177#endif
2143#ifdef HAVE_DIRCACHE 2178#ifdef HAVE_DIRCACHE
2144 { "View dircache info", dbg_dircache_info }, 2179 { "View dircache info", dbg_dircache_info },
2145#endif 2180#endif
2146#ifdef HAVE_LCD_BITMAP 2181#ifdef HAVE_LCD_BITMAP
2147 { "View tagcache info", dbg_tagcache_info }, 2182 { "View tagcache info", dbg_tagcache_info },
2183#if CONFIG_CODEC == SWCODEC || !defined(SIMULATOR)
2148 { "View audio thread", dbg_audio_thread }, 2184 { "View audio thread", dbg_audio_thread },
2185#endif
2149#ifdef PM_DEBUG 2186#ifdef PM_DEBUG
2150 { "pm histogram", peak_meter_histogram}, 2187 { "pm histogram", peak_meter_histogram},
2151#endif /* PM_DEBUG */ 2188#endif /* PM_DEBUG */
2152#endif /* HAVE_LCD_BITMAP */ 2189#endif /* HAVE_LCD_BITMAP */
2153 { "View runtime", view_runtime }, 2190 { "View runtime", view_runtime },
2191#ifndef SIMULATOR
2154#ifdef CONFIG_TUNER 2192#ifdef CONFIG_TUNER
2155 { "FM Radio", dbg_fm_radio }, 2193 { "FM Radio", dbg_fm_radio },
2156#endif 2194#endif
2195#endif
2157#if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) 2196#if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
2158 { "Write back EEPROM", dbg_write_eeprom }, 2197 { "Write back EEPROM", dbg_write_eeprom },
2159#endif 2198#endif
@@ -2170,5 +2209,3 @@ bool debug_menu(void)
2170 2209
2171 return result; 2210 return result;
2172} 2211}
2173
2174#endif /* SIMULATOR */
diff --git a/apps/debug_menu.h b/apps/debug_menu.h
index e3f2eb4ebd..629d0712c6 100644
--- a/apps/debug_menu.h
+++ b/apps/debug_menu.h
@@ -23,10 +23,10 @@ bool debug_menu(void);
23 23
24#ifndef SIMULATOR 24#ifndef SIMULATOR
25extern bool dbg_ports(void); 25extern bool dbg_ports(void);
26extern bool dbg_partitions(void);
26#ifdef CONFIG_RTC 27#ifdef CONFIG_RTC
27extern bool dbg_rtc(void); 28extern bool dbg_rtc(void);
28#endif 29#endif
29#endif 30#endif
30extern bool dbg_partitions(void);
31 31
32#endif 32#endif
diff --git a/apps/main_menu.c b/apps/main_menu.c
index e800b13d5b..0ac4d94753 100644
--- a/apps/main_menu.c
+++ b/apps/main_menu.c
@@ -349,9 +349,8 @@ bool info_menu(void)
349 static const struct menu_item items[] = { 349 static const struct menu_item items[] = {
350 { ID2P(LANG_INFO_MENU), show_info }, 350 { ID2P(LANG_INFO_MENU), show_info },
351 { ID2P(LANG_VERSION), show_credits }, 351 { ID2P(LANG_VERSION), show_credits },
352#ifndef SIMULATOR
353 { ID2P(LANG_DEBUG), debug_menu }, 352 { ID2P(LANG_DEBUG), debug_menu },
354#else 353#ifdef SIMULATOR
355 { ID2P(LANG_USB), simulate_usb }, 354 { ID2P(LANG_USB), simulate_usb },
356#ifdef ROCKBOX_HAS_LOGF 355#ifdef ROCKBOX_HAS_LOGF
357 {"logf", logfdisplay }, 356 {"logf", logfdisplay },