Fix pending interrupt clear logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2646 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
366c4b78ea
commit
465f3284a9
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user