Spurious interrupts support
This commit is contained in:
parent
92e1e261e7
commit
0ef7b9e353
@ -2,6 +2,10 @@
|
|||||||
#include <interrupt.h>
|
#include <interrupt.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
extern "C" void spurious_irq_handler(const uint8_t cpuID, const uint16_t interruptID) {
|
||||||
|
printkl("Spurious interrupt caught");
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" uint32_t c_irq_handler(uint32_t iar) {
|
extern "C" uint32_t c_irq_handler(uint32_t iar) {
|
||||||
uint8_t cpuID = (iar >> 10) & 0x7;
|
uint8_t cpuID = (iar >> 10) & 0x7;
|
||||||
uint16_t interruptID = iar & 0x3ff;
|
uint16_t interruptID = iar & 0x3ff;
|
||||||
@ -19,6 +23,9 @@ extern "C" uint32_t c_irq_handler(uint32_t iar) {
|
|||||||
case 54: case 55: case 56: case 57: case 99: case 100:
|
case 54: case 55: case 56: case 57: case 99: case 100:
|
||||||
handler = interrupt::handler[interruptID];
|
handler = interrupt::handler[interruptID];
|
||||||
break;
|
break;
|
||||||
|
case 1023:
|
||||||
|
handler = spurious_irq_handler;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call interrupt handler */
|
/* Call interrupt handler */
|
||||||
@ -35,3 +42,4 @@ extern "C" uint32_t c_irq_handler(uint32_t iar) {
|
|||||||
return iar;
|
return iar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,13 +91,15 @@ irq_handler:
|
|||||||
ldr r0, [r10]
|
ldr r0, [r10]
|
||||||
push {r0}
|
push {r0}
|
||||||
|
|
||||||
// C complex handler
|
// Complex handlers in C++
|
||||||
bl c_irq_handler
|
bl c_irq_handler
|
||||||
|
|
||||||
// Send End of Interrupt
|
// Send End of Interrupt
|
||||||
pop {r0}
|
pop {r0}
|
||||||
ldr r10, =0x01c82010 // EOIR
|
ldr r10, =0x01c82010 // EOIR address
|
||||||
str r0, [r10]
|
mov r1, #1023 // check for spurious interrupt
|
||||||
|
cmp r0, r1
|
||||||
|
strne r0, [r10] // ack interrupt only if not spurious (see GICC_EOIR)
|
||||||
|
|
||||||
// Reload context from stack
|
// Reload context from stack
|
||||||
// and also restore CPSR from SPSR (that caret)
|
// and also restore CPSR from SPSR (that caret)
|
||||||
|
Loading…
Reference in New Issue
Block a user