diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-12-04 21:06:52 +0000 |
---|---|---|
committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-12-04 21:06:52 +0000 |
commit | 203722136c5f50d7deab432739e991faa48e470f (patch) | |
tree | 5e4b9fa829859e53a05f051ebb1112d91da0538d /firmware | |
parent | 1ab08e6879b1fe50102fe68a1326db05891e6faa (diff) |
Implement in_interrupt_mode() properly
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19334 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/system-jz4740.c | 19 | ||||
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/system-target.h | 6 |
2 files changed, 9 insertions, 16 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/system-jz4740.c b/firmware/target/mips/ingenic_jz47xx/system-jz4740.c index f733582d70..bde8e1df6a 100644 --- a/firmware/target/mips/ingenic_jz47xx/system-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/system-jz4740.c @@ -27,6 +27,7 @@ #include "system-target.h" #include <string.h> #include "kernel.h" +#include "system.h" #define NUM_DMA 6 #define NUM_GPIO 128 @@ -322,26 +323,15 @@ static int get_irq_number(void) return irq; } -static bool intr_mode = false; - -bool in_interrupt_mode(void) -{ - return intr_mode; -} - void intr_handler(void) { - int irq = get_irq_number(); - if(irq < 0) + irq = get_irq_number(); /* irq is defined static at UIRQ() */ + if(UNLIKELY(irq < 0)) return; ack_irq(irq); - if(irq > 0) - { - intr_mode = true; + if(LIKELY(irq > 0)) irqvector[irq-1](); - intr_mode = false; - } } #define EXC(x,y) if(_cause == (x)) return (y); @@ -378,7 +368,6 @@ void exception_handler(void* stack_ptr, unsigned int cause, unsigned int epc) static const int FR2n[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32}; static unsigned int iclk; - static void detect_clock(void) { unsigned int cfcr, pllout; diff --git a/firmware/target/mips/ingenic_jz47xx/system-target.h b/firmware/target/mips/ingenic_jz47xx/system-target.h index a8133140fa..eab517fa5d 100644 --- a/firmware/target/mips/ingenic_jz47xx/system-target.h +++ b/firmware/target/mips/ingenic_jz47xx/system-target.h @@ -56,6 +56,11 @@ static inline void disable_interrupt(void) clear_c0_status(ST0_IE); } +static inline bool in_interrupt_mode(void) +{ + return (read_c0_status() & ST0_IE) ? true : false; +} + #define disable_irq() \ disable_interrupt() @@ -101,7 +106,6 @@ void udelay(unsigned int usec); void mdelay(unsigned int msec); void power_off(void); void system_reboot(void); -bool in_interrupt_mode(void); #define DMA_LCD_CHANNEL 0 #define DMA_NAND_CHANNEL 1 |