[DSP] Implement ConvertProcessAddressFromDspDram

This commit is contained in:
wheremyfoodat 2022-10-10 22:33:38 +03:00
parent a3431e7c9c
commit c34011326e
2 changed files with 14 additions and 2 deletions

View file

@ -49,6 +49,7 @@ class DSPService {
DSPPipe audioPipe;
// Service functions
void convertProcessAddressFromDspDram(u32 messagePointer); // Nice function name
void getSemaphoreHandle(u32 messagePointer);
void loadComponent(u32 messagePointer);
void readPipeIfPossible(u32 messagePointer);

View file

@ -2,13 +2,14 @@
namespace DSPCommands {
enum : u32 {
SetSemaphore = 0x00070040,
ConvertProcessAddressFromDspDram = 0x000C0040,
WriteProcessPipe = 0x000D0082,
ReadPipeIfPossible = 0x001000C0,
LoadComponent = 0x001100C2,
RegisterInterruptEvents = 0x00150082,
GetSemaphoreHandle = 0x00160000,
SetSemaphoreMask = 0x00170040,
SetSemaphore = 0x00070040,
WriteProcessPipe = 0x000D0082
};
}
@ -25,6 +26,7 @@ void DSPService::reset() {
void DSPService::handleSyncRequest(u32 messagePointer) {
const u32 command = mem.read32(messagePointer);
switch (command) {
case DSPCommands::ConvertProcessAddressFromDspDram: convertProcessAddressFromDspDram(messagePointer); break;
case DSPCommands::GetSemaphoreHandle: getSemaphoreHandle(messagePointer); break;
case DSPCommands::LoadComponent: loadComponent(messagePointer); break;
case DSPCommands::ReadPipeIfPossible: readPipeIfPossible(messagePointer); break;
@ -36,6 +38,15 @@ void DSPService::handleSyncRequest(u32 messagePointer) {
}
}
void DSPService::convertProcessAddressFromDspDram(u32 messagePointer) {
const u32 address = mem.read32(messagePointer + 4);
log("DSP::ConvertProcessAddressFromDspDram (address = %08X)\n", address);
const u32 converted = (address << 1) + 0x1FF40000;
mem.write32(messagePointer + 4, Result::Success);
mem.write32(messagePointer + 8, converted); // Converted address
}
void DSPService::loadComponent(u32 messagePointer) {
u32 size = mem.read32(messagePointer + 4);
u32 programMask = mem.read32(messagePointer + 8);