From 5ee04e9656bc72360cb8c8ba1745ecc027f84b99 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Tue, 29 Apr 2014 18:01:35 +0100 Subject: [PATCH] devicedefine.h tidy and update for documentation --- module_usb_audio/devicedefines.h | 1177 +++++++++++++++++++----------- 1 file changed, 763 insertions(+), 414 deletions(-) diff --git a/module_usb_audio/devicedefines.h b/module_usb_audio/devicedefines.h index 24d1e6c6..7929aa86 100644 --- a/module_usb_audio/devicedefines.h +++ b/module_usb_audio/devicedefines.h @@ -1,4 +1,4 @@ -/** +/* * @brief Defines relating to device configuration and customisation. * @author Ross Owen, XMOS Limited */ @@ -9,43 +9,54 @@ #include "customdefines.h" /* Default tile arrangement */ + +/** + * @brief Location (tile) of audio I/O. Default: 0 + */ #ifndef AUDIO_IO_TILE #define AUDIO_IO_TILE 0 #endif +/** + * @brief Location (tile) of audio I/O. Default: 0 + */ #ifndef XUD_TILE #define XUD_TILE 0 #endif +/** + * @brief Location (tile) of IAP. Default: AUDIO_IO_TILE + */ #ifndef IAP_TILE #define IAP_TILE AUDIO_IO_TILE #endif +/** + * @brief Location (tile) of MIDI I/O. Default: AUDIO_IO_TILE + */ #ifndef MIDI_TILE #define MIDI_TILE AUDIO_IO_TILE #endif -/* Tidy up historical INPUT/OUTPUT defines. INPUT/OUTPUT now enabled based on channel count defines */ +/** + * @brief Number of input channels (device to host). Default: NONE (Must be defined by app) + */ #if !defined(NUM_USB_CHAN_IN) #error NUM_USB_CHAN_IN must be defined! -#else - #if (NUM_USB_CHAN_IN == 0) - #undef INPUT - #else - #define INPUT 1 - #endif + #define NUM_USB_CHAN_IN 2 /* Define anyway for doxygen */ #endif +/** + * @brief Number of output channels (host to device). Default: NONE (Must be defined by app) + */ #if !defined(NUM_USB_CHAN_OUT) #error NUM_USB_CHAN_OUT must be defined! -#else - #if (NUM_USB_CHAN_OUT == 0) - #undef OUTPUT - #else - #define OUTPUT 1 - #endif + #define NUM_USB_CHAN_OUT 2 /* Define anyway for doxygen */ #endif +/** + * @brief Number of DSD output channels. Default: 0 + */ #if defined(DSD_CHANS_DAC) #if defined(NATIVE_DSD) && (NATIVE_DSD == 0) #undef NATIVE_DSD @@ -56,116 +67,79 @@ #define DSD_CHANS_DAC 0 #endif -/* Max supported sample freq for device */ +/** + * @brief Number of IS2 channesl to DAC/CODEC. Must be a multiple of 2. + * + * Default: NONE (Must be defined by app) + */ +#ifndef I2S_CHANS_DAC + #error I2S_CHANS_DAC not defined + #define I2S_CHANS_DAC 2 /* Define anyway for doxygen */ +#else +#define I2S_WIRES_DAC (I2S_CHANS_DAC >> 1) +#endif + +/** + * @brief Number of I2S channels from ADC/CODEC. Must be a multiple of 2. + * + * Default: NONE (Must be defined by app) + */ +#ifndef I2S_CHANS_ADC + #error I2S_CHANS_ADC not defined + #define I2S_CHANS_ADC 2 /* Define anyway for doxygen */ +#else +#define I2S_WIRES_ADC (I2S_CHANS_ADC >> 1) +#endif + +/** + * @brief Max supported sample frequency for device (Hz). Default: 192000Hz + */ #ifndef MAX_FREQ #define MAX_FREQ (192000) #endif -/* Min supported sample freq for device */ +/** + * @brief Min supported sample frequency for device (Hz). Default 44100Hz + */ #ifndef MIN_FREQ #define MIN_FREQ (44100) #endif -#if ((MCLK_44 % MIN_FREQ) == 0) -#define MIN_FREQ_44 MIN_FREQ -#define MIN_FREQ_48 ((48000 * 512)/((44100 * 512)/MIN_FREQ)) +/** + * @brief Master clock defines for 44100 rates (in Hz). Default: NOTE (Must be defined by app) + */ +#ifndef MCLK_441 + #error MCLK_441 not defined + #define MCLK_441 (256 * 44100) /* Define anyway for doygen */ #endif -#if ((MCLK_48 % MIN_FREQ) == 0) -#define MIN_FREQ_48 MIN_FREQ -/* * 2 required since we want the next 44.1 based freq above MIN_FREQ */ -#define MIN_FREQ_44 (((44100*512)/((48000 * 512)/MIN_FREQ))*2) +/** + * @brief Master clock defines for 48000 rates (in Hz). Default: NOTE (Must be defined by app) + */ +#ifndef MCLK_48 + #error MCLK_48 not defined + #define MCLK_48 (256 * 48000) /* Define anyway for doygen */ #endif -/* For Audio Class 1.0 and Full-speed Audio 2.0 we always have at most 2 channels */ -#if (NUM_USB_CHAN_OUT > 2) -#define NUM_USB_CHAN_OUT_FS (2) -#else -#define NUM_USB_CHAN_OUT_FS (NUM_USB_CHAN_OUT) +/** + * @brief Default device sample frequency. A safe default should be used. Default: MIN_FREQ + */ +#ifndef DEFAULT_FREQ +#define DEFAULT_FREQ (MIN_FREQ) #endif -#if (NUM_USB_CHAN_IN > 2) -#define NUM_USB_CHAN_IN_FS (2) -#else -#define NUM_USB_CHAN_IN_FS (NUM_USB_CHAN_IN) -#endif +/* Audio Class Defines */ -/* Apply sample-rate restrictions to full-speed operation */ -#if (NUM_USB_CHAN_OUT_FS > 0) && (NUM_USB_CHAN_IN_FS > 0) - #if(MAX_FREQ > 48000) - #define MAX_FREQ_FS 48000 - #else - #define MAX_FREQ_FS MAX_FREQ - #endif -#else - #if (MAX_FREQ > 96000) - #define MAX_FREQ_FS 96000 - #else - #define MAX_FREQ_FS MAX_FREQ - #endif -#endif - -#if defined(IAP) && (IAP == 0) -#undef IAP -#endif - -#if defined(IAP_INT_EP) && (IAP_INT_EP == 0) -#undef IAP_INT_EP -#endif - -#if defined(SU1_ADC_ENABLE) && (SU1_ADC_ENABLE == 0) -#undef SU1_ADC_ENABLE -#endif - -#if defined(HID_CONTROLS) && (HID_CONTROLS == 0) -#undef HID_CONTROLS -#endif - -#if defined(MIDI) && (MIDI == 0) -#undef MIDI -#endif - -#if defined(SPDIF) && (SPDIF == 0) -#undef SPDIF -#endif - -#if defined(INPUT) && (INPUT == 0) -#undef INPUT -#endif - -#if defined(OUTPUT) && (OUTPUT == 0) -#undef OUTPUT -#endif - -#if defined(SPDIF_RX) && (SPDIF_RX == 0) -#undef SPDIF_RX -#endif - -#if defined(ADAT_RX) && (ADAT_RX == 0) -#undef ADAT_RX -#endif - -#if !defined(DFU) -/* Enable DFU by default */ -#define DFU 1 -#elif defined(DFU) && (DFU == 0) -#undef DFU -#endif - -#if defined(CODEC_MASTER) && (CODEC_MASTER == 0) -#undef CODEC_MASTER -#endif - -#if defined(LEVEL_METER_LEDS) && !defined(LEVEL_UPDATE_RATE) -#define LEVEL_UPDATE_RATE 400000 -#endif - -/* USB Audio Class Version. Default to 2.0 */ +/** + * @brief USB Audio Class Version. Default: 2 (Audio Class version 2.0) + */ #ifndef AUDIO_CLASS #define AUDIO_CLASS 2 #endif -/* Whether or not to fall back to Audio Class 1.0 in USB Full-speed */ +/** + * @brief Whether or not to fall back to Audio Class 1.0 in USB Full-speed. Default: 0 (Disabled) + */ #ifndef AUDIO_CLASS_FALLBACK #define AUDIO_CLASS_FALLBACK 0 /* Default to not falling back to UAC 1 */ #endif @@ -174,6 +148,12 @@ #undef AUDIO_CLASS_FALLBACK #endif +/** + * @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. + * + * Default: 1 (Enabled) when AUDIO_CLASS_FALLBACK disabled. + */ #if (AUDIO_CLASS == 2) /* Whether to run in Audio Class 2.0 mode in USB Full-speed */ #if !defined(FULL_SPEED_AUDIO_2) && !defined(AUDIO_CLASS_FALLBACK) @@ -194,117 +174,231 @@ #error AUDIO_CLASS set to 1 and FULL_SPEED_AUDIO_2 enabled! #endif -/* Number of IS2 chans to DAC */ -#ifndef I2S_CHANS_DAC -#error I2S_CHANS_DAC not defined -#else -#define I2S_WIRES_DAC (I2S_CHANS_DAC >> 1) + +/* Feature defines */ + +/** + * @brief Enable MIDI functionality including buffering, descriptors etc. Default: DISABLED + */ +#ifndef MIDI +#define MIDI (0) #endif -/* Number of I2S chans from ADC */ -#ifndef I2S_CHANS_ADC -#error I2S_CHANS_ADC not defined -#else -#define I2S_WIRES_ADC (I2S_CHANS_ADC >> 1) +#if defined(MIDI) && (MIDI == 0) +#undef MIDI #endif -/* SPDIF and ADAT first input chan indices */ -#ifdef SPDIF_RX -#ifndef SPDIF_RX_INDEX -#error SPDIF_RX_INDEX not defined and SPDIF_RX defined -#endif +/** + * @brief MIDI Rx port width (1 or 4bit). Default: 1 + */ +#ifndef MIDI_RX_PORT_WIDTH +#define MIDI_RX_PORT_WIDTH (1) #endif -#ifdef ADAT_RX -#ifndef ADAT_RX_INDEX -#error ADAT_RX_INDEX not defined and ADAT_RX defined -#endif +/** + * @brief Enables SPDIF Tx. Default: 0 (Disabled) + */ +#ifndef SPDIF +#define SPDIF (0) #endif -/* S/PDIF Tx channel index */ +/* Tidy up old SPDIF usage */ +#if defined(SPDIF) && (SPDIF == 0) +#undef SPDIF +#endif + +/** + * @brief Defines which output channels (stereo) should be output on S/PDIF. Note, Output channels indexed from 0. + * + * Default: 0 (i.e. channels 0 & 1) + * */ #ifndef SPDIF_TX_INDEX #define SPDIF_TX_INDEX (0) #endif -/* Default device sample frequency */ -#ifndef DEFAULT_FREQ -#define DEFAULT_FREQ (MIN_FREQ) +/** + * @brief Enables SPDIF Rx. Default: 0 (Disabled) + */ +#ifndef SPDIF_RX +#define SPDIF_RX (0) #endif -/* Master clock defines (in Hz) */ -#ifndef MCLK_441 -#error MCLK_441 not defined +/* Tidy up old SPDIF_RX usage */ +#if defined(SPDIF_RX) && (SPDIF_RX == 0) +#undef SPDIF_RX #endif -#ifndef MCLK_48 -#error MCLK_441 not defined +/** + * @brief Enables ADAT Rx. Default: 0 (Disabled) + */ +#ifndef ADAT_RX +#define ADAT_RX (0) #endif -#if ((MCLK_441 % DEFAULT_FREQ) == 0) -#define DEFAULT_MCLK_FREQ MCLK_441 -#elif ((MCLK_48 % DEFAULT_FREQ) == 0) -#define DEFAULT_MCLK_FREQ MCLK_48 +#if defined(ADAT_RX) && (ADAT_RX == 0) +#undef ADAT_RX +#endif + +/** + * @brief S/PDIF Rx first channel index, defines which channels S/PDIF will be input on. + * Note, indexed from 0. + * + * Default: NONE (Must be defined by app when SPDIF_RX enabled) + */ +#ifdef SPDIF_RX +#ifndef SPDIF_RX_INDEX + #error SPDIF_RX_INDEX not defined and SPDIF_RX defined +#endif +#else + #define SPDIF_RX_INDEX 0 /* Default define for doxygen */ +#endif + +/** + * @brief ADAT Rx first channel index. defines which channels ADAT will be input on. + * Note, indexed from 0. + * + * Default: NONE (Must be defined by app when ADAT_RX enabled) + */ +#ifdef ADAT_RX +#ifndef ADAT_RX_INDEX + #error ADAT_RX_INDEX not defined and ADAT_RX defined +#endif #else -#error Bad DEFAULT_MCLK_FREQ + #define ADAT_RX_INDEX 0 /* Default define for doxygen */ #endif -/* The number of clock ticks to wait for the audio feeback to stabalise - * Note, feedback always counts 128 SOFs (16ms @ HS, 128ms @ FS) */ -#ifndef FEEDBACK_STABILITY_DELAY_HS -#define FEEDBACK_STABILITY_DELAY_HS (2000000) +/** + * @brief Enable DFU functionality. A driver required for Windows operation. + * + * Default: 1 (Enabled) + */ +#if !defined(DFU) +#define DFU (1) +#elif defined(DFU) && (DFU == 0) +#undef DFU #endif -#ifndef FEEDBACK_STABILITY_DELAY_FS -#define FEEDBACK_STABILITY_DELAY_FS (20000000) +/** + * @brief Enable HID playback controls functionality. + * + * 1 for enabled, 0 for disabled. + * + * Default 0 (Disabled) + */ +#ifndef HID_CONTROLS +#define HID_CONTROLS (0) #endif -/* Vendor String */ +#if defined(HID_CONTROLS) && (HID_CONTROLS == 0) +#undef HID_CONTROLS +#endif + +/* @brief Defines whether XMOS device runs as master (i.e. drives LR and Bit clocks) + * + * 0: XMOS is I2S master. 1: CODEC is I2s master. + * + * Default: 0 (XMOS is master) + */ +#ifndef CODEC_MASTER +#define CODEC_MASTER (0) +#endif + +#if defined(CODEC_MASTER) && (CODEC_MASTER == 0) +#undef CODEC_MASTER +#endif + +/** + * @brief Vendor String used by the device. This is also pre-pended to various strings used by the design. + * + * Default: "XMOS" + */ #ifndef VENDOR_STR #define VENDOR_STR "XMOS" #endif -/* USB Vendor ID */ +/** + * @brief USB Vendor ID (or VID) as assigned by the USB-IF + * + * Default: 0x20B1 (XMOS) + */ #ifndef VENDOR_ID #define VENDOR_ID (0x20B1) #endif -/* USB Product String */ +/** + * @brief USB Product String for the device. If defined will be used for both PRODUCT_STR_A2 and PRODUCT_STR_A1 + * + * Default: Undefined + */ #ifdef PRODUCT_STR #define PRODUCT_STR_A2 PRODUCT_STR #define PRODUCT_STR_A1 PRODUCT_STR #endif -/* Product string for Audio Class 2.0 mode */ +#ifdef __DOXYGEN__ +#define PRODUCT_STR "" +#endif + +/** + * @brief Product string for Audio Class 2.0 mode. + * + * Default: "xCore USB Audio 2.0" + */ #ifndef PRODUCT_STR_A2 #define PRODUCT_STR_A2 "xCORE USB Audio 2.0" #endif -/* Product string for Audio Class 1.0 mode */ +/** + * @brief Product string for Audio Class 1.0 mode + * + * Default: "xCore USB Audio 1.0" + */ #ifndef PRODUCT_STR_A1 #define PRODUCT_STR_A1 "xCORE USB Audio 1.0" #endif -/* USB Product ID (PID) for Audio Class 1.0 mode */ -#if (AUDIO_CLASS==1) || defined(AUDIO_CLASS_FALLBACK) +/** + * @brief USB Product ID (PID) for Audio Class 1.0 mode. Only required if AUDIO_CLASS == 1 or AUDIO_CLASS_FALLBACK is enabled. + * + * Default: 0x0003 + */ +#if (AUDIO_CLASS==1) || defined(AUDIO_CLASS_FALLBACK) || defined(__DOXYGEN__) #ifndef PID_AUDIO_1 #define PID_AUDIO_1 (0x0003) #endif #endif -/* USB Product ID (PID) for Audio Class 2.0 mode */ +/** + * @brief USB Product ID (PID) for Audio Class 2.0 mode + * + * Default: 0x0002 + */ #ifndef PID_AUDIO_2 #define PID_AUDIO_2 (0x0002) #endif -/* Device release number in BCD: 0xJJMN */ +/* Auto-generated version number defines */ #define BCD_DEVICE_J 6 #define BCD_DEVICE_M 5 #define BCD_DEVICE_N 1 +/** + * @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number. + * + * Default: XMOS USB Audio Release version (e.g. 0x0651 for 6.5.1) + */ #ifndef BCD_DEVICE #define BCD_DEVICE ((BCD_DEVICE_J << 8) | ((BCD_DEVICE_M & 0xF) << 4) | (BCD_DEVICE_N & 0xF)) #endif + +/** + * @brief Number of supported output stream formats. + * + * Values 1,2,3 supported + * + * Default: 2 + */ #ifndef OUTPUT_FORMAT_COUNT #ifndef NATIVE_DSD /* Default format count is 2 (16bit, 24bit) */ @@ -331,8 +425,16 @@ #endif -/* Default resolutions */ -/* Note, 24 on the lowests in case OUTPUT_FORMAT_COUNT = 1 */ +/* Default sample resolutions for each alternate */ + +/** + * @brief Sample resolution (bits) of output stream Alternate 1. + * + * Default: 24 if Alternate 1 is PCM, else 32 if DSD/RAW + * + * Note, 24 on the lowests alt in case of OUTPUT_FORMAT_COUNT = 1 leaving 24bit as the designs default + * resolution. + */ #ifndef STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS #if (NATIVE_DSD_FORMAT_NUM == 1) #define STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS 32 /* DSD requires 32bits */ @@ -341,6 +443,12 @@ #endif #endif +/** + * @brief Sample resolution (bits) of output stream Alternate 2. + * + * Default: 16 if Alternate 2 is PCM, else 32 if DSD/RAW + * + */ #ifndef STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS #if (NATIVE_DSD_FORMAT_NUM == 2) #define STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS 32 /* DSD requires 32bits */ @@ -349,6 +457,12 @@ #endif #endif +/** + * @brief Sample resolution (bits) of output stream Alternate 3. + * + * Default: 32 if Alternate 2 is PCM, else 32 if DSD/RAW + * + */ #ifndef STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS #if (NATIVE_DSD_FORMAT_NUM == 3) #define STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS 32 /* DSD requires 32bits */ @@ -383,9 +497,17 @@ #define FS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS #endif -/* Setup default subslot size based on resolution - * Catch special 24bit case where 4 byte subslot is nicer for our 32-bit machine. - * Typically do not care about this extra bus overhead at High-speed */ +/* Default sample subslot sizes (based on resolution) */ + +/** + * @brief Sample sub-slot size (bytes) of output stream Alternate 1 when running in high-speed + * + * Default: 4 if resolution for Alternate 1 is 24bits, else resolution / 8 + * + * Note, the default catchs the 24bit special case where 4-byte subslot is nicer for our 32-bit machine. + * Typically do not care about this extra bus overhead at High-speed + * + */ #ifndef HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES #if (HS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS == 24) #define HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES 4 /* 4 byte subslot is nicer for our 32 bit machine to unpack.. */ @@ -394,6 +516,15 @@ #endif #endif +/** + * @brief Sample sub-slot size (bytes) of output stream Alternate 2 when running in high-speed + * + * Default: 4 if resolution for Alternate 2 is 24bits, else resolution / 8 + * + * Note, the default catchs the 24bit special case where 4-byte subslot is nicer for our 32-bit machine. + * Typically do not care about this extra bus overhead at High-speed + * + */ #ifndef HS_STREAM_FORMAT_OUTPUT_2_SUBSLOT_BYTES #if (HS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS == 24) #define HS_STREAM_FORMAT_OUTPUT_2_SUBSLOT_BYTES 4 /* 4 byte subslot is nicer for our 32 bit machine to unpack.. */ @@ -402,6 +533,15 @@ #endif #endif +/** + * @brief Sample sub-slot size (bytes) of output stream Alternate 3 when running in high-speed + * + * Default: 4 if resolution for Alternate 3 is 24bits, else resolution / 8 + * + * Note, the default catchs the 24bit special case where 4-byte subslot is nicer for our 32-bit machine. + * Typically do not care about this extra bus overhead at High-speed + * + */ #ifndef HS_STREAM_FORMAT_OUTPUT_3_SUBSLOT_BYTES #if (HS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS == 24) #define HS_STREAM_FORMAT_OUTPUT_3_SUBSLOT_BYTES 4 /* 4 byte subslot is nicer for our 32 bit machine to unpack.. */ @@ -410,20 +550,52 @@ #endif #endif -/* Setup default FS subslot sizes - make as small as possible */ +/* Default sub-slot sizes for full-speed operation */ + +/** + * @brief Sample sub-slot size (bytes) of output stream Alternate 1 when running in full-speed + * + * Note, in full-speed mode bus bandwidth is at a premium, therefore pack samples into smallest + * possible sub-slot. + * + * Default: STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS / 8 + */ #ifndef FS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES #define FS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES (FS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS/8) #endif +/** + * @brief Sample sub-slot size (bytes) of output stream Alternate 2 when running in full-speed + * + * Note, in full-speed mode bus bandwidth is at a premium, therefore pack samples into smallest + * possible sub-slot. + * + * Default: STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS / 8 + */ #ifndef FS_STREAM_FORMAT_OUTPUT_2_SUBSLOT_BYTES #define FS_STREAM_FORMAT_OUTPUT_2_SUBSLOT_BYTES (FS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS/8) #endif +/** + * @brief Sample sub-slot size (bytes) of output stream Alternate 3 when running in full-speed + * + * Note, in full-speed mode bus bandwidth is at a premium, therefore pack samples into smallest + * possible sub-slot. + * + * Default: STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS / 8 + * + */ #ifndef FS_STREAM_FORMAT_OUTPUT_3_SUBSLOT_BYTES #define FS_STREAM_FORMAT_OUTPUT_3_SUBSLOT_BYTES (FS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS/8) #endif -/* Setup default formats */ +/* Setup default audio data formats */ + +/** + * @brief Sample audio data-format if output stream Alternate 1. + * + * Default: UAC_FORMAT_TYPEI_RAW_DATA when Alternate 1 is RAW/DSD else UAC_FORMAT_TYPEI_PCM + */ #ifndef STREAM_FORMAT_OUTPUT_1_DATAFORMAT #if (NATIVE_DSD_FORMAT_NUM == 1) #define STREAM_FORMAT_OUTPUT_1_DATAFORMAT UAC_FORMAT_TYPEI_RAW_DATA @@ -432,6 +604,11 @@ #endif #endif +/** + * @brief Sample audio data-format if output stream Alternate 2. + * + * Default: UAC_FORMAT_TYPEI_RAW_DATA when Alternate 2 is RAW/DSD else UAC_FORMAT_TYPEI_PCM + */ #ifndef STREAM_FORMAT_OUTPUT_2_DATAFORMAT #if (NATIVE_DSD_FORMAT_NUM == 2) #define STREAM_FORMAT_OUTPUT_2_DATAFORMAT UAC_FORMAT_TYPEI_RAW_DATA @@ -440,6 +617,11 @@ #endif #endif +/** + * @brief Sample audio data-format if output stream Alternate 3. + * + * Default: UAC_FORMAT_TYPEI_RAW_DATA when Alternate 3 is RAW/DSD else UAC_FORMAT_TYPEI_PCM + */ #ifndef STREAM_FORMAT_OUTPUT_3_DATAFORMAT #if (NATIVE_DSD_FORMAT_NUM == 3) #define STREAM_FORMAT_OUTPUT_3_DATAFORMAT UAC_FORMAT_TYPEI_RAW_DATA @@ -448,6 +630,390 @@ #endif #endif +/** + * @brief Number of supported input stream formats. + * + * Currenly only 1 supported + * + * Default: 1 + */ +#ifndef INPUT_FORMAT_COUNT + #define INPUT_FORMAT_COUNT 1 +#endif + +#if (INPUT_FORMAT_COUNT > 1) + /* Only 1 supported */ + #error +#endif + +/** + * @brief Sample resolution (bits) of input stream Alternate 1. + * + * Default: 24 + */ +#ifndef STREAM_FORMAT_INPUT_1_RESOLUTION_BITS + #define STREAM_FORMAT_INPUT_1_RESOLUTION_BITS 24 +#endif + +/* Default resolutions for HS */ +#ifndef HS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS + #define HS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS STREAM_FORMAT_INPUT_1_RESOLUTION_BITS +#endif + +/* Default resolutions for FS (same as HS) */ +#ifndef FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS + #define FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS STREAM_FORMAT_INPUT_1_RESOLUTION_BITS +#endif + +/** + * @brief Sample sub-slot size (bytes) of input stream Alternate 1 when running in high-speed + * + * Default: 4 if resolution for Alternate 1 is 24bits, else resolution / 8 + * + * Note, the default catchs the 24bit special case where 4-byte subslot is nicer for our 32-bit machine. + * Typically do not care about this extra bus overhead at High-speed + * + */ +#ifndef HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES + #if (HS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS == 24) + #define HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES 4 /* 4 byte subslot is nicer for our 32 bit machine to unpack.. */ + #else + #define HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES (HS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS/8) + #endif +#endif + +/** + * @brief Sample sub-slot size (bytes) of input stream Alternate 1 when running in full-speed + * + * Note, in full-speed mode bus bandwidth is at a premium, therefore pack samples into smallest + * possible sub-slot. + * + * Default: STREAM_FORMAT_INPUT_1_RESOLUTION_BITS / 8 + */ +#ifndef FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES + #define FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES (FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS/8) +#endif + +/** + * @brief Sample audio data-format for input stream Alternate 1. + * + * Default: UAC_FORMAT_TYPEI_PCM + */ +#ifndef STREAM_FORMAT_INPUT_1_DATAFORMAT + #define STREAM_FORMAT_INPUT_1_DATAFORMAT UAC_FORMAT_TYPEI_PCM +#endif + +/** + * @brief Enable/disable output volume control including all processing and descriptor support + * + * Default: 1 (Enabled) + */ +#ifndef OUTPUT_VOLUME_CONTROL +#define OUTPUT_VOLUME_CONTROL (1) +#endif + +/** + * @brief Enable/disable input volume control including all processing and descriptor support + * + * Default: 1 (Enabled) + */ +#ifndef INPUT_VOLUME_CONTROL +#define INPUT_VOLUME_CONTROL (1) +#endif + +/* Power */ + +/** + * @brief Report as self to the host when enabled, else reports as bus-powered. This affects descriptors + * and XUD usage. + * + * Default: 0 (Disabled) + */ +#ifndef SELF_POWERED +#define SELF_POWERED (0) +#endif + +/* Tidy-up historical ifndef usage */ +#if defined(SELF_POWERED) && (SELF_POWERED==0) +#undef SELF_POWERED +#endif + +/** + * @brief Power drawn from the host (in mA x 2) + * + * Default: 0 when SELF_POWERED enabled else 250 (500mA) + */ +#ifdef SELF_POWERED + /* Default to taking no power from the bus in self-powered mode */ + #ifndef BMAX_POWER + #define BMAX_POWER 0 + #endif +#else + /* Default to taking 500mA from the bus in bus-powered mode */ + #ifndef BMAX_POWER + #define BMAX_POWER 250 + #endif +#endif + +/* Mixer defines */ + +/** + * @brief Enable "mixer" core + * + * Default: 0 (Disabled) + */ +#ifndef MIXER +#define MIXER (0) +#endif + +/* Tidy up old ifndef usage */ +#if defined(MIXER) && (MIXER == 0) +#undef MIXER +#endif + +/** + * @brief Number of seperate mixes to perform + * + * Default: 8 if MIXER enabled, else 0 + */ +#ifdef MIXER + #ifndef MAX_MIX_COUNT + #define MAX_MIX_COUNT (8) + #endif +#else + #define MAX_MIX_COUNT (0) +#endif + +/** + * @brief Number of channels input into the mixer. + * + * Note, total number of mixer nodes is MIX_INPUTS * MAX_MIX_COUNT + * + * Default: 18 + */ +#ifndef MIX_INPUTS + #define MIX_INPUTS (18) +#endif + +/* Volume processing defines */ + +/** + * @brief The minimum volume setting above -inf. This is a signed 8.8 fixed point + * number that must be strictly greater than -128 (0x8000) + * Default: 0x8100 (-127db) + */ +#ifndef MIN_VOLUME +#define MIN_VOLUME (0x8100) +#endif + + +/** + * @brief The maximum volume setting. This is a signed 8.8 fixed point number. + * + * Default: 0x0000 (0db) + */ +#ifndef MAX_VOLUME +#define MAX_VOLUME (0x0000) +#endif + +/** + * @brief The resolution of the volume control in db as a 8.8 fixed point number + * + * Default: 0x100 (1db) + */ +#ifndef VOLUME_RES +#define VOLUME_RES (0x100) +#endif + +/** + * @brief The minimum volume setting for the mixer unit above -inf. + * This is a signed 8.8 fixed point number that must be strictly greater than -128 (0x8000) + * + * Default: 0x8100 (-127db) + */ +#ifndef MIN_MIXER_VOLUME +#define MIN_MIXER_VOLUME (0x8100) +#endif + +/** + * @brief The maximum volume setting for the mixer. This is a signed 8.8 fixed point number. + * + * Default: 0x0000 (0db) + */ +#ifndef MAX_MIXER_VOLUME +#define MAX_MIXER_VOLUME (0x0000) +#endif + +/** + * @brief The resolution of the volume control in db as a 8.8 fixed point number + * +* Default: 0x100 (1db) +*/ +#ifndef VOLUME_RES_MIXER +#define VOLUME_RES_MIXER (0x100) +#endif + +/* Handle out volume control in the mixer */ +#if defined(OUT_VOLUME_IN_MIXER) && (OUT_VOLUME_IN_MIXER==0) +#undef OUT_VOLUME_IN_MIXER +#else +#if defined(MIXER) +// Enabled by default +#define OUT_VOLUME_IN_MIXER +#endif +#endif + +/* Apply out volume controls after the mix */ +#if defined(OUT_VOLUME_AFTER_MIX) && (OUT_VOLUME_AFTER_MIX==0) +#undef OUT_VOLUME_AFTER_MIX +#else +#if defined(MIXER) && defined(OUT_VOLUME_IN_MIXER) +// Enabled by default +#define OUT_VOLUME_AFTER_MIX +#endif +#endif + +/* Handle in volume control in the mixer */ +#if defined(IN_VOLUME_IN_MIXER) && (IN_VOLUME_IN_MIXER==0) +#undef IN_VOLUME_IN_MIXER +#else +#if defined(MIXER) +/* Enabled by default */ +#define IN_VOLUME_IN_MIXER +#endif +#endif + +/* Apply in volume controls after the mix */ +#if defined(IN_VOLUME_AFTER_MIX) && (IN_VOLUME_AFTER_MIX==0) +#undef IN_VOLUME_AFTER_MIX +#else +#if defined(MIXER) && defined(IN_VOLUME_IN_MIXER) +// Enabled by default +#define IN_VOLUME_AFTER_MIX +#endif +#endif + +/* IAP */ +#if defined(IAP) && (IAP == 0) +#undef IAP +#endif + +/* IAP Interrupt endpoint */ +#if defined(IAP_INT_EP) && (IAP_INT_EP == 0) +#undef IAP_INT_EP +#endif + +/* Endpoint addresses enums */ +enum USBEndpointNumber_In +{ + ENDPOINT_NUMBER_IN_CONTROL, /* Endpoint 0 */ + ENDPOINT_NUMBER_IN_FEEDBACK, + ENDPOINT_NUMBER_IN_AUDIO, +#if defined(SPDIF_RX) || defined(ADAT_RX) + ENDPOINT_NUMBER_IN_INTERRUPT, /* Audio interrupt/status EP */ +#endif +#ifdef MIDI + ENDPOINT_NUMBER_IN_MIDI, +#endif +#ifdef HID_CONTROLS + ENDPOINT_NUMBER_IN_HID, +#endif +#ifdef IAP +#ifdef IAP_INT_EP + ENDPOINT_NUMBER_IN_IAP_INT, +#endif + ENDPOINT_NUMBER_IN_IAP, +#endif + ENDPOINT_COUNT_IN /* End marker */ +}; + +enum USBEndpointNumber_Out +{ + ENDPOINT_NUMBER_OUT_CONTROL, /* Endpoint 0 */ + ENDPOINT_NUMBER_OUT_AUDIO, +#ifdef MIDI + ENDPOINT_NUMBER_OUT_MIDI, +#endif +#ifdef IAP + ENDPOINT_NUMBER_OUT_IAP, +#endif + ENDPOINT_COUNT_OUT /* End marker */ +}; + +/*** Internal defines below here. NOT FOR MODIFICATION ***/ + +#define AUDIO_STOP_FOR_DFU (0x12345678) +#define AUDIO_START_FROM_DFU (0x87654321) +#define AUDIO_REBOOT_FROM_DFU (0xa5a5a5a5) + +#define MAX_VOL (0x20000000) + +#if defined(SU1_ADC_ENABLE) && (SU1_ADC_ENABLE == 0) +#undef SU1_ADC_ENABLE +#endif + +#if defined(LEVEL_METER_LEDS) && !defined(LEVEL_UPDATE_RATE) +#define LEVEL_UPDATE_RATE 400000 +#endif + +/* The number of clock ticks to wait for the audio feeback to stabalise + * Note, feedback always counts 128 SOFs (16ms @ HS, 128ms @ FS) */ +#ifndef FEEDBACK_STABILITY_DELAY_HS +#define FEEDBACK_STABILITY_DELAY_HS (2000000) +#endif + +#ifndef FEEDBACK_STABILITY_DELAY_FS +#define FEEDBACK_STABILITY_DELAY_FS (20000000) +#endif + +/* Length of clock unit/clock-selector units */ +#if defined(SPDIF_RX) && defined(ADAT_RX) +#define NUM_CLOCKS (3) +#elif defined(SPDIF_RX) || defined(ADAT_RX) +#define NUM_CLOCKS (2) +#else +#define NUM_CLOCKS (1) +#endif + +/* Audio Unit ID defines */ +#define FU_USBIN 11 /* Feature Unit: USB Audio device -> host */ +#define FU_USBOUT 10 /* Feature Unit: USB Audio host -> device*/ +#define ID_IT_USB 2 /* Input terminal: USB streaming */ +#define ID_IT_AUD 1 /* Input terminal: Analogue input */ +#define ID_OT_USB 22 /* Output terminal: USB streaming */ +#define ID_OT_AUD 20 /* Output terminal: Analogue output */ + +#define ID_CLKSEL 40 /* Clock selector ID */ +#define ID_CLKSRC_INT 41 /* Clock source ID (internal) */ +#define ID_CLKSRC_SPDIF 42 /* Clock source ID (external) */ +#define ID_CLKSRC_ADAT 43 /* Clock source ID (external) */ + +#define ID_XU_MIXSEL 50 +#define ID_XU_OUT 51 +#define ID_XU_IN 52 + +#define ID_MIXER_1 60 + +/* Defines for DFU */ +#define DFU_PID PID_AUDIO_2 +#define DFU_VENDOR_ID VENDOR_ID +#define DFU_BCD_DEVICE BCD_DEVICE +#define DFU_MANUFACTURER_STR_INDEX offsetof(StringDescTable_t, vendorStr)/sizeof(char *) +#define DFU_PRODUCT_STR_INDEX offsetof(StringDescTable_t, productStr_Audio2)/sizeof(char *) +#endif + +/* USB test mode support enabled by default (Required for compliance testing) */ +#if defined(TEST_MODE_SUPPORT) && (TEST_MODE_SUPPORT == 0) +#undef TEST_MODE_SUPPORT +#else +#define TEST_MODE_SUPPORT 1 +#endif + +#if defined(FAST_MODE) && (FAST_MODE == 0) +#undef FAST_MODE +#endif + + /* Some stream format checks */ #if (OUTPUT_FORMAT_COUNT > 0) #if !defined(HS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS) || \ @@ -509,52 +1075,7 @@ #define STREAM_FORMAT_OUTPUT_SUBSLOT_4_USED 0 #endif -//#ifdef INPUT -#if 1 - - /* Only one Input stream format currently supported */ - #ifndef INPUT_FORMAT_COUNT - #define INPUT_FORMAT_COUNT 1 - #endif - - #if (INPUT_FORMAT_COUNT > 1) - #error - #endif - - #ifndef STREAM_FORMAT_INPUT_1_RESOLUTION_BITS - #define STREAM_FORMAT_INPUT_1_RESOLUTION_BITS 24 - #endif - - /* Default resolutions for HS */ - #ifndef HS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS - #define HS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS STREAM_FORMAT_INPUT_1_RESOLUTION_BITS - #endif - - /* Default resolutions for FS (same as HS) */ - #ifndef FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS - #define FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS STREAM_FORMAT_INPUT_1_RESOLUTION_BITS - #endif - - /* Setup default subslot sized based on resolution */ - #ifndef HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES - #if (HS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS == 24) - #define HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES 4 /* 4 byte subslot is nicer for our 32 bit machine to unpack.. */ - #else - #define HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES (HS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS/8) - #endif - #endif - - /* Setup default FS subslot sizes */ - #ifndef FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES - #define FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES (FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS/8) - #endif - - /* Setup default formats */ - #ifndef STREAM_FORMAT_INPUT_1_DATAFORMAT - #define STREAM_FORMAT_INPUT_1_DATAFORMAT UAC_FORMAT_TYPEI_PCM - #endif - - /* Useful for dropping lower part of macs in volume processing... */ +/* Useful for dropping lower part of macs in volume processing... */ #if (FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS > 24) || (FS_STREAM_FORMAT_INPUT_2_RESOLUTION_BITS > 24) #define STREAM_FORMAT_INPUT_RESOLUTION_32BIT_USED 1 #else @@ -578,228 +1099,56 @@ #else #define STREAM_FORMAT_INPUT_SUBSLOT_2_USED 0 #endif -#endif - -/* Endpoint addresses enums */ -enum USBEndpointNumber_In -{ - ENDPOINT_NUMBER_IN_CONTROL, /* Endpoint 0 */ - ENDPOINT_NUMBER_IN_FEEDBACK, - ENDPOINT_NUMBER_IN_AUDIO, -#if defined(SPDIF_RX) || defined(ADAT_RX) - ENDPOINT_NUMBER_IN_INTERRUPT, /* Audio interrupt/status EP */ -#endif -#ifdef MIDI - ENDPOINT_NUMBER_IN_MIDI, -#endif -#ifdef HID_CONTROLS - ENDPOINT_NUMBER_IN_HID, -#endif -#ifdef IAP -#ifdef IAP_INT_EP - ENDPOINT_NUMBER_IN_IAP_INT, -#endif - ENDPOINT_NUMBER_IN_IAP, -#endif - ENDPOINT_COUNT_IN /* End marker */ -}; - -enum USBEndpointNumber_Out -{ - ENDPOINT_NUMBER_OUT_CONTROL, /* Endpoint 0 */ - ENDPOINT_NUMBER_OUT_AUDIO, -#ifdef MIDI - ENDPOINT_NUMBER_OUT_MIDI, -#endif -#ifdef IAP - ENDPOINT_NUMBER_OUT_IAP, -#endif - ENDPOINT_COUNT_OUT /* End marker */ -}; - -/* Enable output volume control by default */ -#ifndef OUTPUT_VOLUME_CONTROL -#define OUTPUT_VOLUME_CONTROL 1 -#endif - -/* Enable input volume control by default */ -#ifndef INPUT_VOLUME_CONTROL -#define INPUT_VOLUME_CONTROL 1 -#endif -#define AUDIO_STOP_FOR_DFU (0x12345678) -#define AUDIO_START_FROM_DFU (0x87654321) -#define AUDIO_REBOOT_FROM_DFU (0xa5a5a5a5) -#define MAX_VOL (0x20000000) +/* For Audio Class 1.0 and Full-speed Audio 2.0 we always have at most 2 channels */ +#if (NUM_USB_CHAN_OUT > 2) +#define NUM_USB_CHAN_OUT_FS (2) +#else +#define NUM_USB_CHAN_OUT_FS (NUM_USB_CHAN_OUT) +#endif +#if (NUM_USB_CHAN_IN > 2) +#define NUM_USB_CHAN_IN_FS (2) +#else +#define NUM_USB_CHAN_IN_FS (NUM_USB_CHAN_IN) +#endif -#ifdef SELF_POWERED - /* Default to taking no power from the bus in self-powered mode */ - #ifndef BMAX_POWER - #define BMAX_POWER 0 +/* Apply sample-rate restrictions to full-speed operation */ +#if (NUM_USB_CHAN_OUT_FS > 0) && (NUM_USB_CHAN_IN_FS > 0) + #if(MAX_FREQ > 48000) + #define MAX_FREQ_FS 48000 + #else + #define MAX_FREQ_FS MAX_FREQ #endif #else - /* Default to taking 500mA from the bus in bus-powered mode */ - #ifndef BMAX_POWER - #define BMAX_POWER 250 + #if (MAX_FREQ > 96000) + #define MAX_FREQ_FS 96000 + #else + #define MAX_FREQ_FS MAX_FREQ #endif #endif -/* Length of clock unit/clock-selector units */ -#if defined(SPDIF_RX) && defined(ADAT_RX) -#define NUM_CLOCKS (3) -#elif defined(SPDIF_RX) || defined(ADAT_RX) -#define NUM_CLOCKS (2) + + +/* Setup DEFAULT_MCLK_FREQ based on MCLK_ and DEFAULT_FREQ defines */ +#if ((MCLK_441 % DEFAULT_FREQ) == 0) +#define DEFAULT_MCLK_FREQ MCLK_441 +#elif ((MCLK_48 % DEFAULT_FREQ) == 0) +#define DEFAULT_MCLK_FREQ MCLK_48 #else -#define NUM_CLOCKS (1) +#error Bad DEFAULT_MCLK_FREQ #endif -/* Audio Unit ID defines */ -#define FU_USBIN 11 /* Feature Unit: USB Audio device -> host */ -#define FU_USBOUT 10 /* Feature Unit: USB Audio host -> device*/ -#define ID_IT_USB 2 /* Input terminal: USB streaming */ -#define ID_IT_AUD 1 /* Input terminal: Analogue input */ -#define ID_OT_USB 22 /* Output terminal: USB streaming */ -#define ID_OT_AUD 20 /* Output terminal: Analogue output */ - -#define ID_CLKSEL 40 /* Clock selector ID */ -#define ID_CLKSRC_INT 41 /* Clock source ID (internal) */ -#define ID_CLKSRC_SPDIF 42 /* Clock source ID (external) */ -#define ID_CLKSRC_ADAT 43 /* Clock source ID (external) */ - -#define ID_XU_MIXSEL 50 -#define ID_XU_OUT 51 -#define ID_XU_IN 52 - -#define ID_MIXER_1 60 - -/* Mixer defines */ - -#if defined(MIXER) && (MIXER == 0) -#undef MIXER +#if ((MCLK_44 % MIN_FREQ) == 0) +#define MIN_FREQ_44 MIN_FREQ +#define MIN_FREQ_48 ((48000 * 512)/((44100 * 512)/MIN_FREQ)) #endif -#ifndef MIX_INPUTS -#define MIX_INPUTS 18 +#if ((MCLK_48 % MIN_FREQ) == 0) +#define MIN_FREQ_48 MIN_FREQ +/* * 2 required since we want the next 44.1 based freq above MIN_FREQ */ +#define MIN_FREQ_44 (((44100*512)/((48000 * 512)/MIN_FREQ))*2) #endif -#ifdef MIXER - #ifndef MAX_MIX_COUNT - #define MAX_MIX_COUNT 8 - #endif -#else - #define MAX_MIX_COUNT 0 -#endif - -/* Volume defines */ - -#ifndef MIN_VOLUME -/* The minimum volume setting above -inf. This is a signed 8.8 fixed point - number that must be strictly greater than -128 (0x8000) */ -/* Default min volume is -127db */ -#define MIN_VOLUME (0x8100) -#endif - -#ifndef MAX_VOLUME -/* The maximum volume setting. This is a signed 8.8 fixed point number. */ -/* Default max volume is 0db */ -#define MAX_VOLUME (0x0000) -#endif - -#ifndef VOLUME_RES -/* The resolution of the volume control in db as a 8.8 fixed point number */ -/* Default volume resolution 1db */ -#define VOLUME_RES (0x100) -#endif - -#ifndef MIN_MIXER_VOLUME -/* The minimum volume setting for the mixer unit above -inf. - This is a signed 8.8 fixed point - number that must be strictly greater than -128 (0x8000) */ -/* Default min volume is -127db */ -#define MIN_MIXER_VOLUME (0x8100) -#endif - -#ifndef MAX_MIXER_VOLUME -/* The maximum volume setting for the mixer. - This is a signed 8.8 fixed point number. */ -/* Default max volume is 0db */ -#define MAX_MIXER_VOLUME (0x0000) -#endif - -#ifndef VOLUME_RES_MIXER -/* The resolution of the volume control in db as a 8.8 fixed point number */ -/* Default volume resolution 1db */ -#define VOLUME_RES_MIXER (0x100) -#endif - -/* Handle out volume control in the mixer */ -#if defined(OUT_VOLUME_IN_MIXER) && (OUT_VOLUME_IN_MIXER==0) -#undef OUT_VOLUME_IN_MIXER -#else -#if defined(MIXER) -// Enabled by default -#define OUT_VOLUME_IN_MIXER -#endif -#endif - -/* Apply out volume controls after the mix */ -#if defined(OUT_VOLUME_AFTER_MIX) && (OUT_VOLUME_AFTER_MIX==0) -#undef OUT_VOLUME_AFTER_MIX -#else -#if defined(MIXER) && defined(OUT_VOLUME_IN_MIXER) -// Enabled by default -#define OUT_VOLUME_AFTER_MIX -#endif -#endif - -/* Define for reporting as self or bus-powered to the host */ -#if defined(SELF_POWERED) && (SELF_POWERED==0) -#undef SELF_POWERED -#endif - -/* Handle in volume control in the mixer */ -#if defined(IN_VOLUME_IN_MIXER) && (IN_VOLUME_IN_MIXER==0) -#undef IN_VOLUME_IN_MIXER -#else -#if defined(MIXER) -/* Enabled by default */ -#define IN_VOLUME_IN_MIXER -#endif -#endif - -/* Apply in volume controls after the mix */ -#if defined(IN_VOLUME_AFTER_MIX) && (IN_VOLUME_AFTER_MIX==0) -#undef IN_VOLUME_AFTER_MIX -#else -#if defined(MIXER) && defined(IN_VOLUME_IN_MIXER) -// Enabled by default -#define IN_VOLUME_AFTER_MIX -#endif -#endif - -/* Defines for DFU */ -#define DFU_PID PID_AUDIO_2 -#define DFU_VENDOR_ID VENDOR_ID -#define DFU_BCD_DEVICE BCD_DEVICE -#define DFU_MANUFACTURER_STR_INDEX offsetof(StringDescTable_t, vendorStr)/sizeof(char *) -#define DFU_PRODUCT_STR_INDEX offsetof(StringDescTable_t, productStr_Audio2)/sizeof(char *) -#endif - -/* USB test mode support enabled by default (Required for compliance testing) */ -#if defined(TEST_MODE_SUPPORT) && (TEST_MODE_SUPPORT == 0) -#undef TEST_MODE_SUPPORT -#else -#define TEST_MODE_SUPPORT 1 -#endif - -#if defined(FAST_MODE) && (FAST_MODE == 0) -#undef FAST_MODE -#endif - -/* Default MIDI Rx port width */ -#ifndef MIDI_RX_PORT_WIDTH -#define MIDI_RX_PORT_WIDTH 1 -#endif