Skip to content

Commit

Permalink
suspend processors while waiting
Browse files Browse the repository at this point in the history
  • Loading branch information
soyersoyer committed Jan 23, 2025
1 parent dcdbe3d commit 392bd58
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/minidexed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,13 +431,16 @@ void CMiniDexed::Run (unsigned nCore)
m_CoreStatus[nCore] = CoreStatusIdle; // core 1 ready

// wait for cores 2 and 3 to be ready
DisableIRQs ();
for (unsigned nCore = 2; nCore < CORES; nCore++)
{
while (m_CoreStatus[nCore] != CoreStatusIdle)
{
// just wait
DataSyncBarrier ();
WaitForInterrupt ();
}
}
EnableIRQs ();

while (m_CoreStatus[nCore] != CoreStatusExit)
{
Expand All @@ -449,10 +452,15 @@ void CMiniDexed::Run (unsigned nCore)
while (1)
{
m_CoreStatus[nCore] = CoreStatusIdle; // ready to be kicked
SendIPI (1, IPI_USER);

DisableIRQs ();
while (m_CoreStatus[nCore] == CoreStatusIdle)
{
// just wait
DataSyncBarrier ();
WaitForInterrupt ();
}
EnableIRQs ();

// now kicked from core 1

Expand Down Expand Up @@ -1230,6 +1238,7 @@ void CMiniDexed::ProcessSound (void)
{
assert (m_CoreStatus[nCore] == CoreStatusIdle);
m_CoreStatus[nCore] = CoreStatusBusy;
SendIPI (nCore, IPI_USER);
}

// process the TGs assigned to core 1
Expand All @@ -1241,13 +1250,16 @@ void CMiniDexed::ProcessSound (void)
}

// wait for cores 2 and 3 to complete their work
DisableIRQs ();
for (unsigned nCore = 2; nCore < CORES; nCore++)
{
while (m_CoreStatus[nCore] != CoreStatusIdle)
{
// just wait
DataSyncBarrier ();
WaitForInterrupt ();
}
}
EnableIRQs ();

//
// Audio signal path after tone generators starts here
Expand Down

0 comments on commit 392bd58

Please sign in to comment.