Skip to content

Commit

Permalink
DMA: internal CPU cycles may execute during CPU<->DMA bus transition …
Browse files Browse the repository at this point in the history
…cycles (see #380)
  • Loading branch information
fleroviux committed Jan 21, 2025
1 parent 61b0c90 commit 4945d05
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/nba/src/hw/dma/dma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,19 +155,17 @@ bool DMA::HasVideoTransferDMA() {
}

auto DMA::Run() -> int {
bus.Step(1);

const auto timestamp0 = scheduler.GetTimestampNow();

bus.Step(1);

do {
RunChannel();
} while(IsRunning());

const auto timestamp1 = scheduler.GetTimestampNow();

bus.Step(1);

return (int)(timestamp1 - timestamp0);
return (int)(scheduler.GetTimestampNow() - timestamp0);
}

void DMA::RunChannel() {
Expand Down

0 comments on commit 4945d05

Please sign in to comment.