From 0de5d6b6c0a9649e1a1b10a345ac6b76ee558fa5 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sun, 21 Jun 2020 13:47:06 -0500 Subject: [PATCH] [nostalgia/core/gba] Cleanup interrupt globals --- src/nostalgia/core/gba/irq.arm.cpp | 2 +- src/nostalgia/core/gba/irq.cpp | 8 ++++---- src/nostalgia/core/gba/irq.hpp | 25 ++++++++++++++++--------- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/nostalgia/core/gba/irq.arm.cpp b/src/nostalgia/core/gba/irq.arm.cpp index 6b35b98b..955e9e4d 100644 --- a/src/nostalgia/core/gba/irq.arm.cpp +++ b/src/nostalgia/core/gba/irq.arm.cpp @@ -14,7 +14,7 @@ namespace nostalgia::core { void isr() { - REG_IF = IntId_vblank; + REG_IF = Int_vblank; } } diff --git a/src/nostalgia/core/gba/irq.cpp b/src/nostalgia/core/gba/irq.cpp index 9082542c..c499d78c 100644 --- a/src/nostalgia/core/gba/irq.cpp +++ b/src/nostalgia/core/gba/irq.cpp @@ -10,9 +10,9 @@ namespace nostalgia::core { -constexpr auto DispStat_irq_vblank = static_cast(1) << 3; -constexpr auto DispStat_irq_hblank = static_cast(1) << 4; -constexpr auto DispStat_irq_vcount = static_cast(1) << 5; +constexpr uint16_t DispStat_irq_vblank = 1 << 3; +constexpr uint16_t DispStat_irq_hblank = 1 << 4; +constexpr uint16_t DispStat_irq_vcount = 1 << 5; void isr(); @@ -21,7 +21,7 @@ ox::Error initIrq(Context*) { // tell display to trigger vblank interrupts REG_DISPSTAT |= DispStat_irq_vblank; // tell proc which interrupts to handle - REG_IE |= IntId_vblank; + REG_IE |= Int_vblank; REG_IME = 1; return OxError(0); } diff --git a/src/nostalgia/core/gba/irq.hpp b/src/nostalgia/core/gba/irq.hpp index b56201a7..a9b7e247 100644 --- a/src/nostalgia/core/gba/irq.hpp +++ b/src/nostalgia/core/gba/irq.hpp @@ -12,15 +12,22 @@ namespace nostalgia::core { -constexpr uint16_t IntId_vblank = static_cast(1) << 0; -constexpr uint16_t IntId_hblank = static_cast(1) << 1; -constexpr uint16_t IntId_vcount = static_cast(1) << 2; -constexpr uint16_t IntId_timer0 = static_cast(1) << 3; -constexpr uint16_t IntId_timer1 = static_cast(1) << 4; -constexpr uint16_t IntId_timer2 = static_cast(1) << 5; -constexpr uint16_t IntId_serial = static_cast(1) << 6; // link cable -constexpr uint16_t IntId_input = static_cast(1) << 14; // gamepad -constexpr uint16_t IntId_cart = static_cast(1) << 15; // cartridge removed +constexpr uint16_t Int_vblank = 1 << 0; +constexpr uint16_t Int_hblank = 1 << 1; +constexpr uint16_t Int_vcount = 1 << 2; +constexpr uint16_t Int_timer0 = 1 << 3; +constexpr uint16_t Int_timer1 = 1 << 4; +constexpr uint16_t Int_timer2 = 1 << 5; +constexpr uint16_t Int_timer3 = 1 << 6; +constexpr uint16_t Int_serial = 1 << 7; // link cable +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);