diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2011-08-24 09:50:21 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2011-08-24 09:50:21 +0000 |
commit | a233109909f0e8d3cf578733f088a20474b3c43f (patch) | |
tree | 7e7c3fbfacec8914e164c1ac46a46a8fd59ba748 /LUFA/Drivers/USB | |
parent | cff190b8f47416698f3783e1e7711f0864713f73 (diff) | |
download | lufa-a233109909f0e8d3cf578733f088a20474b3c43f.tar.gz lufa-a233109909f0e8d3cf578733f088a20474b3c43f.tar.bz2 lufa-a233109909f0e8d3cf578733f088a20474b3c43f.zip |
Renamed USB_Host_ClearPipeStall() to USB_Host_ClearEndpointStall() as the function works on an endpoint address within the attached device, and not a Pipe within the host.
Updated MS_Host_ResetMSInterface() to now perform a full Mass Storage reset sequence to prevent data corruption in the event of a device lock up or timeout (thanks to David Lyons).
Add parenthesis around the library Endianness macros that do nothing on a particular architecture to prevent operator precedence issues depending on usage.
Minor documentation corrections.
Diffstat (limited to 'LUFA/Drivers/USB')
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/MassStorage.c | 23 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/StillImage.c | 4 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h | 2 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/HostStandardReq.c | 2 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/HostStandardReq.h | 2 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/StdDescriptors.h | 3 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h | 2 |
7 files changed, 26 insertions, 12 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.c b/LUFA/Drivers/USB/Class/Host/MassStorage.c index 60195e987..36503bf45 100644 --- a/LUFA/Drivers/USB/Class/Host/MassStorage.c +++ b/LUFA/Drivers/USB/Class/Host/MassStorage.c @@ -226,8 +226,7 @@ static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInte if (Pipe_IsStalled()) { - USB_Host_ClearPipeStall(MSInterfaceInfo->Config.DataOUTPipeNumber); - + USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress()); return PIPE_RWSTREAM_PipeStalled; } @@ -237,8 +236,7 @@ static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInte if (Pipe_IsStalled()) { - USB_Host_ClearPipeStall(MSInterfaceInfo->Config.DataINPipeNumber); - + USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress()); return PIPE_RWSTREAM_PipeStalled; } @@ -328,6 +326,8 @@ static uint8_t MS_Host_GetReturnedStatus(USB_ClassInfo_MS_Host_t* const MSInterf uint8_t MS_Host_ResetMSInterface(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) { + uint8_t ErrorCode; + USB_ControlRequest = (USB_Request_Header_t) { .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), @@ -339,7 +339,20 @@ uint8_t MS_Host_ResetMSInterface(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) Pipe_SelectPipe(PIPE_CONTROLPIPE); - return USB_Host_SendControlRequest(NULL); + if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful) + return ErrorCode; + + Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber); + + if ((ErrorCode = USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress())) != HOST_SENDCONTROL_Successful) + return ErrorCode; + + Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipeNumber); + + if ((ErrorCode = USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress())) != HOST_SENDCONTROL_Successful) + return ErrorCode; + + return HOST_SENDCONTROL_Successful; } uint8_t MS_Host_GetMaxLUN(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.c b/LUFA/Drivers/USB/Class/Host/StillImage.c index 64cae45f6..48aa86431 100644 --- a/LUFA/Drivers/USB/Class/Host/StillImage.c +++ b/LUFA/Drivers/USB/Class/Host/StillImage.c @@ -254,7 +254,7 @@ uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf if (Pipe_IsStalled()) { - USB_Host_ClearPipeStall(SIInterfaceInfo->Config.DataOUTPipeNumber); + USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress()); return PIPE_RWSTREAM_PipeStalled; } @@ -264,7 +264,7 @@ uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf if (Pipe_IsStalled()) { - USB_Host_ClearPipeStall(SIInterfaceInfo->Config.DataINPipeNumber); + USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress()); return PIPE_RWSTREAM_PipeStalled; } diff --git a/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h index 2d9972260..40eebef75 100644 --- a/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h +++ b/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h @@ -860,7 +860,7 @@ const uint16_t Size, const uint8_t Banks); - /** Spin-loops until the currently selected non-control pipe is ready for the next packed of data to be read + /** Spin-loops until the currently selected non-control pipe is ready for the next packet of data to be read * or written to it, aborting in the case of an error condition (such as a timeout or device disconnect). * * \ingroup Group_PipeRW_AVR8 diff --git a/LUFA/Drivers/USB/Core/HostStandardReq.c b/LUFA/Drivers/USB/Core/HostStandardReq.c index 3da222086..5bbe5d3fd 100644 --- a/LUFA/Drivers/USB/Core/HostStandardReq.c +++ b/LUFA/Drivers/USB/Core/HostStandardReq.c @@ -254,7 +254,7 @@ uint8_t USB_Host_GetDeviceStatus(uint8_t* const FeatureStatus) return USB_Host_SendControlRequest(FeatureStatus); } -uint8_t USB_Host_ClearPipeStall(const uint8_t EndpointAddress) +uint8_t USB_Host_ClearEndpointStall(const uint8_t EndpointAddress) { USB_ControlRequest = (USB_Request_Header_t) { diff --git a/LUFA/Drivers/USB/Core/HostStandardReq.h b/LUFA/Drivers/USB/Core/HostStandardReq.h index 7ef439d84..ba8d7be4e 100644 --- a/LUFA/Drivers/USB/Core/HostStandardReq.h +++ b/LUFA/Drivers/USB/Core/HostStandardReq.h @@ -177,7 +177,7 @@ * * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. */ - uint8_t USB_Host_ClearPipeStall(const uint8_t EndpointAddress); + uint8_t USB_Host_ClearEndpointStall(const uint8_t EndpointAddress); /** Selects a given alternative setting for the specified interface, via a SET INTERFACE standard request to * the attached device. diff --git a/LUFA/Drivers/USB/Core/StdDescriptors.h b/LUFA/Drivers/USB/Core/StdDescriptors.h index fc79483cf..a37ea09e7 100644 --- a/LUFA/Drivers/USB/Core/StdDescriptors.h +++ b/LUFA/Drivers/USB/Core/StdDescriptors.h @@ -681,7 +681,8 @@ * Under GCC, strings prefixed with the "L" character (before * the opening string quotation mark) are considered to be * Unicode strings, and may be used instead of an explicit - * array of ASCII characters. + * array of ASCII characters on little endian devices with + * UTF-16-LE \c wchar_t encoding. */ #endif } ATTR_PACKED USB_Descriptor_String_t; diff --git a/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h b/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h index f8700383c..044dead1a 100644 --- a/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h +++ b/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h @@ -871,7 +871,7 @@ const uint16_t Size, const uint8_t Banks); - /** Spin-loops until the currently selected non-control pipe is ready for the next packed of data to be read + /** Spin-loops until the currently selected non-control pipe is ready for the next packet of data to be read * or written to it, aborting in the case of an error condition (such as a timeout or device disconnect). * * \ingroup Group_PipeRW_UC3 |