summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-05-02 22:15:32 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-05-02 22:15:32 +0000
commit3189113f3d66055d80d8b97f11ebe391ae53c1f6 (patch)
treed26577bd95bd65c4273cf000019942685c98444f /nuttx/arch/arm
parent56317916d45ed401e3e6f33caff39a7d72726407 (diff)
downloadpx4-nuttx-3189113f3d66055d80d8b97f11ebe391ae53c1f6.tar.gz
px4-nuttx-3189113f3d66055d80d8b97f11ebe391ae53c1f6.tar.bz2
px4-nuttx-3189113f3d66055d80d8b97f11ebe391ae53c1f6.zip
Fix pending interrupt clear logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2646 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm')
-rwxr-xr-xnuttx/arch/arm/src/str71x/str71x_xti.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/nuttx/arch/arm/src/str71x/str71x_xti.c b/nuttx/arch/arm/src/str71x/str71x_xti.c
index e95e4349b..63e084577 100755
--- a/nuttx/arch/arm/src/str71x/str71x_xti.c
+++ b/nuttx/arch/arm/src/str71x/str71x_xti.c
@@ -95,16 +95,12 @@ static int str7x_xtiinterrupt(int irq, FAR void *context)
(uint16_t)getreg8(STR71X_XTI_PRL);
uint16_t mask;
- /* Clear the interrupts now. This seems unsafe? Couldn't this cause lost
- * interupts?
+ /* Dispatch the interrupts, the actions performed by the interrupt
+ * handlers should clear the interrupt at the external source of the
+ * interrupt. We need to clear the interrupts at the source before
+ * clearing the pending interrupts (see below).
*/
- mask = ~pending;
- putreg8(mask >> 8, STR71X_XTI_PRH);
- putreg8(mask & 0xff, STR71X_XTI_PRH);
-
- /* Then dispatch the interrupts */
-
pending &= enabled;
for (irq = STR71X_IRQ_FIRSTXTI, mask = 0x0001;
@@ -121,6 +117,16 @@ static int str7x_xtiinterrupt(int irq, FAR void *context)
pending &= ~mask;
}
}
+
+ /* Clear the pending interrupts. This should be safe: "it is necessary to
+ * clear at least one pending bit: this operation allows a rising edge to be
+ * generated on the internal line (if there is at least one more pending bit
+ * set and not masked) and so to set the interrupt controller pending bit
+ * again.
+ */
+
+ putreg8(0, STR71X_XTI_PRH);
+ putreg8(0, STR71X_XTI_PRL);
return OK;
}