From 3ed7c4da7661620b5b1e312be835f1509aeb15e3 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sat, 6 May 2023 00:08:21 +0600 Subject: [PATCH] usb: interrupt setting function (OHCI) --- src/usb.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/usb.c b/src/usb.c index 12385c808..0951412d6 100644 --- a/src/usb.c +++ b/src/usb.c @@ -258,6 +258,22 @@ ohci_port_reset_callback_2(void* priv) dev->ohci_mmio[OHCI_HcRhPortStatus2 + 2] |= 0x10; } +void +ohci_set_interrupt(usb_t* usb, uint8_t bit) +{ + if (!(usb->ohci_mmio[OHCI_HcInterruptEnable + 3] & 0x80)) + return; + + if (!(usb->ohci_mmio[OHCI_HcInterruptEnable] & bit)) + return; + + if (usb->ohci_mmio[OHCI_HcInterruptDisable] & bit) + return; + + usb->ohci_mmio[OHCI_HcInterruptStatus] |= bit; + usb_interrupt_ohci(usb); +} + static void ohci_mmio_write(uint32_t addr, uint8_t val, void *p) {