kopia lustrzana https://github.com/skuep/AIOC
Added rudimentary speaker output functionality with successful enumeration
rodzic
f44eb92056
commit
f2a99edbc4
|
@ -44,13 +44,8 @@
|
|||
#define BOARD_TUD_MAX_SPEED OPT_MODE_DEFAULT_SPEED
|
||||
#endif
|
||||
|
||||
// Conserve some precious USB packet memory
|
||||
#ifndef CFG_TUD_ENDPOINT0_SIZE
|
||||
#define CFG_TUD_ENDPOINT0_SIZE 8
|
||||
#endif
|
||||
|
||||
#ifndef MAX_EP_COUNT
|
||||
#define MAX_EP_COUNT 5
|
||||
#define MAX_EP_COUNT 6
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -96,7 +91,7 @@
|
|||
//--------------------------------------------------------------------
|
||||
|
||||
#ifndef CFG_TUD_ENDPOINT0_SIZE
|
||||
#define CFG_TUD_ENDPOINT0_SIZE 64
|
||||
#define CFG_TUD_ENDPOINT0_SIZE 8
|
||||
#endif
|
||||
|
||||
//------------- CLASS -------------//
|
||||
|
@ -104,8 +99,8 @@
|
|||
#define CFG_TUD_CDC 1
|
||||
|
||||
// CDC FIFO size of TX and RX
|
||||
#define CFG_TUD_CDC_RX_BUFSIZE CFG_TUD_CDC_EP_BUFSIZE
|
||||
#define CFG_TUD_CDC_TX_BUFSIZE CFG_TUD_CDC_EP_BUFSIZE
|
||||
#define CFG_TUD_CDC_RX_BUFSIZE 128
|
||||
#define CFG_TUD_CDC_TX_BUFSIZE 128
|
||||
|
||||
// CDC Endpoint transfer buffer size, more is faster
|
||||
#define CFG_TUD_CDC_EP_BUFSIZE 64
|
||||
|
@ -116,17 +111,25 @@
|
|||
|
||||
// Have a look into audio_device.h for all configurations
|
||||
|
||||
#define CFG_TUD_AUDIO_FUNC_1_DESC_LEN TUD_AUDIO_MIC_ONE_CH_DESC_LEN
|
||||
#define CFG_TUD_AUDIO_FUNC_1_N_AS_INT 1 // Number of Standard AS Interface Descriptors (4.9.1) defined per audio function - this is required to be able to remember the current alternate settings of these interfaces - We restrict us here to have a constant number for all audio functions (which means this has to be the maximum number of AS interfaces an audio function has and a second audio function with less AS interfaces just wastes a few bytes)
|
||||
#define CFG_TUD_AUDIO_FUNC_1_CTRL_BUF_SZ 64 // Size of control request buffer
|
||||
#define CFG_TUD_AUDIO_ENABLE_EP_IN 1
|
||||
#define CFG_TUD_AUDIO_ENABLE_EP_OUT 1
|
||||
|
||||
#define CFG_TUD_AUDIO_ENABLE_EP_IN 1
|
||||
#define CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_TX 2 // Driver gets this info from the descriptors - we define it here to use it to setup the descriptors and to do calculations with it below
|
||||
#define CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX 1 // Driver gets this info from the descriptors - we define it here to use it to setup the descriptors and to do calculations with it below - be aware: for different number of channels you need another descriptor!
|
||||
#define CFG_TUD_AUDIO_EP_SZ_IN 48 * CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_TX * CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX // 48 Samples (48 kHz) x 2 Bytes/Sample x 1 Channel
|
||||
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SZ_MAX CFG_TUD_AUDIO_EP_SZ_IN // Maximum EP IN size for all AS alternate settings used
|
||||
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SW_BUF_SZ CFG_TUD_AUDIO_EP_SZ_IN + 1
|
||||
#define CFG_TUD_AUDIO_FUNC_1_DESC_LEN TUD_AUDIO_IO_DESC_LEN
|
||||
#define CFG_TUD_AUDIO_FUNC_1_N_AS_INT 1
|
||||
#define CFG_TUD_AUDIO_FUNC_1_CTRL_BUF_SZ 64
|
||||
#define CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE 2
|
||||
#define CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX 1
|
||||
#define CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_RX 1
|
||||
#define CFG_TUD_AUDIO_FUNC_1_EP_OUT_SZ_MAX CFG_TUD_AUDIO_EP_SZ_OUT + CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE
|
||||
#define CFG_TUD_AUDIO_FUNC_1_EP_OUT_SW_BUF_SZ CFG_TUD_AUDIO_FUNC_1_EP_OUT_SZ_MAX
|
||||
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SZ_MAX CFG_TUD_AUDIO_EP_SZ_IN + CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE
|
||||
#define CFG_TUD_AUDIO_FUNC_1_EP_IN_SW_BUF_SZ CFG_TUD_AUDIO_FUNC_1_EP_IN_SZ_MAX
|
||||
|
||||
#define CFG_TUD_AUDIO_EP_SZ_IN (48) * CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE * CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_TX // 48 Samples (48 kHz) x 2 Bytes/Sample x 1 Channel
|
||||
#define CFG_TUD_AUDIO_EP_SZ_OUT (48) * CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE * CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_RX // 48 Samples (48 kHz) x 2 Bytes/Sample x 1 Channel
|
||||
|
||||
/* Include this here for pulling length of custom descriptors into tinyusb stack */
|
||||
#include "usb_descriptors.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -70,7 +70,6 @@ int main(void)
|
|||
|
||||
USB_Init();
|
||||
|
||||
|
||||
while (1) {
|
||||
USB_Task();
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#include <usb.h>
|
||||
#include "usb.h"
|
||||
#include "stm32f3xx_hal.h"
|
||||
#include "tusb.h"
|
||||
#include "usb_serial.h"
|
||||
#include "usb_audio.h"
|
||||
|
||||
|
||||
// FIXME: Do all three need to be handled, or just the LP one?
|
||||
// USB high-priority interrupt (Channel 74): Triggered only by a correct
|
||||
// transfer event for isochronous and double-buffer bulk transfer to reach
|
||||
|
@ -28,6 +29,31 @@ void USBWakeUp_RMP_IRQHandler(void)
|
|||
tud_int_handler(0);
|
||||
}
|
||||
|
||||
// Invoked when device is mounted (configured)
|
||||
void tud_mount_cb(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Invoked when device is unmounted
|
||||
void tud_umount_cb(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Invoked when usb bus is suspended
|
||||
// Within 7ms, device must draw an average of current less than 2.5 mA from bus
|
||||
void tud_suspend_cb(bool remote_wakeup_en)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Invoked when usb bus is resumed
|
||||
void tud_resume_cb(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void USB_Init(void)
|
||||
{
|
||||
__HAL_REMAPINTERRUPT_USB_ENABLE();
|
||||
|
|
|
@ -154,7 +154,7 @@ bool tud_audio_get_req_entity_cb(uint8_t rhport, tusb_control_request_t const *
|
|||
uint8_t entityID = TU_U16_HIGH(p_request->wIndex);
|
||||
|
||||
// Input terminal (Microphone input)
|
||||
if (entityID == 1)
|
||||
if (entityID == AUDIO_CTRL_ID_MIC_INPUT)
|
||||
{
|
||||
switch ( ctrlSel )
|
||||
{
|
||||
|
@ -182,7 +182,7 @@ bool tud_audio_get_req_entity_cb(uint8_t rhport, tusb_control_request_t const *
|
|||
}
|
||||
|
||||
// Feature unit
|
||||
if (entityID == 2)
|
||||
if (entityID == AUDIO_CTRL_ID_MIC_FUNIT)
|
||||
{
|
||||
switch ( ctrlSel )
|
||||
{
|
||||
|
@ -228,7 +228,7 @@ bool tud_audio_get_req_entity_cb(uint8_t rhport, tusb_control_request_t const *
|
|||
}
|
||||
|
||||
// Clock Source unit
|
||||
if ( entityID == 4 )
|
||||
if ( entityID == AUDIO_CTRL_ID_CLOCK )
|
||||
{
|
||||
switch ( ctrlSel )
|
||||
{
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
* THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "usb_descriptors.h"
|
||||
#include "tusb.h"
|
||||
#include "usb_descriptors.h"
|
||||
|
||||
|
||||
/* A combination of interfaces must have a unique product id, since PC will save device driver after the first plug.
|
||||
* Same VID/PID with different interface e.g MSC (first), then CDC (later) will possibly cause system error on PC.
|
||||
|
@ -34,7 +34,7 @@
|
|||
*/
|
||||
#define _PID_MAP(itf, n) ( (CFG_TUD_##itf) << (n) )
|
||||
#define USB_PID (0x4000 | _PID_MAP(CDC, 0) | _PID_MAP(MSC, 1) | _PID_MAP(HID, 2) | \
|
||||
_PID_MAP(MIDI, 3) | _PID_MAP(VENDOR, 4) )
|
||||
_PID_MAP(MIDI, 3) | _PID_MAP(VENDOR, 4) | _PID_MAP(AUDIO, 5))
|
||||
|
||||
#define USB_VID 0xCafe
|
||||
#define USB_BCD 0x0200
|
||||
|
@ -76,18 +76,14 @@ uint8_t const * tud_descriptor_device_cb(void)
|
|||
//--------------------------------------------------------------------+
|
||||
// Configuration Descriptor
|
||||
//--------------------------------------------------------------------+
|
||||
#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + CFG_TUD_CDC * TUD_CDC_DESC_LEN + CFG_TUD_AUDIO * TUD_AUDIO_MIC_ONE_CH_DESC_LEN)
|
||||
#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + CFG_TUD_CDC * TUD_CDC_DESC_LEN + 1 * TUD_AUDIO_IO_DESC_LEN)
|
||||
|
||||
uint8_t const desc_fs_configuration[] =
|
||||
{
|
||||
// Config number, interface count, string index, total length, attribute, power in mA
|
||||
TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, 0x00, 100),
|
||||
|
||||
// 1st CDC: Interface number, string index, EP notification address and size, EP data address (out, in) and size.
|
||||
TUD_CDC_DESCRIPTOR(ITF_NUM_CDC_0, 4, EPNUM_CDC_0_NOTIF, 8, EPNUM_CDC_0_OUT, EPNUM_CDC_0_IN, CFG_TUD_CDC_EP_BUFSIZE),
|
||||
|
||||
// Interface number, string index, EP Out & EP In address, EP size
|
||||
TUD_AUDIO_MIC_ONE_CH_DESCRIPTOR(/*_itfnum*/ ITF_NUM_AUDIO_CONTROL, /*_stridx*/ 0, /*_nBytesPerSample*/ CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_TX, /*_nBitsUsedPerSample*/ CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_TX*8, /*_epin*/ EPNUM_AUDIO_IN, /*_epsize*/ CFG_TUD_AUDIO_EP_SZ_IN)
|
||||
TUD_AUDIO_IO_DESCRIPTOR(/*_itfnum*/ ITF_NUM_AUDIO_CONTROL, /*_stridx*/ 0, /*_nBytesPerSample*/ CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE, /*_nBitsUsedPerSample*/ CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE*8, /*_epin*/ EPNUM_AUDIO_IN, /*_epinsize*/ CFG_TUD_AUDIO_FUNC_1_EP_IN_SZ_MAX, /*_epout*/ EPNUM_AUDIO_OUT, /*_epoutsize*/ CFG_TUD_AUDIO_FUNC_1_EP_OUT_SZ_MAX, /*_epfb*/ EPNUM_AUDIO_FB)
|
||||
};
|
||||
|
||||
// Invoked when received GET CONFIGURATION DESCRIPTOR
|
||||
|
|
|
@ -1,17 +1,113 @@
|
|||
#ifndef USB_DESCRIPTORS_H_
|
||||
#define USB_DESCRIPTORS_H_
|
||||
|
||||
/* Interfaces */
|
||||
enum USB_DESCRIPTORS_ITF {
|
||||
ITF_NUM_CDC_0 = 0,
|
||||
ITF_NUM_CDC_0_DATA,
|
||||
ITF_NUM_AUDIO_CONTROL,
|
||||
ITF_NUM_AUDIO_STREAMING,
|
||||
ITF_NUM_AUDIO_STREAMING_OUT,
|
||||
ITF_NUM_AUDIO_STREAMING_IN,
|
||||
ITF_NUM_TOTAL
|
||||
};
|
||||
|
||||
#define EPNUM_CDC_0_NOTIF 0x81
|
||||
#define EPNUM_CDC_0_OUT 0x02
|
||||
#define EPNUM_CDC_0_IN 0x82
|
||||
#define EPNUM_AUDIO_IN 0x83
|
||||
/* Endpoints */
|
||||
#define EPNUM_AUDIO_IN 0x81
|
||||
#define EPNUM_AUDIO_OUT 0x02
|
||||
#define EPNUM_AUDIO_FB 0x83
|
||||
#define EPNUM_CDC_0_OUT 0x04
|
||||
#define EPNUM_CDC_0_IN 0x84
|
||||
#define EPNUM_CDC_0_NOTIF 0x85
|
||||
|
||||
/* Custom Audio Descriptor.
|
||||
* Courtesy of https://github.com/hathach/tinyusb/issues/1249#issuecomment-1148727765 */
|
||||
#define AUDIO_CTRL_ID_SPK_INPUT_STREAM 0x01
|
||||
#define AUDIO_CTRL_ID_SPK_FUNIT 0x02
|
||||
#define AUDIO_CTRL_ID_SPK_OUTPUT 0x03
|
||||
#define AUDIO_CTRL_ID_MIC_INPUT 0x04
|
||||
#define AUDIO_CTRL_ID_MIC_FUNIT 0x05
|
||||
#define AUDIO_CTRL_ID_MIC_OUTPUT_STREAM 0x06
|
||||
#define AUDIO_CTRL_ID_CLOCK 0x41
|
||||
#define AUDIO_CTRL_ID_CLOCKSEL 0x40
|
||||
|
||||
#define AUDIO_NUM_INTERFACES 0x03
|
||||
#define AUDIO_NUM_INCHANNELS 0x01
|
||||
#define AUDIO_NUM_OUTCHANNELS 0x01
|
||||
|
||||
#define TUD_AUDIO_CTRL_TOTAL_LEN ( \
|
||||
TUD_AUDIO_DESC_CLK_SRC_LEN + \
|
||||
TUD_AUDIO_DESC_INPUT_TERM_LEN + \
|
||||
TUD_AUDIO_DESC_OUTPUT_TERM_LEN + \
|
||||
TUD_AUDIO_DESC_INPUT_TERM_LEN + \
|
||||
TUD_AUDIO_DESC_OUTPUT_TERM_LEN)
|
||||
|
||||
#define TUD_AUDIO_IO_DESC_LEN ( \
|
||||
TUD_AUDIO_DESC_IAD_LEN + \
|
||||
TUD_AUDIO_DESC_STD_AC_LEN + \
|
||||
TUD_AUDIO_DESC_CS_AC_LEN + \
|
||||
TUD_AUDIO_CTRL_TOTAL_LEN + \
|
||||
/* Speaker Interface */ \
|
||||
TUD_AUDIO_DESC_STD_AS_INT_LEN + \
|
||||
TUD_AUDIO_DESC_STD_AS_INT_LEN + \
|
||||
TUD_AUDIO_DESC_CS_AS_INT_LEN + \
|
||||
TUD_AUDIO_DESC_TYPE_I_FORMAT_LEN + \
|
||||
TUD_AUDIO_DESC_STD_AS_ISO_EP_LEN + \
|
||||
TUD_AUDIO_DESC_CS_AS_ISO_EP_LEN + \
|
||||
TUD_AUDIO_DESC_STD_AS_ISO_EP_LEN + \
|
||||
/* Microphone Interface */ \
|
||||
TUD_AUDIO_DESC_STD_AS_INT_LEN + \
|
||||
TUD_AUDIO_DESC_STD_AS_INT_LEN + \
|
||||
TUD_AUDIO_DESC_CS_AS_INT_LEN + \
|
||||
TUD_AUDIO_DESC_TYPE_I_FORMAT_LEN + \
|
||||
TUD_AUDIO_DESC_STD_AS_ISO_EP_LEN + \
|
||||
TUD_AUDIO_DESC_CS_AS_ISO_EP_LEN)
|
||||
|
||||
#define TUD_AUDIO_IO_DESCRIPTOR(_itfnum, _stridx, _nBytesPerSample, _nBitsUsedPerSample, _epin, _epinsize, _epout, _epoutsize, _epfb) \
|
||||
/* Standard Interface Association Descriptor (IAD) */ \
|
||||
TUD_AUDIO_DESC_IAD(_itfnum, AUDIO_NUM_INTERFACES, /*_stridx*/ 0x00), \
|
||||
/* Audio Control Interface */ \
|
||||
/* Standard AC Interface Descriptor(4.7.1) */ \
|
||||
TUD_AUDIO_DESC_STD_AC(/*_itfnum*/ _itfnum, /*_nEPs*/ 0x00, /*_stridx*/ _stridx), \
|
||||
/* Class-Specific AC Interface Header Descriptor(4.7.2) */ \
|
||||
TUD_AUDIO_DESC_CS_AC(/*_bcdADC*/ 0x0200, AUDIO_FUNC_CONVERTER, TUD_AUDIO_CTRL_TOTAL_LEN, /*_ctrl*/ AUDIO_CS_AS_INTERFACE_CTRL_LATENCY_POS), \
|
||||
/* Clock Source Descriptor(4.7.2.1) */ \
|
||||
TUD_AUDIO_DESC_CLK_SRC(AUDIO_CTRL_ID_CLOCK, AUDIO_CLOCK_SOURCE_ATT_INT_FIX_CLK, (AUDIO_CTRL_R << AUDIO_CLOCK_SOURCE_CTRL_CLK_FRQ_POS), /*_assocTerm*/ 0x01, /*_stridx*/ 0x00), \
|
||||
/* Speaker Terminals */ \
|
||||
TUD_AUDIO_DESC_INPUT_TERM(/*_termid*/ AUDIO_CTRL_ID_SPK_INPUT_STREAM, /*_termtype*/ AUDIO_TERM_TYPE_USB_STREAMING, /*_assocTerm*/ AUDIO_CTRL_ID_MIC_OUTPUT_STREAM, /*_clkid*/ AUDIO_CTRL_ID_CLOCK, /*_nchannelslogical*/ AUDIO_NUM_OUTCHANNELS, /*_channelcfg*/ AUDIO_CHANNEL_CONFIG_NON_PREDEFINED, /*_idxchannelnames*/ 0x00, /*_ctrl*/ AUDIO_CTRL_R << AUDIO_IN_TERM_CTRL_CONNECTOR_POS, /*_stridx*/ 0x00), \
|
||||
TUD_AUDIO_DESC_OUTPUT_TERM(AUDIO_CTRL_ID_SPK_OUTPUT, AUDIO_TERM_TYPE_OUT_GENERIC_SPEAKER, AUDIO_CTRL_ID_SPK_INPUT_STREAM, AUDIO_CTRL_ID_SPK_INPUT_STREAM, AUDIO_CTRL_ID_CLOCK, /*_ctrl*/ 0x0000, /*_stridx*/ 0x00), \
|
||||
/* Microphone Terminals */ \
|
||||
TUD_AUDIO_DESC_INPUT_TERM(AUDIO_CTRL_ID_MIC_INPUT, AUDIO_TERM_TYPE_IN_GENERIC_MIC, AUDIO_CTRL_ID_MIC_OUTPUT_STREAM, AUDIO_CTRL_ID_CLOCK, AUDIO_NUM_INCHANNELS, AUDIO_CHANNEL_CONFIG_NON_PREDEFINED, /*_idxchannelnames*/ 0x00, /*_ctrl*/ AUDIO_CTRL_R << AUDIO_IN_TERM_CTRL_CONNECTOR_POS, /*_stridx*/ 0x00), \
|
||||
TUD_AUDIO_DESC_OUTPUT_TERM(AUDIO_CTRL_ID_MIC_OUTPUT_STREAM, AUDIO_TERM_TYPE_USB_STREAMING, AUDIO_CTRL_ID_MIC_INPUT, AUDIO_CTRL_ID_MIC_INPUT, AUDIO_CTRL_ID_CLOCK, /*_ctrl*/ 0x0000, /*_stridx*/ 0x00), \
|
||||
/* Speaker Interface */ \
|
||||
/* Interface 1, Alternate 0 - default alternate setting with 0 bandwidth */ \
|
||||
TUD_AUDIO_DESC_STD_AS_INT(/*_itfnum*/ (uint8_t)((_itfnum) + 1), /*_altset*/ 0x00, /*_nEPs*/ 0x00, /*_stridx*/ 0x00), \
|
||||
/* Interface 1, Alternate 1 - alternate interface for data streaming */ \
|
||||
TUD_AUDIO_DESC_STD_AS_INT(/*_itfnum*/ (uint8_t)((_itfnum) + 1), /*_altset*/ 0x01, /*_nEPs*/ 0x02, /*_stridx*/ 0x00), \
|
||||
/* Class-Specific AS Interface Descriptor(4.9.2) */ \
|
||||
TUD_AUDIO_DESC_CS_AS_INT(AUDIO_CTRL_ID_SPK_INPUT_STREAM, AUDIO_CTRL_NONE, AUDIO_FORMAT_TYPE_I, AUDIO_DATA_FORMAT_TYPE_I_PCM, AUDIO_NUM_OUTCHANNELS, AUDIO_CHANNEL_CONFIG_NON_PREDEFINED, /*_stridx*/ 0x00), \
|
||||
/* Type I Format Type Descriptor(2.3.1.6 - Audio Formats) */ \
|
||||
TUD_AUDIO_DESC_TYPE_I_FORMAT(_nBytesPerSample, _nBitsUsedPerSample), \
|
||||
/* Standard AS Isochronous Audio Data Endpoint Descriptor(4.10.1.1) */ \
|
||||
TUD_AUDIO_DESC_STD_AS_ISO_EP(_epout, (TUSB_XFER_ISOCHRONOUS | TUSB_ISO_EP_ATT_ASYNCHRONOUS | TUSB_ISO_EP_ATT_DATA), _epoutsize, TUD_OPT_HIGH_SPEED ? 0x04 : 0x01), \
|
||||
/* Class-Specific AS Isochronous Audio Data Endpoint Descriptor(4.10.1.2) */ \
|
||||
TUD_AUDIO_DESC_CS_AS_ISO_EP(AUDIO_CS_AS_ISO_DATA_EP_ATT_NON_MAX_PACKETS_OK, AUDIO_CTRL_NONE, AUDIO_CS_AS_ISO_DATA_EP_LOCK_DELAY_UNIT_UNDEFINED, 0x0000), \
|
||||
/* Standard AS Isochronous Feedback Endpoint Descriptor(4.10.2.1) */ \
|
||||
TUD_AUDIO_DESC_STD_AS_ISO_FB_EP(_epfb, 1), \
|
||||
/* Microphone Interface */ \
|
||||
/* Standard AS Interface Descriptor(4.9.1) */ \
|
||||
/* Interface 1, Alternate 0 - default alternate setting with 0 bandwidth */ \
|
||||
TUD_AUDIO_DESC_STD_AS_INT((uint8_t)((_itfnum)+2), /*_altset*/ 0x00, /*_nEPs*/ 0x00, /*_stridx*/ 0x00), \
|
||||
/* Standard AS Interface Descriptor(4.9.1) */ \
|
||||
/* Interface 1, Alternate 1 - alternate interface for data streaming */ \
|
||||
TUD_AUDIO_DESC_STD_AS_INT(/*_itfnum*/ (uint8_t)((_itfnum)+2), /*_altset*/ 0x01, /*_nEPs*/ 0x01, /*_stridx*/ 0x00), \
|
||||
/* Class-Specific AS Interface Descriptor(4.9.2) */ \
|
||||
TUD_AUDIO_DESC_CS_AS_INT(AUDIO_CTRL_ID_MIC_OUTPUT_STREAM, AUDIO_CTRL_NONE, AUDIO_FORMAT_TYPE_I, AUDIO_DATA_FORMAT_TYPE_I_PCM, AUDIO_NUM_INCHANNELS, AUDIO_CHANNEL_CONFIG_FRONT_LEFT | AUDIO_CHANNEL_CONFIG_FRONT_RIGHT, /*_stridx*/ 0x00), \
|
||||
/* Type I Format Type Descriptor(2.3.1.6 - Audio Formats) */ \
|
||||
TUD_AUDIO_DESC_TYPE_I_FORMAT(_nBytesPerSample, _nBitsUsedPerSample), \
|
||||
/* Standard AS Isochronous Audio Data Endpoint Descriptor(4.10.1.1) */ \
|
||||
TUD_AUDIO_DESC_STD_AS_ISO_EP(_epin, (TUSB_XFER_ISOCHRONOUS | TUSB_ISO_EP_ATT_ASYNCHRONOUS | TUSB_ISO_EP_ATT_DATA), _epinsize, TUD_OPT_HIGH_SPEED ? 0x04 : 0x01), \
|
||||
/* Class-Specific AS Isochronous Audio Data Endpoint Descriptor(4.10.1.2) */ \
|
||||
TUD_AUDIO_DESC_CS_AS_ISO_EP(AUDIO_CS_AS_ISO_DATA_EP_ATT_NON_MAX_PACKETS_OK, AUDIO_CTRL_NONE, AUDIO_CS_AS_ISO_DATA_EP_LOCK_DELAY_UNIT_UNDEFINED, 0x0000)
|
||||
|
||||
|
||||
#endif /* USB_DESCRIPTORS_H_ */
|
||||
|
|
Ładowanie…
Reference in New Issue