diff options
| author | Michael Sevakis <jethead71@rockbox.org> | 2009-02-03 12:16:45 +0000 |
|---|---|---|
| committer | Michael Sevakis <jethead71@rockbox.org> | 2009-02-03 12:16:45 +0000 |
| commit | 3cf148945ed0b484b4610dbc2b4afaa34f2ce2cc (patch) | |
| tree | 9d25dc10a7ab2f2a2d5dc263136ac121b6efd624 /firmware/system.c | |
| parent | e2a169bce53aff3e5fc300c00d3828129298d469 (diff) | |
| download | rockbox-3cf148945ed0b484b4610dbc2b4afaa34f2ce2cc.zip rockbox-3cf148945ed0b484b4610dbc2b4afaa34f2ce2cc.tar.gz rockbox-3cf148945ed0b484b4610dbc2b4afaa34f2ce2cc.tar.bz2 rockbox-3cf148945ed0b484b4610dbc2b4afaa34f2ce2cc.tar.xz | |
Remove struct spinlock to cleanup some mess and simplify. It's only used in boosting for multiprocesors and a pure two-corelock heirarchy will do just fine.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19910 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/system.c')
| -rw-r--r-- | firmware/system.c | 43 |
1 files changed, 11 insertions, 32 deletions
diff --git a/firmware/system.c b/firmware/system.c index befc785..52be7a1 100644 --- a/firmware/system.c +++ b/firmware/system.c @@ -33,10 +33,10 @@ long cpu_frequency SHAREDBSS_ATTR = CPU_FREQ; static int boost_counter SHAREDBSS_ATTR = 0; static bool cpu_idle SHAREDBSS_ATTR = false; #if NUM_CORES > 1 -struct spinlock boostctrl_spin SHAREDBSS_ATTR; +static struct corelock boostctrl_cl SHAREDBSS_ATTR; void cpu_boost_init(void) { - spinlock_init(&boostctrl_spin); + corelock_init(&boostctrl_cl); } #endif @@ -57,9 +57,7 @@ int cpu_boost_log_getcount(void) char * cpu_boost_log_getlog_first(void) { char *first; -#if NUM_CORES > 1 - spinlock_lock(&boostctrl_spin); -#endif + corelock_lock(&boostctrl_cl); first = NULL; @@ -69,10 +67,7 @@ char * cpu_boost_log_getlog_first(void) first = cpu_boost_calls[cpu_boost_first]; } -#if NUM_CORES > 1 - spinlock_unlock(&boostctrl_spin); -#endif - + corelock_unlock(&boostctrl_cl); return first; } @@ -81,9 +76,7 @@ char * cpu_boost_log_getlog_next(void) int message; char *next; -#if NUM_CORES > 1 - spinlock_lock(&boostctrl_spin); -#endif + corelock_lock(&boostctrl_cl); message = (cpu_boost_track_message+cpu_boost_first)%MAX_BOOST_LOG; next = NULL; @@ -94,18 +87,13 @@ char * cpu_boost_log_getlog_next(void) next = cpu_boost_calls[message]; } -#if NUM_CORES > 1 - spinlock_unlock(&boostctrl_spin); -#endif - + corelock_unlock(&boostctrl_cl); return next; } void cpu_boost_(bool on_off, char* location, int line) { -#if NUM_CORES > 1 - spinlock_lock(&boostctrl_spin); -#endif + corelock_lock(&boostctrl_cl); if (cpu_boost_calls_count == MAX_BOOST_LOG) { @@ -124,10 +112,7 @@ void cpu_boost_(bool on_off, char* location, int line) #else void cpu_boost(bool on_off) { -#if NUM_CORES > 1 - spinlock_lock(&boostctrl_spin); -#endif - + corelock_lock(&boostctrl_cl); #endif /* CPU_BOOST_LOGGING */ if(on_off) { @@ -153,16 +138,12 @@ void cpu_boost(bool on_off) } } -#if NUM_CORES > 1 - spinlock_unlock(&boostctrl_spin); -#endif + corelock_unlock(&boostctrl_cl); } void cpu_idle_mode(bool on_off) { -#if NUM_CORES > 1 - spinlock_lock(&boostctrl_spin); -#endif + corelock_lock(&boostctrl_cl); cpu_idle = on_off; @@ -176,9 +157,7 @@ void cpu_idle_mode(bool on_off) set_cpu_frequency(CPUFREQ_NORMAL); } -#if NUM_CORES > 1 - spinlock_unlock(&boostctrl_spin); -#endif + corelock_unlock(&boostctrl_cl); } #endif /* HAVE_ADJUSTABLE_CPU_FREQ */ |