Prepare DMA support for PS3

This commit is contained in:
Jaby 2024-03-13 23:59:15 -05:00
parent 0a89fed98a
commit 76da72b9d5
3 changed files with 20 additions and 2 deletions

View File

@ -66,6 +66,11 @@ namespace JabyEngine {
}
namespace DMA {
#ifdef SUPPORT_PS3
// The PS3 doesn't autoincrement the GPU MADR register so we have to do it
extern uintptr_t MADR;
#endif // SUPPORT_PS3
static void wait() {
::JabyEngine::DMA_IO::GPU.wait();
}
@ -81,7 +86,11 @@ namespace JabyEngine {
}
static void set_src(uintptr_t adr) {
DMA_IO::GPU.set_adr(adr);
#ifdef SUPPORT_PS3
MADR = adr;
#else
DMA_IO::GPU.set_adr(adr);
#endif // SUPPORT_PS3
}
static void set_dst(const PositionU16& position, const SizeU16& size) {
@ -94,6 +103,10 @@ namespace JabyEngine {
static void start(uint16_t blockCount, uint16_t wordsPerBlock = 0x10) {
typedef DMA_IO::BCR::SyncMode1 SyncMode1;
#ifdef SUPPORT_PS3
DMA_IO::GPU.set_adr(MADR);
MADR += (blockCount * wordsPerBlock) << 2;
#endif // SUPPORT_PS3
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

@ -116,7 +116,6 @@ namespace JabyEngine {
__debug_boot_color_at(::JabyEngine::GPU::Color24::Red(), DebugX, DebugY, DebugScale);
SPU::stop_voices();
// TODO: v Might be the PS3 crash
__debug_boot_color_at(::JabyEngine::GPU::Color24::Green(), DebugX, DebugY, DebugScale);
CD::setup();
__debug_boot_color_at(::JabyEngine::GPU::Color24::Blue(), DebugX, DebugY, DebugScale);

View File

@ -8,6 +8,12 @@ namespace JabyEngine {
uint8_t Display :: current_id = 1; //< Setup will call exchange and set it to 0
namespace internal {
namespace DMA {
#ifdef SUPPORT_PS3
uintptr_t MADR = 0;
#endif // SUPPORT_PS3
}
static SysCall::InterruptVerifierResult interrupt_verifier();
static uint32_t interrupt_handler(uint32_t);