From 1d75730d44312f06ebbc419bb09812db258c23c3 Mon Sep 17 00:00:00 2001 From: joevt Date: Thu, 23 Nov 2023 12:10:38 -0800 Subject: [PATCH] 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. --- devices/common/dbdma.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/devices/common/dbdma.cpp b/devices/common/dbdma.cpp index a9fa9e1..6042d7d 100644 --- a/devices/common/dbdma.cpp +++ b/devices/common/dbdma.cpp @@ -21,6 +21,7 @@ along with this program. If not, see . /** @file Descriptor-based direct memory access emulation. */ +#include #include #include #include @@ -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()); } }