Skip to content

Commit

Permalink
naomi: fix handling of dma abort
Browse files Browse the repository at this point in the history
Fixes hang in f355 twin and twin2
  • Loading branch information
flyinghead committed Dec 8, 2023
1 parent 9137ff9 commit 0433fd8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions core/hw/naomi/naomi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ static int naomiDmaSched(int tag, int sch_cycl, int jitter, void *arg)
//Dma Start
static void Naomi_DmaStart(u32 addr, u32 data)
{
if ((data & 1) == 0)
if ((data & 1) == 0 || SB_GDST == 1)
return;
if (SB_GDEN == 0)
{
INFO_LOG(NAOMI, "Invalid (NAOMI)GD-DMA start, SB_GDEN=0. Ignoring it.");
INFO_LOG(NAOMI, "Invalid NAOMI-DMA start, SB_GDEN=0. Ignoring it.");
return;
}

Expand Down Expand Up @@ -177,8 +177,9 @@ static void Naomi_DmaEnable(u32 addr, u32 data)
SB_GDEN = data & 1;
if (SB_GDEN == 0 && SB_GDST == 1)
{
INFO_LOG(NAOMI, "(NAOMI)GD-DMA aborted");
INFO_LOG(NAOMI, "NAOMI-DMA aborted");
SB_GDST = 0;
sh4_sched_request(dmaSchedId, -1);
}
}

Expand Down Expand Up @@ -223,6 +224,7 @@ void naomi_reg_Reset(bool hard)
hollyRegs.setWriteHandler<SB_GDEN_addr>(Naomi_DmaEnable);
SB_GDST = 0;
SB_GDEN = 0;
sh4_sched_request(dmaSchedId, -1);

aw_ram_test_skipped = false;

Expand Down

0 comments on commit 0433fd8

Please sign in to comment.