diff options
-rw-r--r-- | apps/debug_menu.c | 72 | ||||
-rw-r--r-- | firmware/system.c | 10 |
2 files changed, 59 insertions, 23 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 7b81869e69..fcd7e01181 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -691,24 +691,6 @@ bool dbg_ports(void) | |||
691 | 691 | ||
692 | switch(button) | 692 | switch(button) |
693 | { | 693 | { |
694 | case BUTTON_UP: | ||
695 | cpu_boost(true); | ||
696 | snprintf(buf, sizeof(buf), "freq: %ld, IDECONFIG1: %08lx, IDECONFIG2: %08lx", FREQ, IDECONFIG1, IDECONFIG2); | ||
697 | splash(HZ, false, buf); | ||
698 | break; | ||
699 | |||
700 | case BUTTON_DOWN: | ||
701 | cpu_boost(false); | ||
702 | snprintf(buf, sizeof(buf), "freq: %ld, IDECONFIG1: %08lx, IDECONFIG2: %08lx", FREQ, IDECONFIG1, IDECONFIG2); | ||
703 | splash(HZ, false, buf); | ||
704 | break; | ||
705 | |||
706 | case BUTTON_SELECT: | ||
707 | set_cpu_frequency(CPUFREQ_DEFAULT); | ||
708 | snprintf(buf, sizeof(buf), "freq: %ld, IDECONFIG1: %08lx, IDECONFIG2: %08lx", FREQ, IDECONFIG1, IDECONFIG2); | ||
709 | splash(HZ, false, buf); | ||
710 | break; | ||
711 | |||
712 | case SETTINGS_CANCEL: | 694 | case SETTINGS_CANCEL: |
713 | return false; | 695 | return false; |
714 | } | 696 | } |
@@ -811,6 +793,57 @@ bool dbg_ports(void) | |||
811 | } | 793 | } |
812 | #endif | 794 | #endif |
813 | 795 | ||
796 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | ||
797 | extern int boost_counter; | ||
798 | bool dbg_cpufreq(void) | ||
799 | { | ||
800 | char buf[128]; | ||
801 | int line; | ||
802 | int button; | ||
803 | |||
804 | #ifdef HAVE_LCD_BITMAP | ||
805 | lcd_setmargins(0, 0); | ||
806 | #endif | ||
807 | lcd_clear_display(); | ||
808 | lcd_setfont(FONT_SYSFIXED); | ||
809 | |||
810 | while(1) | ||
811 | { | ||
812 | line = 0; | ||
813 | |||
814 | snprintf(buf, sizeof(buf), "Frequency: %ld", FREQ); | ||
815 | lcd_puts(0, line++, buf); | ||
816 | |||
817 | snprintf(buf, sizeof(buf), "boost_counter: %d", boost_counter); | ||
818 | lcd_puts(0, line++, buf); | ||
819 | |||
820 | lcd_update(); | ||
821 | button = button_get_w_tmo(HZ/10); | ||
822 | |||
823 | switch(button) | ||
824 | { | ||
825 | case BUTTON_UP: | ||
826 | cpu_boost(true); | ||
827 | break; | ||
828 | |||
829 | case BUTTON_DOWN: | ||
830 | cpu_boost(false); | ||
831 | break; | ||
832 | |||
833 | case BUTTON_SELECT: | ||
834 | set_cpu_frequency(CPUFREQ_DEFAULT); | ||
835 | boost_counter = 0; | ||
836 | break; | ||
837 | |||
838 | case SETTINGS_CANCEL: | ||
839 | return false; | ||
840 | } | ||
841 | } | ||
842 | |||
843 | return false; | ||
844 | } | ||
845 | #endif | ||
846 | |||
814 | #ifdef HAVE_RTC | 847 | #ifdef HAVE_RTC |
815 | /* Read RTC RAM contents and display them */ | 848 | /* Read RTC RAM contents and display them */ |
816 | bool dbg_rtc(void) | 849 | bool dbg_rtc(void) |
@@ -1754,6 +1787,9 @@ bool debug_menu(void) | |||
1754 | #if CONFIG_CPU == SH7034 || CONFIG_CPU == MCF5249 | 1787 | #if CONFIG_CPU == SH7034 || CONFIG_CPU == MCF5249 |
1755 | { "View I/O ports", dbg_ports }, | 1788 | { "View I/O ports", dbg_ports }, |
1756 | #endif | 1789 | #endif |
1790 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | ||
1791 | { "CPU frequency", dbg_cpufreq }, | ||
1792 | #endif | ||
1757 | #if CONFIG_CPU == SH7034 | 1793 | #if CONFIG_CPU == SH7034 |
1758 | #ifdef HAVE_LCD_BITMAP | 1794 | #ifdef HAVE_LCD_BITMAP |
1759 | #ifdef HAVE_RTC | 1795 | #ifdef HAVE_RTC |
diff --git a/firmware/system.c b/firmware/system.c index 1cafc8f096..03414924ca 100644 --- a/firmware/system.c +++ b/firmware/system.c | |||
@@ -29,13 +29,13 @@ long cpu_frequency = CPU_FREQ; | |||
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 31 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
32 | int boost_counter = 0; | ||
32 | void cpu_boost(bool on_off) | 33 | void cpu_boost(bool on_off) |
33 | { | 34 | { |
34 | static int counter = 0; | ||
35 | if(on_off) | 35 | if(on_off) |
36 | { | 36 | { |
37 | /* Boost the frequency if not already boosted */ | 37 | /* Boost the frequency if not already boosted */ |
38 | if(counter++ == 0) | 38 | if(boost_counter++ == 0) |
39 | { | 39 | { |
40 | set_cpu_frequency(CPUFREQ_MAX); | 40 | set_cpu_frequency(CPUFREQ_MAX); |
41 | } | 41 | } |
@@ -43,14 +43,14 @@ void cpu_boost(bool on_off) | |||
43 | else | 43 | else |
44 | { | 44 | { |
45 | /* Lower the frequency if the counter reaches 0 */ | 45 | /* Lower the frequency if the counter reaches 0 */ |
46 | if(--counter == 0) | 46 | if(--boost_counter == 0) |
47 | { | 47 | { |
48 | set_cpu_frequency(CPUFREQ_NORMAL); | 48 | set_cpu_frequency(CPUFREQ_NORMAL); |
49 | } | 49 | } |
50 | 50 | ||
51 | /* Safety measure */ | 51 | /* Safety measure */ |
52 | if(counter < 0) | 52 | if(boost_counter < 0) |
53 | counter = 0; | 53 | boost_counter = 0; |
54 | } | 54 | } |
55 | } | 55 | } |
56 | #endif | 56 | #endif |