{\r
/* Find a new Audio Control interface if the current one doesn't contain a compatible streaming interface */\r
if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,\r
- DComp_NextAudioControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextAudioControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoCompatibleInterfaceFound;\r
\r
/* Find the next Audio Streaming interface within that Audio Control interface */\r
if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,\r
- DComp_NextAudioStreamInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextAudioStreamInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoCompatibleInterfaceFound;\r
/* Check if we haven't found an Audio Control interface yet, or if we have run out of related Audio Streaming interfaces */\r
if (!(AudioControlInterface) ||\r
USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,\r
- DComp_NextAudioStreamInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextAudioStreamInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Find a new Audio Control interface if the current one doesn't contain a compatible streaming interface */\r
if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,\r
- DComp_NextAudioControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextAudioControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoCompatibleInterfaceFound;\r
\r
/* Find the next Audio Streaming interface within that Audio Control interface */\r
if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,\r
- DComp_NextAudioStreamInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextAudioStreamInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoCompatibleInterfaceFound;\r
DComp_NextAudioStreamInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- DComp_NextAudioControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextAudioControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
return AUDIO_ENUMERROR_NoCompatibleInterfaceFound;\r
}\r
AudioControlInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t); \r
\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- DComp_NextAudioStreamInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ DComp_NextAudioStreamInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
return AUDIO_ENUMERROR_NoCompatibleInterfaceFound;\r
}\r
Size = DataINEndpoint->EndpointSize;\r
EndpointAddress = DataINEndpoint->EndpointAddress;\r
Token = PIPE_TOKEN_IN;\r
- Type = EP_TYPE_BULK;\r
+ Type = EP_TYPE_ISOCHRONOUS;\r
DoubleBanked = true;\r
\r
AudioInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;\r
uint16_t const DataLength,\r
void* const Data)\r
{\r
+ if (!(AudioInterfaceInfo->State.IsActive))\r
+ return HOST_SENDCONTROL_DeviceDisconnected;\r
+\r
uint8_t RequestType;\r
uint8_t EndpointAddress;\r
\r
{\r
const struct\r
{\r
- uint8_t DataINPipeNumber; /**< Pipe number of the Audio interface's IN data pipe. */\r
- uint8_t DataOUTPipeNumber; /**< Pipe number of the Audio interface's OUT data pipe. */\r
+ uint8_t DataINPipeNumber; /**< Pipe number of the Audio interface's IN data pipe. If this interface should not\r
+ * bind to an IN endpoint, this may be set to 0 to disable audio input streaming for\r
+ * this driver instance.\r
+ */\r
+ uint8_t DataOUTPipeNumber; /**< Pipe number of the Audio interface's OUT data pipe. If this interface should not\r
+ * bind to an OUT endpoint, this may be set to 0 to disable audio output streaming for\r
+ * this driver instance.\r
+ */\r
} Config; /**< Config data for the USB class interface within the device. All elements in this section\r
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.\r
*/\r
{\r
Pipe_Write_8(Sample);\r
\r
- if (Pipe_BytesInPipe() == AudioInterfaceInfo->State.DataOUTPipeSize)\r
+ if (!(Pipe_IsReadWriteAllowed()))\r
{\r
Pipe_Unfreeze();\r
Pipe_ClearOUT();\r
+ Pipe_WaitUntilReady();\r
Pipe_Freeze();\r
}\r
}\r
{\r
Pipe_Write_16_LE(Sample);\r
\r
- if (Pipe_BytesInPipe() == AudioInterfaceInfo->State.DataOUTPipeSize)\r
+ if (!(Pipe_IsReadWriteAllowed()))\r
{\r
Pipe_Unfreeze();\r
Pipe_ClearOUT();\r
+ Pipe_WaitUntilReady();\r
Pipe_Freeze();\r
}\r
}\r
Pipe_Write_16_LE(Sample);\r
Pipe_Write_8(Sample >> 16);\r
\r
- if (Pipe_BytesInPipe() == AudioInterfaceInfo->State.DataOUTPipeSize)\r
+ if (!(Pipe_IsReadWriteAllowed()))\r
{\r
Pipe_Unfreeze();\r
Pipe_ClearOUT();\r
+ Pipe_WaitUntilReady();\r
Pipe_Freeze();\r
}\r
}\r