47 lines
1.5 KiB
C++
47 lines
1.5 KiB
C++
#ifndef __JABYENGINE_INTERRUPT_IO_HPP__
|
|
#define __JABYENGINE_INTERRUPT_IO_HPP__
|
|
#include "ioport.hpp"
|
|
|
|
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 LightPen = Controller;
|
|
|
|
__new_declare_io_value(Status, uint32_t) {
|
|
};
|
|
|
|
__new_declare_io_value(Mask, uint32_t) {
|
|
};
|
|
|
|
__new_declare_io_port(inline, Status, 0x1F801070);
|
|
__new_declare_io_port(inline, Mask, 0x1F801074);
|
|
|
|
static bool is_irq(Bit irq) {
|
|
return Status.read().is_set2(irq);
|
|
}
|
|
|
|
static void ack_irq(Bit irq) {
|
|
Status.write(Status.read().clear2(irq));
|
|
}
|
|
|
|
static void disable_irq(Bit irq) {
|
|
Mask.write(Mask.read().clear2(irq));
|
|
}
|
|
|
|
static void enable_irq(Bit irq) {
|
|
Mask.write(Mask.read().set2(irq));
|
|
}
|
|
};
|
|
}
|
|
|
|
#endif //!__JABYENGINE_INTERRUPT_IO_HPP__
|