forked from PAWPAW-Mirror/lib_xua
Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee75327d34 | ||
|
|
2fb8bd6d49 | ||
|
|
2dc860b9aa | ||
|
|
67f8badbe7 | ||
|
|
8be5f0a31f | ||
|
|
acd5e5f951 | ||
|
|
0286ca093d | ||
|
|
2e8e57d5fa | ||
|
|
0b32bee3aa | ||
|
|
e0ab8d4346 | ||
|
|
0eaefc3478 | ||
|
|
dcfe0235ad | ||
|
|
58713733a2 | ||
|
|
a135b674f7 | ||
|
|
43eb63e271 | ||
|
|
7d06aa543a | ||
|
|
235b06f00a | ||
|
|
f90022618b | ||
|
|
5b1132a603 | ||
|
|
2e6ce1e4e1 | ||
|
|
a48ae96f39 | ||
|
|
ebe263605c | ||
|
|
502db6ee48 | ||
|
|
df8cdd8692 | ||
|
|
83b8c727f6 | ||
|
|
3cbb8282c7 | ||
|
|
9cd76b2a4b | ||
|
|
7d1d2af8d2 | ||
|
|
fa3ccb555b | ||
|
|
9ea6a3de3c | ||
|
|
58eb2fe612 | ||
|
|
f4ab2d9b82 | ||
|
|
5a1865d9d5 | ||
|
|
c59a545197 | ||
|
|
232ab79f78 | ||
|
|
2aab72a817 | ||
|
|
156bf61b62 | ||
|
|
408d9b7c42 | ||
|
|
a572bf9c5a |
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
@@ -1 +0,0 @@
|
||||
* @xross
|
||||
16
.gitignore
vendored
16
.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
*.log
|
||||
module_dfu/host/xmosdfu/xmosdfu
|
||||
*.dSYM
|
||||
*/.build_*/*
|
||||
*/bin/*
|
||||
@@ -10,24 +11,15 @@
|
||||
*.xi
|
||||
*.i
|
||||
*.bin
|
||||
.build*
|
||||
*/.venv/*
|
||||
*~
|
||||
*.a
|
||||
*.swp
|
||||
*.*~
|
||||
*.pyc
|
||||
.build*
|
||||
.DS_Store
|
||||
test_results.csv
|
||||
_build*
|
||||
**/.venv/**
|
||||
**/.vscode/**
|
||||
**.egg-info
|
||||
*.pdf
|
||||
|
||||
# waf build files
|
||||
.lock-waf_*
|
||||
.waf-*/
|
||||
build/
|
||||
.build*
|
||||
*.pyc
|
||||
xscope.xmt
|
||||
host/xmosdfu/xmosdfu
|
||||
|
||||
7
Brewfile
Normal file
7
Brewfile
Normal file
@@ -0,0 +1,7 @@
|
||||
tap 'homebrew/core'
|
||||
|
||||
brew 'perl'
|
||||
brew 'cpanm'
|
||||
|
||||
brew 'python@2'
|
||||
brew 'pipenv'
|
||||
441
CHANGELOG.rst
441
CHANGELOG.rst
@@ -1,202 +1,41 @@
|
||||
lib_xua Change Log
|
||||
==================
|
||||
|
||||
3.2.0
|
||||
0.1.5
|
||||
-----
|
||||
|
||||
* CHANGED: Updated tests to use lib_locks (was legacy module_locks)
|
||||
* CHANGED: Exclude HID Report functions unless the HID feature is enabled
|
||||
* CHANGED: Explicit feedback EP enabled by default (see
|
||||
UAC_FORCE_FEEDBACK_EP)
|
||||
* FIXED: Incorrect conditional compilation of HID report code
|
||||
* FIXED: Input/output descriptors written when input/output not enabled.
|
||||
(Audio class 1.0 mode using XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES)
|
||||
* CHANGED: Update lib_xud dependency to v1.1.1
|
||||
|
||||
* Changes to dependencies:
|
||||
|
||||
- lib_dsp: 5.0.0 -> 6.2.1
|
||||
|
||||
- lib_locks: Added dependency 2.1.0
|
||||
|
||||
- lib_logging: 3.0.0 -> 3.1.1
|
||||
|
||||
- lib_mic_array: 4.0.0 -> 4.5.0
|
||||
|
||||
- lib_spdif: 4.0.0 -> 4.1.0
|
||||
|
||||
- lib_xassert: 4.0.0 -> 4.1.0
|
||||
|
||||
- lib_xud: 2.0.0 -> 2.1.0
|
||||
|
||||
3.1.0
|
||||
0.1.4
|
||||
-----
|
||||
|
||||
* CHANGED: Removed logic from HID API functions allowing a Report ID of 0 to
|
||||
be used as "all/any" Report
|
||||
* RESOLVED: Zero length input packets generated before enumeration causing I2S
|
||||
timing pushout at startup
|
||||
|
||||
3.0.0
|
||||
0.1.3
|
||||
-----
|
||||
|
||||
* ADDED: Support for HID Report IDs
|
||||
* CHANGED: Renamed the HID API file xua_hid_report_descriptor.h to
|
||||
xua_hid_report.h
|
||||
* REMOVED: Support for HID Reports containing controls from mixed usage
|
||||
pages
|
||||
|
||||
2.1.1
|
||||
-----
|
||||
|
||||
* CHANGED: Setting of HID report items
|
||||
|
||||
2.1.0
|
||||
-----
|
||||
|
||||
* CHANGED: Updated clock blocks to support lib_xud v2.0.0
|
||||
|
||||
* Changes to dependencies:
|
||||
|
||||
- lib_xud: 1.2.0 -> 2.0.0
|
||||
|
||||
2.0.0
|
||||
-----
|
||||
|
||||
* ADDED: Function to get a Report item description
|
||||
* ADDED: Support for multiple flash specs defined by DFU_FLASH_DEVICE
|
||||
* ADDED: Nullable c_aud_ctl chan-end optimisation for fixed rate devices
|
||||
* CHANGED: Check HID Usage Page when changing a Report item description
|
||||
* CHANGED: HID event ID from list to bit and byte location in HID Report
|
||||
* CHANGED: Interface to UserHIDRecordEvent()
|
||||
|
||||
1.3.0
|
||||
-----
|
||||
|
||||
* ADDED: Build default HID Report descriptor at boot-time
|
||||
* ADDED: Function to return length of HID Report
|
||||
* CHANGED: Move HID descriptors to ease maintenance
|
||||
* CHANGED: Move legacy tests to separate directory
|
||||
* CHANGED: Replace unused GPI-specific HID event names with generic ones
|
||||
* CHANGED: HID Report to return multiple bytes
|
||||
* CHANGED: NO_USB conditional compilation switch with XUA_USB_EN
|
||||
* CHANGED: Clock blocks used for BCLK and MCLK
|
||||
* CHANGED: Arguments no longer supported by XUD_Main
|
||||
* REMOVED: Support for XS1 based devices
|
||||
|
||||
1.2.0
|
||||
-----
|
||||
|
||||
* ADDED: Updates for xcore.ai/XS3 compatibility
|
||||
* ADDED: Makefile.Win32 for xmosdfu on Windows
|
||||
* CHANGED: Use XMOS Public Licence Version 1
|
||||
* FIXED: Bump default BCD device number to v1.2.0
|
||||
* FIXED: xmosdfu now fails with an error when given a directory (#119)
|
||||
* FIXED: Compilation errors related to HID code
|
||||
* FIXED: Runtime error when using mic array interface
|
||||
* FIXED: Automate HID Report Descriptor length in AC1 HID Descriptor
|
||||
|
||||
1.1.1
|
||||
-----
|
||||
|
||||
* CHANGED: Pin Python package versions
|
||||
* FIXED: Zero length input packets generated before enumeration causing
|
||||
I2S timing pushout at startup
|
||||
|
||||
1.1.0
|
||||
-----
|
||||
|
||||
* ADDED: Ability to read or modify serial number string
|
||||
|
||||
1.0.1
|
||||
-----
|
||||
|
||||
* FIXED: Wrong size of vendor and product strings
|
||||
|
||||
1.0.0
|
||||
-----
|
||||
|
||||
* ADDED: UAC1 HID support with simulated Voice Command detection reported
|
||||
every 10 seconds
|
||||
* ADDED: Support for USB HID Set Idle request
|
||||
* ADDED: Pre-processor symbols to enable single-threaded, dual-PDM
|
||||
microphone operation
|
||||
* ADDED: Guards to user_hid.h and xua_hid.h
|
||||
* ADDED: UAC1 HID support for AC Stop (End Call), Volume Increment and
|
||||
Volume Decrement
|
||||
* CHANGED: UAC1 HID to report function keys f21 through f24 as specified by
|
||||
customer
|
||||
* CHANGED: HID interface for user to set and clear events from global
|
||||
variable to function
|
||||
* CHANGE HID report descriptor to use generic events instead of GPI
|
||||
events, to report Key-phrase detection as AC Search, and to report end-call
|
||||
detection as AC Stop
|
||||
* ADDED: Ability to read or modify vendor and product IDs and strings
|
||||
* ADDED: Ability to read or modify bcdDevice
|
||||
* ADDED: Override USB descriptor with sampling frequency and
|
||||
bit-resolution set at boot time.
|
||||
* ADDED: Global pointer to allow external access to masterClockFreq
|
||||
* FIXED: Descriptors for XUA_ADAPTIVE incorrectly defined for IN endpoint
|
||||
|
||||
* Changes to dependencies:
|
||||
|
||||
- lib_spdif: 3.1.0 -> 4.0.0
|
||||
|
||||
- lib_xassert: 3.0.1 -> 4.0.0
|
||||
|
||||
0.2.1
|
||||
-----
|
||||
|
||||
* FIXED: Fix descriptors for XUA_ADAPTIVE
|
||||
|
||||
* Changes to dependencies:
|
||||
|
||||
- lib_logging: 2.1.1 -> 3.0.0
|
||||
|
||||
- lib_xud: 0.1.0 -> 0.2.0
|
||||
|
||||
0.2.0
|
||||
-----
|
||||
|
||||
* ADDED: Initial library documentation
|
||||
* ADDED: Application note AN00247: Using lib_xua with lib_spdif (transmit)
|
||||
* ADDED: Separate callbacks for input/output audio stream start/stop
|
||||
* CHANGED: I2S hardware resources no longer used globally and must be passed
|
||||
to XUA_AudioHub()
|
||||
* CHANGED: XUA_AudioHub() no longer pars S/PDIF transmitter task
|
||||
* CHANGED: Moved to lib_spdif (from module_spdif_tx & module_spdif_rx)
|
||||
* CHANGED: Define NUM_PDM_MICS renamed to XUA_NUM_PDM_MICS
|
||||
* CHANGED: Define NO_USB renamed to XUA_USB_EN
|
||||
* CHANGED: Build files updated to support new "xcommon" behaviour in xwaf.
|
||||
* FIXED: wChannelConfig in UAC1 descriptor set according to output channel
|
||||
count
|
||||
* FIXED: Indexing of ADAT channel strings (#18059)
|
||||
* FIXED: Rebooting device fails when PLL config "not reset" bit is set
|
||||
|
||||
* Changes to dependencies:
|
||||
|
||||
- lib_dsp: Added dependency 5.0.0
|
||||
|
||||
- lib_mic_array: Added dependency 4.0.0
|
||||
|
||||
- lib_spdif: Added dependency 3.1.0
|
||||
|
||||
- lib_xassert: Added dependency 3.0.1
|
||||
* CHANGED: Remove sharing of global master clock port variable for
|
||||
compatibility with tools 14.4 (API change but preserve 0.1 version as this
|
||||
is maintenance branch)
|
||||
* CHANGED: Remove obsolete -fsubword-select to clear warning in tools 14.4
|
||||
|
||||
0.1.2
|
||||
-----
|
||||
|
||||
* ADDED: Application note AN00246: Simple USB Audio Device using lib_xua
|
||||
* CHANGED: xmosdfu emits warning if empty image read via upload
|
||||
* CHANGED: Simplified mclk port sharing - no longer uses unsafe pointer
|
||||
* FIXED: Runtime exception issues when incorrect feedback calculated
|
||||
(introduced in sc_usb_audio 6.13)
|
||||
* FIXED: Output sample counter reset on stream start. Caused playback
|
||||
* ADDED: Application note AN00246
|
||||
* RESOLVED: Runtime exception issues when incorrect feedback calculated
|
||||
(introduced in sc_xud 6.13)
|
||||
* RESOLVED: Output sample counter reset on stream start. Caused playback
|
||||
issues on some Linux based hosts
|
||||
|
||||
0.1.1
|
||||
-----
|
||||
|
||||
* FIXED: Configurations where I2S_CHANS_DAC and I2S_CHANS_ADC are both 0 now
|
||||
build
|
||||
* FIXED: Deadlock in mixer when MAX_MIX_COUNT > 0 for larger channel counts
|
||||
* RESOLVED: Configurations where I2S_CHANS_DAC and I2S_CHANS_ADC are both 0
|
||||
now build
|
||||
* RESOLVED: Deadlock in mixer when MAX_MIX_COUNT > 0 for larger channel
|
||||
counts
|
||||
|
||||
* Changes to dependencies:
|
||||
|
||||
@@ -207,139 +46,139 @@ lib_xua Change Log
|
||||
0.1.0
|
||||
-----
|
||||
|
||||
* ADDED: FB_USE_REF_CLOCK to allow feedback generation from xCORE internal
|
||||
reference
|
||||
* ADDED: Linux Makefile for xmosdfu host application
|
||||
* ADDED: Raspberry Pi Makefile for xmosdfu host application
|
||||
* ADDED: Documentation of PID argument to xmosdfu
|
||||
* ADDED: Optional build time microphone delay line (MIC_BUFFER_DEPTH)
|
||||
* CHANGED: Removal of audManage_if, users should define their own interfaces
|
||||
as required
|
||||
* CHANGED: Vendor specific control interface in UAC1 descriptor now has a
|
||||
* ADDED: FB_USE_REF_CLOCK to allow feedback generation from xCORE
|
||||
internal reference
|
||||
* ADDED: Linux Makefile for xmosdfu host application
|
||||
* ADDED: Raspberry Pi Makefile for xmosdfu host application
|
||||
* ADDED: Documentation of PID argument to xmosdfu
|
||||
* ADDED: Optional build time microphone delay line (MIC_BUFFER_DEPTH)
|
||||
* CHANGE: Removal of audManage_if, users should define their own
|
||||
interfaces as required
|
||||
* CHANGE: Vendor specific control interface in UAC1 descriptor now has a
|
||||
string descriptor so it shows up with a descriptive name in Windows Device
|
||||
Manager
|
||||
* CHANGED: DFU_BCD_DEVICE removed (now uses BCD_DEVICE)
|
||||
* CHANGED: Renaming in descriptors.h to avoid clashes with application
|
||||
* CHANGED: Make device reboot function no-argument (was one channel end)
|
||||
* FIXED: FIR gain compensation for PDM mics set incorrectly for divide of
|
||||
* CHANGE: DFU_BCD_DEVICE removed (now uses BCD_DEVICE)
|
||||
* CHANGE: Renaming in descriptors.h to avoid clashes with application
|
||||
* CHANGE: Make device reboot function no-argument (was one channel end)
|
||||
* RESOLVED: FIR gain compensation for PDM mics set incorrectly for divide of
|
||||
8
|
||||
* FIXED: Incorrect xmosdfu DYLD path in test script code
|
||||
* FIXED: xmosdfu cannot find XMOS device on modern MacBook Pro (#17897)
|
||||
* FIXED: Issue when feedback is initially incorrect when two SOF's are not
|
||||
yet received
|
||||
* FIXED: AUDIO_TILE and PDM_TILE may now share the same value/tile
|
||||
* FIXED: Cope with out of order interface numbers in xmosdfu
|
||||
* FIXED: DSD playback not functional on xCORE-200 (introduced in
|
||||
* RESOLVED: Incorrect xmosdfu DYLD path in test script code
|
||||
* RESOLVED: xmosdfu cannot find XMOS device on modern MacBook Pro (#17897)
|
||||
* RESOLVED: Issue when feedback is initially incorrect when two SOF's are
|
||||
not yet received
|
||||
* RESOLVED: AUDIO_TILE and PDM_TILE may now share the same value/tile
|
||||
* RESOLVED: Cope with out of order interface numbers in xmosdfu
|
||||
* RESOLVED: DSD playback not functional on xCORE-200 (introduced in
|
||||
sc_usb_audio 6.14)
|
||||
* FIXED: Improvements made to clock sync code in TDM slave mode
|
||||
* RESOLVED: Improvements made to clock sync code in TDM slave mode
|
||||
|
||||
|
||||
Legacy release history
|
||||
----------------------
|
||||
======================
|
||||
|
||||
(Note: Forked from sc_usb_audio at this point)
|
||||
|
||||
7.4.1
|
||||
-----
|
||||
- FIXED: Exception due to null chanend when using NO_USB
|
||||
- RESOLVED: Exception due to null chanend when using NO_USB
|
||||
|
||||
7.4.0
|
||||
-----
|
||||
- FIXED: PID_DFU now based on AUDIO_CLASS. This potentially caused issues
|
||||
- RESOLVED: PID_DFU now based on AUDIO_CLASS. This potentially caused issues
|
||||
with UAC1 DFU
|
||||
|
||||
|
||||
7.3.0
|
||||
-----
|
||||
- CHANGED: Example OSX DFU host app updated to now take PID as runtime
|
||||
- CHANGE: Example OSX DFU host app updated to now take PID as runtime
|
||||
argument. This enabled multiple XMOS devices to be attached to the host
|
||||
during DFU process
|
||||
|
||||
7.2.0
|
||||
-----
|
||||
- ADDED: DFU to UAC1 descriptors (guarded by DFU and FORCE_UAC1_DFU)
|
||||
- FIXED: Removed 'reinterpretation to type of larger alignment' warnings
|
||||
- FIXED: DFU flash code run on tile[0] even if XUD_TILE and AUDIO_IO_TILE are not 0
|
||||
- RESOLVED: Removed 'reinterpretation to type of larger alignment' warnings
|
||||
- RESOLVED: DFU flash code run on tile[0] even if XUD_TILE and AUDIO_IO_TILE are not 0
|
||||
|
||||
7.1.0
|
||||
-----
|
||||
- ADDED: UserBufferManagementInit() to reset any state required in UserBufferManagement()
|
||||
- ADDED: I2S output up-sampling (enabled when AUD_TO_USB_RATIO is > 1)
|
||||
- ADDED: PDM Mic decimator output rate can now be controlled independently (via AUD_TO_MICS_RATIO)
|
||||
- CHANGED: Rename I2S input down-sampling (enabled when AUD_TO_USB_RATIO is > 1, rather than via I2S_DOWNSAMPLE_FACTOR)
|
||||
- FIXED: Crosstalk between input channels when I2S input down-sampling is enabled
|
||||
- FIXED: Mic decimation data tables properly sized when mic sample-rate < USB audio sample-rate
|
||||
- CHANGE: Rename I2S input down-sampling (enabled when AUD_TO_USB_RATIO is > 1, rather than via I2S_DOWNSAMPLE_FACTOR)
|
||||
- RESOLVED: Crosstalk between input channels when I2S input down-sampling is enabled
|
||||
- RESOLVED: Mic decimation data tables properly sized when mic sample-rate < USB audio sample-rate
|
||||
|
||||
7.0.1
|
||||
-----
|
||||
- FIXED: PDM microphone decimation issue at some sample rates caused by integration
|
||||
- RESOLVED: PDM microphone decimation issue at some sample rates caused by integration
|
||||
|
||||
7.0.0
|
||||
------
|
||||
- ADDED: I2S down-sampling (I2S_DOWNSAMPLE_FACTOR)
|
||||
- ADDED: I2S resynchronisation when in slave mode (CODEC_MASTER=1)
|
||||
- CHANGED: Various memory optimisations when MAX_FREQ = MIN_FREQ
|
||||
- CHANGED: Memory optimisations in audio buffering
|
||||
- CHANGED: Various memory optimisations in UAC1 mode
|
||||
- CHANGED: user_pdm_process() API change
|
||||
- CHANGED: PDM Mic decimator table now related to MIN_FREQ (memory optimisation)
|
||||
- FIXED: Audio request interrupt handler properly eliminated
|
||||
- CHANGE: Various memory optimisations when MAX_FREQ = MIN_FREQ
|
||||
- CHANGE: Memory optimisations in audio buffering
|
||||
- CHANGE: Various memory optimisations in UAC1 mode
|
||||
- CHANGE: user_pdm_process() API change
|
||||
- CHANGE: PDM Mic decimator table now related to MIN_FREQ (memory optimisation)
|
||||
- RESOLVED: Audio request interrupt handler properly eliminated
|
||||
|
||||
6.30.0
|
||||
------
|
||||
- FIXED: Number of PDM microphone channels configured now based on NUM_PDM_MICS define
|
||||
(previously hard-coded)
|
||||
- FIXED: PDM microphone clock divide now based MCLK defines (previously hard-coded)
|
||||
- CHANGED: Second microphone decimation core only run if NUM_PDM_MICS > 4
|
||||
- RESOLVED: Number of PDM microphone channels configured now based on NUM_PDM_MICS define
|
||||
(previously hard-coded)
|
||||
- RESOLVED: PDM microphone clock divide now based MCLK defines (previously hard-coded)
|
||||
- CHANGE: Second microphone decimation core only run if NUM_PDM_MICS > 4
|
||||
|
||||
6.20.0
|
||||
------
|
||||
- FIXED: Intra-frame sample delays of 1/2 samples on input streaming in TDM mode
|
||||
- FIXED: Build issue with NUM_USB_CHAN_OUT set to 0 and MIXER enabled
|
||||
- FIXED: SPDIF_TX_INDEX not defined build warning only emitted when SPDIF_TX defined
|
||||
- FIXED: Failure to enter DFU mode when configured without input volume control
|
||||
- RESOLVED: Intra-frame sample delays of 1/2 samples on input streaming in TDM mode
|
||||
- RESOLVED: Build issue with NUM_USB_CHAN_OUT set to 0 and MIXER enabled
|
||||
- RESOLVED: SPDIF_TX_INDEX not defined build warning only emitted when SPDIF_TX defined
|
||||
- RESOLVED: Failure to enter DFU mode when configured without input volume control
|
||||
|
||||
6.19.0
|
||||
------
|
||||
- FIXED: SPDIF_TX_INDEX not defined build warning only emitted when SPDIF_TX defined
|
||||
- FIXED: Failure to enter DFU mode when configured without input volume control
|
||||
- RESOLVED: SPDIF_TX_INDEX not defined build warning only emitted when SPDIF_TX defined
|
||||
- RESOLVED: Failure to enter DFU mode when configured without input volume control
|
||||
|
||||
6.18.1
|
||||
------
|
||||
- ADDED: Vendor Specific control interface added to UAC1 descriptors to allow control of
|
||||
XVSM params from Windows (via lib_usb)
|
||||
- ADDED: Vendor Specific control interface added to UAC1 descriptors to allow control of
|
||||
XVSM params from Windows (via lib_usb)
|
||||
|
||||
6.18.0
|
||||
------
|
||||
- ADDED: Call to VendorRequests() and VendorRequests_Init() to Endpoint 0
|
||||
- ADDED: VENDOR_REQUESTS_PARAMS define to allow for custom parameters to VendorRequest calls
|
||||
- FIXED: FIR gain compensation set appropriately in lib_mic_array usage
|
||||
- CHANGED: i_dsp interface renamed i_audManage
|
||||
- ADDED: Call to VendorRequests() and VendorRequests_Init() to Endpoint 0
|
||||
- ADDED: VENDOR_REQUESTS_PARAMS define to allow for custom parameters to VendorRequest calls
|
||||
- RESOLVED: FIR gain compensation set appropriately in lib_mic_array usage
|
||||
- CHANGE: i_dsp interface renamed i_audManage
|
||||
|
||||
6.16.0
|
||||
------
|
||||
- ADDED: Call to UserBufferManagement()
|
||||
- ADDED: PDM_MIC_INDEX in devicedefines.h and usage
|
||||
- CHANGED: pdm_buffer() task now combinable
|
||||
- CHANGED: Audio I/O task now takes i_dsp interface as a parameter
|
||||
- CHANGED: Removed built-in support for A/U series internal ADC
|
||||
- CHANGED: User PDM Microphone processing now uses an interface (previously function call)
|
||||
- CHANGE: pdm_buffer() task now combinable
|
||||
- CHANGE: Audio I/O task now takes i_dsp interface as a parameter
|
||||
- CHANGE: Removed built-in support for A/U series internal ADC
|
||||
- CHANGE: User PDM Microphone processing now uses an interface (previously function call)
|
||||
|
||||
6.15.2
|
||||
------
|
||||
- FIXED: interrupt.h (used in audio buffering) now compatible with xCORE-200 ABI
|
||||
- RESOLVED: interrupt.h (used in audio buffering) now compatible with xCORE-200 ABI
|
||||
|
||||
6.15.1
|
||||
------
|
||||
- FIXED: DAC data mis-alignment issue in TDM/I2S slave mode
|
||||
- CHANGED: Updates to support API changes in lib_mic_array version 2.0
|
||||
- RESOLVED: DAC data mis-alignment issue in TDM/I2S slave mode
|
||||
- CHANGE: Updates to support API changes in lib_mic_array version 2.0
|
||||
|
||||
6.15.0
|
||||
------
|
||||
|
||||
- FIXED: UAC 1.0 descriptors now support multi-channel volume control (previously were
|
||||
- RESOLVED: UAC 1.0 descriptors now support multi-channel volume control (previously were
|
||||
hard-coded as stereo)
|
||||
- CHANGED: Removed 32kHz sample-rate support when PDM microphones enabled (lib_mic_array
|
||||
- CHANGE: Removed 32kHz sample-rate support when PDM microphones enabled (lib_mic_array
|
||||
currently does not support non-integer decimation factors)
|
||||
|
||||
6.14.0
|
||||
@@ -353,75 +192,75 @@ Legacy release history
|
||||
list and UAC 1.0 descriptors
|
||||
- ADDED: Support for the use and integration of PDM microphones (including PDM to PCM
|
||||
conversion) via lib_mic_array
|
||||
- FIXED: MIDI data not accepted after "sleep" in OSX 10.11 (El Capitan) - related to sc_xud
|
||||
- RESOLVED: MIDI data not accepted after "sleep" in OSX 10.11 (El Capitan) - related to sc_xud
|
||||
issue #17092
|
||||
- CHANGED: Asynchronous feedback system re-implemented to allow for the first two ADDED
|
||||
- CHANGE: Asynchronous feedback system re-implemented to allow for the first two ADDED
|
||||
changelog items
|
||||
- CHANGED: Hardware divider used to generate bit-clock from master clock (xCORE-200 only).
|
||||
- CHANGE: Hardware divider used to generate bit-clock from master clock (xCORE-200 only).
|
||||
Allows easy support for greater number of master-clock to sample-rate ratios.
|
||||
- CHANGED: module_queue no longer uses any assert module/lib
|
||||
- CHANGE: module_queue no longer uses any assert module/lib
|
||||
|
||||
6.13.0
|
||||
------
|
||||
- ADDED: Device now uses implicit feedback when input stream is available (previously explicit
|
||||
feedback pipe always used). This saves chanend/EP resources and means less processing
|
||||
burden for the host. Previous behaviour available by enabling UAC_FORCE_FEEDBACK_EP
|
||||
- FIXED: Exception when SPDIF_TX and ADAT_TX both enabled due to clock-block being configured
|
||||
- RESOLVED: Exception when SPDIF_TX and ADAT_TX both enabled due to clock-block being configured
|
||||
after already started. Caused by SPDIF_TX define check typo
|
||||
- FIXED: DFU flag address changed to properly conform to memory address range allocated to
|
||||
- RESOLVED: DFU flag address changed to properly conform to memory address range allocated to
|
||||
apps by tools
|
||||
- FIXED: Build failure when DFU disabled
|
||||
- FIXED: Build issue when I2S_CHANS_ADC/DAC set to 0 and CODEC_MASTER enabled
|
||||
- FIXED: Typo in MCLK_441 checking for MIN_FREQ define
|
||||
- CHANGED: Mixer and non-mixer channel comms scheme (decouple <-> audio path) now identical
|
||||
- CHANGED: Input stream buffering modified such that during overflow older samples are removed
|
||||
- RESOLVED: Build failure when DFU disabled
|
||||
- RESOLVED: Build issue when I2S_CHANS_ADC/DAC set to 0 and CODEC_MASTER enabled
|
||||
- RESOLVED: Typo in MCLK_441 checking for MIN_FREQ define
|
||||
- CHANGE: Mixer and non-mixer channel comms scheme (decouple <-> audio path) now identical
|
||||
- CHANGE: Input stream buffering modified such that during overflow older samples are removed
|
||||
rather than ignoring most recent samples. Removes any chance of stale input packets
|
||||
being sent to host
|
||||
- CHANGED: module_queue (in sc_usb_audio) now uses lib_xassert rather than module_xassert
|
||||
- CHANGE: module_queue (in sc_usb_audio) now uses lib_xassert rather than module_xassert
|
||||
|
||||
6.12.6
|
||||
------
|
||||
- FIXED: Build error when DFU is disabled
|
||||
- FIXED: Build error when I2S_CHANS_ADC or I2S_CHANS_DAC set to 0 and CODEC_MASTER enabled
|
||||
- RESOLVED: Build error when DFU is disabled
|
||||
- RESOLVED: Build error when I2S_CHANS_ADC or I2S_CHANS_DAC set to 0 and CODEC_MASTER enabled
|
||||
|
||||
6.12.5
|
||||
------
|
||||
- FIXED: Stream issue when NUM_USB_CHAN_IN < I2S_CHANS_ADC
|
||||
- RESOLVED: Stream issue when NUM_USB_CHAN_IN < I2S_CHANS_ADC
|
||||
|
||||
6.12.4
|
||||
------
|
||||
- FIXED: DFU fail when DSD enabled and USB library not running on tile[0]
|
||||
- RESOLVED: DFU fail when DSD enabled and USB library not running on tile[0]
|
||||
|
||||
6.12.3
|
||||
------
|
||||
- FIXED: Method for storing persistent state over a DFU reboot modified to improve resilience
|
||||
- RESOLVED: Method for storing persistent state over a DFU reboot modified to improve resilience
|
||||
against code-base and tools changes
|
||||
|
||||
6.12.2
|
||||
------
|
||||
- FIXED: Reboot code (used for DFU) failure in tools versions > 14.0.2 (xCORE-200 only)
|
||||
- FIXED: Run-time exception in mixer when MAX_MIX_COUNT > 0 (xCORE-200 only)
|
||||
- FIXED: MAX_MIX_COUNT checked properly for mix strings in string table
|
||||
- CHANGED: DFU code re-written to use an XC interface. The flash-part may now be connected
|
||||
- RESOLVED: Reboot code (used for DFU) failure in tools versions > 14.0.2 (xCORE-200 only)
|
||||
- RESOLVED: Run-time exception in mixer when MAX_MIX_COUNT > 0 (xCORE-200 only)
|
||||
- RESOLVED: MAX_MIX_COUNT checked properly for mix strings in string table
|
||||
- CHANGE: DFU code re-written to use an XC interface. The flash-part may now be connected
|
||||
to a separate tile to the tile running USB code
|
||||
- CHANGED: DFU code can now use quad-SPI flash
|
||||
- CHANGED: Example xmos_dfu application now uses a list of PIDs to allow adding PIDs easier.
|
||||
- CHANGE: DFU code can now use quad-SPI flash
|
||||
- CHANGE: Example xmos_dfu application now uses a list of PIDs to allow adding PIDs easier.
|
||||
--listdevices command also added.
|
||||
- CHANGED: I2S_CHANS_PER_FRAME and I2S_WIRES_xxx defines tidied
|
||||
- CHANGE: I2S_CHANS_PER_FRAME and I2S_WIRES_xxx defines tidied
|
||||
|
||||
6.12.1
|
||||
------
|
||||
- FIXED: Fixes to TDM input timing/sample-alignment when BCLK=MCLK
|
||||
- FIXED: Various minor fixes to allow ADAT_RX to run on xCORE 200 MC AUDIO hardware
|
||||
- CHANGED: Moved from old SPDIF define to SPDIF_TX
|
||||
- RESOLVED: Fixes to TDM input timing/sample-alignment when BCLK=MCLK
|
||||
- RESOLVED: Various minor fixes to allow ADAT_RX to run on xCORE 200 MC AUDIO hardware
|
||||
- CHANGE: Moved from old SPDIF define to SPDIF_TX
|
||||
|
||||
6.12.0
|
||||
------
|
||||
- ADDED: Checks for XUD_200_SERIES define where required
|
||||
- FIXED: Run-time exception due to decouple interrupt not entering correct issue mode
|
||||
- RESOLVED: Run-time exception due to decouple interrupt not entering correct issue mode
|
||||
(affects XCORE-200 only)
|
||||
- CHANGED: SPDIF Tx Core may now reside on a different tile from I2S
|
||||
- CHANGED: I2C ports now in structure to match new module_i2c_singleport/shared API.
|
||||
- CHANGE: SPDIF Tx Core may now reside on a different tile from I2S
|
||||
- CHANGE: I2C ports now in structure to match new module_i2c_singleport/shared API.
|
||||
|
||||
* Changes to dependencies:
|
||||
|
||||
@@ -431,48 +270,48 @@ Legacy release history
|
||||
|
||||
6.11.3
|
||||
------
|
||||
- FIXED: (Major) Streaming issue when mixer not enabled (introduced in 6.11.2)
|
||||
- RESOLVED: (Major) Streaming issue when mixer not enabled (introduced in 6.11.2)
|
||||
|
||||
6.11.2
|
||||
------
|
||||
- FIXED: (Major) Enumeration issue when MAX_MIX_COUNT > 0 only. Introduced in mixer
|
||||
- RESOLVED: (Major) Enumeration issue when MAX_MIX_COUNT > 0 only. Introduced in mixer
|
||||
optimisations in 6.11.0. Only affects designs using mixer functionality.
|
||||
- FIXED: (Normal) Audio buffering request system modified such that the mixer output is
|
||||
- RESOLVED: (Normal) Audio buffering request system modified such that the mixer output is
|
||||
not silent when in underflow case (i.e. host output stream not active) This issue was
|
||||
introduced with the addition of DSD functionality and only affects designs using
|
||||
mixer functionality.
|
||||
- FIXED: (Minor) Potential build issue due to duplicate labels in inline asm in
|
||||
- RESOLVED: (Minor) Potential build issue due to duplicate labels in inline asm in
|
||||
set_interrupt_handler macro
|
||||
- FIXED: (Minor) BCD_DEVICE define in devicedefines.h now guarded by ifndef (caused issues
|
||||
- RESOLVED: (Minor) BCD_DEVICE define in devicedefines.h now guarded by ifndef (caused issues
|
||||
with DFU test build configs.
|
||||
- FIXED: (Minor) String descriptor for Clock Selector unit incorrectly reported
|
||||
- FIXED: (Minor) BCD_DEVICE in devicedefines.h now guarded by #ifndef (Caused issues with
|
||||
- RESOLVED: (Minor) String descriptor for Clock Selector unit incorrectly reported
|
||||
- RESOLVED: (Minor) BCD_DEVICE in devicedefines.h now guarded by #ifndef (Caused issues with
|
||||
default DFU test build configs.
|
||||
- CHANGED: HID report descriptor defines added to shared user_hid.h
|
||||
- CHANGED: Now uses module_adat_rx from sc_adat (local module_usb_audio_adat removed)
|
||||
- CHANGE: HID report descriptor defines added to shared user_hid.h
|
||||
- CHANGE: Now uses module_adat_rx from sc_adat (local module_usb_audio_adat removed)
|
||||
|
||||
6.11.1
|
||||
------
|
||||
- ADDED: ADAT transmit functionality, including SMUX. See ADAT_TX and ADAT_TX_INDEX.
|
||||
- FIXED: (Normal) Build issue with CODEC_MASTER (xCore is I2S slave) enabled
|
||||
- FIXED: (Minor) Channel ordering issue in when TDM and CODEC_MASTER mode enabled
|
||||
- FIXED: (Normal) DFU fails when SPDIF_RX enabled due to clock block being shared between SPDIF
|
||||
- RESOLVED: (Normal) Build issue with CODEC_MASTER (xCore is I2S slave) enabled
|
||||
- RESOLVED: (Minor) Channel ordering issue in when TDM and CODEC_MASTER mode enabled
|
||||
- RESOLVED: (Normal) DFU fails when SPDIF_RX enabled due to clock block being shared between SPDIF
|
||||
core and FlashLib
|
||||
|
||||
6.11.0
|
||||
------
|
||||
- ADDED: Basic TDM I2S functionality added. See I2S_CHANS_PER_FRAME and I2S_MODE_TDM
|
||||
- CHANGED: Various optimisations in 'mixer' core to improve performance for higher
|
||||
- CHANGE: Various optimisations in 'mixer' core to improve performance for higher
|
||||
channel counts including the use of XC unsafe pointers instead of inline ASM
|
||||
- CHANGED: Mixer mapping disabled when MAX_MIX_COUNT is 0 since this is wasted processing.
|
||||
- CHANGED: Descriptor changes to allow for channel input/output channel count up to 32
|
||||
- CHANGE: Mixer mapping disabled when MAX_MIX_COUNT is 0 since this is wasted processing.
|
||||
- CHANGE: Descriptor changes to allow for channel input/output channel count up to 32
|
||||
(previous limit was 18)
|
||||
|
||||
6.10.0
|
||||
------
|
||||
- CHANGED: Endpoint management for iAP EA Native Transport now merged into buffer() core.
|
||||
- CHANGE: Endpoint management for iAP EA Native Transport now merged into buffer() core.
|
||||
Previously was separate core (as added in 6.8.0).
|
||||
- CHANGED: Minor optimisation to I2S port code for inputs from ADC
|
||||
- CHANGE: Minor optimisation to I2S port code for inputs from ADC
|
||||
|
||||
6.9.0
|
||||
-----
|
||||
@@ -480,39 +319,39 @@ Legacy release history
|
||||
supported (4 channels at 96kHz).
|
||||
- ADDED: Explicit build warnings if sample rate/depth & channel combination exceeds
|
||||
available USB bus bandwidth.
|
||||
- FIXED: (Major) Reinstated ADAT input functionality, including descriptors and clock
|
||||
- RESOLVED: (Major) Reinstated ADAT input functionality, including descriptors and clock
|
||||
generation/control and stream configuration defines/tables.
|
||||
- FIXED: (Major) S/PDIF/ADAT sample transfer code in audio() (from ClockGen()) moved to
|
||||
- RESOLVED: (Major) S/PDIF/ADAT sample transfer code in audio() (from ClockGen()) moved to
|
||||
aid timing.
|
||||
- CHANGED: Modifying mix map now only affects specified mix, previous was applied to all
|
||||
- CHANGE: Modifying mix map now only affects specified mix, previous was applied to all
|
||||
mixes. CS_XU_MIXSEL control selector now takes values 0 to MAX_MIX_COUNT + 1
|
||||
(with 0 affecting all mixes).
|
||||
- CHANGED: Channel c_dig_rx is no longer nullable, assists with timing due to removal of
|
||||
- CHANGE: Channel c_dig_rx is no longer nullable, assists with timing due to removal of
|
||||
null checks inserted by compiler.
|
||||
- CHANGED: ADAT SMUX selection now based on device sample frequency rather than selected
|
||||
- CHANGE: ADAT SMUX selection now based on device sample frequency rather than selected
|
||||
stream format - Endpoint 0 now configures clockgen() on a sample-rate change
|
||||
rather than stream start.
|
||||
|
||||
6.8.0
|
||||
-----
|
||||
- ADDED: Evaluation support for iAP EA Native Transport endpoints
|
||||
- FIXED: (Minor) Reverted change in 6.5.1 release where sample rate listing in Audio Class
|
||||
- RESOLVED: (Minor) Reverted change in 6.5.1 release where sample rate listing in Audio Class
|
||||
1.0 descriptors was trimmed (previously 4 rates were always reported). This change
|
||||
appears to highlight a Windows (only) enumeration issue with the Input & Output
|
||||
configs
|
||||
- FIXED: (Major) Mixer functionality re-instated, including descriptors and various required
|
||||
- RESOLVED: (Major) Mixer functionality re-instated, including descriptors and various required
|
||||
updates compatibility with 13 tools
|
||||
- FIXED: (Major) Endpoint 0 was requesting an out of bounds channel whilst requesting level data
|
||||
- FIXED: (Major) Fast mix code not operates correctly in 13 tools, assembler inserting long jmp
|
||||
- RESOLVED: (Major) Endpoint 0 was requesting an out of bounds channel whilst requesting level data
|
||||
- RESOLVED: (Major) Fast mix code not operates correctly in 13 tools, assembler inserting long jmp
|
||||
instructions
|
||||
- FIXED: (Minor) LED level meter code now compatible with 13 tools (shared mem access)
|
||||
- FIXED: (Minor) Ordering of level data from the device now matches channel ordering into
|
||||
- RESOLVED: (Minor) LED level meter code now compatible with 13 tools (shared mem access)
|
||||
- RESOLVED (Minor) Ordering of level data from the device now matches channel ordering into
|
||||
mixer (previously the device input data and the stream from host were swapped)
|
||||
- CHANGED: Level meter buffer naming now resemble functionality
|
||||
- CHANGE: Level meter buffer naming now resemble functionality
|
||||
|
||||
|
||||
Legacy release history
|
||||
----------------------
|
||||
======================
|
||||
|
||||
Please see changelog in sw_usb_audio for changes prior to 6.8.0 release.
|
||||
|
||||
|
||||
139
Jenkinsfile
vendored
139
Jenkinsfile
vendored
@@ -1,4 +1,4 @@
|
||||
@Library('xmos_jenkins_shared_library@v0.18.0') _
|
||||
@Library('xmos_jenkins_shared_library@develop') _
|
||||
|
||||
getApproval()
|
||||
|
||||
@@ -6,7 +6,7 @@ pipeline {
|
||||
agent none
|
||||
environment {
|
||||
REPO = 'lib_xua'
|
||||
VIEW = getViewName(REPO)
|
||||
VIEW = 'lib_xua_release_0_1_5'
|
||||
}
|
||||
options {
|
||||
skipDefaultCheckout()
|
||||
@@ -14,7 +14,7 @@ pipeline {
|
||||
stages {
|
||||
stage('Basic tests') {
|
||||
agent {
|
||||
label 'x86_64 && linux'
|
||||
label 'x86_64&&brew'
|
||||
}
|
||||
stages {
|
||||
stage('Get view') {
|
||||
@@ -27,70 +27,11 @@ pipeline {
|
||||
xcoreLibraryChecks("${REPO}")
|
||||
}
|
||||
}
|
||||
stage('XS2 Tests') {
|
||||
failFast true
|
||||
parallel {
|
||||
stage('Legacy tests') {
|
||||
steps {
|
||||
runXmostest("${REPO}", 'legacy_tests')
|
||||
}
|
||||
}
|
||||
stage('Unit tests') {
|
||||
steps {
|
||||
dir("${REPO}") {
|
||||
dir('tests') {
|
||||
dir('xua_unit_tests') {
|
||||
withVenv {
|
||||
runWaf('.', "configure clean build --target=xcore200")
|
||||
// runWaf('.', "configure clean build --target=xcoreai")
|
||||
// stash name: 'xua_unit_tests', includes: 'bin/*xcoreai.xe, '
|
||||
viewEnv() {
|
||||
runPython("TARGET=XCORE200 pytest -s")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Tests') {
|
||||
steps {
|
||||
runXmostest("${REPO}", 'tests')
|
||||
}
|
||||
}
|
||||
// stage('xcore.ai Verification') {
|
||||
// agent {
|
||||
// label 'xcore.ai-explorer'
|
||||
// }
|
||||
// options {
|
||||
// skipDefaultCheckout()
|
||||
// }
|
||||
// stages{
|
||||
// stage('Get View') {
|
||||
// steps {
|
||||
// xcorePrepareSandbox("${VIEW}", "${REPO}")
|
||||
// }
|
||||
// }
|
||||
// stage('Unit tests') {
|
||||
// steps {
|
||||
// dir("${REPO}") {
|
||||
// dir('tests') {
|
||||
// dir('xua_unit_tests') {
|
||||
// withVenv {
|
||||
// unstash 'xua_unit_tests'
|
||||
// viewEnv() {
|
||||
// runPython("TARGET=XCOREAI pytest -s")
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } // stages
|
||||
// post {
|
||||
// cleanup {
|
||||
// cleanWs()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
stage('xCORE builds') {
|
||||
steps {
|
||||
dir("${REPO}") {
|
||||
@@ -113,7 +54,7 @@ pipeline {
|
||||
parallel {
|
||||
stage('Build Linux host app') {
|
||||
agent {
|
||||
label 'x86_64&&linux'
|
||||
label 'x86_64&&brew&&linux'
|
||||
}
|
||||
steps {
|
||||
xcorePrepareSandbox("${VIEW}", "${REPO}")
|
||||
@@ -129,7 +70,7 @@ pipeline {
|
||||
}
|
||||
stage('Build Mac host app') {
|
||||
agent {
|
||||
label 'x86_64&&macOS'
|
||||
label 'x86_64&&brew&&macOS'
|
||||
}
|
||||
steps {
|
||||
xcorePrepareSandbox("${VIEW}", "${REPO}")
|
||||
@@ -143,50 +84,34 @@ pipeline {
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build Pi host app') {
|
||||
agent {
|
||||
label 'pi'
|
||||
}
|
||||
steps {
|
||||
dir("${REPO}") {
|
||||
checkout scm
|
||||
dir("${REPO}/host/xmosdfu") {
|
||||
sh 'make -f Makefile.Pi'
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
cleanup {
|
||||
xcoreCleanSandbox()
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build Windows host app') {
|
||||
agent {
|
||||
label 'x86_64&&windows'
|
||||
}
|
||||
steps {
|
||||
dir("${REPO}") {
|
||||
checkout scm
|
||||
dir("${REPO}/host/xmosdfu") {
|
||||
runVS('nmake /f Makefile.Win32')
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
cleanup {
|
||||
xcoreCleanSandbox()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Update') {
|
||||
stage('Release and update') {
|
||||
agent {
|
||||
label 'x86_64 && linux'
|
||||
label 'x86_64&&brew'
|
||||
}
|
||||
steps {
|
||||
updateViewfiles()
|
||||
stages {
|
||||
stage('Get view') {
|
||||
steps {
|
||||
xcorePrepareSandbox("${VIEW}", "${REPO}")
|
||||
}
|
||||
}
|
||||
stage('Release') {
|
||||
when {
|
||||
expression {
|
||||
isReleaseBranchOfOrganisation('xmos')
|
||||
}
|
||||
}
|
||||
steps {
|
||||
sh "mkdir ${REPO}/empty"
|
||||
xcoreReleaseToGithub("${WORKSPACE}/${REPO}","${WORKSPACE}/${REPO}/empty")
|
||||
}
|
||||
}
|
||||
stage('Update') {
|
||||
steps {
|
||||
updateViewfiles()
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
cleanup {
|
||||
|
||||
84
LICENSE.rst
84
LICENSE.rst
@@ -1,84 +0,0 @@
|
||||
*******************************
|
||||
XMOS PUBLIC LICENCE: Version 1
|
||||
*******************************
|
||||
|
||||
Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software.
|
||||
|
||||
**1. Definitions**
|
||||
|
||||
**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software.
|
||||
|
||||
**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code.
|
||||
|
||||
**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives.
|
||||
|
||||
**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof.
|
||||
|
||||
**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code.
|
||||
|
||||
**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence.
|
||||
|
||||
This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement.
|
||||
|
||||
|
||||
**2. Licence**
|
||||
|
||||
**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following:
|
||||
|
||||
2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software:
|
||||
|
||||
2.1.1 for personal or academic, non-commercial purposes; or
|
||||
|
||||
2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2):
|
||||
|
||||
(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and
|
||||
|
||||
(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms).
|
||||
|
||||
The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement.
|
||||
|
||||
2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives:
|
||||
|
||||
2.2.1 for personal or academic, non-commercial purposes; or
|
||||
|
||||
2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2):
|
||||
|
||||
(a) you must comply with the terms of clause 2.1 with respect to the Derivatives;
|
||||
|
||||
(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and
|
||||
|
||||
(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS.
|
||||
|
||||
Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below.
|
||||
|
||||
2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code.
|
||||
|
||||
**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above.
|
||||
|
||||
**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives.
|
||||
|
||||
**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS.
|
||||
|
||||
**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms.
|
||||
|
||||
**7. IPR and Ownership**
|
||||
Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com**
|
||||
|
||||
Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein).
|
||||
Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit.
|
||||
|
||||
**8. Termination**
|
||||
|
||||
8.1 This Licence will automatically terminate immediately, without notice to you, if:
|
||||
|
||||
(a) you fail to comply with the terms of this Licence; and/or
|
||||
|
||||
(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or
|
||||
|
||||
(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part.
|
||||
|
||||
**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use.
|
||||
|
||||
**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50.
|
||||
|
||||
**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply.
|
||||
135
LICENSE.txt
Normal file
135
LICENSE.txt
Normal file
@@ -0,0 +1,135 @@
|
||||
Software Release License Agreement
|
||||
|
||||
Copyright (c) 2011-2020, XMOS, All rights reserved.
|
||||
|
||||
BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software.
|
||||
|
||||
Parties:
|
||||
|
||||
(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS).
|
||||
|
||||
(2) An individual or legal entity exercising permissions granted by this License (Customer).
|
||||
|
||||
If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity.
|
||||
|
||||
1. Definitions
|
||||
|
||||
"License" means this Software License and any schedules or annexes to it.
|
||||
|
||||
"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License
|
||||
|
||||
"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer.
|
||||
|
||||
"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS.
|
||||
|
||||
"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License.
|
||||
|
||||
"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates.
|
||||
|
||||
The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License.
|
||||
|
||||
Unless the context otherwise requires:
|
||||
|
||||
- references to XMOS and the Customer include their permitted successors and assigns;
|
||||
- references to statutory provisions include those statutory provisions as amended or re-enacted; and
|
||||
- references to any gender include all genders.
|
||||
|
||||
Words in the singular include the plural and in the plural include the singular.
|
||||
|
||||
2. License
|
||||
|
||||
XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware.
|
||||
|
||||
Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed.
|
||||
|
||||
3. Consideration
|
||||
|
||||
In consideration of the mutual obligations contained in this License, the parties agree to its terms.
|
||||
|
||||
4. Term
|
||||
|
||||
Subject to clause 12 below, this License shall be perpetual.
|
||||
|
||||
5. Restrictions on Use
|
||||
|
||||
The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation.
|
||||
|
||||
6. Modifications
|
||||
|
||||
The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis.
|
||||
|
||||
XMOS will own all intellectual property rights in the XMOS Modifications.
|
||||
The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware.
|
||||
|
||||
7. Support
|
||||
|
||||
Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement.
|
||||
|
||||
8. Warranty and Disclaimer
|
||||
|
||||
The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any).
|
||||
|
||||
Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications.
|
||||
|
||||
XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW.
|
||||
|
||||
9. High Risk Activities
|
||||
|
||||
The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities.
|
||||
|
||||
10. Liability
|
||||
|
||||
TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee.
|
||||
|
||||
Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License.
|
||||
|
||||
11. Ownership
|
||||
|
||||
The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement.
|
||||
|
||||
12. Termination
|
||||
|
||||
Either party may terminate this License at any time on written notice to the other if the other:
|
||||
|
||||
- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or
|
||||
|
||||
- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction.
|
||||
|
||||
Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination.
|
||||
|
||||
On termination for any reason:
|
||||
|
||||
- all rights granted to the Customer under this License shall cease;
|
||||
- the Customer shall cease all activities authorised by this License;
|
||||
- the Customer shall immediately pay any sums due to XMOS under this License; and
|
||||
- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so.
|
||||
|
||||
Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement.
|
||||
|
||||
13. Third party rights
|
||||
|
||||
No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license.
|
||||
|
||||
14. Confidentiality and publicity
|
||||
|
||||
Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party.
|
||||
|
||||
The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS.
|
||||
The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason.
|
||||
|
||||
15. Entire agreement
|
||||
|
||||
This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter.
|
||||
|
||||
16. Assignment
|
||||
|
||||
The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent.
|
||||
|
||||
17. Governing law and jurisdiction
|
||||
|
||||
This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts.
|
||||
|
||||
This License has been entered into on the date stated at the beginning of it.
|
||||
|
||||
Schedule
|
||||
XMOS lib_xua software
|
||||
7
Pipfile
Normal file
7
Pipfile
Normal file
@@ -0,0 +1,7 @@
|
||||
[[source]]
|
||||
name = "pypi"
|
||||
url = "https://pypi.org/simple"
|
||||
verify_ssl = true
|
||||
|
||||
[dev-packages]
|
||||
flake8 = "*"
|
||||
86
README.rst
86
README.rst
@@ -1,84 +1,18 @@
|
||||
lib_xua
|
||||
=======
|
||||
|
||||
:Latest release: 3.2.0rc1
|
||||
USB Audio Shared Components. For use in the XMOS USB Audio Refererence Designs.
|
||||
|
||||
|
||||
:Scope: General Use
|
||||
|
||||
Summary
|
||||
-------
|
||||
|
||||
USB Audio Shared Components for use in the XMOS USB Audio Refererence Designs.
|
||||
|
||||
This library enables the development of USB Audio devices on the XMOS xCORE architecture.
|
||||
|
||||
Features
|
||||
........
|
||||
|
||||
Key features of the various applications in this repository are as follows
|
||||
|
||||
- USB Audio Class 1.0/2.0 Compliant
|
||||
|
||||
- Fully Asynchronous operation
|
||||
|
||||
- Support for the following sample frequencies: 8, 11.025, 12, 16, 32, 44.1, 48, 88.2, 96, 176.4, 192, 352.8, 384kHz
|
||||
|
||||
- Input/output channel and individual volume/mute controls supported
|
||||
|
||||
- Support for dynamically selectable output audio formats (e.g. resolution)
|
||||
|
||||
- Field firmware upgrade compliant to the USB Device Firmware Upgrade (DFU) Class Specification
|
||||
|
||||
- S/PDIF output
|
||||
|
||||
- S/PDIF input
|
||||
|
||||
- ADAT output
|
||||
|
||||
- ADAT input
|
||||
|
||||
- Synchronisation to external digital streams i.e. S/PDIF or ADAT
|
||||
|
||||
- I2S slave & master modes
|
||||
|
||||
- TDM slave & master modes
|
||||
|
||||
- MIDI input/output (Compliant to USB Class Specification for MIDI devices)
|
||||
|
||||
- DSD output (Native and DoP mode) at DSD64 and DSD128 rates
|
||||
|
||||
- Mixer with flexible routing
|
||||
|
||||
- Simple playback controls via Human Interface Device (HID)
|
||||
|
||||
- Support for operation with Apple devices (requires software module sc_mfi for MFI licensees only - please contact XMOS)
|
||||
|
||||
Note, not all features may be supported at all sample frequencies, simultaneously or on all devices. Some features also require specific host driver support.
|
||||
|
||||
Software version and dependencies
|
||||
.................................
|
||||
|
||||
The CHANGELOG contains information about the current and previous versions.
|
||||
For a list of direct dependencies, look for DEPENDENT_MODULES in lib_xua/module_build_info.
|
||||
|
||||
Related Application Notes
|
||||
.........................
|
||||
|
||||
The following application notes use this library:
|
||||
|
||||
* AN000246 - Simple USB Audio Device using lib_xua
|
||||
* AN000247 - Using lib_xua with lib_spdif (transmit)
|
||||
* AN000248 - Using lib_xua with lib_mic_array
|
||||
|
||||
Required software (dependencies)
|
||||
================================
|
||||
--------------------------------
|
||||
|
||||
* lib_locks (git@github.com:xmos/lib_locks.git)
|
||||
* lib_logging (git@github.com:xmos/lib_logging)
|
||||
* lib_mic_array (git@github.com:xmos/lib_mic_array.git)
|
||||
* lib_xassert (git@github.com:xmos/lib_xassert)
|
||||
* lib_dsp (git@github.com:xmos/lib_dsp)
|
||||
* lib_spdif (git@github.com:xmos/lib_spdif)
|
||||
* lib_xud (git@github.com:xmos/lib_xud)
|
||||
* lib_logging
|
||||
* lib_xud
|
||||
|
||||
Checking dependent libs
|
||||
|
||||
Software version and dependencies
|
||||
---------------------------------
|
||||
|
||||
.. libdeps::
|
||||
|
||||
2
cpanfile
Normal file
2
cpanfile
Normal file
@@ -0,0 +1,2 @@
|
||||
requires 'File::Copy::Recursive';
|
||||
requires 'LWP::Simple'
|
||||
@@ -1,56 +0,0 @@
|
||||
.. _usb_audiosec_building_xmos_dfu:
|
||||
|
||||
Building the XMOS DFU loader
|
||||
============================
|
||||
|
||||
The XMOS DFU loader is provided as source as part of the USB Audio
|
||||
framework, located in lib_xua/host/xmosdfu.
|
||||
|
||||
The loader is compiled using libusb, the code for the loader is contained in the
|
||||
file ``xmosdfu.cpp``
|
||||
|
||||
macOS
|
||||
-----
|
||||
|
||||
To build the loader a Makefile is provided, which can be run as follows:
|
||||
|
||||
``make -f Makefile.OSX64 all``
|
||||
|
||||
This Makefile contains the following:
|
||||
|
||||
.. literalinclude:: Makefile.OSX64
|
||||
|
||||
There is also a 32bit OS X makefile, ``Makefile.OSX32``.
|
||||
|
||||
Linux
|
||||
-----
|
||||
|
||||
Similarly to macOS, there are two Linux makefiles provided, ``Makefile.Linux32`` and ``Makefile.Linux64``:
|
||||
|
||||
.. literalinclude:: Makefile.Linux64
|
||||
|
||||
System-wide libusb is used. On Debian-derived systems this can be installed with:
|
||||
|
||||
``apt-get install libusb-1.0.0-dev``
|
||||
|
||||
Raspberry Pi
|
||||
------------
|
||||
|
||||
A makefile is provided for Raspbian. libusb is required and can be installed using the ``apt-get`` command from previous Linux section.
|
||||
|
||||
.. literalinclude:: Makefile.Pi
|
||||
|
||||
Windows
|
||||
-------
|
||||
|
||||
To build on Windows, you must first install Visual Studio 2019 Build Tools with
|
||||
C++ support. `This is available from Microsoft's website. <https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019>`_
|
||||
|
||||
To build, open a Developer Command Prompt via the start menu and navigate to the
|
||||
xmosdfu folder. The command to build is as follows:
|
||||
|
||||
``nmake /f Makefile.Win32``
|
||||
|
||||
This Makefile contains the following:
|
||||
|
||||
.. literalinclude:: Makefile.Win32
|
||||
@@ -1,3 +0,0 @@
|
||||
XMOSNEWSTYLE=2
|
||||
SOURCE_INCLUDE_DIRS=../../../lib_xua/host/xmosdfu
|
||||
SPHINX_MASTER_DOC=dfu
|
||||
135
doc_dfu/LICENSE.txt
Normal file
135
doc_dfu/LICENSE.txt
Normal file
@@ -0,0 +1,135 @@
|
||||
Software Release License Agreement
|
||||
|
||||
Copyright (c) 2017-2018, XMOS, All rights reserved.
|
||||
|
||||
BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software.
|
||||
|
||||
Parties:
|
||||
|
||||
(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS).
|
||||
|
||||
(2) An individual or legal entity exercising permissions granted by this License (Customer).
|
||||
|
||||
If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity.
|
||||
|
||||
1. Definitions
|
||||
|
||||
"License" means this Software License and any schedules or annexes to it.
|
||||
|
||||
"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License
|
||||
|
||||
"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer.
|
||||
|
||||
"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS.
|
||||
|
||||
"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License.
|
||||
|
||||
"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates.
|
||||
|
||||
The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License.
|
||||
|
||||
Unless the context otherwise requires:
|
||||
|
||||
- references to XMOS and the Customer include their permitted successors and assigns;
|
||||
- references to statutory provisions include those statutory provisions as amended or re-enacted; and
|
||||
- references to any gender include all genders.
|
||||
|
||||
Words in the singular include the plural and in the plural include the singular.
|
||||
|
||||
2. License
|
||||
|
||||
XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware.
|
||||
|
||||
Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed.
|
||||
|
||||
3. Consideration
|
||||
|
||||
In consideration of the mutual obligations contained in this License, the parties agree to its terms.
|
||||
|
||||
4. Term
|
||||
|
||||
Subject to clause 12 below, this License shall be perpetual.
|
||||
|
||||
5. Restrictions on Use
|
||||
|
||||
The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation.
|
||||
|
||||
6. Modifications
|
||||
|
||||
The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis.
|
||||
|
||||
XMOS will own all intellectual property rights in the XMOS Modifications.
|
||||
The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware.
|
||||
|
||||
7. Support
|
||||
|
||||
Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement.
|
||||
|
||||
8. Warranty and Disclaimer
|
||||
|
||||
The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any).
|
||||
|
||||
Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications.
|
||||
|
||||
XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW.
|
||||
|
||||
9. High Risk Activities
|
||||
|
||||
The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities.
|
||||
|
||||
10. Liability
|
||||
|
||||
TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee.
|
||||
|
||||
Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License.
|
||||
|
||||
11. Ownership
|
||||
|
||||
The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement.
|
||||
|
||||
12. Termination
|
||||
|
||||
Either party may terminate this License at any time on written notice to the other if the other:
|
||||
|
||||
- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or
|
||||
|
||||
- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction.
|
||||
|
||||
Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination.
|
||||
|
||||
On termination for any reason:
|
||||
|
||||
- all rights granted to the Customer under this License shall cease;
|
||||
- the Customer shall cease all activities authorised by this License;
|
||||
- the Customer shall immediately pay any sums due to XMOS under this License; and
|
||||
- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so.
|
||||
|
||||
Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement.
|
||||
|
||||
13. Third party rights
|
||||
|
||||
No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license.
|
||||
|
||||
14. Confidentiality and publicity
|
||||
|
||||
Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party.
|
||||
|
||||
The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS.
|
||||
The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason.
|
||||
|
||||
15. Entire agreement
|
||||
|
||||
This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter.
|
||||
|
||||
16. Assignment
|
||||
|
||||
The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent.
|
||||
|
||||
17. Governing law and jurisdiction
|
||||
|
||||
This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts.
|
||||
|
||||
This License has been entered into on the date stated at the beginning of it.
|
||||
|
||||
Schedule
|
||||
XMOS lib_xua software
|
||||
1
doc_dfu/Makefile
Normal file
1
doc_dfu/Makefile
Normal file
@@ -0,0 +1 @@
|
||||
SOURCE_INCLUDE_DIRS=../lib_xua/host/xmosdfu
|
||||
18
doc_dfu/building_xmos_dfu.rst
Normal file
18
doc_dfu/building_xmos_dfu.rst
Normal file
@@ -0,0 +1,18 @@
|
||||
.. _usb_audiosec_building_xmos_dfu:
|
||||
|
||||
Building the XMOS DFU loader - macOS
|
||||
====================================
|
||||
|
||||
The XMOS DFU loader is provided as source as part of the USB Audio
|
||||
framework, located in lib_xua/host/xmosdfu.
|
||||
|
||||
The loader is compiled using libusb, the code for the loader is contained in the
|
||||
file ``xmosdfu.cpp``
|
||||
|
||||
To build the loader a Makefile is provided, which can be run as follows:
|
||||
|
||||
``make -f Makefile.OSX all``
|
||||
|
||||
This Makefile contains the following:
|
||||
|
||||
.. literalinclude:: Makefile.OSX
|
||||
@@ -7,4 +7,4 @@ DFU loader for XMOS USB AUDIO devices
|
||||
Creating factory and upgrade images with XFLASH <factory_image>
|
||||
Using the DFU loader - Windows (via the Thesycon driver) <thesycon_dfu>
|
||||
Using the DFU loader - macOS (via the XMOS DFU loader) <xmos_dfu>
|
||||
Building the XMOS DFU loader <building_xmos_dfu>
|
||||
Building the XMOS DFU loader - macOS <building_xmos_dfu>
|
||||
@@ -4,9 +4,6 @@ Using the DFU loader - macOS (via the XMOS DFU loader)
|
||||
The XMOS DFU loader is provided as source as part of the XMOS USB Audio software
|
||||
framework, see :ref:`usb_audiosec_building_xmos_dfu`.
|
||||
|
||||
NOTE: Windows requires the installation of libusbK drivers on the DFU endpoint.
|
||||
We recommend using `Zadig <https://zadig.akeo.ie/>`_.
|
||||
|
||||
Set up the image loader
|
||||
-----------------------
|
||||
|
||||
@@ -21,7 +18,7 @@ Download new firmware
|
||||
|
||||
To program the new firmware run the command:
|
||||
|
||||
``./bin/xmosdfu XMOS_L2_AUDIO2_PID --download new_firmware.bin``
|
||||
``./xmosdfu XMOS_L2_AUDIO2_PID --download new_firmware.bin``
|
||||
|
||||
Replace ``XMOS_L2_AUDIO2_PID`` with product ID of your target device. Invoke
|
||||
``xmosdfu`` with no arguments to get a list of all supported product IDs.
|
||||
@@ -38,7 +35,7 @@ present.
|
||||
|
||||
Run the command:
|
||||
|
||||
``./bin/xmosdfu XMOS_L2_AUDIO2_PID --upload currentfirmware.bin``
|
||||
``./xmosdfu XMOS_L2_AUDIO2_PID --upload currentfirmware.bin``
|
||||
|
||||
The file ``currentfirmware.bin`` contains the latest upgrade image. This file is
|
||||
an exact copy of the data from the flash and can be downloaded to the device
|
||||
@@ -50,6 +47,6 @@ Reverting firmware to factory image
|
||||
To revert the device back to its factory (i.e XFLASH) installed state from the
|
||||
new firmware, run the command:
|
||||
|
||||
``./bin/xmosdfu XMOS_L2_AUDIO2_PID --revertfactory``
|
||||
``./xmosdfu XMOS_L2_AUDIO2_PID --revertfactory``
|
||||
|
||||
The device will now be running, and only contain the factory firmware.
|
||||
@@ -1,84 +0,0 @@
|
||||
*******************************
|
||||
XMOS PUBLIC LICENCE: Version 1
|
||||
*******************************
|
||||
|
||||
Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software.
|
||||
|
||||
**1. Definitions**
|
||||
|
||||
**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software.
|
||||
|
||||
**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code.
|
||||
|
||||
**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives.
|
||||
|
||||
**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof.
|
||||
|
||||
**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code.
|
||||
|
||||
**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence.
|
||||
|
||||
This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement.
|
||||
|
||||
|
||||
**2. Licence**
|
||||
|
||||
**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following:
|
||||
|
||||
2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software:
|
||||
|
||||
2.1.1 for personal or academic, non-commercial purposes; or
|
||||
|
||||
2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2):
|
||||
|
||||
(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and
|
||||
|
||||
(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms).
|
||||
|
||||
The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement.
|
||||
|
||||
2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives:
|
||||
|
||||
2.2.1 for personal or academic, non-commercial purposes; or
|
||||
|
||||
2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2):
|
||||
|
||||
(a) you must comply with the terms of clause 2.1 with respect to the Derivatives;
|
||||
|
||||
(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and
|
||||
|
||||
(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS.
|
||||
|
||||
Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below.
|
||||
|
||||
2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code.
|
||||
|
||||
**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above.
|
||||
|
||||
**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives.
|
||||
|
||||
**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS.
|
||||
|
||||
**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms.
|
||||
|
||||
**7. IPR and Ownership**
|
||||
Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com**
|
||||
|
||||
Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein).
|
||||
Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit.
|
||||
|
||||
**8. Termination**
|
||||
|
||||
8.1 This Licence will automatically terminate immediately, without notice to you, if:
|
||||
|
||||
(a) you fail to comply with the terms of this Licence; and/or
|
||||
|
||||
(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or
|
||||
|
||||
(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part.
|
||||
|
||||
**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use.
|
||||
|
||||
**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50.
|
||||
|
||||
**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply.
|
||||
135
examples/AN00246_xua_example/LICENSE.txt
Normal file
135
examples/AN00246_xua_example/LICENSE.txt
Normal file
@@ -0,0 +1,135 @@
|
||||
Software Release License Agreement
|
||||
|
||||
Copyright (c) 2018-2019, XMOS, All rights reserved.
|
||||
|
||||
BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software.
|
||||
|
||||
Parties:
|
||||
|
||||
(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS).
|
||||
|
||||
(2) An individual or legal entity exercising permissions granted by this License (Customer).
|
||||
|
||||
If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity.
|
||||
|
||||
1. Definitions
|
||||
|
||||
"License" means this Software License and any schedules or annexes to it.
|
||||
|
||||
"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License
|
||||
|
||||
"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer.
|
||||
|
||||
"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS.
|
||||
|
||||
"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License.
|
||||
|
||||
"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates.
|
||||
|
||||
The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License.
|
||||
|
||||
Unless the context otherwise requires:
|
||||
|
||||
- references to XMOS and the Customer include their permitted successors and assigns;
|
||||
- references to statutory provisions include those statutory provisions as amended or re-enacted; and
|
||||
- references to any gender include all genders.
|
||||
|
||||
Words in the singular include the plural and in the plural include the singular.
|
||||
|
||||
2. License
|
||||
|
||||
XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware.
|
||||
|
||||
Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed.
|
||||
|
||||
3. Consideration
|
||||
|
||||
In consideration of the mutual obligations contained in this License, the parties agree to its terms.
|
||||
|
||||
4. Term
|
||||
|
||||
Subject to clause 12 below, this License shall be perpetual.
|
||||
|
||||
5. Restrictions on Use
|
||||
|
||||
The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation.
|
||||
|
||||
6. Modifications
|
||||
|
||||
The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis.
|
||||
|
||||
XMOS will own all intellectual property rights in the XMOS Modifications.
|
||||
The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware.
|
||||
|
||||
7. Support
|
||||
|
||||
Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement.
|
||||
|
||||
8. Warranty and Disclaimer
|
||||
|
||||
The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any).
|
||||
|
||||
Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications.
|
||||
|
||||
XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW.
|
||||
|
||||
9. High Risk Activities
|
||||
|
||||
The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities.
|
||||
|
||||
10. Liability
|
||||
|
||||
TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee.
|
||||
|
||||
Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License.
|
||||
|
||||
11. Ownership
|
||||
|
||||
The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement.
|
||||
|
||||
12. Termination
|
||||
|
||||
Either party may terminate this License at any time on written notice to the other if the other:
|
||||
|
||||
- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or
|
||||
|
||||
- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction.
|
||||
|
||||
Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination.
|
||||
|
||||
On termination for any reason:
|
||||
|
||||
- all rights granted to the Customer under this License shall cease;
|
||||
- the Customer shall cease all activities authorised by this License;
|
||||
- the Customer shall immediately pay any sums due to XMOS under this License; and
|
||||
- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so.
|
||||
|
||||
Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement.
|
||||
|
||||
13. Third party rights
|
||||
|
||||
No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license.
|
||||
|
||||
14. Confidentiality and publicity
|
||||
|
||||
Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party.
|
||||
|
||||
The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS.
|
||||
The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason.
|
||||
|
||||
15. Entire agreement
|
||||
|
||||
This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter.
|
||||
|
||||
16. Assignment
|
||||
|
||||
The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent.
|
||||
|
||||
17. Governing law and jurisdiction
|
||||
|
||||
This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts.
|
||||
|
||||
This License has been entered into on the date stated at the beginning of it.
|
||||
|
||||
Schedule
|
||||
XMOS application note AN00246 software
|
||||
@@ -4,13 +4,13 @@ TARGET = xk-audio-216-mc.xn
|
||||
|
||||
# The flags passed to xcc when building the application
|
||||
XCC_FLAGS = -fcomment-asm -Xmapper --map -Xmapper MAPFILE -O3 -report -save-temps \
|
||||
-g -Wno-unused-function -Wno-timing -DXUD_SERIES_SUPPORT=XUD_X200_SERIES \
|
||||
-DXUD_CORE_CLOCK=600 -DUSB_TILE=tile[1] -fxscope -DUAC_FORCE_FEEDBACK_EP=0
|
||||
|
||||
-g -Wno-unused-function -Wno-timing -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DUSB_TILE=tile[1] \
|
||||
-DSDA_HIGH=2 -DSCL_HIGH=1 -fxscope
|
||||
|
||||
# The USED_MODULES variable lists other module used by the application. These
|
||||
# modules will extend the SOURCE_DIRS, INCLUDE_DIRS and LIB_DIRS variables.
|
||||
# Modules are expected to be in the directory above the BASE_DIR directory.
|
||||
USED_MODULES = lib_xua lib_device_control lib_xud lib_i2c
|
||||
USED_MODULES = lib_xua lib_xud module_i2c_shared module_i2c_single_port
|
||||
|
||||
#=============================================================================
|
||||
# The following part of the Makefile includes the common build infrastructure
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
|
||||
Simple USB Audio Device using lib_xua
|
||||
=====================================
|
||||
How to use the lib_xua_library
|
||||
===============================
|
||||
|
||||
.. version:: 0.1.3
|
||||
|
||||
Summary
|
||||
-------
|
||||
|
||||
Software dependencies
|
||||
.....................
|
||||
Required tools and libraries
|
||||
............................
|
||||
|
||||
For a list of direct dependencies, look for USED_MODULES in the Makefile.
|
||||
.. appdeps::
|
||||
|
||||
Required hardware
|
||||
.................
|
||||
|
||||
2
examples/AN00246_xua_example/doc/.gitignore
vendored
Normal file
2
examples/AN00246_xua_example/doc/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
rst/_build
|
||||
pdf
|
||||
@@ -1,4 +1,5 @@
|
||||
.. include:: ../../README.rst
|
||||
.. |I2C| replace:: I\ :sup:`2`\ C
|
||||
|
||||
|newpage|
|
||||
|
||||
@@ -8,16 +9,29 @@ Overview
|
||||
Introduction
|
||||
............
|
||||
|
||||
The XMOS USB Audio (XUA) library provides an implemention of USB Audio Class versions 1.0 and 2.0.
|
||||
The XMOS USB Audio (XUA) library provides an implemention of USB Audio Class 2.0
|
||||
|
||||
This application note demonstrates the implementation of a basic USB Audio Device on
|
||||
the xCORE-200 MC Audio board.
|
||||
|
||||
Block diagram
|
||||
.............
|
||||
|
||||
.. .. figure:: images/block_diagram.*
|
||||
.. :width: 80%
|
||||
..
|
||||
.. Application block diagram
|
||||
|
||||
The application uses a single logical core which runs the application and makes
|
||||
calls to the |I2C| master library functions as required.
|
||||
|
||||
How to use lib_xua
|
||||
------------------
|
||||
|
||||
The Makefile
|
||||
------------
|
||||
............
|
||||
|
||||
To start using ``lib_xua``, you need to add ``lib_xua`` to your Makefile::
|
||||
To start using the lib_xua, you need to add ``lib_xua`` to your Makefile::
|
||||
|
||||
USED_MODULES = .. lib_xua ...
|
||||
|
||||
@@ -55,7 +69,7 @@ be included in your code to use the library.
|
||||
Allocating hardware resources
|
||||
.............................
|
||||
|
||||
A basic implementation of a USB Audio device (i.e. simple stereo input and output via I2S)
|
||||
A most basic implementation of a USB Audio device (i.e. simple stereo input and output via I2S)
|
||||
using ``lib_xua`` requires the follow pins:
|
||||
|
||||
- I2S Bit Clock (from xCORE to DAC)
|
||||
@@ -66,34 +80,20 @@ using ``lib_xua`` requires the follow pins:
|
||||
|
||||
.. note::
|
||||
|
||||
This application note assumes xCORE is I2S bus master
|
||||
ANOO246 assumes xCORE is I2S bus master
|
||||
|
||||
On an xCORE the pins are controlled by ``ports``. The application therefore declares various ``ports``
|
||||
for this purpose:
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: /* Port declaration
|
||||
:end-on: in port p_mclk_in
|
||||
|
||||
``lib_xua`` also requires two ports for internally calculating USB feedback. Please refer to
|
||||
the ``lib_xua`` library documentation for further details. The additonal input port for the master
|
||||
clock is required since USB and S/PDIF do not reside of the same tiles on the example hardware.
|
||||
|
||||
These ports are declared as follows:
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: /* Resources for USB feedback
|
||||
:end-on: in port p_mclk_in_usb
|
||||
:end-on: /* Clock-block
|
||||
|
||||
In addition to ``port`` resources two clock-block resources are also required:
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: /* Clock-block
|
||||
:end-on: clock clk_audio_mclk_usb
|
||||
|
||||
Again, for the same reasoning as the master-clock ports, two master-clock clock-blocks are required
|
||||
- one on each tile.
|
||||
|
||||
:end-on: /* clock clk_audio_mclk
|
||||
|
||||
Other declarations
|
||||
..................
|
||||
@@ -110,21 +110,21 @@ These are declared as follows:
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: /* Endpoint type tables
|
||||
:end-on: XUD_EpType epTypeTableIn
|
||||
:end-on: /* XUD_EpType epTypeTableIn
|
||||
|
||||
The application main() function
|
||||
-------------------------------
|
||||
...............................
|
||||
|
||||
The ``main()`` function sets up the tasks in the application.
|
||||
|
||||
Various channels are required in order to allow the required tasks to communcate.
|
||||
These must first be declared:
|
||||
These must be declared":
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: /* Channels for lib_xud
|
||||
:end-on: chan c_aud_ctl
|
||||
:end-on: /* chan c_aud_ctl
|
||||
|
||||
The rest of the ``main()`` function starts all of the tasks in parallel
|
||||
The rest of the ``main()`` function starts all the tasks in parallel
|
||||
using the xC ``par`` construct:
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
@@ -146,15 +146,7 @@ Configuration
|
||||
- Various product strings
|
||||
- Master clock frequency
|
||||
|
||||
These parameters are set via defines in an optional ``xua_conf.h`` header file. For this simple application the contents
|
||||
of this file might look something like the following:
|
||||
|
||||
.. literalinclude:: xua_conf.h
|
||||
:start-on: // Copyright
|
||||
:end-on: #endif
|
||||
|
||||
Some items have sensible default values, items like strings and sample rates for example. However, some items are specific to a hardware
|
||||
implentation e.g. master clock frequencies and must be defined. Please see the ``lib_xua`` library documentation for full details.
|
||||
These parameters are set via defines in an optional ``xua_conf.h`` header file.
|
||||
|
||||
|appendix|
|
||||
|newpage|
|
||||
@@ -1,3 +1,2 @@
|
||||
XMOSNEWSTYLE=2
|
||||
SOURCE_INCLUDE_DIRS=../../src
|
||||
SPHINX_MASTER_DOC=AN00246_xua_example
|
||||
XMOSNEWSTYLE=1
|
||||
SOURCE_INCLUDE_DIRS=../../src
|
||||
@@ -1,13 +1,12 @@
|
||||
// Copyright 2017-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
// Copyright (c) 2017-2019, XMOS Ltd, All rights reserved
|
||||
|
||||
/* A very simple *example* of a USB audio application (and as such is un-verified for production)
|
||||
*
|
||||
* It uses the main blocks from the lib_xua
|
||||
* It uses the main blocks from the lib_xua
|
||||
*
|
||||
* - 2 in/ 2 out I2S only
|
||||
* - No DFU
|
||||
* - I2S only
|
||||
* - I2S only
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -23,17 +22,17 @@ buffered in port:32 p_i2s_adc[] = {PORT_I2S_ADC0}; /* I2S Data-line(s) */
|
||||
buffered out port:32 p_lrclk = PORT_I2S_LRCLK; /* I2S Bit-clock */
|
||||
buffered out port:32 p_bclk = PORT_I2S_BCLK; /* I2S L/R-clock */
|
||||
|
||||
/* Master clock for the audio IO tile */
|
||||
/* Note, declared unsafe as sometimes we want to share this port
|
||||
e.g. PDM mics and I2S use same master clock IO */
|
||||
in port p_mclk_in = PORT_MCLK_IN;
|
||||
|
||||
/* Resources for USB feedback */
|
||||
in port p_for_mclk_count = PORT_MCLK_COUNT; /* Extra port for counting master clock ticks */
|
||||
in port p_mclk_in_usb = PORT_MCLK_IN_USB; /* Extra master clock input for the USB tile */
|
||||
in port p_mclk_in2 = PORT_MCLK_IN2;
|
||||
|
||||
/* Clock-block declarations */
|
||||
clock clk_audio_bclk = on tile[0]: XS1_CLKBLK_4; /* Bit clock */
|
||||
clock clk_audio_bclk = on tile[0]: XS1_CLKBLK_4; /* Bit clock */
|
||||
clock clk_audio_mclk = on tile[0]: XS1_CLKBLK_5; /* Master clock */
|
||||
clock clk_audio_mclk_usb = on tile[1]: XS1_CLKBLK_1; /* Master clock for USB tile */
|
||||
clock clk_audio_mclk2 = on tile[1]: XS1_CLKBLK_1; /* Master clock */
|
||||
|
||||
/* Endpoint type tables - informs XUD what the transfer types for each Endpoint in use and also
|
||||
* if the endpoint wishes to be informed of USB bus resets */
|
||||
@@ -49,19 +48,20 @@ int main()
|
||||
/* Channel for communicating SOF notifications from XUD to the Buffering cores */
|
||||
chan c_sof;
|
||||
|
||||
/* Channel for audio data between buffering cores and AudioHub/IO core */
|
||||
/* Channel for audio data between buffering cores and audio IO core */
|
||||
chan c_aud;
|
||||
|
||||
/* Channel for communicating control messages from EP0 to the rest of the device (via the buffering cores) */
|
||||
|
||||
/* Channel for communicating control messages from EP0 to the rest of the device (via the buffering cores */
|
||||
chan c_aud_ctl;
|
||||
|
||||
par
|
||||
{
|
||||
/* Low level USB device layer core */
|
||||
/* Low level USB device layer core */
|
||||
on tile[1]: XUD_Main(c_ep_out, 2, c_ep_in, 2,
|
||||
c_sof, epTypeTableOut, epTypeTableIn,
|
||||
XUD_SPEED_HS, XUD_PWR_SELF);
|
||||
|
||||
c_sof, epTypeTableOut, epTypeTableIn,
|
||||
null, null, -1 ,
|
||||
XUD_SPEED_HS, XUD_PWR_BUS);
|
||||
|
||||
/* Endpoint 0 core from lib_xua */
|
||||
/* Note, since we are not using many features we pass in null for quite a few params.. */
|
||||
on tile[1]: XUA_Endpoint0(c_ep_out[0], c_ep_in[0], c_aud_ctl, null, null, null, null);
|
||||
@@ -69,20 +69,20 @@ int main()
|
||||
/* Buffering cores - handles audio data to/from EP's and gives/gets data to/from the audio I/O core */
|
||||
/* Note, this spawns two cores */
|
||||
on tile[1]: {
|
||||
|
||||
/* Connect master-clock clock-block to clock-block pin */
|
||||
set_clock_src(clk_audio_mclk_usb, p_mclk_in_usb); /* Clock clock-block from mclk pin */
|
||||
set_port_clock(p_for_mclk_count, clk_audio_mclk_usb); /* Clock the "count" port from the clock block */
|
||||
start_clock(clk_audio_mclk_usb); /* Set the clock off running */
|
||||
set_clock_src(clk_audio_mclk2, p_mclk_in2);
|
||||
set_port_clock(p_for_mclk_count, clk_audio_mclk2);
|
||||
start_clock(clk_audio_mclk2);
|
||||
|
||||
XUA_Buffer(c_ep_out[1], c_ep_in[1], c_sof, c_aud_ctl, p_for_mclk_count, c_aud);
|
||||
|
||||
}
|
||||
|
||||
/* AudioHub/IO core does most of the audio IO i.e. I2S (also serves as a hub for all audio) */
|
||||
on tile[0]: XUA_AudioHub(c_aud, clk_audio_mclk, clk_audio_bclk, p_mclk_in, p_lrclk, p_bclk, p_i2s_dac, p_i2s_adc);
|
||||
/* IOHub core does most of the audio IO i.e. I2S (also serves as a hub for all audio) */
|
||||
on tile[0]: {
|
||||
XUA_AudioHub(c_aud, p_mclk_in);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright 2017-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved
|
||||
#ifndef CS4384_H_
|
||||
#define CS4384_H_
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright 2017-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved
|
||||
#ifndef _CS5368_H_
|
||||
#define _CS5368_H_
|
||||
|
||||
|
||||
@@ -1,168 +0,0 @@
|
||||
// Copyright 2021-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#ifndef __hid_report_descriptor_h__
|
||||
#define __hid_report_descriptor_h__
|
||||
|
||||
#include "xua_hid_report.h"
|
||||
|
||||
#if 0
|
||||
/* Existing static report descriptor kept for reference */
|
||||
unsigned char hidReportDescriptor[] =
|
||||
{
|
||||
0x05, 0x0c, /* Usage Page (Consumer Device) */
|
||||
0x09, 0x01, /* Usage (Consumer Control) */
|
||||
0xa1, 0x01, /* Collection (Application) */
|
||||
0x15, 0x00, /* Logical Minimum (0) */
|
||||
0x25, 0x01, /* Logical Maximum (1) */
|
||||
0x09, 0xb0, /* Usage (Play) */
|
||||
0x09, 0xb5, /* Usage (Scan Next Track) */
|
||||
0x09, 0xb6, /* Usage (Scan Previous Track) */
|
||||
0x09, 0xe9, /* Usage (Volume Up) */
|
||||
0x09, 0xea, /* Usage (Volume Down) */
|
||||
0x09, 0xe2, /* Usage (Mute) */
|
||||
0x75, 0x01, /* Report Size (1) */
|
||||
0x95, 0x06, /* Report Count (6) */
|
||||
0x81, 0x02, /* Input (Data, Var, Abs) */
|
||||
0x95, 0x02, /* Report Count (2) */
|
||||
0x81, 0x01, /* Input (Cnst, Ary, Abs) */
|
||||
0xc0 /* End collection */
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define non-configurable items in the HID Report descriptor.
|
||||
*/
|
||||
static const USB_HID_Short_Item_t hidCollectionApplication = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_COLLECTION),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidCollectionEnd = {
|
||||
.header = HID_REPORT_SET_HEADER(0, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_END_COLLECTION),
|
||||
.data = { 0x00, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidInputConstArray = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_INPUT),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidInputDataVar = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_INPUT),
|
||||
.data = { 0x02, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidLogicalMaximum0 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MAXIMUM),
|
||||
.data = { 0x00, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidLogicalMaximum1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MAXIMUM),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidLogicalMinimum0 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MINIMUM),
|
||||
.data = { 0x00, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidReportCount2 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x02, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportCount6 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x06, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportSize1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_SIZE),
|
||||
.data = { 0x01, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidUsageConsumerControl = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.data = { 0x01, 0x00 } };
|
||||
|
||||
/*
|
||||
* Define the HID Report Descriptor Item, Usage Page, Report ID and length for each HID Report
|
||||
* For internal purposes, a report element with ID of 0 must be included if report IDs are not being used.
|
||||
*/
|
||||
static const USB_HID_Report_Element_t hidReportPageConsumer = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_USAGE_PAGE),
|
||||
.item.data = { USB_HID_USAGE_PAGE_ID_CONSUMER, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( 0, 2, 0, 0 )
|
||||
};
|
||||
|
||||
/*
|
||||
* Define configurable items in the HID Report descriptor.
|
||||
*/
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit5 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xE2, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 5)
|
||||
}; // Mute
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit4 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xEA, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 4)
|
||||
}; // Vol-
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit3 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xE9, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 3)
|
||||
}; // Vol+
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit2 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB6, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 2)
|
||||
}; // Scan Prev
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit1 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB5, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 1)
|
||||
}; // Scan Next
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit0 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB0, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 0)
|
||||
}; // Play
|
||||
|
||||
/*
|
||||
* List the configurable elements in the HID Report descriptor.
|
||||
*/
|
||||
static USB_HID_Report_Element_t* const hidConfigurableElements[] = {
|
||||
&hidUsageByte0Bit0,
|
||||
&hidUsageByte0Bit1,
|
||||
&hidUsageByte0Bit2,
|
||||
&hidUsageByte0Bit3,
|
||||
&hidUsageByte0Bit4,
|
||||
&hidUsageByte0Bit5
|
||||
};
|
||||
|
||||
/*
|
||||
* List HID Reports, one per Report ID. This should be a usage page item with the relevant
|
||||
* If not using report IDs - still have one with report ID 0
|
||||
*/
|
||||
static const USB_HID_Report_Element_t* const hidReports[] = {
|
||||
&hidReportPageConsumer
|
||||
};
|
||||
|
||||
/*
|
||||
* List all items in the HID Report descriptor.
|
||||
*/
|
||||
static const USB_HID_Short_Item_t* const hidReportDescriptorItems[] = {
|
||||
&(hidReportPageConsumer.item),
|
||||
&hidUsageConsumerControl,
|
||||
&hidCollectionApplication,
|
||||
&hidLogicalMinimum0,
|
||||
&hidLogicalMaximum1,
|
||||
&(hidUsageByte0Bit0.item),
|
||||
&(hidUsageByte0Bit1.item),
|
||||
&(hidUsageByte0Bit2.item),
|
||||
&(hidUsageByte0Bit3.item),
|
||||
&(hidUsageByte0Bit4.item),
|
||||
&(hidUsageByte0Bit5.item),
|
||||
&hidReportSize1,
|
||||
&hidReportCount6,
|
||||
&hidInputDataVar,
|
||||
&hidLogicalMaximum0,
|
||||
&hidReportCount2,
|
||||
&hidInputConstArray,
|
||||
&hidCollectionEnd
|
||||
};
|
||||
|
||||
/*
|
||||
* Define the number of HID Reports
|
||||
* Due to XC not supporting designated initializers, this constant has a hard-coded value.
|
||||
* It must equal ( sizeof hidReports / sizeof ( USB_HID_Report_Element_t* ))
|
||||
*/
|
||||
#define HID_REPORT_COUNT ( 1 )
|
||||
|
||||
#endif // __hid_report_descriptor_h__
|
||||
@@ -1,17 +1,16 @@
|
||||
// Copyright 2016-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved
|
||||
|
||||
#include <platform.h>
|
||||
#include <timer.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "xua.h"
|
||||
#include "i2c.h" /* From lib_i2c */
|
||||
#include "i2c_shared.h"
|
||||
|
||||
#include "cs5368.h"
|
||||
#include "cs4384.h"
|
||||
|
||||
port p_i2c = on tile[0]:XS1_PORT_4A;
|
||||
on tile [0] : struct r_i2c r_i2c = {XS1_PORT_4A};
|
||||
|
||||
|
||||
/* General output port bit definitions */
|
||||
#define P_GPIO_DSD_MODE (1 << 0) /* DSD mode select 0 = 8i/8o I2S, 1 = 8o DSD*/
|
||||
@@ -23,16 +22,17 @@ port p_i2c = on tile[0]:XS1_PORT_4A;
|
||||
#define P_GPIO_ADC_RST_N (1 << 6)
|
||||
#define P_GPIO_MCLK_FSEL (1 << 7) /* Select frequency on Phaselink clock. 0 = 24.576MHz for 48k, 1 = 22.5792MHz for 44.1k.*/
|
||||
|
||||
#define DAC_REGWRITE(reg, val) result = i2c.write_reg(CS4384_I2C_ADDR, reg, val);
|
||||
#define DAC_REGREAD(reg) data = i2c.read_reg(CS4384_I2C_ADDR, reg, result);
|
||||
#define ADC_REGWRITE(reg, val) result = i2c.write_reg(CS5368_I2C_ADDR, reg, val);
|
||||
#define DAC_REGWRITE(reg, val) {data[0] = val; i2c_shared_master_write_reg(r_i2c, CS4384_I2C_ADDR, reg, data, 1);}
|
||||
#define DAC_REGREAD(reg, val) {i2c_shared_master_read_reg(r_i2c, CS4384_I2C_ADDR, reg, val, 1);}
|
||||
#define ADC_REGWRITE(reg, val) {data[0] = val; i2c_shared_master_write_reg(r_i2c, CS5368_I2C_ADDR, reg, data, 1);}
|
||||
|
||||
out port p_gpio = on tile[0]:XS1_PORT_8C;
|
||||
|
||||
void AudioHwConfig2(unsigned samFreq, unsigned mClk, unsigned dsdMode, unsigned sampRes_DAC, unsigned sampRes_ADC, client interface i2c_master_if i2c)
|
||||
void AudioHwConfig(unsigned samFreq, unsigned mClk, unsigned dsdMode,
|
||||
unsigned sampRes_DAC, unsigned sampRes_ADC)
|
||||
{
|
||||
unsigned char data[1] = {0};
|
||||
unsigned char gpioVal = 0;
|
||||
i2c_regop_res_t result;
|
||||
|
||||
/* Set master clock select appropriately and put ADC and DAC into reset */
|
||||
if (mClk == MCLK_441)
|
||||
@@ -50,7 +50,7 @@ void AudioHwConfig2(unsigned samFreq, unsigned mClk, unsigned dsdMode, unsigned
|
||||
delay_microseconds(20000);
|
||||
|
||||
/* Take ADC out of reset */
|
||||
gpioVal |= P_GPIO_ADC_RST_N;
|
||||
gpioVal |= P_GPIO_ADC_RST_N;
|
||||
p_gpio <: gpioVal;
|
||||
|
||||
/* Configure ADC for I2S slave mode via I2C */
|
||||
@@ -58,7 +58,7 @@ void AudioHwConfig2(unsigned samFreq, unsigned mClk, unsigned dsdMode, unsigned
|
||||
dif = 0x01; /* I2S */
|
||||
mode = 0x03; /* Slave mode all speeds */
|
||||
|
||||
/* Reg 0x01: (GCTL) Global Mode Control Register
|
||||
/* Reg 0x01: (GCTL) Global Mode Control Register
|
||||
* Bit[7]: CP-EN: Manages control-port mode
|
||||
* Bit[6]: CLKMODE: Setting puts part in 384x mode
|
||||
* Bit[5:4]: MDIV[1:0]: Set to 01 for /2
|
||||
@@ -67,7 +67,6 @@ void AudioHwConfig2(unsigned samFreq, unsigned mClk, unsigned dsdMode, unsigned
|
||||
*/
|
||||
ADC_REGWRITE(CS5368_GCTL_MDE, 0b10010000 | (dif << 2) | mode);
|
||||
|
||||
|
||||
/* Reg 0x06: (PDN) Power Down Register */
|
||||
/* Bit[7:6]: Reserved
|
||||
* Bit[5]: PDN-BG: When set, this bit powers-own the bandgap reference
|
||||
@@ -92,7 +91,7 @@ void AudioHwConfig2(unsigned samFreq, unsigned mClk, unsigned dsdMode, unsigned
|
||||
*/
|
||||
DAC_REGWRITE(CS4384_MODE_CTRL, 0b11000001);
|
||||
|
||||
/* PCM Control (Address: 0x03) */
|
||||
/* PCM Control (Address: 0x03) */
|
||||
/* bit[7:4] : Digital Interface Format (DIF) : 0b0001 for I2S up to 24bit
|
||||
* bit[3:2] : Reserved
|
||||
* bit[1:0] : Functional Mode (FM) : 0x00 - single-speed mode (4-50kHz)
|
||||
@@ -121,8 +120,6 @@ void AudioHwConfig2(unsigned samFreq, unsigned mClk, unsigned dsdMode, unsigned
|
||||
*/
|
||||
DAC_REGWRITE(CS4384_MODE_CTRL, 0b10000000);
|
||||
|
||||
/* Kill the i2c task */
|
||||
i2c.shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -131,16 +128,8 @@ void AudioHwInit()
|
||||
/* Set USB Mux to micro-b */
|
||||
/* ADC and DAC in reset */
|
||||
p_gpio <: P_GPIO_USB_SEL0 | P_GPIO_USB_SEL1;
|
||||
}
|
||||
|
||||
void AudioHwConfig(unsigned samFreq, unsigned mClk, unsigned dsdMode,
|
||||
unsigned sampRes_DAC, unsigned sampRes_ADC)
|
||||
{
|
||||
i2c_master_if i2c[1];
|
||||
par
|
||||
{
|
||||
i2c_master_single_port(i2c, 1, p_i2c, 10, 0, 1, 0);
|
||||
AudioHwConfig2(samFreq, mClk, dsdMode, sampRes_DAC, sampRes_ADC, i2c[0]);
|
||||
}
|
||||
|
||||
/* Init the i2c module */
|
||||
i2c_shared_master_init(r_i2c);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,10 +40,9 @@
|
||||
</Tile>
|
||||
<Tile Number="1" Reference="tile[1]">
|
||||
<!-- USB intended to run on this tile -->
|
||||
<!-- Ports for USB feedback calculation -->
|
||||
<Port Location="XS1_PORT_16B" Name="PORT_MCLK_COUNT"/>
|
||||
<Port Location="XS1_PORT_1L" Name="PORT_MCLK_IN_USB"/>
|
||||
<!-- Audio Ports -->
|
||||
<Port Location="XS1_PORT_16B" Name="PORT_MCLK_COUNT"/>
|
||||
<Port Location="XS1_PORT_1L" Name="PORT_MCLK_IN2"/>
|
||||
<Port Location="XS1_PORT_1M" Name="PORT_MIDI_IN"/>
|
||||
<Port Location="XS1_PORT_1N" Name="PORT_MIDI_OUT"/>
|
||||
<Port Location="XS1_PORT_1O" Name="PORT_ADAT_IN"/>--> <!-- P: COAX O: OPT -->
|
||||
@@ -75,7 +74,7 @@
|
||||
</Link>
|
||||
</Links>
|
||||
<ExternalDevices>
|
||||
<Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="S25FL116K" PageSize="256" SectorSize="4096" NumPages="8192">
|
||||
<Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="S25FL116K">
|
||||
<Attribute Name="PORT_SQI_CS" Value="PORT_SQI_CS"/>
|
||||
<Attribute Name="PORT_SQI_SCLK" Value="PORT_SQI_SCLK"/>
|
||||
<Attribute Name="PORT_SQI_SIO" Value="PORT_SQI_SIO"/>
|
||||
|
||||
@@ -1,27 +1,24 @@
|
||||
// Copyright 2017-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved
|
||||
|
||||
#ifndef _XUA_CONF_H_
|
||||
#define _XUA_CONF_H_
|
||||
|
||||
#define NUM_USB_CHAN_OUT 2 /* Number of channels from host to device */
|
||||
#define NUM_USB_CHAN_IN 2 /* Number of channels from device to host */
|
||||
#define I2S_CHANS_DAC 2 /* Number of I2S channels out of xCORE */
|
||||
#define I2S_CHANS_ADC 2 /* Number of I2S channels in to xCORE */
|
||||
#define MCLK_441 (512 * 44100) /* 44.1kHz family master clock frequency */
|
||||
#define MCLK_48 (512 * 48000) /* 48kHz family master clock frequency */
|
||||
#define MIN_FREQ 48000 /* Minimum sample rate */
|
||||
#define MAX_FREQ 48000 /* Maximum sample rate */
|
||||
#define NUM_USB_CHAN_OUT 2
|
||||
#define NUM_USB_CHAN_IN 2
|
||||
#define I2S_CHANS_DAC 2
|
||||
#define I2S_CHANS_ADC 2
|
||||
#define MCLK_441 (512 * 44100)
|
||||
#define MCLK_48 (512 * 48000)
|
||||
#define MIN_FREQ 48000
|
||||
#define MAX_FREQ 48000
|
||||
|
||||
#define EXCLUDE_USB_AUDIO_MAIN
|
||||
|
||||
#define VENDOR_STR "XMOS"
|
||||
#define VENDOR_ID 0x20B1
|
||||
#define PRODUCT_STR_A2 "XUA Example"
|
||||
#define PRODUCT_STR_A1 "XUA Example"
|
||||
#define PID_AUDIO_1 1
|
||||
#define PID_AUDIO_2 2
|
||||
#define XUA_DFU_EN 0 /* Disable DFU (for simplicity of example */
|
||||
#define MIC_DUAL_ENABLED 0 // Use multi-threaded design
|
||||
|
||||
#endif
|
||||
#define SPDIF_TX_INDEX 0
|
||||
#define VENDOR_STR "XMOS"
|
||||
#define VENDOR_ID 0x20B1
|
||||
#define PRODUCT_STR_A2 "XUA Example"
|
||||
#define PRODUCT_STR_A1 "XUA Example"
|
||||
#define PID_AUDIO_1 1
|
||||
#define PID_AUDIO_2 2
|
||||
#define AUDIO_CLASS 2
|
||||
#define AUDIO_CLASS_FALLBACK 0
|
||||
#define BCD_DEVICE 0x1234
|
||||
#define XUA_DFU_EN 0
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright 2017-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved
|
||||
|
||||
#include "xua_conf.h"
|
||||
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
*******************************
|
||||
XMOS PUBLIC LICENCE: Version 1
|
||||
*******************************
|
||||
|
||||
Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software.
|
||||
|
||||
**1. Definitions**
|
||||
|
||||
**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software.
|
||||
|
||||
**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code.
|
||||
|
||||
**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives.
|
||||
|
||||
**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof.
|
||||
|
||||
**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code.
|
||||
|
||||
**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence.
|
||||
|
||||
This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement.
|
||||
|
||||
|
||||
**2. Licence**
|
||||
|
||||
**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following:
|
||||
|
||||
2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software:
|
||||
|
||||
2.1.1 for personal or academic, non-commercial purposes; or
|
||||
|
||||
2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2):
|
||||
|
||||
(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and
|
||||
|
||||
(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms).
|
||||
|
||||
The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement.
|
||||
|
||||
2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives:
|
||||
|
||||
2.2.1 for personal or academic, non-commercial purposes; or
|
||||
|
||||
2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2):
|
||||
|
||||
(a) you must comply with the terms of clause 2.1 with respect to the Derivatives;
|
||||
|
||||
(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and
|
||||
|
||||
(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS.
|
||||
|
||||
Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below.
|
||||
|
||||
2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code.
|
||||
|
||||
**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above.
|
||||
|
||||
**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives.
|
||||
|
||||
**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS.
|
||||
|
||||
**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms.
|
||||
|
||||
**7. IPR and Ownership**
|
||||
Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com**
|
||||
|
||||
Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein).
|
||||
Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit.
|
||||
|
||||
**8. Termination**
|
||||
|
||||
8.1 This Licence will automatically terminate immediately, without notice to you, if:
|
||||
|
||||
(a) you fail to comply with the terms of this Licence; and/or
|
||||
|
||||
(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or
|
||||
|
||||
(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part.
|
||||
|
||||
**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use.
|
||||
|
||||
**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50.
|
||||
|
||||
**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply.
|
||||
@@ -1,22 +0,0 @@
|
||||
APP_NAME = app_xua_simple
|
||||
|
||||
TARGET = xk-audio-216-mc.xn
|
||||
|
||||
# The flags passed to xcc when building the application
|
||||
XCC_FLAGS = -fcomment-asm -Xmapper --map -Xmapper MAPFILE -O3 -report -save-temps \
|
||||
-g -Wno-unused-function -Wno-timing -DXUD_SERIES_SUPPORT=XUD_X200_SERIES \
|
||||
-DXUD_CORE_CLOCK=600 -DUSB_TILE=tile[1] -DSDA_HIGH=2 -DSCL_HIGH=1 -fxscope \
|
||||
-DUAC_FORCE_FEEDBACK_EP=0
|
||||
|
||||
# The USED_MODULES variable lists other module used by the application. These
|
||||
# modules will extend the SOURCE_DIRS, INCLUDE_DIRS and LIB_DIRS variables.
|
||||
# Modules are expected to be in the directory above the BASE_DIR directory.
|
||||
USED_MODULES = lib_xua lib_xud lib_spdif
|
||||
|
||||
#=============================================================================
|
||||
# The following part of the Makefile includes the common build infrastructure
|
||||
# for compiling XMOS applications. You should not need to edit below here.
|
||||
|
||||
XMOS_MAKE_PATH ?= ../..
|
||||
include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
|
||||
Using lib_xua with lib_spdif (transmit)
|
||||
=======================================
|
||||
|
||||
Summary
|
||||
-------
|
||||
|
||||
Software dependencies
|
||||
.....................
|
||||
|
||||
For a list of direct dependencies, look for USED_MODULES in the Makefile.
|
||||
|
||||
Required hardware
|
||||
.................
|
||||
|
||||
The example code provided with the application has been implemented
|
||||
and tested on the xCORE-200 Multi-channel Audio Board
|
||||
|
||||
Prerequisites
|
||||
.............
|
||||
|
||||
* This document assumes familiarity with the XMOS xCORE architecture,
|
||||
the XMOS tool chain and the xC language. Documentation related to these
|
||||
aspects which are not specific to this application note are linked to in
|
||||
the references appendix.
|
||||
|
||||
* For a description of XMOS related terms found in this document
|
||||
please see the XMOS Glossary [#]_.
|
||||
|
||||
.. [#] http://www.xmos.com/published/glossary
|
||||
|
||||
|
||||
@@ -1,278 +0,0 @@
|
||||
.. include:: ../../README.rst
|
||||
|
||||
|newpage|
|
||||
|
||||
Overview
|
||||
--------
|
||||
|
||||
Introduction
|
||||
............
|
||||
|
||||
The XMOS USB Audio (XUA) library provides an implemention of USB Audio Class versions 1.0 and 2.0.
|
||||
|
||||
This application note demonstrates the implementation of a basic USB Audio Device with
|
||||
S/PDIF transmit functionality the xCORE-200 MC Audio board.
|
||||
|
||||
To reduce complexity this application note does not enable any other audio interfaces other that S/PDIF transmit
|
||||
(i.e. no I2S). Readers are encouraged to read applicaition note AN00246 in conjunction with this application
|
||||
note.
|
||||
|
||||
|
||||
The Makefile
|
||||
------------
|
||||
|
||||
To start using ``lib_xua``, you need to add ``lib_xua`` and ``lib_spdif`` to your Makefile::
|
||||
|
||||
USED_MODULES = .. lib_xua lib_spdif ...
|
||||
|
||||
This demo also uses the XMOS USB Device library (``lib_xud``) for low-level USB connectivity.
|
||||
The Makefile also includes::
|
||||
|
||||
USED_MODULES = .. lib_xud ..
|
||||
|
||||
``lib_xud`` library requires some flags for correct operation. Firstly the
|
||||
tile on which ``lib_xud`` will be execute, for example::
|
||||
|
||||
XCC_FLAGS = .. -DUSB_TILE=tile[1] ..
|
||||
|
||||
Secondly, the architecture of the target device, for example::
|
||||
|
||||
XCC_FLAGS = .. -DXUD_SERIES_SUPPORT=XUD_X200_SERIES ..
|
||||
|
||||
Includes
|
||||
--------
|
||||
|
||||
This application requires the system header that defines XMOS xCORE specific
|
||||
defines for declaring and initialising hardware:
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: include <xs1.h>
|
||||
:end-before: include "xua.h"
|
||||
|
||||
The XUA library functions are defined in ``xua.h``. This header must
|
||||
be included in your code to use the library.
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: include "xua.h"
|
||||
:end-on: include "xud_device.h"
|
||||
|
||||
The application uses the S/PDIF transmitter from ``lib_spdif``. This header
|
||||
must be included in your code.
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: /* From lib_spdif
|
||||
:end-on: include "spdif.h"
|
||||
|
||||
Declarations
|
||||
------------
|
||||
|
||||
Allocating hardware resources for lib_xua
|
||||
.........................................
|
||||
|
||||
A minimal implementation of a USB Audio device, without I2S functionalilty,
|
||||
using ``lib_xua`` requires the follow pins:
|
||||
|
||||
- Audio Master clock (from clock source to xCORE)
|
||||
|
||||
On an xCORE the pins are controlled by ``ports``. The application therefore declares a
|
||||
port for the master clock input signal.
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: /* Lib_xua port declaration
|
||||
:end-on: in port p_mclk_in
|
||||
|
||||
``lib_xua`` also requires two ports for internally calculating USB feedback. Please refer to
|
||||
the ``lib_xua`` library documentation for further details. The additonal input port for the master
|
||||
clock is required since USB and S/PDIF do not reside of the same tiles on the example hardware.
|
||||
|
||||
These ports are declared as follows:
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: /* Resources for USB feedback
|
||||
:end-on: in port p_mclk_in_usb
|
||||
|
||||
In addition to ``port`` resources two clock-block resources are also required:
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: /* Clock-block
|
||||
:end-on: clock clk_audio_mclk_usb
|
||||
|
||||
Again, for the same reasoning as the master-clock ports, two master-clock clock-blocks are required
|
||||
- one on each tile.
|
||||
|
||||
|
||||
Allocating hardware resources for lib_spdif
|
||||
...........................................
|
||||
|
||||
The S/PDIF transmitter requires a single (buffered) 1-bit port:
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: /* Lib_spdif port
|
||||
:end-on: buffered out port
|
||||
|
||||
This port must be clocked from the audio master clock. This application note chooses to declare
|
||||
an extra clock-block as follows:
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: clock clk_spdif_tx
|
||||
:end-before: /* Lib_xua
|
||||
|
||||
|
||||
Other declarations
|
||||
..................
|
||||
|
||||
``lib_xua`` currently requires the manual declaration of tables for the endpoint types for
|
||||
``lib_xud`` and the calling the main XUD function in a par (``XUD_Main()``).
|
||||
|
||||
For a simple application the following endpoints are required:
|
||||
|
||||
- ``Control`` enpoint zero
|
||||
- ``Isochonous`` endpoint for each direction for audio data to/from the USB host
|
||||
|
||||
These are declared as follows:
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: /* Endpoint type tables
|
||||
:end-on: XUD_EpType epTypeTableIn
|
||||
|
||||
Configuring lib_xua
|
||||
-------------------
|
||||
|
||||
``lib_xua`` must be configued to enable S/PDIF Tx functionality.
|
||||
|
||||
``lib_xua`` has many parameters than can be configured at build time, some examples include:
|
||||
|
||||
- Sample-rates
|
||||
- Channel counts
|
||||
- Audio Class version
|
||||
- Product/Vendor ID's
|
||||
- Various product strings
|
||||
- Master clock frequency
|
||||
|
||||
To enable S/PDIF functionality ``XUA_SPDIF_TX_EN`` must be set to a non-zero value. Setting this will cause the ``XUA_AudioHub``
|
||||
tasks to forward samples and sample rate information to the S/PDIF transmitter task.
|
||||
|
||||
These parameters are set via defines in an optional ``xua_conf.h`` header file. For this simple application the
|
||||
complete contents of this file are as follows:
|
||||
|
||||
.. literalinclude:: xua_conf.h
|
||||
:start-on: // Copyright
|
||||
:end-on: #endif
|
||||
|
||||
The application main() function
|
||||
-------------------------------
|
||||
|
||||
The ``main()`` function sets up the tasks in the application.
|
||||
|
||||
Various channels are required in order to allow the required tasks to communcate.
|
||||
These must first be declared:
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: /* Channels for lib_xud
|
||||
:end-on: chan c_spdif_tx
|
||||
|
||||
The rest of the ``main()`` function starts all of the tasks in parallel
|
||||
using the xC ``par`` construct:
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: par
|
||||
:end-before: return 0
|
||||
|
||||
This code starts the low-level USB task, an Endpoint 0 task, an Audio buffering task and a task to handle
|
||||
the audio I/O. Note, since there is no I2S funcitonality in this example this task simply forwards samples to the
|
||||
SPDIF transmitter task. In addition the ``spdif_tx()`` task is also run.
|
||||
|
||||
Note that the ``spdif_tx_port_config()`` function is called before a nested ``par`` of ``spdif_tx()`` and ``XUA_AudioHub()``.
|
||||
This is because of the "shared" nature of ``p_mclk_in`` and avoids a parrallel usage check failure by the XMOS toolchain.
|
||||
|
||||
|appendix|
|
||||
|newpage|
|
||||
|
||||
Demo Hardware Setup
|
||||
-------------------
|
||||
|
||||
To run the demo, connect a USB cable to power the xCORE-200 MC Audio board
|
||||
and plug the xTAG to the board and connect the xTAG USB cable to your
|
||||
development machine.
|
||||
|
||||
.. figure:: images/hw_setup.*
|
||||
:width: 80%
|
||||
|
||||
Hardware setup
|
||||
|
||||
|newpage|
|
||||
|
||||
Launching the demo application
|
||||
------------------------------
|
||||
|
||||
Once the demo example has been built either from the command line using xmake or
|
||||
via the build mechanism of xTIMEcomposer studio it can be executed on the xCORE-200
|
||||
MC Audio board.
|
||||
|
||||
Once built there will be a ``bin/`` directory within the project which contains
|
||||
the binary for the xCORE device. The xCORE binary has a XMOS standard .xe extension.
|
||||
|
||||
Launching from the command line
|
||||
...............................
|
||||
|
||||
From the command line you use the ``xrun`` tool to download and run the code
|
||||
on the xCORE device::
|
||||
|
||||
xrun --xscope bin/app_xua_simple.xe
|
||||
|
||||
Once this command has executed the application will be running on the
|
||||
xCORE-200 MC Audio Board
|
||||
|
||||
Launching from xTIMEcomposer Studio
|
||||
...................................
|
||||
|
||||
From xTIMEcomposer Studio use the run mechanism to download code to xCORE device.
|
||||
Select the xCORE binary from the ``bin/`` directory, right click and go to Run
|
||||
Configurations. Double click on xCORE application to create a new run configuration,
|
||||
enable the xSCOPE I/O mode in the dialog box and then
|
||||
select Run.
|
||||
|
||||
Once this command has executed the application will be running on the
|
||||
xCORE-200 MC Audio board.
|
||||
|
||||
Running the application
|
||||
.......................
|
||||
|
||||
Once running the device will be detected as a USB Audio device - note, Windows operating
|
||||
systems may require a third party driver for correct operation
|
||||
|
||||
|newpage|
|
||||
|
||||
References
|
||||
----------
|
||||
|
||||
.. nopoints::
|
||||
|
||||
* XMOS Tools User Guide
|
||||
|
||||
http://www.xmos.com/published/xtimecomposer-user-guide
|
||||
|
||||
* XMOS xCORE Programming Guide
|
||||
|
||||
http://www.xmos.com/published/xmos-programming-guide
|
||||
|
||||
* XMOS lib_xua Library
|
||||
|
||||
http://www.xmos.com/support/libraries/lib_xua
|
||||
|
||||
* XMOS lib_xud Library
|
||||
|
||||
http://www.xmos.com/support/libraries/lib_xud
|
||||
|
||||
|newpage|
|
||||
|
||||
Full source code listing
|
||||
------------------------
|
||||
|
||||
Source code for main.xc
|
||||
.......................
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:largelisting:
|
||||
|
||||
|newpage|
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 75 KiB |
@@ -1,3 +0,0 @@
|
||||
XMOSNEWSTYLE=2
|
||||
SOURCE_INCLUDE_DIRS=../../src
|
||||
SPHINX_MASTER_DOC=AN00247_xua_example_spdif_tx
|
||||
@@ -1,106 +0,0 @@
|
||||
// Copyright 2017-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
/* A very simple *example* of a USB audio application (and as such is un-verified for production)
|
||||
*
|
||||
* It uses the main blocks from the lib_xua
|
||||
*
|
||||
* - S/PDIF output only
|
||||
* - No DFU
|
||||
*
|
||||
*/
|
||||
|
||||
#include <xs1.h>
|
||||
#include <platform.h>
|
||||
|
||||
#include "xua.h"
|
||||
#include "xud_device.h"
|
||||
|
||||
/* From lib_spdif */
|
||||
#include "spdif.h"
|
||||
|
||||
/* Lib_spdif port declarations. Note, the defines come from the xn file */
|
||||
buffered out port:32 p_spdif_tx = PORT_SPDIF_OUT; /* SPDIF transmit port */
|
||||
|
||||
clock clk_spdif_tx = on tile[0]: XS1_CLKBLK_4; /* Clock block for S/PDIF transmit */
|
||||
|
||||
/* Lib_xua port declarations. Note, the defines come from the xn file */
|
||||
in port p_mclk_in = PORT_MCLK_IN; /* Master clock for the audio IO tile */
|
||||
|
||||
/* Resources for USB feedback */
|
||||
in port p_for_mclk_count = PORT_MCLK_COUNT; /* Extra port for counting master clock ticks */
|
||||
in port p_mclk_in_usb = PORT_MCLK_IN_USB; /* Extra master clock input for the USB tile */
|
||||
|
||||
/* Clock-block declarations */
|
||||
clock clk_audio_mclk = on tile[0]: XS1_CLKBLK_5; /* Master clock */
|
||||
clock clk_audio_mclk_usb = on tile[1]: XS1_CLKBLK_1; /* Master clock for USB tile */
|
||||
|
||||
/* Endpoint type tables - informs XUD what the transfer types for each Endpoint in use and also
|
||||
* if the endpoint wishes to be informed of USB bus resets */
|
||||
XUD_EpType epTypeTableOut[] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE, XUD_EPTYPE_ISO};
|
||||
XUD_EpType epTypeTableIn[] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE, XUD_EPTYPE_ISO};
|
||||
|
||||
int main()
|
||||
{
|
||||
/* Channels for lib_xud */
|
||||
chan c_ep_out[2];
|
||||
chan c_ep_in[2];
|
||||
|
||||
/* Channel for communicating SOF notifications from XUD to the Buffering cores */
|
||||
chan c_sof;
|
||||
|
||||
/* Channel for audio data between buffering cores and AudioHub/IO core */
|
||||
chan c_aud;
|
||||
|
||||
/* Channel for communicating control messages from EP0 to the rest of the device (via the buffering cores) */
|
||||
chan c_aud_ctl;
|
||||
|
||||
/* Channel for communication between AudioHub and S/PDIF transmitter */
|
||||
chan c_spdif_tx;
|
||||
|
||||
par
|
||||
{
|
||||
/* Low level USB device layer core */
|
||||
on tile[1]: XUD_Main(c_ep_out, 2, c_ep_in, 2, c_sof, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_SELF);
|
||||
|
||||
/* Endpoint 0 core from lib_xua */
|
||||
/* Note, since we are not using many features we pass in null for quite a few params.. */
|
||||
on tile[1]: XUA_Endpoint0(c_ep_out[0], c_ep_in[0], c_aud_ctl, null, null, null, null);
|
||||
|
||||
/* Buffering cores - handles audio data to/from EP's and gives/gets data to/from the audio I/O core */
|
||||
/* Note, this spawns two cores */
|
||||
on tile[1]: {
|
||||
|
||||
/* Connect master-clock clock-block to clock-block pin */
|
||||
set_clock_src(clk_audio_mclk_usb, p_mclk_in_usb); /* Clock clock-block from mclk pin */
|
||||
set_port_clock(p_for_mclk_count, clk_audio_mclk_usb); /* Clock the "count" port from the clock block */
|
||||
start_clock(clk_audio_mclk_usb); /* Set the clock off running */
|
||||
|
||||
XUA_Buffer(c_ep_out[1], c_ep_in[1], c_sof, c_aud_ctl, p_for_mclk_count, c_aud);
|
||||
}
|
||||
|
||||
/* AudioHub() (I2S) and S/SPDIF Tx are on the same tile */
|
||||
on tile[0]: {
|
||||
|
||||
/* Setup S/PDIF tx port from clock etc - note we do this before par to avoid parallel usage */
|
||||
spdif_tx_port_config(p_spdif_tx, clk_spdif_tx, p_mclk_in, 7);
|
||||
|
||||
par
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
/* Run the S/PDIF transmitter task */
|
||||
spdif_tx(p_spdif_tx, c_spdif_tx);
|
||||
}
|
||||
|
||||
/* AudioHub/IO core does most of the audio IO i.e. I2S (also serves as a hub for all audio) */
|
||||
/* Note, since we are not using I2S we pass in null for LR and Bit clock ports and the I2S dataline ports */
|
||||
XUA_AudioHub(c_aud, clk_audio_mclk, null, p_mclk_in, null, null, null, null, c_spdif_tx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,168 +0,0 @@
|
||||
// Copyright 2021-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#ifndef __hid_report_descriptor_h__
|
||||
#define __hid_report_descriptor_h__
|
||||
|
||||
#include "xua_hid_report.h"
|
||||
|
||||
#if 0
|
||||
/* Existing static report descriptor kept for reference */
|
||||
unsigned char hidReportDescriptor[] =
|
||||
{
|
||||
0x05, 0x0c, /* Usage Page (Consumer Device) */
|
||||
0x09, 0x01, /* Usage (Consumer Control) */
|
||||
0xa1, 0x01, /* Collection (Application) */
|
||||
0x15, 0x00, /* Logical Minimum (0) */
|
||||
0x25, 0x01, /* Logical Maximum (1) */
|
||||
0x09, 0xb0, /* Usage (Play) */
|
||||
0x09, 0xb5, /* Usage (Scan Next Track) */
|
||||
0x09, 0xb6, /* Usage (Scan Previous Track) */
|
||||
0x09, 0xe9, /* Usage (Volume Up) */
|
||||
0x09, 0xea, /* Usage (Volume Down) */
|
||||
0x09, 0xe2, /* Usage (Mute) */
|
||||
0x75, 0x01, /* Report Size (1) */
|
||||
0x95, 0x06, /* Report Count (6) */
|
||||
0x81, 0x02, /* Input (Data, Var, Abs) */
|
||||
0x95, 0x02, /* Report Count (2) */
|
||||
0x81, 0x01, /* Input (Cnst, Ary, Abs) */
|
||||
0xc0 /* End collection */
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define non-configurable items in the HID Report descriptor.
|
||||
*/
|
||||
static const USB_HID_Short_Item_t hidCollectionApplication = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_COLLECTION),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidCollectionEnd = {
|
||||
.header = HID_REPORT_SET_HEADER(0, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_END_COLLECTION),
|
||||
.data = { 0x00, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidInputConstArray = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_INPUT),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidInputDataVar = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_INPUT),
|
||||
.data = { 0x02, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidLogicalMaximum0 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MAXIMUM),
|
||||
.data = { 0x00, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidLogicalMaximum1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MAXIMUM),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidLogicalMinimum0 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MINIMUM),
|
||||
.data = { 0x00, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidReportCount2 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x02, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportCount6 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x06, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportSize1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_SIZE),
|
||||
.data = { 0x01, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidUsageConsumerControl = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.data = { 0x01, 0x00 } };
|
||||
|
||||
/*
|
||||
* Define the HID Report Descriptor Item, Usage Page, Report ID and length for each HID Report
|
||||
* For internal purposes, a report element with ID of 0 must be included if report IDs are not being used.
|
||||
*/
|
||||
static const USB_HID_Report_Element_t hidReportPageConsumer = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_USAGE_PAGE),
|
||||
.item.data = { USB_HID_USAGE_PAGE_ID_CONSUMER, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( 0, 2, 0, 0 )
|
||||
};
|
||||
|
||||
/*
|
||||
* Define configurable items in the HID Report descriptor.
|
||||
*/
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit5 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xE2, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 5)
|
||||
}; // Mute
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit4 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xEA, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 4)
|
||||
}; // Vol-
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit3 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xE9, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 3)
|
||||
}; // Vol+
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit2 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB6, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 2)
|
||||
}; // Scan Prev
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit1 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB5, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 1)
|
||||
}; // Scan Next
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit0 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB0, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 0)
|
||||
}; // Play
|
||||
|
||||
/*
|
||||
* List the configurable elements in the HID Report descriptor.
|
||||
*/
|
||||
static USB_HID_Report_Element_t* const hidConfigurableElements[] = {
|
||||
&hidUsageByte0Bit0,
|
||||
&hidUsageByte0Bit1,
|
||||
&hidUsageByte0Bit2,
|
||||
&hidUsageByte0Bit3,
|
||||
&hidUsageByte0Bit4,
|
||||
&hidUsageByte0Bit5
|
||||
};
|
||||
|
||||
/*
|
||||
* List HID Reports, one per Report ID. This should be a usage page item with the relevant
|
||||
* If not using report IDs - still have one with report ID 0
|
||||
*/
|
||||
static const USB_HID_Report_Element_t* const hidReports[] = {
|
||||
&hidReportPageConsumer
|
||||
};
|
||||
|
||||
/*
|
||||
* List all items in the HID Report descriptor.
|
||||
*/
|
||||
static const USB_HID_Short_Item_t* const hidReportDescriptorItems[] = {
|
||||
&(hidReportPageConsumer.item),
|
||||
&hidUsageConsumerControl,
|
||||
&hidCollectionApplication,
|
||||
&hidLogicalMinimum0,
|
||||
&hidLogicalMaximum1,
|
||||
&(hidUsageByte0Bit0.item),
|
||||
&(hidUsageByte0Bit1.item),
|
||||
&(hidUsageByte0Bit2.item),
|
||||
&(hidUsageByte0Bit3.item),
|
||||
&(hidUsageByte0Bit4.item),
|
||||
&(hidUsageByte0Bit5.item),
|
||||
&hidReportSize1,
|
||||
&hidReportCount6,
|
||||
&hidInputDataVar,
|
||||
&hidLogicalMaximum0,
|
||||
&hidReportCount2,
|
||||
&hidInputConstArray,
|
||||
&hidCollectionEnd
|
||||
};
|
||||
|
||||
/*
|
||||
* Define the number of HID Reports
|
||||
* Due to XC not supporting designated initializers, this constant has a hard-coded value.
|
||||
* It must equal ( sizeof hidReports / sizeof ( USB_HID_Report_Element_t* ))
|
||||
*/
|
||||
#define HID_REPORT_COUNT ( 1 )
|
||||
|
||||
#endif // __hid_report_descriptor_h__
|
||||
@@ -1,52 +0,0 @@
|
||||
// Copyright 2016-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#include <platform.h>
|
||||
#include <timer.h>
|
||||
|
||||
#include "xua.h"
|
||||
|
||||
/* General output port bit definitions */
|
||||
#define P_GPIO_DSD_MODE (1 << 0) /* DSD mode select 0 = 8i/8o I2S, 1 = 8o DSD*/
|
||||
#define P_GPIO_DAC_RST_N (1 << 1)
|
||||
#define P_GPIO_USB_SEL0 (1 << 2)
|
||||
#define P_GPIO_USB_SEL1 (1 << 3)
|
||||
#define P_GPIO_VBUS_EN (1 << 4)
|
||||
#define P_GPIO_PLL_SEL (1 << 5) /* 1 = CS2100, 0 = Phaselink clock source */
|
||||
#define P_GPIO_ADC_RST_N (1 << 6)
|
||||
#define P_GPIO_MCLK_FSEL (1 << 7) /* Select frequency on Phaselink clock. 0 = 24.576MHz for 48k, 1 = 22.5792MHz for 44.1k.*/
|
||||
|
||||
|
||||
out port p_gpio = on tile[0]:XS1_PORT_8C;
|
||||
|
||||
void AudioHwConfig(unsigned samFreq, unsigned mClk, unsigned dsdMode,
|
||||
unsigned sampRes_DAC, unsigned sampRes_ADC)
|
||||
{
|
||||
unsigned char gpioVal = 0;
|
||||
|
||||
/* Set master clock select appropriately and put ADC and DAC into reset */
|
||||
if (mClk == MCLK_441)
|
||||
{
|
||||
gpioVal = P_GPIO_USB_SEL0 | P_GPIO_USB_SEL1;
|
||||
}
|
||||
else
|
||||
{
|
||||
gpioVal = P_GPIO_USB_SEL0 | P_GPIO_USB_SEL1 | P_GPIO_MCLK_FSEL;
|
||||
}
|
||||
|
||||
/* Note, DAC and ADC held in reset */
|
||||
p_gpio <: gpioVal;
|
||||
|
||||
/* Allow MCLK to settle */
|
||||
delay_microseconds(20000);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void AudioHwInit()
|
||||
{
|
||||
/* Set USB Mux to micro-b */
|
||||
/* ADC and DAC in reset */
|
||||
p_gpio <: P_GPIO_USB_SEL0 | P_GPIO_USB_SEL1;
|
||||
}
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Network xmlns="http://www.xmos.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xmos.com http://www.xmos.com" ManuallySpecifiedRouting="true">
|
||||
<Type>Board</Type>
|
||||
<Name>XS2 MC Audio</Name>
|
||||
<Declarations>
|
||||
<Declaration>tileref tile[2]</Declaration>
|
||||
<Declaration>tileref usb_tile</Declaration>
|
||||
</Declarations>
|
||||
<Packages>
|
||||
<Package id="0" Type="XS2-UnA-512-FB236">
|
||||
<Nodes>
|
||||
<Node Id="0" InPackageId="0" Type="XS2-L16A-512" Oscillator="24MHz" SystemFrequency="500MHz" referencefrequency="100MHz">
|
||||
<Boot>
|
||||
<Source Location="SPI:bootFlash"/>
|
||||
</Boot>
|
||||
<Tile Number="0" Reference="tile[0]">
|
||||
<Port Location="XS1_PORT_1B" Name="PORT_SQI_CS"/>
|
||||
<Port Location="XS1_PORT_1C" Name="PORT_SQI_SCLK"/>
|
||||
<Port Location="XS1_PORT_4B" Name="PORT_SQI_SIO"/>
|
||||
|
||||
<!-- Audio Ports -->
|
||||
<Port Location="XS1_PORT_1A" Name="PORT_PLL_REF"/>
|
||||
<Port Location="XS1_PORT_1F" Name="PORT_MCLK_IN"/>
|
||||
<Port Location="XS1_PORT_1G" Name="PORT_I2S_LRCLK"/>
|
||||
<Port Location="XS1_PORT_1H" Name="PORT_I2S_BCLK"/>
|
||||
<Port Location="XS1_PORT_1M" Name="PORT_I2S_DAC0"/>
|
||||
<port Location="XS1_PORT_1N" Name="PORT_I2S_DAC1"/>
|
||||
<port Location="XS1_PORT_1O" Name="PORT_I2S_DAC2"/>
|
||||
<port Location="XS1_PORT_1P" Name="PORT_I2S_DAC3"/>
|
||||
<Port Location="XS1_PORT_1I" Name="PORT_I2S_ADC0"/>
|
||||
<Port Location="XS1_PORT_1J" Name="PORT_I2S_ADC1"/>
|
||||
<Port Location="XS1_PORT_1K" Name="PORT_I2S_ADC2"/>
|
||||
<Port Location="XS1_PORT_1L" Name="PORT_I2S_ADC3"/>
|
||||
<Port Location="XS1_PORT_4A" Name="PORT_I2C"/>
|
||||
<Port Location="XS1_PORT_1M" Name="PORT_DSD_DAC0"/>
|
||||
<port Location="XS1_PORT_1N" Name="PORT_DSD_DAC1"/>
|
||||
<Port Location="XS1_PORT_1G" Name="PORT_DSD_CLK"/>
|
||||
<Port Location="XS1_PORT_1E" Name="PORT_ADAT_OUT"/>--> <!-- D: COAX E: OPT -->
|
||||
<Port Location="XS1_PORT_1D" Name="PORT_SPDIF_OUT"/>--> <!-- D: COAX E: OPT -->
|
||||
</Tile>
|
||||
<Tile Number="1" Reference="tile[1]">
|
||||
<!-- USB intended to run on this tile -->
|
||||
<!-- Ports for USB feedback calculation -->
|
||||
<Port Location="XS1_PORT_16B" Name="PORT_MCLK_COUNT"/>
|
||||
<Port Location="XS1_PORT_1L" Name="PORT_MCLK_IN_USB"/>
|
||||
<!-- Audio Ports -->
|
||||
<Port Location="XS1_PORT_1M" Name="PORT_MIDI_IN"/>
|
||||
<Port Location="XS1_PORT_1N" Name="PORT_MIDI_OUT"/>
|
||||
<Port Location="XS1_PORT_1O" Name="PORT_ADAT_IN"/>--> <!-- P: COAX O: OPT -->
|
||||
<Port Location="XS1_PORT_1P" Name="PORT_SPDIF_IN"/>--> <!-- P: COAX O: OPT -->
|
||||
</Tile>
|
||||
</Node>
|
||||
<Node Id="1" InPackageId="1" Type="periph:XS1-SU" Reference="usb_tile" Oscillator="24MHz">
|
||||
</Node>
|
||||
</Nodes>
|
||||
<Links>
|
||||
<Link Encoding="5wire">
|
||||
<LinkEndpoint NodeId="0" Link="8" Delays="52clk,52clk"/>
|
||||
<LinkEndpoint NodeId="1" Link="XL0" Delays="1clk,1clk"/>
|
||||
</Link>
|
||||
</Links>
|
||||
</Package>
|
||||
</Packages>
|
||||
<Nodes>
|
||||
<Node Id="2" Type="device:" RoutingId="0x8000">
|
||||
<Service Id="0" Proto="xscope_host_data(chanend c);">
|
||||
<Chanend Identifier="c" end="3"/>
|
||||
</Service>
|
||||
</Node>
|
||||
</Nodes>
|
||||
<Links>
|
||||
<Link Encoding="2wire" Delays="4,4" Flags="XSCOPE">
|
||||
<LinkEndpoint NodeId="0" Link="XL0"/>
|
||||
<LinkEndpoint NodeId="2" Chanend="1"/>
|
||||
</Link>
|
||||
</Links>
|
||||
<ExternalDevices>
|
||||
<Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="S25FL116K" PageSize="256" SectorSize="4096" NumPages="8192">
|
||||
<Attribute Name="PORT_SQI_CS" Value="PORT_SQI_CS"/>
|
||||
<Attribute Name="PORT_SQI_SCLK" Value="PORT_SQI_SCLK"/>
|
||||
<Attribute Name="PORT_SQI_SIO" Value="PORT_SQI_SIO"/>
|
||||
</Device>
|
||||
</ExternalDevices>
|
||||
<JTAGChain>
|
||||
<JTAGDevice NodeId="0"/>
|
||||
<JTAGDevice NodeId="1"/>
|
||||
</JTAGChain>
|
||||
</Network>
|
||||
@@ -1,32 +0,0 @@
|
||||
// Copyright 2017-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#ifndef _XUA_CONF_H_
|
||||
#define _XUA_CONF_H_
|
||||
|
||||
#define NUM_USB_CHAN_OUT 2
|
||||
#define NUM_USB_CHAN_IN 0
|
||||
#define I2S_CHANS_DAC 0
|
||||
#define I2S_CHANS_ADC 0
|
||||
#define MCLK_441 (512 * 44100)
|
||||
#define MCLK_48 (512 * 48000)
|
||||
#define MIN_FREQ 48000
|
||||
#define MAX_FREQ 48000
|
||||
|
||||
#define EXCLUDE_USB_AUDIO_MAIN
|
||||
|
||||
#define XUA_SPDIF_TX_EN 1
|
||||
#define SPDIF_TX_INDEX 0
|
||||
#define VENDOR_STR "XMOS"
|
||||
#define VENDOR_ID 0x20B1
|
||||
#define PRODUCT_STR_A2 "XUA SPDIF Example"
|
||||
#define PRODUCT_STR_A1 "XUA SPDIF Example"
|
||||
#define PID_AUDIO_1 1
|
||||
#define PID_AUDIO_2 2
|
||||
#define AUDIO_CLASS 2
|
||||
#define AUDIO_CLASS_FALLBACK 0
|
||||
#define BCD_DEVICE 0x1234
|
||||
#define XUA_DFU_EN 0
|
||||
#define MIC_DUAL_ENABLED 0 // Use multi-threaded design
|
||||
|
||||
#endif
|
||||
@@ -1,8 +0,0 @@
|
||||
// Copyright 2017-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#include "xua_conf.h"
|
||||
|
||||
/* TODO */
|
||||
#define XUD_UAC_NUM_USB_CHAN_OUT NUM_USB_CHAN_OUT
|
||||
#define XUD_UAC_NUM_USB_CHAN_IN NUM_USB_CHAN_IN
|
||||
@@ -1,84 +0,0 @@
|
||||
*******************************
|
||||
XMOS PUBLIC LICENCE: Version 1
|
||||
*******************************
|
||||
|
||||
Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software.
|
||||
|
||||
**1. Definitions**
|
||||
|
||||
**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software.
|
||||
|
||||
**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code.
|
||||
|
||||
**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives.
|
||||
|
||||
**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof.
|
||||
|
||||
**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code.
|
||||
|
||||
**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence.
|
||||
|
||||
This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement.
|
||||
|
||||
|
||||
**2. Licence**
|
||||
|
||||
**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following:
|
||||
|
||||
2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software:
|
||||
|
||||
2.1.1 for personal or academic, non-commercial purposes; or
|
||||
|
||||
2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2):
|
||||
|
||||
(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and
|
||||
|
||||
(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms).
|
||||
|
||||
The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement.
|
||||
|
||||
2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives:
|
||||
|
||||
2.2.1 for personal or academic, non-commercial purposes; or
|
||||
|
||||
2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2):
|
||||
|
||||
(a) you must comply with the terms of clause 2.1 with respect to the Derivatives;
|
||||
|
||||
(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and
|
||||
|
||||
(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS.
|
||||
|
||||
Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below.
|
||||
|
||||
2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code.
|
||||
|
||||
**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above.
|
||||
|
||||
**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives.
|
||||
|
||||
**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS.
|
||||
|
||||
**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms.
|
||||
|
||||
**7. IPR and Ownership**
|
||||
Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com**
|
||||
|
||||
Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein).
|
||||
Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit.
|
||||
|
||||
**8. Termination**
|
||||
|
||||
8.1 This Licence will automatically terminate immediately, without notice to you, if:
|
||||
|
||||
(a) you fail to comply with the terms of this Licence; and/or
|
||||
|
||||
(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or
|
||||
|
||||
(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part.
|
||||
|
||||
**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use.
|
||||
|
||||
**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50.
|
||||
|
||||
**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply.
|
||||
@@ -1,22 +0,0 @@
|
||||
APP_NAME = app_xua_simple
|
||||
|
||||
TARGET = mic_array_ref.xn
|
||||
|
||||
# The flags passed to xcc when building the application
|
||||
XCC_FLAGS = -fcomment-asm -Xmapper --map -Xmapper MAPFILE -O3 -report -save-temps \
|
||||
-g -Wno-unused-function -Wno-timing -DXUD_SERIES_SUPPORT=XUD_X200_SERIES \
|
||||
-DXUD_CORE_CLOCK=600 -DUSB_TILE=tile[1] -DSDA_HIGH=2 -DSCL_HIGH=1 -fxscope \
|
||||
-DUAC_FORCE_FEEDBACK_EP=0
|
||||
|
||||
# The USED_MODULES variable lists other module used by the application. These
|
||||
# modules will extend the SOURCE_DIRS, INCLUDE_DIRS and LIB_DIRS variables.
|
||||
# Modules are expected to be in the directory above the BASE_DIR directory.
|
||||
USED_MODULES = lib_xua lib_xud lib_mic_array
|
||||
|
||||
#=============================================================================
|
||||
# The following part of the Makefile includes the common build infrastructure
|
||||
# for compiling XMOS applications. You should not need to edit below here.
|
||||
|
||||
XMOS_MAKE_PATH ?= ../..
|
||||
include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
|
||||
Using lib_xua with lib_mic_array
|
||||
================================
|
||||
|
||||
Summary
|
||||
-------
|
||||
|
||||
This applicaition note describes how to use ``lib_mic_array`` in conjunction with ``lib_xua``
|
||||
to implement a USB Audio device with the ability to record from multiple PDM microphones.
|
||||
|
||||
Software dependencies
|
||||
.....................
|
||||
|
||||
For a list of direct dependencies, look for USED_MODULES in the Makefile.
|
||||
|
||||
Required hardware
|
||||
.................
|
||||
|
||||
The example code provided with the application has been implemented
|
||||
and tested on the xCORE-200 Array Microphone board.
|
||||
|
||||
Prerequisites
|
||||
.............
|
||||
|
||||
* This document assumes familiarity with the XMOS xCORE architecture,
|
||||
the XMOS tool chain and the xC language. Documentation related to these
|
||||
aspects which are not specific to this application note are linked to in
|
||||
the references appendix.
|
||||
|
||||
* For a description of XMOS related terms found in this document
|
||||
please see the XMOS Glossary [#]_.
|
||||
|
||||
.. [#] http://www.xmos.com/published/glossary
|
||||
|
||||
|
||||
@@ -1,315 +0,0 @@
|
||||
.. include:: ../../README.rst
|
||||
|
||||
|newpage|
|
||||
|
||||
Overview
|
||||
--------
|
||||
|
||||
Introduction
|
||||
............
|
||||
|
||||
The XMOS USB Audio (XUA) library provides an implementation of USB Audio Class versions 1.0 and 2.0.
|
||||
|
||||
This application note demonstrates the implementation of a basic USB Audio Device with
|
||||
record functionality from PDM microphones on the xCORE-200 Array Microphone board.
|
||||
|
||||
Core PDM microphone functionality is contained in` ``lib_mic_array``. This library includes both the physical
|
||||
interfacing to the PDM microphones as well as efficient decimation to user selectable output
|
||||
sample rates - essentially providing PDM to PCM conversion.
|
||||
|
||||
To reduce complexity this application note does not enable any other audio interfaces other than recording
|
||||
from PDM microphones (i.e. no I2S and the on board DAC is not configured.
|
||||
|
||||
Readers are encouraged to read application note AN00246 in conjunction with this application note.
|
||||
|
||||
|
||||
The Makefile
|
||||
------------
|
||||
|
||||
To start using ``lib_xua``, you need to add ``lib_xua`` to the Makefile. ``lib_mic_array`` should also be
|
||||
added for this application example::
|
||||
|
||||
USED_MODULES = .. lib_xua lib_mic_array ...
|
||||
|
||||
This demo also uses the XMOS USB Device library (``lib_xud``) for low-level USB connectivity.
|
||||
The Makefile therefore also includes this lib::
|
||||
|
||||
USED_MODULES = .. lib_xud ..
|
||||
|
||||
``lib_xud`` library requires some flags for correct operation. Firstly the
|
||||
tile on which ``lib_xud`` will be executed, for example::
|
||||
|
||||
XCC_FLAGS = .. -DUSB_TILE=tile[1] ..
|
||||
|
||||
Secondly, the architecture of the target device, for example::
|
||||
|
||||
XCC_FLAGS = .. -DXUD_SERIES_SUPPORT=XUD_X200_SERIES ..
|
||||
|
||||
Includes
|
||||
--------
|
||||
|
||||
This application requires the system header files that contains XMOS xCORE specific
|
||||
defines for declaring and initialising hardware:
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: include <xs1.h>
|
||||
:end-before: include "xua.h"
|
||||
|
||||
The XUA and XUD library functions are defined in header files ``xua.h`` and ``xud_device.h`` respectively. These headers must
|
||||
be included in the code in order to use these libraries.
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: include "xua.h"
|
||||
:end-on: include "xud_device.h"
|
||||
|
||||
The application uses PDM interfacing and decimation code from ``lib_mic_array``. This header
|
||||
must be included in the code.
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: /* From lib_mic
|
||||
:end-on: include "mic_array.h"
|
||||
|
||||
Declarations
|
||||
------------
|
||||
|
||||
Allocating hardware resources for lib_xua
|
||||
.........................................
|
||||
|
||||
A minimal implementation of a USB Audio device using ``lib_xua``, without I2S functionality,
|
||||
requires the follow I/O pins:
|
||||
|
||||
- Audio Master clock (from clock source to xCORE)
|
||||
|
||||
On an xCORE the pins are controlled by ``ports``. The application therefore declares a
|
||||
port for the master clock input signal.
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: /* Lib_xua port declaration
|
||||
:end-on: in port p_mclk_in
|
||||
|
||||
``lib_xua`` also requires two ports for internally calculating USB feedback. Please refer to
|
||||
the ``lib_xua`` library documentation for further details. In this example ``XUA_Buffer()`` and ``XUA_AudioHub()``
|
||||
reside on the same tile and can therefore make use of the same master-clock port.
|
||||
|
||||
These ports are declared as follows:
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: /* Resources for USB feedback
|
||||
:end-on: in port p_for
|
||||
|
||||
In addition to ``port`` resources a single clock-block resource is also required:
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: /* Clock-block declarations
|
||||
:end-on: clock clk_audio_mclk
|
||||
|
||||
Again, for the same reasoning as the master-clock ports, only one master-clock clock-blocks is required.
|
||||
|
||||
|
||||
Allocating hardware resources for lib_mic_array
|
||||
...............................................
|
||||
|
||||
``lib_mic_array`` requires a single 8-bit port for PDM data from up to 8 microphones. This port must be declared
|
||||
as 32-bit buffered:
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: in buffered port:32 p_pdm_mics
|
||||
:end-before: clock clk_pdm
|
||||
|
||||
The microphones must be clocked by an audio related clock - typically 3.072MHz.
|
||||
|
||||
The xCORE-200 Array Microphone Board expects the xCORE to divide down the audio master clock input (24.576MHz)
|
||||
and output the result to the microphones.
|
||||
|
||||
Two ports for this purpose are declared as follows:
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: /* Lib_mic_array declarations
|
||||
:end-before: in buffered
|
||||
|
||||
|
||||
Please see the ``lib_mic_array`` library documentation for full details.
|
||||
|
||||
|
||||
Other declarations
|
||||
..................
|
||||
|
||||
``lib_xua`` currently requires the manual declaration of tables for the endpoint types for
|
||||
``lib_xud`` and the calling the main XUD function in a par (``XUD_Main()``).
|
||||
|
||||
For a simple application the following endpoints are required:
|
||||
|
||||
- ``Control`` endpoint zero
|
||||
- ``Isochonous`` endpoint for each direction for audio data to/from the USB host
|
||||
|
||||
These are declared as follows:
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: /* Endpoint type tables
|
||||
:end-on: XUD_EpType epTypeTableIn
|
||||
|
||||
Configuring lib_xua
|
||||
-------------------
|
||||
|
||||
``lib_xua`` must be configured to enable support for PDM microphones.
|
||||
|
||||
``lib_xua`` has many parameters than can be configured at build time, some examples include:
|
||||
|
||||
- Supported sample-rates
|
||||
- Channel counts
|
||||
- Audio Class version
|
||||
- Product/Vendor ID's
|
||||
- Various product strings
|
||||
- Master clock frequency
|
||||
|
||||
To enable PDM microphone support ``XUA_NUM_PDM_MICS`` must be set to a non-zero value. Setting this will cause the ``XUA_AudioHub``
|
||||
task to forward sample rate information and receive samples from the relevant microphone related tasks.
|
||||
|
||||
These parameters are set via defines in an optional ``xua_conf.h`` header file. For this simple application the
|
||||
complete contents of this file are as follows:
|
||||
|
||||
.. literalinclude:: xua_conf.h
|
||||
:start-on: // Copyright
|
||||
:end-on: #endif
|
||||
|
||||
The application main() function
|
||||
-------------------------------
|
||||
|
||||
The ``main()`` function sets up and runs the tasks in the application.
|
||||
|
||||
Channel declarations
|
||||
....................
|
||||
|
||||
Various channels are required in order to allow the required tasks to communicate.
|
||||
These must first be declared:
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: /* Channels for lib_xud
|
||||
:end-on: chan c_mic_pcm
|
||||
|
||||
Standard ``lib_xua`` tasks
|
||||
..........................
|
||||
|
||||
The rest of the ``main()`` function starts all of the tasks in parallel
|
||||
using the xC ``par`` construct.
|
||||
|
||||
Firstly the standard ``lib_xua`` tasks are run on tile 1:
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: par
|
||||
:end-before: on tile[0]
|
||||
|
||||
This code starts the low-level USB task, an Endpoint 0 task, an Audio buffering task and a task to handle
|
||||
the audio I/O (``XUA_AudioHub``).
|
||||
|
||||
Note, since there is no I2S functionality in this example the ``XUA_AudioHub`` task essentially just receives
|
||||
samples from the PDM buffer task and forwards samples to the ``XUA_Buffer`` task for forwarding to the USB host.
|
||||
|
||||
Microphone related tasks
|
||||
........................
|
||||
|
||||
Microphone related tasks are executed on tile 0 as follows:
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:start-on: Microphone related tasks
|
||||
:end-before: return 0
|
||||
|
||||
Two functions from ``lib_mic_array`` are used - a PDM receiver task (``mic_array_pdm_rx()``) and a decimation task (``mic_array_decimate_to_pcm_4ch()``).
|
||||
|
||||
Each call to ``mic_array_decimate_to_pcm_4ch()`` can handle the decimation of up to 4 microphone signals. Since the xCORE-200 Array microphone
|
||||
board is equipped with seven microphones two instances of this task are run.
|
||||
|
||||
The ``mic_array_pdm_rx()`` task expects the PDM microphone port to be clocked from the PDM clock.
|
||||
|
||||
|
||||
|appendix|
|
||||
|newpage|
|
||||
|
||||
Demo Hardware Setup
|
||||
-------------------
|
||||
|
||||
To run the demo, connect a USB cable to power the xCORE-200 MC Audio board
|
||||
and plug the xTAG to the board and connect the xTAG USB cable to your
|
||||
development machine.
|
||||
|
||||
.. figure:: images/hw_setup.*
|
||||
:width: 80%
|
||||
|
||||
Hardware setup
|
||||
|
||||
|newpage|
|
||||
|
||||
Launching the demo application
|
||||
------------------------------
|
||||
|
||||
Once the demo example has been built either from the command line using xmake or
|
||||
via the build mechanism of xTIMEcomposer studio it can be executed on the xCORE-200
|
||||
MC Audio board.
|
||||
|
||||
Once built there will be a ``bin/`` directory within the project which contains
|
||||
the binary for the xCORE device. The xCORE binary has a XMOS standard .xe extension.
|
||||
|
||||
Launching from the command line
|
||||
...............................
|
||||
|
||||
From the command line you use the ``xrun`` tool to download and run the code
|
||||
on the xCORE device::
|
||||
|
||||
xrun --xscope bin/app_xua_simple.xe
|
||||
|
||||
Once this command has executed the application will be running on the
|
||||
xCORE-200 MC Audio Board
|
||||
|
||||
Launching from xTIMEcomposer Studio
|
||||
...................................
|
||||
|
||||
From xTIMEcomposer Studio use the run mechanism to download code to xCORE device.
|
||||
Select the xCORE binary from the ``bin/`` directory, right click and go to Run
|
||||
Configurations. Double click on xCORE application to create a new run configuration,
|
||||
enable the xSCOPE I/O mode in the dialog box and then
|
||||
select Run.
|
||||
|
||||
Once this command has executed the application will be running on the
|
||||
xCORE-200 MC Audio board.
|
||||
|
||||
Running the application
|
||||
.......................
|
||||
|
||||
Once running the device will be detected as a USB Audio device - note, Windows operating
|
||||
systems may require a third party driver for correct operation
|
||||
|
||||
|newpage|
|
||||
|
||||
References
|
||||
----------
|
||||
|
||||
.. nopoints::
|
||||
|
||||
* XMOS Tools User Guide
|
||||
|
||||
http://www.xmos.com/published/xtimecomposer-user-guide
|
||||
|
||||
* XMOS xCORE Programming Guide
|
||||
|
||||
http://www.xmos.com/published/xmos-programming-guide
|
||||
|
||||
* XMOS lib_xua Library
|
||||
|
||||
http://www.xmos.com/support/libraries/lib_xua
|
||||
|
||||
* XMOS lib_xud Library
|
||||
|
||||
http://www.xmos.com/support/libraries/lib_xud
|
||||
|
||||
|newpage|
|
||||
|
||||
Full source code listing
|
||||
------------------------
|
||||
|
||||
Source code for main.xc
|
||||
.......................
|
||||
|
||||
.. literalinclude:: app_xua_simple.xc
|
||||
:largelisting:
|
||||
|
||||
|newpage|
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 75 KiB |
@@ -1,3 +0,0 @@
|
||||
XMOSNEWSTYLE=2
|
||||
SOURCE_INCLUDE_DIRS=../../src
|
||||
SPHINX_MASTER_DOC=AN00248_xua_example_pdm_mics
|
||||
@@ -1,121 +0,0 @@
|
||||
// Copyright 2017-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
/* A very simple *example* of a USB audio application (and as such is un-verified for production)
|
||||
*
|
||||
* It uses the main blocks from the lib_xua with the addition of PDM mic support using lib_mic_array
|
||||
*
|
||||
* - No DFU
|
||||
*
|
||||
*/
|
||||
|
||||
#include <xs1.h>
|
||||
#include <platform.h>
|
||||
|
||||
#include "xua.h"
|
||||
#include "xud_device.h"
|
||||
|
||||
/* From lib_mic_array */
|
||||
#include "mic_array.h"
|
||||
|
||||
/* Lib_mic_array declarations. Note, the defines derived from the xn file */
|
||||
in port p_pdm_clk = PORT_PDM_CLK; /* Port for PDM mic clock */
|
||||
in port p_pdm_mclk = PORT_PDM_MCLK; /* Master clock for PDM mics */
|
||||
|
||||
in buffered port:32 p_pdm_mics = PORT_PDM_DATA; /* Port for PDM mic data */
|
||||
|
||||
clock clk_pdm = on tile[0]: XS1_CLKBLK_1; /* Clock-block for PDM mics */
|
||||
|
||||
|
||||
/* Lib_xua port declarations. Note, the defines come from the xn file */
|
||||
in port p_mclk_in = PORT_MCLK_IN; /* Master clock for the audio IO tile */
|
||||
|
||||
/* Resources for USB feedback */
|
||||
in port p_for_mclk_count = PORT_MCLK_COUNT; /* Extra port for counting master clock ticks */
|
||||
|
||||
/* Clock-block declarations */
|
||||
clock clk_audio_mclk = on tile[1]: XS1_CLKBLK_1; /* Master clock */
|
||||
|
||||
/* Endpoint type tables - informs XUD what the transfer types for each Endpoint in use and also
|
||||
* if the endpoint wishes to be informed of USB bus resets */
|
||||
XUD_EpType epTypeTableOut[] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE, XUD_EPTYPE_ISO};
|
||||
XUD_EpType epTypeTableIn[] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE, XUD_EPTYPE_ISO};
|
||||
|
||||
int main()
|
||||
{
|
||||
/* Channels for lib_xud */
|
||||
chan c_ep_out[2];
|
||||
chan c_ep_in[2];
|
||||
|
||||
/* Channel for communicating SOF notifications from XUD to the Buffering cores */
|
||||
chan c_sof;
|
||||
|
||||
/* Channel for audio data between buffering cores and AudioHub/IO core */
|
||||
chan c_aud;
|
||||
|
||||
/* Channel for communicating control messages from EP0 to the rest of the device (via the buffering cores) */
|
||||
chan c_aud_ctl;
|
||||
|
||||
/* Array of channels for communication between PDM mic decimator task(s) and the XUA mic buffer task */
|
||||
streaming chan c_ds_output[2];
|
||||
|
||||
/* Channel for communcation between XUA_AudioHub() and the XUA mic buffer task */
|
||||
chan c_mic_pcm;
|
||||
|
||||
par
|
||||
{
|
||||
/* Low level USB device layer core */
|
||||
on tile[1]: XUD_Main(c_ep_out, 2, c_ep_in, 2, c_sof, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS);
|
||||
|
||||
/* Endpoint 0 core from lib_xua */
|
||||
/* Note, since we are not using many features we pass in null for quite a few params.. */
|
||||
on tile[1]: XUA_Endpoint0(c_ep_out[0], c_ep_in[0], c_aud_ctl, null, null, null, null);
|
||||
|
||||
on tile[1]:
|
||||
{
|
||||
/* Connect master-clock clock-block to clock-block pin */
|
||||
set_clock_src(clk_audio_mclk, p_mclk_in); /* Clock clock-block from mclk pin */
|
||||
set_port_clock(p_for_mclk_count, clk_audio_mclk); /* Clock the "count" port from the clock block */
|
||||
/* Note, AudioHub() will start the clock */
|
||||
|
||||
par
|
||||
{
|
||||
/* Buffering task - handles audio data to/from EP's and gives/gets data to/from the audio I/O core */
|
||||
/* Note, this spawns two cores */
|
||||
XUA_Buffer(c_ep_out[1], c_ep_in[1], c_sof, c_aud_ctl, p_for_mclk_count, c_aud);
|
||||
|
||||
/* AudioHub/IO core does most of the audio IO i.e. I2S (also serves as a hub for all audio) */
|
||||
/* Note, since we are not using I2S we pass in null for LR and Bit clock ports and the I2S dataline ports */
|
||||
XUA_AudioHub(c_aud, clk_audio_mclk, null, p_mclk_in, null, null, null, null, c_mic_pcm);
|
||||
}
|
||||
}
|
||||
|
||||
/* Microphone related tasks */
|
||||
on tile[0]:
|
||||
{
|
||||
streaming chan c_4x_pdm_mic_0;
|
||||
streaming chan c_4x_pdm_mic_1;
|
||||
|
||||
configure_clock_src_divide(clk_pdm, p_pdm_mclk, 4); /* Master clock to PDM clock divide */
|
||||
configure_port_clock_output(p_pdm_clk, clk_pdm);
|
||||
configure_in_port(p_pdm_mics, clk_pdm);
|
||||
start_clock(clk_pdm);
|
||||
|
||||
par
|
||||
{
|
||||
/* PDM receive I/O task */
|
||||
mic_array_pdm_rx(p_pdm_mics, c_4x_pdm_mic_0, c_4x_pdm_mic_1);
|
||||
|
||||
/* Run two decimator tasks for 8 mics */
|
||||
mic_array_decimate_to_pcm_4ch(c_4x_pdm_mic_0, c_ds_output[0], MIC_ARRAY_NO_INTERNAL_CHANS);
|
||||
mic_array_decimate_to_pcm_4ch(c_4x_pdm_mic_1, c_ds_output[1], MIC_ARRAY_NO_INTERNAL_CHANS);
|
||||
|
||||
XUA_PdmBuffer(c_ds_output, c_mic_pcm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
// Copyright 2017-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#include <xs1.h>
|
||||
#include <assert.h>
|
||||
#include <platform.h>
|
||||
|
||||
#include "xua.h"
|
||||
|
||||
/* 0: DAC reset */
|
||||
/* 1: Ethernet Phy reset */
|
||||
on tile[1] : out port p_gpio = XS1_PORT_4F;
|
||||
|
||||
void AudioHwInit()
|
||||
{
|
||||
/* DAC in reset */
|
||||
p_gpio <: 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Configures the external audio hardware for the required sample frequency */
|
||||
void AudioHwConfig(unsigned samFreq, unsigned mClk, unsigned dsdMode,
|
||||
unsigned sampRes_DAC, unsigned sampRes_ADC)
|
||||
{
|
||||
/* Note, without any config the Cirrus 2100 will output it's 24.576MHz ref clock
|
||||
to the Aux output - which we will use for mclk */
|
||||
|
||||
return;
|
||||
}
|
||||
//:
|
||||
@@ -1,168 +0,0 @@
|
||||
// Copyright 2021-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#ifndef __hid_report_descriptor_h__
|
||||
#define __hid_report_descriptor_h__
|
||||
|
||||
#include "xua_hid_report.h"
|
||||
|
||||
#if 0
|
||||
/* Existing static report descriptor kept for reference */
|
||||
unsigned char hidReportDescriptor[] =
|
||||
{
|
||||
0x05, 0x0c, /* Usage Page (Consumer Device) */
|
||||
0x09, 0x01, /* Usage (Consumer Control) */
|
||||
0xa1, 0x01, /* Collection (Application) */
|
||||
0x15, 0x00, /* Logical Minimum (0) */
|
||||
0x25, 0x01, /* Logical Maximum (1) */
|
||||
0x09, 0xb0, /* Usage (Play) */
|
||||
0x09, 0xb5, /* Usage (Scan Next Track) */
|
||||
0x09, 0xb6, /* Usage (Scan Previous Track) */
|
||||
0x09, 0xe9, /* Usage (Volume Up) */
|
||||
0x09, 0xea, /* Usage (Volume Down) */
|
||||
0x09, 0xe2, /* Usage (Mute) */
|
||||
0x75, 0x01, /* Report Size (1) */
|
||||
0x95, 0x06, /* Report Count (6) */
|
||||
0x81, 0x02, /* Input (Data, Var, Abs) */
|
||||
0x95, 0x02, /* Report Count (2) */
|
||||
0x81, 0x01, /* Input (Cnst, Ary, Abs) */
|
||||
0xc0 /* End collection */
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define non-configurable items in the HID Report descriptor.
|
||||
*/
|
||||
static const USB_HID_Short_Item_t hidCollectionApplication = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_COLLECTION),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidCollectionEnd = {
|
||||
.header = HID_REPORT_SET_HEADER(0, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_END_COLLECTION),
|
||||
.data = { 0x00, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidInputConstArray = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_INPUT),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidInputDataVar = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_INPUT),
|
||||
.data = { 0x02, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidLogicalMaximum0 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MAXIMUM),
|
||||
.data = { 0x00, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidLogicalMaximum1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MAXIMUM),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidLogicalMinimum0 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MINIMUM),
|
||||
.data = { 0x00, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidReportCount2 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x02, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportCount6 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x06, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportSize1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_SIZE),
|
||||
.data = { 0x01, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidUsageConsumerControl = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.data = { 0x01, 0x00 } };
|
||||
|
||||
/*
|
||||
* Define the HID Report Descriptor Item, Usage Page, Report ID and length for each HID Report
|
||||
* For internal purposes, a report element with ID of 0 must be included if report IDs are not being used.
|
||||
*/
|
||||
static const USB_HID_Report_Element_t hidReportPageConsumer = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_USAGE_PAGE),
|
||||
.item.data = { USB_HID_USAGE_PAGE_ID_CONSUMER, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( 0, 2, 0, 0 )
|
||||
};
|
||||
|
||||
/*
|
||||
* Define configurable items in the HID Report descriptor.
|
||||
*/
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit5 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xE2, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 5)
|
||||
}; // Mute
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit4 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xEA, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 4)
|
||||
}; // Vol-
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit3 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xE9, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 3)
|
||||
}; // Vol+
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit2 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB6, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 2)
|
||||
}; // Scan Prev
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit1 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB5, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 1)
|
||||
}; // Scan Next
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit0 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB0, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC(0, 0, 0, 0)
|
||||
}; // Play
|
||||
|
||||
/*
|
||||
* List the configurable elements in the HID Report descriptor.
|
||||
*/
|
||||
static USB_HID_Report_Element_t* const hidConfigurableElements[] = {
|
||||
&hidUsageByte0Bit0,
|
||||
&hidUsageByte0Bit1,
|
||||
&hidUsageByte0Bit2,
|
||||
&hidUsageByte0Bit3,
|
||||
&hidUsageByte0Bit4,
|
||||
&hidUsageByte0Bit5
|
||||
};
|
||||
|
||||
/*
|
||||
* List HID Reports, one per Report ID. This should be a usage page item with the relevant
|
||||
* If not using report IDs - still have one with report ID 0
|
||||
*/
|
||||
static const USB_HID_Report_Element_t* const hidReports[] = {
|
||||
&hidReportPageConsumer
|
||||
};
|
||||
|
||||
/*
|
||||
* List all items in the HID Report descriptor.
|
||||
*/
|
||||
static const USB_HID_Short_Item_t* const hidReportDescriptorItems[] = {
|
||||
&(hidReportPageConsumer.item),
|
||||
&hidUsageConsumerControl,
|
||||
&hidCollectionApplication,
|
||||
&hidLogicalMinimum0,
|
||||
&hidLogicalMaximum1,
|
||||
&(hidUsageByte0Bit0.item),
|
||||
&(hidUsageByte0Bit1.item),
|
||||
&(hidUsageByte0Bit2.item),
|
||||
&(hidUsageByte0Bit3.item),
|
||||
&(hidUsageByte0Bit4.item),
|
||||
&(hidUsageByte0Bit5.item),
|
||||
&hidReportSize1,
|
||||
&hidReportCount6,
|
||||
&hidInputDataVar,
|
||||
&hidLogicalMaximum0,
|
||||
&hidReportCount2,
|
||||
&hidInputConstArray,
|
||||
&hidCollectionEnd
|
||||
};
|
||||
|
||||
/*
|
||||
* Define the number of HID Reports
|
||||
* Due to XC not supporting designated initializers, this constant has a hard-coded value.
|
||||
* It must equal ( sizeof hidReports / sizeof ( USB_HID_Report_Element_t* ))
|
||||
*/
|
||||
#define HID_REPORT_COUNT ( 1 )
|
||||
|
||||
#endif // __hid_report_descriptor_h__
|
||||
@@ -1,94 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Network xmlns="http://www.xmos.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xmos.com http://www.xmos.com" ManuallySpecifiedRouting="true">
|
||||
<Type>Board</Type>
|
||||
<Name>XS2 MC Audio</Name>
|
||||
<Declarations>
|
||||
<Declaration>tileref tile[2]</Declaration>
|
||||
<Declaration>tileref usb_tile</Declaration>
|
||||
</Declarations>
|
||||
<Packages>
|
||||
<Package id="0" Type="XS2-UnA-512-FB236">
|
||||
<Nodes>
|
||||
<Node Id="0" InPackageId="0" Type="XS2-L16A-512" Oscillator="24MHz" SystemFrequency="500MHz" referencefrequency="100MHz">
|
||||
<Boot>
|
||||
<Source Location="SPI:bootFlash"/>
|
||||
</Boot>
|
||||
<Tile Number="0" Reference="tile[0]">
|
||||
<Port Location="XS1_PORT_1B" Name="PORT_SQI_CS"/>
|
||||
<Port Location="XS1_PORT_1C" Name="PORT_SQI_SCLK"/>
|
||||
<Port Location="XS1_PORT_4B" Name="PORT_SQI_SIO"/>
|
||||
|
||||
<!-- Mic related ports -->
|
||||
<Port Location="XS1_PORT_1E" Name="PORT_PDM_CLK"/>
|
||||
<Port Location="XS1_PORT_8B" Name="PORT_PDM_DATA"/>
|
||||
<Port Location="XS1_PORT_1F" Name="PORT_PDM_MCLK"/>
|
||||
|
||||
<!-- LED ports -->
|
||||
<Port Location="XS1_PORT_8C" Name="PORT_LED0_TO_7"/>
|
||||
<Port Location="XS1_PORT_1K" Name="PORT_LED8"/>
|
||||
<Port Location="XS1_PORT_1L" Name="PORT_LED9"/>
|
||||
<Port Location="XS1_PORT_8D" Name="PORT_LED10_TO_12"/>
|
||||
<Port Location="XS1_PORT_1P" Name="PORT_LED_OEN"/>
|
||||
|
||||
<!-- Button ports -->
|
||||
<Port Location="XS1_PORT_4A" Name="PORT_BUT_A_TO_D"/>
|
||||
|
||||
</Tile>
|
||||
|
||||
<Tile Number="1" Reference="tile[1]">
|
||||
<Port Location="XS1_PORT_1H" Name="PORT_USB_TX_READYIN"/>
|
||||
<Port Location="XS1_PORT_1J" Name="PORT_USB_CLK"/>
|
||||
<Port Location="XS1_PORT_1K" Name="PORT_USB_TX_READYOUT"/>
|
||||
<Port Location="XS1_PORT_1I" Name="PORT_USB_RX_READY"/>
|
||||
<Port Location="XS1_PORT_1E" Name="PORT_USB_FLAG0"/>
|
||||
<Port Location="XS1_PORT_1F" Name="PORT_USB_FLAG1"/>
|
||||
<Port Location="XS1_PORT_1G" Name="PORT_USB_FLAG2"/>
|
||||
<Port Location="XS1_PORT_8A" Name="PORT_USB_TXD"/>
|
||||
<Port Location="XS1_PORT_8B" Name="PORT_USB_RXD"/>
|
||||
|
||||
<!-- Audio Ports -->
|
||||
<Port Location="XS1_PORT_4D" Name="PORT_PLL_REF"/>
|
||||
<Port Location="XS1_PORT_1O" Name="PORT_MCLK_IN"/>
|
||||
<Port Location="XS1_PORT_1N" Name="PORT_I2S_LRCLK"/>
|
||||
<Port Location="XS1_PORT_1M" Name="PORT_I2S_BCLK"/>
|
||||
<Port Location="XS1_PORT_1P" Name="PORT_I2S_DAC0"/>
|
||||
<Port Location="XS1_PORT_4E" Name="PORT_I2C"/>
|
||||
<Port Location="XS1_PORT_16B" Name="PORT_MCLK_COUNT"/>
|
||||
</Tile>
|
||||
</Node>
|
||||
<Node Id="1" InPackageId="1" Type="periph:XS1-SU" Reference="usb_tile" Oscillator="24MHz">
|
||||
</Node>
|
||||
</Nodes>
|
||||
<Links>
|
||||
<Link Encoding="5wire">
|
||||
<LinkEndpoint NodeId="0" Link="8" Delays="52clk,52clk"/>
|
||||
<LinkEndpoint NodeId="1" Link="XL0" Delays="1clk,1clk"/>
|
||||
</Link>
|
||||
</Links>
|
||||
</Package>
|
||||
</Packages>
|
||||
<Nodes>
|
||||
<Node Id="2" Type="device:" RoutingId="0x8000">
|
||||
<Service Id="0" Proto="xscope_host_data(chanend c);">
|
||||
<Chanend Identifier="c" end="3"/>
|
||||
</Service>
|
||||
</Node>
|
||||
</Nodes>
|
||||
<Links>
|
||||
<Link Encoding="2wire" Delays="4,4" Flags="XSCOPE">
|
||||
<LinkEndpoint NodeId="0" Link="XL0"/>
|
||||
<LinkEndpoint NodeId="2" Chanend="1"/>
|
||||
</Link>
|
||||
</Links>
|
||||
<ExternalDevices>
|
||||
<Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="S25FL116K" PageSize="256" SectorSize="4096" NumPages="8192">
|
||||
<Attribute Name="PORT_SQI_CS" Value="PORT_SQI_CS"/>
|
||||
<Attribute Name="PORT_SQI_SCLK" Value="PORT_SQI_SCLK"/>
|
||||
<Attribute Name="PORT_SQI_SIO" Value="PORT_SQI_SIO"/>
|
||||
</Device>
|
||||
</ExternalDevices>
|
||||
<JTAGChain>
|
||||
<JTAGDevice NodeId="0"/>
|
||||
<JTAGDevice NodeId="1"/>
|
||||
</JTAGChain>
|
||||
</Network>
|
||||
@@ -1,31 +0,0 @@
|
||||
// Copyright 2017-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#ifndef _XUA_CONF_H_
|
||||
#define _XUA_CONF_H_
|
||||
|
||||
#define NUM_USB_CHAN_OUT 0
|
||||
#define NUM_USB_CHAN_IN 8
|
||||
#define I2S_CHANS_DAC 0
|
||||
#define I2S_CHANS_ADC 0
|
||||
#define MCLK_441 (512 * 44100)
|
||||
#define MCLK_48 (512 * 48000)
|
||||
#define MIN_FREQ 48000
|
||||
#define MAX_FREQ 48000
|
||||
|
||||
#define EXCLUDE_USB_AUDIO_MAIN
|
||||
|
||||
#define XUA_NUM_PDM_MICS 8
|
||||
#define VENDOR_STR "XMOS"
|
||||
#define VENDOR_ID 0x20B1
|
||||
#define PRODUCT_STR_A2 "XUA PDM Example"
|
||||
#define PRODUCT_STR_A1 "XUA PDM Example"
|
||||
#define PID_AUDIO_1 1
|
||||
#define PID_AUDIO_2 2
|
||||
#define AUDIO_CLASS 2
|
||||
#define AUDIO_CLASS_FALLBACK 0
|
||||
#define BCD_DEVICE 0x1234
|
||||
#define XUA_DFU_EN 0
|
||||
#define MIC_DUAL_ENABLED 0 // Use multi-threaded design
|
||||
|
||||
#endif
|
||||
@@ -1,8 +0,0 @@
|
||||
// Copyright 2017-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#include "xua_conf.h"
|
||||
|
||||
/* TODO */
|
||||
#define XUD_UAC_NUM_USB_CHAN_OUT NUM_USB_CHAN_OUT
|
||||
#define XUD_UAC_NUM_USB_CHAN_IN NUM_USB_CHAN_IN
|
||||
@@ -1,167 +0,0 @@
|
||||
// Copyright 2021-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#ifndef __hid_report_descriptor_h__
|
||||
#define __hid_report_descriptor_h__
|
||||
|
||||
#include "xua_hid_report.h"
|
||||
|
||||
#if 0
|
||||
/* Existing static report descriptor kept for reference */
|
||||
unsigned char hidReportDescriptor[] =
|
||||
{
|
||||
0x05, 0x0c, /* Usage Page (Consumer Device) */
|
||||
0x09, 0x01, /* Usage (Consumer Control) */
|
||||
0xa1, 0x01, /* Collection (Application) */
|
||||
0x15, 0x00, /* Logical Minimum (0) */
|
||||
0x25, 0x01, /* Logical Maximum (1) */
|
||||
0x09, 0xb0, /* Usage (Play) */
|
||||
0x09, 0xb5, /* Usage (Scan Next Track) */
|
||||
0x09, 0xb6, /* Usage (Scan Previous Track) */
|
||||
0x09, 0xe9, /* Usage (Volume Up) */
|
||||
0x09, 0xea, /* Usage (Volume Down) */
|
||||
0x09, 0xe2, /* Usage (Mute) */
|
||||
0x75, 0x01, /* Report Size (1) */
|
||||
0x95, 0x06, /* Report Count (6) */
|
||||
0x81, 0x02, /* Input (Data, Var, Abs) */
|
||||
0x95, 0x02, /* Report Count (2) */
|
||||
0x81, 0x01, /* Input (Cnst, Ary, Abs) */
|
||||
0xc0 /* End collection */
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define non-configurable items in the HID Report descriptor.
|
||||
*/
|
||||
static const USB_HID_Short_Item_t hidCollectionApplication = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_COLLECTION),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidCollectionEnd = {
|
||||
.header = HID_REPORT_SET_HEADER(0, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_END_COLLECTION),
|
||||
.data = { 0x00, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidInputConstArray = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_INPUT),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidInputDataVar = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_INPUT),
|
||||
.data = { 0x02, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidLogicalMaximum0 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MAXIMUM),
|
||||
.data = { 0x00, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidLogicalMaximum1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MAXIMUM),
|
||||
.data = { 0x01, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidLogicalMinimum0 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_LOGICAL_MINIMUM),
|
||||
.data = { 0x00, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidReportCount2 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x02, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportCount6 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x06, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportSize1 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_SIZE),
|
||||
.data = { 0x01, 0x00 } };
|
||||
|
||||
static const USB_HID_Short_Item_t hidUsageConsumerControl = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.data = { 0x01, 0x00 } };
|
||||
|
||||
/*
|
||||
* Define the HID Report Descriptor Item, Usage Page, Report ID and length for each HID Report
|
||||
* For internal purposes, a report element with ID of 0 must be included if report IDs are not being used.
|
||||
*/
|
||||
static const USB_HID_Report_Element_t hidReportPageConsumer = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_USAGE_PAGE),
|
||||
.item.data = { USB_HID_USAGE_PAGE_ID_CONSUMER, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( 0, 1, 0, 0 ) };
|
||||
|
||||
/*
|
||||
* Define configurable items in the HID Report descriptor.
|
||||
*/
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit5 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xE2, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( 0, 0, 0, 5 )
|
||||
}; // Mute
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit4 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xEA, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( 0, 0, 0, 4 )
|
||||
}; // Vol-
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit3 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xE9, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( 0, 0, 0, 3 )
|
||||
}; // Vol+
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit2 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB6, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( 0, 0, 0, 2 )
|
||||
}; // Scan Prev
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit1 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB5, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( 0, 0, 0, 1 )
|
||||
}; // Scan Next
|
||||
static USB_HID_Report_Element_t hidUsageByte0Bit0 = {
|
||||
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
|
||||
.item.data = { 0xB0, 0x00 },
|
||||
.location = HID_REPORT_SET_LOC( 0, 0, 0, 0 )
|
||||
}; // Play
|
||||
|
||||
/*
|
||||
* List the configurable items in the HID Report descriptor.
|
||||
*/
|
||||
static USB_HID_Report_Element_t* const hidConfigurableElements[] = {
|
||||
&hidUsageByte0Bit0,
|
||||
&hidUsageByte0Bit1,
|
||||
&hidUsageByte0Bit2,
|
||||
&hidUsageByte0Bit3,
|
||||
&hidUsageByte0Bit4,
|
||||
&hidUsageByte0Bit5
|
||||
};
|
||||
|
||||
/*
|
||||
* List HID Reports, one per Report ID. This should be a usage page item with the relevant
|
||||
* If not using report IDs - still have one with report ID 0
|
||||
*/
|
||||
static const USB_HID_Report_Element_t* const hidReports[] = {
|
||||
&hidReportPageConsumer
|
||||
};
|
||||
|
||||
/*
|
||||
* List all items in the HID Report descriptor.
|
||||
*/
|
||||
static const USB_HID_Short_Item_t * const hidReportDescriptorItems[] = {
|
||||
&(hidReportPageConsumer.item),
|
||||
&hidUsageConsumerControl,
|
||||
&hidCollectionApplication,
|
||||
&hidLogicalMinimum0,
|
||||
&hidLogicalMaximum1,
|
||||
&(hidUsageByte0Bit0.item),
|
||||
&(hidUsageByte0Bit1.item),
|
||||
&(hidUsageByte0Bit2.item),
|
||||
&(hidUsageByte0Bit3.item),
|
||||
&(hidUsageByte0Bit4.item),
|
||||
&(hidUsageByte0Bit5.item),
|
||||
&hidReportSize1,
|
||||
&hidReportCount6,
|
||||
&hidInputDataVar,
|
||||
&hidLogicalMaximum0,
|
||||
&hidReportCount2,
|
||||
&hidInputConstArray,
|
||||
&hidCollectionEnd
|
||||
};
|
||||
|
||||
/*
|
||||
* Define the number of HID Reports
|
||||
* Due to XC not supporting designated initializers, this constant has a hard-coded value.
|
||||
* It must equal ( sizeof hidReports / sizeof ( USB_HID_Report_Element_t* ))
|
||||
*/
|
||||
#define HID_REPORT_COUNT ( 1 )
|
||||
|
||||
#endif // __hid_report_descriptor_h__
|
||||
5
lib_xua/.gitignore
vendored
5
lib_xua/.gitignore
vendored
@@ -1,5 +0,0 @@
|
||||
.cproject
|
||||
.makefile
|
||||
.project
|
||||
.settings
|
||||
.xproject
|
||||
@@ -1,8 +0,0 @@
|
||||
all:
|
||||
@echo "** Module only - only builds as part of application **"
|
||||
|
||||
|
||||
clean:
|
||||
@echo "** Module only - only builds as part of application **"
|
||||
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
*******************************
|
||||
XMOS PUBLIC LICENCE: Version 1
|
||||
*******************************
|
||||
|
||||
Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software.
|
||||
|
||||
**1. Definitions**
|
||||
|
||||
**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software.
|
||||
|
||||
**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code.
|
||||
|
||||
**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives.
|
||||
|
||||
**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof.
|
||||
|
||||
**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code.
|
||||
|
||||
**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence.
|
||||
|
||||
This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement.
|
||||
|
||||
|
||||
**2. Licence**
|
||||
|
||||
**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following:
|
||||
|
||||
2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software:
|
||||
|
||||
2.1.1 for personal or academic, non-commercial purposes; or
|
||||
|
||||
2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2):
|
||||
|
||||
(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and
|
||||
|
||||
(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms).
|
||||
|
||||
The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement.
|
||||
|
||||
2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives:
|
||||
|
||||
2.2.1 for personal or academic, non-commercial purposes; or
|
||||
|
||||
2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2):
|
||||
|
||||
(a) you must comply with the terms of clause 2.1 with respect to the Derivatives;
|
||||
|
||||
(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and
|
||||
|
||||
(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS.
|
||||
|
||||
Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below.
|
||||
|
||||
2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code.
|
||||
|
||||
**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above.
|
||||
|
||||
**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives.
|
||||
|
||||
**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS.
|
||||
|
||||
**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms.
|
||||
|
||||
**7. IPR and Ownership**
|
||||
Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com**
|
||||
|
||||
Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein).
|
||||
Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit.
|
||||
|
||||
**8. Termination**
|
||||
|
||||
8.1 This Licence will automatically terminate immediately, without notice to you, if:
|
||||
|
||||
(a) you fail to comply with the terms of this Licence; and/or
|
||||
|
||||
(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or
|
||||
|
||||
(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part.
|
||||
|
||||
**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use.
|
||||
|
||||
**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50.
|
||||
|
||||
**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply.
|
||||
135
lib_xua/LICENSE.txt
Normal file
135
lib_xua/LICENSE.txt
Normal file
@@ -0,0 +1,135 @@
|
||||
Software Release License Agreement
|
||||
|
||||
Copyright (c) 2017-2020, XMOS, All rights reserved.
|
||||
|
||||
BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software.
|
||||
|
||||
Parties:
|
||||
|
||||
(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS).
|
||||
|
||||
(2) An individual or legal entity exercising permissions granted by this License (Customer).
|
||||
|
||||
If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity.
|
||||
|
||||
1. Definitions
|
||||
|
||||
"License" means this Software License and any schedules or annexes to it.
|
||||
|
||||
"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License
|
||||
|
||||
"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer.
|
||||
|
||||
"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS.
|
||||
|
||||
"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License.
|
||||
|
||||
"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates.
|
||||
|
||||
The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License.
|
||||
|
||||
Unless the context otherwise requires:
|
||||
|
||||
- references to XMOS and the Customer include their permitted successors and assigns;
|
||||
- references to statutory provisions include those statutory provisions as amended or re-enacted; and
|
||||
- references to any gender include all genders.
|
||||
|
||||
Words in the singular include the plural and in the plural include the singular.
|
||||
|
||||
2. License
|
||||
|
||||
XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware.
|
||||
|
||||
Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed.
|
||||
|
||||
3. Consideration
|
||||
|
||||
In consideration of the mutual obligations contained in this License, the parties agree to its terms.
|
||||
|
||||
4. Term
|
||||
|
||||
Subject to clause 12 below, this License shall be perpetual.
|
||||
|
||||
5. Restrictions on Use
|
||||
|
||||
The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation.
|
||||
|
||||
6. Modifications
|
||||
|
||||
The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis.
|
||||
|
||||
XMOS will own all intellectual property rights in the XMOS Modifications.
|
||||
The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware.
|
||||
|
||||
7. Support
|
||||
|
||||
Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement.
|
||||
|
||||
8. Warranty and Disclaimer
|
||||
|
||||
The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any).
|
||||
|
||||
Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications.
|
||||
|
||||
XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW.
|
||||
|
||||
9. High Risk Activities
|
||||
|
||||
The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities.
|
||||
|
||||
10. Liability
|
||||
|
||||
TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee.
|
||||
|
||||
Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License.
|
||||
|
||||
11. Ownership
|
||||
|
||||
The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement.
|
||||
|
||||
12. Termination
|
||||
|
||||
Either party may terminate this License at any time on written notice to the other if the other:
|
||||
|
||||
- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or
|
||||
|
||||
- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction.
|
||||
|
||||
Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination.
|
||||
|
||||
On termination for any reason:
|
||||
|
||||
- all rights granted to the Customer under this License shall cease;
|
||||
- the Customer shall cease all activities authorised by this License;
|
||||
- the Customer shall immediately pay any sums due to XMOS under this License; and
|
||||
- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so.
|
||||
|
||||
Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement.
|
||||
|
||||
13. Third party rights
|
||||
|
||||
No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license.
|
||||
|
||||
14. Confidentiality and publicity
|
||||
|
||||
Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party.
|
||||
|
||||
The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS.
|
||||
The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason.
|
||||
|
||||
15. Entire agreement
|
||||
|
||||
This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter.
|
||||
|
||||
16. Assignment
|
||||
|
||||
The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent.
|
||||
|
||||
17. Governing law and jurisdiction
|
||||
|
||||
This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts.
|
||||
|
||||
This License has been entered into on the date stated at the beginning of it.
|
||||
|
||||
Schedule
|
||||
XMOS lib_xua software
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright 2017-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved
|
||||
|
||||
#ifndef __XUA_H__
|
||||
#define __XUA_H__
|
||||
@@ -7,17 +6,13 @@
|
||||
#include "xua_conf_full.h"
|
||||
|
||||
#if __XC__ || __STDC__
|
||||
#include "xua_audiohub.h"
|
||||
#include "xua_audiohub.h"
|
||||
|
||||
#include "xua_endpoint0.h"
|
||||
#include "xua_endpoint0.h"
|
||||
|
||||
#include "xua_buffer.h"
|
||||
#endif
|
||||
#include "xua_buffer.h"
|
||||
|
||||
#if __XC__
|
||||
#if XUA_NUM_PDM_MICS > 0
|
||||
#include "xua_pdm_mic.h"
|
||||
#endif
|
||||
//#include "xua_dfu.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
// Copyright 2011-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved
|
||||
#ifndef __XUA_AUDIOHUB_H__
|
||||
#define __XUA_AUDIOHUB_H__
|
||||
|
||||
#if __XC__
|
||||
|
||||
#include "xccompat.h"
|
||||
#include "xs1.h"
|
||||
|
||||
#if XUA_USB_EN
|
||||
#ifndef NO_USB
|
||||
#include "dfu_interface.h"
|
||||
#endif
|
||||
|
||||
@@ -17,44 +15,26 @@
|
||||
* This function drives I2S ports and handles samples to/from other digital
|
||||
* I/O threads.
|
||||
*
|
||||
* \param c_aud Audio sample channel connected to the mixer() thread or the
|
||||
* decouple() thread
|
||||
*
|
||||
* \param clk_audio_mclk Nullable clockblock to be clocked from master clock
|
||||
*
|
||||
* \param clk_audio_mclk Nullable clockblock to be clocked from i2s clock
|
||||
*
|
||||
* \param p_mclk_in Master clock inport port (must be 1-bit)
|
||||
*
|
||||
* \param p_lrclk Nullable port for I2S sample clock
|
||||
*
|
||||
* \param p_bclk Nullable port for I2S bit
|
||||
*
|
||||
* \param p_i2s_dac Nullable array of ports for I2S data output lines
|
||||
*
|
||||
* \param p_i2s_adc Nullable array of ports for I2S data input lines
|
||||
*
|
||||
* \param c_dig channel connected to the clockGen() thread for
|
||||
* receiving/transmitting samples
|
||||
* \param c_aud Audio sample channel connected to the mixer() thread or the
|
||||
* decouple() thread
|
||||
* \param p_mclk_in Master clock port
|
||||
* \param c_dig channel connected to the clockGen() thread for
|
||||
* receiving/transmitting samples
|
||||
* \param c_config An optional channel that will be passed on to the
|
||||
* CODEC configuration functions.
|
||||
*/
|
||||
void XUA_AudioHub(chanend ?c_aud,
|
||||
clock ?clk_audio_mclk,
|
||||
clock ?clk_audio_bclk,
|
||||
in port p_mclk_in,
|
||||
buffered _XUA_CLK_DIR port:32 ?p_lrclk,
|
||||
buffered _XUA_CLK_DIR port:32 ?p_bclk,
|
||||
buffered out port:32 (&?p_i2s_dac)[I2S_WIRES_DAC],
|
||||
buffered in port:32 (&?p_i2s_adc)[I2S_WIRES_ADC]
|
||||
#if (XUA_SPDIF_TX_EN) //&& (SPDIF_TX_TILE != AUDIO_IO_TILE)
|
||||
void XUA_AudioHub(chanend ?c_aud
|
||||
, in port p_mclk_in
|
||||
#if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
|
||||
, chanend c_spdif_tx
|
||||
#endif
|
||||
#if((SPDIF_RX) || (ADAT_RX))
|
||||
#if(defined(SPDIF_RX) || defined(ADAT_RX))
|
||||
, chanend c_dig
|
||||
#endif
|
||||
#if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0) && (XUA_DFU_EN == 1)
|
||||
, server interface i_dfu ?dfuInterface
|
||||
#endif
|
||||
#if (XUA_NUM_PDM_MICS > 0)
|
||||
#if (NUM_PDM_MICS > 0)
|
||||
, chanend c_pdm_in
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved
|
||||
#ifndef __XUA_BUFFER_H__
|
||||
#define __XUA_BUFFER_H__
|
||||
|
||||
@@ -52,14 +51,14 @@ void XUA_Buffer(
|
||||
chanend c_iap_ea_native_data,
|
||||
#endif
|
||||
#endif
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
||||
chanend ?c_int,
|
||||
chanend ?c_clk_int,
|
||||
#endif
|
||||
chanend c_sof,
|
||||
chanend c_aud_ctl,
|
||||
in port p_off_mclk
|
||||
#if( 0 < HID_CONTROLS )
|
||||
#ifdef HID_CONTROLS
|
||||
, chanend c_hid
|
||||
#endif
|
||||
, chanend c_aud
|
||||
@@ -91,14 +90,14 @@ void XUA_Buffer_Ep(chanend c_aud_out,
|
||||
chanend c_iap_ea_native_data,
|
||||
#endif
|
||||
#endif
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
||||
chanend ?c_int,
|
||||
chanend ?c_clk_int,
|
||||
#endif
|
||||
chanend c_sof,
|
||||
chanend c_aud_ctl,
|
||||
in port p_off_mclk
|
||||
#if( 0 < HID_CONTROLS )
|
||||
#ifdef HID_CONTROLS
|
||||
, chanend c_hid
|
||||
#endif
|
||||
#ifdef CHAN_BUFF_CTRL
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright 2011-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved
|
||||
/*
|
||||
* @brief Defines relating to device configuration and customisation of lib_xua
|
||||
* @author Ross Owen, XMOS Limited
|
||||
@@ -57,13 +56,6 @@
|
||||
#define PDM_TILE AUDIO_IO_TILE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Disable USB functionalty just leaving AudioHub
|
||||
*/
|
||||
#ifndef XUA_USB_EN
|
||||
#define XUA_USB_EN 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Number of input channels (device to host). Default: NONE (Must be defined by app)
|
||||
*/
|
||||
@@ -83,7 +75,7 @@
|
||||
/**
|
||||
* @brief Number of DSD output channels. Default: 0 (disabled)
|
||||
*/
|
||||
#if defined(DSD_CHANS_DAC) && (DSD_CHANS_DAC != 0)
|
||||
#if defined(DSD_CHANS_DAC)
|
||||
#if defined(NATIVE_DSD) && (NATIVE_DSD == 0)
|
||||
#undef NATIVE_DSD
|
||||
#else
|
||||
@@ -243,6 +235,10 @@
|
||||
#define AUDIO_CLASS_FALLBACK 0 /* Default to not falling back to UAC 1 */
|
||||
#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
|
||||
* UAC1 mode in full-speed (if AUDIO_CLASS_FALLBACK enabled) or return "null" descriptors.
|
||||
@@ -251,7 +247,7 @@
|
||||
*/
|
||||
#if (AUDIO_CLASS == 2)
|
||||
/* Whether to run in Audio Class 2.0 mode in USB Full-speed */
|
||||
#if !defined(FULL_SPEED_AUDIO_2) && (AUDIO_CLASS_FALLBACK == 0)
|
||||
#if !defined(FULL_SPEED_AUDIO_2) && !defined(AUDIO_CLASS_FALLBACK)
|
||||
#define FULL_SPEED_AUDIO_2 1 /* Default to falling back to UAC2 */
|
||||
#endif
|
||||
#endif
|
||||
@@ -261,7 +257,7 @@
|
||||
#endif
|
||||
|
||||
/* Some checks on full-speed functionality */
|
||||
#if defined(FULL_SPEED_AUDIO_2) && (AUDIO_CLASS_FALLBACK)
|
||||
#if defined(FULL_SPEED_AUDIO_2) && defined(AUDIO_CLASS_FALLBACK)
|
||||
#error FULL_SPEED_AUDIO_2 and AUDIO_CLASS_FALLBACK enabled!
|
||||
#endif
|
||||
|
||||
@@ -275,27 +271,20 @@
|
||||
/**
|
||||
* @brief Number of PDM microphones in the design. Default: None
|
||||
*/
|
||||
#ifndef XUA_NUM_PDM_MICS
|
||||
#define XUA_NUM_PDM_MICS (0)
|
||||
#ifndef NUM_PDM_MICS
|
||||
#define NUM_PDM_MICS (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief PDM Microphone first channel index, defines which channels microphones will be input on.
|
||||
* Note, indexed from 0.
|
||||
*
|
||||
* Default: 0 (i.e. channels [0:XUA_NUM_PDM_MICS-1])
|
||||
* Default: 0 (i.e. channels [0:NUM_PDM_MICS-1])
|
||||
* */
|
||||
#ifndef PDM_MIC_INDEX
|
||||
#define PDM_MIC_INDEX (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Size of a frame of microphone data samples. Default: 1
|
||||
*/
|
||||
#ifndef XUA_MIC_FRAME_SIZE
|
||||
#define XUA_MIC_FRAME_SIZE (1)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enable MIDI functionality including buffering, descriptors etc. Default: DISABLED
|
||||
*/
|
||||
@@ -358,6 +347,11 @@
|
||||
#define SPDIF_RX (0)
|
||||
#endif
|
||||
|
||||
/* Tidy up old SPDIF_RX usage */
|
||||
#if defined(SPDIF_RX) && (SPDIF_RX == 0)
|
||||
#undef SPDIF_RX
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables ADAT Rx. Default: 0 (Disabled)
|
||||
*/
|
||||
@@ -365,13 +359,17 @@
|
||||
#define ADAT_RX (0)
|
||||
#endif
|
||||
|
||||
#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)
|
||||
*/
|
||||
#if (SPDIF_RX) || defined (__DOXYGEN__)
|
||||
#if defined (SPDIF_RX) || defined (__DOXYGEN__)
|
||||
#ifndef SPDIF_RX_INDEX
|
||||
#error SPDIF_RX_INDEX not defined and SPDIF_RX defined
|
||||
#define SPDIF_RX_INDEX 0 /* Default define for doxygen */
|
||||
@@ -384,7 +382,7 @@
|
||||
*
|
||||
* Default: NONE (Must be defined by app when ADAT_RX enabled)
|
||||
*/
|
||||
#if (ADAT_RX) || defined(__DOXYGEN__)
|
||||
#if defined(ADAT_RX) || defined(__DOXYGEN__)
|
||||
#ifndef ADAT_RX_INDEX
|
||||
#error ADAT_RX_INDEX not defined and ADAT_RX defined
|
||||
#define ADAT_RX_INDEX (0) /* Default define for doxygen */
|
||||
@@ -395,7 +393,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ADAT_RX
|
||||
#ifdef ADAT_RX
|
||||
|
||||
/* Setup input stream formats for ADAT */
|
||||
#if(MAX_FREQ > 96000)
|
||||
@@ -433,6 +431,10 @@
|
||||
#define HID_CONTROLS (0)
|
||||
#endif
|
||||
|
||||
#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.
|
||||
@@ -443,16 +445,6 @@
|
||||
#define CODEC_MASTER (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Serial Number String used by the device
|
||||
*
|
||||
* Default: ""
|
||||
*/
|
||||
#ifndef SERIAL_STR
|
||||
#define SERIAL_STR ""
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @brief Vendor String used by the device. This is also pre-pended to various strings used by the design.
|
||||
*
|
||||
@@ -508,7 +500,7 @@
|
||||
*
|
||||
* Default: 0x0003
|
||||
*/
|
||||
#if (AUDIO_CLASS == 1) || (AUDIO_CLASS_FALLBACK) || defined(__DOXYGEN__)
|
||||
#if (AUDIO_CLASS==1) || defined(AUDIO_CLASS_FALLBACK) || defined(__DOXYGEN__)
|
||||
#ifndef PID_AUDIO_1
|
||||
#define PID_AUDIO_1 (0x0003)
|
||||
#endif
|
||||
@@ -527,21 +519,21 @@
|
||||
* @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number.
|
||||
*/
|
||||
#ifndef BCD_DEVICE_J
|
||||
#define BCD_DEVICE_J (1)
|
||||
#define BCD_DEVICE_J (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number.
|
||||
*/
|
||||
#ifndef BCD_DEVICE_M
|
||||
#define BCD_DEVICE_M (2)
|
||||
#define BCD_DEVICE_M (1)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number.
|
||||
*/
|
||||
#ifndef BCD_DEVICE_N
|
||||
#define BCD_DEVICE_N (0)
|
||||
#define BCD_DEVICE_N (1)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -1140,15 +1132,38 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Always enable explicit feedback EP, even when input stream is present */
|
||||
#ifndef UAC_FORCE_FEEDBACK_EP
|
||||
#define UAC_FORCE_FEEDBACK_EP (1)
|
||||
/* IAP */
|
||||
#if defined(IAP) && (IAP == 0)
|
||||
#undef IAP
|
||||
#endif
|
||||
|
||||
#if (defined(UAC_FORCE_FEEDBACK_EP) && UAC_FORCE_FEEDBACK_EP == 0)
|
||||
#undef UAC_FORCE_FEEDBACK_EP
|
||||
/* IAP Interrupt endpoint */
|
||||
#if defined(IAP_INT_EP) && (IAP_INT_EP == 0)
|
||||
#undef IAP_INT_EP
|
||||
#endif
|
||||
|
||||
/* IAP EA Native Transport */
|
||||
#if defined(IAP_EA_NATIVE_TRANS) && (IAP_EA_NATIVE_TRANS == 0)
|
||||
#undef IAP_EA_NATIVE_TRANS
|
||||
#endif
|
||||
|
||||
#if defined(IAP_EA_NATIVE_TRANS) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Number of supported EA Native Interface Alternative settings.
|
||||
*
|
||||
* Only 1 supported
|
||||
*/
|
||||
#ifndef IAP_EA_NATIVE_TRANS_ALT_COUNT
|
||||
#define IAP_EA_NATIVE_TRANS_ALT_COUNT 1
|
||||
#endif
|
||||
|
||||
#if (IAP_EA_NATIVE_TRANS_ALT_COUNT > 1)
|
||||
/* Only 1 supported */
|
||||
#error
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
/* Endpoint addresses enums */
|
||||
enum USBEndpointNumber_In
|
||||
@@ -1158,13 +1173,13 @@ enum USBEndpointNumber_In
|
||||
ENDPOINT_NUMBER_IN_FEEDBACK,
|
||||
#endif
|
||||
ENDPOINT_NUMBER_IN_AUDIO,
|
||||
#if (SPDIF_RX) || (ADAT_RX)
|
||||
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
||||
ENDPOINT_NUMBER_IN_INTERRUPT, /* Audio interrupt/status EP */
|
||||
#endif
|
||||
#ifdef MIDI
|
||||
ENDPOINT_NUMBER_IN_MIDI,
|
||||
#endif
|
||||
#if( 0 < HID_CONTROLS )
|
||||
#ifdef HID_CONTROLS
|
||||
ENDPOINT_NUMBER_IN_HID,
|
||||
#endif
|
||||
#ifdef IAP
|
||||
@@ -1201,7 +1216,7 @@ enum USBEndpointNumber_Out
|
||||
#endif
|
||||
|
||||
#ifndef XUA_ENDPOINT_COUNT_CUSTOM_IN
|
||||
#define XUA_ENDPOINT_COUNT_CUSTOM_IN 0
|
||||
#define XUA_ENDPOINT_COUNT_CUSTOM_IN 0
|
||||
#endif
|
||||
|
||||
#define ENDPOINT_COUNT_IN (XUA_ENDPOINT_COUNT_IN + XUA_ENDPOINT_COUNT_CUSTOM_IN)
|
||||
@@ -1217,6 +1232,10 @@ enum USBEndpointNumber_Out
|
||||
|
||||
#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
|
||||
@@ -1232,9 +1251,9 @@ enum USBEndpointNumber_Out
|
||||
#endif
|
||||
|
||||
/* Length of clock unit/clock-selector units */
|
||||
#if (SPDIF_RX) && (ADAT_RX)
|
||||
#if defined(SPDIF_RX) && defined(ADAT_RX)
|
||||
#define NUM_CLOCKS (3)
|
||||
#elif (SPDIF_RX) || (ADAT_RX)
|
||||
#elif defined(SPDIF_RX) || defined(ADAT_RX)
|
||||
#define NUM_CLOCKS (2)
|
||||
#else
|
||||
#define NUM_CLOCKS (1)
|
||||
@@ -1425,12 +1444,6 @@ enum USBEndpointNumber_Out
|
||||
#error Bad DEFAULT_MCLK_FREQ
|
||||
#endif
|
||||
|
||||
/* DFU functional descriptor wDetachTimeOut field (milliseconds)
|
||||
* Time for device to wait for bus reset after DETACH request before reverting to idle state */
|
||||
#ifndef DFU_DETACH_TIME_OUT
|
||||
#define DFU_DETACH_TIME_OUT 250
|
||||
#endif
|
||||
|
||||
#if ((MCLK_441 % MIN_FREQ) == 0)
|
||||
#define MIN_FREQ_44 MIN_FREQ
|
||||
#define MIN_FREQ_48 ((48000 * 512)/((44100 * 512)/MIN_FREQ))
|
||||
@@ -1442,13 +1455,3 @@ enum USBEndpointNumber_Out
|
||||
#define MIN_FREQ_44 (((44100*512)/((48000 * 512)/MIN_FREQ))*2)
|
||||
#endif
|
||||
|
||||
/* Internal define for port declaration */
|
||||
#if CODEC_MASTER
|
||||
#define _XUA_CLK_DIR in
|
||||
#else
|
||||
#define _XUA_CLK_DIR out
|
||||
#endif
|
||||
|
||||
#if (CODEC_MASTER == 1) && (DSD_CHANS_DAC != 0)
|
||||
#error CODEC_MASTER with DSD is currently unsupported
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright 2017-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved
|
||||
#ifndef __XUA_CONF_FULL_H__
|
||||
#define __XUA_CONF_FULL_H__
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved
|
||||
|
||||
#ifndef _XUA_ENDPOINT0_H_
|
||||
#define _XUA_ENDPOINT0_H_
|
||||
@@ -15,10 +14,7 @@
|
||||
* \param c_ep0_out Chanend connected to the XUD_Manager() out endpoint array
|
||||
* \param c_ep0_in Chanend connected to the XUD_Manager() in endpoint array
|
||||
* \param c_audioCtrl Chanend connected to the decouple thread for control
|
||||
* audio (sample rate changes etc.). Note when nulled, the
|
||||
* audio device only supports single sample rate/format and
|
||||
* DFU is not supported either since this channel is used
|
||||
* to carry messages about format, rate and DFU state
|
||||
* audio (sample rate changes etc.)
|
||||
* \param c_mix_ctl Optional chanend to be connected to the mixer thread if
|
||||
* present
|
||||
* \param c_clk_ctl Optional chanend to be connected to the clockgen thread if
|
||||
@@ -28,109 +24,9 @@
|
||||
* \param c_EANativeTransport_ctrl Optional chanend to be connected to EA Native
|
||||
* endpoint manager if present
|
||||
*/
|
||||
void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend ?c_audioCtrl,
|
||||
void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCtrl,
|
||||
chanend ?c_mix_ctl,chanend ?c_clk_ctl, chanend ?c_EANativeTransport_ctr, client interface i_dfu ?dfuInterface
|
||||
VENDOR_REQUESTS_PARAMS_DEC_);
|
||||
|
||||
/** Function to set the Vendor ID value
|
||||
*
|
||||
* \param vid vendor ID value to set
|
||||
*/
|
||||
void XUA_Endpoint0_setVendorId(unsigned short vid);
|
||||
|
||||
/** Function to set the Product ID value
|
||||
*
|
||||
* \param pid Product ID value to set
|
||||
*/
|
||||
void XUA_Endpoint0_setProductId(unsigned short pid);
|
||||
|
||||
|
||||
/** Function to set the Vendor string
|
||||
*
|
||||
* \param vendor_str Vendor string to set
|
||||
*/
|
||||
#ifdef __XC__
|
||||
void XUA_Endpoint0_setVendorStr(char * unsafe vendor_str);
|
||||
#else
|
||||
void XUA_Endpoint0_setVendorStr(char * vendor_str);
|
||||
#endif
|
||||
|
||||
/** Function to set the Product string
|
||||
*
|
||||
* \param product_str Product string to set
|
||||
*/
|
||||
|
||||
#ifdef __XC__
|
||||
void XUA_Endpoint0_setProductStr(char * unsafe product_str);
|
||||
#else
|
||||
void XUA_Endpoint0_setProductStr(char * product_str);
|
||||
#endif
|
||||
|
||||
/** Function to set the Serial string
|
||||
*
|
||||
* \param serial_str Serial string to set
|
||||
*/
|
||||
#ifdef __XC__
|
||||
void XUA_Endpoint0_setSerialStr(char * unsafe serial_str);
|
||||
#else
|
||||
void XUA_Endpoint0_setSerialStr(char * serial_str);
|
||||
#endif
|
||||
|
||||
/** Function to set the BCD device
|
||||
*
|
||||
* \param bcdDevice BCD device to set
|
||||
|
||||
*/
|
||||
|
||||
void XUA_Endpoint0_setBcdDevice(unsigned short bcdDevice);
|
||||
|
||||
/** Function to get the Vendor string
|
||||
*
|
||||
* \return vendor string
|
||||
*/
|
||||
#ifdef __XC__
|
||||
char * unsafe XUA_Endpoint0_getVendorStr();
|
||||
#else
|
||||
char * XUA_Endpoint0_getVendorStr();
|
||||
#endif
|
||||
|
||||
/** Function to get the Product string
|
||||
*
|
||||
* \return Product string
|
||||
*/
|
||||
#ifdef __XC__
|
||||
char * unsafe XUA_Endpoint0_getProductStr();
|
||||
#else
|
||||
char * XUA_Endpoint0_getProductStr();
|
||||
#endif
|
||||
|
||||
/** Function to get the Serial Number string
|
||||
*
|
||||
* \return Serial string
|
||||
*/
|
||||
#ifdef __XC__
|
||||
char * unsafe XUA_Endpoint0_getSerialStr();
|
||||
#else
|
||||
char * XUA_Endpoint0_getSerialStr();
|
||||
#endif
|
||||
|
||||
/** Function to get the Vendor ID
|
||||
*
|
||||
* \return Vendor ID
|
||||
*/
|
||||
unsigned short XUA_Endpoint0_getVendorId();
|
||||
|
||||
/** Function to get the Product ID
|
||||
*
|
||||
* \return Product ID
|
||||
*/
|
||||
unsigned short XUA_Endpoint0_getProductId();
|
||||
|
||||
/** Function to get the BCD device
|
||||
*
|
||||
* \return BCD device
|
||||
*/
|
||||
unsigned short XUA_Endpoint0_getBcdDevice();
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
// Copyright 2017-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#ifndef __XUA_API_H__
|
||||
#define __XUA_API_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void set_usb_to_device_rate(uint32_t rate);
|
||||
void set_device_to_usb_rate(uint32_t rate);
|
||||
void set_usb_to_device_bit_res(uint32_t rate);
|
||||
void set_device_to_usb_bit_res(uint32_t rate);
|
||||
|
||||
uint32_t get_usb_to_device_rate();
|
||||
uint32_t get_device_to_usb_rate();
|
||||
uint32_t get_usb_to_device_bit_res();
|
||||
uint32_t get_device_to_usb_bit_res();
|
||||
|
||||
#endif //__XUA_API_H__
|
||||
1
lib_xua/doc/.gitignore
vendored
1
lib_xua/doc/.gitignore
vendored
@@ -1 +1,2 @@
|
||||
rst/_build
|
||||
pdf
|
||||
|
||||
1
lib_xua/doc/rst/.gitignore
vendored
1
lib_xua/doc/rst/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
_build
|
||||
@@ -1,117 +0,0 @@
|
||||
|
||||
Features & Options
|
||||
------------------
|
||||
|
||||
The previous sections describes only the basic core set of ``lib_xua`` details on enabling additional features e.g. S/PDIF are discussed in this section.
|
||||
|
||||
Where something must be defined, it is recommened this is done in `xua_conf.h` but could also be done in the application Makefile.
|
||||
|
||||
For each feature steps are listed for if calling ``lib_xua`` functions manually - if using the "codeless" programming model then these steps informational only.
|
||||
Each section also includes a sub-section on enabling the feature using the "codeless" model.
|
||||
|
||||
For full details of all options please see the API section
|
||||
|
||||
I2S/TDM
|
||||
~~~~~~~
|
||||
|
||||
I2S/TDM is typically fundamental to most products and is built into the ``XUA_AudioHub()`` core.
|
||||
|
||||
In order to enable I2S on must declare an array of ports for the data-lines (one for each direction)::
|
||||
|
||||
/* Port declarations. Note, the defines come from the xn file */
|
||||
buffered out port:32 p_i2s_dac[] = {PORT_I2S_DAC0}; /* I2S Data-line(s) */
|
||||
buffered in port:32 p_i2s_adc[] = {PORT_I2S_ADC0}; /* I2S Data-line(s) */
|
||||
|
||||
Ports for the sample and bit clocks are also required::
|
||||
|
||||
buffered out port:32 p_lrclk = PORT_I2S_LRCLK; /* I2S Bit-clock */
|
||||
buffered out port:32 p_bclk = PORT_I2S_BCLK; /* I2S L/R-clock */
|
||||
|
||||
.. note::
|
||||
|
||||
All of these ports must be buffered, width 32. Based on whether the xCORE is bus slave/master the ports must be declared as input/output respectively
|
||||
|
||||
These ports must then be passed to the ``XUA_AudioHub()`` task appropriately.
|
||||
|
||||
I2S functionality also requires two clock-blocks, one for bit and sample clock e.g.::
|
||||
|
||||
/* Clock-block declarations */
|
||||
clock clk_audio_bclk = on tile[0]: XS1_CLKBLK_4; /* Bit clock */
|
||||
clock clk_audio_mclk = on tile[0]: XS1_CLKBLK_5; /* Master clock */
|
||||
|
||||
These hardware resources must be passed into the call to ``XUA_AudioHub()``::
|
||||
|
||||
/* AudioHub/IO core does most of the audio IO i.e. I2S (also serves as a hub for all audio) */
|
||||
on tile[0]: XUA_AudioHub(c_aud, clk_audio_mclk, clk_audio_bclk, p_mclk_in, p_lrclk, p_bclk);
|
||||
|
||||
|
||||
Codeless Programming Model
|
||||
..........................
|
||||
|
||||
All ports and hardware resources are already fully declared, one must simply set the following:
|
||||
|
||||
* `I2S_CHANS_DAC` must be set to the desired number of output channels via I2S
|
||||
* `I2S_CHANS_ADC` must be set to the desired number of input channels via I2S
|
||||
* `AUDIO_IO_TILE` must be set to the tile where the physical I2S connections reside
|
||||
|
||||
For configuration options, master vs slave, TDM etc please see the API section.
|
||||
|
||||
|
||||
|newpage|
|
||||
|
||||
S/PDIF Transmit
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
``lib_xua`` supports the development of devices with S/PDIF transmit functionality through the use of
|
||||
``lib_spdif``. The XMOS S/PDIF transmitter runs in a single core and supports rates up to 192kHz.
|
||||
|
||||
The S/PDIF transmitter core takes PCM audio samples via a channel and outputs them in S/PDIF format to a port.
|
||||
Samples are provided to the S/PDIF transmitter task from the ``XUA_AudioHub()`` task.
|
||||
|
||||
The channel should be declared a normal::
|
||||
|
||||
chan c_spdif_tx
|
||||
|
||||
|
||||
In order to use the S/PDIF transmmiter with ``lib_xua`` hardware resources must be declared e.g::
|
||||
|
||||
buffered out port:32 p_spdif_tx = PORT_SPDIF_OUT; /* SPDIF transmit port */
|
||||
|
||||
This port should be clocked from the master-clock, ``lib_spdif`` provides a helper function for setting up the port::
|
||||
|
||||
spdif_tx_port_config(p_spdif_tx2, clk_audio_mclk, p_mclk_in, delay);
|
||||
|
||||
.. note:: If sharing the master-clock port and clockblock with ``XUA_AudioHub()`` (or any other task) then this setup
|
||||
should be done before running the tasks in a ``par`` statement.
|
||||
|
||||
Finally the S/PDIF transmitter task must be run - passing in the port and channel for communication with ``XUA_AudioHub``.
|
||||
For example::
|
||||
|
||||
par
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
/* Run the S/PDIF transmitter task */
|
||||
spdif_tx(p_spdif_tx2, c_spdif_tx);
|
||||
}
|
||||
|
||||
/* AudioHub/IO core does most of the audio IO i.e. I2S (also serves as a hub for all audio) */
|
||||
/* Note, since we are not using I2S we pass in null for LR and Bit clock ports and the I2S dataline ports */
|
||||
XUA_AudioHub(c_aud, clk_audio_mclk, null, p_mclk_in, null, null, null, null, c_spdif_tx);
|
||||
}
|
||||
|
||||
For further details please see the documentation, application notes and examples provided for ``lib_spdif``.
|
||||
|
||||
Codeless Programming Model
|
||||
..........................
|
||||
|
||||
If using the codeless programming method one must simply ensure the following:
|
||||
|
||||
* `PORT_SPDIF_OUT` is correctly defined in the XN file
|
||||
* `XUA_SPDIF_TX_EN` should be defined as non-zero
|
||||
* `SPDIF_TX_TILE` is correctly defined (note, this defaults to `AUDIO_IO_TILE`)
|
||||
|
||||
For further configuration options please see the API section.
|
||||
|
||||
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
|
||||
XMOS USB Audio Hardware Platforms
|
||||
---------------------------------
|
||||
|
||||
A range of hardware platforms for evaluating USB Audio on XMOS devices.
|
||||
|
||||
Specific, in depth, details for each platform/board are out of scope of this library documentation however, the features of the most popular platform are described below with the view of providing a worked example.
|
||||
|
||||
Please also see application note AN00246.
|
||||
|
||||
|
||||
xCORE-200 Multi-Channel Audio Board
|
||||
...................................
|
||||
|
||||
`The XMOS xCORE-200 Multi-channel Audio board <https://www.xmos.com/support/boards?product=18334>`_
|
||||
(XK-AUDIO-216-MC) is a complete hardware and reference software platform targeted at up to 32-channel USB and networked audio applications, such as DJ decks and mixers.
|
||||
|
||||
The Multichannel Audio Platform hardware is based around the XE216-512-TQ128 multicore microcontroller; an dual-tile xCORE-200 device with an integrated High Speed USB 2.0 PHY, RGMII (Gigabit Ethernet) interface and 16 logical cores delivering up to 2000MIPS of deterministic and responsive processing power.
|
||||
|
||||
Exploiting the flexible programmability of the xCORE-200 architecture, the Multi-channel Audio Platform supports either USB or network audio source, streaming 8 analogue input and 8 analogue output audio channels simultaneously - at up to 192kHz.
|
||||
|
||||
For full details regarding the hardware please refer to `xCORE-200 Multichannel Audio Platform Hardware Manual <https://www.xmos.com/support/boards?product=18334&component=18687>`_.
|
||||
|
||||
The reference board has an associated firmware application that uses `lib_xua` to implemented a USB Audio Devicce. Full details of this application can be found in the USB Audio Design Guide.
|
||||
|
||||
Analogue Input & Output
|
||||
+++++++++++++++++++++++
|
||||
|
||||
A total of eight single-ended analog input channels are provided via 3.5mm stereo jacks. Each is fed into a CirrusLogic CS5368 ADC.
|
||||
Similarly a total of eight single-ended analog output channels are provided. Each is fed into a CirrusLogic CS4384 DAC.
|
||||
|
||||
The four digital I2S/TDM input and output channels are mapped to the xCORE input/outputs through a header array. This jumper allows channel selection when the ADC/DAC is used in TDM mode
|
||||
|
||||
Digital Input & Output
|
||||
++++++++++++++++++++++
|
||||
|
||||
Optical and coaxial digital audio transmitters are used to provide digital audio input output in formats such as IEC60958 consumer mode (S/PDIF) and ADAT.
|
||||
The output data streams from the xCORE-200 are re-clocked using the external master clock to synchronise the data into the audio clock domain. This is achieved using simple external D-type flip-flops.
|
||||
|
||||
MIDI
|
||||
++++
|
||||
|
||||
MIDI I/O is provided on the board via standard 5-pin DIN connectors. The signals are buffered using 5V line drivers and are then connected to 1-bit ports on the xCORE-200, via a 5V to 3.3V buffer.
|
||||
|
||||
Audio Clocking
|
||||
++++++++++++++
|
||||
|
||||
A flexible clocking scheme is provided for both audio and other system services. In order to accommodate a multitude of clocking options, the low-jitter master clock is generated locally using a frequency multiplier PLL chip. The chip used is a Phaselink PL611-01, which is pre-programmed to provide a 24MHz clock from its CLK0 output, and either 24.576 MHz or 22.5792MHz from its CLK1 output.
|
||||
|
||||
The 24MHz fixed output is provided to the xCORE-200 device as the main processor clock. It also provides the reference clock to a Cirrus Logic CS2100, which provides a very low jitter audio clock from a synchronisation signal provided from the xCORE-200.
|
||||
|
||||
Either the locally generated clock (from the PL611) or the recovered low jitter clock (from the CS2100) may be selected to clock the audio stages; the xCORE-200, the ADC/DAC and Digital output stages. Selection is conntrolled via an additional I/O, bit 5 of PORT 8C.
|
||||
|
||||
LEDs, Buttons and Other IO
|
||||
++++++++++++++++++++++++++
|
||||
|
||||
An array of 4*4 green LEDs, 3 buttons and a switch are provided for general purpose user interfacing. The LED array is driven by eight signals each controlling one of 4 rows and 4 columns.
|
||||
|
||||
A standard XMOS xSYS interface is provided to allow host debug of the board via JTAG.
|
||||
|
||||
|newpage|
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB |
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 6.2 KiB |
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 29 KiB |
22
lib_xua/doc/rst/index.rst
Normal file
22
lib_xua/doc/rst/index.rst
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
.. include:: ../../../README.rst
|
||||
|
||||
|
||||
==============
|
||||
XMOS USB Audio
|
||||
==============
|
||||
|
||||
This document details the XMOS USB Audio Library. This library
|
||||
enables the development of USB Audio devices on the XMOS xCORE architecture.
|
||||
|
||||
This document describes the structure of the library, its basic use
|
||||
and resources required.
|
||||
|
||||
This document assumes familiarity with the XMOS xCORE architecture, the
|
||||
Universal Serial Bus 2.0 Specification (and related specifications),
|
||||
the XMOS tool chain and XC language.
|
||||
|
||||
Known Issues
|
||||
============
|
||||
|
||||
.. include:: ../../../CHANGELOG.rst
|
||||
@@ -1,20 +0,0 @@
|
||||
|appendix|
|
||||
|
||||
Known Issues
|
||||
------------
|
||||
|
||||
- Quad-SPI DFU will corrupt the factory image with tools version < 14.0.4 due to an issue with libquadflash
|
||||
|
||||
- (#14762) When in DSD mode with S/PDIF output enabled, DSD samples are transmitted over S/PDIF if the DSD and S/PDIF channels are shared, this may or may not be desired
|
||||
|
||||
- (#14173) I2S input is completely disabled when DSD output is active - any input stream to the host will contain 0 samples
|
||||
|
||||
- (#14780) Operating the design at a sample rate of less than or equal to the SOF rate (i.e. 8kHz at HS, 1kHz at FS) may expose a corner case relating to 0 length packet handling in both the driver and device and should be considered un-supported at this time.
|
||||
|
||||
- (#14883) Before DoP mode is detected a small number of DSD samples will be played out as PCM via I2S
|
||||
|
||||
- (#14887) Volume control settings currently affect samples in both DSD and PCM modes. This results in invalid DSD output if volume control not set to 0
|
||||
|
||||
- Windows XP volume control very sensitive. The Audio 1.0 driver built into Windows XP (usbaudio.sys) does not properly support master volume AND channel volume controls, leading to a very sensitive control. Descriptors can be easily modified to disable master volume control if required (one byte - bmaControls(0) in Feature Unit descriptors)
|
||||
|
||||
- 88.2kHz and 176.4kHz sample frequencies are not exposed in Windows control panels. These are known OS restrictions.
|
||||
@@ -1,38 +0,0 @@
|
||||
|
||||
.. include:: ../../../README.rst
|
||||
|
||||
|
||||
About This Document
|
||||
-------------------
|
||||
|
||||
This document describes the structure of the library, its use and resources required. It also covers some implementation detail.
|
||||
|
||||
This document assumes familiarity with the XMOS xCORE architecture, the Universal Serial Bus 2.0 Specification (and related specifications),
|
||||
the XMOS tool chain and XC language.
|
||||
|
||||
|
||||
Host System Requirements
|
||||
------------------------
|
||||
|
||||
USB Audio devices built using `lib_xua` have the following host system requirements.
|
||||
|
||||
- Mac OSX version 10.6 or later
|
||||
|
||||
- Windows Vista, 7, 8 or 10 with Thesycon Audio Class 2.0 driver for Windows (Tested against version 3.20). Please contact XMOS for details.
|
||||
|
||||
- Windows Vista, 7, 8 or 10 with built-in USB Audio Class 1.0 driver.
|
||||
|
||||
Older versions of Windows are not guaranteed to operate as expected. Devices are also expected to operate with various Linux distributions including mobile variants.
|
||||
|
||||
.. toctree::
|
||||
|
||||
Overview <overview>
|
||||
Hardware Platforms <hw>
|
||||
Software Overview <sw>
|
||||
Using lib_xua <using>
|
||||
Features <feat>
|
||||
Software Detail <sw_detail>
|
||||
Known Issues <issues>
|
||||
|
||||
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
USB Audio Solution Overview
|
||||
---------------------------
|
||||
|
||||
|
||||
.. table::
|
||||
:class: vertical-borders
|
||||
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
| **Functionality** |
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
| Provides USB interface to audio I/O. |
|
||||
| |
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
| **Supported Standards** |
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
+---------------------------------+---------------------------------------------------------------------------------------------+
|
||||
| USB | USB 2.0 (Full-speed and High-speed) |
|
||||
| +---------------------------------------------------------------------------------------------+
|
||||
| | `USB Audio Class 1.0 <http://www.usb.org/developers/devclass_docs/audio10.pdf>`_ |
|
||||
| +---------------------------------------------------------------------------------------------+
|
||||
| | `USB Audio Class 2.0 <http://www.usb.org/developers/devclass_docs/Audio2.0_final.zip>`_ |
|
||||
| +---------------------------------------------------------------------------------------------+
|
||||
| | `USB Firmware Upgrade (DFU) 1.1 <http://www.usb.org/developers/devclass_docs/DFU_1.1.pdf>`_ |
|
||||
| +---------------------------------------------------------------------------------------------+
|
||||
| | `USB Midi Device Class 1.0 <http://www.usb.org/developers/devclass_docs/midi10.pdf>`_ |
|
||||
+---------------------------------+---------------------------------------------------------------------------------------------+
|
||||
| Audio | I2S/TDM |
|
||||
| +---------------------------------------------------------------------------------------------+
|
||||
| | S/PDIF |
|
||||
| +---------------------------------------------------------------------------------------------+
|
||||
| | ADAT |
|
||||
| +---------------------------------------------------------------------------------------------+
|
||||
| | Direct Stream Digital (DSD) |
|
||||
| +---------------------------------------------------------------------------------------------+
|
||||
| | PDM Microphones |
|
||||
| +---------------------------------------------------------------------------------------------+
|
||||
| | MIDI |
|
||||
+---------------------------------+---------------------------------------------------------------------------------------------+
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
| **Supported Sample Frequencies** |
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
| 44.1kHz, 48kHz, 88.2kHz, 96kHz, 176.4kHz, 192kHz, 352.8kHz, 384kHz |
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
| **Supported Devices** |
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
+---------------------------------+---------------------------------------------------------------------------------------------+
|
||||
| XMOS Devices | xCORE-200 Series |
|
||||
+---------------------------------+---------------------------------------------------------------------------------------------+
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
| **Requirements** |
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
+---------------------------------+---------------------------------------------------------------------------------------------+
|
||||
| Development Tools | xTIMEcomposer Development Tools v14 or later |
|
||||
+---------------------------------+---------------------------------------------------------------------------------------------+
|
||||
| USB | xCORE-200 Series device with integrated USB Phy |
|
||||
+---------------------------------+---------------------------------------------------------------------------------------------+
|
||||
| Audio | External audio DAC/ADC/CODECs (and required supporting componentry) supporting I2S/TDM |
|
||||
+---------------------------------+---------------------------------------------------------------------------------------------+
|
||||
| Boot/Storage | Compatible SPI Flash device (or xCORE-200 device with internal flash) |
|
||||
+---------------------------------+---------------------------------------------------------------------------------------------+
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
| **Licensing and Support** |
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
| Reference code provided without charge under license from XMOS. |
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
| Please visit http://www.xmos.com/support/contact for support. |
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
| Reference code is maintained by XMOS Limited. |
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
|
||||
.. _usb_audio_sec_architecture:
|
||||
|
||||
USB Audio Software Overview
|
||||
---------------------------
|
||||
|
||||
This section describes the software architecture of a USB Audio device implemented using `lib_xua`, its dependencies and other supporting libraries.
|
||||
|
||||
`lib_xua` provides fundamental building blocks for producing USB Audio products on XMOS devices. Every system is required to have the components from `lib_xua` listed in :ref:`usb_audio_shared_components`.
|
||||
|
||||
.. _usb_audio_shared_components:
|
||||
|
||||
.. list-table:: Required XUA Components
|
||||
:header-rows: 1
|
||||
:widths: 40 60
|
||||
|
||||
* - Component
|
||||
- Description
|
||||
* - Endpoint 0
|
||||
- Provides the logic for Endpoint 0 which handles
|
||||
enumeration and control of the device including DFU related requests.
|
||||
* - Endpoint buffer
|
||||
- Buffers endpoint data packets to and from the host. Manages delivery of audio packets between the endpoint buffer
|
||||
component and the audio components. It can also handle volume control processing.Note, this currently utlises two cores
|
||||
* - AudioHub
|
||||
- Handles audio I/O over I2S and manages audio data
|
||||
to/from other digital audio I/O components.
|
||||
|
||||
In addition low-level USB I/0 is required and is provided by the external dependency `lib_xud`
|
||||
|
||||
.. list-table:: Additional Components Required
|
||||
:header-rows: 1
|
||||
:widths: 100 60
|
||||
|
||||
* - Component
|
||||
- Description
|
||||
* - XMOS USB Device Driver (XUD)
|
||||
- Handles the low level USB I/O.
|
||||
|
||||
In addition :ref:`usb_audio_optional_components` shows optional components that can be added/enabled from within `lib_xua`
|
||||
|
||||
.. _usb_audio_optional_components:
|
||||
|
||||
.. list-table:: Optional Components
|
||||
:header-rows: 1
|
||||
:widths: 40 60
|
||||
|
||||
* - Component
|
||||
- Description
|
||||
* - Mixer
|
||||
- Allows digital mixing of input and output channels. It can also
|
||||
handle volume control instead of the decoupler.
|
||||
* - Clockgen
|
||||
- Drives an external frequency generator (PLL) and manages
|
||||
changes between internal clocks and external clocks arising
|
||||
from digital input.
|
||||
* - MIDI
|
||||
- Outputs and inputs MIDI over a serial UART interface.
|
||||
|
||||
`lib_xua` also provides optional support for integrating with the following eternal dependencies:
|
||||
|
||||
.. list-table:: Optional Components
|
||||
:header-rows: 1
|
||||
:widths: 40 60
|
||||
|
||||
* - Component
|
||||
- Description
|
||||
* - S/PDIF Transmitter (lib_spdif)
|
||||
- Outputs samples of an S/PDIF digital audio interface.
|
||||
* - S/PDIF Receiver (lib_spdif)
|
||||
- Inputs samples of an S/PDIF digital audio interface (requires the
|
||||
clockgen component).
|
||||
* - ADAT Receiver (lib_adat)
|
||||
- Inputs samples of an ADAT digital audio interface (requires the
|
||||
clockgen component).
|
||||
* - PDM Microphones (lib_mic_array)
|
||||
- Receives PDM data from microphones and performs PDM to PCM conversion
|
||||
|
||||
.. _usb_audio_threads:
|
||||
|
||||
.. figure:: images/threads-crop.*
|
||||
:width: 100%
|
||||
|
||||
USB Audio Core Diagram
|
||||
|
||||
:ref:`usb_audio_threads` shows how the components interact with each
|
||||
other in a typical system. The green circles represent cores with arrows indicating inter-core communications.
|
||||
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
ADAT Receive
|
||||
------------
|
||||
|
||||
The ADAT receive component receives up to eight channels of audio at a sample rate
|
||||
of 44.1kHz or 48kHz. The API for calling the receiver functions is
|
||||
described in :ref:`usb_audio_sec_component_api`.
|
||||
|
||||
The component outputs 32 bits words split into nine word frames. The
|
||||
frames are laid out in the following manner:
|
||||
|
||||
* Control byte
|
||||
* Channel 0 sample
|
||||
* Channel 1 sample
|
||||
* Channel 2 sample
|
||||
* Channel 3 sample
|
||||
* Channel 4 sample
|
||||
* Channel 5 sample
|
||||
* Channel 6 sample
|
||||
* Channel 7 sample
|
||||
|
||||
Example of code show how to read the output of the ADAT component is shown below::
|
||||
|
||||
control = inuint(oChan);
|
||||
|
||||
for(int i = 0; i < 8; i++)
|
||||
{
|
||||
sample[i] = inuint(oChan);
|
||||
}
|
||||
|
||||
Samples are 24-bit values contained in the lower 24 bits of the word.
|
||||
|
||||
The control word comprises four control bits in bits [11..8] and the value 0b00000001 in bits [7..0].
|
||||
This control word enables synchronization at a higher level, in that on the channel a single odd
|
||||
word is always read followed by eight words of data.
|
||||
|
||||
.. Timing Requirements
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. The data samples are outputted onto the channel every 2.4 us. The
|
||||
.. control sample follows 1.7 us after the last data sample, and is
|
||||
.. followed 2.4 us later by the first data sample. Given that a channel
|
||||
.. can hold two words of data, when data appears on the channel, it
|
||||
.. should be input within 4.1 us otherwise the ADAT receiver will block,
|
||||
.. and data will be lost. Between data samples a window of 4.8 us is
|
||||
.. available.
|
||||
|
||||
Integration
|
||||
~~~~~~~~~~~
|
||||
|
||||
Since the ADAT is a digital stream the devices master clock must synchronised to it. This is
|
||||
typically achieved with an external fractional-n clock multiplier.
|
||||
|
||||
The ADAT receive function communicates with the clockGen component which passes audio data onto the
|
||||
audio driver and handles locking to the ADAT clock source if required.
|
||||
@@ -1,176 +0,0 @@
|
||||
.. _usb_audio_sec_audio:
|
||||
|
||||
AudioHub/I2S
|
||||
............
|
||||
|
||||
The AudioHub task performs many functions. It receives and transmits samples from/to the decoupler or mixer core over an XC channel.
|
||||
|
||||
It also drives several in and out I2S/TDM channels to/from a CODEC, DAC, ADC etc - from now on termed "audio hardware".
|
||||
|
||||
If the firmware is configured with the xCORE as I2S master the requred clock lines will also be driven out from this task also.
|
||||
|
||||
It also has the task of formwarding on and reciving samples to/from other audio related tasks such as S/PDIF tasks, ADAT tasks etc.
|
||||
|
||||
The AudioHub task must be connected to external audio hardware that supports I2S (other modes such as "left justified" can be supported with firmware changes).
|
||||
|
||||
In master mode, the XMOS device acts as the master generating the I2S "Continous Serial Clock (SCK)" typically called the Bit-Clock (BCLK) and the "Word Select (WS)" line typically called left-right clock (LRCLK) signals. Any CODEC or DAC/ADC combination that supports I2S and can be used.
|
||||
|
||||
The LR-clock, bit-clock and data are all derived from the incoming master clock (typically the output of the external oscillator or PLL)
|
||||
- This is not part of the I2S standard but is commonly included for synchronizing the internal operation of the analog/digital converters.
|
||||
|
||||
The AudioHub task is implemented in the file ``xua_audiohub.xc``.
|
||||
|
||||
:ref:`usb_audio_codec_signals` shows the signals used to communicate audio between the XMOS device and the external audio hardware.
|
||||
|
||||
.. _usb_audio_codec_signals:
|
||||
|
||||
.. list-table:: I2S Signals
|
||||
:header-rows: 1
|
||||
:widths: 20 80
|
||||
|
||||
* - Signal
|
||||
- Description
|
||||
* - LRCLK
|
||||
- The word clock, transition at the start of a sample
|
||||
* - BCLK
|
||||
- The bit clock, clocks data in and out
|
||||
* - SDIN
|
||||
- Sample data in (from CODEC/ADC to the XMOS device)
|
||||
* - SDOUT
|
||||
- Sample data out (from the XMOS device to CODEC/DAC)
|
||||
* - MCLK
|
||||
- The master clock running the CODEC/DAC/ADC
|
||||
|
||||
The bit clock controls the rate at which data is transmitted to and from the external audio hardware.
|
||||
|
||||
In the case where the XMOS device is the master, it divides the MCLK to generate the required signals for both BCLK and LRCLK,
|
||||
with BCLK then being used to clock data in (SDIN) and data out (SDOUT) of the external audio hardware.
|
||||
|
||||
:ref:`usb_audio_example_clock_divides` shows some example clock frequencies and divides for different sample rates:
|
||||
|
||||
.. _usb_audio_example_clock_divides:
|
||||
|
||||
.. list-table:: Clock Divide examples
|
||||
:header-rows: 1
|
||||
:widths: 30 25 25 20
|
||||
|
||||
* - Sample Rate (kHz)
|
||||
- MCLK (MHz)
|
||||
- BCLK (MHz)
|
||||
- Divide
|
||||
* - 44.1
|
||||
- 11.2896
|
||||
- 2.819
|
||||
- 4
|
||||
* - 88.2
|
||||
- 11.2896
|
||||
- 5.638
|
||||
- 2
|
||||
* - 176.4
|
||||
- 11.2896
|
||||
- 11.2896
|
||||
- 1
|
||||
* - 48
|
||||
- 24.576
|
||||
- 3.072
|
||||
- 8
|
||||
* - 96
|
||||
- 24.576
|
||||
- 6.144
|
||||
- 4
|
||||
* - 192
|
||||
- 24.576
|
||||
- 12.288
|
||||
- 2
|
||||
|
||||
The master clock must be supplied by an external source e.g. clock generator, fixed oscillators, PLL etc to generate the two frequencies to support
|
||||
44.1kHz and 48kHz audio frequencies (e.g. 11.2896/22.5792MHz and 12.288/24.576MHzrespectively). This master clock input is then provided to the
|
||||
external audio hardware and the xCORE device.
|
||||
|
||||
|
||||
Port Configuration (xCORE Master)
|
||||
+++++++++++++++++++++++++++++++++
|
||||
|
||||
The default software configuration is xCORE is I2S master. That is, the XMOS device provides the BCLK and LRCLK signals to the external audio hardware
|
||||
|
||||
xCORE ports and XMOS clocks provide many valuable features for implementing I2S. This section describes how these are configured
|
||||
and used to drive the I2S interface.
|
||||
|
||||
.. only:: latex
|
||||
|
||||
.. figure:: images/port_config.pdf
|
||||
|
||||
Ports and Clocks (xCORE master)
|
||||
|
||||
.. only:: html
|
||||
|
||||
.. figure:: images/port_config.png
|
||||
|
||||
Ports and Clocks (xCORE master)
|
||||
|
||||
The code to configure the ports and clocks is in the ``ConfigAudioPorts()`` function. Developers should not need to modify this.
|
||||
|
||||
The xCORE inputs MCLK and divides it down to generate BCLK and LRCLK.
|
||||
|
||||
To achieve this MCLK is input into the device using the 1-bit port ``p_mclk``. This is attached to the clock block ``clk_audio_mclk``, which is in
|
||||
turn used to clock the BCLK port, ``p_bclk``. BCLK is used to clock the LRCLK (``p_lrclk``) and data signals SDIN (``p_sdin``) and SDOUT (``p_sdout``).
|
||||
|
||||
Again, a clock block is used (``clk_audio_bclk``) which has ``p_bclk`` as its input and is used to clock the ports ``p_lrclk``, ``p_sdin`` and ``p_sdout``.
|
||||
The preceding diagram shows the connectivity of ports and clock blocks.
|
||||
|
||||
``p_sdin`` and ``p_sdout`` are configured as buffered ports with a transfer width of 32, so all 32 bits are
|
||||
input in one input statement. This allows the software to input, process and output 32-bit words, whilst the ports serialize and
|
||||
deserialize to the single I/O pin connected to each port.
|
||||
|
||||
xCORE-200 series devices have the ability to divide an extenal clock in a clock-block.
|
||||
|
||||
However, XS1 based devices do not have this functionality. In order achieve the reqired master-clock
|
||||
to bit-clock/LR-clock divicd on XS1 devices, buffered ports with a transfer width of 32 are also
|
||||
used for ``p_bclk`` and ``p_lrclk``. The bit clock is generated by performing outputs of a particular pattern to ``p_bclk`` to toggle
|
||||
the output at the desired rate. The pattern depends on the divide between the master-clock and bit-clock.
|
||||
The following table shows the required pattern for different values of this divide:
|
||||
|
||||
.. list-table:: Output patterns
|
||||
:header-rows: 1
|
||||
|
||||
* - Divide
|
||||
- Output pattern
|
||||
- Outputs per sample
|
||||
* - 2
|
||||
- ``0xAAAAAAAA``
|
||||
- 2
|
||||
* - 4
|
||||
- ``0xCCCCCCCC``
|
||||
- 4
|
||||
* - 8
|
||||
- ``0xF0F0F0F0``
|
||||
- 8
|
||||
|
||||
In any case, the bit clock outputs 32 clock cycles per sample. In the special case where the divide is 1 (i.e. the bit clock frequency equals
|
||||
the master clock frequency), the ``p_bclk`` port is set to a special mode where it simply outputs its clock input (i.e. ``p_mclk``).
|
||||
See ``configure_port_clock_output()`` in ``xs1.h`` for details.
|
||||
|
||||
``p_lrclk`` is clocked by ``p_bclk``. In I2S mode the port outputs the pattern ``0x7fffffff``
|
||||
followed by ``0x80000000`` repeatedly. This gives a signal that has a transition one bit-clock
|
||||
before the data (as required by the I2S standard) and alternates between high and low for the
|
||||
left and right channels of audio.
|
||||
|
||||
Changing Audio Sample Frequency
|
||||
+++++++++++++++++++++++++++++++
|
||||
|
||||
.. _usb_audio_sec_chang-audio-sample:
|
||||
|
||||
When the host changes sample frequency, a new frequency is sent to
|
||||
the audio driver core by Endpoint 0 (via the buffering cores and mixer).
|
||||
|
||||
First, a change of sample frequency is reported by sending the new frequency over an XC channel. The audio core
|
||||
detects this by checking for the presence of a control token on the channel channel
|
||||
|
||||
Upon receiving the change of sample frequency request, the audio
|
||||
core stops the I2S/TDM interface and calls the CODEC/port configuration
|
||||
functions.
|
||||
|
||||
Once this is complete, the I2S/TDM interface (i.e. the main look in AudioHub) is restarted at the new frequency.
|
||||
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
.. _usb_audio_sec_clock_recovery:
|
||||
|
||||
External Clock Recovery (ClockGen)
|
||||
----------------------------------
|
||||
|
||||
An application can either provide fixed master clock sources via selectable oscillators, clock
|
||||
generation IC, etc, to provide the audio master or use an external PLL/Clock Multiplier to
|
||||
generate a master clock based on reference from the XMOS device.
|
||||
|
||||
Using an external PLL/Clock Multiplier allows the design to lock to an external clock source
|
||||
from a digital stream (e.g. S/PDIF or ADAT input).
|
||||
|
||||
The clock recovery core (clockGen) is responsible for generating the reference frequency
|
||||
to the Fractional-N Clock Generator. This, in turn, generates the master clock used over the
|
||||
whole design.
|
||||
|
||||
When running in *Internal Clock* mode this core simply generates this clock using a local
|
||||
timer, based on the XMOS reference clock.
|
||||
|
||||
When running in an external clock mode (i.e. S/PDIF Clock" or "ADAT Clock" mode) digital
|
||||
samples are received from the S/PDIF and/or ADAT receive core.
|
||||
|
||||
The external frequency is calculated through counting samples in a given period. The
|
||||
reference clock to the Fractional-N Clock Multiplier is then generated based on this
|
||||
external stream. If this stream becomes invalid, the timer event will fire to ensure that
|
||||
valid master clock generation continues regardless of cable unplugs etc.
|
||||
|
||||
This core gets clock selection Get/Set commands from Endpoint 0 via the ``c_clk_ctl``
|
||||
channel. This core also records the validity of external clocks, which is also queried
|
||||
through the same channel from Endpoint 0.
|
||||
|
||||
|
||||
This core also can cause the decouple core to request an interrupt packet on change of
|
||||
clock validity. This functionality is based on the Audio Class 2.0 status/interrupt endpoint
|
||||
feature.
|
||||
@@ -1,27 +0,0 @@
|
||||
|
||||
Implementation Detail
|
||||
---------------------
|
||||
|
||||
This section describes the software architecture of a USB Audio device implemented using `lib_xua`, it's dependancies and other supporting libraries.
|
||||
|
||||
This section will now examine the operation of these components in further detail.
|
||||
|
||||
.. toctree::
|
||||
|
||||
sw_audio
|
||||
sw_spdif
|
||||
|
||||
|
||||
..
|
||||
sw_xud
|
||||
sw_ep0
|
||||
sw_audio
|
||||
sw_mixer
|
||||
sw_spdif_rx
|
||||
sw_adat
|
||||
sw_clocking
|
||||
sw_midi
|
||||
sw_pdm
|
||||
sw_resource
|
||||
..
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
.. _usb_audio_sec_dfu:
|
||||
|
||||
Device Firmware Upgrade (DFU)
|
||||
=============================
|
||||
|
||||
The DFU interface handles updates to the boot image of the device. The DFU code is called from
|
||||
the Endpoint 0 core.
|
||||
|
||||
The interface links USB to the XMOS flash user library (see :ref:`libflash_api`). In Application
|
||||
mode the DFU can accept commands to reset the device into DFU mode. There are two ways to do this:
|
||||
|
||||
- The host can send a ``DETACH`` request and then reset the
|
||||
device. If the device is reset by the host within a specified
|
||||
timeout, it will start in DFU mode (this is initially set to
|
||||
one second and is configurable from the host).
|
||||
|
||||
- The host can send a custom user request
|
||||
``XMOS_DFU_RESETDEVICE`` to the DFU interface that
|
||||
resets the device immediately into DFU mode.
|
||||
|
||||
|
||||
Once the device is in DFU mode. The DFU interface can accept commands defined by the
|
||||
`DFU 1.1 class specification <http://www.usb.org/developers/devclass_docs/DFU_1.1.pdf*USB>`_. In
|
||||
addition the interface accepts the custom command ``XMOS_DFU_REVERTFACTORY`` which reverts the active
|
||||
boot image to the factory image. Note that the XMOS specific command request
|
||||
identifiers are defined in ``dfu_types.h`` within ``module_dfu``.
|
||||
|
||||
@@ -1,349 +0,0 @@
|
||||
|newpage|
|
||||
|
||||
.. _usb_audio_sec_usb:
|
||||
|
||||
Endpoint 0: Management and Control
|
||||
..................................
|
||||
|
||||
All USB devices must support a mandatory control endpoint, Endpoint 0. This controls the management tasks of the USB device.
|
||||
|
||||
These tasks can be generally split into enumeration, audio configuration and firmware upgrade requests.
|
||||
|
||||
Enumeration
|
||||
~~~~~~~~~~~
|
||||
|
||||
When the device is first attached to a host, enumeration occurs. This process involves the host interrogating the device as to its functionality. The device does this by presenting several interfaces to the host via a set of descriptors.
|
||||
|
||||
During the enumeration process the host will issue various commands to the device including assigning the device a unique address on the bus.
|
||||
|
||||
The endpoint 0 code runs in its own core and follows a similar format to that of the USB Device examples in `lib_xud` (i.e. Example HID Mouse Demo). That is, a call is made to ``USB_GetSetupPacket()`` to receive a command from the host. This populates a ``USB_SetupPacket_t`` structure, which is then parsed.
|
||||
|
||||
There are many mandatory requests that a USB Device must support as required by the USB Specification. Since these are required for all devices in order to function a
|
||||
``USB_StandardRequests()`` function is provided (see ``module_usb_device``) which implements all of these requests. This includes the following items:
|
||||
|
||||
- Requests for standard descriptors (Device descriptor, configuration descriptor etc) and string descriptors
|
||||
- USB GET/SET INTERFACE requests
|
||||
- USB GET/SET_CONFIGURATION requests
|
||||
- USB SET_ADDRESS requests
|
||||
|
||||
For more information and full documentation, including full worked examples of simple devices, please refer to `lib_xud`.
|
||||
|
||||
The ``USB_StandardRequests()`` function takes the devices various descriptors as parameters, these are passed from data structures found in the ``descriptors.h`` file.
|
||||
These data structures are fully customised based on the how the design is configured using various defines (see :ref:`sec_custom_defines_api`).
|
||||
|
||||
The ``USB_StandardRequests()`` functions returns a ``XUD_Result_t``. ``XUD_RESULT_OKAY`` indicates that the request was fully handled without error and no further action is required
|
||||
- The device should move to receiving the next request from the host (via ``USB_GetSetupPacket()``).
|
||||
|
||||
The function returns ``XUD_RES_ERR`` if the request was not recognised by the ``USB_StandardRequests()`` function and a STALL has been issued.
|
||||
|
||||
The function may also return ``XUD_RES_RST`` if a bus-reset has been issued onto the bus by the host and communicated from XUD to Endpoint 0.
|
||||
|
||||
Since the ``USB_StandardRequests()`` function STALLs an unknown request, the endpoint 0 code must parse the ``USB_SetupPacket_t`` structure to handle device specific requests and then calling ``USB_StandardRequests()`` as required. This is described next.
|
||||
|
||||
Over-riding Standard Requests
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The USB Audio design "over-rides" some of the requests handled by ``USB_StandardRequests()``, for example it uses the SET_INTERFACE request to indicate it if the host is streaming audio to the device. In this case the setup packet is parsed, the relevant action taken, the ``USB_StandardRequests()`` is called to handle the response to the host etc.
|
||||
|
||||
Class Requests
|
||||
~~~~~~~~~~~~~~
|
||||
Before making the call to ``USB_StandardRequests()`` the setup packet is parsed for Class requests. These are handled in functions such as ``AudioClasRequests_2()``, ``AudioClassRequests_2``, ``DFUDeviceRequests()`` etc depending on the type of request.
|
||||
|
||||
Any device specific requests are handled - in this case Audio Class, MIDI class, DFU requests etc.
|
||||
|
||||
Some of the common Audio Class requests and their associated behaviour will now be examined.
|
||||
|
||||
Audio Requests
|
||||
++++++++++++++
|
||||
|
||||
When the host issues an audio request (e.g. sample rate or volume change), it sends a command to Endpoint 0. Like all requests this is returned from ``USB_GetSetupPacket()``. After some parsing (namely as Class Request to an Audio Interface) the request is handled by either the ``AudioClassRequests_1()`` or ``AudioClassRequests_2()`` function (based on whether the device is running in Audio Class 1.0 or 2.0 mode).
|
||||
|
||||
Note, Audio Class 1.0 Sample rate changes are send to the relevant endpoint, rather than the interface - this is handled as a special case in he endpoint 0 request parsing where ``AudioEndpointRequests_1()`` is called.
|
||||
|
||||
The ``AudioClassRequests_X()`` functions parses the request further in order to ascertain the correct audio operation to execute.
|
||||
|
||||
Audio Request: Set Sample Rate
|
||||
++++++++++++++++++++++++++++++
|
||||
|
||||
The ``AudioClassRequests_2()`` function parses the passed ``USB_SetupPacket_t`` structure for a ``CUR`` request of type ``SAM_FREQ_CNTROL`` to a Clock Unit in the devices topology (as described in the devices descriptors).
|
||||
|
||||
The new sample frequency is extracted and passed via channel to the rest of the design - through the buffering code and eventually to the Audio IO/I2S core. The ``AudioClassRequests_2()`` function waits for a handshake to propagate back though the system before signalling to the host that the request has completed successfully. Note, during this time the USB library is NAKing the host essentially holding off further traffic/requests until the sample-rate change is fully complete.
|
||||
|
||||
.. _usb_audio_sec_audio-requ-volume:
|
||||
|
||||
Audio Request: Volume Control
|
||||
+++++++++++++++++++++++++++++
|
||||
|
||||
When the host requests a volume change, it
|
||||
sends an audio interface request to Endpoint 0. An array is
|
||||
maintained in the Endpoint 0 core that is updated with such a
|
||||
request.
|
||||
|
||||
When changing the volume, Endpoint 0 applies the master volume and
|
||||
channel volume, producing a single volume value for each channel.
|
||||
These are stored in the array.
|
||||
|
||||
The volume will either be handled by the ``decoupler`` core or the mixer
|
||||
component (if the mixer component is used). Handling the volume in the
|
||||
mixer gives the decoupler more performance to handle more channels.
|
||||
|
||||
If the effect of the volume control array on the audio input and
|
||||
output is implemented by the decoupler, the ``decoupler`` core
|
||||
reads the volume values from this array. Note that this array is shared
|
||||
between Endpoint 0 and the decoupler core. This is done in a safe
|
||||
manner, since only Endpoint 0 can write to the array, word update
|
||||
is atomic between cores and the decoupler core only reads from
|
||||
the array (ordering between writes and reads is unimportant in this
|
||||
case). Inline assembly is used by the decoupler core to access
|
||||
the array, avoiding the parallel usage checks of XC.
|
||||
|
||||
If volume control is implemented in the mixer, Endpoint 0 sends a mixer command to the mixer to change the volume. Mixer commands
|
||||
are described in :ref:`usb_audio_sec_mixer`.
|
||||
|
||||
Audio Endpoints (Endpoint Buffer and Decoupler)
|
||||
...............................................
|
||||
|
||||
Endpoint Buffer
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
All endpoints other that Endpoint 0 are handled in one core. This
|
||||
core is implemented in the file ``usb_buffer.xc``. This core is communicates directly with the XUD library.
|
||||
|
||||
The USB buffer core is also responsible for feedback calculation based on USB Start Of Frame
|
||||
(SOF) notification and reads from the port counter of a port connected to the master clock.
|
||||
|
||||
Decoupler
|
||||
~~~~~~~~~
|
||||
|
||||
The decoupler supplies the USB buffering core with buffers to
|
||||
transmit/receive audio data to/from the host. It marshals these buffers into
|
||||
FIFOs. The data from the FIFOs are then sent over XC channels to
|
||||
other parts of the system as they need it. This core also
|
||||
determines the size of each packet of audio sent to the host (thus
|
||||
matching the audio rate to the USB packet rate). The decoupler is
|
||||
implemented in the file ``decouple.xc``.
|
||||
|
||||
Audio Buffering Scheme
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
This scheme is executed by co-operation between the buffering
|
||||
core, the decouple core and the XUD library.
|
||||
|
||||
For data going from the device to the host the following scheme is
|
||||
used:
|
||||
|
||||
|
||||
#. The decouple core receives samples from the audio core and
|
||||
puts them into a FIFO. This FIFO is split into packets when data is
|
||||
entered into it. Packets are stored in a format consisting of their
|
||||
length in bytes followed by the data.
|
||||
|
||||
#. When the buffer cores needs a buffer to send to the XUD core
|
||||
(after sending the previous buffer), the decouple core is
|
||||
signalled (via a shared memory flag).
|
||||
|
||||
#. Upon this signal from the buffering core, the decouple core
|
||||
passes the next packet from the FIFO to the buffer core. It also
|
||||
signals to the XUD library that the buffer core is able to send a
|
||||
packet.
|
||||
|
||||
#. When the buffer core has sent this buffer, it signals to the
|
||||
decouple that the buffer has been sent and the decouple core
|
||||
moves the read pointer of the FIFO.
|
||||
|
||||
|
||||
For data going from the host to the device the following scheme is
|
||||
used:
|
||||
|
||||
|
||||
#. The decouple core passes a pointer to the buffering core
|
||||
pointing into a FIFO of data and signals to the XUD library that
|
||||
the buffering core is ready to receive.
|
||||
|
||||
#. The buffering core then reads a USB packet into the FIFO and
|
||||
signals to the decoupler that the packet has been read.
|
||||
|
||||
#. Upon receiving this signal the decoupler core updates the
|
||||
write pointer of the FIFO and provides a new pointer to the
|
||||
buffering core to fill.
|
||||
|
||||
#. Upon request from the audio core, the decoupler core sends
|
||||
samples to the audio core by reading samples out of the FIFO.
|
||||
|
||||
|
||||
Decoupler/Audio Core interaction
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
To meet timing requirements of the audio system, the decoupler
|
||||
core must respond to requests from the audio system to
|
||||
send/receive samples immediately. An interrupt handler
|
||||
is set up in the decoupler core to do this. The interrupt handler
|
||||
is implemented in the function ``handle_audio_request``.
|
||||
|
||||
The audio system sends a word over a channel to the decouple core to
|
||||
request sample transfer (using the build in outuint function).
|
||||
The receipt of this word in the channel
|
||||
causes the ``handle_audio_request`` interrupt to fire.
|
||||
|
||||
The first operation the interrupt handler does is to send back a word
|
||||
acknowledging the request (if there was a change of sample frequency
|
||||
a control token would instead be sent---the audio system uses a testct()
|
||||
to inspect for this case).
|
||||
|
||||
Sample transfer may now take place. First the audio subsystem transfers
|
||||
samples destined for the host, then the decouple core sends
|
||||
samples from the host to device. These transfers always take place
|
||||
in channel count sized chunks (i.e. ``NUM_USB_CHAN_OUT`` and
|
||||
``NUM_USB_CHAN_IN``). That is, if the device has 10 output channels and
|
||||
8 input channels, 10 samples are sent from the decouple core and 8 received
|
||||
every interrupt.
|
||||
|
||||
The complete communication scheme is shown in the table below (for non sample
|
||||
frequency change case):
|
||||
|
||||
|
||||
.. table:: Decouple/Audio System Channel Communication
|
||||
|
||||
+-----------------+-----------------+-----------------------------------------+
|
||||
| Decouple | Audio System | Note |
|
||||
+=================+=================+=========================================+
|
||||
| | outuint() | Audio system requests sample exchange |
|
||||
+-----------------+-----------------+-----------------------------------------+
|
||||
| inuint() | | Interrupt fires and inuint performed |
|
||||
+-----------------+-----------------+-----------------------------------------+
|
||||
| outuint() | | Decouple sends ack |
|
||||
+-----------------+-----------------+-----------------------------------------+
|
||||
| | testct() | Checks for CT indicating SF change |
|
||||
+-----------------+-----------------+-----------------------------------------+
|
||||
| | inuint() | Word indication ACK input (No SF change)|
|
||||
+-----------------+-----------------+-----------------------------------------+
|
||||
| inuint() | outuint() | Sample transfer (Device to Host) |
|
||||
+-----------------+-----------------+-----------------------------------------+
|
||||
| inuint() | outuint() | |
|
||||
+-----------------+-----------------+-----------------------------------------+
|
||||
| inuint() | outuint() | |
|
||||
+-----------------+-----------------+-----------------------------------------+
|
||||
| ... | | |
|
||||
+-----------------+-----------------+-----------------------------------------+
|
||||
| outuint() | inuint() | Sample transfer (Host to Device) |
|
||||
+-----------------+-----------------+-----------------------------------------+
|
||||
| outuint() | inuint() | |
|
||||
+-----------------+-----------------+-----------------------------------------+
|
||||
| outuint() | inuint() | |
|
||||
+-----------------+-----------------+-----------------------------------------+
|
||||
| outuint() | inuint() | |
|
||||
+-----------------+-----------------+-----------------------------------------+
|
||||
| ... | | |
|
||||
+-----------------+-----------------+-----------------------------------------+
|
||||
|
||||
.. note::
|
||||
The request and acknowledgement sent to/from Decouple to the Audio System is an "output underflow" sample
|
||||
value. If in PCM mode it will be 0, in DSD mode it will be DSD silence.
|
||||
This allows the buffering system to output a suitable underflow value without knowing the format of the stream
|
||||
(this is especially advantageous in the DSD over PCM (DoP) case)
|
||||
|
||||
Asynchronous Feedback
|
||||
+++++++++++++++++++++
|
||||
|
||||
The device uses a feedback endpoint to report the rate at which
|
||||
audio is output/input to/from external audio interfaces/devices. This feedback is in accordance with
|
||||
the *USB 2.0 Specification*.
|
||||
|
||||
This asynchronous clocking scheme means that the device is the clocking master than therefore
|
||||
means a high-quality local master clock source can be used.
|
||||
|
||||
After each received USB SOF token, the buffering core takes a time-stamp from a port clocked off
|
||||
the master clock. By subtracting the time-stamp taken at the previous SOF, the number of master
|
||||
clock ticks since the last SOF is calculated. From this the number of samples (as a fixed
|
||||
point number) between SOFs can be calculated.
|
||||
This count is aggregated over 128 SOFs and used as a basis for the feedback value.
|
||||
|
||||
The sending of feedback to the host is also handled in the USB buffering core via an explicit feedback
|
||||
IN endpoint. If both input and output is enabled then the feedback is implicit based on the audio stream
|
||||
sent to the host.
|
||||
|
||||
USB Rate Control
|
||||
++++++++++++++++
|
||||
|
||||
.. _usb_audio_sec_usb-rate-control:
|
||||
|
||||
The Audio core must consume data from USB
|
||||
and provide data to USB at the correct rate for the selected sample
|
||||
frequency. The *USB 2.0 Specification* states that the maximum
|
||||
variation on USB packets can be +/- 1 sample per USB frame. USB
|
||||
frames are sent at 8kHz, so on average for 48kHz each packet
|
||||
contains six samples per channel. The device uses Asynchronous mode,
|
||||
so the audio clock may drift and run faster or slower than the
|
||||
host. Hence, if the audio clock is slightly fast, the device may
|
||||
occasionally input/output seven samples rather than six. Alternatively,
|
||||
it may be slightly slow and input/output five samples rather than six.
|
||||
:ref:`usb_audio_samples_per_packet` shows the allowed number of samples
|
||||
per packet for each example audio frequency.
|
||||
|
||||
See USB Device Class Definition for Audio Data Formats v2.0 section 2.3.1.1
|
||||
for full details.
|
||||
|
||||
.. _usb_audio_samples_per_packet:
|
||||
|
||||
.. table:: Allowed samples per packet
|
||||
|
||||
+-----------------+-------------+-------------+
|
||||
| Frequency (kHz) | Min Packet | Max Packet |
|
||||
+=================+=============+=============+
|
||||
| 44.1 | 5 | 6 |
|
||||
+-----------------+-------------+-------------+
|
||||
| 48 | 5 | 7 |
|
||||
+-----------------+-------------+-------------+
|
||||
| 88.2 | 10 | 11 |
|
||||
+-----------------+-------------+-------------+
|
||||
| 96 | 11 | 13 |
|
||||
+-----------------+-------------+-------------+
|
||||
| 176.4 | 20 | 21 |
|
||||
+-----------------+-------------+-------------+
|
||||
| 192 | 23 | 25 |
|
||||
+-----------------+-------------+-------------+
|
||||
|
||||
|
||||
To implement this control, the decoupler core uses the feedback
|
||||
value calculated in the buffering core. This value is used to
|
||||
work out the size of the next packet it will insert into the audio
|
||||
FIFO.
|
||||
|
||||
|
||||
|
||||
.. .. _fig_usb_devices:
|
||||
|
||||
.. .. table:: USB interfaces presented to host
|
||||
.. :class: center
|
||||
..
|
||||
.. +-----------------------+----------------------------------+
|
||||
.. | **Mode** | **Interfaces** |
|
||||
.. +=======================+==================================+
|
||||
.. | Application mode | | Audio Class 2/Audio Class 1 |
|
||||
.. | | | DFU Class 1.1 |
|
||||
.. | | | MIDI Device Class 1.0 |
|
||||
.. +-----------------------+----------------------------------+
|
||||
.. | DFU mode | DFU Class 1.1 |
|
||||
.. +-----------------------+----------------------------------+
|
||||
|
||||
.. The device initially starts in Application mode.
|
||||
|
||||
|
||||
|
||||
|
||||
.. :ref:`usb_audio_sec_dfu` describes how DFU mode is used. The
|
||||
.. audio device class (1 or 2) is set at compile time---see :ref:`usb_audio_sec_custom_defines_api`.
|
||||
|
||||
|
||||
|
||||
.. Reset
|
||||
.. ~~~~~
|
||||
|
||||
.. On receiving a reset request, three steps occur:
|
||||
|
||||
.. #. Depending on the DFU state, the device may be set into DFU
|
||||
mode.
|
||||
|
||||
.. #. A XUD function is called to reset the endpoint structure and receive the new bus speed.
|
||||
|
||||
.. _usb_audio_sec_audio-requ-sett:
|
||||
@@ -1,48 +0,0 @@
|
||||
Audio Controls via Human Interface Device (HID)
|
||||
------------------------------------------------
|
||||
|
||||
The design supports simple audio controls such as play/pause, volume up/down etc via the USB Human
|
||||
Interface Device Class Specification.
|
||||
|
||||
This functionality is enabled by setting the ``HID_CONTROLS`` define to ``1``. Setting to ``0``
|
||||
disables this feature.
|
||||
|
||||
When turned on the following items are enabled:
|
||||
|
||||
#. HID descriptors are enabled in the Configuration Descriptor informing the host that the device has HID interface
|
||||
#. A Get Report Descriptor request is enabled in ``endpoint0``.
|
||||
#. Endpoint data handling is enabled in the ``buffer`` core
|
||||
|
||||
The Get Descriptor Request enabled in endpoint 0 returns the report descriptor for the HID device.
|
||||
This details the format of the HID reports returned from the device to the host. It maps a bit in
|
||||
the report to a function such as play/pause.
|
||||
|
||||
The USB Audio Framework implements a report descriptor that should fit most basic audio device controls.
|
||||
If further controls are necessary the HID Report Descriptor in ``descriptors.h`` should be modified.
|
||||
The default report size is 1 byte with the format as follows:
|
||||
|
||||
.. table:: Default HID Report Format
|
||||
|
||||
+-------------+-------------------------+
|
||||
| Bit | Function |
|
||||
+=============+=========================+
|
||||
| 0 | Play/Pause |
|
||||
+-------------+-------------------------+
|
||||
| 1 | Scan Next Track |
|
||||
+-------------+-------------------------+
|
||||
| 2 | Scan Prev Track |
|
||||
+-------------+-------------------------+
|
||||
| 3 | Volume Up |
|
||||
+-------------+-------------------------+
|
||||
| 4 | Volume Down |
|
||||
+-------------+-------------------------+
|
||||
| 5 | Mute |
|
||||
+-------------+-------------------------+
|
||||
| 6-7 | Unused |
|
||||
+-------------+-------------------------+
|
||||
|
||||
On each HID report request from the host the function ``Vendor_ReadHidButtons(unsigned char hidData[])`` is called from ``buffer()``. This function is passed an array ``hidData[]`` by reference. The programmer should report the state of his buttons into this array. For example, if a volume up command is desired, bit 3 should be set to 1, else 0.
|
||||
|
||||
Since the ``Vendor_ReadHidButtons()`` function is called from the ``buffer`` logical core, care should be taken not to add to much execution time to this function since this could cause issues with servicing other endpoints.
|
||||
|
||||
For a full example please see the HID section in :ref:`usb_audio_sec_l1_audio_sw`.
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
Apple MFi compatibility
|
||||
-----------------------
|
||||
|
||||
XMOS devices are capable of operating with Apple iPod, iPhone, and iPad devices
|
||||
that feature USB host support. Information regarding this functionality is
|
||||
protected by the Made For iPod (MFi) program and associated licensing.
|
||||
|
||||
Please contact XMOS for details and further documentation.
|
||||
@@ -1,7 +0,0 @@
|
||||
MIDI
|
||||
----
|
||||
|
||||
The MIDI driver implements a 31250 baud UART input and output. On receiving 32-bit USB MIDI events
|
||||
from the ``buffer`` core, it parses these and translates them to 8-bit MIDI messages which are sent
|
||||
over UART. Similarly, incoming 8-bit MIDI messages are aggregated into 32-bit USB-MIDI events an
|
||||
passed on to the ``buffer`` core. The MIDI core is implemented in the file ``usb_midi.xc``.
|
||||
@@ -1,181 +0,0 @@
|
||||
.. _usb_audio_sec_mixer:
|
||||
|
||||
Digital Mixer
|
||||
-------------
|
||||
|
||||
The mixer core(s) take outgoing audio from the decoupler core and incoming
|
||||
audio from the audio driver core. It then applies the volume to each
|
||||
channel and passes incoming audio on to the decoupler and outgoing
|
||||
audio to the audio driver. The volume update is achieved using the
|
||||
built-in 32bit to 64bit signed multiply-accumulate function
|
||||
(``macs``). The mixer is implemented in the file
|
||||
``mixer.xc``.
|
||||
|
||||
The mixer takes two cores and can perform eight mixes with
|
||||
up to 18 inputs at sample rates up to 96kHz and two mixes with up to 18
|
||||
inputs at higher sample rates. The component automatically moves
|
||||
down to two mixes when switching to a higher rate.
|
||||
|
||||
The mixer can take inputs from either:
|
||||
|
||||
* The USB outputs from the host---these samples come from the decoupler core.
|
||||
* The inputs from the audio interface on the device---these
|
||||
samples come from the audio driver.
|
||||
|
||||
Since the sum of these inputs may be more then the 18 possible mix
|
||||
inputs to each mixer, there is a mapping from all the
|
||||
possible inputs to the mixer inputs.
|
||||
|
||||
After the mix occurs, the final outputs are created. There are two
|
||||
output destinations:
|
||||
|
||||
* The USB inputs to the host---these samples are sent to the decoupler core.
|
||||
|
||||
* The outputs to the audio interface on the device---these samples
|
||||
are sent to the audio driver.
|
||||
|
||||
For each possible output, a mapping exists to tell the mixer what its
|
||||
source is. The possible sources are the USB outputs from the host, the
|
||||
inputs for the audio interface or the outputs from the mixer units.
|
||||
|
||||
As mentioned in :ref:`usb_audio_sec_audio-requ-volume`, the mixer can also
|
||||
handle volume setting. If the mixer is configured to handle volume but
|
||||
the number of mixes is set to zero (so the component is solely doing
|
||||
volume setting) then the component will use only one core.
|
||||
|
||||
Control
|
||||
~~~~~~~
|
||||
|
||||
The mixers can receive the following control commands from the Endpoint 0 core via a channel:
|
||||
|
||||
.. list-table:: Mixer Component Commands
|
||||
:header-rows: 1
|
||||
|
||||
* - Command
|
||||
- Description
|
||||
|
||||
* - ``SET_SAMPLES_TO_HOST_MAP``
|
||||
- Sets the source of one of the audio streams going to the host.
|
||||
|
||||
* - ``SET_SAMPLES_TO_DEVICE_MAP``
|
||||
- Sets the source of one of the audio streams going to the audio
|
||||
driver.
|
||||
|
||||
* - ``SET_MIX_MULT``
|
||||
- Sets the multiplier for one of the inputs to a mixer.
|
||||
|
||||
* - ``SET_MIX_MAP``
|
||||
- Sets the source of one of the inputs to a mixer.
|
||||
|
||||
* - ``SET_MIX_IN_VOL``
|
||||
- If volume adjustment is being done in the mixer, this command
|
||||
sets the volume multiplier of one of the USB audio inputs.
|
||||
|
||||
* - ``SET_MIX_OUT_VOL``
|
||||
- If volume adjustment is being done in the mixer, this command
|
||||
sets the volume multiplier of one of the USB audio outputs.
|
||||
|
||||
Host Control
|
||||
~~~~~~~~~~~~
|
||||
|
||||
The mixer can be controlled from a host PC by sending requests to Endpoint 0. XMOS provides a simple
|
||||
command line based sample application demonstrating how the mixer can be controlled.
|
||||
|
||||
For details, consult the README file in the host_usb_mixer_control directory.
|
||||
|
||||
The main requirements of this control are to
|
||||
|
||||
* Set the mapping of input channels into the mixer
|
||||
* Set the coefficients for each mixer output of each input
|
||||
* Set the mapping for physical outputs which can either come
|
||||
directly from the inputs or via the mixer.
|
||||
|
||||
There is enough flexibility within this configuration that there will often
|
||||
be multiple ways of creating the required solution.
|
||||
|
||||
Whilst using the XMOS Host control example application, consider setting the
|
||||
mixer to perform a loop-back from analogue inputs 1 and 2 to analogue
|
||||
outputs 1 and 2.
|
||||
|
||||
First consider the inputs to the mixer::
|
||||
|
||||
./xmos_mixer --display-aud-channel-map 0
|
||||
|
||||
displays which channels are mapped to which mixer inputs::
|
||||
|
||||
./xmos_mixer --display-aud-channel-map-sources 0
|
||||
|
||||
displays which channels could possibly be mapped to mixer inputs. Notice
|
||||
that analogue inputs 1 and 2 are on mixer inputs 10 and 11.
|
||||
|
||||
Now examine the audio output mapping::
|
||||
|
||||
./xmos_mixer --display-aud-channel-map 0
|
||||
|
||||
displays which channels are mapped to which outputs. By default all
|
||||
of these bypass the mixer. We can also see what all the possible
|
||||
mappings are::
|
||||
|
||||
./xmos_mixer --display-aud-channel-map-sources 0
|
||||
|
||||
So now map the first two mixer outputs to physical outputs 1 and 2::
|
||||
|
||||
./xmos_mixer --set-aud-channel-map 0 26
|
||||
./xmos_mixer --set-aud-channel-map 1 27
|
||||
|
||||
You can confirm the effect of this by re-checking the map::
|
||||
|
||||
./xmos_mixer --display-aud-channel-map 0
|
||||
|
||||
This now makes analogue outputs 1 and 2 come from the mixer, rather
|
||||
than directly from USB. However the mixer is still mapped to pass
|
||||
the USB channels through to the outputs, so there will still be no
|
||||
functional change yet.
|
||||
|
||||
The mixer nodes need to be individually set. They can be displayed
|
||||
with::
|
||||
|
||||
./xmos_mixer --display-mixer-nodes 0
|
||||
|
||||
To get the audio from the analogue inputs to outputs 1 and 2, nodes 80
|
||||
and 89 need to be set::
|
||||
|
||||
./xmos_mixer --set-value 0 80 0
|
||||
./xmos_mixer --set-value 0 89 0
|
||||
|
||||
At the same time, the original mixer outputs can be muted::
|
||||
|
||||
./xmos_mixer --set-value 0 0 -inf
|
||||
./xmos_mixer --set-value 0 9 -inf
|
||||
|
||||
Now audio inputs on analogue 1/2 should be heard on outputs 1/2.
|
||||
|
||||
As mentioned above, the flexibility of the mixer is such that there
|
||||
will be multiple ways to create a particular mix. Another option to
|
||||
create the same routing would be to change the mixer sources such that
|
||||
mixer 1/2 outputs come from the analogue inputs.
|
||||
|
||||
To demonstrate this, firstly undo the changes above::
|
||||
|
||||
./xmos_mixer --set-value 0 80 -inf
|
||||
./xmos_mixer --set-value 0 89 -inf
|
||||
./xmos_mixer --set-value 0 0 0
|
||||
./xmos_mixer --set-value 0 9 0
|
||||
|
||||
The mixer should now have the default values. The sources for mixer
|
||||
1/2 can now be changed::
|
||||
|
||||
./xmos_mixer --set-mixer-source 0 0 10
|
||||
./xmos_mixer --set-mixer-source 0 1 11
|
||||
|
||||
If you rerun::
|
||||
|
||||
./xmos_mixer --display-mixer-nodes 0
|
||||
|
||||
the first column now has AUD - Analogue 1 and 2 rather than DAW (Digital Audio Workstation i.e. the
|
||||
host) - Analogue 1 and 2 confirming the new mapping. Again, by playing audio into analogue inputs
|
||||
1/2 this can be heard looped through to analogue outputs 1/2.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
PDM Microphones
|
||||
---------------
|
||||
|
||||
Overview of PDM implemention
|
||||
----------------------------
|
||||
|
||||
The design is capable of integrating PDM microphones. The PDM stream from the microphones is converted
|
||||
to PCM and output to the host via USB.
|
||||
|
||||
Interfacing to the PDM microphones is done using the XMOS microphone array library (``lib_mic_array``).
|
||||
``lib_mic_array`` is designed to allow interfacing to PDM microphones coupled with efficient decimation
|
||||
to user selectable output sample rates.
|
||||
|
||||
.. note::
|
||||
The ``lib_mic_array`` library is only available for xCORE-200 series devices.
|
||||
|
||||
The following components of the library are used:
|
||||
|
||||
* PDM interface
|
||||
* Four channel decimators
|
||||
|
||||
|newpage|
|
||||
|
||||
|
||||
Up to sixteen PDM microphones can be attached to each high channel count PDM interface (``mic_array_pdm_rx()``).
|
||||
One to four processing tasks, ``mic_array_decimate_to_pcm_4ch()``, each process up to four channels. For 1-4
|
||||
channels the library requires two logical cores:
|
||||
|
||||
.. figure:: images/pdm_chan4.pdf
|
||||
:width: 100%
|
||||
|
||||
One to four channel count PDM interface
|
||||
|
||||
|
||||
for 5-8 channels three logical cores are required, as shown below:
|
||||
|
||||
.. figure:: images/pdm_chan8.pdf
|
||||
:width: 100%
|
||||
|
||||
Five to eight count PDM interface
|
||||
|
||||
The left most task, ``mic_array_pdm_rx()``, samples up to 8 microphones and filters the data to provide up to
|
||||
eight 384 KHz data streams, split in two streams of four channels. The processing thread
|
||||
decimates the signal to a user chosen sample rate (one of 48, 24, 16, 12 or 8 KHz).
|
||||
|
||||
More channels can be supported by increasing the number of cores dedicated to the PDM tasks. However, the current
|
||||
PDM mic integration into USB Audio limits itself to 8.
|
||||
|
||||
After the decimation to the output sample-rate various other steps take place e.g. DC offset elimination, gain correction
|
||||
and compensation etc. Please refer to ``lib_mic_array`` documention for further implementation detail and complete feature set.
|
||||
|
||||
|
||||
PDM Microphone Hardware Characteristics
|
||||
+++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
The PDM microphones need a *clock input* and provide the PDM signal on a *data output*. All PDM microphones share the same
|
||||
clock signal (buffered on the PCB as appropriate), and output onto eight data wires that are connected to a single 8-bit port:
|
||||
|
||||
.. _pdm_wire_table:
|
||||
|
||||
.. list-table:: PDM microphone data and signal wires
|
||||
:class: vertical-borders horizontal-borders
|
||||
|
||||
* - *CLOCK*
|
||||
- Clock line, the PDM clock the used by the microphones to
|
||||
drive the data out.
|
||||
* - *DQ_PDM*
|
||||
- The data from the PDM microphones on an 8 bit port.
|
||||
|
||||
The only port that is passed into ``lib_mic_array`` is the 8-bit data port. The library
|
||||
assumes that the input port is clocked using the PDM clock and requires no knowlege of the
|
||||
PDM clock source.
|
||||
|
||||
The input clock for the microphones can be generated in a multitude of
|
||||
ways. For example, a 3.072MHz clock can be generated on the board, or the xCORE can
|
||||
divide down 12.288 MHz master clock. Or, if clock accuracy is not important, the internal 100 MHz
|
||||
reference can be divided down to provide an approximate clock.
|
||||
|
||||
Integration of PDM Microphones into USB Audio
|
||||
+++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
A PDM microphone wrapper is called from ``main()`` and takes one channel argument connecting it to the rest of the system:
|
||||
|
||||
``pcm_pdm_mic(c_pdm_pcm);``
|
||||
|
||||
The implemetation of this function can be found in the file ``pcm_pdm_mics.xc``.
|
||||
|
||||
The first job of this function is to configure the ports/clocking for the microphones, this divides the external
|
||||
audio master clock input (on port ``p_mclk``) and outputs the divided clock to the microphones via the ``p_pdm_clk`` port::
|
||||
|
||||
configure_clock_src_divide(pdmclk, p_mclk, MCLK_TO_PDM_CLK_DIV);
|
||||
configure_port_clock_output(p_pdm_clk, pdmclk);
|
||||
configure_in_port(p_pdm_mics, pdmclk);
|
||||
start_clock(pdmclk);
|
||||
|
||||
It then runs the various cores required for the PDM interface and PDM to PCM conversion as discussed previously::
|
||||
|
||||
par
|
||||
{
|
||||
mic_array_pdm_rx(p_pdm_mics, c_4x_pdm_mic_0, c_4x_pdm_mic_1);
|
||||
mic_array_decimate_to_pcm_4ch(c_4x_pdm_mic_0, c_ds_output[0]);
|
||||
mic_array_decimate_to_pcm_4ch(c_4x_pdm_mic_1, c_ds_output[1]);
|
||||
pdm_process(c_ds_output, c_pcm_out);
|
||||
}
|
||||
|
||||
The ``pdm_process()`` task includes the main integration code, it takes audio from the ``lib_mic_array`` cores, buffers
|
||||
it, performs optional local processing and outputs it to the audio driver (TDM/I2S core).
|
||||
|
||||
This function simply makes a call to ``mic_array_get_next_time_domain_frame()`` in order to get a frame of PCM audio
|
||||
from the microphones. It then waits for an request for audio samples from the audio/I2S/TDM core via a channel and
|
||||
sends the frame of audio back over this channel.
|
||||
|
||||
Note, it is assumed that the system shares a global master-clock, therefore no additional buffering or rate-matching/conversion
|
||||
is required.
|
||||
@@ -1,51 +0,0 @@
|
||||
.. _usb_audio_sec_resource_usage:
|
||||
|
||||
Resource Usage
|
||||
--------------
|
||||
|
||||
The following table details the resource usage of each
|
||||
component of the reference design software.
|
||||
|
||||
.. table:: Resource Usage
|
||||
|
||||
+---------------+---------------+---------------------+-------------------------------------+
|
||||
| Component | Cores | Memory (KB) | Ports |
|
||||
+===============+===============+=====================+=====================================+
|
||||
| XUD library | 1 | 9 (6 code) | ULPI ports |
|
||||
| | | | |
|
||||
+---------------+---------------+---------------------+-------------------------------------+
|
||||
| Endpoint 0 | 1 | 17.5 (10.5 code) | none |
|
||||
+---------------+---------------+---------------------+-------------------------------------+
|
||||
| USB Buffering | 1 | 22.5 (1 code) | none |
|
||||
+---------------+---------------+---------------------+-------------------------------------+
|
||||
| Audio driver | 1 | 8.5 (6 code) | See :ref:`usb_audio_sec_audio` |
|
||||
+---------------+---------------+---------------------+-------------------------------------+
|
||||
| S/PDIF Tx | 1 | 3.5 (2 code) | 1 x 1 bit port |
|
||||
+---------------+---------------+---------------------+-------------------------------------+
|
||||
| S/PDIF Rx | 1 | 3.7 (3.7 code) | 1 x 1 bit port |
|
||||
+---------------+---------------+---------------------+-------------------------------------+
|
||||
| ADAT Rx | 1 | 3.2 (3.2 code) | 1 x 1 bit port |
|
||||
+---------------+---------------+---------------------+-------------------------------------+
|
||||
| Midi | 1 | 6.5 (1.5 code) | 2 x 1 bit ports |
|
||||
+---------------+---------------+---------------------+-------------------------------------+
|
||||
| Mixer | 2 | 8.7 (6.5 code) | |
|
||||
+---------------+---------------+---------------------+-------------------------------------+
|
||||
| ClockGen | 1 | 2.5 (2.4 code) | |
|
||||
+---------------+---------------+---------------------+-------------------------------------+
|
||||
|
||||
.. note::
|
||||
|
||||
These resource estimates are based on the multichannel reference design with
|
||||
all options of that design enabled. For fewer channels, the resource
|
||||
usage is likely to decrease.
|
||||
|
||||
.. note::
|
||||
|
||||
The XUD library requires an 80MIPS core to function correctly
|
||||
(i.e. on a 500MHz part only six cores can run).
|
||||
|
||||
.. note::
|
||||
|
||||
The ULPI ports are a fixed set of ports on the L-Series
|
||||
device. When using these ports, other ports are
|
||||
unavailable when ULPI is active. See the `XS1-L Hardware Design Checklist <http://www.xmos.com/published/xs1lcheck>`_ for further details.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user