Prepare GPU setup

This commit is contained in:
Jaby 2022-09-08 20:36:36 +02:00 committed by Jaby
parent ab9d47dde8
commit 564e8a6e8b
2 changed files with 32 additions and 3 deletions

View File

@ -36,9 +36,33 @@ namespace GPU {
GPU2CPU = 3, GPU2CPU = 3,
}; };
struct __no_align Command : public ComplexBitMap<uint32_t> { enum struct DisplayState {
On = 0,
Off = 1
}; };
namespace Command {
static constexpr uint32_t construct_cmd(uint8_t cmd, uint32_t value) {
return ((cmd << 24) | value);
}
struct __no_align GP0 : public ComplexBitMap<uint32_t> {
__io_port_inherit_complex_bit_map(GP0);
};
struct __no_align GP1 : public ComplexBitMap<uint32_t> {
__io_port_inherit_complex_bit_map(GP1);
static constexpr GP1 Reset() {
return {0};
}
static constexpr GP1 SetDisplayState(DisplayState state) {
return {construct_cmd(0x03, static_cast<uint32_t>(state))};
}
};
}
struct __no_align GPUStatusRegister : public ComplexBitMap<uint32_t> { struct __no_align GPUStatusRegister : public ComplexBitMap<uint32_t> {
static constexpr auto DrawingOddLinesInterlaced = Bit<uint32_t>(31); static constexpr auto DrawingOddLinesInterlaced = Bit<uint32_t>(31);
static constexpr auto DMADirectionValue = BitRange<DMADirection>::from_to(29, 30); static constexpr auto DMADirectionValue = BitRange<DMADirection>::from_to(29, 30);
@ -68,6 +92,10 @@ namespace GPU {
static constexpr auto TexturePageY256 = Bit<uint32_t>(4); static constexpr auto TexturePageY256 = Bit<uint32_t>(4);
}; };
__declare_io_port_global(Command::GP0, GP0, 0x1F801810);
__declare_io_port_global(Command::GP1, GP1, 0x1F801814);
__declare_io_port_global_const(uint32_t, GPUREAD, 0x1F801810);
__declare_io_port_global_const(GPUStatusRegister, GPUSTAT, 0x1F801814); __declare_io_port_global_const(GPUStatusRegister, GPUSTAT, 0x1F801814);
} }
} }

View File

@ -1,7 +1,8 @@
#include <PSX/GPU/GPU_Types.hpp> #include <PSX/System/IOPorts/GPU_IO.hpp>
namespace GPU { namespace GPU {
void setup() { void setup() {
Port::GP1.write(Port::Command::GP1::Reset());
Port::GP1.write(Port::Command::GP1::SetDisplayState(Port::DisplayState::On));
} }
} }