Improve struct and namespace usage

This commit is contained in:
2023-01-08 21:08:23 +01:00
parent 297526e4d0
commit a791f0bffd
14 changed files with 169 additions and 177 deletions

View File

@@ -3,7 +3,7 @@
#include "ioport.hpp"
namespace JabyEngine {
namespace Interrupt {
struct Interrupt {
static constexpr auto VBlank = Bit<uint32_t>(0);
static constexpr auto GPU = Bit<uint32_t>(1);
static constexpr auto CDROM = Bit<uint32_t>(2);
@@ -17,16 +17,16 @@ namespace JabyEngine {
static constexpr auto Controller = Bit<uint32_t>(10);
static constexpr auto LightPen = Controller;
struct __no_align IRQStatus : public ComplexBitMap<uint32_t> {
__io_port_inherit_complex_bit_map(IRQStatus);
struct __no_align Status : public ComplexBitMap<uint32_t> {
__io_port_inherit_complex_bit_map(Status);
};
struct __no_align IRQMask : public ComplexBitMap<uint32_t> {
__io_port_inherit_complex_bit_map(IRQMask);
struct __no_align Mask : public ComplexBitMap<uint32_t> {
__io_port_inherit_complex_bit_map(Mask);
};
__declare_io_port_global(IRQStatus, Status, 0x1F801070);
__declare_io_port_global(IRQMask, Mask, 0x1F801074);
__declare_io_port_member(struct Status, Status, 0x1F801070);
__declare_io_port_member(struct Mask, Mask, 0x1F801074);
static bool is_irq(Bit<uint32_t> irq) {
return Status.read().is_bit_set(irq);
@@ -43,7 +43,7 @@ namespace JabyEngine {
static void enable_irq(Bit<uint32_t> irq) {
Mask.write(Mask.read().set_bit(irq));
}
}
};
}
#endif //!__JABYENGINE_INTERRUPT_IO_HPP__