Support DMA with new IO

This commit is contained in:
2023-09-17 12:30:43 +02:00
parent 19c5485658
commit 87a7a349cc
6 changed files with 72 additions and 63 deletions

View File

@@ -91,10 +91,10 @@ namespace JabyEngine {
}
static void start(uint16_t blockCount, uint16_t wordsPerBlock = 0x10) {
typedef DMA_IO::BCR_t::SyncMode1 SyncMode1;
typedef DMA_IO::BCR::SyncMode1 SyncMode1;
DMA_IO::GPU.block_ctrl = DMA_IO::BCR_t::from(SyncMode1::BlockSize.with(wordsPerBlock), SyncMode1::BlockAmount.with(blockCount));
DMA_IO::GPU.channel_ctrl = DMA_IO::CHCHR_t::StartGPUReceive();
DMA_IO::GPU.block_ctrl.write(DMA_IO::BCR::from(SyncMode1::BlockSize.with(wordsPerBlock), SyncMode1::BlockAmount.with(blockCount)));
DMA_IO::GPU.channel_ctrl.write(DMA_IO::CHCHR::StartGPUReceive());
}
}
}

View File

@@ -31,7 +31,10 @@ namespace JabyEngine {
namespace Start {
static void enable_DMA() {
::JabyEngine::Blubb::bla(::JabyEngine::Blubb::Test);
DMA_IO::DPCR = DMA_IO::DPCR_t(DMA_IO::DPCR).set(DMA_IO::DPCR_t::SPUEnable).set(DMA_IO::DPCR_t::GPUEnable).set(DMA_IO::DPCR_t::CDROMEnable);
asm("#miau");
DMA_IO::DPCR.write(DMA_IO::DPCR.read().set2(DMA_IO::DPCR::SPUEnable, DMA_IO::DPCR::GPUEnable, DMA_IO::DPCR::CDROMEnable));
asm("#miau");
}
static void setup() {

View File

@@ -45,8 +45,8 @@ namespace JabyEngine {
static const auto ReadSector = [](uint32_t* dst) {
DMA_IO::CDROM.set_adr(reinterpret_cast<uintptr_t>(dst));
DMA_IO::CDROM.block_ctrl = DMA_IO::BCR_t::SyncMode0::for_cd();
DMA_IO::CDROM.channel_ctrl = DMA_IO::CHCHR_t::StartCDROM();
DMA_IO::CDROM.block_ctrl.write(DMA_IO::BCR::SyncMode0::for_cd());
DMA_IO::CDROM.channel_ctrl.write(DMA_IO::CHCHR::StartCDROM());
DMA_IO::CDROM.wait();

View File

@@ -68,8 +68,8 @@ namespace JabyEngine {
// DPCR already enabled
GPU_IO::GP1 = GPU_IO::Command::DMADirection(GPU_IO::DMADirection::CPU2GPU);
DMA_IO::GPU.set_adr(reinterpret_cast<uintptr_t>(data));
DMA_IO::GPU.block_ctrl = 0;
DMA_IO::GPU.channel_ctrl = DMA_IO::CHCHR_t::StartGPULinked();
DMA_IO::GPU.block_ctrl.write(DMA_IO::BCR::SyncMode2::for_gpu_cmd());
DMA_IO::GPU.channel_ctrl.write(DMA_IO::CHCHR::StartGPULinked());
}
}