Iop,Spu: Adds the IOPs DMAC, still very incomplete...

This commit is contained in:
Gabriel Correia 2024-01-11 14:57:28 -03:00
parent 69d81e6437
commit 2aa3403872
9 changed files with 82 additions and 4 deletions

View File

@ -68,6 +68,7 @@ target_sources(cosmic PRIVATE
${COSMIC_DIR}/iop/iop_core.cpp
${COSMIC_DIR}/iop/iop_cop.cpp
${COSMIC_DIR}/iop/iop_intc.cpp
${COSMIC_DIR}/iop/iop_dma.cpp
${COSMIC_DIR}/gpu/render_driver.cpp
${COSMIC_DIR}/gpu/exhibition_engine.cpp
${COSMIC_DIR}/gpu/graphics_layer.cpp

View File

@ -13,8 +13,14 @@ namespace cosmic::console {
mipsEeR5900 = std::make_shared<engine::EeMipsCore>(pipe);
mipsIop = std::make_shared<iop::IoMipsCore>(pipe);
iopDma = std::make_shared<iop::IopDma>();
decoderMpeg12 = std::make_shared<ipu::IpuMpeg2>(pipe->controller);
}
void VirtDevices::level3devsInit(
std::shared_ptr<console::IntCInfra> &infra) {
soundPu = std::make_shared<spu::Spu2>(infra, iopDma);
}
void Vu01Package::populate(std::shared_ptr<IntCInfra> infra,
std::shared_ptr<mio::DmaController> dma) {

View File

@ -9,6 +9,8 @@
#include <gs/synth_engine.h>
#include <ipu/ipu_core.h>
#include <mio/mem_pipe.h>
#include <iop/iop_dma.h>
#include <spu/sound_processor.h>
namespace cosmic::mio {
class DmaController;
}
@ -43,9 +45,13 @@ namespace cosmic::console {
public:
VirtDevices();
void level2devsInit(std::shared_ptr<mio::MemoryPipe>& pipe);
void level3devsInit(std::shared_ptr<console::IntCInfra>& infra);
std::shared_ptr<engine::EeMipsCore> mipsEeR5900;
std::shared_ptr<iop::IoMipsCore> mipsIop;
std::shared_ptr<iop::IopDma> iopDma;
std::shared_ptr<spu::Spu2> soundPu;
std::shared_ptr<ipu::IpuMpeg2> decoderMpeg12;
std::shared_ptr<mio::GlobalMemory> virtBlocks;

View File

@ -0,0 +1,7 @@
#include <iop/iop_dma.h>
namespace cosmic::iop {
void IopDma::resetIoDma() {
}
}

View File

@ -0,0 +1,14 @@
#pragma once
#include <common/types.h>
namespace cosmic::iop {
enum DmaChannels {
IopSpu2 = 0x8
};
class IopDma {
public:
IopDma() {
}
void resetIoDma();
};
}

View File

@ -1,4 +1,9 @@
#include <spu/sound_processor.h>
namespace cosmic::spu {
void Spu2::resetSound() {
status = {};
transferAddr = 0;
currentAddr = 0;
}
}

View File

@ -1,5 +1,33 @@
#pragma once
#include <common/types.h>
namespace cosmic {
namespace console {
class IntCInfra;
}
namespace iop {
class IopDma;
}
}
namespace cosmic::spu {
struct SpuStatus {
bool dmaReady;
bool dmaBusy;
};
class Spu2 {
public:
Spu2(std::shared_ptr<console::IntCInfra>& infra, std::shared_ptr<iop::IopDma>& ioDma) :
intc(infra), dmac(ioDma)
{
}
SpuStatus status;
void resetSound();
u32 transferAddr;
u32 currentAddr;
private:
std::shared_ptr<console::IntCInfra> intc;
std::shared_ptr<iop::IopDma> dmac;
};
}

View File

@ -9,14 +9,18 @@
namespace cosmic::vm {
EmuVm::EmuVm(JNIEnv* env, std::shared_ptr<console::VirtDevices>& devices,
std::shared_ptr<gpu::ExhibitionEngine>& dsp) :
screenEngine(dsp),
emuThread(*this) {
outside = std::make_shared<console::BackDoor>(*this);
screenEngine(dsp),
emuThread(*this) {
outside = std::make_shared<console::BackDoor>(*this);
sharedPipe = std::make_shared<mio::MemoryPipe>(devices);
devices->level2devsInit(sharedPipe);
mips = devices->mipsEeR5900;
iop = devices->mipsIop;
ioDma = devices->iopDma;
sound = devices->soundPu;
gsGif = devices->gif;
mpegDecoder = devices->decoderMpeg12;
vu01 = devices->VUs;
@ -27,9 +31,11 @@ namespace cosmic::vm {
// Our way to perform interconnection between different isolated components
dealer = std::make_unique<hle::SyscallDealer>();
frames = 30;
devices->level3devsInit(intc);
vu01->populate(intc, sharedPipe->controller);
frames = 30;
RawReference<vu::VectorUnit> vus[]{
vu01->vpu0Cop2,
vu01->vpu1Dlo
@ -83,6 +89,8 @@ namespace cosmic::vm {
vu01->vpu1Dlo.resetVu();
iop->resetIop();
ioDma->resetIoDma();
sound->resetSound();
}
void EmuVm::dealWithSyscalls() {
hle::SyscallOrigin origin{};

View File

@ -24,6 +24,9 @@ namespace cosmic::vm {
std::shared_ptr<hle::BiosPatcher> biosHigh;
std::shared_ptr<engine::EeMipsCore> mips;
std::shared_ptr<iop::IoMipsCore> iop;
std::shared_ptr<iop::IopDma> ioDma;
std::shared_ptr<spu::Spu2> sound;
std::shared_ptr<ipu::IpuMpeg2> mpegDecoder;
std::shared_ptr<gs::GifBridge> gsGif;