From 775307e8eaf27c520fdf85820b2863eb07716bf7 Mon Sep 17 00:00:00 2001 From: min0911Y <1474635462@qq.com> Date: Sun, 22 Dec 2024 17:14:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=85=B1=E4=BA=ABirq=20line?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/kernel/drivers/sound/hda.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kernel/drivers/sound/hda.c b/src/kernel/drivers/sound/hda.c index a0315226..0ddf70f6 100755 --- a/src/kernel/drivers/sound/hda.c +++ b/src/kernel/drivers/sound/hda.c @@ -29,8 +29,6 @@ #define HDA_PIN_COMPLEX_SPDIF_IN 0xc #define HDA_PIN_COMPLEX_DIG_IN 0xd - -static inthandler_t prev_handler; static u8 hda_bus = 255, hda_slot = 255, hda_func = 255; static u32 hda_base, output_base; static u32 *corb = null; @@ -57,6 +55,7 @@ static u32 hda_codec_number = 0; static void *hda_buffer_ptr = null; static inthandler_f hda_interrupt_handler; +static inthandler_t prev_handler; static void wait(int ticks) { int tick = system_tick; @@ -382,7 +381,7 @@ void hda_init() { int irq = pci_get_drive_irq(hda_bus, hda_slot, hda_func); irq_enable(irq); - inthandler_set(0x20 + irq, hda_interrupt_handler); + prev_handler = inthandler_set(0x20 + irq, hda_interrupt_handler); mem_set32(hda_base + 0x20, ((u32)1 << 31) | ((u32)1 << input_stream_count)); info("%x", pci_get_drive_irq(hda_bus, hda_slot, hda_func)); @@ -634,6 +633,7 @@ static int hda_open(vsound_t vsound) { __attr(fastcall) void hda_interrupt_handler(i32 id, regs32 *regs) { // printf("hda interrupt has been called"); + if (prev_handler) { prev_handler(id, regs); } bool result = pci_check_interrupt_status(hda_bus, hda_slot, hda_func); // 不是我们的中断我们不要 if (!result) { return; }