From 307cb049485cc20140b85aa78f8e2677e8df5851 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sun, 8 Jan 2012 22:29:25 +0000 Subject: AS3525v1/2: Enable nested handling of interrupts Mostly for the sake of reducing latency for audio servicing where other service routines can take a long time to complete, leading to occasional drops of a few samples, especially in recording, where they are fairly frequent. One mystery that remains is GPIOA IRQ being interrupted causes strange undefined instruction exceptions, most easily produced on my Fuze V2 with a scrollwheel. Making GPIOA the top ISR for now, thus not interruptible, cures it. SVC mode is used during the actual calls. Hopefully the SVC stack size is sufficient. Prologue and epilogue code only uses the IRQ stack and is large enough. Any routine code that should not be interrupted should disable IRQ itself from here on in. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31642 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/system-arm.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'firmware/target/arm/system-arm.h') diff --git a/firmware/target/arm/system-arm.h b/firmware/target/arm/system-arm.h index b3630a8473..ffce77a176 100644 --- a/firmware/target/arm/system-arm.h +++ b/firmware/target/arm/system-arm.h @@ -76,6 +76,9 @@ void __div0(void); #define ints_enabled_checkval(val) \ (((val) & IRQ_FIQ_STATUS) == 0) +/* We run in SYS mode */ +#define is_thread_context() \ + (get_processor_mode() == 0x1f) /* Core-level interrupt masking */ @@ -109,6 +112,13 @@ static inline bool interrupt_enabled(int status) return (cpsr & status) == 0; } +static inline unsigned long get_processor_mode(void) +{ + unsigned long cpsr; + asm ("mrs %0, cpsr" : "=r"(cpsr)); + return cpsr & 0x1f; +} + /* ARM_ARCH version section for architecture*/ #if ARM_ARCH >= 6 -- cgit v1.2.3