USB - Still non working, but fiddling with it
authorJohn Hodge <[email protected]>
Sat, 7 May 2011 13:39:37 +0000 (21:39 +0800)
committerJohn Hodge <[email protected]>
Sat, 7 May 2011 13:39:37 +0000 (21:39 +0800)
Modules/USB/Core/uhci.c
Modules/USB/Core/uhci.h

index e8cb7b7..fb92d54 100644 (file)
@@ -33,19 +33,22 @@ int UHCI_Initialise()
 {\r
         int    i=0, id=-1;\r
         int    ret;\r
-       Uint16  base;\r
        \r
        ENTER("");\r
        \r
        // Enumerate PCI Bus, getting a maximum of `MAX_CONTROLLERS` devices\r
        while( (id = PCI_GetDeviceByClass(0x0C03, 0xFFFF, id)) >= 0 && i < MAX_CONTROLLERS )\r
        {\r
+               // NOTE: Check "protocol" from PCI?\r
+               \r
                gUHCI_Controllers[i].PciId = id;\r
                // Assign a port range (BAR4, Reserve 32 ports)\r
-               base = PCI_AssignPort( id, 4, 0x20 );\r
-               gUHCI_Controllers[i].IOBase = base;\r
+               //base = PCI_AssignPort( id, 4, 0x20 );\r
+               gUHCI_Controllers[i].IOBase = PCI_GetBAR4(id);\r
+               gUHCI_Controllers[i].IRQNum = PCI_GetIRQ(id);\r
                \r
-               Log("[USB  ] Controller PCI #%i: IO Base = 0x%x", id, base);\r
+               Log("[USB  ] Controller PCI #%i: IO Base = 0x%x, IRQ %i",\r
+                       id, gUHCI_Controllers[i].IOBase, gUHCI_Controllers[i].IRQNum);\r
                \r
                // Initialise Host\r
                ret = UHCI_Int_InitHost(&gUHCI_Controllers[i]);\r
@@ -91,10 +94,14 @@ int UHCI_Int_InitHost(tUHCI_Controller *Host)
 {\r
        ENTER("pHost", Host);\r
        \r
+       outw( Host->IOBase + USBCMD, 4 );       // GRESET\r
+       // TODO: Wait for at least 10ms\r
+       outw( Host->IOBase + USBCMD, 0 );       // GRESET\r
+       \r
        // Allocate Frame List\r
        Host->FrameList = (void *) MM_AllocDMA(1, 32, &Host->PhysFrameList);    // 1 Page, 32-bit\r
        if( !Host->FrameList ) {\r
-               Warning("[UHCI ] Unable to allocate frame list, aborting");\r
+               Log_Warning("UHCI", "Unable to allocate frame list, aborting");\r
                LEAVE('i', -1);\r
                return -1;\r
        }\r
index df7854b..d8ace9f 100644 (file)
@@ -24,6 +24,11 @@ struct sUHCI_Controller
         */
        Uint16  IOBase;
        
+       /**
+        * \brief IRQ Number assigned to the device
+        */
+        int    IRQNum;
+       
        /**
         * \brief Frame list
         * 

UCC git Repository :: git.ucc.asn.au