From 9bc94963aefcb5028c3529ff59c974e48d814690 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Thu, 23 Dec 2021 21:42:32 -0800 Subject: Intro USB --- src/cpu/irq.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/cpu/irq.c') diff --git a/src/cpu/irq.c b/src/cpu/irq.c index f2b326e..e99b398 100644 --- a/src/cpu/irq.c +++ b/src/cpu/irq.c @@ -1,5 +1,6 @@ #include "../cpu/irq.h" #include "../drivers/uart.h" +#include "../drivers/usb.h" #include "../graphics/drawer.h" #include "../sys/core.h" #include "../sys/timer.h" @@ -92,6 +93,26 @@ void c_irq_handler(void) { enableirq(); return; } + } else if (load32(IRQ_PENDING1) & (1 << 9)) { + unsigned long reg = *USB_CORE_GINTSTS; + *USB_CORE_GINTSTS = reg; //clear + g_Drawer.y = 20; + write_hex32(&g_Drawer, reg); + g_Drawer.x = 0; + g_Drawer.y = 0; + if (reg & 1 << 28) { uart_string("Connector ID Status Change\n"); } + if (reg & 1 << 27) { uart_string("LPM Transaction Received Interrupt\n"); } + if (reg & 1 << 26) { uart_string("Periodic TxFIFO Empty\n"); } + if (reg & 1 << 25) { uart_string("Host Channels Interrupt\n"); + } + if (reg & 1 << 24) { *USB_HOST_HPRT |= 1 << 1; //clear host port interrupt + uart_string("Host Port Interrupt\n"); } + if (reg & 1 << 6) { uart_string("Global IN Non-periodic NAK Effective\n"); } + if (reg & 1 << 5) { uart_string("Non-periodic TxFIFO Empty\n"); } + if (reg & 1 << 4) { uart_string("Host and Device RxFIFO Non-Empty (RxFLvl) \n"); } + if (reg & 1 << 3) { uart_string("Host and Device Start of Frame\n"); } + if (reg & 1 << 2) { uart_string("OTG Interrupt\n"); } + if (reg & 1 << 1) { uart_string("Mode Mismatch Interrupt\n"); } } } else if (source & (1 << 3)) { c_timer(); -- cgit v1.2.1