lol noobs, how about clearing OHCI0_HC_INT_STATUS?! :)
authorBernhard Urban <lewurm@gmx.net>
Fri, 4 Sep 2009 07:53:12 +0000 (09:53 +0200)
committerBernhard Urban <lewurm@gmx.net>
Fri, 4 Sep 2009 08:02:40 +0000 (10:02 +0200)
irq.c
main.c
ohci.c
ohci.h

diff --git a/irq.c b/irq.c
index 7288be0224a890c9058ac3b70e8dc7ff2c7d9334..449a85c34a1e43f861f82f7ab7c90ee03a07294c 100644 (file)
--- a/irq.c
+++ b/irq.c
@@ -14,8 +14,7 @@ Copyright (C) 2009                    Andre Heider "dhewg" <dhewg@wiibrew.org>
 #include "hollywood.h"
 #include "ipc.h"
 #include "bootmii_ppc.h"
 #include "hollywood.h"
 #include "ipc.h"
 #include "bootmii_ppc.h"
-//debug only
-#include "printf.h"
+#include "ohci.h"
 
 void irq_initialize(void)
 {
 
 void irq_initialize(void)
 {
@@ -27,12 +26,19 @@ void irq_initialize(void)
        write32(HW_PPCIRQMASK, 0);
        write32(HW_PPCIRQFLAG, 0xffffffff);
 
        write32(HW_PPCIRQMASK, 0);
        write32(HW_PPCIRQFLAG, 0xffffffff);
 
-       printf("PPCIRQMASK: 0x%08X\n", read32(HW_PPCIRQMASK));
-
-
-       //??? -- needed?!
-       //write32(HW_ARMIRQFLAG, 0); // this does nothing?
-       write32(HW_PPCIRQMASK+0x20, 0);
+       /* ??? -- needed?!
+        * in mini they do
+        *
+        * write32(HW_ARMIRQMASK+0x04, 0);
+        * write32(HW_ARMIRQMASK+0x20, 0);
+        *
+        *
+        * may it's here following; on the other 
+        * hand it's already done by mini...
+        *
+        * write32(HW_PPCIRQMASK+0x04+0x08, 0);
+        * write32(HW_PPCIRQMASK+0x20+0x08, 0);
+        */
 
        _CPU_ISR_Enable()
 }
 
        _CPU_ISR_Enable()
 }
@@ -48,7 +54,8 @@ void irq_handler(void)
 {
        u32 enabled = read32(BW_PI_IRQMASK);
        u32 flags = read32(BW_PI_IRQFLAG);
 {
        u32 enabled = read32(BW_PI_IRQMASK);
        u32 flags = read32(BW_PI_IRQFLAG);
-       printf("flags1: 0x%08X\n", flags);
+       printf( "========================\n"
+                       "flags1: 0x%08X\n", flags);
 
        flags = flags & enabled;
 
 
        flags = flags & enabled;
 
@@ -106,9 +113,8 @@ void irq_handler(void)
                        //sdhc_irq();
                }
                if (hw_flags & IRQF_OHCI0) {
                        //sdhc_irq();
                }
                if (hw_flags & IRQF_OHCI0) {
-                       printf("IRQ: OHCI0\n");
+                       ohci0_irq();
                        write32(HW_PPCIRQFLAG, IRQF_OHCI0);
                        write32(HW_PPCIRQFLAG, IRQF_OHCI0);
-                       //TODO: ohci0_irq();
                }
                if (hw_flags & IRQF_OHCI1) {
                        printf("IRQ: OHCI1\n");
                }
                if (hw_flags & IRQF_OHCI1) {
                        printf("IRQ: OHCI1\n");
@@ -124,14 +130,10 @@ void irq_handler(void)
 
                printf("hw_flags1: 0x%08x\n", read32(HW_PPCIRQFLAG));
 
 
                printf("hw_flags1: 0x%08x\n", read32(HW_PPCIRQFLAG));
 
-               // quirk for flipper pic? TODO :/
-               write32(HW_PPCIRQMASK, 0);
-
+               // not necessary here, but "cleaner"?
                write32(BW_PI_IRQFLAG, 1<<BW_PI_IRQ_HW);
                write32(BW_PI_IRQFLAG, 1<<BW_PI_IRQ_HW);
-               printf("flags2: 0x%08X\n", read32(BW_PI_IRQFLAG));
-               
-               write32(HW_PPCIRQMASK, hw_enabled);
        }
        }
+       printf("flags2: 0x%08X\n", read32(BW_PI_IRQFLAG));
 }
 
 void irq_bw_enable(u32 irq)
 }
 
 void irq_bw_enable(u32 irq)
diff --git a/main.c b/main.c
index 2c1e41ff71a0b63938465d7207815259af95d491..c8193f4b874b9e33252975a505b19357808f848d 100644 (file)
--- a/main.c
+++ b/main.c
@@ -84,6 +84,11 @@ int main(void)
        exception_init();
        dsp_reset();
 
        exception_init();
        dsp_reset();
 
+       irq_initialize();
+       irq_bw_enable(BW_PI_IRQ_RESET);
+       irq_bw_enable(BW_PI_IRQ_HW); //hollywood pic
+       irq_hw_enable(IRQ_OHCI0);
+
        ipc_initialize();
        ipc_slowping();
 
        ipc_initialize();
        ipc_slowping();
 
@@ -95,11 +100,6 @@ int main(void)
        VIDEO_SetFrameBuffer(get_xfb());
        VISetupEncoder();
 
        VIDEO_SetFrameBuffer(get_xfb());
        VISetupEncoder();
 
-       irq_initialize();
-       irq_bw_enable(BW_PI_IRQ_RESET);
-       irq_bw_enable(BW_PI_IRQ_HW); //hollywood pic
-       irq_hw_enable(IRQ_OHCI0);
-
        ohci_init();
 
        u32 version = ipc_getvers();
        ohci_init();
 
        u32 version = ipc_getvers();
diff --git a/ohci.c b/ohci.c
index 1bab91a5b7bac17c06fdfedd6629b875a0f9531f..899d474e24d989b3e558ef4431f3bd52cda410ce 100644 (file)
--- a/ohci.c
+++ b/ohci.c
@@ -108,3 +108,9 @@ void ohci_init() {
        dbg_op_state();
 }
 
        dbg_op_state();
 }
 
+void ohci0_irq() {
+       gecko_printf("ohci_irq\n");
+       write32(OHCI0_HC_INT_STATUS, ~0);
+}
+
+
diff --git a/ohci.h b/ohci.h
index 50af699911628208aefcea0989e0750d2c21bb3a..e9a41b05f1da7061ddf1d18b2d7b822094aaa980 100644 (file)
--- a/ohci.h
+++ b/ohci.h
@@ -197,5 +197,6 @@ struct ohci_hcca {
 } ALIGNED(256);
 
 void ohci_init(void);
 } ALIGNED(256);
 
 void ohci_init(void);
+void ohci0_irq(void);
 
 #endif
 
 #endif