forked from PAWPAW-Mirror/lib_xua
Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f035e1dc13 | ||
|
|
c5496ea994 | ||
|
|
b0db22a50b | ||
|
|
1f74f8c601 | ||
|
|
9f8a4e737f | ||
|
|
c57079cd4a | ||
|
|
5a78b5079f | ||
|
|
5b5ee132e0 | ||
|
|
15c3007d1c | ||
|
|
ab7a94a821 | ||
|
|
29156d5b19 | ||
|
|
5e5b2b7bd5 | ||
|
|
eebbb88fee | ||
|
|
db63b93ac1 | ||
|
|
32c783795b | ||
|
|
5b37c4d224 | ||
|
|
8fbe410e0e | ||
|
|
52b72285e0 | ||
|
|
2cfaff9221 | ||
|
|
0f4cb1ccb5 | ||
|
|
bd702db2c6 | ||
|
|
764fe0bfe9 | ||
|
|
f1d902306f | ||
|
|
74894341d1 | ||
|
|
a89df80da8 | ||
|
|
07ffd9221a | ||
|
|
7bbaff49af | ||
|
|
f970623edf | ||
|
|
b4c1587478 | ||
|
|
be682f2b72 | ||
|
|
86f531b6ea | ||
|
|
66e6894f95 | ||
|
|
a8a0feaf52 | ||
|
|
fc3e3636ec | ||
|
|
a796e1ee36 | ||
|
|
b49bd69abe | ||
|
|
ae550d5fc9 |
@@ -1,6 +1,18 @@
|
|||||||
lib_xua Change Log
|
lib_xua Change Log
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
HEAD
|
||||||
|
----
|
||||||
|
|
||||||
|
* ADDED: Support for XCommon CMake build system
|
||||||
|
* RESOLVED: Output volume control not enabled by default when MIXER disabled
|
||||||
|
* RESOLVED: Full 32bit result of volume processing not calculated when required
|
||||||
|
* RESOLVED: Input stream sending an erroneous zero-length packet when exiting underflow state
|
||||||
|
* RESOLVED Build failures when XUA_USB_EN = 0
|
||||||
|
* RESOLVED: Clock configuration issues when ADAT and S/PDIF receive are enabled (#352)
|
||||||
|
* CHANGED: QUAD_SPI_FLASH replaced by XUA_QUAD_SPI_FLASH (default: 1)
|
||||||
|
* CHANGED: UserBufferManagementInit() now takes a sample rate parameter
|
||||||
|
|
||||||
3.5.1
|
3.5.1
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ Required hardware
|
|||||||
.................
|
.................
|
||||||
|
|
||||||
The example code provided with the application has been implemented
|
The example code provided with the application has been implemented
|
||||||
and tested on the xCORE-200 Multi-channel Audio Board
|
and tested on the xCORE.ai Multi-channel Audio Board
|
||||||
|
|
||||||
Prerequisites
|
Prerequisites
|
||||||
.............
|
.............
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ void AudioHwConfig(unsigned samFreq, unsigned mClk, unsigned dsdMode,
|
|||||||
|
|
||||||
#endif // __XC__
|
#endif // __XC__
|
||||||
|
|
||||||
void UserBufferManagementInit();
|
void UserBufferManagementInit(unsigned samFreq);
|
||||||
|
|
||||||
void UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudioToUsb[]);
|
void UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudioToUsb[]);
|
||||||
|
|
||||||
|
|||||||
@@ -17,49 +17,49 @@
|
|||||||
* @brief Location (tile) of audio I/O. Default: 0
|
* @brief Location (tile) of audio I/O. Default: 0
|
||||||
*/
|
*/
|
||||||
#ifndef AUDIO_IO_TILE
|
#ifndef AUDIO_IO_TILE
|
||||||
#define AUDIO_IO_TILE (0)
|
#define AUDIO_IO_TILE (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Location (tile) of audio I/O. Default: 0
|
* @brief Location (tile) of audio I/O. Default: 0
|
||||||
*/
|
*/
|
||||||
#ifndef XUD_TILE
|
#ifndef XUD_TILE
|
||||||
#define XUD_TILE (0)
|
#define XUD_TILE (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Location (tile) of MIDI I/O. Default: AUDIO_IO_TILE
|
* @brief Location (tile) of MIDI I/O. Default: AUDIO_IO_TILE
|
||||||
*/
|
*/
|
||||||
#ifndef MIDI_TILE
|
#ifndef MIDI_TILE
|
||||||
#define MIDI_TILE AUDIO_IO_TILE
|
#define MIDI_TILE AUDIO_IO_TILE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Location (tile) of SPDIF Tx. Default: AUDIO_IO_TILE
|
* @brief Location (tile) of SPDIF Tx. Default: AUDIO_IO_TILE
|
||||||
*/
|
*/
|
||||||
#ifndef SPDIF_TX_TILE
|
#ifndef SPDIF_TX_TILE
|
||||||
#define SPDIF_TX_TILE AUDIO_IO_TILE
|
#define SPDIF_TX_TILE AUDIO_IO_TILE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Location (tile) of PDM Rx. Default: AUDIO_IO_TILE
|
* @brief Location (tile) of PDM Rx. Default: AUDIO_IO_TILE
|
||||||
*/
|
*/
|
||||||
#ifndef PDM_TILE
|
#ifndef PDM_TILE
|
||||||
#define PDM_TILE AUDIO_IO_TILE
|
#define PDM_TILE AUDIO_IO_TILE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Location (tile) of reference signal to CS2100. Default: AUDIO_IO_TILE
|
* @brief Location (tile) of reference signal to CS2100. Default: AUDIO_IO_TILE
|
||||||
*/
|
*/
|
||||||
#ifndef PLL_REF_TILE
|
#ifndef PLL_REF_TILE
|
||||||
#define PLL_REF_TILE AUDIO_IO_TILE
|
#define PLL_REF_TILE AUDIO_IO_TILE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Disable USB functionalty just leaving AudioHub
|
* @brief Disable USB functionalty just leaving AudioHub
|
||||||
*/
|
*/
|
||||||
#ifndef XUA_USB_EN
|
#ifndef XUA_USB_EN
|
||||||
#define XUA_USB_EN (1)
|
#define XUA_USB_EN (1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,10 +85,10 @@
|
|||||||
#if defined(NATIVE_DSD) && (NATIVE_DSD == 0)
|
#if defined(NATIVE_DSD) && (NATIVE_DSD == 0)
|
||||||
#undef NATIVE_DSD
|
#undef NATIVE_DSD
|
||||||
#else
|
#else
|
||||||
#define NATIVE_DSD 1 /* Always enable Native DSD when DSD mode is enabled */
|
#define NATIVE_DSD (1) /* Always enable Native DSD when DSD mode is enabled */
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define DSD_CHANS_DAC 0
|
#define DSD_CHANS_DAC (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define XUA_PCM_FORMAT_I2S (0)
|
#define XUA_PCM_FORMAT_I2S (0)
|
||||||
@@ -103,7 +103,7 @@
|
|||||||
#error Bad value for XUA_PCM_FORMAT
|
#error Bad value for XUA_PCM_FORMAT
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define XUA_PCM_FORMAT XUA_PCM_FORMAT_I2S
|
#define XUA_PCM_FORMAT XUA_PCM_FORMAT_I2S
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,9 +114,9 @@
|
|||||||
**/
|
**/
|
||||||
#ifndef I2S_CHANS_PER_FRAME
|
#ifndef I2S_CHANS_PER_FRAME
|
||||||
#if (XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM)
|
#if (XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM)
|
||||||
#define I2S_CHANS_PER_FRAME 8
|
#define I2S_CHANS_PER_FRAME (8)
|
||||||
#else
|
#else
|
||||||
#define I2S_CHANS_PER_FRAME 2
|
#define I2S_CHANS_PER_FRAME (2)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@
|
|||||||
#error I2S_CHANS_ADC not defined
|
#error I2S_CHANS_ADC not defined
|
||||||
#define I2S_CHANS_ADC 2 /* Define anyway for doxygen */
|
#define I2S_CHANS_ADC 2 /* Define anyway for doxygen */
|
||||||
#else
|
#else
|
||||||
#define I2S_WIRES_ADC (I2S_CHANS_ADC / I2S_CHANS_PER_FRAME)
|
#define I2S_WIRES_ADC (I2S_CHANS_ADC / I2S_CHANS_PER_FRAME)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -153,7 +153,7 @@
|
|||||||
* Default: 1 i.e. I2S and USB Audio are running at the same sample rate.
|
* Default: 1 i.e. I2S and USB Audio are running at the same sample rate.
|
||||||
*/
|
*/
|
||||||
#ifndef AUD_TO_USB_RATIO
|
#ifndef AUD_TO_USB_RATIO
|
||||||
#define AUD_TO_USB_RATIO (1)
|
#define AUD_TO_USB_RATIO (1)
|
||||||
#else
|
#else
|
||||||
#if (AUD_TO_USB_RATIO != 3) && (AUD_TO_USB_RATIO != 1)
|
#if (AUD_TO_USB_RATIO != 3) && (AUD_TO_USB_RATIO != 1)
|
||||||
#error Unsupported I2S to USB Audio sample rate ratio
|
#error Unsupported I2S to USB Audio sample rate ratio
|
||||||
@@ -167,7 +167,7 @@
|
|||||||
* Default: 1 i.e. I2S and PDM microphone decimators are running at the same sample rate.
|
* Default: 1 i.e. I2S and PDM microphone decimators are running at the same sample rate.
|
||||||
*/
|
*/
|
||||||
#ifndef AUD_TO_MICS_RATIO
|
#ifndef AUD_TO_MICS_RATIO
|
||||||
#define AUD_TO_MICS_RATIO (1)
|
#define AUD_TO_MICS_RATIO (1)
|
||||||
#else
|
#else
|
||||||
#if (AUD_TO_MICS_RATIO != 3) && (AUD_TO_MICS_RATIO != 1)
|
#if (AUD_TO_MICS_RATIO != 3) && (AUD_TO_MICS_RATIO != 1)
|
||||||
#error Unsupported I2S to PDM microphone decimator sample rate ratio
|
#error Unsupported I2S to PDM microphone decimator sample rate ratio
|
||||||
@@ -180,7 +180,7 @@
|
|||||||
* Default: 0 i.e. mono mode is disabled, all input channels will be downsampled.
|
* Default: 0 i.e. mono mode is disabled, all input channels will be downsampled.
|
||||||
*/
|
*/
|
||||||
#ifndef I2S_DOWNSAMPLE_MONO_IN
|
#ifndef I2S_DOWNSAMPLE_MONO_IN
|
||||||
#define I2S_DOWNSAMPLE_MONO_IN (0)
|
#define I2S_DOWNSAMPLE_MONO_IN (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -203,7 +203,7 @@
|
|||||||
* Default: 32 bits
|
* Default: 32 bits
|
||||||
*/
|
*/
|
||||||
#ifndef XUA_I2S_N_BITS
|
#ifndef XUA_I2S_N_BITS
|
||||||
#define XUA_I2S_N_BITS (32)
|
#define XUA_I2S_N_BITS (32)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (XUA_I2S_N_BITS != 16) && (XUA_I2S_N_BITS != 32)
|
#if (XUA_I2S_N_BITS != 16) && (XUA_I2S_N_BITS != 32)
|
||||||
@@ -241,7 +241,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Default device sample frequency. A safe default should be used. Default: MIN_FREQ
|
* @brief Default device sample frequency. A safe default should be used.
|
||||||
|
*
|
||||||
|
* Default: MIN_FREQ
|
||||||
*/
|
*/
|
||||||
#ifndef DEFAULT_FREQ
|
#ifndef DEFAULT_FREQ
|
||||||
#define DEFAULT_FREQ (MIN_FREQ)
|
#define DEFAULT_FREQ (MIN_FREQ)
|
||||||
@@ -250,17 +252,21 @@
|
|||||||
/* Audio Class Defines */
|
/* Audio Class Defines */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief USB Audio Class Version. Default: 2 (Audio Class version 2.0)
|
* @brief USB Audio Class Version.
|
||||||
|
*
|
||||||
|
* Default: 2 (Audio Class version 2.0)
|
||||||
*/
|
*/
|
||||||
#ifndef AUDIO_CLASS
|
#ifndef AUDIO_CLASS
|
||||||
#define AUDIO_CLASS 2
|
#define AUDIO_CLASS (2)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Whether or not to fall back to Audio Class 1.0 in USB Full-speed. Default: 0 (Disabled)
|
* @brief Whether or not to fall back to Audio Class 1.0 in USB Full-speed.
|
||||||
|
*
|
||||||
|
* Default: 0 (Disabled i.e. do not fall back to UAC 1.0
|
||||||
*/
|
*/
|
||||||
#ifndef AUDIO_CLASS_FALLBACK
|
#ifndef AUDIO_CLASS_FALLBACK
|
||||||
#define AUDIO_CLASS_FALLBACK 0 /* Default to not falling back to UAC 1 */
|
#define AUDIO_CLASS_FALLBACK (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -272,7 +278,7 @@
|
|||||||
#if (AUDIO_CLASS == 2)
|
#if (AUDIO_CLASS == 2)
|
||||||
/* Whether to run in Audio Class 2.0 mode in USB Full-speed */
|
/* Whether to run in Audio Class 2.0 mode in USB Full-speed */
|
||||||
#if !defined(FULL_SPEED_AUDIO_2) && (AUDIO_CLASS_FALLBACK == 0)
|
#if !defined(FULL_SPEED_AUDIO_2) && (AUDIO_CLASS_FALLBACK == 0)
|
||||||
#define FULL_SPEED_AUDIO_2 1 /* Default to falling back to UAC2 */
|
#define FULL_SPEED_AUDIO_2 (1) /* Default to falling back to UAC2 */
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -293,10 +299,12 @@
|
|||||||
/* Feature defines */
|
/* Feature defines */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Number of PDM microphones in the design. Default: None
|
* @brief Number of PDM microphones in the design.
|
||||||
|
*
|
||||||
|
* Default: None
|
||||||
*/
|
*/
|
||||||
#ifndef XUA_NUM_PDM_MICS
|
#ifndef XUA_NUM_PDM_MICS
|
||||||
#define XUA_NUM_PDM_MICS (0)
|
#define XUA_NUM_PDM_MICS (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -310,14 +318,18 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Size of a frame of microphone data samples. Default: 1
|
* @brief Size of a frame of microphone data samples.
|
||||||
|
*
|
||||||
|
* Default: 1
|
||||||
*/
|
*/
|
||||||
#ifndef XUA_MIC_FRAME_SIZE
|
#ifndef XUA_MIC_FRAME_SIZE
|
||||||
#define XUA_MIC_FRAME_SIZE (1)
|
#define XUA_MIC_FRAME_SIZE (1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enable MIDI functionality including buffering, descriptors etc. Default: DISABLED
|
* @brief Enable MIDI functionality including buffering, descriptors etc.
|
||||||
|
*
|
||||||
|
* Default: 0 (Disabled)
|
||||||
*/
|
*/
|
||||||
#ifndef MIDI
|
#ifndef MIDI
|
||||||
#define MIDI (0)
|
#define MIDI (0)
|
||||||
@@ -338,7 +350,7 @@
|
|||||||
* @brief Enables SPDIF Tx. Default: 0 (Disabled)
|
* @brief Enables SPDIF Tx. Default: 0 (Disabled)
|
||||||
*/
|
*/
|
||||||
#ifndef XUA_SPDIF_TX_EN
|
#ifndef XUA_SPDIF_TX_EN
|
||||||
#define XUA_SPDIF_TX_EN (0)
|
#define XUA_SPDIF_TX_EN (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -347,14 +359,16 @@
|
|||||||
* Default: 0 (i.e. channels 0 & 1)
|
* Default: 0 (i.e. channels 0 & 1)
|
||||||
* */
|
* */
|
||||||
#ifndef SPDIF_TX_INDEX
|
#ifndef SPDIF_TX_INDEX
|
||||||
#define SPDIF_TX_INDEX (0)
|
#define SPDIF_TX_INDEX (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enables ADAT Tx. Default: 0 (Disabled)
|
* @brief Enables ADAT Tx.
|
||||||
|
*
|
||||||
|
* Default: 0 (Disabled)
|
||||||
*/
|
*/
|
||||||
#ifndef XUA_ADAT_TX_EN
|
#ifndef XUA_ADAT_TX_EN
|
||||||
#define XUA_ADAT_TX_EN (0)
|
#define XUA_ADAT_TX_EN (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -363,21 +377,25 @@
|
|||||||
* Default: 0 (i.e. channels [0:7])
|
* Default: 0 (i.e. channels [0:7])
|
||||||
* */
|
* */
|
||||||
#ifndef ADAT_TX_INDEX
|
#ifndef ADAT_TX_INDEX
|
||||||
#define ADAT_TX_INDEX (0)
|
#define ADAT_TX_INDEX (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enables SPDIF Rx. Default: 0 (Disabled)
|
* @brief Enables SPDIF Rx.
|
||||||
|
*
|
||||||
|
* Default: 0 (Disabled)
|
||||||
*/
|
*/
|
||||||
#ifndef XUA_SPDIF_RX_EN
|
#ifndef XUA_SPDIF_RX_EN
|
||||||
#define XUA_SPDIF_RX_EN (0)
|
#define XUA_SPDIF_RX_EN (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enables ADAT Rx. Default: 0 (Disabled)
|
* @brief Enables ADAT Rx.
|
||||||
|
*
|
||||||
|
* Default: 0 (Disabled)
|
||||||
*/
|
*/
|
||||||
#ifndef XUA_ADAT_RX_EN
|
#ifndef XUA_ADAT_RX_EN
|
||||||
#define XUA_ADAT_RX_EN (0)
|
#define XUA_ADAT_RX_EN (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -432,11 +450,20 @@
|
|||||||
* Default: 1 (Enabled)
|
* Default: 1 (Enabled)
|
||||||
*/
|
*/
|
||||||
#if !defined(XUA_DFU_EN)
|
#if !defined(XUA_DFU_EN)
|
||||||
#define XUA_DFU_EN (1)
|
#define XUA_DFU_EN (1)
|
||||||
#elif defined(XUA_DFU_EN) && (XUA_DFU_EN == 0)
|
#elif defined(XUA_DFU_EN) && (XUA_DFU_EN == 0)
|
||||||
#undef XUA_DFU_EN
|
#undef XUA_DFU_EN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Use a QSPI (rather than SPI) flash for DFU (and boot)
|
||||||
|
*
|
||||||
|
* Default: 1 (True i.e use QSPI flash)
|
||||||
|
*/
|
||||||
|
#if !defined(XUA_QUAD_SPI_FLASH)
|
||||||
|
#define XUA_QUAD_SPI_FLASH (1)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enable HID playback controls functionality.
|
* @brief Enable HID playback controls functionality.
|
||||||
*
|
*
|
||||||
@@ -445,7 +472,7 @@
|
|||||||
* Default 0 (Disabled)
|
* Default 0 (Disabled)
|
||||||
*/
|
*/
|
||||||
#ifndef HID_CONTROLS
|
#ifndef HID_CONTROLS
|
||||||
#define HID_CONTROLS (0)
|
#define HID_CONTROLS (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -479,7 +506,7 @@
|
|||||||
* Default 0 (Disabled)
|
* Default 0 (Disabled)
|
||||||
*/
|
*/
|
||||||
#ifndef HID_OUT_REQUIRED
|
#ifndef HID_OUT_REQUIRED
|
||||||
#define HID_OUT_REQUIRED (0)
|
#define HID_OUT_REQUIRED (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -490,7 +517,7 @@
|
|||||||
* Default: 0 (XMOS is master)
|
* Default: 0 (XMOS is master)
|
||||||
*/
|
*/
|
||||||
#ifndef CODEC_MASTER
|
#ifndef CODEC_MASTER
|
||||||
#define CODEC_MASTER (0)
|
#define CODEC_MASTER (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -499,7 +526,7 @@
|
|||||||
* Default: ""
|
* Default: ""
|
||||||
*/
|
*/
|
||||||
#ifndef SERIAL_STR
|
#ifndef SERIAL_STR
|
||||||
#define SERIAL_STR ""
|
#define SERIAL_STR ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -508,7 +535,7 @@
|
|||||||
* Default: "XMOS"
|
* Default: "XMOS"
|
||||||
*/
|
*/
|
||||||
#ifndef VENDOR_STR
|
#ifndef VENDOR_STR
|
||||||
#define VENDOR_STR "XMOS"
|
#define VENDOR_STR "XMOS"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -517,7 +544,7 @@
|
|||||||
* Default: 0x20B1 (XMOS)
|
* Default: 0x20B1 (XMOS)
|
||||||
*/
|
*/
|
||||||
#ifndef VENDOR_ID
|
#ifndef VENDOR_ID
|
||||||
#define VENDOR_ID (0x20B1)
|
#define VENDOR_ID (0x20B1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -559,7 +586,7 @@
|
|||||||
*/
|
*/
|
||||||
#if (AUDIO_CLASS == 1) || (AUDIO_CLASS_FALLBACK) || defined(__DOXYGEN__)
|
#if (AUDIO_CLASS == 1) || (AUDIO_CLASS_FALLBACK) || defined(__DOXYGEN__)
|
||||||
#ifndef PID_AUDIO_1
|
#ifndef PID_AUDIO_1
|
||||||
#define PID_AUDIO_1 (0x0003)
|
#define PID_AUDIO_1 (0x0003)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -569,28 +596,28 @@
|
|||||||
* Default: 0x0002
|
* Default: 0x0002
|
||||||
*/
|
*/
|
||||||
#ifndef PID_AUDIO_2
|
#ifndef PID_AUDIO_2
|
||||||
#define PID_AUDIO_2 (0x0002)
|
#define PID_AUDIO_2 (0x0002)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number.
|
* @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
|
#ifndef BCD_DEVICE_J
|
||||||
#define BCD_DEVICE_J (1)
|
#define BCD_DEVICE_J (1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number.
|
* @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
|
#ifndef BCD_DEVICE_M
|
||||||
#define BCD_DEVICE_M (2)
|
#define BCD_DEVICE_M (2)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number.
|
* @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
|
#ifndef BCD_DEVICE_N
|
||||||
#define BCD_DEVICE_N (0)
|
#define BCD_DEVICE_N (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1045,7 +1072,7 @@
|
|||||||
* Default: 0 (Disabled)
|
* Default: 0 (Disabled)
|
||||||
*/
|
*/
|
||||||
#ifndef MIXER
|
#ifndef MIXER
|
||||||
#define MIXER (0)
|
#define MIXER (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1055,11 +1082,11 @@
|
|||||||
*/
|
*/
|
||||||
#if (MIXER)
|
#if (MIXER)
|
||||||
#ifndef MAX_MIX_COUNT
|
#ifndef MAX_MIX_COUNT
|
||||||
#define MAX_MIX_COUNT (8)
|
#define MAX_MIX_COUNT (8)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#ifndef MAX_MIX_COUNT
|
#ifndef MAX_MIX_COUNT
|
||||||
#define MAX_MIX_COUNT (0)
|
#define MAX_MIX_COUNT (0)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1071,7 +1098,7 @@
|
|||||||
* Default: 18
|
* Default: 18
|
||||||
*/
|
*/
|
||||||
#ifndef MIX_INPUTS
|
#ifndef MIX_INPUTS
|
||||||
#define MIX_INPUTS (18)
|
#define MIX_INPUTS (18)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Volume processing defines */
|
/* Volume processing defines */
|
||||||
@@ -1083,7 +1110,7 @@
|
|||||||
* Default: 0x8100 (-127db)
|
* Default: 0x8100 (-127db)
|
||||||
*/
|
*/
|
||||||
#ifndef MIN_VOLUME
|
#ifndef MIN_VOLUME
|
||||||
#define MIN_VOLUME (0x8100)
|
#define MIN_VOLUME (0x8100)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -1093,7 +1120,7 @@
|
|||||||
* Default: 0x0000 (0db)
|
* Default: 0x0000 (0db)
|
||||||
*/
|
*/
|
||||||
#ifndef MAX_VOLUME
|
#ifndef MAX_VOLUME
|
||||||
#define MAX_VOLUME (0x0000)
|
#define MAX_VOLUME (0x0000)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1102,7 +1129,7 @@
|
|||||||
* Default: 0x100 (1db)
|
* Default: 0x100 (1db)
|
||||||
*/
|
*/
|
||||||
#ifndef VOLUME_RES
|
#ifndef VOLUME_RES
|
||||||
#define VOLUME_RES (0x100)
|
#define VOLUME_RES (0x100)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1112,7 +1139,7 @@
|
|||||||
* Default: 0x8100 (-127db)
|
* Default: 0x8100 (-127db)
|
||||||
*/
|
*/
|
||||||
#ifndef MIN_MIXER_VOLUME
|
#ifndef MIN_MIXER_VOLUME
|
||||||
#define MIN_MIXER_VOLUME (0x8100)
|
#define MIN_MIXER_VOLUME (0x8100)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1121,7 +1148,7 @@
|
|||||||
* Default: 0x0000 (0db)
|
* Default: 0x0000 (0db)
|
||||||
*/
|
*/
|
||||||
#ifndef MAX_MIXER_VOLUME
|
#ifndef MAX_MIXER_VOLUME
|
||||||
#define MAX_MIXER_VOLUME (0x0000)
|
#define MAX_MIXER_VOLUME (0x0000)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1130,32 +1157,36 @@
|
|||||||
* Default: 0x100 (1db)
|
* Default: 0x100 (1db)
|
||||||
*/
|
*/
|
||||||
#ifndef VOLUME_RES_MIXER
|
#ifndef VOLUME_RES_MIXER
|
||||||
#define VOLUME_RES_MIXER (0x100)
|
#define VOLUME_RES_MIXER (0x100)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Handle out volume control in the mixer - enabled by default */
|
/* Handle out volume control in the mixer - enabled by default if mixer enabled */
|
||||||
#ifndef OUT_VOLUME_IN_MIXER
|
#ifndef OUT_VOLUME_IN_MIXER
|
||||||
#define OUT_VOLUME_IN_MIXER (1)
|
#if MIXER
|
||||||
|
#define OUT_VOLUME_IN_MIXER (1)
|
||||||
|
#else
|
||||||
|
#define OUT_VOLUME_IN_MIXER (0)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Apply out volume controls after the mix. Only relevant when OUT_VOLUME_IN_MIXER enabled. Enabled by default */
|
/* Apply out volume controls after the mix. Only relevant when OUT_VOLUME_IN_MIXER enabled. Enabled by default */
|
||||||
#ifndef OUT_VOLUME_AFTER_MIX
|
#ifndef OUT_VOLUME_AFTER_MIX
|
||||||
#define OUT_VOLUME_AFTER_MIX (1)
|
#define OUT_VOLUME_AFTER_MIX (1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Handle in volume control in the mixer - disabled by default */
|
/* Handle in volume control in the mixer - disabled by default */
|
||||||
#ifndef IN_VOLUME_IN_MIXER
|
#ifndef IN_VOLUME_IN_MIXER
|
||||||
#define IN_VOLUME_IN_MIXER (0)
|
#define IN_VOLUME_IN_MIXER (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Apply in volume controls after the mix. Only relebant when IN_VOLUMNE_IN MIXER enabled. Enabled by default */
|
/* Apply in volume controls after the mix. Only relevant when IN_VOLUMNE_IN MIXER enabled. Enabled by default */
|
||||||
#ifndef IN_VOLUME_AFTER_MIX
|
#ifndef IN_VOLUME_AFTER_MIX
|
||||||
#define IN_VOLUME_AFTER_MIX (1)
|
#define IN_VOLUME_AFTER_MIX (1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Always enable explicit feedback EP, even when input stream is present */
|
/* Always enable explicit feedback EP, even when input stream is present */
|
||||||
#ifndef UAC_FORCE_FEEDBACK_EP
|
#ifndef UAC_FORCE_FEEDBACK_EP
|
||||||
#define UAC_FORCE_FEEDBACK_EP (1)
|
#define UAC_FORCE_FEEDBACK_EP (1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(UAC_FORCE_FEEDBACK_EP) && UAC_FORCE_FEEDBACK_EP == 0)
|
#if (defined(UAC_FORCE_FEEDBACK_EP) && UAC_FORCE_FEEDBACK_EP == 0)
|
||||||
@@ -1163,9 +1194,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Synchronisation defines */
|
/* Synchronisation defines */
|
||||||
#define XUA_SYNCMODE_ASYNC (1) // USB_ENDPOINT_SYNCTYPE_ASYNC
|
#define XUA_SYNCMODE_ASYNC (1) // USB_ENDPOINT_SYNCTYPE_ASYNC
|
||||||
#define XUA_SYNCMODE_ADAPT (2) // USB_ENDPOINT_SYNCTYPE_ADAPT
|
#define XUA_SYNCMODE_ADAPT (2) // USB_ENDPOINT_SYNCTYPE_ADAPT
|
||||||
#define XUA_SYNCMODE_SYNC (3) // USB_ENDPOINT_SYNCTYPE_SYNC
|
#define XUA_SYNCMODE_SYNC (3) // USB_ENDPOINT_SYNCTYPE_SYNC
|
||||||
|
|
||||||
#ifndef XUA_SYNCMODE
|
#ifndef XUA_SYNCMODE
|
||||||
#define XUA_SYNCMODE XUA_SYNCMODE_ASYNC
|
#define XUA_SYNCMODE XUA_SYNCMODE_ASYNC
|
||||||
@@ -1245,8 +1276,6 @@ enum USBEndpointNumber_Out
|
|||||||
#endif /* __ASSEMBLER__ */
|
#endif /* __ASSEMBLER__ */
|
||||||
|
|
||||||
#define AUDIO_STOP_FOR_DFU (0x12345678)
|
#define AUDIO_STOP_FOR_DFU (0x12345678)
|
||||||
#define AUDIO_START_FROM_DFU (0x87654321)
|
|
||||||
#define AUDIO_REBOOT_FROM_DFU (0xa5a5a5a5)
|
|
||||||
|
|
||||||
/* Result of db_to_mult(MAX_VOLUME, 8, 29) */
|
/* Result of db_to_mult(MAX_VOLUME, 8, 29) */
|
||||||
#define MAX_VOLUME_MULT (0x20000000)
|
#define MAX_VOLUME_MULT (0x20000000)
|
||||||
@@ -1349,7 +1378,7 @@ enum USBEndpointNumber_Out
|
|||||||
/* Some defines that allow us to remove unused code */
|
/* Some defines that allow us to remove unused code */
|
||||||
|
|
||||||
/* Useful for dropping lower part of macs in volume processing... */
|
/* Useful for dropping lower part of macs in volume processing... */
|
||||||
#if (FS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS > 24) || (HS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS > 24) || \
|
#if (FS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS > 24) || (HS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS > 24) || \
|
||||||
(((FS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS > 24) || (HS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS > 24)) && (OUTPUT_FORMAT_COUNT > 1)) || \
|
(((FS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS > 24) || (HS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS > 24)) && (OUTPUT_FORMAT_COUNT > 1)) || \
|
||||||
(((FS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS > 24) || (HS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS > 24)) && (OUTPUT_FORMAT_COUNT > 2))
|
(((FS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS > 24) || (HS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS > 24)) && (OUTPUT_FORMAT_COUNT > 2))
|
||||||
#define STREAM_FORMAT_OUTPUT_RESOLUTION_32BIT_USED 1
|
#define STREAM_FORMAT_OUTPUT_RESOLUTION_32BIT_USED 1
|
||||||
@@ -1383,29 +1412,29 @@ enum USBEndpointNumber_Out
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Useful for dropping lower part of macs in volume processing... */
|
/* Useful for dropping lower part of macs in volume processing... */
|
||||||
#if (FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS > 24) || (FS_STREAM_FORMAT_INPUT_2_RESOLUTION_BITS > 24)
|
#if (FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS > 24) || (HS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS > 24)
|
||||||
#define STREAM_FORMAT_INPUT_RESOLUTION_32BIT_USED 1
|
#define STREAM_FORMAT_INPUT_RESOLUTION_32BIT_USED 1
|
||||||
#else
|
#else
|
||||||
#define STREAM_FORMAT_INPUT_RESOLUTION_32BIT_USED 0
|
#define STREAM_FORMAT_INPUT_RESOLUTION_32BIT_USED 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if((FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES == 4) || (HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES == 4))
|
#if((FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES == 4) || (HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES == 4))
|
||||||
#define STREAM_FORMAT_INPUT_SUBSLOT_4_USED 1
|
#define STREAM_FORMAT_INPUT_SUBSLOT_4_USED 1
|
||||||
#else
|
#else
|
||||||
#define STREAM_FORMAT_INPUT_SUBSLOT_4_USED 0
|
#define STREAM_FORMAT_INPUT_SUBSLOT_4_USED 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if((FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES == 3) || (HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES == 3))
|
#if((FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES == 3) || (HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES == 3))
|
||||||
#define STREAM_FORMAT_INPUT_SUBSLOT_3_USED 1
|
#define STREAM_FORMAT_INPUT_SUBSLOT_3_USED 1
|
||||||
#else
|
#else
|
||||||
#define STREAM_FORMAT_INPUT_SUBSLOT_3_USED 0
|
#define STREAM_FORMAT_INPUT_SUBSLOT_3_USED 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if((FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES == 2) || (HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES == 2))
|
#if((FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES == 2) || (HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES == 2))
|
||||||
#define STREAM_FORMAT_INPUT_SUBSLOT_2_USED 1
|
#define STREAM_FORMAT_INPUT_SUBSLOT_2_USED 1
|
||||||
#else
|
#else
|
||||||
#define STREAM_FORMAT_INPUT_SUBSLOT_2_USED 0
|
#define STREAM_FORMAT_INPUT_SUBSLOT_2_USED 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MAX_FREQ < MIN_FREQ
|
#if MAX_FREQ < MIN_FREQ
|
||||||
#error MAX_FREQ should be >= MIN_FREQ!!
|
#error MAX_FREQ should be >= MIN_FREQ!!
|
||||||
|
|||||||
51
lib_xua/lib_build_info.cmake
Normal file
51
lib_xua/lib_build_info.cmake
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
set(LIB_NAME lib_xua)
|
||||||
|
set(LIB_VERSION 3.5.1)
|
||||||
|
set(LIB_INCLUDES api
|
||||||
|
src/core
|
||||||
|
src/core/audiohub
|
||||||
|
src/core/buffer/ep
|
||||||
|
src/core/endpoint0
|
||||||
|
src/dfu
|
||||||
|
src/core/buffer/decouple
|
||||||
|
src/core/clocking
|
||||||
|
src/core/mixer
|
||||||
|
src/core/pdm_mics
|
||||||
|
src/core/ports
|
||||||
|
src/core/support
|
||||||
|
src/core/user
|
||||||
|
src/core/user/audiostream
|
||||||
|
src/core/user/hid
|
||||||
|
src/core/user/hostactive
|
||||||
|
src/hid
|
||||||
|
src/midi)
|
||||||
|
set(LIB_OPTIONAL_HEADERS xua_conf.h static_hid_report.h)
|
||||||
|
set(LIB_DEPENDENT_MODULES "lib_locks"
|
||||||
|
"lib_logging"
|
||||||
|
"lib_mic_array(feature/xcommon_cmake)"
|
||||||
|
"lib_spdif"
|
||||||
|
"lib_xassert"
|
||||||
|
"lib_xud"
|
||||||
|
"lib_adat")
|
||||||
|
|
||||||
|
set(LIB_COMPILER_FLAGS -O3 -DREF_CLK_FREQ=100 -fasm-linenum -fcomment-asm)
|
||||||
|
|
||||||
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
list(APPEND LIB_COMPILER_FLAGS -DXASSERT_ENABLE_ASSERTIONS=1
|
||||||
|
-DXASSERT_ENABLE_DEBUG=1
|
||||||
|
-DXASSERT_ENBALE_LINE_NUMBERS=1)
|
||||||
|
else()
|
||||||
|
list(APPEND LIB_COMPILER_FLAGS -DXASSERT_ENABLE_ASSERTIONS=0
|
||||||
|
-DXASSERT_ENABLE_DEBUG=0
|
||||||
|
-DXASSERT_ENABLE_LINE_NUMBERS=0)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(LIB_COMPILER_FLAGS_xua_endpoint0.c ${LIB_COMPILER_FLAGS} -Os -mno-dual-issue)
|
||||||
|
set(LIB_COMPILER_FLAGS_xua_ep0_uacreqs.xc ${LIB_COMPILER_FLAGS} -Os -mno-dual-issue)
|
||||||
|
set(LIB_COMPILER_FLAGS_dbcalc.xc ${LIB_COMPILER_FLAGS} -Os -mno-dual-issue)
|
||||||
|
set(LIB_COMPILER_FLAGS_audioports.c ${LIB_COMPILER_FLAGS} -Os -mno-dual-issue)
|
||||||
|
set(LIB_COMPILER_FLAGS_audioports.xc ${LIB_COMPILER_FLAGS} -Os -mno-dual-issue)
|
||||||
|
set(LIB_COMPILER_FLAGS_dfu.xc ${LIB_COMPILER_FLAGS} -Os -mno-dual-issue)
|
||||||
|
set(LIB_COMPILER_FLAGS_flash_interface.c ${LIB_COMPILER_FLAGS} -Os -mno-dual-issue)
|
||||||
|
set(LIB_COMPILER_FLAGS_flashlib_user.c ${LIB_COMPILER_FLAGS} -Os -mno-dual-issue)
|
||||||
|
|
||||||
|
XMOS_REGISTER_MODULE()
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
// Copyright 2018-2022 XMOS LIMITED.
|
// Copyright 2018-2023 XMOS LIMITED.
|
||||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||||
|
|
||||||
unsigned adatCounter = 0;
|
unsigned adatCounter = 0;
|
||||||
unsigned adatSamples[8];
|
unsigned adatSamples[8];
|
||||||
|
|
||||||
#pragma unsafe arrays
|
#pragma unsafe arrays
|
||||||
static inline void TransferAdatTxSamples(chanend c_adat_out, const unsigned samplesFromHost[], int smux, int handshake)
|
static inline void TransferAdatTxSamples(chanend c_adat_out, const unsigned samplesFromHost[], int smux, int handshake)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Do some re-arranging for SMUX.. */
|
/* Do some re-arranging for SMUX.. */
|
||||||
unsafe
|
unsafe
|
||||||
{
|
{
|
||||||
@@ -29,7 +27,6 @@ static inline void TransferAdatTxSamples(chanend c_adat_out, const unsigned samp
|
|||||||
|
|
||||||
if(adatCounter == smux)
|
if(adatCounter == smux)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef ADAT_TX_USE_SHARED_BUFF
|
#ifdef ADAT_TX_USE_SHARED_BUFF
|
||||||
unsafe
|
unsafe
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -241,12 +241,12 @@ unsigned static AudioHub_MainLoop(chanend ?c_out, chanend ?c_spd_out
|
|||||||
}
|
}
|
||||||
#endif // ((DEBUG_MIC_ARRAY == 1) && (XUA_NUM_PDM_MICS > 0))
|
#endif // ((DEBUG_MIC_ARRAY == 1) && (XUA_NUM_PDM_MICS > 0))
|
||||||
|
|
||||||
UserBufferManagementInit();
|
UserBufferManagementInit(curSamFreq);
|
||||||
|
|
||||||
unsigned command = DoSampleTransfer(c_out, readBuffNo, underflowWord);
|
unsigned command = DoSampleTransfer(c_out, readBuffNo, underflowWord);
|
||||||
|
|
||||||
// Reinitialise user state before entering the main loop
|
// Reinitialise user state before entering the main loop
|
||||||
UserBufferManagementInit();
|
UserBufferManagementInit(curSamFreq);
|
||||||
|
|
||||||
#if (XUA_ADAT_TX_EN)
|
#if (XUA_ADAT_TX_EN)
|
||||||
unsafe{
|
unsafe{
|
||||||
@@ -806,7 +806,7 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk,
|
|||||||
{
|
{
|
||||||
/* TODO wait for good mclk instead of delay */
|
/* TODO wait for good mclk instead of delay */
|
||||||
/* No delay for DFU modes */
|
/* No delay for DFU modes */
|
||||||
if (((curSamFreq / AUD_TO_USB_RATIO) != AUDIO_REBOOT_FROM_DFU) && ((curSamFreq / AUD_TO_USB_RATIO) != AUDIO_STOP_FOR_DFU) && command)
|
if (((curSamFreq / AUD_TO_USB_RATIO) != AUDIO_STOP_FOR_DFU) && command)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
/* User should ensure MCLK is stable in AudioHwConfig */
|
/* User should ensure MCLK is stable in AudioHwConfig */
|
||||||
@@ -916,13 +916,9 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk,
|
|||||||
#else
|
#else
|
||||||
dummy_deliver(c_aud, command);
|
dummy_deliver(c_aud, command);
|
||||||
#endif
|
#endif
|
||||||
|
/* Note, we do not expect to reach here */
|
||||||
curSamFreq = inuint(c_aud);
|
curSamFreq = inuint(c_aud);
|
||||||
|
outct(c_aud, XS1_CT_END);
|
||||||
if (curSamFreq == AUDIO_START_FROM_DFU)
|
|
||||||
{
|
|
||||||
outct(c_aud, XS1_CT_END);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
// Copyright 2016-2021 XMOS LIMITED.
|
// Copyright 2016-2023 XMOS LIMITED.
|
||||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||||
|
|
||||||
#include "xccompat.h"
|
#include "xccompat.h"
|
||||||
#include "xua_audiohub.h"
|
#include "xua_audiohub.h"
|
||||||
|
|
||||||
/* Default implementation for UserBufferManagementInit() */
|
/* Default implementation for UserBufferManagementInit() */
|
||||||
void __attribute__ ((weak)) UserBufferManagementInit()
|
void __attribute__ ((weak)) UserBufferManagementInit(unsigned sampFreq)
|
||||||
{
|
{
|
||||||
/* Do nothing */
|
/* Do nothing */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -514,7 +514,7 @@ __builtin_unreachable();
|
|||||||
{
|
{
|
||||||
/* Finished creating packet - commit it to the FIFO */
|
/* Finished creating packet - commit it to the FIFO */
|
||||||
/* Total samps to write could start at 0 (i.e. no MCLK) so need to check for < 0) */
|
/* Total samps to write could start at 0 (i.e. no MCLK) so need to check for < 0) */
|
||||||
if (sampsToWrite <= 0)
|
if(sampsToWrite <= 0)
|
||||||
{
|
{
|
||||||
int speed, wrPtr;
|
int speed, wrPtr;
|
||||||
packState = 0;
|
packState = 0;
|
||||||
@@ -651,6 +651,7 @@ __builtin_unreachable();
|
|||||||
|
|
||||||
#if (NUM_USB_CHAN_IN > 0)
|
#if (NUM_USB_CHAN_IN > 0)
|
||||||
/* Mark Endpoint (IN) ready with an appropriately sized zero buffer */
|
/* Mark Endpoint (IN) ready with an appropriately sized zero buffer */
|
||||||
|
/* TODO We should properly size zeros packet rather than using "mid" */
|
||||||
static inline void SetupZerosSendBuffer(XUD_ep aud_to_host_usb_ep, unsigned sampFreq, unsigned slotSize,
|
static inline void SetupZerosSendBuffer(XUD_ep aud_to_host_usb_ep, unsigned sampFreq, unsigned slotSize,
|
||||||
xc_ptr aud_to_host_zeros)
|
xc_ptr aud_to_host_zeros)
|
||||||
{
|
{
|
||||||
@@ -659,8 +660,8 @@ static inline void SetupZerosSendBuffer(XUD_ep aud_to_host_usb_ep, unsigned samp
|
|||||||
|
|
||||||
/* Set IN stream packet size to something sensible. We expect the buffer to
|
/* Set IN stream packet size to something sensible. We expect the buffer to
|
||||||
* over flow and this to be reset */
|
* over flow and this to be reset */
|
||||||
SET_SHARED_GLOBAL(sampsToWrite, 0);
|
SET_SHARED_GLOBAL(sampsToWrite, mid);
|
||||||
SET_SHARED_GLOBAL(totalSampsToWrite, 0);
|
SET_SHARED_GLOBAL(totalSampsToWrite, mid);
|
||||||
|
|
||||||
mid *= g_numUsbChan_In * slotSize;
|
mid *= g_numUsbChan_In * slotSize;
|
||||||
|
|
||||||
@@ -821,6 +822,7 @@ void XUA_Buffer_Decouple(chanend c_mix_out
|
|||||||
SetupZerosSendBuffer(aud_to_host_usb_ep, sampFreq, g_curSubSlot_In, aud_to_host_zeros);
|
SetupZerosSendBuffer(aud_to_host_usb_ep, sampFreq, g_curSubSlot_In, aud_to_host_zeros);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if (NUM_USB_CHAN_OUT > 0)
|
||||||
/* Reset OUT buffer state */
|
/* Reset OUT buffer state */
|
||||||
outUnderflow = 1;
|
outUnderflow = 1;
|
||||||
SET_SHARED_GLOBAL(g_aud_from_host_rdptr, aud_from_host_fifo_start);
|
SET_SHARED_GLOBAL(g_aud_from_host_rdptr, aud_from_host_fifo_start);
|
||||||
@@ -830,9 +832,10 @@ void XUA_Buffer_Decouple(chanend c_mix_out
|
|||||||
if(outOverflow)
|
if(outOverflow)
|
||||||
{
|
{
|
||||||
/* If we were previously in overflow we wont have marked as ready */
|
/* If we were previously in overflow we wont have marked as ready */
|
||||||
XUD_SetReady_OutPtr(aud_from_host_usb_ep, aud_from_host_fifo_start+4);
|
XUD_SetReady_OutPtr(aud_from_host_usb_ep, aud_from_host_fifo_start + 4);
|
||||||
outOverflow = 0;
|
outOverflow = 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wait for handshake back and pass back up */
|
/* Wait for handshake back and pass back up */
|
||||||
@@ -906,6 +909,7 @@ void XUA_Buffer_Decouple(chanend c_mix_out
|
|||||||
GET_SHARED_GLOBAL(dataFormat, g_formatChange_DataFormat);
|
GET_SHARED_GLOBAL(dataFormat, g_formatChange_DataFormat);
|
||||||
GET_SHARED_GLOBAL(sampRes, g_formatChange_SampRes);
|
GET_SHARED_GLOBAL(sampRes, g_formatChange_SampRes);
|
||||||
|
|
||||||
|
#if (NUM_USB_CHAN_OUT > 0)
|
||||||
/* Reset OUT buffer state */
|
/* Reset OUT buffer state */
|
||||||
SET_SHARED_GLOBAL(g_aud_from_host_rdptr, aud_from_host_fifo_start);
|
SET_SHARED_GLOBAL(g_aud_from_host_rdptr, aud_from_host_fifo_start);
|
||||||
SET_SHARED_GLOBAL(g_aud_from_host_wrptr, aud_from_host_fifo_start);
|
SET_SHARED_GLOBAL(g_aud_from_host_wrptr, aud_from_host_fifo_start);
|
||||||
@@ -921,6 +925,7 @@ void XUA_Buffer_Decouple(chanend c_mix_out
|
|||||||
XUD_SetReady_OutPtr(aud_from_host_usb_ep, aud_from_host_fifo_start+4);
|
XUD_SetReady_OutPtr(aud_from_host_usb_ep, aud_from_host_fifo_start+4);
|
||||||
outOverflow = 0;
|
outOverflow = 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef NATIVE_DSD
|
#ifdef NATIVE_DSD
|
||||||
if(dataFormat == UAC_FORMAT_TYPEI_RAW_DATA)
|
if(dataFormat == UAC_FORMAT_TYPEI_RAW_DATA)
|
||||||
@@ -1041,7 +1046,7 @@ void XUA_Buffer_Decouple(chanend c_mix_out
|
|||||||
|
|
||||||
DISABLE_INTERRUPTS();
|
DISABLE_INTERRUPTS();
|
||||||
|
|
||||||
if (inUnderflow)
|
if(inUnderflow)
|
||||||
{
|
{
|
||||||
int fillLevel;
|
int fillLevel;
|
||||||
GET_SHARED_GLOBAL(fillLevel, g_aud_to_host_fill_level);
|
GET_SHARED_GLOBAL(fillLevel, g_aud_to_host_fill_level);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
// Copyright 2011-2023 XMOS LIMITED.
|
// Copyright 2011-2023 XMOS LIMITED.
|
||||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||||
|
|
||||||
#include <xs1.h>
|
#include <xs1.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <print.h>
|
#include <print.h>
|
||||||
@@ -141,9 +140,6 @@ static inline void setClockValidity(chanend c_interruptControl, int clkIndex, in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Returns 1 for valid clock found else 0 */
|
/* Returns 1 for valid clock found else 0 */
|
||||||
static inline int validSamples(Counter &counter, int clockIndex)
|
static inline int validSamples(Counter &counter, int clockIndex)
|
||||||
{
|
{
|
||||||
@@ -219,18 +215,6 @@ static inline int validSamples(Counter &counter, int clockIndex)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (XUA_SPDIF_RX_EN)
|
|
||||||
//:badParity
|
|
||||||
/* Returns 1 for bad parity, else 0 */
|
|
||||||
static inline int badParity(unsigned x)
|
|
||||||
{
|
|
||||||
unsigned X = (x>>4);
|
|
||||||
crc32(X, 0, 1);
|
|
||||||
return X & 1;
|
|
||||||
}
|
|
||||||
//:
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef LEVEL_METER_LEDS
|
#ifdef LEVEL_METER_LEDS
|
||||||
void VendorLedRefresh(unsigned levelData[]);
|
void VendorLedRefresh(unsigned levelData[]);
|
||||||
unsigned g_inputLevelData[NUM_USB_CHAN_IN];
|
unsigned g_inputLevelData[NUM_USB_CHAN_IN];
|
||||||
@@ -248,7 +232,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa
|
|||||||
unsigned clkMode = CLOCK_INTERNAL; /* Current clocking mode in operation */
|
unsigned clkMode = CLOCK_INTERNAL; /* Current clocking mode in operation */
|
||||||
unsigned tmp;
|
unsigned tmp;
|
||||||
|
|
||||||
/* start in no-SMUX (8-channel) mode */
|
/* Start in no-SMUX (8-channel) mode */
|
||||||
int smux = 0;
|
int smux = 0;
|
||||||
|
|
||||||
#ifdef LEVEL_METER_LEDS
|
#ifdef LEVEL_METER_LEDS
|
||||||
@@ -262,16 +246,17 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa
|
|||||||
|
|
||||||
#if (XUA_SPDIF_RX_EN)
|
#if (XUA_SPDIF_RX_EN)
|
||||||
/* S/PDIF buffer state */
|
/* S/PDIF buffer state */
|
||||||
int spdifSamples[MAX_SPDIF_SAMPLES]; /* S/PDIF sample buffer */
|
int spdifSamples[MAX_SPDIF_SAMPLES]; /* S/PDIF sample buffer */
|
||||||
int spdifWr = 0; /* Write index */
|
int spdifWr = 0; /* Write index */
|
||||||
int spdifRd = 0; /* Read index */ //(spdifWriteIndex ^ (MAX_SPDIF_SAMPLES >> 1)) & ~1; // Start in middle
|
int spdifRd = 0; /* Read index */ //(spdifWriteIndex ^ (MAX_SPDIF_SAMPLES >> 1)) & ~1; // Start in middle
|
||||||
int spdifOverflow = 0; /* Overflow/undeflow flags */
|
int spdifOverflow = 0; /* Overflow/undeflow flags */
|
||||||
int spdifUnderflow = 1;
|
int spdifUnderflow = 1;
|
||||||
int spdifSamps = 0; /* Number of samples in buffer */
|
int spdifSamps = 0; /* Number of samples in buffer */
|
||||||
Counter spdifCounters;
|
Counter spdifCounters;
|
||||||
int spdifReceivedTime;
|
int spdifRxTime;
|
||||||
unsigned tmp2;
|
unsigned tmp2;
|
||||||
unsigned spdifLeft = 0;
|
unsigned spdifLeft = 0;
|
||||||
|
unsigned spdifRxData;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (XUA_ADAT_RX_EN)
|
#if (XUA_ADAT_RX_EN)
|
||||||
@@ -296,21 +281,21 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Init clock unit state */
|
/* Init clock unit state */
|
||||||
|
clockFreq[CLOCK_INTERNAL] = 0;
|
||||||
|
clockId[CLOCK_INTERNAL] = ID_CLKSRC_INT;
|
||||||
|
clockValid[CLOCK_INTERNAL] = 0;
|
||||||
|
clockInt[CLOCK_INTERNAL] = 0;
|
||||||
#if (XUA_SPDIF_RX_EN)
|
#if (XUA_SPDIF_RX_EN)
|
||||||
clockFreq[CLOCK_SPDIF_INDEX] = 0;
|
clockFreq[CLOCK_SPDIF] = 0;
|
||||||
clockValid[CLOCK_SPDIF_INDEX] = 0;
|
clockValid[CLOCK_SPDIF] = 0;
|
||||||
clockInt[CLOCK_SPDIF_INDEX] = 0;
|
clockInt[CLOCK_SPDIF] = 0;
|
||||||
clockId[CLOCK_SPDIF_INDEX] = ID_CLKSRC_SPDIF;
|
clockId[CLOCK_SPDIF] = ID_CLKSRC_SPDIF;
|
||||||
#endif
|
#endif
|
||||||
clockFreq[CLOCK_INTERNAL_INDEX] = 0;
|
|
||||||
clockId[CLOCK_INTERNAL_INDEX] = ID_CLKSRC_INT;
|
|
||||||
clockValid[CLOCK_INTERNAL_INDEX] = 0;
|
|
||||||
clockInt[CLOCK_INTERNAL_INDEX] = 0;
|
|
||||||
#if (XUA_ADAT_RX_EN)
|
#if (XUA_ADAT_RX_EN)
|
||||||
clockFreq[CLOCK_ADAT_INDEX] = 0;
|
clockFreq[CLOCK_ADAT] = 0;
|
||||||
clockInt[CLOCK_ADAT_INDEX] = 0;
|
clockInt[CLOCK_ADAT] = 0;
|
||||||
clockValid[CLOCK_ADAT_INDEX] = 0;
|
clockValid[CLOCK_ADAT] = 0;
|
||||||
clockId[CLOCK_ADAT_INDEX] = ID_CLKSRC_ADAT;
|
clockId[CLOCK_ADAT] = ID_CLKSRC_ADAT;
|
||||||
#endif
|
#endif
|
||||||
#if (XUA_SPDIF_RX_EN)
|
#if (XUA_SPDIF_RX_EN)
|
||||||
spdifCounters.receivedSamples = 0;
|
spdifCounters.receivedSamples = 0;
|
||||||
@@ -330,7 +315,6 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa
|
|||||||
adatCounters.samplesPerTick = 0;
|
adatCounters.samplesPerTick = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
t_local :> timeNextEdge;
|
t_local :> timeNextEdge;
|
||||||
timeLastEdge = timeNextEdge;
|
timeLastEdge = timeNextEdge;
|
||||||
timeNextClockDetection = timeNextEdge + (LOCAL_CLOCK_INCREMENT / 2);
|
timeNextClockDetection = timeNextEdge + (LOCAL_CLOCK_INCREMENT / 2);
|
||||||
@@ -390,8 +374,8 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Updates to clock settings from endpoint 0 */
|
/* Updates to clock settings from endpoint 0 */
|
||||||
case inuint_byref(c_clk_ctl, tmp):
|
case inuint_byref(c_clk_ctl, tmp):
|
||||||
switch(tmp)
|
switch(tmp)
|
||||||
{
|
{
|
||||||
case GET_SEL:
|
case GET_SEL:
|
||||||
@@ -405,13 +389,9 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa
|
|||||||
|
|
||||||
case SET_SEL:
|
case SET_SEL:
|
||||||
/* Update clock mode */
|
/* Update clock mode */
|
||||||
tmp = inuint(c_clk_ctl);
|
clkMode = inuint(c_clk_ctl);
|
||||||
chkct(c_clk_ctl, XS1_CT_END);
|
chkct(c_clk_ctl, XS1_CT_END);
|
||||||
|
|
||||||
if(tmp!=0)
|
|
||||||
{
|
|
||||||
clkMode = tmp;
|
|
||||||
}
|
|
||||||
#ifdef CLOCK_VALIDITY_CALL
|
#ifdef CLOCK_VALIDITY_CALL
|
||||||
switch(clkMode)
|
switch(clkMode)
|
||||||
{
|
{
|
||||||
@@ -420,12 +400,12 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa
|
|||||||
break;
|
break;
|
||||||
#if (XUA_ADAT_RX_EN)
|
#if (XUA_ADAT_RX_EN)
|
||||||
case CLOCK_ADAT:
|
case CLOCK_ADAT:
|
||||||
VendorClockValidity(clockValid[CLOCK_ADAT_INDEX]);
|
VendorClockValidity(clockValid[CLOCK_ADAT]);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if (XUA_SPDIF_RX_EN)
|
#if (XUA_SPDIF_RX_EN)
|
||||||
case CLOCK_SPDIF:
|
case CLOCK_SPDIF:
|
||||||
VendorClockValidity(clockValid[CLOCK_SPDIF_INDEX]);
|
VendorClockValidity(clockValid[CLOCK_SPDIF]);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -465,7 +445,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Generate local clock from timer */
|
/* Generate local clock from timer */
|
||||||
case t_local when timerafter(timeNextEdge) :> void:
|
case t_local when timerafter(timeNextEdge) :> void:
|
||||||
@@ -499,58 +479,56 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||||
case t_external when timerafter(timeNextClockDetection) :> void:
|
case t_external when timerafter(timeNextClockDetection) :> void:
|
||||||
|
{
|
||||||
timeNextClockDetection += (LOCAL_CLOCK_INCREMENT);
|
int valid;
|
||||||
|
timeNextClockDetection += (LOCAL_CLOCK_INCREMENT);
|
||||||
#if (XUA_SPDIF_RX_EN)
|
#if (XUA_SPDIF_RX_EN)
|
||||||
tmp = spdifCounters.samplesPerTick;
|
/* Returns 1 if valid clock found */
|
||||||
|
valid = validSamples(spdifCounters, CLOCK_SPDIF);
|
||||||
/* Returns 1 if valid clock found */
|
setClockValidity(c_clk_int, CLOCK_SPDIF, valid, clkMode);
|
||||||
tmp = validSamples(spdifCounters, CLOCK_SPDIF_INDEX);
|
|
||||||
setClockValidity(c_clk_int, CLOCK_SPDIF_INDEX, tmp, clkMode);
|
|
||||||
#endif
|
#endif
|
||||||
#if (XUA_ADAT_RX_EN)
|
#if (XUA_ADAT_RX_EN)
|
||||||
tmp = validSamples(adatCounters, CLOCK_ADAT_INDEX);
|
/* Returns 1 if valid clock found */
|
||||||
setClockValidity(c_clk_int, CLOCK_ADAT_INDEX, tmp, clkMode);
|
valid = validSamples(adatCounters, CLOCK_ADAT);
|
||||||
|
setClockValidity(c_clk_int, CLOCK_ADAT, valid, clkMode);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (XUA_SPDIF_RX_EN)
|
#if (XUA_SPDIF_RX_EN)
|
||||||
/* Receive sample from S/PDIF RX thread (steaming chan) */
|
/* Receive sample from S/PDIF RX thread (streaming chan) */
|
||||||
case c_spdif_rx :> tmp:
|
case c_spdif_rx :> spdifRxData:
|
||||||
|
|
||||||
/* Record time of sample */
|
/* Record time of sample */
|
||||||
t_local :> spdifReceivedTime;
|
t_local :> spdifRxTime;
|
||||||
|
|
||||||
/* Check parity and ignore if bad */
|
/* Check parity and ignore if bad */
|
||||||
if(badParity(tmp))
|
if(spdif_rx_check_parity(spdifRxData))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Get pre-amble */
|
/* Get preamble */
|
||||||
tmp2 = tmp & 0xF;
|
unsigned preamble = spdifRxData & SPDIF_RX_PREAMBLE_MASK;
|
||||||
switch(tmp2)
|
|
||||||
|
switch(preamble)
|
||||||
{
|
{
|
||||||
/* LEFT */
|
/* LEFT */
|
||||||
case SPDIF_FRAME_X:
|
case SPDIF_FRAME_X:
|
||||||
case SPDIF_FRAME_Z:
|
case SPDIF_FRAME_Z:
|
||||||
|
spdifLeft = SPDIF_RX_EXTRACT_SAMPLE(spdifRxData);
|
||||||
spdifLeft = tmp << 4;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* RIGHT */
|
/* RIGHT */
|
||||||
case SPDIF_FRAME_Y:
|
case SPDIF_FRAME_Y:
|
||||||
|
|
||||||
/* Only store sample if not in overflow and stream is reasonably valid */
|
/* Only store sample if not in overflow and stream is reasonably valid */
|
||||||
if(!spdifOverflow && clockValid[CLOCK_SPDIF_INDEX])
|
if(!spdifOverflow && clockValid[CLOCK_SPDIF])
|
||||||
{
|
{
|
||||||
/* Store left and right sample pair to buffer */
|
/* Store left and right sample pair to buffer */
|
||||||
spdifSamples[spdifWr] = spdifLeft;
|
spdifSamples[spdifWr] = spdifLeft;
|
||||||
spdifSamples[spdifWr+1] = tmp << 4;
|
spdifSamples[spdifWr+1] = SPDIF_RX_EXTRACT_SAMPLE(spdifRxData);
|
||||||
|
|
||||||
spdifWr = (spdifWr + 2) & (MAX_SPDIF_SAMPLES - 1);
|
spdifWr = (spdifWr + 2) & (MAX_SPDIF_SAMPLES - 1);
|
||||||
|
|
||||||
@@ -578,7 +556,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa
|
|||||||
|
|
||||||
spdifCounters.samples += 1;
|
spdifCounters.samples += 1;
|
||||||
|
|
||||||
if(clkMode == CLOCK_SPDIF && clockValid[CLOCK_SPDIF_INDEX])
|
if(clkMode == CLOCK_SPDIF && clockValid[CLOCK_SPDIF])
|
||||||
{
|
{
|
||||||
spdifCounters.receivedSamples+=1;
|
spdifCounters.receivedSamples+=1;
|
||||||
|
|
||||||
@@ -586,13 +564,13 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa
|
|||||||
if((spdifCounters.receivedSamples >= spdifCounters.samplesPerTick))
|
if((spdifCounters.receivedSamples >= spdifCounters.samplesPerTick))
|
||||||
{
|
{
|
||||||
/* Check edge is about right... S/PDIF may have changed freq... */
|
/* Check edge is about right... S/PDIF may have changed freq... */
|
||||||
if(timeafter(spdifReceivedTime, (timeLastEdge + LOCAL_CLOCK_INCREMENT - LOCAL_CLOCK_MARGIN)))
|
if(timeafter(spdifRxTime, (timeLastEdge + LOCAL_CLOCK_INCREMENT - LOCAL_CLOCK_MARGIN)))
|
||||||
{
|
{
|
||||||
/* Record edge time */
|
/* Record edge time */
|
||||||
timeLastEdge = spdifReceivedTime;
|
timeLastEdge = spdifRxTime;
|
||||||
|
|
||||||
/* Setup for next edge */
|
/* Setup for next edge */
|
||||||
timeNextEdge = spdifReceivedTime + LOCAL_CLOCK_INCREMENT + LOCAL_CLOCK_MARGIN;
|
timeNextEdge = spdifRxTime + LOCAL_CLOCK_INCREMENT + LOCAL_CLOCK_MARGIN;
|
||||||
|
|
||||||
/* Toggle edge */
|
/* Toggle edge */
|
||||||
i_pll_ref.toggle_timed(1);
|
i_pll_ref.toggle_timed(1);
|
||||||
@@ -627,7 +605,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa
|
|||||||
if (adatChannel == 8)
|
if (adatChannel == 8)
|
||||||
{
|
{
|
||||||
/* only store left samples if not in overflow and stream is reasonably valid */
|
/* only store left samples if not in overflow and stream is reasonably valid */
|
||||||
if (!adatOverflow && clockValid[CLOCK_ADAT_INDEX])
|
if (!adatOverflow && clockValid[CLOCK_ADAT])
|
||||||
{
|
{
|
||||||
/* Unpick the SMUX.. */
|
/* Unpick the SMUX.. */
|
||||||
if(smux == 2)
|
if(smux == 2)
|
||||||
@@ -684,7 +662,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa
|
|||||||
{
|
{
|
||||||
adatCounters.samples += 1;
|
adatCounters.samples += 1;
|
||||||
|
|
||||||
if (clkMode == CLOCK_ADAT && clockValid[CLOCK_ADAT_INDEX])
|
if (clkMode == CLOCK_ADAT && clockValid[CLOCK_ADAT])
|
||||||
{
|
{
|
||||||
adatCounters.receivedSamples += 1;
|
adatCounters.receivedSamples += 1;
|
||||||
|
|
||||||
@@ -705,7 +683,6 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa
|
|||||||
|
|
||||||
/* Reset counters */
|
/* Reset counters */
|
||||||
adatCounters.receivedSamples = 0;
|
adatCounters.receivedSamples = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -716,10 +693,9 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||||
/* AudioHub requests data */
|
/* AudioHub requests data */
|
||||||
case inuint_byref(c_dig_rx, tmp):
|
case inuint_byref(c_dig_rx, tmp):
|
||||||
#if (XUA_SPDIF_RX_EN)
|
#if (XUA_SPDIF_RX_EN)
|
||||||
if(spdifUnderflow)
|
if(spdifUnderflow)
|
||||||
{
|
{
|
||||||
@@ -734,7 +710,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa
|
|||||||
tmp2 = spdifSamples[spdifRd + 1];
|
tmp2 = spdifSamples[spdifRd + 1];
|
||||||
|
|
||||||
spdifRd += 2;
|
spdifRd += 2;
|
||||||
spdifRd &= (MAX_SPDIF_SAMPLES - 1);
|
spdifRd &= (MAX_SPDIF_SAMPLES - 1);
|
||||||
|
|
||||||
g_digData[0] = tmp;
|
g_digData[0] = tmp;
|
||||||
g_digData[1] = tmp2;
|
g_digData[1] = tmp2;
|
||||||
@@ -756,7 +732,6 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa
|
|||||||
spdifOverflow = 0;
|
spdifOverflow = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#if (XUA_ADAT_RX_EN)
|
#if (XUA_ADAT_RX_EN)
|
||||||
if (adatUnderflow)
|
if (adatUnderflow)
|
||||||
@@ -839,11 +814,9 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
outuint(c_dig_rx, 1);
|
outuint(c_dig_rx, 1);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -456,34 +456,35 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
|||||||
(buffer, unsigned char[])[0] = 1;
|
(buffer, unsigned char[])[0] = 1;
|
||||||
return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), 1, sp.wLength);
|
return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), 1, sp.wLength);
|
||||||
break;
|
break;
|
||||||
|
#if (XUA_SPDIF_RX_EN)
|
||||||
case ID_CLKSRC_SPDIF:
|
case ID_CLKSRC_SPDIF:
|
||||||
|
|
||||||
/* Interogate clockgen thread for validity */
|
/* Interogate clockgen thread for validity */
|
||||||
if (!isnull(c_clk_ctl))
|
if (!isnull(c_clk_ctl))
|
||||||
{
|
{
|
||||||
outuint(c_clk_ctl, GET_VALID);
|
outuint(c_clk_ctl, GET_VALID);
|
||||||
outuint(c_clk_ctl, CLOCK_SPDIF_INDEX);
|
outuint(c_clk_ctl, CLOCK_SPDIF);
|
||||||
outct(c_clk_ctl, XS1_CT_END);
|
outct(c_clk_ctl, XS1_CT_END);
|
||||||
(buffer, unsigned char[])[0] = inuint(c_clk_ctl);
|
(buffer, unsigned char[])[0] = inuint(c_clk_ctl);
|
||||||
chkct(c_clk_ctl, XS1_CT_END);
|
chkct(c_clk_ctl, XS1_CT_END);
|
||||||
return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), 1, sp.wLength);
|
return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), 1, sp.wLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#if (XUA_ADAT_RX_EN)
|
||||||
case ID_CLKSRC_ADAT:
|
case ID_CLKSRC_ADAT:
|
||||||
|
|
||||||
if (!isnull(c_clk_ctl))
|
if (!isnull(c_clk_ctl))
|
||||||
{
|
{
|
||||||
outuint(c_clk_ctl, GET_VALID);
|
outuint(c_clk_ctl, GET_VALID);
|
||||||
outuint(c_clk_ctl, CLOCK_ADAT_INDEX);
|
outuint(c_clk_ctl, CLOCK_ADAT);
|
||||||
outct(c_clk_ctl, XS1_CT_END);
|
outct(c_clk_ctl, XS1_CT_END);
|
||||||
(buffer, unsigned char[])[0] = inuint(c_clk_ctl);
|
(buffer, unsigned char[])[0] = inuint(c_clk_ctl);
|
||||||
chkct(c_clk_ctl, XS1_CT_END);
|
chkct(c_clk_ctl, XS1_CT_END);
|
||||||
return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), 1, sp.wLength);
|
return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), 1, sp.wLength);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
//Unknown Unit ID in Clock Valid Control Request
|
//Unknown Unit ID in Clock Valid Control Request
|
||||||
@@ -513,19 +514,23 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for correct datalength for clock sel */
|
|
||||||
if(datalength == 1)
|
if(datalength == 1)
|
||||||
{
|
{
|
||||||
if (!isnull(c_clk_ctl))
|
int clockIndex = (int) (buffer, unsigned char[])[0];
|
||||||
{
|
clockIndex -= 1; /* Index to/from host is 1-based */
|
||||||
outuint(c_clk_ctl, SET_SEL);
|
|
||||||
outuint(c_clk_ctl, (buffer, unsigned char[])[0]);
|
|
||||||
outct(c_clk_ctl, XS1_CT_END);
|
|
||||||
}
|
|
||||||
/* Send 0 Length as status stage */
|
|
||||||
return XUD_DoSetRequestStatus(ep0_in);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if((clockIndex >= 0) && (clockIndex < CLOCK_COUNT))
|
||||||
|
{
|
||||||
|
if(!isnull(c_clk_ctl))
|
||||||
|
{
|
||||||
|
outuint(c_clk_ctl, SET_SEL);
|
||||||
|
outuint(c_clk_ctl, clockIndex);
|
||||||
|
outct(c_clk_ctl, XS1_CT_END);
|
||||||
|
}
|
||||||
|
/* Send 0 Length as status stage */
|
||||||
|
return XUD_DoSetRequestStatus(ep0_in);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -533,13 +538,15 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
|||||||
(buffer, unsigned char[])[0] = 1;
|
(buffer, unsigned char[])[0] = 1;
|
||||||
if (!isnull(c_clk_ctl))
|
if (!isnull(c_clk_ctl))
|
||||||
{
|
{
|
||||||
|
int clockIndex;
|
||||||
outuint(c_clk_ctl, GET_SEL);
|
outuint(c_clk_ctl, GET_SEL);
|
||||||
outct(c_clk_ctl, XS1_CT_END);
|
outct(c_clk_ctl, XS1_CT_END);
|
||||||
(buffer, unsigned char[])[0] = inuint(c_clk_ctl);
|
clockIndex = inuint(c_clk_ctl);
|
||||||
|
clockIndex += 1; /* Index to/from host is 1-based */
|
||||||
|
(buffer, unsigned char[])[0] = (unsigned char) clockIndex;
|
||||||
chkct(c_clk_ctl, XS1_CT_END);
|
chkct(c_clk_ctl, XS1_CT_END);
|
||||||
}
|
}
|
||||||
return XUD_DoGetRequest( ep0_out, ep0_in, (buffer, unsigned char[]), 1, sp.wLength );
|
return XUD_DoGetRequest( ep0_out, ep0_in, (buffer, unsigned char[]), 1, sp.wLength);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -916,17 +923,20 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
|
|||||||
{
|
{
|
||||||
storeFreq((buffer, unsigned char[]), i, currentFreq44);
|
storeFreq((buffer, unsigned char[]), i, currentFreq44);
|
||||||
num_freqs++;
|
num_freqs++;
|
||||||
currentFreq44*=2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if((currentFreq48 <= maxFreq))
|
currentFreq44*=2;
|
||||||
|
|
||||||
|
if((currentFreq48 <= maxFreq) && (currentFreq48 >= MIN_FREQ))
|
||||||
{
|
{
|
||||||
/* Note i passed byref here */
|
/* Note i passed byref here */
|
||||||
storeFreq((buffer, unsigned char[]), i, currentFreq48);
|
storeFreq((buffer, unsigned char[]), i, currentFreq48);
|
||||||
num_freqs++;
|
num_freqs++;
|
||||||
currentFreq48*=2;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
currentFreq48*=2;
|
||||||
|
|
||||||
|
if((currentFreq48 > MAX_FREQ) && (currentFreq44 > MAX_FREQ))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,8 +30,8 @@
|
|||||||
#include "iap.h"
|
#include "iap.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (XUA_SPDIF_RX_EN)
|
#if (XUA_SPDIF_RX_EN || XUA_SPDIF_TX_EN)
|
||||||
#include "spdif.h"
|
#include "spdif.h" /* From lib_spdif */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (XUA_ADAT_RX_EN)
|
#if (XUA_ADAT_RX_EN)
|
||||||
@@ -42,10 +42,6 @@
|
|||||||
#include "xua_pdm_mic.h"
|
#include "xua_pdm_mic.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (XUA_SPDIF_TX_EN)
|
|
||||||
#include "spdif.h" /* From lib_spdif */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (XUA_DFU_EN == 1)
|
#if (XUA_DFU_EN == 1)
|
||||||
[[distributable]]
|
[[distributable]]
|
||||||
void DFUHandler(server interface i_dfu i, chanend ?c_user_cmd);
|
void DFUHandler(server interface i_dfu i, chanend ?c_user_cmd);
|
||||||
@@ -340,7 +336,7 @@ void usb_audio_io(chanend ?c_aud_in,
|
|||||||
|
|
||||||
par
|
par
|
||||||
{
|
{
|
||||||
#if (MIXER)
|
#if (MIXER && XUA_USB_EN)
|
||||||
/* Mixer cores(s) */
|
/* Mixer cores(s) */
|
||||||
{
|
{
|
||||||
thread_speed();
|
thread_speed();
|
||||||
@@ -497,14 +493,12 @@ int main()
|
|||||||
on tile[XUD_TILE]:
|
on tile[XUD_TILE]:
|
||||||
par
|
par
|
||||||
{
|
{
|
||||||
#if (XUD_TILE == 0)
|
#if XUA_USB_EN
|
||||||
|
#if ((XUD_TILE == 0) && (XUA_DFU_EN == 1))
|
||||||
/* Check if USB is on the flash tile (tile 0) */
|
/* Check if USB is on the flash tile (tile 0) */
|
||||||
#if (XUA_DFU_EN == 1)
|
|
||||||
[[distribute]]
|
[[distribute]]
|
||||||
DFUHandler(dfuInterface, null);
|
DFUHandler(dfuInterface, null);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#if XUA_USB_EN
|
|
||||||
|
|
||||||
/* Core USB task, buffering, USB etc */
|
/* Core USB task, buffering, USB etc */
|
||||||
{
|
{
|
||||||
@@ -643,7 +637,7 @@ int main()
|
|||||||
on tile[XUD_TILE]:
|
on tile[XUD_TILE]:
|
||||||
{
|
{
|
||||||
thread_speed();
|
thread_speed();
|
||||||
spdif_rx(c_spdif_rx,p_spdif_rx,clk_spd_rx,192000);
|
spdif_rx(c_spdif_rx, p_spdif_rx, clk_spd_rx, 192000);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
// Copyright 2011-2021 XMOS LIMITED.
|
// Copyright 2011-2023 XMOS LIMITED.
|
||||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||||
|
#ifndef _XUA_COMMANDS_H_
|
||||||
#ifndef __XUA_INTERNAL_CMDS_H__
|
#define _XUA_COMMANDS_H_
|
||||||
#define __XUA_INTERNAL_CMDS_H__
|
|
||||||
|
|
||||||
#include "xua.h"
|
#include "xua.h"
|
||||||
|
|
||||||
@@ -11,20 +10,19 @@
|
|||||||
#define SET_SEL 1 /* Set value of clock selector */
|
#define SET_SEL 1 /* Set value of clock selector */
|
||||||
#define GET_FREQ 2 /* Get current freq */
|
#define GET_FREQ 2 /* Get current freq */
|
||||||
#define GET_VALID 3 /* Get current validity */
|
#define GET_VALID 3 /* Get current validity */
|
||||||
|
#define SET_SMUX 7 /* Set SMUX mode (ADAT) */
|
||||||
|
|
||||||
#define CLOCK_INTERNAL 1
|
enum
|
||||||
#define CLOCK_SPDIF 2
|
{
|
||||||
#if SPDIF_RX
|
CLOCK_INTERNAL = 0,
|
||||||
#define CLOCK_ADAT 3
|
#if XUA_SPDIF_RX_EN
|
||||||
#else
|
CLOCK_SPDIF,
|
||||||
#define CLOCK_ADAT 2
|
|
||||||
#endif
|
#endif
|
||||||
|
#if XUA_ADAT_RX_EN
|
||||||
#define CLOCK_INTERNAL_INDEX (CLOCK_INTERNAL - 1)
|
CLOCK_ADAT,
|
||||||
#define CLOCK_ADAT_INDEX (CLOCK_ADAT - 1)
|
#endif
|
||||||
#define CLOCK_SPDIF_INDEX (CLOCK_SPDIF - 1)
|
CLOCK_COUNT
|
||||||
|
};
|
||||||
#define SET_SMUX 7
|
|
||||||
|
|
||||||
/* c_audioControl */
|
/* c_audioControl */
|
||||||
#define SET_SAMPLE_FREQ 4
|
#define SET_SAMPLE_FREQ 4
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2011-2021 XMOS LIMITED.
|
// Copyright 2011-2023 XMOS LIMITED.
|
||||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||||
#include <xs1.h>
|
#include <xs1.h>
|
||||||
#include <flash.h>
|
#include <flash.h>
|
||||||
@@ -72,7 +72,7 @@ int flash_cmd_init(void)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QUAD_SPI_FLASH
|
#if (!XUA_QUAD_SPI_FLASH)
|
||||||
// Disable flash protection
|
// Disable flash protection
|
||||||
fl_setProtection(0);
|
fl_setProtection(0);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
// Copyright 2012-2021 XMOS LIMITED.
|
// Copyright 2012-2023 XMOS LIMITED.
|
||||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||||
#include "xua.h"
|
#include "xua.h"
|
||||||
#if (XUA_DFU_EN == 1)
|
#if (XUA_DFU_EN == 1)
|
||||||
#include "uac_hwresources.h"
|
#include "uac_hwresources.h"
|
||||||
#include <xs1.h>
|
#include <xs1.h>
|
||||||
#include <xclib.h>
|
#include <xclib.h>
|
||||||
#ifdef QUAD_SPI_FLASH
|
#if (XUA_QUAD_SPI_FLASH)
|
||||||
#include <quadflashlib.h>
|
#include <quadflashlib.h>
|
||||||
#else
|
#else
|
||||||
#include <flashlib.h>
|
#include <flashlib.h>
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#ifdef DFU_FLASH_DEVICE
|
#ifdef DFU_FLASH_DEVICE
|
||||||
|
|
||||||
#ifdef QUAD_SPI_FLASH
|
#if (XUA_QUAD_SPI_FLASH)
|
||||||
/* Using specified flash device rather than all supported in tools */
|
/* Using specified flash device rather than all supported in tools */
|
||||||
fl_QuadDeviceSpec flash_devices[] = {DFU_FLASH_DEVICE};
|
fl_QuadDeviceSpec flash_devices[] = {DFU_FLASH_DEVICE};
|
||||||
#else
|
#else
|
||||||
@@ -29,7 +29,7 @@ fl_DeviceSpec flash_devices[] = {DFU_FLASH_DEVICE};
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef QUAD_SPI_FLASH
|
#if (XUA_QUAD_SPI_FLASH)
|
||||||
/*
|
/*
|
||||||
typedef struct {
|
typedef struct {
|
||||||
out port qspiCS;
|
out port qspiCS;
|
||||||
@@ -60,7 +60,7 @@ fl_PortHolderStruct p_flash =
|
|||||||
int flash_cmd_enable_ports()
|
int flash_cmd_enable_ports()
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
#ifdef QUAD_SPI_FLASH
|
#if (XUA_QUAD_SPI_FLASH)
|
||||||
/* Ports not shared */
|
/* Ports not shared */
|
||||||
#else
|
#else
|
||||||
setc(p_flash.spiMISO, XS1_SETC_INUSE_OFF);
|
setc(p_flash.spiMISO, XS1_SETC_INUSE_OFF);
|
||||||
@@ -89,14 +89,14 @@ int flash_cmd_enable_ports()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DFU_FLASH_DEVICE
|
#ifdef DFU_FLASH_DEVICE
|
||||||
#ifdef QUAD_SPI_FLASH
|
#if (XUA_QUAD_SPI_FLASH)
|
||||||
result = fl_connectToDevice(&p_qflash, flash_devices, sizeof(flash_devices) / sizeof(fl_QuadDeviceSpec));
|
result = fl_connectToDevice(&p_qflash, flash_devices, sizeof(flash_devices) / sizeof(fl_QuadDeviceSpec));
|
||||||
#else
|
#else
|
||||||
result = fl_connectToDevice(&p_flash, flash_devices, sizeof(flash_devices) / sizeof(fl_DeviceSpec));
|
result = fl_connectToDevice(&p_flash, flash_devices, sizeof(flash_devices) / sizeof(fl_DeviceSpec));
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
/* Use default flash list */
|
/* Use default flash list */
|
||||||
#ifdef QUAD_SPI_FLASH
|
#if (XUA_QUAD_SPI_FLASH)
|
||||||
result = fl_connect(&p_qflash);
|
result = fl_connect(&p_qflash);
|
||||||
#else
|
#else
|
||||||
result = fl_connect(&p_flash);
|
result = fl_connect(&p_flash);
|
||||||
@@ -117,7 +117,7 @@ int flash_cmd_disable_ports()
|
|||||||
{
|
{
|
||||||
fl_disconnect();
|
fl_disconnect();
|
||||||
|
|
||||||
#ifndef QUAD_SPI_FLASH
|
#if (!XUA_QUAD_SPI_FLASH)
|
||||||
setc(p_flash.spiMISO, XS1_SETC_INUSE_OFF);
|
setc(p_flash.spiMISO, XS1_SETC_INUSE_OFF);
|
||||||
setc(p_flash.spiCLK, XS1_SETC_INUSE_OFF);
|
setc(p_flash.spiCLK, XS1_SETC_INUSE_OFF);
|
||||||
setc(p_flash.spiMOSI, XS1_SETC_INUSE_OFF);
|
setc(p_flash.spiMOSI, XS1_SETC_INUSE_OFF);
|
||||||
|
|||||||
Reference in New Issue
Block a user