dbdma: Do interrupt on main thread.

These may be triggered by other threads (such as for audio) so use the timer manager to handle them in the main thread.
This commit is contained in:
joevt 2023-11-23 12:10:38 -08:00 committed by dingusdev
parent 95d74a6940
commit 1d75730d44

View File

@ -21,6 +21,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
/** @file Descriptor-based direct memory access emulation. */
#include <core/timermanager.h>
#include <cpu/ppc/ppcmmu.h>
#include <devices/common/dbdma.h>
#include <devices/common/dmacore.h>
@ -261,9 +262,11 @@ void DMAChannel::update_irq() {
}
}
if (cond) {
if (int_ctrl)
this->int_ctrl->ack_dma_int(this->irq_id, 1);
else
if (int_ctrl) {
TimerManager::get_instance()->add_immediate_timer([this] {
this->int_ctrl->ack_dma_int(this->irq_id, 1);
});
} else
LOG_F(ERROR, "%s Interrupt ignored", this->get_name().c_str());
}
}