summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-04-30 08:16:25 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-04-30 08:16:25 +0000
commitc7f84b67634330763d3d531f4433581ac29c987e (patch)
treea746e2e15ac17cead5b7151fd84ed261b89de7a9 /firmware
parent199034971678407a2005eaf909f788f1b9a37587 (diff)
downloadrockbox-c7f84b67634330763d3d531f4433581ac29c987e.tar.gz
rockbox-c7f84b67634330763d3d531f4433581ac29c987e.zip
ARM/PP: more optimized set_irq_level()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13291 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/system-arm.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/firmware/target/arm/system-arm.h b/firmware/target/arm/system-arm.h
index 7126350a64..5cacc4cf62 100644
--- a/firmware/target/arm/system-arm.h
+++ b/firmware/target/arm/system-arm.h
@@ -87,16 +87,22 @@ static inline uint32_t swap_odd_even32(uint32_t value)
return value;
}
-#define HIGHEST_IRQ_LEVEL (1)
+#define HIGHEST_IRQ_LEVEL (0x80)
static inline int set_irq_level(int level)
{
unsigned long cpsr;
+ int oldlevel;
/* Read the old level and set the new one */
- asm volatile ("mrs %0,cpsr" : "=r" (cpsr));
- asm volatile ("msr cpsr_c,%0"
- : : "r" ((cpsr & ~0x80) | (level << 7)));
- return (cpsr >> 7) & 1;
+ asm volatile (
+ "mrs %1, cpsr \n"
+ "bic %0, %1, #0x80 \n"
+ "and %2, %2, #0x80 \n"
+ "orr %0, %0, %2 \n"
+ "msr cpsr_c, %0 \n"
+ : "=&r"(cpsr), "=&r"(oldlevel), "+&r"(level)
+ );
+ return oldlevel;
}
static inline void set_fiq_handler(void(*fiq_handler)(void))