diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-09-05 07:11:53 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-09-05 07:11:53 +0000 |
commit | 18cbd31605dae070f00900161090a72d3eb0f8ab (patch) | |
tree | 1166a9c1b27630111d337b76a0eee1292b0d633b /LUFA/Drivers/USB/Class/Host/MassStorage.c | |
parent | 0174d8ea70f3d7180e6ea3da2b3720273adb33d9 (diff) | |
download | lufa-18cbd31605dae070f00900161090a72d3eb0f8ab.tar.gz lufa-18cbd31605dae070f00900161090a72d3eb0f8ab.tar.bz2 lufa-18cbd31605dae070f00900161090a72d3eb0f8ab.zip |
Added new USB_Device_GetFrameNumber() and USB_Host_GetFrameNumber() functions to retrieve the current USB frame number.
Added new USB_Host_EnableSOFEvents(), USB_Host_DisableSOFEvents() and EVENT_USB_Host_StartOfFrame() for the user application handling of USB Start of Frame events while in USB Host mode.
Changed over all demos, drivers and internal functions to use the current frame number over the Start of Frame flag where possible to free up the Start of Frame flag for interrupt use in the user application.
Diffstat (limited to 'LUFA/Drivers/USB/Class/Host/MassStorage.c')
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/MassStorage.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.c b/LUFA/Drivers/USB/Class/Host/MassStorage.c index 14b7741db..dfa954c5c 100644 --- a/LUFA/Drivers/USB/Class/Host/MassStorage.c +++ b/LUFA/Drivers/USB/Class/Host/MassStorage.c @@ -166,19 +166,21 @@ static uint8_t MS_Host_SendCommand(USB_ClassInfo_MS_Host_t* const MSInterfaceInf static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) { - uint16_t TimeoutMSRem = COMMAND_DATA_TIMEOUT_MS; + uint16_t TimeoutMSRem = COMMAND_DATA_TIMEOUT_MS; + uint16_t PreviousFrameNumber = USB_Host_GetFrameNumber(); Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber); Pipe_Unfreeze(); while (!(Pipe_IsINReceived())) { - if (USB_INT_HasOccurred(USB_INT_HSOFI)) + uint16_t CurrentFrameNumber = USB_Host_GetFrameNumber(); + + if (CurrentFrameNumber != PreviousFrameNumber) { - USB_INT_Clear(USB_INT_HSOFI); - TimeoutMSRem--; + PreviousFrameNumber = CurrentFrameNumber; - if (!(TimeoutMSRem)) + if (!(TimeoutMSRem--)) return PIPE_RWSTREAM_Timeout; } |