feat: audio mixer, Audio app, fix Installer crash
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "IntelHda.hpp"
|
||||
#include "Mixer.hpp"
|
||||
#include <Memory/PageFrameAllocator.hpp>
|
||||
#include <Memory/HHDM.hpp>
|
||||
#include <Memory/Paging.hpp>
|
||||
@@ -840,12 +841,14 @@ namespace Drivers::Audio::IntelHda {
|
||||
|
||||
static void HandleInterrupt(uint8_t /*irq*/) {
|
||||
uint32_t intsts = Read32(REG_INTSTS);
|
||||
bool bufferCompleted = false;
|
||||
|
||||
// Handle stream interrupts (bits 0-29 correspond to stream descriptors)
|
||||
if (g_stream.Active) {
|
||||
uint8_t si = g_stream.StreamIndex;
|
||||
if (intsts & (1u << si)) {
|
||||
uint8_t sts = ReadSD8(si, SD_STS);
|
||||
if (sts & SD_STS_BCIS) bufferCompleted = true;
|
||||
WriteSD8(si, SD_STS, sts);
|
||||
}
|
||||
}
|
||||
@@ -858,6 +861,12 @@ namespace Drivers::Audio::IntelHda {
|
||||
uint8_t rirbSts = Read8(REG_RIRBSTS);
|
||||
Write8(REG_RIRBSTS, rirbSts);
|
||||
}
|
||||
|
||||
// Notify the mixer so it can refill the DMA ring with the next mix
|
||||
// window. Done after clearing status bits so re-entry can't latch.
|
||||
if (bufferCompleted) {
|
||||
Mixer::OnHdaBufferComplete();
|
||||
}
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
|
||||
Reference in New Issue
Block a user