Set DMA in defined state

This commit is contained in:
2024-03-09 23:37:07 -06:00
parent 9dc4843038
commit 9ca4778863
2 changed files with 16 additions and 0 deletions

View File

@@ -1,12 +1,24 @@
#include <PSX/System/IOPorts/dma_io.hpp>
#include <PSX/System/syscalls.hpp>
#include <PSX/System/IOPorts/interrupt_io.hpp>
#include <stdio.h>
namespace JabyEngine {
namespace boot {
namespace DMA {
// TODO: Do we want all of this? So far it didn't help
void setup() {
static constexpr auto EnableDMA = DMA_IO::DPCR::from(DMA_IO::DPCR::SPU.turn_on(3), DMA_IO::DPCR::GPU.turn_on(3), DMA_IO::DPCR::CDROM.turn_on(3));
DMA_IO::DPCR.write(EnableDMA);
DMA_IO::DICR.write(DMA_IO::DICR::empty());
DMA_IO::DICR.write(DMA_IO::DICR.read());
SysCall::EnterCriticalSection();
Interrupt::disable_irq(Interrupt::DMA);
Interrupt::ack_irq(Interrupt::DMA);
SysCall::ExitCriticalSection();
}
}
}