aboutsummaryrefslogtreecommitdiffstats
path: root/Demos
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2011-06-07 02:05:19 +0000
committerDean Camera <dean@fourwalledcubicle.com>2011-06-07 02:05:19 +0000
commit567f7ecce0d04c2406b2379eb34ef3e54178a6d1 (patch)
tree7a4ba143776c89e2f378d0e99d6fd4c296444ac6 /Demos
parent2d778a3ff55ace56359bcb9195bb4731a6dd15b5 (diff)
downloadlufa-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 'Demos')
-rw-r--r--Demos/Device/ClassDriver/AudioInput/AudioInput.c4
-rw-r--r--Demos/Device/ClassDriver/AudioOutput/AudioOutput.c4
-rw-r--r--Demos/Device/LowLevel/AudioInput/AudioInput.c16
-rw-r--r--Demos/Device/LowLevel/AudioInput/Descriptors.c2
-rw-r--r--Demos/Device/LowLevel/AudioOutput/AudioOutput.c12
-rw-r--r--Demos/Device/LowLevel/AudioOutput/Descriptors.c2
6 files changed, 20 insertions, 20 deletions
diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.c b/Demos/Device/ClassDriver/AudioInput/AudioInput.c
index 1acf20de8..447cb91dd 100644
--- a/Demos/Device/ClassDriver/AudioInput/AudioInput.c
+++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.c
@@ -190,13 +190,13 @@ void EVENT_USB_Device_ControlRequest(void)
*/
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)
{
/* Check the requested endpoint to see if a supported endpoint is being manipulated */
- if (EndpointIndex == Microphone_Audio_Interface.Config.DataINEndpointNumber)
+ if (EndpointAddress == (ENDPOINT_DESCRIPTOR_DIR_IN | Microphone_Audio_Interface.Config.DataINEndpointNumber))
{
/* Check the requested control to see if a supported control is being manipulated */
if (EndpointControl == AUDIO_EPCONTROL_SamplingFreq)
diff --git a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c
index 77727f05e..f1d606070 100644
--- a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c
+++ b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c
@@ -226,13 +226,13 @@ void EVENT_USB_Device_ControlRequest(void)
*/
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)
{
/* Check the requested endpoint to see if a supported endpoint is being manipulated */
- if (EndpointIndex == Speaker_Audio_Interface.Config.DataOUTEndpointNumber)
+ if (EndpointAddress == (ENDPOINT_DESCRIPTOR_DIR_OUT | Speaker_Audio_Interface.Config.DataOUTEndpointNumber))
{
/* Check the requested control to see if a supported control is being manipulated */
if (EndpointControl == AUDIO_EPCONTROL_SamplingFreq)
diff --git a/Demos/Device/LowLevel/AudioInput/AudioInput.c b/Demos/Device/LowLevel/AudioInput/AudioInput.c
index d79167660..e00b693f9 100644
--- a/Demos/Device/LowLevel/AudioInput/AudioInput.c
+++ b/Demos/Device/LowLevel/AudioInput/AudioInput.c
@@ -160,18 +160,18 @@ void EVENT_USB_Device_ControlRequest(void)
case AUDIO_REQ_SetCurrent:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_ENDPOINT))
{
- /* Extract out the relevant request information to get the target Endpoint index and control being set */
- uint8_t EndpointIndex = (uint8_t)USB_ControlRequest.wIndex;
+ /* Extract out the relevant request information to get the target Endpoint address and control being set */
+ uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex;
uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8);
/* Only handle SET CURRENT requests to the audio endpoint's sample frequency property */
- if ((EndpointIndex == AUDIO_STREAM_EPNUM) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq))
+ if ((EndpointAddress == (ENDPOINT_DESCRIPTOR_DIR_IN | AUDIO_STREAM_EPNUM)) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq))
{
uint8_t SampleRate[3];
Endpoint_ClearSETUP();
Endpoint_Read_Control_Stream_LE(SampleRate, sizeof(SampleRate));
- Endpoint_ClearOUT();
+ Endpoint_ClearIN();
/* Set the new sampling frequency to the value given by the host */
CurrentAudioSampleFrequency = (((uint32_t)SampleRate[2] << 16) | ((uint32_t)SampleRate[1] << 8) | (uint32_t)SampleRate[0]);
@@ -183,14 +183,14 @@ void EVENT_USB_Device_ControlRequest(void)
break;
case AUDIO_REQ_GetCurrent:
- if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_ENDPOINT))
+ if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_ENDPOINT))
{
- /* Extract out the relevant request information to get the target Endpoint index and control being retrieved */
- uint8_t EndpointIndex = (uint8_t)USB_ControlRequest.wIndex;
+ /* Extract out the relevant request information to get the target Endpoint address and control being retrieved */
+ uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex;
uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8);
/* Only handle GET CURRENT requests to the audio endpoint's sample frequency property */
- if ((EndpointIndex == AUDIO_STREAM_EPNUM) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq))
+ if ((EndpointAddress == (ENDPOINT_DESCRIPTOR_DIR_IN | AUDIO_STREAM_EPNUM)) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq))
{
uint8_t SampleRate[3];
diff --git a/Demos/Device/LowLevel/AudioInput/Descriptors.c b/Demos/Device/LowLevel/AudioInput/Descriptors.c
index 10959074a..04f2524f6 100644
--- a/Demos/Device/LowLevel/AudioInput/Descriptors.c
+++ b/Demos/Device/LowLevel/AudioInput/Descriptors.c
@@ -235,7 +235,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Spc_t), .Type = DTYPE_CSEndpoint},
.Subtype = AUDIO_DSUBTYPE_CSEndpoint_General,
- .Attributes = AUDIO_EP_ACCEPTS_SMALL_PACKETS,
+ .Attributes = (AUDIO_EP_ACCEPTS_SMALL_PACKETS | AUDIO_EP_SAMPLE_FREQ_CONTROL),
.LockDelayUnits = 0x00,
.LockDelay = 0x0000
diff --git a/Demos/Device/LowLevel/AudioOutput/AudioOutput.c b/Demos/Device/LowLevel/AudioOutput/AudioOutput.c
index c5d936300..fcc3d5abd 100644
--- a/Demos/Device/LowLevel/AudioOutput/AudioOutput.c
+++ b/Demos/Device/LowLevel/AudioOutput/AudioOutput.c
@@ -186,12 +186,12 @@ void EVENT_USB_Device_ControlRequest(void)
case AUDIO_REQ_SetCurrent:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_ENDPOINT))
{
- /* Extract out the relevant request information to get the target Endpoint index and control being set */
- uint8_t EndpointIndex = (uint8_t)USB_ControlRequest.wIndex;
+ /* Extract out the relevant request information to get the target Endpoint address and control being set */
+ uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex;
uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8);
/* Only handle SET CURRENT requests to the audio endpoint's sample frequency property */
- if ((EndpointIndex == AUDIO_STREAM_EPNUM) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq))
+ if ((EndpointAddress == (ENDPOINT_DESCRIPTOR_DIR_OUT | AUDIO_STREAM_EPNUM)) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq))
{
uint8_t SampleRate[3];
@@ -211,12 +211,12 @@ void EVENT_USB_Device_ControlRequest(void)
case AUDIO_REQ_GetCurrent:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_ENDPOINT))
{
- /* Extract out the relevant request information to get the target Endpoint index and control being retrieved */
- uint8_t EndpointIndex = (uint8_t)USB_ControlRequest.wIndex;
+ /* Extract out the relevant request information to get the target Endpoint address and control being retrieved */
+ uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex;
uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8);
/* Only handle GET CURRENT requests to the audio endpoint's sample frequency property */
- if ((EndpointIndex == AUDIO_STREAM_EPNUM) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq))
+ if ((EndpointAddress == (ENDPOINT_DESCRIPTOR_DIR_OUT | AUDIO_STREAM_EPNUM)) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq))
{
uint8_t SampleRate[3];
diff --git a/Demos/Device/LowLevel/AudioOutput/Descriptors.c b/Demos/Device/LowLevel/AudioOutput/Descriptors.c
index a86eee75c..0a6ec6d68 100644
--- a/Demos/Device/LowLevel/AudioOutput/Descriptors.c
+++ b/Demos/Device/LowLevel/AudioOutput/Descriptors.c
@@ -235,7 +235,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Spc_t), .Type = DTYPE_CSEndpoint},
.Subtype = AUDIO_DSUBTYPE_CSEndpoint_General,
- .Attributes = AUDIO_EP_ACCEPTS_SMALL_PACKETS,
+ .Attributes = (AUDIO_EP_ACCEPTS_SMALL_PACKETS | AUDIO_EP_SAMPLE_FREQ_CONTROL),
.LockDelayUnits = 0x00,
.LockDelay = 0x0000