Temp nonsense

This commit is contained in:
Pokechu22 2023-01-22 16:43:33 -08:00
commit 171be6b49d
7 changed files with 66 additions and 21 deletions

View file

@ -31,10 +31,10 @@ INCLUDES := include ../Core/Common .
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS = -save-temps -O2 -Wall --no-strict-aliasing $(MACHDEP) $(INCLUDE)
CFLAGS = -gdwarf-4 -save-temps -O0 -Wall --no-strict-aliasing $(MACHDEP) $(INCLUDE)
CXXFLAGS = -std=c++17 -Wno-register $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
LDFLAGS = -g $(MACHDEP) -gdwarf-4 -Wl,-Map,$(notdir $@).map
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project

View file

@ -26,7 +26,7 @@ public:
virtual void Reset() = 0;
virtual u32 CheckMailTo() = 0;
virtual void SendMailTo(u32 mail) = 0;
virtual void SetInterrupt() = 0;
virtual void SetInterrupt(bool value) = 0;
virtual bool CheckInterrupt() = 0;
// Yeah, yeah, having a method here makes this not a pure interface - but

View file

@ -433,7 +433,7 @@ void handle_dsp_mail(void)
else
{
const u32 now = gettick();
real_dsp.SetInterrupt();
real_dsp.SetInterrupt(true);
u32 end = gettick();
u32 tries = 0;
while (real_dsp.CheckInterrupt() && end - now < 1000000)
@ -451,6 +451,20 @@ void handle_dsp_mail(void)
}
}
}
else if (mail == 0x88885370)
{
real_dsp.SetInterrupt(false);
real_dsp.SendMailTo(real_dsp.CheckInterrupt() ? 0x99995372 : 0x99995370);
while (real_dsp.CheckMailTo())
;
}
else if (mail == 0x88885372)
{
real_dsp.SetInterrupt(true);
real_dsp.SendMailTo(real_dsp.CheckInterrupt() ? 0x99995372 : 0x99995370);
//while (real_dsp.CheckMailTo())
// ;
}
// SDK status mails
/*

View file

@ -52,11 +52,11 @@ void RealDSP::SendMailTo(u32 mail)
DSP_SendMailTo(mail);
}
void RealDSP::SetInterrupt()
void RealDSP::SetInterrupt(bool value)
{
u32 level;
_CPU_ISR_Disable(level);
_dspReg[5] = (_dspReg[5] & ~(DSPCR_AIINT | DSPCR_ARINT | DSPCR_DSPINT)) | DSPCR_PIINT;
_dspReg[5] = (_dspReg[5] & ~(DSPCR_AIINT | DSPCR_ARINT | DSPCR_DSPINT | DSPCR_PIINT)) | (value ? DSPCR_PIINT : 0);
_CPU_ISR_Restore(level);
}

View file

@ -12,6 +12,6 @@ public:
void Reset() override;
u32 CheckMailTo() override;
void SendMailTo(u32 mail) override;
void SetInterrupt() override;
void SetInterrupt(bool value) override;
bool CheckInterrupt() override;
};

View file

@ -1,19 +1,25 @@
incdir "tests"
incdir "tests"
include "dsp_base.inc"
; Right here we are at a specific predetermined state.
; Ideal environment to try instructions.
; We can call send_back at any time to send data back to the PowerPC.
test_main:
lri $AC0.M, #0x1000
call send_back
CLR $ACC0
CLR $ACC1
set40
lri $AC0.M, #0x1000
set16
call send_back
LRIS $AX0.H, #1
CALL send_back
; We're done, DO NOT DELETE THIS LINE
jmp end_of_test
JMP end_of_test
external_irq:
INC $ACC0
; LRIS $AX0.H, #3
; CALL send_back
RTI
; Expected output ($AX0.H (send_back num), $AC0.L (interrupt count), and $SR):
; 1, 0, 3824 (start)
; 3, 1, 2820 (in interrupt handler)
; 2, 1, 3820 (back out of interrupt handler)
; DSPSpy shows "interrupt after 20 ticks / 0 tries" (exact number of ticks varies)
; ACC1 is 7bb40 or so (also varies, and can vary between steps 2 and 3 if the interrupt happens on the JZ)

View file

@ -0,0 +1,25 @@
incdir "tests"
include "dsp_base.inc"
test_main:
CLR $ACC0
CLR $ACC1
LRIS $AX0.H, #1
CALL send_back
JMP end_of_test
external_irq:
INC $ACC0
; LRIS $AX0.H, #3
; CALL send_back
RTI
; Expected output ($AX0.H (send_back num), $AC0.L (interrupt count), and $SR):
; 1, 0, 3824 (start)
; 3, 1, 2820 (in interrupt handler)
; 2, 1, 3820 (back out of interrupt handler)
; DSPSpy shows "interrupt after 20 ticks / 0 tries" (exact number of ticks varies)
; ACC1 is 7bb40 or so (also varies, and can vary between steps 2 and 3 if the interrupt happens on the JZ)