X-Git-Url: http://git.linex4red.de/pub/lufa.git/blobdiff_plain/e572ee7ff271a3f454fcd8a5fb0d2079bbda4be2..6e0a26083ad76d2cea5aa934b530fdd8d6f4e7c1:/LUFA/Drivers/USB/Class/Host/Audio.h?ds=sidebyside
diff --git a/LUFA/Drivers/USB/Class/Host/Audio.h b/LUFA/Drivers/USB/Class/Host/Audio.h
index 23523144b..26d537614 100644
--- a/LUFA/Drivers/USB/Class/Host/Audio.h
+++ b/LUFA/Drivers/USB/Class/Host/Audio.h
@@ -29,23 +29,23 @@
*/
/** \file
- * \brief Host mode driver for the library USB Audio Class driver.
+ * \brief Host mode driver for the library USB Audio 1.0 Class driver.
*
- * Host mode driver for the library USB Audio Class driver.
+ * Host mode driver for the library USB Audio 1.0 Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassAudio
- * \defgroup Group_USBClassAudioHost Audio Class Host Mode Driver
+ * \defgroup Group_USBClassAudioHost Audio 1.0 Class Host Mode Driver
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - LUFA/Drivers/USB/Class/Host/Audio.c (Makefile source module name: LUFA_SRC_USBCLASS)
*
* \section Sec_ModDescription Module Description
- * Host Mode USB Class driver framework interface, for the Audio USB Class driver.
+ * Host Mode USB Class driver framework interface, for the Audio 1.0 USB Class driver.
*
* @{
*/
@@ -79,8 +79,14 @@
{
const struct
{
- uint8_t DataINPipeNumber; /**< Pipe number of the Audio interface's IN data pipe. */
- uint8_t DataOUTPipeNumber; /**< Pipe number of the Audio interface's OUT data pipe. */
+ uint8_t DataINPipeNumber; /**< Pipe number of the Audio interface's IN data pipe. If this interface should not
+ * bind to an IN endpoint, this may be set to 0 to disable audio input streaming for
+ * this driver instance.
+ */
+ uint8_t DataOUTPipeNumber; /**< Pipe number of the Audio interface's OUT data pipe. If this interface should not
+ * bind to an OUT endpoint, this may be set to 0 to disable audio output streaming for
+ * this driver instance.
+ */
} Config; /**< Config data for the USB class interface within the device. All elements in this section
* must be set or the interface will fail to enumerate and operate correctly.
*/
@@ -120,11 +126,6 @@
* device. This should be called once after the stack has enumerated the attached device, while the host state
* machine is in the Addressed state.
*
- * \note The pipe index numbers as given in the interface's configuration structure must not overlap with any other
- * interface, or pipe bank corruption will occur. Gaps in the allocated pipe numbers or non-sequential indexes
- * within a single interface is allowed, but no two interfaces of any type have have interleaved pipe indexes.
- * \n\n
- *
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class host configuration and state.
* \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor.
* \param[in] DeviceConfigDescriptor Pointer to a buffer containing the attached device's Configuration Descriptor.
@@ -143,9 +144,30 @@
*
* \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);
+ /** Gets or sets the specified property of a streaming audio class endpoint that is bound to a pipe in the given
+ * class instance.
+ *
+ * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class host configuration and state.
+ * \param[in] DataPipeIndex Index of the data pipe whose bound endpoint is to be altered.
+ * \param[in] EndpointProperty Property of the endpoint to get or set, a value from \ref Audio_ClassRequests_t.
+ * \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.
+ * \param[in,out] Data Pointer to a location where the parameter data is stored for SET operations, or where
+ * the retrieved data is to be stored for GET operations.
+ *
+ * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum.
+ */
+ 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,
+ void* const Data);
+
/* Inline Functions: */
/** General management task for a given Audio host class interface, required for the correct operation of
* the interface. This should be called frequently in the main program loop, before the master USB management task
@@ -176,8 +198,14 @@
if ((USB_HostState != HOST_STATE_Configured) || !(AudioInterfaceInfo->State.IsActive))
return false;
- Pipe_SelectPipe(AudioInterfaceInfo->Config.DataOUTPipeNumber);
- return Pipe_IsINReceived();
+ bool SampleReceived = false;
+
+ Pipe_SelectPipe(AudioInterfaceInfo->Config.DataINPipeNumber);
+ Pipe_Unfreeze();
+ SampleReceived = Pipe_IsINReceived();
+ Pipe_Freeze();
+
+ return SampleReceived;
}
/** Determines if the given audio interface is ready to accept the next sample to be written to it, and selects
@@ -197,7 +225,7 @@
if ((USB_HostState != HOST_STATE_Configured) || !(AudioInterfaceInfo->State.IsActive))
return false;
- Pipe_SelectPipe(AudioInterfaceInfo->Config.DataINPipeNumber);
+ Pipe_SelectPipe(AudioInterfaceInfo->Config.DataOUTPipeNumber);
return Pipe_IsOUTReady();
}
@@ -221,7 +249,11 @@
Sample = Pipe_Read_8();
if (!(Pipe_BytesInPipe()))
- Pipe_ClearIN();
+ {
+ Pipe_Unfreeze();
+ Pipe_ClearIN();
+ Pipe_Freeze();
+ }
return Sample;
}
@@ -246,7 +278,11 @@
Sample = (int16_t)Pipe_Read_16_LE();
if (!(Pipe_BytesInPipe()))
- Pipe_ClearIN();
+ {
+ Pipe_Unfreeze();
+ Pipe_ClearIN();
+ Pipe_Freeze();
+ }
return Sample;
}
@@ -271,7 +307,11 @@
Sample = (((uint32_t)Pipe_Read_8() << 16) | Pipe_Read_16_LE());
if (!(Pipe_BytesInPipe()))
- Pipe_ClearIN();
+ {
+ Pipe_Unfreeze();
+ Pipe_ClearIN();
+ Pipe_Freeze();
+ }
return Sample;
}
@@ -291,8 +331,13 @@
{
Pipe_Write_8(Sample);
- if (Pipe_BytesInPipe() == AudioInterfaceInfo->State.DataINPipeSize)
- Pipe_ClearOUT();
+ if (!(Pipe_IsReadWriteAllowed()))
+ {
+ Pipe_Unfreeze();
+ Pipe_ClearOUT();
+ Pipe_WaitUntilReady();
+ Pipe_Freeze();
+ }
}
/** Writes the next 16-bit audio sample to the current audio interface.
@@ -310,8 +355,13 @@
{
Pipe_Write_16_LE(Sample);
- if (Pipe_BytesInPipe() == AudioInterfaceInfo->State.DataINPipeSize)
- Pipe_ClearOUT();
+ if (!(Pipe_IsReadWriteAllowed()))
+ {
+ Pipe_Unfreeze();
+ Pipe_ClearOUT();
+ Pipe_WaitUntilReady();
+ Pipe_Freeze();
+ }
}
/** Writes the next 24-bit audio sample to the current audio interface.
@@ -330,8 +380,13 @@
Pipe_Write_16_LE(Sample);
Pipe_Write_8(Sample >> 16);
- if (Pipe_BytesInPipe() == AudioInterfaceInfo->State.DataINPipeSize)
- Pipe_ClearOUT();
+ if (!(Pipe_IsReadWriteAllowed()))
+ {
+ Pipe_Unfreeze();
+ Pipe_ClearOUT();
+ Pipe_WaitUntilReady();
+ Pipe_Freeze();
+ }
}
/* Private Interface - For use in library only: */