diff options
| author | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2010-09-19 05:46:17 +0000 |
|---|---|---|
| committer | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2010-09-19 05:46:17 +0000 |
| commit | 19c64c52cdbc6189366921445861333689b1f603 (patch) | |
| tree | 70077edc3850e20b9e680ba533155bada92cf079 /LUFA/Drivers/USB/LowLevel/Host.c | |
| parent | c833b03ef0447798cdb28bc41c9e44cf926c0262 (diff) | |
Ensure device address latch bit is not set at the same time as the new address, as per datasheet.
Minor documentation fixes.
Fix broken USB host mode due to the USB frame counter not being updated during the early enumeration steps, causing USB_Host_DelayMS() to spinloop forever.
git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@1485 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'LUFA/Drivers/USB/LowLevel/Host.c')
| -rw-r--r-- | LUFA/Drivers/USB/LowLevel/Host.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/LUFA/Drivers/USB/LowLevel/Host.c b/LUFA/Drivers/USB/LowLevel/Host.c index 2b66e28b..6c66083a 100644 --- a/LUFA/Drivers/USB/LowLevel/Host.c +++ b/LUFA/Drivers/USB/LowLevel/Host.c @@ -194,19 +194,21 @@ void USB_Host_ProcessNextHostState(void) uint8_t USB_Host_WaitMS(uint8_t MS) { - bool BusSuspended = USB_Host_IsBusSuspended(); - uint8_t ErrorCode = HOST_WAITERROR_Successful; - uint16_t PreviousFrameNumber = USB_Host_GetFrameNumber(); + bool BusSuspended = USB_Host_IsBusSuspended(); + uint8_t ErrorCode = HOST_WAITERROR_Successful; USB_Host_ResumeBus(); + bool HSOFIEnabled = USB_INT_IsEnabled(USB_INT_HSOFI); + + USB_INT_Disable(USB_INT_HSOFI); + USB_INT_Clear(USB_INT_HSOFI); + while (MS) { - uint16_t CurrentFrameNumber = USB_Host_GetFrameNumber(); - - if (CurrentFrameNumber != PreviousFrameNumber) + if (USB_INT_HasOccurred(USB_INT_HSOFI)) { - PreviousFrameNumber = CurrentFrameNumber; + USB_INT_Clear(USB_INT_HSOFI); MS--; } @@ -234,6 +236,9 @@ uint8_t USB_Host_WaitMS(uint8_t MS) } } + if (HSOFIEnabled) + USB_INT_Enable(USB_INT_HSOFI); + if (BusSuspended) USB_Host_SuspendBus(); |
