jabyengine/include/PSX/System/IOPorts/interrupt_io.hpp

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 = 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;
__declare_io_type(Status, uint32_t,
);
__declare_io_type(Mask, uint32_t,
);
__declare_new_io_port(Status, 0x1F801070);
__declare_new_io_port(Mask, 0x1F801074);
static constexpr bool is_irq(IOBitSet irq) {
return Status.is_set(irq);
}
static constexpr void ack_irq(IOBitSet irq) {
Status.clear(irq);
}
static constexpr void disable_irq(IOBitSet irq) {
Mask.clear(irq);
}
static void enable_irq(IOBitSet irq) {
Mask.set(irq);
}
};
}
#endif //!__JABYENGINE_INTERRUPT_IO_HPP__