Convert Interrupt IO

This commit is contained in:
jaby 2024-09-29 16:15:36 +02:00
parent c41d996c34
commit a4ddf1d1b6
2 changed files with 18 additions and 9 deletions

View File

@ -0,0 +1,12 @@
#pragma once
#include "../ioport.hpp"
namespace JabyEngine {
namespace Interrupt_IO_Values {
__declare_io_value(Mask, uint32_t) {
};
__declare_io_value(Status, uint32_t) {
};
}
}

View File

@ -1,7 +1,10 @@
#pragma once #pragma once
#include "ioport.hpp" #include "IOValues/interrupt_io_values.hpp"
namespace JabyEngine { namespace JabyEngine {
using StatusIO = IOPort<Interrupt_IO_Values::Status>;
using MaskIO = IOPort<Interrupt_IO_Values::Mask>;
struct Interrupt { struct Interrupt {
static constexpr auto VBlank = Bit(0); static constexpr auto VBlank = Bit(0);
static constexpr auto GPU = Bit(1); static constexpr auto GPU = Bit(1);
@ -16,14 +19,8 @@ namespace JabyEngine {
static constexpr auto Controller = Bit(10); static constexpr auto Controller = Bit(10);
static constexpr auto LightPen = Controller; static constexpr auto LightPen = Controller;
__declare_io_value(Status, uint32_t) { static inline auto& Status = __new_declare_io_port(StatusIO, 0x1F801070);
}; static inline auto& Mask = __new_declare_io_port(MaskIO, 0x1F801074);
__declare_io_value(Mask, uint32_t) {
};
__declare_io_port(inline, Status, 0x1F801070);
__declare_io_port(inline, Mask, 0x1F801074);
static bool is_irq(Bit irq) { static bool is_irq(Bit irq) {
return Status.read().is_set(irq); return Status.read().is_set(irq);