Configuration defines¶
An application using the USB audio framework provided by lib_xua
needs to be configured via
defines. Defaults for these defines are found in lib_xua
in xua_conf_default.h
.
An application should override these defines in an optional xua_conf.h
file or in the
CMakeLists.txt
for the relevant build configuration.
This section documents commonly used defines, for full listings and documentation see the lib_xua
.
Code location (tile)¶
-
AUDIO_IO_TILE¶
Location (tile) of audio I/O. Default: 0.
-
XUD_TILE¶
Location (tile) of audio I/O. Default: 0.
-
MIDI_TILE¶
Location (tile) of MIDI I/O. Default: AUDIO_IO_TILE.
-
PLL_REF_TILE¶
Location (tile) of reference signal to CS2100. Default: AUDIO_IO_TILE.
-
SPDIF_TX_TILE¶
Location (tile) of SPDIF Tx. Default: AUDIO_IO_TILE.
Channel counts¶
-
NUM_USB_CHAN_OUT¶
Number of output channels (host to device). Default: NONE (Must be defined by app)
-
NUM_USB_CHAN_IN¶
Number of input channels (device to host). Default: NONE (Must be defined by app)
-
I2S_CHANS_DAC¶
Number of I2S channesl to DAC/CODEC. Must be a multiple of 2.
Default: NONE (Must be defined by app)
-
I2S_CHANS_ADC¶
Number of I2S channels from ADC/CODEC. Must be a multiple of 2.
Default: NONE (Must be defined by app)
-
DSD_CHANS_DAC¶
Number of DSD output channels.
Default: 0 (disabled)
Frequencies and clocks¶
-
MAX_FREQ¶
Max supported sample frequency for device (Hz).
Default: 192000Hz
-
MIN_FREQ¶
Min supported sample frequency for device (Hz).
Default: 44100Hz
-
MCLK_441¶
Master clock defines for 44100 rates (in Hz).
Default: NONE (Must be defined by app)
-
MCLK_48¶
Master clock defines for 48000 rates (in Hz).
Default: NONE (Must be defined by app)
Audio Class¶
-
AUDIO_CLASS¶
Legacy USB Audio Class version.
Default: 2 (Audio Class version 2.0)
Note: XUA_USB_AUDIO_CLASS_HS and XUA_USB_AUDIO_CLASS_FS are derived from this value. Setting these defines directly will override this value.
System feature configuration¶
MIDI¶
-
MIDI¶
Enable MIDI functionality including buffering, descriptors etc. Default: DISABLED.
-
MIDI_RX_PORT_WIDTH¶
MIDI Rx port width (1 or 4bit). Default: 1.
S/PDIF¶
-
XUA_SPDIF_TX_EN¶
Enables SPDIF Tx. Default: 0 (Disabled)
-
SPDIF_TX_INDEX¶
Defines which output channels (stereo) should be output on S/PDIF. Note, Output channels indexed from 0.
Default: 0 (i.e. channels 0 & 1)
-
XUA_SPDIF_RX_EN¶
Enables SPDIF Rx. Default: 0 (Disabled)
-
SPDIF_RX_INDEX¶
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)
ADAT¶
-
XUA_ADAT_TX_EN¶
Enables ADAT Tx. Default: 0 (Disabled)
-
ADAT_TX_INDEX¶
Defines which output channels (8) should be output on ADAT. Note, Output channels indexed from 0.
Default: 0 (i.e. channels [0:7])
-
XUA_ADAT_RX_EN¶
Enables ADAT Rx. Default: 0 (Disabled)
-
ADAT_RX_INDEX¶
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 XUA_ADAT_RX_EN is true)
PDM Microphones¶
-
XUA_NUM_PDM_MICS¶
Number of PDM microphones in the design.
Default: 0
DFU¶
-
XUA_DFU_EN¶
Enable DFU functionality.
Default: 1 (Enabled)
HID¶
-
HID_CONTROLS¶
Enable HID playback controls functionality.
1 for enabled, 0 for disabled.
Default 0 (Disabled)
CODEC Interface¶
-
CODEC_MASTER¶
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)
USB device configuration¶
-
VENDOR_STR¶
Vendor String used by the device. This is also pre-pended to various strings used by the design.
Default: “XMOS”
-
VENDOR_ID¶
USB Vendor ID (or VID) as assigned by the USB-IF.
Default: 0x20B1 (XMOS)
-
PRODUCT_STR¶
USB Product String for the device. If defined will be used for both PRODUCT_STR_A2 and PRODUCT_STR_A1.
Default: Undefined
-
PRODUCT_STR_A2¶
Product string for Audio Class 2.0 mode.
Default: “XMOS xCORE (UAC2.0)”
-
PRODUCT_STR_A1¶
Product string for Audio Class 1.0 mode.
Default: “XMOS xCORE (UAC1.0)”
-
PID_AUDIO_1¶
USB Product ID (PID) for Audio Class 1.0 mode. Only required if XUA_AUDIO_CLASS_FS == 1.
Default: 0x0003
-
PID_AUDIO_2¶
USB Product ID (PID) for Audio Class 2.0 mode.
Default: 0x0002
-
BCD_DEVICE¶
Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number.
NOTE: User code should not modify this but should modify BCD_DEVICE_J, BCD_DEVICE_M, BCD_DEVICE_N instead
Default: XMOS USB Audio Release version (e.g. 0x0651 for 6.5.1).
Volume control¶
-
OUTPUT_VOLUME_CONTROL¶
Enable/disable output volume control including all processing and descriptor support.
Default: 1 (Enabled)
-
INPUT_VOLUME_CONTROL¶
Enable/disable input volume control including all processing and descriptor support.
Default: 1 (Enabled)
Mixing parameters¶
-
MIXER¶
Enable “mixer” core.
Default: 0 (Disabled)
-
MAX_MIX_COUNT¶
Number of seperate mixes to perform.
Default: 8 if MIXER enabled, else 0
-
MIX_INPUTS¶
Number of channels input into the mixer.
Note, total number of mixer nodes is MIX_INPUTS * MAX_MIX_COUNT
Default: 18
Power¶
-
XUA_POWERMODE¶
Report as self or bus powered device. This affects descriptors and XUD usage and is important for USB compliance.
Default: XUA_POWERMODE_BUS
-
XUA_CHAN_BUFF_CTRL¶
Enable power saving feature in XUA_Buffer_Decouple()
If set to 1 then a channel is instantiated between the XUA_Buffer_Ep() and XUA_Buffer_Decouple() tasks (which together form the buffer between XUD and Audio) that limits shared memory polling in XUA_Buffer_Ep() to occur only when a change has been made by XUA_Buffer_Decouple(). This significantly reduces core power at the cost of two channel ends on the USB_TILE.
-
XUA_LOW_POWER_NON_STREAMING¶
Enable power saving when device is enumerated but audio in not currently streaming.
If set to 1 then transitions to ALT interface 0 (streaming stopped) will cause AudioHub to cease looping and no-longer driver the I2S/TDM lines. In addition, the callback AudioHwShutdown() is called which allows the user to run any specific code (eg. CODEC power-down and/or disable master clock) to further reduce system power in this state. AudioHwInit() and AudioHwConfig() will always be called again prior to USB audio streaming. The transition to the low power state will only occur when both input and output interfaces are not streaming. As soon as either input or output streaming starts then audiohub is restarted.
If set to zero or undefined (default behaviour) then AudioHub will always continue looping even when audio streaming stops. This behaviour may be preferable in applications where frequent initialisation of the mixed signal hardware is undesirable, where other parts of the system rely on I2S clocks being conitinuously available or in MI (musical instrument) applications where functions such as mixer need to continuously operate regardless of USB streaming state.