/*
LUFA Library
- Copyright (C) Dean Camera, 2011.
+ Copyright (C) Dean Camera, 2013.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
- Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+ Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
- The author disclaim all warranties with regard to this
+ The author disclaims all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
*/
typedef struct
{
- const struct
+ struct
{
+ uint8_t ControlInterfaceNumber; /**< Index of the Audio Control interface within the device this
+ * structure controls.
+ */
uint8_t StreamingInterfaceNumber; /**< Index of the Audio Streaming interface within the device this
* structure controls.
*/
- uint8_t DataINEndpointNumber; /**< Endpoint number of the incoming Audio Streaming data, if available
- * (zero if unused).
- */
- uint16_t DataINEndpointSize; /**< Size in bytes of the incoming Audio Streaming data endpoint, if available
- * (zero if unused).
- */
-
- uint8_t DataOUTEndpointNumber; /**< Endpoint number of the outgoing Audio Streaming data, if available
- * (zero if unused).
- */
- uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing Audio Streaming data endpoint, if available
- * (zero if unused).
- */
+ USB_Endpoint_Table_t DataINEndpoint; /**< Data IN endpoint configuration table. */
+ USB_Endpoint_Table_t DataOUTEndpoint; /**< Data OUT endpoint configuration table. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state.
*/
void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** Audio class driver callback for the setting and retrieval of streaming endpoint properties. This callback must be implemented
* in the user application to handle property manipulations on streaming audio endpoints.
*
* When the DataLength parameter is NULL, this callback should only indicate whether the specified operation is valid for
* the given endpoint index, and should return as fast as possible. When non-NULL, this value may be altered for GET operations
- * to indicate the size of the retreived data.
+ * to indicate the size of the retrieved data.
*
* \note The length of the retrieved data stored into the Data buffer on GET operations should not exceed the initial value
* of the \c DataLength parameter.
* \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 Boolean true if the property get/set was successful, false otherwise
+ * \return Boolean \c true if the property GET/SET was successful, \c false otherwise
*/
bool CALLBACK_Audio_Device_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo,
const uint8_t EndpointProperty,
const uint8_t EndpointAddress,
const uint8_t EndpointControl,
uint16_t* const DataLength,
- uint8_t* Data);
+ uint8_t* Data) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** Audio class driver callback for the setting and retrieval of streaming interface properties. This callback must be implemented
+ * in the user application to handle property manipulations on streaming audio interfaces.
+ *
+ * When the DataLength parameter is NULL, this callback should only indicate whether the specified operation is valid for
+ * the given entity and should return as fast as possible. When non-NULL, this value may be altered for GET operations
+ * to indicate the size of the retrieved data.
+ *
+ * \note The length of the retrieved data stored into the Data buffer on GET operations should not exceed the initial value
+ * of the \c DataLength parameter.
+ *
+ * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state.
+ * \param[in] Property Property of the interface to get or set, a value from \ref Audio_ClassRequests_t.
+ * \param[in] EntityAddress Address of the audio entity whose property is being referenced.
+ * \param[in] Parameter Parameter of the entity to get or set, specific to each type of entity (see USB Audio specification).
+ * \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
+ * and parameter is valid for the requested endpoint without reading or modifying the Data buffer.
+ * \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 Boolean \c true if the property GET/SET was successful, \c false otherwise
+ */
+ bool CALLBACK_Audio_Device_GetSetInterfaceProperty(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo,
+ const uint8_t Property,
+ const uint8_t EntityAddress,
+ const uint16_t Parameter,
+ uint16_t* const DataLength,
+ uint8_t* Data) ATTR_NON_NULL_PTR_ARG(1);
/** Audio class driver event for an Audio Stream start/stop change. This event fires each time the device receives a stream enable or
* disable control request from the host, to start and stop the audio stream. The current state of the stream can be determined by the
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(AudioInterfaceInfo->State.InterfaceEnabled))
return false;
- Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataOUTEndpointNumber);
+ Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataOUTEndpoint.Address);
return Endpoint_IsOUTReceived();
}
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(AudioInterfaceInfo->State.InterfaceEnabled))
return false;
- Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataINEndpointNumber);
+ Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataINEndpoint.Address);
return Endpoint_IsINReady();
}
{
Endpoint_Write_8(Sample);
- if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpointSize)
+ if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpoint.Size)
Endpoint_ClearIN();
}
{
Endpoint_Write_16_LE(Sample);
- if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpointSize)
+ if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpoint.Size)
Endpoint_ClearIN();
}
Endpoint_Write_16_LE(Sample);
Endpoint_Write_8(Sample >> 16);
- if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpointSize)
+ if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpoint.Size)
Endpoint_ClearIN();
}
/* Function Prototypes: */
#if defined(__INCLUDE_FROM_AUDIO_DEVICE_C)
void Audio_Device_Event_Stub(void) ATTR_CONST;
-
+
void EVENT_Audio_Device_StreamStartStop(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)
ATTR_WEAK ATTR_NON_NULL_PTR_ARG(1) ATTR_ALIAS(Audio_Device_Event_Stub);
#endif
- #endif
+ #endif
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)