diff options
author | Dean Camera <[email protected]> | 2010-10-12 12:22:11 +0000 |
---|---|---|
committer | Dean Camera <[email protected]> | 2010-10-12 12:22:11 +0000 |
commit | 7aaced1e8bc81ebbf0a1f06fc443ea4707edd1dd (patch) | |
tree | 22251cc704e7d6c209e529727910838f0705145e /LUFA/Drivers/USB/LowLevel/Host.c | |
parent | c1cfffd8eb92aedde76439afa30d8584c4c60043 (diff) | |
download | qmk_firmware-7aaced1e8bc81ebbf0a1f06fc443ea4707edd1dd.tar.gz qmk_firmware-7aaced1e8bc81ebbf0a1f06fc443ea4707edd1dd.zip |
Remove USB_MODE_* macros, replace with a semantically linked USB_Modes_t enum.
Moved the USB device selection logic for ENDPOINT_TOTAL_ENDPOINTS further up in Endpoint.h to where the endpoint bank capabilities are determined, to reduce the total number of device-specific logic.
Change USB_Host_WaitMS() to test and disable the HSOFI interrupt before resuming the bus, so that it does not fire before the delay loop has run.
Add missing const qualifier to the parameter of USB_Host_ClearPipeStall().
Diffstat (limited to 'LUFA/Drivers/USB/LowLevel/Host.c')
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/Host.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/LUFA/Drivers/USB/LowLevel/Host.c b/LUFA/Drivers/USB/LowLevel/Host.c index 1d7faa1970..1fa5290fc0 100644 --- a/LUFA/Drivers/USB/LowLevel/Host.c +++ b/LUFA/Drivers/USB/LowLevel/Host.c @@ -196,14 +196,13 @@ uint8_t USB_Host_WaitMS(uint8_t MS) { bool BusSuspended = USB_Host_IsBusSuspended(); uint8_t ErrorCode = HOST_WAITERROR_Successful; + bool HSOFIEnabled = USB_INT_IsEnabled(USB_INT_HSOFI); - USB_Host_ResumeBus(); - - bool HSOFIEnabled = USB_INT_IsEnabled(USB_INT_HSOFI); - USB_INT_Disable(USB_INT_HSOFI); USB_INT_Clear(USB_INT_HSOFI); + USB_Host_ResumeBus(); + while (MS) { if (USB_INT_HasOccurred(USB_INT_HSOFI)) @@ -212,7 +211,7 @@ uint8_t USB_Host_WaitMS(uint8_t MS) MS--; } - if ((USB_HostState == HOST_STATE_Unattached) || (USB_CurrentMode == USB_MODE_DEVICE)) + if ((USB_HostState == HOST_STATE_Unattached) || (USB_CurrentMode != USB_MODE_Host)) { ErrorCode = HOST_WAITERROR_DeviceDisconnect; @@ -236,12 +235,12 @@ uint8_t USB_Host_WaitMS(uint8_t MS) } } - if (HSOFIEnabled) - USB_INT_Enable(USB_INT_HSOFI); - if (BusSuspended) USB_Host_SuspendBus(); + if (HSOFIEnabled) + USB_INT_Enable(USB_INT_HSOFI); + return ErrorCode; } @@ -336,7 +335,7 @@ uint8_t USB_Host_GetDeviceStringDescriptor(const uint8_t Index, return USB_Host_SendControlRequest(Buffer); } -uint8_t USB_Host_ClearPipeStall(uint8_t EndpointNum) +uint8_t USB_Host_ClearPipeStall(const uint8_t EndpointNum) { USB_ControlRequest = (USB_Request_Header_t) { |