diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2011-06-07 02:05:19 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2011-06-07 02:05:19 +0000 |
commit | 567f7ecce0d04c2406b2379eb34ef3e54178a6d1 (patch) | |
tree | 7a4ba143776c89e2f378d0e99d6fd4c296444ac6 /LUFA/Drivers/USB | |
parent | 2d778a3ff55ace56359bcb9195bb4731a6dd15b5 (diff) | |
download | lufa-567f7ecce0d04c2406b2379eb34ef3e54178a6d1.tar.gz lufa-567f7ecce0d04c2406b2379eb34ef3e54178a6d1.tar.bz2 lufa-567f7ecce0d04c2406b2379eb34ef3e54178a6d1.zip |
Fix errors in the Audio device demos and class driver regarding multiple sample frequency support.
Diffstat (limited to 'LUFA/Drivers/USB')
-rw-r--r-- | LUFA/Drivers/USB/Class/Device/Audio.c | 30 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Device/Audio.h | 4 |
2 files changed, 17 insertions, 17 deletions
diff --git a/LUFA/Drivers/USB/Class/Device/Audio.c b/LUFA/Drivers/USB/Class/Device/Audio.c index f183fdedd..dbf62dae2 100644 --- a/LUFA/Drivers/USB/Class/Device/Audio.c +++ b/LUFA/Drivers/USB/Class/Device/Audio.c @@ -42,9 +42,6 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi if (!(Endpoint_IsSETUPReceived())) return; - if (USB_ControlRequest.wIndex != AudioInterfaceInfo->Config.StreamingInterfaceNumber) - return; - if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_INTERFACE) { if (USB_ControlRequest.wIndex != AudioInterfaceInfo->Config.StreamingInterfaceNumber) @@ -52,13 +49,16 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi } else if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_ENDPOINT) { - if (!((AudioInterfaceInfo->Config.DataINEndpointNumber && - (USB_ControlRequest.wIndex == AudioInterfaceInfo->Config.DataINEndpointNumber)) || - (AudioInterfaceInfo->Config.DataOUTEndpointNumber && - (USB_ControlRequest.wIndex == AudioInterfaceInfo->Config.DataOUTEndpointNumber)))) - { - return; - } + bool EndpointFilterMatch = false; + + EndpointFilterMatch |= (AudioInterfaceInfo->Config.DataINEndpointNumber && + ((uint8_t)USB_ControlRequest.wIndex == (ENDPOINT_DESCRIPTOR_DIR_IN | AudioInterfaceInfo->Config.DataINEndpointNumber))); + + EndpointFilterMatch |= (AudioInterfaceInfo->Config.DataOUTEndpointNumber && + ((uint8_t)USB_ControlRequest.wIndex == (ENDPOINT_DESCRIPTOR_DIR_OUT | AudioInterfaceInfo->Config.DataOUTEndpointNumber))); + + if (!(EndpointFilterMatch)) + return; } switch (USB_ControlRequest.bRequest) @@ -89,10 +89,10 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_ENDPOINT)) { uint8_t EndpointProperty = USB_ControlRequest.bRequest; - uint8_t EndpointIndex = (uint8_t)USB_ControlRequest.wIndex; + uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex; uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8); - if (CALLBACK_Audio_GetSetEndpointProperty(AudioInterfaceInfo, EndpointProperty, EndpointIndex, EndpointControl, NULL, NULL)) + if (CALLBACK_Audio_GetSetEndpointProperty(AudioInterfaceInfo, EndpointProperty, EndpointAddress, EndpointControl, NULL, NULL)) { uint16_t ValueLength = USB_ControlRequest.wLength; uint8_t Value[ValueLength]; @@ -101,7 +101,7 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi Endpoint_Read_Control_Stream_LE(Value, ValueLength); Endpoint_ClearIN(); - CALLBACK_Audio_GetSetEndpointProperty(AudioInterfaceInfo, EndpointProperty, EndpointIndex, EndpointControl, &ValueLength, Value); + CALLBACK_Audio_GetSetEndpointProperty(AudioInterfaceInfo, EndpointProperty, EndpointAddress, EndpointControl, &ValueLength, Value); } } @@ -113,12 +113,12 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_ENDPOINT)) { uint8_t EndpointProperty = USB_ControlRequest.bRequest; - uint8_t EndpointIndex = (uint8_t)USB_ControlRequest.wIndex; + uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex; uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8); uint16_t ValueLength = USB_ControlRequest.wLength; uint8_t Value[ValueLength]; - if (CALLBACK_Audio_GetSetEndpointProperty(AudioInterfaceInfo, EndpointProperty, EndpointIndex, EndpointControl, &ValueLength, Value)) + if (CALLBACK_Audio_GetSetEndpointProperty(AudioInterfaceInfo, EndpointProperty, EndpointAddress, EndpointControl, &ValueLength, Value)) { Endpoint_ClearSETUP(); Endpoint_Write_Control_Stream_LE(Value, ValueLength); diff --git a/LUFA/Drivers/USB/Class/Device/Audio.h b/LUFA/Drivers/USB/Class/Device/Audio.h index ed23683a6..cad87f3b6 100644 --- a/LUFA/Drivers/USB/Class/Device/Audio.h +++ b/LUFA/Drivers/USB/Class/Device/Audio.h @@ -143,7 +143,7 @@ * * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. * \param[in] EndpointProperty Property of the endpoint to get or set, a value from \ref Audio_ClassRequests_t. - * \param[in] EndpointIndex Index of the streaming endpoint whose property is being referenced. + * \param[in] EndpointAddress Address of the streaming endpoint whose property is being referenced. * \param[in] EndpointControl Parameter of the endpoint to get or set, a value from \ref Audio_EndpointControls_t. * \param[in,out] DataLength For SET operations, the length of the parameter data to set. For GET operations, the maximum * length of the retrieved data. When NULL, the function should return whether the given property @@ -155,7 +155,7 @@ */ bool CALLBACK_Audio_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo, const uint8_t EndpointProperty, - const uint8_t EndpointIndex, + const uint8_t EndpointAddress, const uint8_t EndpointControl, uint16_t* const DataLength, uint8_t* Data); |