Do core interrupt masking in a less general fashion and save some instructions to decrease size and speed things up a little bit. Small fix to a few places where interrupts would get enabled again where they shouldn't have been (context switching calls when disabled).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16811 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2008-03-26 01:50:41 +00:00
parent 74d678fdbc
commit af395f4db6
61 changed files with 381 additions and 278 deletions

View file

@ -52,11 +52,29 @@ static inline int set_irq_level(int level)
{
int i;
/* Read the old level and set the new one */
asm volatile ("stc sr, %0" : "=r" (i));
/* Not volatile - will be optimized away if the return value isn't used */
asm ("stc sr, %0" : "=r" (i));
asm volatile ("ldc %0, sr" : : "r" (level));
return i;
}
static inline void enable_irq(void)
{
int i;
asm volatile ("mov %1, %0 \n" /* Save a constant load from RAM */
"ldc %0, sr \n" : "=&r"(i) : "i"(0));
}
#define disable_irq() \
((void)set_irq_level(HIGHEST_IRQ_LEVEL))
#define disable_irq_save() \
set_irq_level(HIGHEST_IRQ_LEVEL)
#define restore_irq(i) \
((void)set_irq_level(i))
static inline uint16_t swap16(uint16_t value)
/*
result[15..8] = value[ 7..0];