33 lines
838 B
C++
33 lines
838 B
C++
#include <dbg.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;
|
|
|
|
if (cpuID == 0) {
|
|
/* for
|
|
* SPI - Shared Peripheral Interrupt
|
|
* PPI - Private Peripheral Interrupt
|
|
*/
|
|
switch (interruptID) {
|
|
case 54: /* timer 0 */ /* TODO: improve this ugliness */
|
|
uint32_t* const TMR_IRQ_STA_REG = (uint32_t* const)(0x01c20c04);
|
|
*TMR_IRQ_STA_REG = *TMR_IRQ_STA_REG | 0x1;
|
|
printk("Serving IRQ #");
|
|
printkl(itoa(interruptID));
|
|
break;
|
|
}
|
|
}
|
|
else {
|
|
/* for
|
|
* SGI - Software Generated Interrupts
|
|
*/
|
|
|
|
/* to be done -- multiprocessor systems */
|
|
}
|
|
|
|
return iar;
|
|
}
|
|
|