Set DMA in defined state
This commit is contained in:
parent
9c6b47e0fa
commit
948f59dde0
|
@ -161,6 +161,10 @@ namespace JabyEngine {
|
||||||
static constexpr auto MasterEnableDPCR = Bit(23);
|
static constexpr auto MasterEnableDPCR = Bit(23);
|
||||||
static constexpr auto EnableDPCR = BitRange::from_to(16, 22);
|
static constexpr auto EnableDPCR = BitRange::from_to(16, 22);
|
||||||
static constexpr auto ForceIRQ = Bit(15);
|
static constexpr auto ForceIRQ = Bit(15);
|
||||||
|
|
||||||
|
static constexpr DICR empty() {
|
||||||
|
return DICR{0};
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
__declare_value_at(, Registers, MDECin, 0x1F801080);
|
__declare_value_at(, Registers, MDECin, 0x1F801080);
|
||||||
|
|
|
@ -1,12 +1,24 @@
|
||||||
#include <PSX/System/IOPorts/dma_io.hpp>
|
#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 JabyEngine {
|
||||||
namespace boot {
|
namespace boot {
|
||||||
namespace DMA {
|
namespace DMA {
|
||||||
|
// TODO: Do we want all of this? So far it didn't help
|
||||||
void setup() {
|
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));
|
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::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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue