38 lines
915 B
C++
38 lines
915 B
C++
#include <dbg.h>
|
|
#include <interrupt.h>
|
|
#include <stdint.h>
|
|
|
|
extern "C" uint32_t c_irq_handler(uint32_t iar) {
|
|
uint8_t cpuID = (iar >> 10) & 0x7;
|
|
uint16_t interruptID = iar & 0x3ff;
|
|
|
|
printk("Serving IRQ #"); printkl(itoa(interruptID));
|
|
|
|
void (*handler)(const uint8_t, const uint16_t);
|
|
|
|
if (cpuID == 0) {
|
|
/* for
|
|
* SPI - Shared Peripheral Interrupt
|
|
* PPI - Private Peripheral Interrupt
|
|
*/
|
|
switch (interruptID) { /* Choose proper interrupt handler */
|
|
case 54: case 55: case 56: case 57: case 99: case 100:
|
|
handler = interrupt::handler[interruptID];
|
|
break;
|
|
}
|
|
|
|
/* Call interrupt handler */
|
|
handler(cpuID, interruptID);
|
|
}
|
|
else {
|
|
/* for
|
|
* SGI - Software Generated Interrupts
|
|
*/
|
|
|
|
/* to be done -- multiprocessor systems */
|
|
}
|
|
|
|
return iar;
|
|
}
|
|
|