aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--later/usb.c (renamed from src/drivers/usb.c)34
-rw-r--r--later/usb.h (renamed from src/drivers/usb.h)0
-rw-r--r--src/cpu/irq.c21
-rw-r--r--src/sys/core.c7
-rw-r--r--src/sys/core.h5
5 files changed, 34 insertions, 33 deletions
diff --git a/src/drivers/usb.c b/later/usb.c
index ea264cb..371f470 100644
--- a/src/drivers/usb.c
+++ b/later/usb.c
@@ -325,3 +325,37 @@ void usb_trig(void)
}
uart_string("\n");
}
+
+
+/* src/cpu/irq.c
+ } 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"); }
+
+
+ * src/sys/core.c sysinit(void)
+ // Enable USB Interrupt
+ store32(1<<9, IRQ_ENABLE1);
+ usbhost_start();
+
+
+ * src/sys/core.c postinit()
+ usb_trig();
+*/
diff --git a/src/drivers/usb.h b/later/usb.h
index e1aae5f..e1aae5f 100644
--- a/src/drivers/usb.h
+++ b/later/usb.h
diff --git a/src/cpu/irq.c b/src/cpu/irq.c
index e99b398..f2b326e 100644
--- a/src/cpu/irq.c
+++ b/src/cpu/irq.c
@@ -1,6 +1,5 @@
#include "../cpu/irq.h"
#include "../drivers/uart.h"
-#include "../drivers/usb.h"
#include "../graphics/drawer.h"
#include "../sys/core.h"
#include "../sys/timer.h"
@@ -93,26 +92,6 @@ 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();
diff --git a/src/sys/core.c b/src/sys/core.c
index 78d95b9..178b5f8 100644
--- a/src/sys/core.c
+++ b/src/sys/core.c
@@ -1,6 +1,5 @@
#include "../cpu/irq.h"
#include "../drivers/uart.h"
-#include "../drivers/usb.h"
#include "../graphics/lfb.h"
#include "../graphics/drawer.h"
#include "../lib/mem.h"
@@ -28,10 +27,6 @@ void sysinit() {
// Enable UART GPU IRQ
store32(1<<25, IRQ_ENABLE2);
- // Enable USB Interrupt
- store32(1<<9, IRQ_ENABLE1);
- usbhost_start();
-
// Enable Timer
// As an IRQ
store32(1<<0, IRQ_BASIC_ENABLE);
@@ -133,6 +128,4 @@ void postinit() {
}
write_string(&g_Drawer, "\n> ");
-
- usb_trig();
}
diff --git a/src/sys/core.h b/src/sys/core.h
index 1a85537..74bac74 100644
--- a/src/sys/core.h
+++ b/src/sys/core.h
@@ -113,11 +113,6 @@ enum
PM_RSTC_RESET = 0x00000102,
};
-#define bool unsigned char
-#define uint8_t unsigned char
-#define uint16_t unsigned short
-#define uint32_t unsigned long
-
void sysinit();
void postinit();