Set AUDIO_CLASS_FALLBACK to 0 by default

- Remove usage of "defined(AUDIO_CLASS_FALLBACK)"
This commit is contained in:
Luciano Martin
2018-06-01 17:27:33 +01:00
parent cde4a6e41c
commit a8b03de538
5 changed files with 15 additions and 19 deletions

View File

@@ -242,10 +242,6 @@
#define AUDIO_CLASS_FALLBACK 0 /* Default to not falling back to UAC 1 */ #define AUDIO_CLASS_FALLBACK 0 /* Default to not falling back to UAC 1 */
#endif #endif
#if defined(AUDIO_CLASS_FALLBACK) && (AUDIO_CLASS_FALLBACK==0)
#undef AUDIO_CLASS_FALLBACK
#endif
/** /**
* @brief Whether or not to run UAC2 in full-speed. When disabled device can either operate in * @brief Whether or not to run UAC2 in full-speed. When disabled device can either operate in
* UAC1 mode in full-speed (if AUDIO_CLASS_FALLBACK enabled) or return "null" descriptors. * UAC1 mode in full-speed (if AUDIO_CLASS_FALLBACK enabled) or return "null" descriptors.
@@ -254,7 +250,7 @@
*/ */
#if (AUDIO_CLASS == 2) #if (AUDIO_CLASS == 2)
/* Whether to run in Audio Class 2.0 mode in USB Full-speed */ /* Whether to run in Audio Class 2.0 mode in USB Full-speed */
#if !defined(FULL_SPEED_AUDIO_2) && !defined(AUDIO_CLASS_FALLBACK) #if !defined(FULL_SPEED_AUDIO_2) && (AUDIO_CLASS_FALLBACK == 0)
#define FULL_SPEED_AUDIO_2 1 /* Default to falling back to UAC2 */ #define FULL_SPEED_AUDIO_2 1 /* Default to falling back to UAC2 */
#endif #endif
#endif #endif
@@ -264,7 +260,7 @@
#endif #endif
/* Some checks on full-speed functionality */ /* Some checks on full-speed functionality */
#if defined(FULL_SPEED_AUDIO_2) && defined(AUDIO_CLASS_FALLBACK) #if defined(FULL_SPEED_AUDIO_2) && (AUDIO_CLASS_FALLBACK != 0)
#error FULL_SPEED_AUDIO_2 and AUDIO_CLASS_FALLBACK enabled! #error FULL_SPEED_AUDIO_2 and AUDIO_CLASS_FALLBACK enabled!
#endif #endif
@@ -498,7 +494,7 @@
* *
* Default: 0x0003 * Default: 0x0003
*/ */
#if (AUDIO_CLASS==1) || defined(AUDIO_CLASS_FALLBACK) || defined(__DOXYGEN__) #if (AUDIO_CLASS == 1) || (AUDIO_CLASS_FALLBACK != 0) || defined(__DOXYGEN__)
#ifndef PID_AUDIO_1 #ifndef PID_AUDIO_1
#define PID_AUDIO_1 (0x0003) #define PID_AUDIO_1 (0x0003)
#endif #endif

View File

@@ -39,13 +39,13 @@
/* Windows does not have a built in DFU driver (windows will prompt), so warn that DFU will not be functional in Audio 1.0 mode */ /* Windows does not have a built in DFU driver (windows will prompt), so warn that DFU will not be functional in Audio 1.0 mode */
#ifndef FORCE_UAC1_DFU #ifndef FORCE_UAC1_DFU
#if ((AUDIO_CLASS==1) || defined(AUDIO_CLASS_FALLBACK)) && defined(DFU) #if ((AUDIO_CLASS == 1) || (AUDIO_CLASS_FALLBACK != 0)) && defined(DFU)
#warning DFU will not be enabled in AUDIO 1.0 mode due to Windows requesting driver #warning DFU will not be enabled in AUDIO 1.0 mode due to Windows requesting driver
#endif #endif
#endif #endif
/* MIDI not supported in Audio 1.0 mode */ /* MIDI not supported in Audio 1.0 mode */
#if ((AUDIO_CLASS==1) || defined(AUDIO_CLASS_FALLBACK)) && defined(MIDI) #if ((AUDIO_CLASS == 1) || (AUDIO_CLASS_FALLBACK != 0)) && defined(MIDI)
#warning MIDI is currently not supported and will not be enabled in AUDIO 1.0 mode #warning MIDI is currently not supported and will not be enabled in AUDIO 1.0 mode
#endif #endif
@@ -529,7 +529,7 @@ void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
if ((epNum == ENDPOINT_ADDRESS_OUT_AUDIO) || (epNum == ENDPOINT_ADDRESS_IN_AUDIO)) if ((epNum == ENDPOINT_ADDRESS_OUT_AUDIO) || (epNum == ENDPOINT_ADDRESS_IN_AUDIO))
{ {
#if (AUDIO_CLASS == 2) && defined(AUDIO_CLASS_FALLBACK) #if (AUDIO_CLASS == 2) && (AUDIO_CLASS_FALLBACK != 0)
if(g_curUsbSpeed == XUD_SPEED_FS) if(g_curUsbSpeed == XUD_SPEED_FS)
{ {
result = AudioEndpointRequests_1(ep0_out, ep0_in, &sp, c_audioControl, c_mix_ctl, c_clk_ctl); result = AudioEndpointRequests_1(ep0_out, ep0_in, &sp, c_audioControl, c_mix_ctl, c_clk_ctl);
@@ -594,7 +594,7 @@ void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
#endif #endif
) )
{ {
#if (AUDIO_CLASS == 2) && defined(AUDIO_CLASS_FALLBACK) #if (AUDIO_CLASS == 2) && (AUDIO_CLASS_FALLBACK != 0)
if(g_curUsbSpeed == XUD_SPEED_HS) if(g_curUsbSpeed == XUD_SPEED_HS)
{ {
result = AudioClassRequests_2(ep0_out, ep0_in, &sp, c_audioControl, c_mix_ctl, c_clk_ctl); result = AudioClassRequests_2(ep0_out, ep0_in, &sp, c_audioControl, c_mix_ctl, c_clk_ctl);
@@ -645,7 +645,7 @@ void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
if (!DFU_mode_active) if (!DFU_mode_active)
{ {
#endif #endif
#if defined(AUDIO_CLASS_FALLBACK) && (AUDIO_CLASS != 1) #if (AUDIO_CLASS_FALLBACK != 0) && (AUDIO_CLASS != 1)
/* Return Audio 2.0 Descriptors with Audio 1.0 as fallback */ /* Return Audio 2.0 Descriptors with Audio 1.0 as fallback */
result = USB_StandardRequests(ep0_out, ep0_in, result = USB_StandardRequests(ep0_out, ep0_in,
(unsigned char*)&devDesc_Audio2, sizeof(devDesc_Audio2), (unsigned char*)&devDesc_Audio2, sizeof(devDesc_Audio2),

View File

@@ -43,7 +43,7 @@ typedef struct
STR_TABLE_ENTRY(usbInputTermStr_Audio2); /* Users sees as output from host */ STR_TABLE_ENTRY(usbInputTermStr_Audio2); /* Users sees as output from host */
STR_TABLE_ENTRY(usbOutputTermStr_Audio2); /* User sees as input to host */ STR_TABLE_ENTRY(usbOutputTermStr_Audio2); /* User sees as input to host */
#endif #endif
#if defined (AUDIO_CLASS_FALLBACK) || (AUDIO_CLASS == 1) #if (AUDIO_CLASS_FALLBACK != 0) || (AUDIO_CLASS == 1)
/* Audio 1.0 Strings */ /* Audio 1.0 Strings */
STR_TABLE_ENTRY(productStr_Audio1); /* Product string for Audio 1 */ STR_TABLE_ENTRY(productStr_Audio1); /* Product string for Audio 1 */
STR_TABLE_ENTRY(outputInterfaceStr_Audio1); /* iInterface for streaming intefaces */ STR_TABLE_ENTRY(outputInterfaceStr_Audio1); /* iInterface for streaming intefaces */
@@ -317,7 +317,7 @@ StringDescTable_t g_strTable =
.usbInputTermStr_Audio2 = APPEND_PRODUCT_STR_A2(), .usbInputTermStr_Audio2 = APPEND_PRODUCT_STR_A2(),
.usbOutputTermStr_Audio2 = APPEND_PRODUCT_STR_A2(), .usbOutputTermStr_Audio2 = APPEND_PRODUCT_STR_A2(),
#endif #endif
#if defined (AUDIO_CLASS_FALLBACK) || (AUDIO_CLASS == 1) #if (AUDIO_CLASS_FALLBACK != 0) || (AUDIO_CLASS == 1)
.productStr_Audio1 = PRODUCT_STR_A1, .productStr_Audio1 = PRODUCT_STR_A1,
.outputInterfaceStr_Audio1 = APPEND_PRODUCT_STR_A1(), .outputInterfaceStr_Audio1 = APPEND_PRODUCT_STR_A1(),
.inputInterfaceStr_Audio1 = APPEND_PRODUCT_STR_A1(), .inputInterfaceStr_Audio1 = APPEND_PRODUCT_STR_A1(),
@@ -392,7 +392,7 @@ StringDescTable_t g_strTable =
/***** Device Descriptors *****/ /***** Device Descriptors *****/
#if defined(AUDIO_CLASS_FALLBACK) || (AUDIO_CLASS==1) #if (AUDIO_CLASS_FALLBACK != 0) || (AUDIO_CLASS==1)
/* Device Descriptor for Audio Class 1.0 (Assumes Full-Speed) */ /* Device Descriptor for Audio Class 1.0 (Assumes Full-Speed) */
USB_Descriptor_Device_t devDesc_Audio1 = USB_Descriptor_Device_t devDesc_Audio1 =
{ {
@@ -474,7 +474,7 @@ unsigned char devQualDesc_Audio2[] =
0x00 /* 9 bReserved (must be zero) */ 0x00 /* 9 bReserved (must be zero) */
}; };
#if defined(AUDIO_CLASS_FALLBACK) || (AUDIO_CLASS==1) #if (AUDIO_CLASS_FALLBACK != 0) || (AUDIO_CLASS == 1)
/* Device Qualifier Descriptor for running at high-speed (matches audio 1.0 device descriptor) */ /* Device Qualifier Descriptor for running at high-speed (matches audio 1.0 device descriptor) */
unsigned char devQualDesc_Audio1[] = unsigned char devQualDesc_Audio1[] =
{ {
@@ -2208,7 +2208,7 @@ unsigned char cfgDesc_Null[] =
}; };
#if defined (AUDIO_CLASS_FALLBACK) || (AUDIO_CLASS == 1) #if (AUDIO_CLASS_FALLBACK != 0) || (AUDIO_CLASS == 1)
/* Configuration descriptor for Audio v1.0 */ /* Configuration descriptor for Audio v1.0 */
/* Note Audio 1.0 descriptors still a simple array so we need some extra defines regarding lengths.. */ /* Note Audio 1.0 descriptors still a simple array so we need some extra defines regarding lengths.. */
#if (NUM_USB_CHAN_IN > 0) #if (NUM_USB_CHAN_IN > 0)

View File

@@ -1069,7 +1069,7 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
} }
#if defined (AUDIO_CLASS_FALLBACK) || (AUDIO_CLASS==1) #if (AUDIO_CLASS_FALLBACK != 0) || (AUDIO_CLASS == 1)
int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, chanend c_audioControl, chanend ?c_mix_ctl, chanend ?c_clk_ctl) int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, chanend c_audioControl, chanend ?c_mix_ctl, chanend ?c_clk_ctl)
{ {

View File

@@ -46,7 +46,7 @@ Warnings relating to configuration defines located in this XC source file rather
#warning BCD_DEVICE not defined. Using XMOS release version number #warning BCD_DEVICE not defined. Using XMOS release version number
#endif #endif
#if (AUDIO_CLASS==1) || defined(AUDIO_CLASS_FALLBACK) #if (AUDIO_CLASS == 1) || (AUDIO_CLASS_FALLBACK != 0)
#ifndef PID_AUDIO_1 #ifndef PID_AUDIO_1
#warning PID_AUDIO_1 not defined. Using 0x0003 #warning PID_AUDIO_1 not defined. Using 0x0003
#endif #endif