From ccfca90451c1bf9fce34cb451be8496fa5862107 Mon Sep 17 00:00:00 2001 From: Tom Williams Date: Wed, 22 Mar 2023 15:56:28 +0000 Subject: [PATCH 1/5] removed referance to outdated header file, changed for the api file --- lib_xua/src/core/main.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/main.xc b/lib_xua/src/core/main.xc index d7a27d10..2b9a90e7 100755 --- a/lib_xua/src/core/main.xc +++ b/lib_xua/src/core/main.xc @@ -31,7 +31,7 @@ #endif #if (XUA_SPDIF_RX_EN) -#include "SpdifReceive.h" +#include "spdif.h" #endif #if (XUA_ADAT_RX_EN) From 79d14f8b59b0e87f7485fef238e67247f740e730 Mon Sep 17 00:00:00 2001 From: Tom Williams Date: Wed, 5 Apr 2023 17:34:33 +0100 Subject: [PATCH 2/5] changed to use spdif_rx from SpdifReceive --- lib_xua/doc/rst/feat_spdif_rx.rst | 4 ++-- lib_xua/src/core/main.xc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_xua/doc/rst/feat_spdif_rx.rst b/lib_xua/doc/rst/feat_spdif_rx.rst index 00dd249d..0753371d 100644 --- a/lib_xua/doc/rst/feat_spdif_rx.rst +++ b/lib_xua/doc/rst/feat_spdif_rx.rst @@ -20,11 +20,11 @@ Finally, a channel for the output samples must be declared, note, this should be The S/PDIF receiver should be called on the appropriate tile:: - SpdifReceive(p_spdif_rx, c_spdif_rx, 1, clk_spd_rx); + spdif_rx(c_spdif_rx,p_spdif_rx,clk_spd_rx,192000); .. note:: - It is recomended to use the value 1 for the ``initial_divider`` parameter + It is recomended to use the value 192000 for the ``sample_freq_estimate`` parameter With the steps above an S/PDIF stream can be captured by the xCORE. To be functionally useful the audio master clock must be able to synchronise to this external digital stream. Additionally, the host can be diff --git a/lib_xua/src/core/main.xc b/lib_xua/src/core/main.xc index 2b9a90e7..19186a69 100755 --- a/lib_xua/src/core/main.xc +++ b/lib_xua/src/core/main.xc @@ -142,7 +142,7 @@ on stdcore[XUD_TILE] : buffered in port:32 p_adat_rx = PORT_ADAT_IN; #endif #if (XUA_SPDIF_RX_EN) -on tile[XUD_TILE] : buffered in port:4 p_spdif_rx = PORT_SPDIF_IN; +on tile[XUD_TILE] : in port p_spdif_rx = PORT_SPDIF_IN; #endif #if (XUA_SPDIF_RX_EN) || (XUA_ADAT_RX_EN) || (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) @@ -685,7 +685,7 @@ int main() on tile[XUD_TILE]: { thread_speed(); - SpdifReceive(p_spdif_rx, c_spdif_rx, 1, clk_spd_rx); + spdif_rx(c_spdif_rx,p_spdif_rx,clk_spd_rx,192000); } #endif From 6cee90d876a2d483164ccb363faf4e0edb3a2bb7 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Mon, 17 Apr 2023 12:23:27 +0100 Subject: [PATCH 3/5] Fix audio interrupt endpoint type Note, this has no functional change --- lib_xua/src/core/main.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/main.xc b/lib_xua/src/core/main.xc index d7a27d10..ea24df08 100755 --- a/lib_xua/src/core/main.xc +++ b/lib_xua/src/core/main.xc @@ -228,7 +228,7 @@ XUD_EpType epTypeTableIn[ENDPOINT_COUNT_IN] = { XUD_EPTYPE_CTL | XUD_STATUS_ENAB XUD_EPTYPE_ISO, /* Async feedback endpoint */ #endif #if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN) - XUD_EPTYPE_BUL, + XUD_EPTYPE_INT, #endif #ifdef MIDI XUD_EPTYPE_BUL, From 981ea78be755a82de66b229e521edc38c735c23e Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Fri, 12 May 2023 17:22:47 +0100 Subject: [PATCH 4/5] Fix for exception when entering DSD mode (also some tidies) --- lib_xua/src/core/audiohub/xua_audiohub.xc | 14 ++++++-------- lib_xua/src/core/ports/audioports.c | 12 ++++++------ lib_xua/src/core/ports/audioports.h | 6 +++--- lib_xua/src/core/ports/audioports.xc | 17 +++++++---------- 4 files changed, 22 insertions(+), 27 deletions(-) diff --git a/lib_xua/src/core/audiohub/xua_audiohub.xc b/lib_xua/src/core/audiohub/xua_audiohub.xc index c297c544..76229899 100755 --- a/lib_xua/src/core/audiohub/xua_audiohub.xc +++ b/lib_xua/src/core/audiohub/xua_audiohub.xc @@ -701,17 +701,16 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk, numBits = 32; } #endif - divide = mClk / ( curSamFreq * numBits); + divide = mClk / (curSamFreq * numBits); /* TODO; we should catch and handle the case when divide is 0. Currently design will lock up */ } - #if (DSD_CHANS_DAC > 0) if(dsdMode) { - /* Configure audio ports */ - ConfigAudioPortsWrapper( + /* Configure audio ports */ + ConfigAudioPortsWrapper( #if (I2S_CHANS_DAC != 0) || (DSD_CHANS_DAC != 0) p_dsd_dac, DSD_CHANS_DAC, @@ -724,7 +723,7 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk, null, p_dsd_clk, #endif - p_mclk_in, clk_audio_bclk, divide, curSamFreq, dsdMode); + p_mclk_in, clk_audio_bclk, divide, curSamFreq); } else #endif @@ -747,9 +746,8 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk, p_bclk, #endif #endif - p_mclk_in, clk_audio_bclk, divide, curSamFreq, dsdMode); -} - + p_mclk_in, clk_audio_bclk, divide, curSamFreq); + } { unsigned curFreq = curSamFreq; diff --git a/lib_xua/src/core/ports/audioports.c b/lib_xua/src/core/ports/audioports.c index 6c86344b..7e01219a 100644 --- a/lib_xua/src/core/ports/audioports.c +++ b/lib_xua/src/core/ports/audioports.c @@ -1,4 +1,4 @@ -// Copyright 2013-2022 XMOS LIMITED. +// Copyright 2013-2023 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include @@ -9,17 +9,17 @@ #include "xua.h" /* Note since DSD ports could be reused for I2S ports we do all the setup manually in C */ -#if DSD_CHANS_DAC > 0 +#if (DSD_CHANS_DAC > 0) port p_dsd_dac[DSD_CHANS_DAC] = { PORT_DSD_DAC0, #endif -#if DSD_CHANS_DAC > 1 +#if (DSD_CHANS_DAC > 1) PORT_DSD_DAC1, #endif -#if DSD_CHANS_DAC > 2 +#if (DSD_CHANS_DAC > 2) #error > 2 DSD chans currently not supported #endif -#if DSD_CHANS_DAC > 0 +#if (DSD_CHANS_DAC > 0) }; port p_dsd_clk = PORT_DSD_CLK; #endif @@ -45,7 +45,7 @@ void ConfigAudioPortsWrapper( port p_lrclk, port p_bclk, #endif - port p_mclk_in, clock clk_audio_bclk, unsigned int divide, unsigned curSamFreq, unsigned int dsdMode) + port p_mclk_in, clock clk_audio_bclk, unsigned int divide, unsigned curSamFreq) { ConfigAudioPorts( #if (I2S_CHANS_DAC != 0) || (DSD_CHANS_DAC != 0) diff --git a/lib_xua/src/core/ports/audioports.h b/lib_xua/src/core/ports/audioports.h index d0db0212..d37e86e2 100644 --- a/lib_xua/src/core/ports/audioports.h +++ b/lib_xua/src/core/ports/audioports.h @@ -1,4 +1,4 @@ -// Copyright 2011-2022 XMOS LIMITED. +// Copyright 2011-2023 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _AUDIOPORTS_H_ #define _AUDIOPORTS_H_ @@ -79,7 +79,7 @@ void ConfigAudioPortsWrapper( buffered in port:32 p_bclk, #endif #endif - in port p_mclk_in, clock clk_audio_bclk, unsigned int divide, unsigned curSamFreq, unsigned int dsdMode); + in port p_mclk_in, clock clk_audio_bclk, unsigned int divide, unsigned curSamFreq); #else void ConfigAudioPortsWrapper( @@ -95,7 +95,7 @@ void ConfigAudioPortsWrapper( port p_lrclk, port p_bclk, #endif - port p_mclk_in, clock clk_audio_bclk, unsigned int divide, unsigned curSamFreq, unsigned int dsdMode); + port p_mclk_in, clock clk_audio_bclk, unsigned int divide, unsigned curSamFreq); #endif /* __XC__*/ diff --git a/lib_xua/src/core/ports/audioports.xc b/lib_xua/src/core/ports/audioports.xc index dd8d9e44..10fd328f 100644 --- a/lib_xua/src/core/ports/audioports.xc +++ b/lib_xua/src/core/ports/audioports.xc @@ -1,4 +1,4 @@ -// Copyright 2011-2022 XMOS LIMITED. +// Copyright 2011-2023 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include @@ -6,9 +6,7 @@ #include "xua.h" #include "audioports.h" -//extern in port p_mclk_in; extern clock clk_audio_mclk; -//extern clock clk_audio_bclk; void ConfigAudioPorts( #if (I2S_CHANS_DAC != 0) || (DSD_CHANS_DAC != 0) @@ -58,7 +56,7 @@ void ConfigAudioPorts( } #endif -#if (I2S_CHANS_DAC != 0) +#if (I2S_CHANS_DAC != 0)|| (DSD_CHANS_DAC != 0) for(int i = 0; i < numPortsDac; i++) { clearbuf(p_i2s_dac[i]); @@ -82,7 +80,7 @@ void ConfigAudioPorts( /* Some adustments for timing. Sample ADC lines on negative edge and add some delay */ if(XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM) { - for(int i = 0; i < I2S_WIRES_ADC; i++) + for(int i = 0; i < numPortsAdc; i++) { set_port_sample_delay(p_i2s_adc[i]); set_pad_delay(p_i2s_adc[i], 4); @@ -91,7 +89,6 @@ void ConfigAudioPorts( #endif #elif (CODEC_MASTER) - /* Stop bit and master clock blocks */ stop_clock(clk_audio_bclk); @@ -112,9 +109,9 @@ void ConfigAudioPorts( set_clock_fall_delay(clk_audio_bclk, bClkDelay_fall); #endif -#if (I2S_CHANS_DAC != 0) - /* Clock I2S output data ports from b-clock clock block */ - for(int i = 0; i < I2S_WIRES_DAC; i++) +#if (I2S_CHANS_DAC != 0) || (DSD_CHANS_DAC != 0) + /* Clock I2S/DSD output data ports from b-clock clock block */ + for(int i = 0; i < numPortsDac; i++) { configure_out_port_no_ready(p_i2s_dac[i], clk_audio_bclk, 0); } @@ -122,7 +119,7 @@ void ConfigAudioPorts( #if (I2S_CHANS_ADC != 0) /* Clock I2S input data ports from clock block */ - for(int i = 0; i < I2S_WIRES_ADC; i++) + for(int i = 0; i < numPortsAdc; i++) { configure_in_port_no_ready(p_i2s_adc[i], clk_audio_bclk); } From 1f4e9a99b873184ddd2503dca026fbc30c93edb1 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Fri, 12 May 2023 17:36:04 +0100 Subject: [PATCH 5/5] Changelog update --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 91828aac..ede260eb 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,7 @@ UNRELEASED ---------- * FIXED: Memory corruption during initialisation of mixer weights + * FIXED: Exception when entering DSD mode 3.4.0 -----