This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Re: Spurious interrrupts on arm
Jani Monoses wrote:
> > Jani Monoses wrote:
> > > On Thu, 23 Oct 2003 12:13:33 +0200
> >
> > I just did not want to inline two different patches in my mail.
>
> You could have attached them as you did with the compressed forms :)
Here are the patches again, uncompressed this time.
tk
--------------------------------------------------
Thomas Koeller, Software Development
Basler Vision Technologies
An der Strusbek 60-62
22926 Ahrensburg
Germany
Tel +49 (4102) 463-162
Fax +49 (4102) 463-239
mailto:thomas.koeller@baslerweb.com
http://www.baslerweb.com
==============================
diff -ru packages-orig/hal/arm/arch/current/ChangeLog packages/hal/arm/arch/current/ChangeLog
--- packages-orig/hal/arm/arch/current/ChangeLog 2003-10-16 14:25:19.000000000 +0200
+++ packages/hal/arm/arch/current/ChangeLog 2003-10-23 11:49:28.000000000 +0200
@@ -1,3 +1,7 @@
+2003-10-23 Thomas Koeller <thomas.koeller@baslerweb.com>
+
+ * src/vectors.S: Acknowlege spurious interrupts.
+
2003-10-13 Thomas Koeller <thomas.koeller@baslerweb.com>
* src/vectors.S: Fixed broken thumb mode exception handling.
diff -ru packages-orig/hal/arm/arch/current/src/vectors.S packages/hal/arm/arch/current/src/vectors.S
--- packages-orig/hal/arm/arch/current/src/vectors.S 2003-10-16 14:25:19.000000000 +0200
+++ packages/hal/arm/arch/current/src/vectors.S 2003-10-22 11:01:26.000000000 +0200
@@ -80,6 +80,21 @@
.thumb_func ;\
_l_:
+// Call thumb function from ARM mode, return to ARM
+// mode afterwards
+#define THUMB_CALL(_r_, _l_, _f_) \
+ ldr _r_,=_f_+1 ;\
+ mov lr,pc ;\
+ bx _r_ ;\
+ .pool ;\
+ .code 16 ;\
+ .thumb_func ;\
+ ldr _r_,=_l_ ## f ;\
+ bx _r_ ;\
+ .pool ;\
+ .code 32 ;\
+ _l_:
+
// Switch to ARM mode
#define ARM_MODE(_r_, _l_) \
ldr _r_,=_l_ ## f ;\
@@ -104,6 +119,10 @@
// Switch to thumb mode
#define THUMB_MODE(_r_, _l_)
+// Call ARM function
+#define THUMB_CALL(_r_, _l_, _f_) \
+ bl _f_
+
// Switch to ARM mode
#define ARM_MODE(_r_, _l_)
@@ -872,15 +891,13 @@
cmp r0,#CYGNUM_HAL_INTERRUPT_NONE // spurious interrupt
bne 10f
-#ifndef CYGIMP_HAL_COMMON_INTERRUPTS_IGNORE_SPURIOUS
+
+#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_IGNORE_SPURIOUS
+ // Acknowledge the interrupt
+ THUMB_CALL(r1,12,hal_interrupt_acknowledge)
+#else
mov r0,v6 // register frame
-# ifdef __thumb__
- ldr r1,=hal_spurious_IRQ
- mov lr,pc
- bx r1
-# else
- bl hal_spurious_IRQ
-# endif
+ THUMB_CALL(r1,12,hal_spurious_IRQ)
#endif // CYGIMP_HAL_COMMON_INTERRUPTS_IGNORE_SPURIOUS
b spurious_IRQ
diff -ru packages-orig/hal/arm/at91/var/current/ChangeLog packages/hal/arm/at91/var/current/ChangeLog
--- packages-orig/hal/arm/at91/var/current/ChangeLog 2003-08-22 11:30:08.000000000 +0200
+++ packages/hal/arm/at91/var/current/ChangeLog 2003-10-23 11:42:31.000000000 +0200
@@ -1,3 +1,8 @@
+2003-10-23 Thomas Koeller <thomas.koeller@baslerweb.com>
+
+ * src/at91_misc.c: Fixed recognition of spurious
+ interrupts.
+
2003-08-21 Thomas Koeller <thomas.koeller@baslerweb.com>
* include/var_io.h:
diff -ru packages-orig/hal/arm/at91/var/current/src/at91_misc.c packages/hal/arm/at91/var/current/src/at91_misc.c
--- packages-orig/hal/arm/at91/var/current/src/at91_misc.c 2003-08-11 13:46:29.000000000 +0200
+++ packages/hal/arm/at91/var/current/src/at91_misc.c 2003-10-21 19:51:36.000000000 +0200
@@ -184,6 +184,10 @@
HAL_READ_UINT32(AT91_AIC+AT91_AIC_IVR, ivr);
HAL_READ_UINT32(AT91_AIC+AT91_AIC_ISR, irq_num);
+
+ // No valid interrrupt source, treat as spurious interrupt
+ if (irq_num < CYGNUM_HAL_ISR_MIN || irq_num > CYGNUM_HAL_ISR_MAX)
+ irq_num = CYGNUM_HAL_INTERRUPT_NONE;
return irq_num;
}
@@ -210,9 +214,8 @@
void hal_interrupt_acknowledge(int vector)
{
- CYG_ASSERT(vector <= CYGNUM_HAL_ISR_MAX &&
- vector >= CYGNUM_HAL_ISR_MIN , "Invalid vector");
-
+ // No check for valid vector here! Spurious interrupts
+ // must be acknowledged, too.
HAL_WRITE_UINT32(AT91_AIC+AT91_AIC_EOI, 0xFFFFFFFF);
}