[nostalgia/core/gba] Cleanup interrupt globals

This commit is contained in:
Gary Talent 2020-06-21 13:47:06 -05:00
parent 89aadfb606
commit 0de5d6b6c0
3 changed files with 21 additions and 14 deletions

View File

@ -14,7 +14,7 @@
namespace nostalgia::core { namespace nostalgia::core {
void isr() { void isr() {
REG_IF = IntId_vblank; REG_IF = Int_vblank;
} }
} }

View File

@ -10,9 +10,9 @@
namespace nostalgia::core { namespace nostalgia::core {
constexpr auto DispStat_irq_vblank = static_cast<uint16_t>(1) << 3; constexpr uint16_t DispStat_irq_vblank = 1 << 3;
constexpr auto DispStat_irq_hblank = static_cast<uint16_t>(1) << 4; constexpr uint16_t DispStat_irq_hblank = 1 << 4;
constexpr auto DispStat_irq_vcount = static_cast<uint16_t>(1) << 5; constexpr uint16_t DispStat_irq_vcount = 1 << 5;
void isr(); void isr();
@ -21,7 +21,7 @@ ox::Error initIrq(Context*) {
// tell display to trigger vblank interrupts // tell display to trigger vblank interrupts
REG_DISPSTAT |= DispStat_irq_vblank; REG_DISPSTAT |= DispStat_irq_vblank;
// tell proc which interrupts to handle // tell proc which interrupts to handle
REG_IE |= IntId_vblank; REG_IE |= Int_vblank;
REG_IME = 1; REG_IME = 1;
return OxError(0); return OxError(0);
} }

View File

@ -12,15 +12,22 @@
namespace nostalgia::core { namespace nostalgia::core {
constexpr uint16_t IntId_vblank = static_cast<uint64_t>(1) << 0; constexpr uint16_t Int_vblank = 1 << 0;
constexpr uint16_t IntId_hblank = static_cast<uint64_t>(1) << 1; constexpr uint16_t Int_hblank = 1 << 1;
constexpr uint16_t IntId_vcount = static_cast<uint64_t>(1) << 2; constexpr uint16_t Int_vcount = 1 << 2;
constexpr uint16_t IntId_timer0 = static_cast<uint64_t>(1) << 3; constexpr uint16_t Int_timer0 = 1 << 3;
constexpr uint16_t IntId_timer1 = static_cast<uint64_t>(1) << 4; constexpr uint16_t Int_timer1 = 1 << 4;
constexpr uint16_t IntId_timer2 = static_cast<uint64_t>(1) << 5; constexpr uint16_t Int_timer2 = 1 << 5;
constexpr uint16_t IntId_serial = static_cast<uint64_t>(1) << 6; // link cable constexpr uint16_t Int_timer3 = 1 << 6;
constexpr uint16_t IntId_input = static_cast<uint64_t>(1) << 14; // gamepad constexpr uint16_t Int_serial = 1 << 7; // link cable
constexpr uint16_t IntId_cart = static_cast<uint64_t>(1) << 15; // cartridge removed constexpr uint16_t Int_dma0 = 1 << 8;
constexpr uint16_t Int_dma1 = 1 << 9;
constexpr uint16_t Int_dma2 = 1 << 10;
constexpr uint16_t Int_dma3 = 1 << 11;
constexpr uint16_t Int_dma4 = 1 << 12;
constexpr uint16_t Int_dma5 = 1 << 13;
constexpr uint16_t Int_input = 1 << 14; // gamepad
constexpr uint16_t Int_cart = 1 << 15; // cartridge removed
[[nodiscard]] ox::Error initIrq(Context *ctx); [[nodiscard]] ox::Error initIrq(Context *ctx);