diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c index 91b83b5343..c35ca93a3c 100644 --- a/apps/plugins/test_codec.c +++ b/apps/plugins/test_codec.c @@ -40,6 +40,16 @@ #define TESTCODEC_EXITBUTTON BUTTON_SELECT #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 */ static int 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 */ 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", (int)speed/100,(int)speed%100); log_text(str,true); @@ -809,9 +826,6 @@ enum plugin_status plugin_start(const void* parameter) audiobuf = SKIPBYTES(codec_mallocbuf, CODEC_SIZE); audiosize -= CODEC_SIZE; -#ifdef HAVE_ADJUSTABLE_CPU_FREQ - rb->cpu_boost(true); -#endif rb->lcd_clear_display(); rb->lcd_update(); @@ -819,6 +833,9 @@ enum plugin_status plugin_start(const void* parameter) { SPEED_TEST = 0, SPEED_TEST_DIR, +#ifdef HAVE_ADJUSTABLE_CPU_FREQ + BOOST, +#endif WRITE_WAV, SPEED_TEST_WITH_DSP, SPEED_TEST_DIR_WITH_DSP, @@ -832,6 +849,9 @@ enum plugin_status plugin_start(const void* parameter) menu, "test_codec", NULL, "Speed test", "Speed test folder", +#ifdef HAVE_ADJUSTABLE_CPU_FREQ + "Boosting", +#endif "Write WAV", "Speed test with DSP", "Speed test folder with DSP", @@ -840,18 +860,35 @@ enum plugin_status plugin_start(const void* parameter) "Checksum folder", "Quit", ); + show_menu: rb->lcd_clear_display(); +#ifdef HAVE_ADJUSTABLE_CPU_FREQ +menu: 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) { res = PLUGIN_OK; goto exit; } +#ifdef HAVE_ADJUSTABLE_CPU_FREQ + if(boost) + rb->cpu_boost(true); +#endif + scandir = 0; if ((checksum = (result == CHECKSUM || result == CHECKSUM_DIR))) @@ -927,15 +964,17 @@ show_menu: } while (rb->button_get(true) != TESTCODEC_EXITBUTTON); } + + #ifdef HAVE_ADJUSTABLE_CPU_FREQ + if(boost) + rb->cpu_boost(false); + #endif + rb->button_clear_queue(); goto show_menu; exit: log_close(); -#ifdef HAVE_ADJUSTABLE_CPU_FREQ - rb->cpu_boost(false); -#endif - return res; }