aboutsummaryrefslogtreecommitdiff
path: root/src/cpu
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2021-12-23 21:42:32 -0800
committerChristian Cunningham <cc@localhost>2021-12-23 21:42:32 -0800
commit9bc94963aefcb5028c3529ff59c974e48d814690 (patch)
treeeb90b58da616bce55176b4f8f72a238cce19cd0d /src/cpu
parenta905c499ceddc47a5fcd46f863e453919c196722 (diff)
Intro USB
Diffstat (limited to 'src/cpu')
-rw-r--r--src/cpu/atomic/swap.h1
-rw-r--r--src/cpu/irq.c21
2 files changed, 22 insertions, 0 deletions
diff --git a/src/cpu/atomic/swap.h b/src/cpu/atomic/swap.h
index 5e8ff57..374dd97 100644
--- a/src/cpu/atomic/swap.h
+++ b/src/cpu/atomic/swap.h
@@ -6,6 +6,7 @@
/// https://elixir.bootlin.com/linux/v4.9/source/arch/arm/include/asm/spinlock.h
/// https://elixir.bootlin.com/linux/v4.9/source/arch/arm/include/asm/spinlock_types.h#L23
/// https://www.cs.uic.edu/~jbell/CourseNotes/OperatingSystems/3_Processes.html
+/// https://developer.arm.com/documentation/dht0008/a/arm-synchronization-primitives/practical-uses/implementing-a-semaphore?lang=en
static inline void atm_lock(unsigned long pid, unsigned long* addr) {
unsigned long tmp, current_lock_value;
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();