Commit deaab900 authored by Dean Camera's avatar Dean Camera
Browse files

Ensure that only the requested Audio class pipes are mapped to endpoints...

Ensure that only the requested Audio class pipes are mapped to endpoints within the device for a specific Audio Host Class driver instance.

Fix const-correctness of the Audio Host Class driver.
parent 6e0a2608
...@@ -104,7 +104,7 @@ int main(void) ...@@ -104,7 +104,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval; USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break; break;
} }
USB_Audio_SampleFreq_t SampleRate = AUDIO_SAMPLE_FREQ(48000); USB_Audio_SampleFreq_t SampleRate = AUDIO_SAMPLE_FREQ(48000);
if (Audio_GetSetEndpointProperty(&Microphone_Audio_Interface, Microphone_Audio_Interface.Config.DataINPipeNumber, if (Audio_GetSetEndpointProperty(&Microphone_Audio_Interface, Microphone_Audio_Interface.Config.DataINPipeNumber,
AUDIO_REQ_SetCurrent, AUDIO_EPCONTROL_SamplingFreq, AUDIO_REQ_SetCurrent, AUDIO_EPCONTROL_SamplingFreq,
......
...@@ -51,7 +51,8 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa ...@@ -51,7 +51,8 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa
if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration) if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)
return AUDIO_ENUMERROR_InvalidConfigDescriptor; return AUDIO_ENUMERROR_InvalidConfigDescriptor;
while (!(DataINEndpoint) || !(DataOUTEndpoint)) while ((AudioInterfaceInfo->Config.DataINPipeNumber && !(DataINEndpoint)) ||
(AudioInterfaceInfo->Config.DataOUTPipeNumber && !(DataOUTEndpoint)))
{ {
if (!(AudioControlInterface) || if (!(AudioControlInterface) ||
USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
...@@ -77,6 +78,9 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa ...@@ -77,6 +78,9 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa
} }
AudioStreamingInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t); AudioStreamingInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);
DataINEndpoint = NULL;
DataOUTEndpoint = NULL;
continue; continue;
} }
...@@ -195,7 +199,7 @@ static uint8_t DComp_NextAudioInterfaceDataEndpoint(void* CurrentDescriptor) ...@@ -195,7 +199,7 @@ static uint8_t DComp_NextAudioInterfaceDataEndpoint(void* CurrentDescriptor)
} }
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) const bool EnableStreaming)
{ {
if (!(AudioInterfaceInfo->State.IsActive)) if (!(AudioInterfaceInfo->State.IsActive))
return HOST_SENDCONTROL_DeviceDisconnected; return HOST_SENDCONTROL_DeviceDisconnected;
...@@ -208,7 +212,7 @@ uint8_t Audio_GetSetEndpointProperty(USB_ClassInfo_Audio_Host_t* const AudioInte ...@@ -208,7 +212,7 @@ uint8_t Audio_GetSetEndpointProperty(USB_ClassInfo_Audio_Host_t* const AudioInte
const uint8_t DataPipeIndex, const uint8_t DataPipeIndex,
const uint8_t EndpointProperty, const uint8_t EndpointProperty,
const uint8_t EndpointControl, const uint8_t EndpointControl,
uint16_t const DataLength, const uint16_t DataLength,
void* const Data) void* const Data)
{ {
if (!(AudioInterfaceInfo->State.IsActive)) if (!(AudioInterfaceInfo->State.IsActive))
......
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum. * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum.
*/ */
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); const bool EnableStreaming);
/** Gets or sets the specified property of a streaming audio class endpoint that is bound to a pipe in the given /** Gets or sets the specified property of a streaming audio class endpoint that is bound to a pipe in the given
* class instance. * class instance.
...@@ -165,7 +165,7 @@ ...@@ -165,7 +165,7 @@
const uint8_t DataPipeIndex, const uint8_t DataPipeIndex,
const uint8_t EndpointProperty, const uint8_t EndpointProperty,
const uint8_t EndpointControl, const uint8_t EndpointControl,
uint16_t const DataLength, const uint16_t DataLength,
void* const Data); void* const Data);
/* Inline Functions: */ /* Inline Functions: */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment