Implement interrupt status register

Upon an interrupt, you can read from the interrupt status register to
see what caused the interrupt.
This commit is contained in:
Byron Lathi
2022-03-14 13:30:01 -05:00
parent e012eb7d4d
commit a5474b5ae5
5 changed files with 46 additions and 1 deletions

View File

@@ -1,7 +1,19 @@
#include <stdint.h>
#include "interrupt.h"
// This is defined in main.c
void puts(const char* s);
void handle_irq() {
uint8_t status;
puts("Interrupt Detected!\n");
status = irq_get_status();
if (status & BUTTON) {
puts("Button Interrupt!\n");
}
}