summaryrefslogtreecommitdiffstats
path: root/firmware/system.c
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2007-03-26 17:29:04 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2007-03-26 17:29:04 +0000
commitc28468552580bceef821c4a9c1a8c52bb7d04d69 (patch)
tree4651b8005cc7c8850121a697f1ff24c20888d65c /firmware/system.c
parent66258a30a407e7ea4600fc2242438ecbd084d5ea (diff)
downloadrockbox-c28468552580bceef821c4a9c1a8c52bb7d04d69.tar.gz
rockbox-c28468552580bceef821c4a9c1a8c52bb7d04d69.zip
Fixed compilation problems with boostctrl_mtx.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12927 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/system.c')
-rw-r--r--firmware/system.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/firmware/system.c b/firmware/system.c
index 1ea06f90d2..f8fd73d11d 100644
--- a/firmware/system.c
+++ b/firmware/system.c
@@ -36,7 +36,9 @@ long cpu_frequency NOCACHEBSS_ATTR = CPU_FREQ;
static int boost_counter NOCACHEBSS_ATTR = 0;
static bool cpu_idle NOCACHEBSS_ATTR = false;
+#if NUM_CORES > 1
struct mutex boostctrl_mtx NOCACHEBSS_ATTR;
+#endif
int get_cpu_boost_counter(void)
{
@@ -725,8 +727,10 @@ void set_cpu_frequency(long frequency)
{
unsigned long postmult;
+# if NUM_CORES > 1
/* Using mutex or spinlock isn't safe here. */
while (test_and_set(&boostctrl_mtx.locked, 1)) ;
+# endif
if (frequency == CPUFREQ_NORMAL)
postmult = CPUFREQ_NORMAL_MULT;
@@ -767,7 +771,9 @@ void set_cpu_frequency(long frequency)
COP_INT_EN |= TIMER1_MASK;
# endif
+# if NUM_CORES > 1
boostctrl_mtx.locked = 0;
+# endif
}
#elif !defined(BOOTLOADER)
void ipod_set_cpu_frequency(void)
@@ -810,7 +816,10 @@ void system_init(void)
outl(-1, 0x60001028);
outl(-1, 0x6000101c);
+# if NUM_CORES > 1 && defined(HAVE_ADJUSTABLE_CPU_FREQ)
spinlock_init(&boostctrl_mtx);
+# endif
+
#if (!defined HAVE_ADJUSTABLE_CPU_FREQ) && (NUM_CORES == 1)
ipod_set_cpu_frequency();
#endif