Merge pull request #1 from keithauxmos/feature/configurable_usb_res_rate_shuchita

removed USB_CMD_CFG_SAMP_FREQ related codes
This commit is contained in:
shuchitak
2020-02-18 08:33:09 +00:00
committed by GitHub
4 changed files with 4 additions and 95 deletions

View File

@@ -17,7 +17,7 @@
#endif
#define MAX(x,y) ((x)>(y) ? (x) : (y))
#if((defined USB_CMD_CFG_SAMP_FREQ) || (defined USB_DESCRIPTOR_OVERRIDE_RATE_RES))
#if(defined USB_DESCRIPTOR_OVERRIDE_RATE_RES)
extern uint32_t get_usb_to_device_rate();
extern uint32_t get_device_to_usb_rate();
extern uint32_t get_usb_to_device_bit_res();

View File

@@ -65,7 +65,7 @@ extern void device_reboot(void);
#include "xua_hid.h"
#endif
#if((defined USB_CMD_CFG_SAMP_FREQ) || (defined USB_DESCRIPTOR_OVERRIDE_RATE_RES))
#if(defined USB_DESCRIPTOR_OVERRIDE_RATE_RES)
extern uint32_t get_usb_to_device_rate();
extern uint32_t get_device_to_usb_rate();
extern uint32_t get_usb_to_device_bit_res();

View File

@@ -2364,11 +2364,7 @@ const unsigned num_freqs_a1 = MAX(3, (0
#if ((NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP))
#define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (OUTPUT_INTERFACES_A1 * (58 + num_freqs_a1 * 3)) + CONTROL_INTERFACE_BYTES + DFU_INTERFACE_BYTES + HID_INTERFACE_BYTES)
#else
#ifdef USB_CMD_CFG_SAMP_FREQ
#define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3) + (40 + num_freqs_a1 * 3)) + (OUTPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + CONTROL_INTERFACE_BYTES + DFU_INTERFACE_BYTES + HID_INTERFACE_BYTES)
#else
#define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (OUTPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + CONTROL_INTERFACE_BYTES + DFU_INTERFACE_BYTES + HID_INTERFACE_BYTES)
#endif //USB_CMD_CFG_SAMP_FREQ
#endif
#ifdef USB_DESCRIPTOR_OVERRIDE_RATE_RES
@@ -2618,14 +2614,6 @@ unsigned char cfgDesc_Audio1[] =
NUM_USB_CHAN_OUT_FS, /* nrChannels */
FS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES, /* subFrameSize */
FS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS, /* bitResolution */
#ifdef USB_CMD_CFG_SAMP_FREQ
USB_OUT_SAMP_FREQ_NUM,
CHARIFY_SR(USB_OUT_SAMP_FREQ_0),
CHARIFY_SR(USB_OUT_SAMP_FREQ_1),
CHARIFY_SR(USB_OUT_SAMP_FREQ_2),
#else
num_freqs_a1, /* SamFreqType - sample freq count */
/* Windows enum issue with <= two sample rates work around */
@@ -2678,7 +2666,6 @@ unsigned char cfgDesc_Audio1[] =
#if (MIN_FREQ <= 96000) && (MAX_FREQ_FS >= 96000)
0x00, 0x77, 0x01, /* sampleFreq - 96KHz */
#endif
#endif //USB_CMD_CFG_SAMP_FREQ
/* Standard AS Isochronous Audio Data Endpoint Descriptor 4.6.1.1 */
0x09,
@@ -2771,13 +2758,6 @@ unsigned char cfgDesc_Audio1[] =
NUM_USB_CHAN_IN_FS, /* bNrChannels - Typically 2 */
FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES, /* subFrameSize - Typically 4 bytes per slot */
FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS, /* bitResolution - Typically 24bit */
#ifdef USB_CMD_CFG_SAMP_FREQ
USB_IN_SAMP_FREQ_NUM,
CHARIFY_SR(USB_IN_SAMP_FREQ_0),
CHARIFY_SR(USB_IN_SAMP_FREQ_1),
CHARIFY_SR(USB_IN_SAMP_FREQ_2),
#else
num_freqs_a1, /* SamFreqType - sample freq count */
/* Windows enum issue with <= two sample rates work around */
@@ -2830,7 +2810,6 @@ unsigned char cfgDesc_Audio1[] =
#if (MIN_FREQ <= 96000) && (MAX_FREQ_FS >= 96000)
0x00, 0x77, 0x01, /* sampleFreq - 96KHz */
#endif
#endif //USB_CMD_CFG_SAMP_FREQ
/* Standard Endpoint Descriptor */
0x09,
@@ -2863,76 +2842,6 @@ unsigned char cfgDesc_Audio1[] =
0x00, /* Undefined */
0x00, 0x00, /* Not used */
#endif // XUA_ADAPTIVE
#ifdef USB_CMD_CFG_SAMP_FREQ //add extra Interface Descriptor in case mulitple bit resolution is needed to be offered to host
/* Standard Interface Descriptor - Audio streaming IN */
0x09,
0x04, /* INTERFACE */
(OUTPUT_INTERFACES_A1 + 1), /* bInterfaceNumber */
0x02, /* AlternateSetting */
0x01, /* bNumEndpoints */
0x01, /* Interface class - AUDIO */
0x02, /* Subclass - AUDIO_STREAMING */
0x00, /* Unused */
offsetof(StringDescTable_t, inputInterfaceStr_Audio1)/sizeof(char *),
/* CS_Interface AC interface header descriptor */
0x07,
UAC_CS_DESCTYPE_INTERFACE,
0x01, /* subtype - GENERAL */
0x07, /* TerminalLink - linked to Streaming OUT terminal */
0x01, /* Interface delay */
0x01,0x00, /* Format - PCM */
/* CS_Interface Terminal Descriptor */
(8 + (num_freqs_a1 * 3)),
UAC_CS_DESCTYPE_INTERFACE,
0x02, /* Subtype - FORMAT_TYPE */
0x01, /* Format type - FORMAT_TYPE_1 */
NUM_USB_CHAN_IN_FS, /* bNrChannels - Typically 2 */
FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES, /* subFrameSize - Typically 4 bytes per slot */
FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS, /* bitResolution - Typically 24bit */
USB_IN_SAMP_FREQ_NUM,
CHARIFY_SR(USB_IN_SAMP_FREQ_0),
CHARIFY_SR(USB_IN_SAMP_FREQ_1),
CHARIFY_SR(USB_IN_SAMP_FREQ_2),
/* Standard Endpoint Descriptor */
0x09,
0x05, /* ENDPOINT */
ENDPOINT_ADDRESS_IN_AUDIO, /* EndpointAddress */
#ifdef XUA_ADAPTIVE
ISO_EP_ATTRIBUTES_ADAPTIVE,
#else
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */
#else
ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */
#endif
#endif
FS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE&0xff, /* 4 wMaxPacketSize (Typically 294 bytes)*/
(FS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE&0xff00)>>8, /* 5 wMaxPacketSize */
0x01, /* bInterval */
0x00, /* bRefresh */
0x00, /* bSynchAddress */
/* CS_Endpoint Descriptor */
0x07,
0x25, /* CS_ENDPOINT */
0x01, /* Subtype - GENERAL */
0x01, /* Attributes. D[0]: sample freq ctrl. */
#ifdef XUA_ADAPTIVE
0x02, /* Lock Delay units PCM samples*/
0x08, 0x00, /* No lock delay */
#else
0x00, /* Undefined */
0x00, 0x00, /* Not used */
#endif // XUA_ADAPTIVE
#endif//USB_CMD_CFG_SAMP_FREQ
#endif
#if (XUA_DFU_EN == 1) && (FORCE_UAC1_DFU == 1)

View File

@@ -55,7 +55,7 @@ extern unsigned char mixSel[MAX_MIX_COUNT][MIX_INPUTS];
/* Global var for current frequency, set to default freq */
#if((defined USB_CMD_CFG_SAMP_FREQ) || (defined USB_DESCRIPTOR_OVERRIDE_RATE_RES))
#if(defined USB_DESCRIPTOR_OVERRIDE_RATE_RES)
extern uint32_t get_usb_to_device_rate();
extern uint32_t get_device_to_usb_rate();
extern uint32_t get_usb_to_device_bit_res();
@@ -1121,7 +1121,7 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp
{
return result;
}
#if ((MAX_FREQ != MIN_FREQ) || (defined USB_CMD_CFG_SAMP_FREQ))
#if (MAX_FREQ != MIN_FREQ)
if(controlSelector == SAMPLING_FREQ_CONTROL)
{
/* Expect length 3 for sample rate */