Update more converted IO
This commit is contained in:
parent
9620b0ec41
commit
5bafe78ab5
|
@ -33,11 +33,11 @@ namespace JabyEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void enable() {
|
static void enable() {
|
||||||
GPU_IO::GP1.set_display_state(GPU_IO::DisplayMode::State::On);
|
GPU_IO::GP1.set_display_state(GPU_IO_Values::DisplayMode::State::On);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void disable() {
|
static void disable() {
|
||||||
GPU_IO::GP1.set_display_state(GPU_IO::DisplayMode::State::Off);
|
GPU_IO::GP1.set_display_state(GPU_IO_Values::DisplayMode::State::Off);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_offset(int16_t x, int16_t y);
|
static void set_offset(int16_t x, int16_t y);
|
||||||
|
@ -72,7 +72,7 @@ namespace JabyEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wait_for_render() {
|
static void wait_for_render() {
|
||||||
while(!GPU_IO::GPUSTAT.read().is_set(GPU_IO::GPUSTAT::GP0ReadyForCMD));
|
while(!GPU_IO::GPUSTAT.read().is_set(GPU_IO_Values::GPUSTAT::GP0ReadyForCMD));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t swap_buffers_vsync(uint8_t syncs, bool clear_screen = true);
|
uint8_t swap_buffers_vsync(uint8_t syncs, bool clear_screen = true);
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
|
|
||||||
namespace JabyEngine {
|
namespace JabyEngine {
|
||||||
namespace GPU_IO {
|
namespace GPU_IO {
|
||||||
using namespace GPU_IO_Values;
|
|
||||||
|
|
||||||
struct GP0IO : public IOPort<GPU_IO_Values::GP0> {
|
struct GP0IO : public IOPort<GPU_IO_Values::GP0> {
|
||||||
void clear_cache() {
|
void clear_cache() {
|
||||||
this->write(GPU_IO_Values::GP0::ClearCache());
|
this->write(GPU_IO_Values::GP0::ClearCache());
|
||||||
|
|
|
@ -3,23 +3,21 @@
|
||||||
|
|
||||||
namespace JabyEngine {
|
namespace JabyEngine {
|
||||||
namespace Periphery_IO {
|
namespace Periphery_IO {
|
||||||
namespace Value = Periphery_IO_Values;
|
struct JOY_STAT_IO : public IOPort<Periphery_IO_Values::JOY_STAT> {
|
||||||
|
|
||||||
struct JOY_STAT_IO : public IOPort<Value::JOY_STAT> {
|
|
||||||
inline bool has_response() const {
|
inline bool has_response() const {
|
||||||
return this->read().is_set(Value::JOY_STAT::RXFifoNonEmpty);
|
return this->read().is_set(Periphery_IO_Values::JOY_STAT::RXFifoNonEmpty);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool is_ready_transfer() const {
|
inline bool is_ready_transfer() const {
|
||||||
return this->read().is_set(Value::JOY_STAT::TXReadyFinished);
|
return this->read().is_set(Periphery_IO_Values::JOY_STAT::TXReadyFinished);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
using JOY_BAUD_IO = IOPort<Value::JOY_BAUD>;
|
using JOY_BAUD_IO = IOPort<Periphery_IO_Values::JOY_BAUD>;
|
||||||
using JOY_CTRL_IO = IOPort<Value::JOY_CTRL>;
|
using JOY_CTRL_IO = IOPort<Periphery_IO_Values::JOY_CTRL>;
|
||||||
using JOY_MODE_IO = IOPort<Value::JOY_MODE>;
|
using JOY_MODE_IO = IOPort<Periphery_IO_Values::JOY_MODE>;
|
||||||
using JOY_RX_DATA_IO = IOPort<Value::JOY_RX_DATA>;
|
using JOY_RX_DATA_IO = IOPort<Periphery_IO_Values::JOY_RX_DATA>;
|
||||||
using JOY_TX_DATA_IO = IOPort<Value::JOY_TX_DATA>;
|
using JOY_TX_DATA_IO = IOPort<Periphery_IO_Values::JOY_TX_DATA>;
|
||||||
|
|
||||||
static auto& JOY_TX_DATA = __new_declare_io_port(JOY_TX_DATA_IO, 0x1F801040);
|
static auto& JOY_TX_DATA = __new_declare_io_port(JOY_TX_DATA_IO, 0x1F801040);
|
||||||
static const auto& JOY_RX_DATA = __new_declare_io_port(JOY_RX_DATA_IO, 0x1F801040);
|
static const auto& JOY_RX_DATA = __new_declare_io_port(JOY_RX_DATA_IO, 0x1F801040);
|
||||||
|
|
|
@ -4,12 +4,10 @@
|
||||||
|
|
||||||
namespace JabyEngine {
|
namespace JabyEngine {
|
||||||
namespace SPU_IO {
|
namespace SPU_IO {
|
||||||
namespace Value = SPU_IO_Values;
|
|
||||||
|
|
||||||
static constexpr size_t VoiceCount = 24;
|
static constexpr size_t VoiceCount = 24;
|
||||||
static constexpr size_t ReverbCount = 1;
|
static constexpr size_t ReverbCount = 1;
|
||||||
|
|
||||||
struct ControlRegisterIO : public IOPort<Value::ControlRegister> {
|
struct ControlRegisterIO : public IOPort<SPU_IO_Values::ControlRegister> {
|
||||||
using TransferMode = Value::RAMTransferMode;
|
using TransferMode = Value::RAMTransferMode;
|
||||||
|
|
||||||
void set_transfer_mode(TransferMode mode) {
|
void set_transfer_mode(TransferMode mode) {
|
||||||
|
@ -18,20 +16,20 @@ namespace JabyEngine {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
using ADIO = IOPort<Value::AD>;
|
using ADIO = IOPort<SPU_IO_Values::AD>;
|
||||||
using DataTransferControlIO = IOPort<Value::DataTransferControl>;
|
using DataTransferControlIO = IOPort<SPU_IO_Values::DataTransferControl>;
|
||||||
using EchoIO = IOPort32<Value::Echo>;
|
using EchoIO = IOPort32<SPU_IO_Values::Echo>;
|
||||||
using KeyOffIO = IOPort32<Value::KeyOff>;
|
using KeyOffIO = IOPort32<SPU_IO_Values::KeyOff>;
|
||||||
using KeyOnIO = IOPort32<Value::KeyOn>;
|
using KeyOnIO = IOPort32<SPU_IO_Values::KeyOn>;
|
||||||
using KeyStatusIO = IOPort32<Value::KeyStatus>;
|
using KeyStatusIO = IOPort32<SPU_IO_Values::KeyStatus>;
|
||||||
using NoiseIO = IOPort<Value::Noise>;
|
using NoiseIO = IOPort<SPU_IO_Values::Noise>;
|
||||||
using PitchModulationIO = IOPort32<Value::PitchModulation>;
|
using PitchModulationIO = IOPort32<SPU_IO_Values::PitchModulation>;
|
||||||
using SampleRateIO = IOPort<Value::SampleRate>;
|
using SampleRateIO = IOPort<SPU_IO_Values::SampleRate>;
|
||||||
using SimpleVolumeIO = IOPort<Value::SimpleVolume>;
|
using SimpleVolumeIO = IOPort<SPU_IO_Values::SimpleVolume>;
|
||||||
using StatusRegisterIO = IOPort<Value::StatusRegister>;
|
using StatusRegisterIO = IOPort<SPU_IO_Values::StatusRegister>;
|
||||||
using SRIO = IOPort<Value::SR>;
|
using SRIO = IOPort<SPU_IO_Values::SR>;
|
||||||
using SRAMAdrIO = IOPort<Value::SRAMAdr>;
|
using SRAMAdrIO = IOPort<SPU_IO_Values::SRAMAdr>;
|
||||||
using SweepVolumeIO = IOPort<Value::SweepVolume>;
|
using SweepVolumeIO = IOPort<SPU_IO_Values::SweepVolume>;
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
struct Voice {
|
struct Voice {
|
||||||
|
|
|
@ -13,11 +13,11 @@ namespace JabyEngine {
|
||||||
static constexpr auto Height = PublicDisplay::Height;
|
static constexpr auto Height = PublicDisplay::Height;
|
||||||
|
|
||||||
#ifdef JABYENGINE_PAL
|
#ifdef JABYENGINE_PAL
|
||||||
static constexpr auto DisplayMode = GPU_IO::DisplayMode::PAL();
|
static constexpr auto DisplayMode = GPU_IO_Values::DisplayMode::PAL();
|
||||||
static constexpr uint16_t ScanlinesV = 288;
|
static constexpr uint16_t ScanlinesV = 288;
|
||||||
static constexpr auto DisplayRange = PositionI16::create(78, 35);
|
static constexpr auto DisplayRange = PositionI16::create(78, 35);
|
||||||
#else
|
#else
|
||||||
static constexpr auto DisplayMode = GPU_IO::DisplayMode::NTSC();
|
static constexpr auto DisplayMode = GPU_IO_Values::DisplayMode::NTSC();
|
||||||
static constexpr uint16_t ScanlinesV = 240;
|
static constexpr uint16_t ScanlinesV = 240;
|
||||||
static constexpr auto DisplayRange = PositionI16::create(76, 16);
|
static constexpr auto DisplayRange = PositionI16::create(76, 16);
|
||||||
#endif //JABYENGINE_PAL
|
#endif //JABYENGINE_PAL
|
||||||
|
@ -78,7 +78,7 @@ namespace JabyEngine {
|
||||||
|
|
||||||
struct Receive {
|
struct Receive {
|
||||||
static void prepare() {
|
static void prepare() {
|
||||||
GPU_IO::GP1.set_dma_direction(GPU_IO::GPUSTAT::DMADirection::CPU2GPU);
|
GPU_IO::GP1.set_dma_direction(GPU_IO_Values::GPUSTAT::DMADirection::CPU2GPU);
|
||||||
reset_cmd_buffer();
|
reset_cmd_buffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,17 +11,17 @@ namespace JabyEngine {
|
||||||
using namespace Periphery_IO;
|
using namespace Periphery_IO;
|
||||||
|
|
||||||
static void connect_to(uint16_t port) {
|
static void connect_to(uint16_t port) {
|
||||||
JOY_CTRL.write(Value::JOY_CTRL::create_for(port));
|
JOY_CTRL.write(Periphery_IO_Values::JOY_CTRL::create_for(port));
|
||||||
busy_loop(500);
|
busy_loop(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void close_connection() {
|
static void close_connection() {
|
||||||
JOY_CTRL.write(Value::JOY_CTRL::close());
|
JOY_CTRL.write(Periphery_IO_Values::JOY_CTRL::close());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void send_byte(uint8_t byte) {
|
static void send_byte(uint8_t byte) {
|
||||||
while(!JOY_STAT.is_ready_transfer());
|
while(!JOY_STAT.is_ready_transfer());
|
||||||
JOY_TX_DATA.write(Value::JOY_TX_DATA::create(byte));
|
JOY_TX_DATA.write(Periphery_IO_Values::JOY_TX_DATA::create(byte));
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t read_byte() {
|
static uint8_t read_byte() {
|
||||||
|
@ -30,8 +30,8 @@ namespace JabyEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void acknowledge() {
|
static void acknowledge() {
|
||||||
while(JOY_STAT.read().is_set(Value::JOY_STAT::ACKIrqLow));
|
while(JOY_STAT.read().is_set(Periphery_IO_Values::JOY_STAT::ACKIrqLow));
|
||||||
JOY_CTRL.write(JOY_CTRL.read().set(Value::JOY_CTRL::ACK));
|
JOY_CTRL.write(JOY_CTRL.read().set(Periphery_IO_Values::JOY_CTRL::ACK));
|
||||||
|
|
||||||
Interrupt::ack_irq(Interrupt::Periphery);
|
Interrupt::ack_irq(Interrupt::Periphery);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace JabyEngine {
|
||||||
wait_ready_for_CMD();
|
wait_ready_for_CMD();
|
||||||
#ifdef __SUPPORT_PS3__
|
#ifdef __SUPPORT_PS3__
|
||||||
// The PS3 needs explict change to FiFo
|
// The PS3 needs explict change to FiFo
|
||||||
GPU_IO::GP1.set_dma_direction(GPU_IO::GPUSTAT::DMADirection::Fifo);
|
GPU_IO::GP1.set_dma_direction(GPU_IO_Values::GPUSTAT::DMADirection::Fifo);
|
||||||
#endif // __SUPPORT_PS3__
|
#endif // __SUPPORT_PS3__
|
||||||
|
|
||||||
for(size_t n = 0; n < words; n++) {
|
for(size_t n = 0; n < words; n++) {
|
||||||
|
@ -72,7 +72,7 @@ namespace JabyEngine {
|
||||||
void render_dma(const uint32_t* data) {
|
void render_dma(const uint32_t* data) {
|
||||||
// DPCR already enabled
|
// DPCR already enabled
|
||||||
DMA_IO::GPU.wait();
|
DMA_IO::GPU.wait();
|
||||||
GPU_IO::GP1.set_dma_direction(GPU_IO::GPUSTAT::DMADirection::CPU2GPU);
|
GPU_IO::GP1.set_dma_direction(GPU_IO_Values::GPUSTAT::DMADirection::CPU2GPU);
|
||||||
DMA_IO::GPU.set_adr(reinterpret_cast<uintptr_t>(data));
|
DMA_IO::GPU.set_adr(reinterpret_cast<uintptr_t>(data));
|
||||||
DMA_IO::GPU.block_ctrl.write(DMA_IO::BCR::SyncMode2::for_gpu_cmd());
|
DMA_IO::GPU.block_ctrl.write(DMA_IO::BCR::SyncMode2::for_gpu_cmd());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue