summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2005-03-07 10:51:43 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2005-03-07 10:51:43 +0000
commit213d34ed1d23dbc69570863f1587b96bc346a9f1 (patch)
tree9c6a5c04947903c3b418105351fc5d2a206b5784
parent5152eca7d40a1dae57c51f4dfe635c683291ad34 (diff)
downloadrockbox-213d34ed1d23dbc69570863f1587b96bc346a9f1.zip
rockbox-213d34ed1d23dbc69570863f1587b96bc346a9f1.tar.gz
rockbox-213d34ed1d23dbc69570863f1587b96bc346a9f1.tar.bz2
rockbox-213d34ed1d23dbc69570863f1587b96bc346a9f1.tar.xz
Dedicated CPU frequency debug screen for CPU's with PLL
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6161 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/debug_menu.c72
-rw-r--r--firmware/system.c10
2 files changed, 59 insertions, 23 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 7b81869..fcd7e01 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -691,24 +691,6 @@ bool dbg_ports(void)
switch(button)
{
- case BUTTON_UP:
- cpu_boost(true);
- snprintf(buf, sizeof(buf), "freq: %ld, IDECONFIG1: %08lx, IDECONFIG2: %08lx", FREQ, IDECONFIG1, IDECONFIG2);
- splash(HZ, false, buf);
- break;
-
- case BUTTON_DOWN:
- cpu_boost(false);
- snprintf(buf, sizeof(buf), "freq: %ld, IDECONFIG1: %08lx, IDECONFIG2: %08lx", FREQ, IDECONFIG1, IDECONFIG2);
- splash(HZ, false, buf);
- break;
-
- case BUTTON_SELECT:
- set_cpu_frequency(CPUFREQ_DEFAULT);
- snprintf(buf, sizeof(buf), "freq: %ld, IDECONFIG1: %08lx, IDECONFIG2: %08lx", FREQ, IDECONFIG1, IDECONFIG2);
- splash(HZ, false, buf);
- break;
-
case SETTINGS_CANCEL:
return false;
}
@@ -811,6 +793,57 @@ bool dbg_ports(void)
}
#endif
+#ifdef HAVE_ADJUSTABLE_CPU_FREQ
+extern int boost_counter;
+bool dbg_cpufreq(void)
+{
+ char buf[128];
+ int line;
+ int button;
+
+#ifdef HAVE_LCD_BITMAP
+ lcd_setmargins(0, 0);
+#endif
+ lcd_clear_display();
+ lcd_setfont(FONT_SYSFIXED);
+
+ while(1)
+ {
+ line = 0;
+
+ snprintf(buf, sizeof(buf), "Frequency: %ld", FREQ);
+ lcd_puts(0, line++, buf);
+
+ snprintf(buf, sizeof(buf), "boost_counter: %d", boost_counter);
+ lcd_puts(0, line++, buf);
+
+ lcd_update();
+ button = button_get_w_tmo(HZ/10);
+
+ switch(button)
+ {
+ case BUTTON_UP:
+ cpu_boost(true);
+ break;
+
+ case BUTTON_DOWN:
+ cpu_boost(false);
+ break;
+
+ case BUTTON_SELECT:
+ set_cpu_frequency(CPUFREQ_DEFAULT);
+ boost_counter = 0;
+ break;
+
+ case SETTINGS_CANCEL:
+ return false;
+ }
+ }
+
+ return false;
+}
+#endif
+
#ifdef HAVE_RTC
/* Read RTC RAM contents and display them */
bool dbg_rtc(void)
@@ -1754,6 +1787,9 @@ bool debug_menu(void)
#if CONFIG_CPU == SH7034 || CONFIG_CPU == MCF5249
{ "View I/O ports", dbg_ports },
#endif
+#ifdef HAVE_ADJUSTABLE_CPU_FREQ
+ { "CPU frequency", dbg_cpufreq },
+#endif
#if CONFIG_CPU == SH7034
#ifdef HAVE_LCD_BITMAP
#ifdef HAVE_RTC
diff --git a/firmware/system.c b/firmware/system.c
index 1cafc8f..0341492 100644
--- a/firmware/system.c
+++ b/firmware/system.c
@@ -29,13 +29,13 @@ long cpu_frequency = CPU_FREQ;
#endif
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
+int boost_counter = 0;
void cpu_boost(bool on_off)
{
- static int counter = 0;
if(on_off)
{
/* Boost the frequency if not already boosted */
- if(counter++ == 0)
+ if(boost_counter++ == 0)
{
set_cpu_frequency(CPUFREQ_MAX);
}
@@ -43,14 +43,14 @@ void cpu_boost(bool on_off)
else
{
/* Lower the frequency if the counter reaches 0 */
- if(--counter == 0)
+ if(--boost_counter == 0)
{
set_cpu_frequency(CPUFREQ_NORMAL);
}
/* Safety measure */
- if(counter < 0)
- counter = 0;
+ if(boost_counter < 0)
+ boost_counter = 0;
}
}
#endif