From bb23e55f11a42f6214757483d010ebd24377caeb Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Tue, 23 Jun 2009 08:45:46 +0000 Subject: [PATCH] Fixed MassStorage demo not clearing the reset flag when a Mass Storage Reset is issued while not processing a command. --- Demos/Device/LowLevel/MassStorage/MassStorage.c | 6 +++--- Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c | 1 + LUFA/Drivers/USB/Class/Device/MassStorage.c | 4 ++-- LUFA/Drivers/USB/LowLevel/Pipe.c | 3 +-- LUFA/ManPages/ChangeLog.txt | 2 ++ 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Demos/Device/LowLevel/MassStorage/MassStorage.c b/Demos/Device/LowLevel/MassStorage/MassStorage.c index 3f992c2250..f0984a2b3c 100644 --- a/Demos/Device/LowLevel/MassStorage/MassStorage.c +++ b/Demos/Device/LowLevel/MassStorage/MassStorage.c @@ -218,9 +218,6 @@ void MassStorage_Task(void) Endpoint_ClearStall(); Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPNUM); Endpoint_ClearStall(); - - /* Clear the abort transfer flag */ - IsMassStoreReset = false; } /* Indicate ready */ @@ -232,6 +229,9 @@ void MassStorage_Task(void) LEDs_SetAllLEDs(LEDMASK_USB_ERROR); } } + + /* Clear the abort transfer flag */ + IsMassStoreReset = false; } } diff --git a/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c b/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c index c524b5387e..b89ad19697 100644 --- a/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c +++ b/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c @@ -90,6 +90,7 @@ static uint8_t MassStore_SendCommand(void) /* Send the data in the OUT pipe to the attached device */ Pipe_ClearOUT(); + /* Wait until command has been sent */ while(!(Pipe_IsOUTReady())); /* Freeze pipe after use */ diff --git a/LUFA/Drivers/USB/Class/Device/MassStorage.c b/LUFA/Drivers/USB/Class/Device/MassStorage.c index a70ed68ce0..073111e647 100644 --- a/LUFA/Drivers/USB/Class/Device/MassStorage.c +++ b/LUFA/Drivers/USB/Class/Device/MassStorage.c @@ -131,11 +131,11 @@ void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* MSInterfaceInfo) Endpoint_ClearStall(); Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber); Endpoint_ClearStall(); - - MSInterfaceInfo->State.IsMassStoreReset = false; } } } + + MSInterfaceInfo->State.IsMassStoreReset = false; } static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* MSInterfaceInfo) diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.c b/LUFA/Drivers/USB/LowLevel/Pipe.c index aead39dc50..1376de4952 100644 --- a/LUFA/Drivers/USB/LowLevel/Pipe.c +++ b/LUFA/Drivers/USB/LowLevel/Pipe.c @@ -48,8 +48,7 @@ bool Pipe_ConfigurePipe(const uint8_t Number, const uint8_t Type, const uint8_t UPCFG0X = ((Type << EPTYPE0) | Token | ((EndpointNumber & PIPE_EPNUM_MASK) << PEPNUM0)); UPCFG1X = ((1 << ALLOC) | Banks | Pipe_BytesToEPSizeMask(Size)); - if (Token == PIPE_TOKEN_IN) - Pipe_SetInfiniteINRequests(); + Pipe_SetInfiniteINRequests(); return Pipe_IsConfigured(); } diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt index 3843941e72..34fe109941 100644 --- a/LUFA/ManPages/ChangeLog.txt +++ b/LUFA/ManPages/ChangeLog.txt @@ -31,9 +31,11 @@ * - Added new USE_INTERNAL_SERIAL define for using the unique serial numbers in some AVR models as the USB device's serial number, * added NO_INTERNAL_SERIAL compile time option to turn off new serial number reading code * - Fixed ADC driver for the ATMEGA32U4 and ATMEGA16U4 (thanks to Opendous Inc.) + * - Fixed CDCHost demo unfreezing the pipes at the point of configuration, rather than use * - Pipe stream functions now automatically set the correct pipe token, so that bidirectional pipes can be used * - Pipe_ConfigurePipe() now automatically defaults IN pipes to accepting infinite IN requests, this can still be changed by calling * the existing \ref Pipe_SetFiniteINRequests() function + * - Fixed MassStorage demo not clearing the reset flag when a Mass Storage Reset is issued while not processing a command * * * \section Sec_ChangeLog090605 Version 090605