1
0
Fork 0
forked from len0rd/rockbox

ARM/PP: more optimized set_irq_level()

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13291 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2007-04-30 08:16:25 +00:00
parent 1990349716
commit c7f84b6763

View file

@ -87,16 +87,22 @@ static inline uint32_t swap_odd_even32(uint32_t value)
return value; return value;
} }
#define HIGHEST_IRQ_LEVEL (1) #define HIGHEST_IRQ_LEVEL (0x80)
static inline int set_irq_level(int level) static inline int set_irq_level(int level)
{ {
unsigned long cpsr; unsigned long cpsr;
int oldlevel;
/* Read the old level and set the new one */ /* Read the old level and set the new one */
asm volatile ("mrs %0,cpsr" : "=r" (cpsr)); asm volatile (
asm volatile ("msr cpsr_c,%0" "mrs %1, cpsr \n"
: : "r" ((cpsr & ~0x80) | (level << 7))); "bic %0, %1, #0x80 \n"
return (cpsr >> 7) & 1; "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)) static inline void set_fiq_handler(void(*fiq_handler)(void))