Set DMA in defined state

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

View File

@ -161,6 +161,10 @@ namespace JabyEngine {
static constexpr auto MasterEnableDPCR = Bit(23);
static constexpr auto EnableDPCR = BitRange::from_to(16, 22);
static constexpr auto ForceIRQ = Bit(15);
static constexpr DICR empty() {
return DICR{0};
}
};
__declare_value_at(, Registers, MDECin, 0x1F801080);

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();
}
}
}