aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/LowLevel/Host.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-06-18 07:53:51 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-06-18 07:53:51 +0000
commite338cb6f329d6bf948abad88637f81436ee90daf (patch)
tree8363f304c09248929a65f9c3e029340d1dc960b1 /LUFA/Drivers/USB/LowLevel/Host.c
parent2b21a1552d1a5b107120f4ac2e9ac357c999cc34 (diff)
downloadlufa-e338cb6f329d6bf948abad88637f81436ee90daf.tar.gz
lufa-e338cb6f329d6bf948abad88637f81436ee90daf.tar.bz2
lufa-e338cb6f329d6bf948abad88637f81436ee90daf.zip
Added new USB_Host_ClearPipeStall() convenience function to clear a stall condition on an attached device's endpoint.
Added new USB_Host_GetDeviceDescriptor() convenience function to retrieve the attached device's Device descriptor. Make Pipe_ConfigurePipe() mask the given endpoint number against PIPE_EPNUM_MASK to ensure the endpoint IN direction bit is cleared to prevent endpoint type corruption. Fix documentation mentioning Pipe_GetCurrentToken() function when real name is Pipe_GetPipeToken().
Diffstat (limited to 'LUFA/Drivers/USB/LowLevel/Host.c')
-rw-r--r--LUFA/Drivers/USB/LowLevel/Host.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/LUFA/Drivers/USB/LowLevel/Host.c b/LUFA/Drivers/USB/LowLevel/Host.c
index c059b43ac..421719bf8 100644
--- a/LUFA/Drivers/USB/LowLevel/Host.c
+++ b/LUFA/Drivers/USB/LowLevel/Host.c
@@ -302,4 +302,39 @@ uint8_t USB_Host_SetDeviceConfiguration(uint8_t ConfigNumber)
return USB_Host_SendControlRequest(NULL);
}
+uint8_t USB_Host_GetDeviceDescriptor(USB_Descriptor_Device_t* DeviceDescriptorPtr)
+{
+ USB_ControlRequest = (USB_Request_Header_t)
+ {
+ bmRequestType: (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE),
+ bRequest: REQ_GetDescriptor,
+ wValue: (DTYPE_Device << 8),
+ wIndex: 0,
+ wLength: sizeof(USB_Descriptor_Device_t),
+ };
+
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);
+
+ return USB_Host_SendControlRequest(DeviceDescriptorPtr);
+}
+
+uint8_t USB_Host_ClearPipeStall(uint8_t EndpointNum)
+{
+ if (Pipe_GetPipeToken() == PIPE_TOKEN_IN)
+ EndpointNum |= (1 << 7);
+
+ USB_ControlRequest = (USB_Request_Header_t)
+ {
+ .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_ENDPOINT),
+ .bRequest = REQ_ClearFeature,
+ .wValue = FEATURE_ENDPOINT_HALT,
+ .wIndex = EndpointNum,
+ .wLength = 0,
+ };
+
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);
+
+ return USB_Host_SendControlRequest(NULL);
+}
+
#endif