Added support in UAC1 descriptors for 24, 22.05, 12 and 11.025kHz

This commit is contained in:
Ross Owen
2015-11-12 19:03:30 +00:00
parent a63663da13
commit 2aef62b434

View File

@@ -1248,7 +1248,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
.bSourceID = FU_USBIN, /* 7 bSourceID Connect to analog input feature unit*/ .bSourceID = FU_USBIN, /* 7 bSourceID Connect to analog input feature unit*/
#else #else
.bSourceID = ID_IT_USB, /* 7 bSourceID Connect to analog input term */ .bSourceID = ID_IT_USB,/* 7 bSourceID Connect to analog input term */
#endif #endif
.bCSourceID = ID_CLKSEL, .bCSourceID = ID_CLKSEL,
.bmControls = 0x0000, .bmControls = 0x0000,
@@ -2155,7 +2155,7 @@ unsigned char hidDescriptor[] =
0, /* 4 bCountryCode */ 0, /* 4 bCountryCode */
1, /* 5 bNumDescriptors */ 1, /* 5 bNumDescriptors */
0x22, /* 6 bDescriptorType[0] (Report) */ 0x22, /* 6 bDescriptorType[0] (Report) */
sizeof(hidReportDescriptor) & 0xff,/* 7 wDescriptorLength[0] */ sizeof(hidReportDescriptor) & 0xff, /* 7 wDescriptorLength[0] */
sizeof(hidReportDescriptor) >> 8, /* 8 wDescriptorLength[0] */ sizeof(hidReportDescriptor) >> 8, /* 8 wDescriptorLength[0] */
}; };
#endif #endif
@@ -2208,6 +2208,12 @@ unsigned char cfgDesc_Null[] =
#define AC_LENGTH (8 + INPUT_INTERFACES_A1 + OUTPUT_INTERFACES_A1) #define AC_LENGTH (8 + INPUT_INTERFACES_A1 + OUTPUT_INTERFACES_A1)
/* In UAC1 supported sample rates are listed in descriptor */
/* Note, to make descriptors easier to produce we always report a fixed number freqs.
* Multiple of MAX_FREQ_FS is reported for freqs not required
* Mote, reducing freq coint seems to cause an enumeration issue on Windows */
#define NUM_FREQS_A1 (8)
#define AC_TOTAL_LENGTH (AC_LENGTH + (INPUT_INTERFACES_A1 * (19 + NUM_FREQS_A1 * 3)) + (OUTPUT_INTERFACES_A1 * (19 + (NUM_FREQS_A1 *3)))) #define AC_TOTAL_LENGTH (AC_LENGTH + (INPUT_INTERFACES_A1 * (19 + NUM_FREQS_A1 * 3)) + (OUTPUT_INTERFACES_A1 * (19 + (NUM_FREQS_A1 *3))))
#define STREAMING_INTERFACES (INPUT_INTERFACES_A1 + OUTPUT_INTERFACES_A1) #define STREAMING_INTERFACES (INPUT_INTERFACES_A1 + OUTPUT_INTERFACES_A1)
@@ -2221,9 +2227,7 @@ unsigned char cfgDesc_Null[] =
#define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * 61) + (OUTPUT_INTERFACES_A1 * 61)) #define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * 61) + (OUTPUT_INTERFACES_A1 * 61))
#endif #endif
/* In UAC1 supported sample rates are listed in descriptor */ #define MAX_FREQ_A1_CHARS (MAX_FREQ_FS & 0xff),((MAX_FREQ_FS & 0xff00)>> 8),((MAX_FREQ_FS & 0xff0000)>> 16)
/* Note, we always report 4 freqs, doing otherwise seems to cause an enumeration issue on Windows */
#define NUM_FREQS_A1 (4)
unsigned char cfgDesc_Audio1[] = unsigned char cfgDesc_Audio1[] =
{ {
@@ -2385,21 +2389,53 @@ unsigned char cfgDesc_Audio1[] =
FS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS, /* bitResolution */ FS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS, /* bitResolution */
NUM_FREQS_A1, /* SamFreqType - sample freq count */ NUM_FREQS_A1, /* SamFreqType - sample freq count */
#if(MIN_FREQ <= 11025) && (MAX_FREQ_FS >= 11025)
0x11, 0x2B, 0x00, /* sampleFreq - 11025KHz */
#else
MAX_FREQ_A1_CHARS, /* sampleFreq - MAX_FREQ */
#endif
#if(MIN_FREQ <= 12000) && (MAX_FREQ_FS >= 12000)
0xE0, 0x2E, 0x00, /* sampleFreq - 12000KHz */
#else
MAX_FREQ_A1_CHARS, /* sampleFreq - MAX_FREQ */
#endif
#if(MIN_FREQ <= 22050) && (MAX_FREQ_FS >= 22050)
0x22, 0x56, 0x00, /* sampleFreq - 22.05KHz */
#else
MAX_FREQ_A1_CHARS, /* sampleFreq - MAX_FREQ */
#endif
#if(MIN_FREQ <= 24000) && (MAX_FREQ_FS >= 24000)
0xC0, 0x5D, 0x00, /* sampleFreq - 24KHz */
#else
MAX_FREQ_A1_CHARS, /* sampleFreq - MAX_FREQ */
#endif
#if (MIN_FREQ <= 44100) && (MAX_FREQ_FS >= 44100)
0x44, 0xAC, 0x00, /* sampleFreq - 44.1Khz */ 0x44, 0xAC, 0x00, /* sampleFreq - 44.1Khz */
#if (MAX_FREQ_FS > 44100) #else
MAX_FREQ_A1_CHARS, /* sampleFreq - MAX_FREQ */
#endif
#if (MIN_FREQ <= 48000) && (MAX_FREQ_FS >= 48000)
0x80, 0xBB, 0x00, /* sampleFreq - 48KHz */ 0x80, 0xBB, 0x00, /* sampleFreq - 48KHz */
#else #else
0x44, 0xAC, 0x00, /* sampleFreq - 44.1Khz */ MAX_FREQ_A1_CHARS, /* sampleFreq - MAX_FREQ */
#endif #endif
#if (MAX_FREQ_FS > 48000)
#if (MIN_FREQ <= 88200) && (MAX_FREQ_FS >= 88200)
0x88, 0x58, 0x01, /* sampleFreq - 88.2KHz */ 0x88, 0x58, 0x01, /* sampleFreq - 88.2KHz */
#else #else
0x44, 0xAC, 0x00, /* sampleFreq - 44.1Khz */ MAX_FREQ_A1_CHARS, /* sampleFreq - MAX_FREQ */
#endif #endif
#if (MAX_FREQ_FS > 88200)
#if (MIN_FREQ <= 96000) && (MAX_FREQ_FS >= 96000)
0x00, 0x77, 0x01, /* sampleFreq - 96KHz */ 0x00, 0x77, 0x01, /* sampleFreq - 96KHz */
#else #else
0x44, 0xAC, 0x00, /* sampleFreq - 44.1Khz */ MAX_FREQ_A1_CHARS, /* sampleFreq - MAX_FREQ */
#endif #endif
/* Standard AS Isochronous Audio Data Endpoint Descriptor 4.6.1.1 */ /* Standard AS Isochronous Audio Data Endpoint Descriptor 4.6.1.1 */
@@ -2478,22 +2514,55 @@ unsigned char cfgDesc_Audio1[] =
FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES, /* subFrameSize - Typically 4 bytes per slot */ FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES, /* subFrameSize - Typically 4 bytes per slot */
FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS, /* bitResolution - Typically 24bit */ FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS, /* bitResolution - Typically 24bit */
NUM_FREQS_A1, /* SamFreqType - sample freq count */ NUM_FREQS_A1, /* SamFreqType - sample freq count */
#if(MIN_FREQ <= 11025) && (MAX_FREQ_FS >= 11025)
0x11, 0x2B, 0x00, /* sampleFreq - 11025KHz */
#else
MAX_FREQ_A1_CHARS, /* sampleFreq - MAX_FREQ */
#endif
#if(MIN_FREQ <= 12000) && (MAX_FREQ_FS >= 12000)
0xE0, 0x2E, 0x00, /* sampleFreq - 12000KHz */
#else
MAX_FREQ_A1_CHARS, /* sampleFreq - MAX_FREQ */
#endif
#if(MIN_FREQ <= 22050) && (MAX_FREQ_FS >= 22050)
0x22, 0x56, 0x00, /* sampleFreq - 22.05KHz */
#else
MAX_FREQ_A1_CHARS, /* sampleFreq - MAX_FREQ */
#endif
#if(MIN_FREQ <= 24000) && (MAX_FREQ_FS >= 24000)
0xC0, 0x5D, 0x00, /* sampleFreq - 24KHz */
#else
MAX_FREQ_A1_CHARS, /* sampleFreq - MAX_FREQ */
#endif
#if (MIN_FREQ <= 44100) && (MAX_FREQ_FS >= 44100)
0x44, 0xAC, 0x00, /* sampleFreq - 44.1Khz */ 0x44, 0xAC, 0x00, /* sampleFreq - 44.1Khz */
#if (MAX_FREQ_FS > 44100) #else
MAX_FREQ_A1_CHARS, /* sampleFreq - MAX_FREQ */
#endif
#if (MIN_FREQ <= 48000) && (MAX_FREQ_FS >= 48000)
0x80, 0xBB, 0x00, /* sampleFreq - 48KHz */ 0x80, 0xBB, 0x00, /* sampleFreq - 48KHz */
#else #else
0x44, 0xAC, 0x00, /* sampleFreq - 44.1Khz */ MAX_FREQ_A1_CHARS, /* sampleFreq - MAX_FREQ */
#endif #endif
#if (MAX_FREQ_FS > 48000)
#if (MIN_FREQ <= 88200) && (MAX_FREQ_FS >= 88200)
0x88, 0x58, 0x01, /* sampleFreq - 88.2KHz */ 0x88, 0x58, 0x01, /* sampleFreq - 88.2KHz */
#else #else
0x44, 0xAC, 0x00, /* sampleFreq - 44.1Khz */ MAX_FREQ_A1_CHARS, /* sampleFreq - MAX_FREQ */
#endif #endif
#if (MAX_FREQ_FS > 88200)
#if (MIN_FREQ <= 96000) && (MAX_FREQ_FS >= 96000)
0x00, 0x77, 0x01, /* sampleFreq - 96KHz */ 0x00, 0x77, 0x01, /* sampleFreq - 96KHz */
#else #else
0x44, 0xAC, 0x00, /* sampleFreq - 44.1Khz */ MAX_FREQ_A1_CHARS, /* sampleFreq - MAX_FREQ */
#endif #endif
/* Standard Endpoint Descriptor */ /* Standard Endpoint Descriptor */
0x09, 0x09,
0x05, /* ENDPOINT */ 0x05, /* ENDPOINT */
@@ -2518,7 +2587,6 @@ unsigned char cfgDesc_Audio1[] =
0x00, 0x00, /* Unused */ 0x00, 0x00, /* Unused */
#endif #endif
}; };
#endif #endif
#endif #endif
#endif #endif