USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
- if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
+ if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN)
DataINEndpoint = EndpointData;
else
DataOUTEndpoint = EndpointData;
if (Pipe_IsStalled())
{
- USB_Host_ClearPipeStall(MSInterfaceInfo->Config.DataOUTPipeNumber);
-
+ USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress());
return PIPE_RWSTREAM_PipeStalled;
}
if (Pipe_IsStalled())
{
- USB_Host_ClearPipeStall(MSInterfaceInfo->Config.DataINPipeNumber);
-
+ USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress());
return PIPE_RWSTREAM_PipeStalled;
}
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),
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,