From 5820336c4ed8897316d3d2cbd2c0f1b6f204f9a8 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Wed, 8 Feb 2012 14:21:22 +0800 Subject: [PATCH] USB - Cleaning a little --- KernelLand/Modules/USB/Core/include/usb_core.h | 2 ++ KernelLand/Modules/USB/Core/usb.c | 6 ++++++ KernelLand/Modules/USB/Core/usb_lowlevel.c | 3 ++- KernelLand/Modules/USB/Core/usb_poll.c | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/KernelLand/Modules/USB/Core/include/usb_core.h b/KernelLand/Modules/USB/Core/include/usb_core.h index 43af16f2..d0f449fb 100644 --- a/KernelLand/Modules/USB/Core/include/usb_core.h +++ b/KernelLand/Modules/USB/Core/include/usb_core.h @@ -51,6 +51,8 @@ struct sUSBDriver } Endpoints[]; }; +extern void USB_RegisterDriver(tUSBDriver *Driver); + extern void *USB_GetDeviceDataPtr(tUSBInterface *Dev); extern void USB_SetDeviceDataPtr(tUSBInterface *Dev, void *Ptr); diff --git a/KernelLand/Modules/USB/Core/usb.c b/KernelLand/Modules/USB/Core/usb.c index b3195804..405a5081 100644 --- a/KernelLand/Modules/USB/Core/usb.c +++ b/KernelLand/Modules/USB/Core/usb.c @@ -24,6 +24,12 @@ tUSBHub *USB_RegisterHost(tUSBHostDef *HostDef, void *ControllerPtr, int nPorts) tUSBDriver *gpUSB_InterfaceDrivers = &gUSBHub_Driver; // === CODE === +void USB_RegisterDriver(tUSBDriver *Driver) +{ + Driver->Next = gpUSB_InterfaceDrivers; + gpUSB_InterfaceDrivers = Driver; +} + tUSBHub *USB_RegisterHost(tUSBHostDef *HostDef, void *ControllerPtr, int nPorts) { tUSBHost *host; diff --git a/KernelLand/Modules/USB/Core/usb_lowlevel.c b/KernelLand/Modules/USB/Core/usb_lowlevel.c index 0e53bad9..d8e1485a 100644 --- a/KernelLand/Modules/USB/Core/usb_lowlevel.c +++ b/KernelLand/Modules/USB/Core/usb_lowlevel.c @@ -10,6 +10,7 @@ #include "usb.h" #include "usb_proto.h" #include "usb_lowlevel.h" +#include // === PROTOTYPES === void *USB_int_Request(tUSBHost *Host, int Addr, int EndPt, int Type, int Req, int Val, int Indx, int Len, void *Data); @@ -112,7 +113,7 @@ int USB_int_ReadDescriptor(tUSBDevice *Dev, int Endpoint, int Type, int Index, i ); while( Dev->Host->HostDef->IsOpComplete(Dev->Host->Ptr, final) == 0 ) - Time_Delay(1); + Threads_Yield(); return 0; } diff --git a/KernelLand/Modules/USB/Core/usb_poll.c b/KernelLand/Modules/USB/Core/usb_poll.c index b6927fed..84703f84 100644 --- a/KernelLand/Modules/USB/Core/usb_poll.c +++ b/KernelLand/Modules/USB/Core/usb_poll.c @@ -8,6 +8,7 @@ #define DEBUG 1 #include #include "usb.h" +#include #define POLL_ATOM 25 // 25ms atom #define POLL_MAX 256 // Max period that can be nominated -- 2.20.1