diff options
Diffstat (limited to 'firmware/system.c')
-rw-r--r-- | firmware/system.c | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/firmware/system.c b/firmware/system.c index c9ce086f0a..49f01df0cd 100644 --- a/firmware/system.c +++ b/firmware/system.c | |||
@@ -39,9 +39,55 @@ int get_cpu_boost_counter(void) | |||
39 | { | 39 | { |
40 | return boost_counter; | 40 | return boost_counter; |
41 | } | 41 | } |
42 | 42 | #ifdef CPU_BOOST_LOGGING | |
43 | #define MAX_BOOST_LOG 64 | ||
44 | static char cpu_boost_calls[MAX_BOOST_LOG][MAX_PATH]; | ||
45 | static int cpu_boost_first = 0; | ||
46 | static int cpu_boost_calls_count = 0; | ||
47 | static int cpu_boost_track_message = 0; | ||
48 | int cpu_boost_log_getcount(void) | ||
49 | { | ||
50 | return cpu_boost_calls_count; | ||
51 | } | ||
52 | char * cpu_boost_log_getlog_first(void) | ||
53 | { | ||
54 | if (cpu_boost_calls_count) | ||
55 | { | ||
56 | cpu_boost_track_message = 1; | ||
57 | return cpu_boost_calls[cpu_boost_first]; | ||
58 | } | ||
59 | else return NULL; | ||
60 | } | ||
61 | char * cpu_boost_log_getlog_next(void) | ||
62 | { | ||
63 | int message = (cpu_boost_track_message+cpu_boost_first)%MAX_BOOST_LOG; | ||
64 | if (cpu_boost_track_message < cpu_boost_calls_count) | ||
65 | { | ||
66 | cpu_boost_track_message++; | ||
67 | return cpu_boost_calls[message]; | ||
68 | } | ||
69 | else return NULL; | ||
70 | } | ||
71 | void cpu_boost_(bool on_off, char* location, int line) | ||
72 | { | ||
73 | if (cpu_boost_calls_count == MAX_BOOST_LOG) | ||
74 | { | ||
75 | cpu_boost_first = (cpu_boost_first+1)%MAX_BOOST_LOG; | ||
76 | cpu_boost_calls_count--; | ||
77 | if (cpu_boost_calls_count < 0) | ||
78 | cpu_boost_calls_count = 0; | ||
79 | } | ||
80 | if (cpu_boost_calls_count < MAX_BOOST_LOG) | ||
81 | { | ||
82 | int message = (cpu_boost_first+cpu_boost_calls_count)%MAX_BOOST_LOG; | ||
83 | snprintf(cpu_boost_calls[message], MAX_PATH, | ||
84 | "%c %s:%d",on_off==true?'B':'U',location,line); | ||
85 | cpu_boost_calls_count++; | ||
86 | } | ||
87 | #else | ||
43 | void cpu_boost(bool on_off) | 88 | void cpu_boost(bool on_off) |
44 | { | 89 | { |
90 | #endif | ||
45 | if(on_off) | 91 | if(on_off) |
46 | { | 92 | { |
47 | /* Boost the frequency if not already boosted */ | 93 | /* Boost the frequency if not already boosted */ |