X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=KernelLand%2FModules%2FUSB%2FCore%2Fusb.c;h=9a0e2bca5e7d6791cd626f9e96dcbfee3a4ec0b7;hb=4ebe00546574e97c5316881881f7f2562deea74b;hp=b3195804c129892969048d4ea29e7c87e1ce11f2;hpb=48743e39650eb1ef988380e9d95f27fd40d3a9ce;p=tpg%2Facess2.git diff --git a/KernelLand/Modules/USB/Core/usb.c b/KernelLand/Modules/USB/Core/usb.c index b3195804..9a0e2bca 100644 --- a/KernelLand/Modules/USB/Core/usb.c +++ b/KernelLand/Modules/USB/Core/usb.c @@ -21,6 +21,9 @@ extern tUSBDriver gUSBHub_Driver; tUSBHub *USB_RegisterHost(tUSBHostDef *HostDef, void *ControllerPtr, int nPorts); // === GLOBALS === +tMutex glUSB_Hosts; +tUSBHost *gUSB_Hosts = NULL; +tMutex glUSB_InterfaceDrivers; tUSBDriver *gpUSB_InterfaceDrivers = &gUSBHub_Driver; // === CODE === @@ -40,6 +43,7 @@ tUSBHub *USB_RegisterHost(tUSBHostDef *HostDef, void *ControllerPtr, int nPorts) host->RootHubDev.ParentHub = NULL; host->RootHubDev.Host = host; host->RootHubDev.Address = 0; + host->RootHubDev.EndpointHandles[0] = HostDef->InitControl(ControllerPtr, 0, 64); // host->RootHubIf.Next = NULL; host->RootHubIf.Dev = &host->RootHubDev; @@ -51,9 +55,11 @@ tUSBHub *USB_RegisterHost(tUSBHostDef *HostDef, void *ControllerPtr, int nPorts) host->RootHub.nPorts = nPorts; memset(host->RootHub.Devices, 0, sizeof(void*)*nPorts); - // TODO: Lock + // Append to list + Mutex_Acquire( &glUSB_Hosts ); host->Next = gUSB_Hosts; gUSB_Hosts = host; + Mutex_Release( &glUSB_Hosts ); return &host->RootHub; } @@ -61,7 +67,12 @@ tUSBHub *USB_RegisterHost(tUSBHostDef *HostDef, void *ControllerPtr, int nPorts) // --- Drivers --- void USB_RegisterDriver(tUSBDriver *Driver) { - Log_Warning("USB", "TODO: Implement USB_RegisterDriver"); + Mutex_Acquire( &glUSB_InterfaceDrivers ); + Driver->Next = gpUSB_InterfaceDrivers; + gpUSB_InterfaceDrivers = Driver; + Mutex_Release( &glUSB_InterfaceDrivers ); + + // TODO: Recheck devices that didn't have a driver } tUSBDriver *USB_int_FindDriverByClass(Uint32 ClassCode)