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.
This commit is contained in:
Dean Camera 2011-06-08 02:45:32 +00:00
parent 34164a5550
commit 0bf5064aec
9 changed files with 82 additions and 37 deletions

View file

@ -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