aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/Class/Host/Audio.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2011-06-08 02:45:32 +0000
committerDean Camera <dean@fourwalledcubicle.com>2011-06-08 02:45:32 +0000
commit0bf5064aec5ac43ba2b25d44528bebb27db2f117 (patch)
treeee5e186bc1a7121e57dd2f37faf9f43b076b2aa5 /LUFA/Drivers/USB/Class/Host/Audio.c
parent34164a5550911277db03bbbc2a604bc59e0bbc99 (diff)
downloadlufa-0bf5064aec5ac43ba2b25d44528bebb27db2f117.tar.gz
lufa-0bf5064aec5ac43ba2b25d44528bebb27db2f117.tar.bz2
lufa-0bf5064aec5ac43ba2b25d44528bebb27db2f117.zip
Pipe_BoundEndpointNumber() has been renamed to Pipe_GetBoundEndpointAddress(), and now returns the correct endpoint direction as part of the endpoint address.
Add Audio_GetSetEndpointProperty() function to the Host mode Audio class driver.
Diffstat (limited to 'LUFA/Drivers/USB/Class/Host/Audio.c')
-rw-r--r--LUFA/Drivers/USB/Class/Host/Audio.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/Audio.c b/LUFA/Drivers/USB/Class/Host/Audio.c
index 7397ef986..0da1eb664 100644
--- a/LUFA/Drivers/USB/Class/Host/Audio.c
+++ b/LUFA/Drivers/USB/Class/Host/Audio.c
@@ -194,7 +194,7 @@ static uint8_t DComp_NextAudioInterfaceDataEndpoint(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_NotFound;
}
-uint8_t AUDIO_Host_StartStopStreaming(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo,
+uint8_t Audio_Host_StartStopStreaming(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo,
bool EnableStreaming)
{
if (!(AudioInterfaceInfo->State.IsActive))
@@ -204,5 +204,37 @@ uint8_t AUDIO_Host_StartStopStreaming(USB_ClassInfo_Audio_Host_t* const AudioInt
EnableStreaming ? AudioInterfaceInfo->State.EnabledStreamingAltIndex : 0);
}
+uint8_t Audio_GetSetEndpointProperty(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo,
+ const uint8_t DataPipeIndex,
+ const uint8_t EndpointProperty,
+ const uint8_t EndpointControl,
+ uint16_t const DataLength,
+ uint8_t* Data)
+{
+ uint8_t RequestType;
+ uint8_t EndpointAddress;
+
+ if (EndpointProperty & 0x80)
+ RequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE);
+ else
+ RequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE);
+
+ Pipe_SelectPipe(DataPipeIndex);
+ EndpointAddress = Pipe_GetBoundEndpointAddress();
+
+ USB_ControlRequest = (USB_Request_Header_t)
+ {
+ .bmRequestType = RequestType,
+ .bRequest = EndpointProperty,
+ .wValue = ((uint16_t)EndpointControl << 8),
+ .wIndex = EndpointAddress,
+ .wLength = DataLength,
+ };
+
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);
+
+ return USB_Host_SendControlRequest(Data);
+}
+
#endif