From a0cef63369362d67f705c59cbb3b256978fb9310 Mon Sep 17 00:00:00 2001 From: Jaby Date: Mon, 20 Mar 2023 17:53:20 +0100 Subject: [PATCH] Port InterruptIOs --- include/PSX/System/IOPorts/interrupt_io.hpp | 50 ++++++++++----------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/include/PSX/System/IOPorts/interrupt_io.hpp b/include/PSX/System/IOPorts/interrupt_io.hpp index 4e2556b8..4586d619 100644 --- a/include/PSX/System/IOPorts/interrupt_io.hpp +++ b/include/PSX/System/IOPorts/interrupt_io.hpp @@ -4,42 +4,42 @@ namespace JabyEngine { struct Interrupt { - static constexpr auto VBlank = Bit(0); - static constexpr auto GPU = Bit(1); - static constexpr auto CDROM = Bit(2); - static constexpr auto DMA = Bit(3); - static constexpr auto Timer0 = Bit(4); - static constexpr auto Timer1 = Bit(5); - static constexpr auto Timer2 = Bit(6); - static constexpr auto Periphery = Bit(7); - static constexpr auto SIO = Bit(8); - static constexpr auto SPU = Bit(9); - static constexpr auto Controller = Bit(10); + static constexpr auto VBlank = IOBitSet(0); + static constexpr auto GPU = IOBitSet(1); + static constexpr auto CDROM = IOBitSet(2); + static constexpr auto DMA = IOBitSet(3); + static constexpr auto Timer0 = IOBitSet(4); + static constexpr auto Timer1 = IOBitSet(5); + static constexpr auto Timer2 = IOBitSet(6); + static constexpr auto Periphery = IOBitSet(7); + static constexpr auto SIO = IOBitSet(8); + static constexpr auto SPU = IOBitSet(9); + static constexpr auto Controller = IOBitSet(10); static constexpr auto LightPen = Controller; - typedef struct Status : public ComplexBitMap { - } Status_t; + __declare_io_type(Status, uint32_t, + ); - typedef struct Mask : public ComplexBitMap { - } Mask_t; + __declare_io_type(Mask, uint32_t, + ); - __declare_io_port_member(Status_t, Status, 0x1F801070); - __declare_io_port_member(Mask_t, Mask, 0x1F801074); + __declare_new_io_port(Status, 0x1F801070); + __declare_new_io_port(Mask, 0x1F801074); - static bool is_irq(Bit irq) { - return Status.read().is_bit_set(irq); + static constexpr bool is_irq(IOBitSet irq) { + return Status.is_set(irq); } - static void ack_irq(Bit irq) { - Status.write({Status.read().clear_bit(irq)}); + static constexpr void ack_irq(IOBitSet irq) { + Status.clear(irq); } - static void disable_irq(Bit irq) { - Mask.write({Mask.read().clear_bit(irq)}); + static constexpr void disable_irq(IOBitSet irq) { + Mask.clear(irq); } - static void enable_irq(Bit irq) { - Mask.write({Mask.read().set_bit(irq)}); + static void enable_irq(IOBitSet irq) { + Mask.set(irq); } }; }