1
0
Fork 0
forked from len0rd/rockbox

Add option to run test_codec unboosted on players with boosting.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28637 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Giacomelli 2010-11-22 02:22:56 +00:00
parent 28ecf9b6d1
commit 7094181157

View file

@ -40,6 +40,16 @@
#define TESTCODEC_EXITBUTTON BUTTON_SELECT #define TESTCODEC_EXITBUTTON BUTTON_SELECT
#endif #endif
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
static unsigned int boost =1;
static const struct opt_items boost_settings[2] = {
{ "No", -1 },
{ "Yes", -1 },
};
#endif
/* Log functions copied from test_disk.c */ /* Log functions copied from test_disk.c */
static int line = 0; static int line = 0;
static int max_line = 0; static int max_line = 0;
@ -759,7 +769,14 @@ static enum plugin_status test_track(const char* filename)
/* show effective clockrate in MHz needed for realtime decoding */ /* show effective clockrate in MHz needed for realtime decoding */
if (speed > 0) if (speed > 0)
{ {
speed = CPUFREQ_MAX / speed; int freq = CPUFREQ_MAX;
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
if(!boost)
freq = CPUFREQ_NORMAL;
#endif
speed = freq / speed;
rb->snprintf(str,sizeof(str),"%d.%02dMHz needed for realtime", rb->snprintf(str,sizeof(str),"%d.%02dMHz needed for realtime",
(int)speed/100,(int)speed%100); (int)speed/100,(int)speed%100);
log_text(str,true); log_text(str,true);
@ -809,9 +826,6 @@ enum plugin_status plugin_start(const void* parameter)
audiobuf = SKIPBYTES(codec_mallocbuf, CODEC_SIZE); audiobuf = SKIPBYTES(codec_mallocbuf, CODEC_SIZE);
audiosize -= CODEC_SIZE; audiosize -= CODEC_SIZE;
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(true);
#endif
rb->lcd_clear_display(); rb->lcd_clear_display();
rb->lcd_update(); rb->lcd_update();
@ -819,6 +833,9 @@ enum plugin_status plugin_start(const void* parameter)
{ {
SPEED_TEST = 0, SPEED_TEST = 0,
SPEED_TEST_DIR, SPEED_TEST_DIR,
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
BOOST,
#endif
WRITE_WAV, WRITE_WAV,
SPEED_TEST_WITH_DSP, SPEED_TEST_WITH_DSP,
SPEED_TEST_DIR_WITH_DSP, SPEED_TEST_DIR_WITH_DSP,
@ -832,6 +849,9 @@ enum plugin_status plugin_start(const void* parameter)
menu, "test_codec", NULL, menu, "test_codec", NULL,
"Speed test", "Speed test",
"Speed test folder", "Speed test folder",
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
"Boosting",
#endif
"Write WAV", "Write WAV",
"Speed test with DSP", "Speed test with DSP",
"Speed test folder with DSP", "Speed test folder with DSP",
@ -841,17 +861,34 @@ enum plugin_status plugin_start(const void* parameter)
"Quit", "Quit",
); );
show_menu: show_menu:
rb->lcd_clear_display(); rb->lcd_clear_display();
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
menu:
result = rb->do_menu(&menu, &selection, NULL, false); result = rb->do_menu(&menu, &selection, NULL, false);
if (result == BOOST)
{
rb->set_option("Boosting", &boost, INT,
boost_settings, 2, NULL);
goto menu;
}
#endif
if (result == QUIT) if (result == QUIT)
{ {
res = PLUGIN_OK; res = PLUGIN_OK;
goto exit; goto exit;
} }
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
if(boost)
rb->cpu_boost(true);
#endif
scandir = 0; scandir = 0;
if ((checksum = (result == CHECKSUM || result == CHECKSUM_DIR))) if ((checksum = (result == CHECKSUM || result == CHECKSUM_DIR)))
@ -927,15 +964,17 @@ show_menu:
} }
while (rb->button_get(true) != TESTCODEC_EXITBUTTON); while (rb->button_get(true) != TESTCODEC_EXITBUTTON);
} }
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
if(boost)
rb->cpu_boost(false);
#endif
rb->button_clear_queue(); rb->button_clear_queue();
goto show_menu; goto show_menu;
exit: exit:
log_close(); log_close();
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(false);
#endif
return res; return res;
} }