diff options
author | Jelle Raaijmakers <jelle@gmta.nl> | 2021-11-27 13:46:43 +0100 |
---|---|---|
committer | Idan Horowitz <idan.horowitz@gmail.com> | 2021-11-28 19:26:22 +0200 |
commit | 689ad0752c5cbbf34791f2ee188f46c558d58193 (patch) | |
tree | e366791023168a3bb2a5c992a417844b72f7eeb1 /Kernel/Devices/Audio/AC97.cpp | |
parent | bb58f6ccabc0e47fd5ef4dfcc911fbc6db0e8677 (diff) | |
download | serenity-689ad0752c5cbbf34791f2ee188f46c558d58193.zip |
Kernel: Add AC97_DEBUG macro
Diffstat (limited to 'Kernel/Devices/Audio/AC97.cpp')
-rw-r--r-- | Kernel/Devices/Audio/AC97.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Kernel/Devices/Audio/AC97.cpp b/Kernel/Devices/Audio/AC97.cpp index f16ddc82c3..b730cd5a51 100644 --- a/Kernel/Devices/Audio/AC97.cpp +++ b/Kernel/Devices/Audio/AC97.cpp @@ -63,6 +63,7 @@ bool AC97::handle_irq(RegisterState const&) { auto pcm_out_status_register = m_pcm_out_channel.reg(AC97Channel::Register::Status); auto pcm_out_status = pcm_out_status_register.in<u16>(); + dbgln_if(AC97_DEBUG, "AC97 @ {}: interrupt received - stat: {:#b}", pci_address(), pcm_out_status); bool is_dma_halted = (pcm_out_status & AudioStatusRegisterFlag::DMAControllerHalted) > 0; bool is_completion_interrupt = (pcm_out_status & AudioStatusRegisterFlag::BufferCompletionInterruptStatus) > 0; @@ -89,8 +90,8 @@ bool AC97::handle_irq(RegisterState const&) UNMAP_AFTER_INIT void AC97::initialize() { - dbgln("AC97 @ {}: mixer base: {:#04x}", pci_address(), m_io_mixer_base.get()); - dbgln("AC97 @ {}: bus base: {:#04x}", pci_address(), m_io_bus_base.get()); + dbgln_if(AC97_DEBUG, "AC97 @ {}: mixer base: {:#04x}", pci_address(), m_io_mixer_base.get()); + dbgln_if(AC97_DEBUG, "AC97 @ {}: bus base: {:#04x}", pci_address(), m_io_bus_base.get()); enable_pin_based_interrupts(); PCI::enable_bus_mastering(pci_address()); @@ -239,6 +240,7 @@ ErrorOr<void> AC97::write_single_buffer(UserOrKernelBuffer const& data, size_t o if (head_distance < m_output_buffer_page_count) break; + dbgln_if(AC97_DEBUG, "AC97 @ {}: waiting on interrupt - stat: {:#b} CI: {} LVI: {}", pci_address(), pcm_out_status, current_index, last_valid_index); m_irq_queue.wait_forever("AC97"sv); } while (m_pcm_out_channel.dma_running()); sti(); @@ -285,6 +287,8 @@ void AC97::AC97Channel::reset() void AC97::AC97Channel::set_last_valid_index(u32 buffer_address, u8 last_valid_index) { + dbgln_if(AC97_DEBUG, "AC97 @ {}: setting LVI - address: {:#x} LVI: {}", m_device.pci_address(), buffer_address, last_valid_index); + reg(Register::BufferDescriptorListBaseAddress).out(buffer_address); reg(Register::LastValidIndex).out(last_valid_index); } |