diff options
Diffstat (limited to 'firmware/system.c')
-rw-r--r-- | firmware/system.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/firmware/system.c b/firmware/system.c index 37631b8735..537e901b05 100644 --- a/firmware/system.c +++ b/firmware/system.c | |||
@@ -35,13 +35,6 @@ long cpu_frequency SHAREDBSS_ATTR = CPU_FREQ; | |||
35 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 35 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
36 | static int boost_counter SHAREDBSS_ATTR = 0; | 36 | static int boost_counter SHAREDBSS_ATTR = 0; |
37 | static bool cpu_idle SHAREDBSS_ATTR = false; | 37 | static bool cpu_idle SHAREDBSS_ATTR = false; |
38 | #if NUM_CORES > 1 | ||
39 | static struct corelock boostctrl_cl SHAREDBSS_ATTR; | ||
40 | void cpu_boost_init(void) | ||
41 | { | ||
42 | corelock_init(&boostctrl_cl); | ||
43 | } | ||
44 | #endif | ||
45 | 38 | ||
46 | int get_cpu_boost_counter(void) | 39 | int get_cpu_boost_counter(void) |
47 | { | 40 | { |
@@ -60,7 +53,7 @@ int cpu_boost_log_getcount(void) | |||
60 | char * cpu_boost_log_getlog_first(void) | 53 | char * cpu_boost_log_getlog_first(void) |
61 | { | 54 | { |
62 | char *first; | 55 | char *first; |
63 | corelock_lock(&boostctrl_cl); | 56 | cpu_boost_lock(); |
64 | 57 | ||
65 | first = NULL; | 58 | first = NULL; |
66 | 59 | ||
@@ -70,7 +63,7 @@ char * cpu_boost_log_getlog_first(void) | |||
70 | first = cpu_boost_calls[cpu_boost_first]; | 63 | first = cpu_boost_calls[cpu_boost_first]; |
71 | } | 64 | } |
72 | 65 | ||
73 | corelock_unlock(&boostctrl_cl); | 66 | cpu_boost_unlock(); |
74 | return first; | 67 | return first; |
75 | } | 68 | } |
76 | 69 | ||
@@ -79,7 +72,7 @@ char * cpu_boost_log_getlog_next(void) | |||
79 | int message; | 72 | int message; |
80 | char *next; | 73 | char *next; |
81 | 74 | ||
82 | corelock_lock(&boostctrl_cl); | 75 | cpu_boost_lock(); |
83 | 76 | ||
84 | message = (cpu_boost_track_message+cpu_boost_first)%MAX_BOOST_LOG; | 77 | message = (cpu_boost_track_message+cpu_boost_first)%MAX_BOOST_LOG; |
85 | next = NULL; | 78 | next = NULL; |
@@ -90,13 +83,14 @@ char * cpu_boost_log_getlog_next(void) | |||
90 | next = cpu_boost_calls[message]; | 83 | next = cpu_boost_calls[message]; |
91 | } | 84 | } |
92 | 85 | ||
93 | corelock_unlock(&boostctrl_cl); | 86 | cpu_boost_unlock(); |
94 | return next; | 87 | return next; |
95 | } | 88 | } |
96 | 89 | ||
97 | void cpu_boost_(bool on_off, char* location, int line) | 90 | void cpu_boost_(bool on_off, char* location, int line) |
98 | { | 91 | { |
99 | corelock_lock(&boostctrl_cl); | 92 | if (!cpu_boost_lock()) |
93 | return; | ||
100 | 94 | ||
101 | if (cpu_boost_calls_count == MAX_BOOST_LOG) | 95 | if (cpu_boost_calls_count == MAX_BOOST_LOG) |
102 | { | 96 | { |
@@ -115,7 +109,9 @@ void cpu_boost_(bool on_off, char* location, int line) | |||
115 | #else | 109 | #else |
116 | void cpu_boost(bool on_off) | 110 | void cpu_boost(bool on_off) |
117 | { | 111 | { |
118 | corelock_lock(&boostctrl_cl); | 112 | if (!cpu_boost_lock()) |
113 | return; | ||
114 | |||
119 | #endif /* CPU_BOOST_LOGGING */ | 115 | #endif /* CPU_BOOST_LOGGING */ |
120 | if(on_off) | 116 | if(on_off) |
121 | { | 117 | { |
@@ -141,12 +137,13 @@ void cpu_boost(bool on_off) | |||
141 | } | 137 | } |
142 | } | 138 | } |
143 | 139 | ||
144 | corelock_unlock(&boostctrl_cl); | 140 | cpu_boost_unlock(); |
145 | } | 141 | } |
146 | 142 | ||
147 | void cpu_idle_mode(bool on_off) | 143 | void cpu_idle_mode(bool on_off) |
148 | { | 144 | { |
149 | corelock_lock(&boostctrl_cl); | 145 | if (!cpu_boost_lock()) |
146 | return; | ||
150 | 147 | ||
151 | cpu_idle = on_off; | 148 | cpu_idle = on_off; |
152 | 149 | ||
@@ -160,7 +157,7 @@ void cpu_idle_mode(bool on_off) | |||
160 | set_cpu_frequency(CPUFREQ_NORMAL); | 157 | set_cpu_frequency(CPUFREQ_NORMAL); |
161 | } | 158 | } |
162 | 159 | ||
163 | corelock_unlock(&boostctrl_cl); | 160 | cpu_boost_unlock(); |
164 | } | 161 | } |
165 | #endif /* HAVE_ADJUSTABLE_CPU_FREQ */ | 162 | #endif /* HAVE_ADJUSTABLE_CPU_FREQ */ |
166 | 163 | ||