Port DMA code

This commit is contained in:
2023-03-20 21:04:01 +01:00
parent 9243a3a17f
commit 44685184f8
4 changed files with 92 additions and 74 deletions

View File

@@ -48,7 +48,7 @@ namespace JabyEngine {
namespace DMA {
static void wait() {
while(::JabyEngine::DMA_IO::GPU.channel_ctrl.read().is(::JabyEngine::DMA_IO::CHCHR::Busy));
::JabyEngine::DMA_IO::GPU.wait();
}
static void end() {
@@ -62,7 +62,7 @@ namespace JabyEngine {
}
static void set_src(uintptr_t adr) {
DMA_IO::GPU.adr.write(DMA_IO::MADR::MemoryAdr.with(static_cast<uint32_t>(adr)));
DMA_IO::GPU.set_adr(adr);
}
static void set_dst(const PositionU16& position, const SizeU16& size) {
@@ -73,10 +73,10 @@ namespace JabyEngine {
}
static void start(uint16_t blockCount, uint16_t wordsPerBlock = 0x10) {
typedef DMA_IO::BCR::SyncMode1 SyncMode1;
typedef DMA_IO::BCR_t::SyncMode1 SyncMode1;
DMA_IO::GPU.block_ctrl.write(DMA_IO::BCR{SyncMode1::with(SyncMode1::BlockSize.with(wordsPerBlock), SyncMode1::BlockAmount.with(blockCount))});
DMA_IO::GPU.channel_ctrl.write(DMA_IO::CHCHR::StartGPUReceive());
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();
}
}
}