various Z2Audio / JAudio debug cleanup (#2876)

* some JAudio work

* audio cleanup checkpoint

* checkpoint more audio cleanup

* fix symbols

* more z2 cleanup

* fix regression

* fix build

* some fixes
This commit is contained in:
TakaRikka
2025-11-27 21:19:33 -08:00
committed by GitHub
parent 767caeecc3
commit 6f96e66518
113 changed files with 6425 additions and 5542 deletions
+18 -23
View File
@@ -1,38 +1,29 @@
//
// Generated By: dol2asm
// Translation Unit: dsptask
//
#include "JSystem/JSystem.h" // IWYU pragma: keep
#include "JSystem/JAudio2/dsptask.h"
#include "JSystem/JAudio2/osdsp.h"
#include "global.h"
//
// Forward References:
//
static void DspInitWork();
static void DspHandShake(void* param_0);
static int DspStartWork(u32 param_0, void (*param_1)(u16));
//
// External References:
//
extern int Dsp_Running_Check();
extern int Dsp_Running_Start();
/* 8029E6E0-8029E718 299020 0038+00 1/1 0/0 0/0 .text DspHandShake__FPv */
void DspHandShake(void*) {
OS_REPORT("DSP InitCallback \n");
while (DSPCheckMailFromDSP() == 0) {}
DSPReadMailFromDSP();
DSPCheckMailFromDSP();
u32 result = DSPReadMailFromDSP();
OS_REPORT("♪JDSP/Boot:: DSPからのファーストメール(%x)が届きました\n", result);
result = DSPCheckMailFromDSP();
OS_REPORT("♪JDSP/Boot:: DSPからのセカンドメール(%x)が届きました\n", result);
OS_REPORT("♪JDSP/Boot:: DSPとの接続に成功しました\n");
Dsp_Running_Start();
}
/* ############################################################################################## */
/* 803C7920-803C9820 024A40 1F00+00 1/1 0/0 0/0 .data jdsp */
static u8 jdsp[7936] ALIGN_DECL(32) = {
0x02, 0x9F, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x02, 0xFF, 0x00, 0x00, 0x02, 0xFF, 0x00, 0x00,
@@ -542,6 +533,7 @@ static u8 AUDIO_YIELD_BUFFER[8192] ALIGN_DECL(32);
/* 8029E720-8029E7CC 299060 00AC+00 0/0 1/1 0/0 .text DspBoot__FPFPv_v */
void DspBoot(void (*param_0)(void*)) {
DspInitWork();
OS_REPORT("Dsp をブートします\n");
audio_task.priority = 0xf0;
audio_task.iram_mmem_addr = (u16*)(jdsp + 0x80000000);
audio_task.iram_length = sizeof(jdsp);
@@ -557,6 +549,7 @@ void DspBoot(void (*param_0)(void*)) {
audio_task.req_cb = param_0;
DSPInit();
DSPAddPriorTask(&audio_task);
OS_REPORT("Dspブートしました\n");
}
/* 8029E7E0-8029E8C8 299120 00E8+00 0/0 4/4 0/0 .text DSPSendCommands2__FPUlUlPFUs_v */
@@ -565,17 +558,20 @@ int DSPSendCommands2(u32* param_1, u32 param_2, void (*callBack)(u16)) {
BOOL interruptFlag;
s32 startWorkStatus;
while (Dsp_Running_Check() == 0) {};
while (Dsp_Running_Check() == 0) {
OS_REPORT("Warning:まだブートしてません\n");
};
interruptFlag = OSDisableInterrupts();
if (DSPCheckMailToDSP()) {
OS_REPORT("エラー::DSPがメッセージを受け取っていません\n");
OSRestoreInterrupts(interruptFlag);
return -1;
}
DSPSendMailToDSP(param_2);
DSPAssertInt();
while(DSPCheckMailToDSP() != 0);
while (DSPCheckMailToDSP() != 0);
if (param_2 == 0) {
param_2 = 1;
@@ -594,9 +590,7 @@ int DSPSendCommands2(u32* param_1, u32 param_2, void (*callBack)(u16)) {
return startWorkStatus;
}
/* ############################################################################################## */
/* 80433FE0-80434060 060D00 0080+00 3/3 0/0 0/0 .bss taskwork */
typedef struct {
u16 field_0x0;
u16 field_0x2;
@@ -606,14 +600,12 @@ typedef struct {
static TaskWorkStruct taskwork[16];
/* 8029E8E0-8029E90C 299220 002C+00 1/1 0/0 0/0 .text DspInitWork__Fv */
// Loop is unrolled but should not be
static void DspInitWork() {
for (int i = 0; i < 16; i++) {
taskwork[i].field_0x4 = NULL;
}
}
/* ############################################################################################## */
/* 80451300-80451304 000800 0004+00 2/2 0/0 0/0 .sbss taskreadp */
static u32 taskreadp;
@@ -625,6 +617,7 @@ static int DspStartWork(u32 param_0, void (*param_1)(u16)) {
u32 taskWritePrev = taskwritep;
u32 writeVal = ((taskWritePrev + 1) & 0xf);
if (writeVal == taskreadp) {
OS_REPORT("DSP-Task Buffer is full ( %d, %d)\n", taskwritep, taskreadp);
return 0;
}
@@ -636,7 +629,9 @@ static int DspStartWork(u32 param_0, void (*param_1)(u16)) {
/* 8029E980-8029E9E8 2992C0 0068+00 0/0 1/1 0/0 .text DspFinishWork__FUs */
void DspFinishWork(u16 param_0) {
if (param_0 == taskwork[taskreadp].field_0x0) {
if (param_0 != taskwork[taskreadp].field_0x0) {
OS_REPORT("Error:: Not finish task\n");
} else {
if (taskwork[taskreadp].field_0x4) {
taskwork[taskreadp].field_0x4(taskreadp);
}