forked from len0rd/rockbox
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
This commit is contained in:
parent
5152eca7d4
commit
213d34ed1d
2 changed files with 59 additions and 23 deletions
|
@ -691,24 +691,6 @@ bool dbg_ports(void)
|
||||||
|
|
||||||
switch(button)
|
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:
|
case SETTINGS_CANCEL:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -811,6 +793,57 @@ bool dbg_ports(void)
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
#ifdef HAVE_RTC
|
||||||
/* Read RTC RAM contents and display them */
|
/* Read RTC RAM contents and display them */
|
||||||
bool dbg_rtc(void)
|
bool dbg_rtc(void)
|
||||||
|
@ -1754,6 +1787,9 @@ bool debug_menu(void)
|
||||||
#if CONFIG_CPU == SH7034 || CONFIG_CPU == MCF5249
|
#if CONFIG_CPU == SH7034 || CONFIG_CPU == MCF5249
|
||||||
{ "View I/O ports", dbg_ports },
|
{ "View I/O ports", dbg_ports },
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
||||||
|
{ "CPU frequency", dbg_cpufreq },
|
||||||
|
#endif
|
||||||
#if CONFIG_CPU == SH7034
|
#if CONFIG_CPU == SH7034
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
#ifdef HAVE_RTC
|
#ifdef HAVE_RTC
|
||||||
|
|
|
@ -29,13 +29,13 @@ long cpu_frequency = CPU_FREQ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
||||||
|
int boost_counter = 0;
|
||||||
void cpu_boost(bool on_off)
|
void cpu_boost(bool on_off)
|
||||||
{
|
{
|
||||||
static int counter = 0;
|
|
||||||
if(on_off)
|
if(on_off)
|
||||||
{
|
{
|
||||||
/* Boost the frequency if not already boosted */
|
/* Boost the frequency if not already boosted */
|
||||||
if(counter++ == 0)
|
if(boost_counter++ == 0)
|
||||||
{
|
{
|
||||||
set_cpu_frequency(CPUFREQ_MAX);
|
set_cpu_frequency(CPUFREQ_MAX);
|
||||||
}
|
}
|
||||||
|
@ -43,14 +43,14 @@ void cpu_boost(bool on_off)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Lower the frequency if the counter reaches 0 */
|
/* Lower the frequency if the counter reaches 0 */
|
||||||
if(--counter == 0)
|
if(--boost_counter == 0)
|
||||||
{
|
{
|
||||||
set_cpu_frequency(CPUFREQ_NORMAL);
|
set_cpu_frequency(CPUFREQ_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Safety measure */
|
/* Safety measure */
|
||||||
if(counter < 0)
|
if(boost_counter < 0)
|
||||||
counter = 0;
|
boost_counter = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue