forked from PAWPAW-Mirror/lib_xua
Compare commits
37 Commits
develop
...
feat/dummy
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a2926d1d8 | ||
|
|
85fd297336 | ||
|
|
c92a640439 | ||
|
|
355df6d6b8 | ||
|
|
0bff3dc5a8 | ||
|
|
9abd3b33f3 | ||
|
|
0932ca0ccc | ||
|
|
f1df805b17 | ||
|
|
867fb3f228 | ||
|
|
9cbdf6374e | ||
|
|
a5922ce3ea | ||
|
|
e24bbe42eb | ||
|
|
1488ace820 | ||
|
|
06bd547c69 | ||
|
|
c2e1a8f17a | ||
|
|
58bb074f0d | ||
|
|
c794ee77d5 | ||
|
|
1cd24963d5 | ||
|
|
b27514fd9a | ||
|
|
5d886487fa | ||
|
|
1b50abb7a2 | ||
|
|
d3f0f11d9e | ||
|
|
897328f9c1 | ||
|
|
f7b05be05b | ||
|
|
fbda8fe92a | ||
|
|
be69d3468e | ||
|
|
7cae9c385c | ||
|
|
d9de1f0322 | ||
|
|
dd21ed0a84 | ||
|
|
d50c9510c6 | ||
|
|
b032310302 | ||
|
|
8f9828ea2c | ||
|
|
50097db00d | ||
|
|
c59f9a7c0c | ||
|
|
7ae04ca313 | ||
|
|
2562f0eb31 | ||
|
|
baaef3b749 |
@@ -1,47 +1,14 @@
|
|||||||
lib_xua Change Log
|
lib_xua Change Log
|
||||||
==================
|
==================
|
||||||
|
|
||||||
HEAD
|
UNRELEASED
|
||||||
----
|
----------
|
||||||
|
|
||||||
* 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
|
|
||||||
-----
|
|
||||||
|
|
||||||
* FIXED: Respect I2S_CHANS_PER_FRAME when calculating bit-clock rates
|
|
||||||
|
|
||||||
* Changes to dependencies:
|
|
||||||
|
|
||||||
- lib_spdif: 5.0.0 -> 5.0.1
|
|
||||||
|
|
||||||
3.5.0
|
|
||||||
-----
|
|
||||||
|
|
||||||
* ADDED: Configurable word-length for I2S/TDM via XUA_I2S_N_BITS
|
* ADDED: Configurable word-length for I2S/TDM via XUA_I2S_N_BITS
|
||||||
* ADDED: Support for statically defined custom HID descriptor
|
* FIXED: Memory corruption due to erroneous initialisation of mixer weights when not in use (#152)
|
||||||
* CHANGED: Rearranged main() such that adding custom code that uses lib_xud
|
|
||||||
is possible
|
|
||||||
* CHANGED: bNumConfigurations changed from 2 to 1, removing a work-around to
|
|
||||||
stop old Windows versions loading the composite driver
|
|
||||||
* FIXED: Memory corruption due to erroneous initialisation of mixer
|
|
||||||
weights when not in use (#152)
|
|
||||||
* FIXED: UserHostActive() not being called as expected (#326)
|
* FIXED: UserHostActive() not being called as expected (#326)
|
||||||
* FIXED: Exception when entering DSD mode (#327)
|
* FIXED: Exception when entering DSD mode (#327)
|
||||||
|
|
||||||
* Changes to dependencies:
|
|
||||||
|
|
||||||
- lib_spdif: 4.2.1 -> 5.0.0
|
|
||||||
|
|
||||||
- lib_xud: 2.2.2 -> 2.2.3
|
|
||||||
|
|
||||||
3.4.0
|
3.4.0
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
lib_xua
|
lib_xua
|
||||||
#######
|
#######
|
||||||
|
|
||||||
:Version: 3.5.1
|
:Version: 3.4.0
|
||||||
:Vendor: XMOS
|
:Vendor: XMOS
|
||||||
|
|
||||||
|
|
||||||
@@ -41,9 +41,9 @@ Key features of the various components in this repository are as follows
|
|||||||
|
|
||||||
- Synchronisation to external digital streams i.e. S/PDIF or ADAT (when in asynchronous mode)
|
- Synchronisation to external digital streams i.e. S/PDIF or ADAT (when in asynchronous mode)
|
||||||
|
|
||||||
- I2S (slave/master modes with configurable word-length)
|
- I2S slave & master modes
|
||||||
|
|
||||||
- TDM (slave/master modes with configurable word-length)
|
- TDM slave & master modes
|
||||||
|
|
||||||
- MIDI input/output (Compliant to USB Class Specification for MIDI devices)
|
- MIDI input/output (Compliant to USB Class Specification for MIDI devices)
|
||||||
|
|
||||||
@@ -53,8 +53,6 @@ Key features of the various components in this repository are as follows
|
|||||||
|
|
||||||
- Simple playback controls via USB Human Interface Device (HID) Class
|
- Simple playback controls via USB Human Interface Device (HID) Class
|
||||||
|
|
||||||
- Support for adding custom HID interfaces
|
|
||||||
|
|
||||||
Note, not all features may be supported at all sample frequencies, simultaneously or on all devices.
|
Note, not all features may be supported at all sample frequencies, simultaneously or on all devices.
|
||||||
Some features may also require specific host driver support.
|
Some features may also require specific host driver support.
|
||||||
|
|
||||||
|
|||||||
@@ -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.ai Multi-channel Audio Board
|
and tested on the xCORE-200 Multi-channel Audio Board
|
||||||
|
|
||||||
Prerequisites
|
Prerequisites
|
||||||
.............
|
.............
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ void AudioHwConfig(unsigned samFreq, unsigned mClk, unsigned dsdMode,
|
|||||||
|
|
||||||
#endif // __XC__
|
#endif // __XC__
|
||||||
|
|
||||||
void UserBufferManagementInit(unsigned samFreq);
|
void UserBufferManagementInit();
|
||||||
|
|
||||||
void UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudioToUsb[]);
|
void UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudioToUsb[]);
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
@@ -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
|
||||||
|
|
||||||
@@ -197,6 +197,23 @@
|
|||||||
#define I2S_DOWNSAMPLE_CHANS_IN I2S_CHANS_ADC
|
#define I2S_DOWNSAMPLE_CHANS_IN I2S_CHANS_ADC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef XUA_I2S_DUMMY_SAMPS
|
||||||
|
#define XUA_I2S_DUMMY_SAMPS (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Number of bits per channel for I2S/TDM. Supported values: 16/32-bit.
|
||||||
|
*
|
||||||
|
* Default: 32 bits
|
||||||
|
*/
|
||||||
|
#ifndef XUA_I2S_N_BITS
|
||||||
|
#define XUA_I2S_N_BITS (32)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (XUA_I2S_N_BITS != 16) && (XUA_I2S_N_BITS != 32)
|
||||||
|
#error Unsupported value for XUA_I2S_N_BITS (only values 16/32 supported)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Number of bits per channel for I2S/TDM. Supported values: 16/32-bit.
|
* @brief Number of bits per channel for I2S/TDM. Supported values: 16/32-bit.
|
||||||
*
|
*
|
||||||
@@ -241,9 +258,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Default device sample frequency. A safe default should be used.
|
* @brief Default device sample frequency. A safe default should be used. Default: MIN_FREQ
|
||||||
*
|
|
||||||
* Default: MIN_FREQ
|
|
||||||
*/
|
*/
|
||||||
#ifndef DEFAULT_FREQ
|
#ifndef DEFAULT_FREQ
|
||||||
#define DEFAULT_FREQ (MIN_FREQ)
|
#define DEFAULT_FREQ (MIN_FREQ)
|
||||||
@@ -252,21 +267,17 @@
|
|||||||
/* Audio Class Defines */
|
/* Audio Class Defines */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief USB Audio Class Version.
|
* @brief USB Audio Class Version. Default: 2 (Audio Class version 2.0)
|
||||||
*
|
|
||||||
* 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.
|
* @brief Whether or not to fall back to Audio Class 1.0 in USB Full-speed. Default: 0 (Disabled)
|
||||||
*
|
|
||||||
* 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)
|
#define AUDIO_CLASS_FALLBACK 0 /* Default to not falling back to UAC 1 */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -278,7 +289,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
|
||||||
|
|
||||||
@@ -299,9 +310,7 @@
|
|||||||
/* Feature defines */
|
/* Feature defines */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Number of PDM microphones in the design.
|
* @brief Number of PDM microphones in the design. Default: None
|
||||||
*
|
|
||||||
* Default: None
|
|
||||||
*/
|
*/
|
||||||
#ifndef XUA_NUM_PDM_MICS
|
#ifndef XUA_NUM_PDM_MICS
|
||||||
#define XUA_NUM_PDM_MICS (0)
|
#define XUA_NUM_PDM_MICS (0)
|
||||||
@@ -318,18 +327,14 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Size of a frame of microphone data samples.
|
* @brief Size of a frame of microphone data samples. Default: 1
|
||||||
*
|
|
||||||
* 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.
|
* @brief Enable MIDI functionality including buffering, descriptors etc. Default: DISABLED
|
||||||
*
|
|
||||||
* Default: 0 (Disabled)
|
|
||||||
*/
|
*/
|
||||||
#ifndef MIDI
|
#ifndef MIDI
|
||||||
#define MIDI (0)
|
#define MIDI (0)
|
||||||
@@ -363,9 +368,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enables ADAT Tx.
|
* @brief Enables ADAT Tx. Default: 0 (Disabled)
|
||||||
*
|
|
||||||
* 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)
|
||||||
@@ -381,18 +384,14 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enables SPDIF Rx.
|
* @brief Enables SPDIF Rx. Default: 0 (Disabled)
|
||||||
*
|
|
||||||
* 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.
|
* @brief Enables ADAT Rx. Default: 0 (Disabled)
|
||||||
*
|
|
||||||
* 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)
|
||||||
@@ -455,15 +454,6 @@
|
|||||||
#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.
|
||||||
*
|
*
|
||||||
@@ -475,40 +465,6 @@
|
|||||||
#define HID_CONTROLS (0)
|
#define HID_CONTROLS (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* HID may be required in two forms: the built-in XUA-HID reports, or a
|
|
||||||
* user-provided static HID. Some sections of code are always needed, they
|
|
||||||
* are enclosed in XUA_OR_STATIC_HID_ENABLED; code specific to XUA-HID
|
|
||||||
* reports are enclosed in XUA_HID_ENABLED.
|
|
||||||
*
|
|
||||||
* HID_CONTROLS implies that the XUA_HID is used, and hence defines both.
|
|
||||||
* In order to roll your own, do not enable HID_CONTROLS, but instead
|
|
||||||
* create a file static_hid_report.h that contains the static descriptor.
|
|
||||||
*
|
|
||||||
* You must also supply your own function to deal with the HID endpoint(s)
|
|
||||||
* in this case.
|
|
||||||
*/
|
|
||||||
#if( 0 < HID_CONTROLS )
|
|
||||||
#define XUA_HID_ENABLED (1)
|
|
||||||
#define XUA_OR_STATIC_HID_ENABLED (1)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(__static_hid_report_h_exists__)
|
|
||||||
#define XUA_OR_STATIC_HID_ENABLED (1)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable a HID OUT endpoint. Only use this if you supply your own HID control.
|
|
||||||
*
|
|
||||||
* 1 for enabled, 0 for disabled.
|
|
||||||
*
|
|
||||||
* Default 0 (Disabled)
|
|
||||||
*/
|
|
||||||
#ifndef HID_OUT_REQUIRED
|
|
||||||
#define HID_OUT_REQUIRED (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Defines whether XMOS device runs as master (i.e. drives LR and Bit clocks)
|
* @brief Defines whether XMOS device runs as master (i.e. drives LR and Bit clocks)
|
||||||
*
|
*
|
||||||
@@ -1160,13 +1116,9 @@
|
|||||||
#define VOLUME_RES_MIXER (0x100)
|
#define VOLUME_RES_MIXER (0x100)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Handle out volume control in the mixer - enabled by default if mixer enabled */
|
/* Handle out volume control in the mixer - enabled by default */
|
||||||
#ifndef OUT_VOLUME_IN_MIXER
|
#ifndef OUT_VOLUME_IN_MIXER
|
||||||
#if MIXER
|
|
||||||
#define OUT_VOLUME_IN_MIXER (1)
|
#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 */
|
||||||
@@ -1179,7 +1131,7 @@
|
|||||||
#define IN_VOLUME_IN_MIXER (0)
|
#define IN_VOLUME_IN_MIXER (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Apply in volume controls after the mix. Only relevant when IN_VOLUMNE_IN MIXER enabled. Enabled by default */
|
/* Apply in volume controls after the mix. Only relebant 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
|
||||||
@@ -1228,7 +1180,7 @@ enum USBEndpointNumber_In
|
|||||||
#ifdef MIDI
|
#ifdef MIDI
|
||||||
ENDPOINT_NUMBER_IN_MIDI,
|
ENDPOINT_NUMBER_IN_MIDI,
|
||||||
#endif
|
#endif
|
||||||
#if XUA_OR_STATIC_HID_ENABLED
|
#if( 0 < HID_CONTROLS )
|
||||||
ENDPOINT_NUMBER_IN_HID,
|
ENDPOINT_NUMBER_IN_HID,
|
||||||
#endif
|
#endif
|
||||||
#ifdef IAP
|
#ifdef IAP
|
||||||
@@ -1255,9 +1207,6 @@ enum USBEndpointNumber_Out
|
|||||||
#ifdef IAP_EA_NATIVE_TRANS
|
#ifdef IAP_EA_NATIVE_TRANS
|
||||||
ENDPOINT_NUMBER_OUT_IAP_EA_NATIVE_TRANS,
|
ENDPOINT_NUMBER_OUT_IAP_EA_NATIVE_TRANS,
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#if XUA_OR_STATIC_HID_ENABLED && HID_OUT_REQUIRED
|
|
||||||
ENDPOINT_NUMBER_OUT_HID,
|
|
||||||
#endif
|
#endif
|
||||||
XUA_ENDPOINT_COUNT_OUT /* End marker */
|
XUA_ENDPOINT_COUNT_OUT /* End marker */
|
||||||
};
|
};
|
||||||
@@ -1276,6 +1225,8 @@ 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)
|
||||||
@@ -1378,7 +1329,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_1_RESOLUTION_BITS > 24) || \
|
#if (FS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS > 24) || (HS_STREAM_FORMAT_OUTPUT_2_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
|
||||||
@@ -1412,7 +1363,7 @@ 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) || (HS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS > 24)
|
#if (FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS > 24) || (FS_STREAM_FORMAT_INPUT_2_RESOLUTION_BITS > 24)
|
||||||
#define STREAM_FORMAT_INPUT_RESOLUTION_32BIT_USED 1
|
#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
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
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,4 +1,4 @@
|
|||||||
VERSION = 3.5.1
|
VERSION = 3.4.0
|
||||||
|
|
||||||
DEBUG ?= 0
|
DEBUG ?= 0
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ XCC_FLAGS_dfu.xc = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
|
|||||||
XCC_FLAGS_flash_interface.c = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
|
XCC_FLAGS_flash_interface.c = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
|
||||||
XCC_FLAGS_flashlib_user.c = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
|
XCC_FLAGS_flashlib_user.c = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
|
||||||
|
|
||||||
OPTIONAL_HEADERS += xua_conf.h static_hid_report.h
|
OPTIONAL_HEADERS += xua_conf.h
|
||||||
|
|
||||||
EXPORT_INCLUDE_DIRS = api \
|
EXPORT_INCLUDE_DIRS = api \
|
||||||
src/core \
|
src/core \
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
// Copyright 2018-2023 XMOS LIMITED.
|
// Copyright 2018-2022 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
|
||||||
{
|
{
|
||||||
@@ -27,6 +29,7 @@ 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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -80,6 +80,14 @@ unsigned dsdMode = DSD_MODE_OFF;
|
|||||||
#endif
|
#endif
|
||||||
#include "xua_audiohub_st.h"
|
#include "xua_audiohub_st.h"
|
||||||
|
|
||||||
|
static inline void PortOutput(buffered out port:32 p, int bits, int value)
|
||||||
|
{
|
||||||
|
if(bits == 32)
|
||||||
|
p <: value;
|
||||||
|
else
|
||||||
|
partout(p, bits, value);
|
||||||
|
}
|
||||||
|
|
||||||
static inline int HandleSampleClock(int frameCount, buffered _XUA_CLK_DIR port:32 p_lrclk)
|
static inline int HandleSampleClock(int frameCount, buffered _XUA_CLK_DIR port:32 p_lrclk)
|
||||||
{
|
{
|
||||||
#if CODEC_MASTER
|
#if CODEC_MASTER
|
||||||
@@ -241,12 +249,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(curSamFreq);
|
UserBufferManagementInit();
|
||||||
|
|
||||||
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(curSamFreq);
|
UserBufferManagementInit();
|
||||||
|
|
||||||
#if (XUA_ADAT_TX_EN)
|
#if (XUA_ADAT_TX_EN)
|
||||||
unsafe{
|
unsafe{
|
||||||
@@ -286,6 +294,19 @@ unsigned static AudioHub_MainLoop(chanend ?c_out, chanend ?c_spd_out
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#if XUA_I2S_DUMMY_SAMPS
|
||||||
|
if(frameCount == 0)
|
||||||
|
{
|
||||||
|
for(int j = 0; j < XUA_I2S_DUMMY_SAMPS; j++)
|
||||||
|
for(int i = 0; i < I2S_WIRES_DAC; i++)
|
||||||
|
{
|
||||||
|
PortOutput(p_i2s_dac[i], XUA_I2S_N_BITS, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if (I2S_CHANS_ADC != 0)
|
#if (I2S_CHANS_ADC != 0)
|
||||||
#if (AUD_TO_USB_RATIO > 1)
|
#if (AUD_TO_USB_RATIO > 1)
|
||||||
if (0 == audioToUsbRatioCounter)
|
if (0 == audioToUsbRatioCounter)
|
||||||
@@ -478,6 +499,25 @@ unsigned static AudioHub_MainLoop(chanend ?c_out, chanend ?c_spd_out
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if XUA_I2S_DUMMY_SAMPS
|
||||||
|
if(frameCount == 1)
|
||||||
|
{
|
||||||
|
int dummyBits;
|
||||||
|
for(int j = 0; j < XUA_I2S_DUMMY_SAMPS; j++)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < I2S_WIRES_ADC; i++)
|
||||||
|
{
|
||||||
|
asm volatile("in %0, res[%1]" : "=r"(dummyBits) : "r"(p_i2s_adc[i]));
|
||||||
|
if(XUA_I2S_N_BITS)
|
||||||
|
set_port_shift_count(p_i2s_adc[i], XUA_I2S_N_BITS);
|
||||||
|
}
|
||||||
|
asm volatile("in %0, res[%1]" : "=r"(dummyBits) : "r"(p_lrclk));
|
||||||
|
if(XUA_I2S_N_BITS)
|
||||||
|
set_port_shift_count(p_lrclk, XUA_I2S_N_BITS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (I2S_CHANS_ADC != 0 || I2S_CHANS_DAC != 0)
|
#if (I2S_CHANS_ADC != 0 || I2S_CHANS_DAC != 0)
|
||||||
syncError += HandleSampleClock(frameCount, p_lrclk);
|
syncError += HandleSampleClock(frameCount, p_lrclk);
|
||||||
#endif
|
#endif
|
||||||
@@ -715,7 +755,13 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk,
|
|||||||
/* Calculate master clock to bit clock (or DSD clock) divide for current sample freq
|
/* Calculate master clock to bit clock (or DSD clock) divide for current sample freq
|
||||||
* e.g. 11.289600 / (176400 * 64) = 1 */
|
* e.g. 11.289600 / (176400 * 64) = 1 */
|
||||||
{
|
{
|
||||||
unsigned numBits = XUA_I2S_N_BITS * I2S_CHANS_PER_FRAME;
|
unsigned numBits = XUA_I2S_N_BITS * 2;
|
||||||
|
|
||||||
|
if(XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM)
|
||||||
|
{
|
||||||
|
/* TDM has 8 channels */
|
||||||
|
numBits *= 4;
|
||||||
|
}
|
||||||
|
|
||||||
#if (DSD_CHANS_DAC > 0)
|
#if (DSD_CHANS_DAC > 0)
|
||||||
if(dsdMode == DSD_MODE_DOP)
|
if(dsdMode == DSD_MODE_DOP)
|
||||||
@@ -806,7 +852,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_STOP_FOR_DFU) && command)
|
if (((curSamFreq / AUD_TO_USB_RATIO) != AUDIO_REBOOT_FROM_DFU) && ((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,9 +962,13 @@ 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);
|
||||||
|
|
||||||
|
if (curSamFreq == AUDIO_START_FROM_DFU)
|
||||||
|
{
|
||||||
outct(c_aud, XS1_CT_END);
|
outct(c_aud, XS1_CT_END);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
// Copyright 2016-2023 XMOS LIMITED.
|
// Copyright 2016-2021 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(unsigned sampFreq)
|
void __attribute__ ((weak)) UserBufferManagementInit()
|
||||||
{
|
{
|
||||||
/* Do nothing */
|
/* Do nothing */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -651,7 +651,6 @@ __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)
|
||||||
{
|
{
|
||||||
@@ -660,8 +659,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, mid);
|
SET_SHARED_GLOBAL(sampsToWrite, 0);
|
||||||
SET_SHARED_GLOBAL(totalSampsToWrite, mid);
|
SET_SHARED_GLOBAL(totalSampsToWrite, 0);
|
||||||
|
|
||||||
mid *= g_numUsbChan_In * slotSize;
|
mid *= g_numUsbChan_In * slotSize;
|
||||||
|
|
||||||
@@ -822,7 +821,6 @@ 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);
|
||||||
@@ -835,7 +833,6 @@ 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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wait for handshake back and pass back up */
|
/* Wait for handshake back and pass back up */
|
||||||
@@ -909,7 +906,6 @@ 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);
|
||||||
@@ -925,7 +921,6 @@ 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)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2011-2023 XMOS LIMITED.
|
// Copyright 2011-2022 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_USB_EN
|
#if XUA_USB_EN
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "xud.h"
|
#include "xud.h"
|
||||||
#include "testct_byref.h"
|
#include "testct_byref.h"
|
||||||
|
|
||||||
#if XUA_HID_ENABLED
|
#if( 0 < HID_CONTROLS )
|
||||||
#include "xua_hid_report.h"
|
#include "xua_hid_report.h"
|
||||||
#include "user_hid.h"
|
#include "user_hid.h"
|
||||||
#include "xua_hid.h"
|
#include "xua_hid.h"
|
||||||
@@ -134,7 +134,7 @@ void XUA_Buffer(
|
|||||||
c_clk_int,
|
c_clk_int,
|
||||||
#endif
|
#endif
|
||||||
c_sof, c_aud_ctl, p_off_mclk
|
c_sof, c_aud_ctl, p_off_mclk
|
||||||
#if XUA_HID_ENABLED
|
#if( 0 < HID_CONTROLS )
|
||||||
, c_hid
|
, c_hid
|
||||||
#endif
|
#endif
|
||||||
#ifdef CHAN_BUFF_CTRL
|
#ifdef CHAN_BUFF_CTRL
|
||||||
@@ -224,7 +224,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
|||||||
XUD_ep ep_int = XUD_InitEp(c_ep_int);
|
XUD_ep ep_int = XUD_InitEp(c_ep_int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XUA_HID_ENABLED
|
#if( 0 < HID_CONTROLS )
|
||||||
XUD_ep ep_hid = XUD_InitEp(c_hid);
|
XUD_ep ep_hid = XUD_InitEp(c_hid);
|
||||||
#endif
|
#endif
|
||||||
unsigned u_tmp;
|
unsigned u_tmp;
|
||||||
@@ -332,7 +332,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XUA_HID_ENABLED
|
#if( 0 < HID_CONTROLS )
|
||||||
|
|
||||||
while (!hidIsReportDescriptorPrepared())
|
while (!hidIsReportDescriptorPrepared())
|
||||||
;
|
;
|
||||||
@@ -897,7 +897,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XUA_HID_ENABLED
|
#if( 0 < HID_CONTROLS )
|
||||||
/* HID Report Data */
|
/* HID Report Data */
|
||||||
case XUD_SetData_Select(c_hid, ep_hid, result):
|
case XUD_SetData_Select(c_hid, ep_hid, result):
|
||||||
hid_ready_flag = 0U;
|
hid_ready_flag = 0U;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
// 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>
|
||||||
@@ -140,6 +141,9 @@ 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)
|
||||||
{
|
{
|
||||||
@@ -215,6 +219,18 @@ 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];
|
||||||
@@ -232,7 +248,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
|
||||||
@@ -253,10 +269,9 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa
|
|||||||
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 spdifRxTime;
|
int spdifReceivedTime;
|
||||||
unsigned tmp2;
|
unsigned tmp2;
|
||||||
unsigned spdifLeft = 0;
|
unsigned spdifLeft = 0;
|
||||||
unsigned spdifRxData;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (XUA_ADAT_RX_EN)
|
#if (XUA_ADAT_RX_EN)
|
||||||
@@ -281,21 +296,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] = 0;
|
clockFreq[CLOCK_SPDIF_INDEX] = 0;
|
||||||
clockValid[CLOCK_SPDIF] = 0;
|
clockValid[CLOCK_SPDIF_INDEX] = 0;
|
||||||
clockInt[CLOCK_SPDIF] = 0;
|
clockInt[CLOCK_SPDIF_INDEX] = 0;
|
||||||
clockId[CLOCK_SPDIF] = ID_CLKSRC_SPDIF;
|
clockId[CLOCK_SPDIF_INDEX] = 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] = 0;
|
clockFreq[CLOCK_ADAT_INDEX] = 0;
|
||||||
clockInt[CLOCK_ADAT] = 0;
|
clockInt[CLOCK_ADAT_INDEX] = 0;
|
||||||
clockValid[CLOCK_ADAT] = 0;
|
clockValid[CLOCK_ADAT_INDEX] = 0;
|
||||||
clockId[CLOCK_ADAT] = ID_CLKSRC_ADAT;
|
clockId[CLOCK_ADAT_INDEX] = ID_CLKSRC_ADAT;
|
||||||
#endif
|
#endif
|
||||||
#if (XUA_SPDIF_RX_EN)
|
#if (XUA_SPDIF_RX_EN)
|
||||||
spdifCounters.receivedSamples = 0;
|
spdifCounters.receivedSamples = 0;
|
||||||
@@ -315,6 +330,7 @@ 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);
|
||||||
@@ -389,9 +405,13 @@ 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 */
|
||||||
clkMode = inuint(c_clk_ctl);
|
tmp = 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)
|
||||||
{
|
{
|
||||||
@@ -400,12 +420,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]);
|
VendorClockValidity(clockValid[CLOCK_ADAT_INDEX]);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if (XUA_SPDIF_RX_EN)
|
#if (XUA_SPDIF_RX_EN)
|
||||||
case CLOCK_SPDIF:
|
case CLOCK_SPDIF:
|
||||||
VendorClockValidity(clockValid[CLOCK_SPDIF]);
|
VendorClockValidity(clockValid[CLOCK_SPDIF_INDEX]);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -479,56 +499,58 @@ 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:
|
||||||
{
|
|
||||||
int valid;
|
|
||||||
timeNextClockDetection += (LOCAL_CLOCK_INCREMENT);
|
timeNextClockDetection += (LOCAL_CLOCK_INCREMENT);
|
||||||
#if (XUA_SPDIF_RX_EN)
|
#if (XUA_SPDIF_RX_EN)
|
||||||
|
tmp = spdifCounters.samplesPerTick;
|
||||||
|
|
||||||
/* Returns 1 if valid clock found */
|
/* Returns 1 if valid clock found */
|
||||||
valid = validSamples(spdifCounters, CLOCK_SPDIF);
|
tmp = validSamples(spdifCounters, CLOCK_SPDIF_INDEX);
|
||||||
setClockValidity(c_clk_int, CLOCK_SPDIF, valid, clkMode);
|
setClockValidity(c_clk_int, CLOCK_SPDIF_INDEX, tmp, clkMode);
|
||||||
#endif
|
#endif
|
||||||
#if (XUA_ADAT_RX_EN)
|
#if (XUA_ADAT_RX_EN)
|
||||||
/* Returns 1 if valid clock found */
|
tmp = validSamples(adatCounters, CLOCK_ADAT_INDEX);
|
||||||
valid = validSamples(adatCounters, CLOCK_ADAT);
|
setClockValidity(c_clk_int, CLOCK_ADAT_INDEX, tmp, clkMode);
|
||||||
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 (streaming chan) */
|
/* Receive sample from S/PDIF RX thread (steaming chan) */
|
||||||
case c_spdif_rx :> spdifRxData:
|
case c_spdif_rx :> tmp:
|
||||||
|
|
||||||
/* Record time of sample */
|
/* Record time of sample */
|
||||||
t_local :> spdifRxTime;
|
t_local :> spdifReceivedTime;
|
||||||
|
|
||||||
/* Check parity and ignore if bad */
|
/* Check parity and ignore if bad */
|
||||||
if(spdif_rx_check_parity(spdifRxData))
|
if(badParity(tmp))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Get preamble */
|
/* Get pre-amble */
|
||||||
unsigned preamble = spdifRxData & SPDIF_RX_PREAMBLE_MASK;
|
tmp2 = tmp & 0xF;
|
||||||
|
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])
|
if(!spdifOverflow && clockValid[CLOCK_SPDIF_INDEX])
|
||||||
{
|
{
|
||||||
/* 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] = SPDIF_RX_EXTRACT_SAMPLE(spdifRxData);
|
spdifSamples[spdifWr+1] = tmp << 4;
|
||||||
|
|
||||||
spdifWr = (spdifWr + 2) & (MAX_SPDIF_SAMPLES - 1);
|
spdifWr = (spdifWr + 2) & (MAX_SPDIF_SAMPLES - 1);
|
||||||
|
|
||||||
@@ -556,7 +578,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])
|
if(clkMode == CLOCK_SPDIF && clockValid[CLOCK_SPDIF_INDEX])
|
||||||
{
|
{
|
||||||
spdifCounters.receivedSamples+=1;
|
spdifCounters.receivedSamples+=1;
|
||||||
|
|
||||||
@@ -564,13 +586,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(spdifRxTime, (timeLastEdge + LOCAL_CLOCK_INCREMENT - LOCAL_CLOCK_MARGIN)))
|
if(timeafter(spdifReceivedTime, (timeLastEdge + LOCAL_CLOCK_INCREMENT - LOCAL_CLOCK_MARGIN)))
|
||||||
{
|
{
|
||||||
/* Record edge time */
|
/* Record edge time */
|
||||||
timeLastEdge = spdifRxTime;
|
timeLastEdge = spdifReceivedTime;
|
||||||
|
|
||||||
/* Setup for next edge */
|
/* Setup for next edge */
|
||||||
timeNextEdge = spdifRxTime + LOCAL_CLOCK_INCREMENT + LOCAL_CLOCK_MARGIN;
|
timeNextEdge = spdifReceivedTime + LOCAL_CLOCK_INCREMENT + LOCAL_CLOCK_MARGIN;
|
||||||
|
|
||||||
/* Toggle edge */
|
/* Toggle edge */
|
||||||
i_pll_ref.toggle_timed(1);
|
i_pll_ref.toggle_timed(1);
|
||||||
@@ -605,7 +627,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])
|
if (!adatOverflow && clockValid[CLOCK_ADAT_INDEX])
|
||||||
{
|
{
|
||||||
/* Unpick the SMUX.. */
|
/* Unpick the SMUX.. */
|
||||||
if(smux == 2)
|
if(smux == 2)
|
||||||
@@ -662,7 +684,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])
|
if (clkMode == CLOCK_ADAT && clockValid[CLOCK_ADAT_INDEX])
|
||||||
{
|
{
|
||||||
adatCounters.receivedSamples += 1;
|
adatCounters.receivedSamples += 1;
|
||||||
|
|
||||||
@@ -683,6 +705,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa
|
|||||||
|
|
||||||
/* Reset counters */
|
/* Reset counters */
|
||||||
adatCounters.receivedSamples = 0;
|
adatCounters.receivedSamples = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -693,6 +716,7 @@ 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):
|
||||||
@@ -732,6 +756,7 @@ 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)
|
||||||
@@ -817,6 +842,8 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2015-2023 XMOS LIMITED.
|
// Copyright 2015-2021 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 __DESCRIPTOR_DEFS_H__
|
#ifndef __DESCRIPTOR_DEFS_H__
|
||||||
@@ -33,7 +33,6 @@
|
|||||||
#define ENDPOINT_ADDRESS_OUT_MIDI (ENDPOINT_NUMBER_OUT_MIDI)
|
#define ENDPOINT_ADDRESS_OUT_MIDI (ENDPOINT_NUMBER_OUT_MIDI)
|
||||||
#define ENDPOINT_ADDRESS_OUT_IAP (ENDPOINT_NUMBER_OUT_IAP)
|
#define ENDPOINT_ADDRESS_OUT_IAP (ENDPOINT_NUMBER_OUT_IAP)
|
||||||
#define ENDPOINT_ADDRESS_OUT_IAP_EA_NATIVE_TRANS (ENDPOINT_NUMBER_OUT_IAP_EA_NATIVE_TRANS)
|
#define ENDPOINT_ADDRESS_OUT_IAP_EA_NATIVE_TRANS (ENDPOINT_NUMBER_OUT_IAP_EA_NATIVE_TRANS)
|
||||||
#define ENDPOINT_ADDRESS_OUT_HID (ENDPOINT_NUMBER_OUT_HID)
|
|
||||||
|
|
||||||
/* Interface numbers enum */
|
/* Interface numbers enum */
|
||||||
enum USBInterfaceNumber
|
enum USBInterfaceNumber
|
||||||
@@ -61,7 +60,7 @@ enum USBInterfaceNumber
|
|||||||
INTERFACE_NUMBER_IAP_EA_NATIVE_TRANS,
|
INTERFACE_NUMBER_IAP_EA_NATIVE_TRANS,
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if XUA_OR_STATIC_HID_ENABLED
|
#if( 0 < HID_CONTROLS )
|
||||||
INTERFACE_NUMBER_HID,
|
INTERFACE_NUMBER_HID,
|
||||||
#endif
|
#endif
|
||||||
INTERFACE_COUNT /* End marker */
|
INTERFACE_COUNT /* End marker */
|
||||||
@@ -71,8 +70,4 @@ enum USBInterfaceNumber
|
|||||||
#define ENDPOINT_INT_INTERVAL_IN_HID 0x08
|
#define ENDPOINT_INT_INTERVAL_IN_HID 0x08
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ENDPOINT_INT_INTERVAL_OUT_HID
|
|
||||||
#define ENDPOINT_INT_INTERVAL_OUT_HID 0x08
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#include "xc_ptr.h"
|
#include "xc_ptr.h"
|
||||||
#include "xua_ep0_uacreqs.h"
|
#include "xua_ep0_uacreqs.h"
|
||||||
|
|
||||||
#if XUA_OR_STATIC_HID_ENABLED
|
#if( 0 < HID_CONTROLS )
|
||||||
#include "hid.h"
|
#include "hid.h"
|
||||||
#include "xua_hid.h"
|
#include "xua_hid.h"
|
||||||
#include "xua_hid_report.h"
|
#include "xua_hid_report.h"
|
||||||
@@ -442,15 +442,6 @@ void XUA_Endpoint0_setBcdDevice(unsigned short bcd) {
|
|||||||
#endif // AUDIO_CLASS == 1}
|
#endif // AUDIO_CLASS == 1}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__static_hid_report_h_exists__)
|
|
||||||
#define hidReportDescriptorLength (sizeof(hidReportDescriptorPtr))
|
|
||||||
static unsigned char hidReportDescriptorPtr[] = {
|
|
||||||
#include "static_hid_report.h"
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, NULLABLE_RESOURCE(chanend, c_audioControl),
|
void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, NULLABLE_RESOURCE(chanend, c_audioControl),
|
||||||
chanend c_mix_ctl, chanend c_clk_ctl, chanend c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_)
|
chanend c_mix_ctl, chanend c_clk_ctl, chanend c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_)
|
||||||
{
|
{
|
||||||
@@ -522,13 +513,11 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, NULLABLE_RESOURCE(c
|
|||||||
|
|
||||||
#endif // XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES
|
#endif // XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES
|
||||||
|
|
||||||
#if XUA_OR_STATIC_HID_ENABLED
|
#if( 0 < HID_CONTROLS )
|
||||||
#if XUA_HID_ENABLED
|
|
||||||
hidReportInit();
|
hidReportInit();
|
||||||
hidPrepareReportDescriptor();
|
hidPrepareReportDescriptor();
|
||||||
|
|
||||||
size_t hidReportDescriptorLength = hidGetReportDescriptorLength();
|
size_t hidReportDescriptorLength = hidGetReportDescriptorLength();
|
||||||
#endif
|
|
||||||
unsigned char hidReportDescriptorLengthLo = hidReportDescriptorLength & 0xFF;
|
unsigned char hidReportDescriptorLengthLo = hidReportDescriptorLength & 0xFF;
|
||||||
unsigned char hidReportDescriptorLengthHi = (hidReportDescriptorLength & 0xFF00) >> 8;
|
unsigned char hidReportDescriptorLengthHi = (hidReportDescriptorLength & 0xFF00) >> 8;
|
||||||
|
|
||||||
@@ -539,7 +528,6 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, NULLABLE_RESOURCE(c
|
|||||||
|
|
||||||
hidDescriptor[HID_DESCRIPTOR_LENGTH_FIELD_OFFSET ] = hidReportDescriptorLengthLo;
|
hidDescriptor[HID_DESCRIPTOR_LENGTH_FIELD_OFFSET ] = hidReportDescriptorLengthLo;
|
||||||
hidDescriptor[HID_DESCRIPTOR_LENGTH_FIELD_OFFSET + 1] = hidReportDescriptorLengthHi;
|
hidDescriptor[HID_DESCRIPTOR_LENGTH_FIELD_OFFSET + 1] = hidReportDescriptorLengthHi;
|
||||||
|
|
||||||
#endif // 0 < HID_CONTROLS
|
#endif // 0 < HID_CONTROLS
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -743,7 +731,7 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0
|
|||||||
|
|
||||||
switch(sp.bRequest)
|
switch(sp.bRequest)
|
||||||
{
|
{
|
||||||
#if XUA_OR_STATIC_HID_ENABLED
|
#if( 0 < HID_CONTROLS )
|
||||||
case USB_GET_DESCRIPTOR:
|
case USB_GET_DESCRIPTOR:
|
||||||
|
|
||||||
/* Check what inteface request is for */
|
/* Check what inteface request is for */
|
||||||
@@ -758,17 +746,15 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0
|
|||||||
{
|
{
|
||||||
/* Return HID Descriptor */
|
/* Return HID Descriptor */
|
||||||
result = XUD_DoGetRequest(ep0_out, ep0_in, hidDescriptor,
|
result = XUD_DoGetRequest(ep0_out, ep0_in, hidDescriptor,
|
||||||
hidDescriptor[0], sp.wLength);
|
sizeof(hidDescriptor), sp.wLength);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HID_REPORT:
|
case HID_REPORT:
|
||||||
{
|
{
|
||||||
/* Return HID report descriptor */
|
/* Return HID report descriptor */
|
||||||
#if XUA_HID_ENABLED
|
|
||||||
unsigned char* hidReportDescriptorPtr;
|
unsigned char* hidReportDescriptorPtr;
|
||||||
hidReportDescriptorPtr = hidGetReportDescriptor();
|
hidReportDescriptorPtr = hidGetReportDescriptor();
|
||||||
size_t hidReportDescriptorLength = hidGetReportDescriptorLength();
|
size_t hidReportDescriptorLength = hidGetReportDescriptorLength();
|
||||||
#endif
|
|
||||||
result = XUD_DoGetRequest(ep0_out, ep0_in, hidReportDescriptorPtr,
|
result = XUD_DoGetRequest(ep0_out, ep0_in, hidReportDescriptorPtr,
|
||||||
hidReportDescriptorLength, sp.wLength);
|
hidReportDescriptorLength, sp.wLength);
|
||||||
}
|
}
|
||||||
@@ -872,7 +858,7 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if XUA_HID_ENABLED
|
#if( 0 < HID_CONTROLS )
|
||||||
if (interfaceNum == INTERFACE_NUMBER_HID)
|
if (interfaceNum == INTERFACE_NUMBER_HID)
|
||||||
{
|
{
|
||||||
result = HidInterfaceClassRequests(ep0_out, ep0_in, &sp);
|
result = HidInterfaceClassRequests(ep0_out, ep0_in, &sp);
|
||||||
|
|||||||
@@ -481,7 +481,7 @@ USB_Descriptor_Device_t devDesc_Audio2 =
|
|||||||
.iManufacturer = offsetof(StringDescTable_t, vendorStr)/sizeof(char *),
|
.iManufacturer = offsetof(StringDescTable_t, vendorStr)/sizeof(char *),
|
||||||
.iProduct = offsetof(StringDescTable_t, productStr_Audio2)/sizeof(char *),
|
.iProduct = offsetof(StringDescTable_t, productStr_Audio2)/sizeof(char *),
|
||||||
.iSerialNumber = offsetof(StringDescTable_t, serialStr)/sizeof(char *),
|
.iSerialNumber = offsetof(StringDescTable_t, serialStr)/sizeof(char *),
|
||||||
.bNumConfigurations = 0x01
|
.bNumConfigurations = 0x02 /* Set to 2 such that windows does not load composite driver */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Device Descriptor for Null Device */
|
/* Device Descriptor for Null Device */
|
||||||
@@ -787,13 +787,10 @@ typedef struct
|
|||||||
#endif
|
#endif
|
||||||
#endif // IAP
|
#endif // IAP
|
||||||
|
|
||||||
#if XUA_OR_STATIC_HID_ENABLED
|
#if( 0 < HID_CONTROLS )
|
||||||
USB_Descriptor_Interface_t HID_Interface;
|
USB_Descriptor_Interface_t HID_Interface;
|
||||||
USB_HID_Descriptor_t HID_Descriptor;
|
USB_HID_Descriptor_t HID_Descriptor;
|
||||||
USB_Descriptor_Endpoint_t HID_In_Endpoint;
|
USB_Descriptor_Endpoint_t HID_In_Endpoint;
|
||||||
#if HID_OUT_REQUIRED
|
|
||||||
USB_Descriptor_Endpoint_t HID_Out_Endpoint;
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}__attribute__((packed)) USB_Config_Descriptor_Audio2_t;
|
}__attribute__((packed)) USB_Config_Descriptor_Audio2_t;
|
||||||
@@ -2211,14 +2208,14 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
|||||||
#endif
|
#endif
|
||||||
#endif /* IAP */
|
#endif /* IAP */
|
||||||
|
|
||||||
#if XUA_OR_STATIC_HID_ENABLED
|
#if( 0 < HID_CONTROLS )
|
||||||
#include "xua_hid_descriptors.h"
|
#include "xua_hid_descriptors.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif /* (AUDIO_CLASS == 2) */
|
#endif /* (AUDIO_CLASS == 2) */
|
||||||
|
|
||||||
#if XUA_OR_STATIC_HID_ENABLED
|
#if( 0 < HID_CONTROLS )
|
||||||
#if (AUDIO_CLASS ==1 )
|
#if (AUDIO_CLASS ==1 )
|
||||||
unsigned char hidDescriptor[] =
|
unsigned char hidDescriptor[] =
|
||||||
{
|
{
|
||||||
@@ -2333,14 +2330,14 @@ const unsigned num_freqs_a1 = MAX(3, (0
|
|||||||
#define DFU_INTERFACES_A1 0
|
#define DFU_INTERFACES_A1 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XUA_OR_STATIC_HID_ENABLED
|
#if( 0 < HID_CONTROLS )
|
||||||
/*
|
/*
|
||||||
* The value of HID_INTERFACE_BYTES must match the length of the descriptors defined in
|
* The value of HID_INTERFACE_BYTES must match the length of the descriptors defined in
|
||||||
* - xua_hid_descriptor_contents.h
|
* - xua_hid_descriptor_contents.h
|
||||||
* - xua_hid_endpoint_descriptor_contents.h and
|
* - xua_hid_endpoint_descriptor_contents.h and
|
||||||
* - xua_hid_interface_descriptor_contents.h
|
* - xua_hid_interface_descriptor_contents.h
|
||||||
*/
|
*/
|
||||||
#define HID_INTERFACE_BYTES ( 9 + 9 + (7 * (1 + HID_OUT_REQUIRED))) // always IN
|
#define HID_INTERFACE_BYTES ( 9 + 9 + 7 )
|
||||||
#define HID_INTERFACES_A1 1
|
#define HID_INTERFACES_A1 1
|
||||||
#else
|
#else
|
||||||
#define HID_INTERFACE_BYTES 0
|
#define HID_INTERFACE_BYTES 0
|
||||||
@@ -2382,7 +2379,7 @@ const unsigned num_freqs_a1 = MAX(3, (0
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XUA_OR_STATIC_HID_ENABLED
|
#if( 0 < HID_CONTROLS )
|
||||||
#define USB_HID_DESCRIPTOR_OFFSET (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (OUTPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + CONTROL_INTERFACE_BYTES + DFU_INTERFACE_BYTES + INTERFACE_DESCRIPTOR_BYTES)
|
#define USB_HID_DESCRIPTOR_OFFSET (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (OUTPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + CONTROL_INTERFACE_BYTES + DFU_INTERFACE_BYTES + INTERFACE_DESCRIPTOR_BYTES)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2896,7 +2893,7 @@ unsigned char cfgDesc_Audio1[] =
|
|||||||
offsetof(StringDescTable_t, ctrlStr)/sizeof(char *), /* 8 iInterface */
|
offsetof(StringDescTable_t, ctrlStr)/sizeof(char *), /* 8 iInterface */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XUA_OR_STATIC_HID_ENABLED
|
#if( 0 < HID_CONTROLS )
|
||||||
#include "xua_hid_descriptors.h"
|
#include "xua_hid_descriptors.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -456,35 +456,34 @@ 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);
|
outuint(c_clk_ctl, CLOCK_SPDIF_INDEX);
|
||||||
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);
|
outuint(c_clk_ctl, CLOCK_ADAT_INDEX);
|
||||||
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
|
||||||
@@ -514,23 +513,19 @@ 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)
|
||||||
{
|
|
||||||
int clockIndex = (int) (buffer, unsigned char[])[0];
|
|
||||||
clockIndex -= 1; /* Index to/from host is 1-based */
|
|
||||||
|
|
||||||
if((clockIndex >= 0) && (clockIndex < CLOCK_COUNT))
|
|
||||||
{
|
{
|
||||||
if (!isnull(c_clk_ctl))
|
if (!isnull(c_clk_ctl))
|
||||||
{
|
{
|
||||||
outuint(c_clk_ctl, SET_SEL);
|
outuint(c_clk_ctl, SET_SEL);
|
||||||
outuint(c_clk_ctl, clockIndex);
|
outuint(c_clk_ctl, (buffer, unsigned char[])[0]);
|
||||||
outct(c_clk_ctl, XS1_CT_END);
|
outct(c_clk_ctl, XS1_CT_END);
|
||||||
}
|
}
|
||||||
/* Send 0 Length as status stage */
|
/* Send 0 Length as status stage */
|
||||||
return XUD_DoSetRequestStatus(ep0_in);
|
return XUD_DoSetRequestStatus(ep0_in);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -538,15 +533,13 @@ 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);
|
||||||
clockIndex = inuint(c_clk_ctl);
|
(buffer, unsigned char[])[0] = 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;
|
||||||
@@ -923,20 +916,17 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentFreq44*=2;
|
if((currentFreq48 <= maxFreq))
|
||||||
|
|
||||||
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;
|
currentFreq48*=2;
|
||||||
|
}
|
||||||
if((currentFreq48 > MAX_FREQ) && (currentFreq44 > MAX_FREQ))
|
else
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,8 +30,8 @@
|
|||||||
#include "iap.h"
|
#include "iap.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (XUA_SPDIF_RX_EN || XUA_SPDIF_TX_EN)
|
#if (XUA_SPDIF_RX_EN)
|
||||||
#include "spdif.h" /* From lib_spdif */
|
#include "spdif.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (XUA_ADAT_RX_EN)
|
#if (XUA_ADAT_RX_EN)
|
||||||
@@ -42,6 +42,10 @@
|
|||||||
#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);
|
||||||
@@ -209,9 +213,6 @@ XUD_EpType epTypeTableOut[ENDPOINT_COUNT_OUT] = { XUD_EPTYPE_CTL | XUD_STATUS_EN
|
|||||||
#ifdef MIDI
|
#ifdef MIDI
|
||||||
XUD_EPTYPE_BUL, /* MIDI */
|
XUD_EPTYPE_BUL, /* MIDI */
|
||||||
#endif
|
#endif
|
||||||
#if HID_OUT_REQUIRED
|
|
||||||
XUD_EPTYPE_INT,
|
|
||||||
#endif
|
|
||||||
#ifdef IAP
|
#ifdef IAP
|
||||||
XUD_EPTYPE_BUL, /* iAP */
|
XUD_EPTYPE_BUL, /* iAP */
|
||||||
#ifdef IAP_EA_NATIVE_TRANS
|
#ifdef IAP_EA_NATIVE_TRANS
|
||||||
@@ -232,7 +233,7 @@ XUD_EpType epTypeTableIn[ENDPOINT_COUNT_IN] = { XUD_EPTYPE_CTL | XUD_STATUS_ENAB
|
|||||||
#ifdef MIDI
|
#ifdef MIDI
|
||||||
XUD_EPTYPE_BUL,
|
XUD_EPTYPE_BUL,
|
||||||
#endif
|
#endif
|
||||||
#if XUA_OR_STATIC_HID_ENABLED
|
#if( 0 < HID_CONTROLS )
|
||||||
XUD_EPTYPE_INT,
|
XUD_EPTYPE_INT,
|
||||||
#endif
|
#endif
|
||||||
#ifdef IAP
|
#ifdef IAP
|
||||||
@@ -266,6 +267,115 @@ void xscope_user_init()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if XUA_USB_EN
|
||||||
|
/* Core USB Audio functions - must be called on the Tile connected to the USB Phy */
|
||||||
|
void usb_audio_core(chanend c_mix_out
|
||||||
|
#ifdef MIDI
|
||||||
|
, chanend c_midi
|
||||||
|
#endif
|
||||||
|
#if (MIXER)
|
||||||
|
, chanend c_mix_ctl
|
||||||
|
#endif
|
||||||
|
, chanend ?c_clk_int
|
||||||
|
, chanend ?c_clk_ctl
|
||||||
|
, client interface i_dfu ?dfuInterface
|
||||||
|
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||||
|
, client interface pll_ref_if i_pll_ref
|
||||||
|
#endif
|
||||||
|
VENDOR_REQUESTS_PARAMS_DEC_
|
||||||
|
)
|
||||||
|
{
|
||||||
|
chan c_sof;
|
||||||
|
chan c_xud_out[ENDPOINT_COUNT_OUT]; /* Endpoint channels for XUD */
|
||||||
|
chan c_xud_in[ENDPOINT_COUNT_IN];
|
||||||
|
chan c_aud_ctl;
|
||||||
|
|
||||||
|
#if (!MIXER)
|
||||||
|
#define c_mix_ctl null
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef IAP_EA_NATIVE_TRANS
|
||||||
|
chan c_EANativeTransport_ctrl;
|
||||||
|
#else
|
||||||
|
#define c_EANativeTransport_ctrl null
|
||||||
|
#endif
|
||||||
|
|
||||||
|
par
|
||||||
|
{
|
||||||
|
{
|
||||||
|
#ifdef XUD_PRIORITY_HIGH
|
||||||
|
set_core_high_priority_on();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Run UAC2.0 at high-speed, UAC1.0 at full-speed */
|
||||||
|
unsigned usbSpeed = (AUDIO_CLASS == 2) ? XUD_SPEED_HS : XUD_SPEED_FS;
|
||||||
|
|
||||||
|
unsigned xudPwrCfg = (XUA_POWERMODE == XUA_POWERMODE_SELF) ? XUD_PWR_SELF : XUD_PWR_BUS;
|
||||||
|
|
||||||
|
/* USB interface core */
|
||||||
|
XUD_Main(c_xud_out, ENDPOINT_COUNT_OUT, c_xud_in, ENDPOINT_COUNT_IN,
|
||||||
|
c_sof, epTypeTableOut, epTypeTableIn, usbSpeed, xudPwrCfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
unsigned x;
|
||||||
|
thread_speed();
|
||||||
|
|
||||||
|
/* Attach mclk count port to mclk clock-block (for feedback) */
|
||||||
|
//set_port_clock(p_for_mclk_count, clk_audio_mclk);
|
||||||
|
#if(AUDIO_IO_TILE != XUD_TILE)
|
||||||
|
set_clock_src(clk_audio_mclk_usb, p_mclk_in_usb);
|
||||||
|
set_port_clock(p_for_mclk_count, clk_audio_mclk_usb);
|
||||||
|
start_clock(clk_audio_mclk_usb);
|
||||||
|
#else
|
||||||
|
/* Clock port from same clock-block as I2S */
|
||||||
|
/* TODO remove asm() */
|
||||||
|
asm("ldw %0, dp[clk_audio_mclk]":"=r"(x));
|
||||||
|
asm("setclk res[%0], %1"::"r"(p_for_mclk_count), "r"(x));
|
||||||
|
#endif
|
||||||
|
/* Endpoint & audio buffering cores */
|
||||||
|
XUA_Buffer(c_xud_out[ENDPOINT_NUMBER_OUT_AUDIO],/* Audio Out*/
|
||||||
|
#if (NUM_USB_CHAN_IN > 0)
|
||||||
|
|
||||||
|
c_xud_in[ENDPOINT_NUMBER_IN_AUDIO], /* Audio In */
|
||||||
|
#endif
|
||||||
|
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||||
|
c_xud_in[ENDPOINT_NUMBER_IN_FEEDBACK], /* Audio FB */
|
||||||
|
#endif
|
||||||
|
#ifdef MIDI
|
||||||
|
c_xud_out[ENDPOINT_NUMBER_OUT_MIDI], /* MIDI Out */ // 2
|
||||||
|
c_xud_in[ENDPOINT_NUMBER_IN_MIDI], /* MIDI In */ // 4
|
||||||
|
c_midi,
|
||||||
|
#endif
|
||||||
|
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||||
|
/* Audio Interrupt - only used for interrupts on external clock change */
|
||||||
|
c_xud_in[ENDPOINT_NUMBER_IN_INTERRUPT],
|
||||||
|
c_clk_int,
|
||||||
|
#endif
|
||||||
|
c_sof, c_aud_ctl, p_for_mclk_count
|
||||||
|
#if (HID_CONTROLS)
|
||||||
|
, c_xud_in[ENDPOINT_NUMBER_IN_HID]
|
||||||
|
#endif
|
||||||
|
, c_mix_out
|
||||||
|
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||||
|
, i_pll_ref
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
//:
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Endpoint 0 Core */
|
||||||
|
{
|
||||||
|
thread_speed();
|
||||||
|
XUA_Endpoint0( c_xud_out[0], c_xud_in[0], c_aud_ctl, c_mix_ctl, c_clk_ctl, c_EANativeTransport_ctrl, dfuInterface VENDOR_REQUESTS_PARAMS_);
|
||||||
|
}
|
||||||
|
|
||||||
|
//:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* XUA_USB_EN */
|
||||||
|
|
||||||
|
|
||||||
#if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
|
#if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
|
||||||
void SpdifTxWrapper(chanend c_spdif_tx)
|
void SpdifTxWrapper(chanend c_spdif_tx)
|
||||||
{
|
{
|
||||||
@@ -336,7 +446,7 @@ void usb_audio_io(chanend ?c_aud_in,
|
|||||||
|
|
||||||
par
|
par
|
||||||
{
|
{
|
||||||
#if (MIXER && XUA_USB_EN)
|
#if (MIXER)
|
||||||
/* Mixer cores(s) */
|
/* Mixer cores(s) */
|
||||||
{
|
{
|
||||||
thread_speed();
|
thread_speed();
|
||||||
@@ -465,20 +575,6 @@ int main()
|
|||||||
|
|
||||||
#if ((XUA_SYNCMODE == XUA_SYNCMODE_SYNC) || XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
#if ((XUA_SYNCMODE == XUA_SYNCMODE_SYNC) || XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||||
interface pll_ref_if i_pll_ref;
|
interface pll_ref_if i_pll_ref;
|
||||||
#endif
|
|
||||||
chan c_sof;
|
|
||||||
chan c_xud_out[ENDPOINT_COUNT_OUT]; /* Endpoint channels for XUD */
|
|
||||||
chan c_xud_in[ENDPOINT_COUNT_IN];
|
|
||||||
chan c_aud_ctl;
|
|
||||||
|
|
||||||
#if (!MIXER)
|
|
||||||
#define c_mix_ctl null
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IAP_EA_NATIVE_TRANS
|
|
||||||
chan c_EANativeTransport_ctrl;
|
|
||||||
#else
|
|
||||||
#define c_EANativeTransport_ctrl null
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USER_MAIN_DECLARATIONS
|
USER_MAIN_DECLARATIONS
|
||||||
@@ -493,83 +589,35 @@ int main()
|
|||||||
on tile[XUD_TILE]:
|
on tile[XUD_TILE]:
|
||||||
par
|
par
|
||||||
{
|
{
|
||||||
#if XUA_USB_EN
|
#if (XUD_TILE == 0)
|
||||||
#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
|
||||||
|
|
||||||
/* Core USB task, buffering, USB etc */
|
|
||||||
{
|
|
||||||
#ifdef XUD_PRIORITY_HIGH
|
|
||||||
set_core_high_priority_on();
|
|
||||||
#endif
|
#endif
|
||||||
|
#if XUA_USB_EN
|
||||||
/* Run UAC2.0 at high-speed, UAC1.0 at full-speed */
|
|
||||||
unsigned usbSpeed = (AUDIO_CLASS == 2) ? XUD_SPEED_HS : XUD_SPEED_FS;
|
|
||||||
|
|
||||||
unsigned xudPwrCfg = (XUA_POWERMODE == XUA_POWERMODE_SELF) ? XUD_PWR_SELF : XUD_PWR_BUS;
|
|
||||||
|
|
||||||
/* USB interface core */
|
|
||||||
XUD_Main(c_xud_out, ENDPOINT_COUNT_OUT, c_xud_in, ENDPOINT_COUNT_IN,
|
|
||||||
c_sof, epTypeTableOut, epTypeTableIn, usbSpeed, xudPwrCfg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Core USB audio task, buffering, USB etc */
|
/* Core USB audio task, buffering, USB etc */
|
||||||
{
|
usb_audio_core(c_mix_out
|
||||||
unsigned x;
|
|
||||||
thread_speed();
|
|
||||||
|
|
||||||
/* Attach mclk count port to mclk clock-block (for feedback) */
|
|
||||||
//set_port_clock(p_for_mclk_count, clk_audio_mclk);
|
|
||||||
#if(AUDIO_IO_TILE != XUD_TILE)
|
|
||||||
set_clock_src(clk_audio_mclk_usb, p_mclk_in_usb);
|
|
||||||
set_port_clock(p_for_mclk_count, clk_audio_mclk_usb);
|
|
||||||
start_clock(clk_audio_mclk_usb);
|
|
||||||
#else
|
|
||||||
/* Clock port from same clock-block as I2S */
|
|
||||||
/* TODO remove asm() */
|
|
||||||
asm("ldw %0, dp[clk_audio_mclk]":"=r"(x));
|
|
||||||
asm("setclk res[%0], %1"::"r"(p_for_mclk_count), "r"(x));
|
|
||||||
#endif
|
|
||||||
/* Endpoint & audio buffering cores */
|
|
||||||
XUA_Buffer(c_xud_out[ENDPOINT_NUMBER_OUT_AUDIO],/* Audio Out*/
|
|
||||||
#if (NUM_USB_CHAN_IN > 0)
|
|
||||||
|
|
||||||
c_xud_in[ENDPOINT_NUMBER_IN_AUDIO], /* Audio In */
|
|
||||||
#endif
|
|
||||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
|
||||||
c_xud_in[ENDPOINT_NUMBER_IN_FEEDBACK], /* Audio FB */
|
|
||||||
#endif
|
|
||||||
#ifdef MIDI
|
#ifdef MIDI
|
||||||
c_xud_out[ENDPOINT_NUMBER_OUT_MIDI], /* MIDI Out */ // 2
|
, c_midi
|
||||||
c_xud_in[ENDPOINT_NUMBER_IN_MIDI], /* MIDI In */ // 4
|
|
||||||
c_midi,
|
|
||||||
#endif
|
#endif
|
||||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
#ifdef IAP
|
||||||
/* Audio Interrupt - only used for interrupts on external clock change */
|
, c_iap
|
||||||
c_xud_in[ENDPOINT_NUMBER_IN_INTERRUPT],
|
#ifdef IAP_EA_NATIVE_TRANS
|
||||||
c_clk_int,
|
, c_ea_data
|
||||||
#endif
|
#endif
|
||||||
c_sof, c_aud_ctl, p_for_mclk_count
|
|
||||||
#if (XUA_HID_ENABLED)
|
|
||||||
, c_xud_in[ENDPOINT_NUMBER_IN_HID]
|
|
||||||
#endif
|
#endif
|
||||||
, c_mix_out
|
#if (MIXER)
|
||||||
|
, c_mix_ctl
|
||||||
|
#endif
|
||||||
|
, c_clk_int, c_clk_ctl, dfuInterface
|
||||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||||
, i_pll_ref
|
, i_pll_ref
|
||||||
#endif
|
#endif
|
||||||
|
VENDOR_REQUESTS_PARAMS_
|
||||||
|
|
||||||
);
|
);
|
||||||
//:
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Endpoint 0 Core */
|
|
||||||
{
|
|
||||||
thread_speed();
|
|
||||||
XUA_Endpoint0( c_xud_out[0], c_xud_in[0], c_aud_ctl, c_mix_ctl, c_clk_ctl, c_EANativeTransport_ctrl, dfuInterface VENDOR_REQUESTS_PARAMS_);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* XUA_USB_EN */
|
#endif /* XUA_USB_EN */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2013-2023 XMOS LIMITED.
|
// Copyright 2013-2021 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.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,7 +34,7 @@ typedef struct hidEvent_t {
|
|||||||
#define HID_MAX_DATA_BYTES ( 4 )
|
#define HID_MAX_DATA_BYTES ( 4 )
|
||||||
#define HID_EVENT_INVALID_ID ( 0x100 )
|
#define HID_EVENT_INVALID_ID ( 0x100 )
|
||||||
|
|
||||||
#if XUA_HID_ENABLED
|
#if( 0 < HID_CONTROLS )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Get the data for the next HID Report
|
* \brief Get the data for the next HID Report
|
||||||
@@ -61,5 +61,21 @@ size_t UserHIDGetData( const unsigned id, unsigned char hidData[ HID_MAX_DATA_BY
|
|||||||
*/
|
*/
|
||||||
void UserHIDInit( void );
|
void UserHIDInit( void );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Record that a HID event has occurred
|
||||||
|
*
|
||||||
|
* \param[in] hidEvent A list of events which have occurred.
|
||||||
|
* Each element specifies a HID Report ID, a bit and byte
|
||||||
|
* within the HID Report and the value for it.
|
||||||
|
* Set the Report ID to zero if not using Report IDs
|
||||||
|
* (see 5.6, 6.2.2.7, 8.1 and 8.2).
|
||||||
|
* \param[in] hidEventCnt The length of the \a hidEvent list.
|
||||||
|
*
|
||||||
|
* \returns The index of the first unrecorded event in \a hidEvent
|
||||||
|
* \retval Zero indicates no events were recorded
|
||||||
|
* \retval \a hidEventCnt indicates all events were recorded
|
||||||
|
*/
|
||||||
|
size_t UserHIDRecordEvent( const hidEvent_t hidEvent[], const size_t hidEventCnt );
|
||||||
|
|
||||||
#endif /* ( 0 < HID_CONTROLS ) */
|
#endif /* ( 0 < HID_CONTROLS ) */
|
||||||
#endif /* __USER_HID_H__ */
|
#endif /* __USER_HID_H__ */
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
// Copyright 2011-2023 XMOS LIMITED.
|
// Copyright 2011-2021 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_
|
|
||||||
#define _XUA_COMMANDS_H_
|
#ifndef __XUA_INTERNAL_CMDS_H__
|
||||||
|
#define __XUA_INTERNAL_CMDS_H__
|
||||||
|
|
||||||
#include "xua.h"
|
#include "xua.h"
|
||||||
|
|
||||||
@@ -10,19 +11,20 @@
|
|||||||
#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) */
|
|
||||||
|
|
||||||
enum
|
#define CLOCK_INTERNAL 1
|
||||||
{
|
#define CLOCK_SPDIF 2
|
||||||
CLOCK_INTERNAL = 0,
|
#if SPDIF_RX
|
||||||
#if XUA_SPDIF_RX_EN
|
#define CLOCK_ADAT 3
|
||||||
CLOCK_SPDIF,
|
#else
|
||||||
|
#define CLOCK_ADAT 2
|
||||||
#endif
|
#endif
|
||||||
#if XUA_ADAT_RX_EN
|
|
||||||
CLOCK_ADAT,
|
#define CLOCK_INTERNAL_INDEX (CLOCK_INTERNAL - 1)
|
||||||
#endif
|
#define CLOCK_ADAT_INDEX (CLOCK_ADAT - 1)
|
||||||
CLOCK_COUNT
|
#define CLOCK_SPDIF_INDEX (CLOCK_SPDIF - 1)
|
||||||
};
|
|
||||||
|
#define SET_SMUX 7
|
||||||
|
|
||||||
/* c_audioControl */
|
/* c_audioControl */
|
||||||
#define SET_SAMPLE_FREQ 4
|
#define SET_SAMPLE_FREQ 4
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2011-2023 XMOS LIMITED.
|
// Copyright 2011-2021 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (!XUA_QUAD_SPI_FLASH)
|
#ifndef QUAD_SPI_FLASH
|
||||||
// Disable flash protection
|
// Disable flash protection
|
||||||
fl_setProtection(0);
|
fl_setProtection(0);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
// Copyright 2012-2023 XMOS LIMITED.
|
// Copyright 2012-2021 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>
|
||||||
#if (XUA_QUAD_SPI_FLASH)
|
#ifdef 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
|
||||||
|
|
||||||
#if (XUA_QUAD_SPI_FLASH)
|
#ifdef 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
|
||||||
|
|
||||||
#if (XUA_QUAD_SPI_FLASH)
|
#ifdef 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;
|
||||||
#if (XUA_QUAD_SPI_FLASH)
|
#ifdef 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
|
||||||
#if (XUA_QUAD_SPI_FLASH)
|
#ifdef 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 */
|
||||||
#if (XUA_QUAD_SPI_FLASH)
|
#ifdef 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();
|
||||||
|
|
||||||
#if (!XUA_QUAD_SPI_FLASH)
|
#ifndef 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);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2019-2023 XMOS LIMITED.
|
// Copyright 2019-2022 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 <stdint.h>
|
#include <stdint.h>
|
||||||
#include <xs1.h>
|
#include <xs1.h>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
#define DEBUG_PRINT_ENABLE_HID_XC 0
|
#define DEBUG_PRINT_ENABLE_HID_XC 0
|
||||||
#include "debug_print.h"
|
#include "debug_print.h"
|
||||||
|
|
||||||
#if XUA_HID_ENABLED
|
#if( 0 < HID_CONTROLS )
|
||||||
static unsigned HidCalcNewReportTime( const unsigned currentPeriod, const unsigned reportTime, const unsigned reportToSetIdleInterval, const unsigned newPeriod );
|
static unsigned HidCalcNewReportTime( const unsigned currentPeriod, const unsigned reportTime, const unsigned reportToSetIdleInterval, const unsigned newPeriod );
|
||||||
static unsigned HidCalcReportToSetIdleInterval( const unsigned reportTime );
|
static unsigned HidCalcReportToSetIdleInterval( const unsigned reportTime );
|
||||||
static unsigned HidFindSetIdleActivationPoint( const unsigned currentPeriod, const unsigned timeWithinPeriod );
|
static unsigned HidFindSetIdleActivationPoint( const unsigned currentPeriod, const unsigned timeWithinPeriod );
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2021-2023 XMOS LIMITED.
|
// Copyright 2021-2022 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_conf_full.h"
|
#include "xua_conf_full.h"
|
||||||
#if XUA_HID_ENABLED
|
#if( 0 < HID_CONTROLS )
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2021-2023 XMOS LIMITED.
|
// Copyright 2021 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.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,19 +31,6 @@
|
|||||||
HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_HI, /* 5 wMaxPacketSize */
|
HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_HI, /* 5 wMaxPacketSize */
|
||||||
ENDPOINT_INT_INTERVAL_IN_HID, /* 6 bInterval */
|
ENDPOINT_INT_INTERVAL_IN_HID, /* 6 bInterval */
|
||||||
|
|
||||||
#if (HID_OUT_REQUIRED)
|
|
||||||
|
|
||||||
/* HID Endpoint descriptor (OUT) */
|
|
||||||
HID_ENDPOINT_DESCRIPTOR_LENGTH, /* 0 bLength */
|
|
||||||
HID_ENDPOINT_DESCRIPTOR_TYPE, /* 1 bDescriptorType */
|
|
||||||
ENDPOINT_ADDRESS_OUT_HID, /* 2 bEndpointAddress */
|
|
||||||
HID_ENDPOINT_ATTRIBUTES, /* 3 bmAttributes (INTERRUPT) */
|
|
||||||
HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_LO, /* 4 wMaxPacketSize */
|
|
||||||
HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_HI, /* 5 wMaxPacketSize */
|
|
||||||
ENDPOINT_INT_INTERVAL_OUT_HID, /* 6 bInterval */
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif (AUDIO_CLASS == 2)
|
#elif (AUDIO_CLASS == 2)
|
||||||
|
|
||||||
.HID_In_Endpoint =
|
.HID_In_Endpoint =
|
||||||
@@ -57,21 +44,6 @@
|
|||||||
.bInterval = ENDPOINT_INT_INTERVAL_IN_HID,
|
.bInterval = ENDPOINT_INT_INTERVAL_IN_HID,
|
||||||
},
|
},
|
||||||
|
|
||||||
#if (HID_OUT_REQUIRED)
|
|
||||||
|
|
||||||
.HID_Out_Endpoint =
|
|
||||||
{
|
|
||||||
/* Endpoint descriptor (OUT) */
|
|
||||||
.bLength = sizeof(USB_Descriptor_Endpoint_t),
|
|
||||||
.bDescriptorType = HID_ENDPOINT_DESCRIPTOR_TYPE,
|
|
||||||
.bEndpointAddress = ENDPOINT_ADDRESS_OUT_HID,
|
|
||||||
.bmAttributes = HID_ENDPOINT_ATTRIBUTES,
|
|
||||||
.wMaxPacketSize = HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_LO,
|
|
||||||
.bInterval = ENDPOINT_INT_INTERVAL_OUT_HID,
|
|
||||||
},
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#error "Unknown Audio Class"
|
#error "Unknown Audio Class"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2021-2023 XMOS LIMITED.
|
// Copyright 2021 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.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,8 +15,7 @@
|
|||||||
#define HID_INTERFACE_DESCRIPTOR_LENGTH ( 0x09 ) /* Size of descriptor in Bytes */
|
#define HID_INTERFACE_DESCRIPTOR_LENGTH ( 0x09 ) /* Size of descriptor in Bytes */
|
||||||
#define HID_INTERFACE_DESCRIPTOR_TYPE ( 0x04 ) /* Interface 0x04 */
|
#define HID_INTERFACE_DESCRIPTOR_TYPE ( 0x04 ) /* Interface 0x04 */
|
||||||
#define HID_INTERFACE_ALTERNATE_SETTING ( 0x00 ) /* Value used alternate interfaces using SetInterface Request */
|
#define HID_INTERFACE_ALTERNATE_SETTING ( 0x00 ) /* Value used alternate interfaces using SetInterface Request */
|
||||||
#define HID_INTERFACE_NUMBER_OF_ENDPOINTS ( 0x01 + HID_OUT_REQUIRED )
|
#define HID_INTERFACE_NUMBER_OF_ENDPOINTS ( 0x01 ) /* Number of endpoitns for this interface (excluding 0) */
|
||||||
/* Number of endpoints for this interface (excluding 0) */
|
|
||||||
#define HID_INTERFACE_CLASS ( 0x03 )
|
#define HID_INTERFACE_CLASS ( 0x03 )
|
||||||
#define HID_INTERFACE_SUBCLASS ( 0x00 ) /* No boot device */
|
#define HID_INTERFACE_SUBCLASS ( 0x00 ) /* No boot device */
|
||||||
#define HID_INTERFACE_PROTOCOL ( 0x00 )
|
#define HID_INTERFACE_PROTOCOL ( 0x00 )
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Copyright 2016-2023 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.
|
||||||
#ifdef SIMULATION
|
#ifdef SIMULATION
|
||||||
|
#include "xua.h"
|
||||||
|
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
#include <print.h>
|
#include <print.h>
|
||||||
@@ -45,7 +46,7 @@ void slave_mode_clk_setup(const unsigned samFreq, const unsigned chans_per_frame
|
|||||||
const unsigned mclk_freq = 24576000;
|
const unsigned mclk_freq = 24576000;
|
||||||
|
|
||||||
const unsigned mclk_bclk_ratio = mclk_freq / (chans_per_frame * samFreq * data_bits);
|
const unsigned mclk_bclk_ratio = mclk_freq / (chans_per_frame * samFreq * data_bits);
|
||||||
const unsigned bclk_lrclk_ratio = (chans_per_frame * data_bits); // 48.828Hz LRCLK
|
const unsigned bclk_lrclk_ratio = (chans_per_frame * data_bits + (data_bits * XUA_I2S_DUMMY_SAMPS)); // 48.828Hz LRCLK
|
||||||
|
|
||||||
//bclk
|
//bclk
|
||||||
configure_clock_src_divide(clk_audio_bclk_gen, p_mclk_gen, mclk_bclk_ratio/2);
|
configure_clock_src_divide(clk_audio_bclk_gen, p_mclk_gen, mclk_bclk_ratio/2);
|
||||||
|
|||||||
Reference in New Issue
Block a user