From f3a149076bc20e077e2d04b1c7bcb6390d586a26 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 27 Jun 2022 19:09:08 +0100 Subject: [PATCH 1/7] Re-named SPDIF_RX define to XUA_SPDIF_RX_EN (chanstrings.h was already using this and therefore the S/PDIF Rx strings were incorrect). Also fixes the ADAT Rx strings and string table generation script. --- lib_xua/api/xua_audiohub.h | 2 +- lib_xua/api/xua_buffer.h | 4 +- lib_xua/api/xua_conf_default.h | 16 +-- lib_xua/src/core/audiohub/xua_audiohub.xc | 16 +-- lib_xua/src/core/buffer/ep/ep_buffer.xc | 12 +- lib_xua/src/core/clocking/clockgen.xc | 34 ++--- lib_xua/src/core/endpoint0/chanstringgen.py | 32 ++--- lib_xua/src/core/endpoint0/chanstrings.h | 128 +++++++++--------- lib_xua/src/core/endpoint0/xua_endpoint0.c | 2 +- .../src/core/endpoint0/xua_ep0_descriptors.h | 16 +-- lib_xua/src/core/main.xc | 25 ++-- 11 files changed, 143 insertions(+), 144 deletions(-) diff --git a/lib_xua/api/xua_audiohub.h b/lib_xua/api/xua_audiohub.h index 1a1f0d3fa..106c63317 100644 --- a/lib_xua/api/xua_audiohub.h +++ b/lib_xua/api/xua_audiohub.h @@ -48,7 +48,7 @@ void XUA_AudioHub(chanend ?c_aud, #if (XUA_SPDIF_TX_EN) //&& (SPDIF_TX_TILE != AUDIO_IO_TILE) , chanend c_spdif_tx #endif -#if((SPDIF_RX) || (ADAT_RX)) +#if (XUA_SPDIF_RX_EN || ADAT_RX) , chanend c_dig #endif #if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0) && (XUA_DFU_EN == 1) diff --git a/lib_xua/api/xua_buffer.h b/lib_xua/api/xua_buffer.h index 2c3c673d0..7be345784 100644 --- a/lib_xua/api/xua_buffer.h +++ b/lib_xua/api/xua_buffer.h @@ -39,7 +39,7 @@ void XUA_Buffer( chanend c_midi_to_host, chanend c_midi, #endif -#if (SPDIF_RX) || (ADAT_RX) +#if (XUA_SPDIF_RX_EN) || (ADAT_RX) chanend ?c_int, chanend ?c_clk_int, #endif @@ -67,7 +67,7 @@ void XUA_Buffer_Ep(chanend c_aud_out, chanend c_midi_to_host, chanend c_midi, #endif -#if (SPDIF_RX) || (ADAT_RX) +#if (XUA_SPDIF_RX_EN) || (ADAT_RX) chanend ?c_int, chanend ?c_clk_int, #endif diff --git a/lib_xua/api/xua_conf_default.h b/lib_xua/api/xua_conf_default.h index e553fba9a..79d1451ee 100644 --- a/lib_xua/api/xua_conf_default.h +++ b/lib_xua/api/xua_conf_default.h @@ -359,8 +359,8 @@ /** * @brief Enables SPDIF Rx. Default: 0 (Disabled) */ -#ifndef SPDIF_RX -#define SPDIF_RX (0) +#ifndef XUA_SPDIF_RX_EN +#define XUA_SPDIF_RX_EN (0) #endif /** @@ -376,9 +376,9 @@ * * Default: NONE (Must be defined by app when SPDIF_RX enabled) */ -#if (SPDIF_RX) || defined (__DOXYGEN__) +#if (XUA_SPDIF_RX_EN) || defined (__DOXYGEN__) #ifndef SPDIF_RX_INDEX - #error SPDIF_RX_INDEX not defined and SPDIF_RX defined + #error SPDIF_RX_INDEX not defined and XUA_SPDIF_RX_EN defined #define SPDIF_RX_INDEX 0 /* Default define for doxygen */ #endif #endif @@ -1163,7 +1163,7 @@ enum USBEndpointNumber_In ENDPOINT_NUMBER_IN_FEEDBACK, #endif ENDPOINT_NUMBER_IN_AUDIO, -#if (SPDIF_RX) || (ADAT_RX) +#if (XUA_SPDIF_RX_EN) || (ADAT_RX) ENDPOINT_NUMBER_IN_INTERRUPT, /* Audio interrupt/status EP */ #endif #ifdef MIDI @@ -1237,9 +1237,9 @@ enum USBEndpointNumber_Out #endif /* Length of clock unit/clock-selector units */ -#if (SPDIF_RX) && (ADAT_RX) +#if (XUA_SPDIF_RX_EN) && (ADAT_RX) #define NUM_CLOCKS (3) -#elif (SPDIF_RX) || (ADAT_RX) +#elif (XUA_SPDIF_RX_EN) || (ADAT_RX) #define NUM_CLOCKS (2) #else #define NUM_CLOCKS (1) @@ -1467,7 +1467,7 @@ enum USBEndpointNumber_Out #endif #if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) - #if (SPDIF_RX || ADAT_RX) + #if (XUA_SPDIF_RX_EN|| ADAT_RX) #error "Digital input streams not supported in Sync mode" #endif #endif diff --git a/lib_xua/src/core/audiohub/xua_audiohub.xc b/lib_xua/src/core/audiohub/xua_audiohub.xc index f6aba8f3f..10e0fc52d 100755 --- a/lib_xua/src/core/audiohub/xua_audiohub.xc +++ b/lib_xua/src/core/audiohub/xua_audiohub.xc @@ -46,7 +46,7 @@ static unsigned samplesOut[MAX(NUM_USB_CHAN_OUT, I2S_CHANS_DAC)]; /* Two buffers for ADC data to allow for DAC and ADC I2S ports being offset */ -#define IN_CHAN_COUNT (I2S_CHANS_ADC + XUA_NUM_PDM_MICS + (8*ADAT_RX) + (2*SPDIF_RX)) +#define IN_CHAN_COUNT (I2S_CHANS_ADC + XUA_NUM_PDM_MICS + (8*ADAT_RX) + (2*XUA_SPDIF_RX_EN)) static unsigned samplesIn[2][MAX(NUM_USB_CHAN_IN, IN_CHAN_COUNT)]; @@ -213,7 +213,7 @@ unsigned static AudioHub_MainLoop(chanend ?c_out, chanend ?c_spd_out , unsigned adatSmuxMode #endif , unsigned divide, unsigned curSamFreq -#if( (SPDIF_RX==1) || (ADAT_RX == 1)) +#if (XUA_SPDIF_RX_EN || ADAT_RX) , chanend c_dig_rx #endif #if (XUA_NUM_PDM_MICS > 0) @@ -418,17 +418,17 @@ unsigned static AudioHub_MainLoop(chanend ?c_out, chanend ?c_spd_out if(frameCount == 0) { -#if (SPDIF_RX == 1) || (ADAT_RX == 1) +#if (XUA_SPDIF_RX_EN || ADAT_RX) /* Sync with clockgen */ inuint(c_dig_rx); /* Note, digi-data we just store in samplesIn[readBuffNo] - we only double buffer the I2S input data */ #endif -#if (SPDIF_RX == 1) +#if (XUA_SPDIF_RX_EN) asm("ldw %0, dp[g_digData]" :"=r"(samplesIn[readBuffNo][SPDIF_RX_INDEX + 0])); asm("ldw %0, dp[g_digData+4]":"=r"(samplesIn[readBuffNo][SPDIF_RX_INDEX + 1])); #endif -#if (ADAT_RX == 1) +#if (ADAT_RX) asm("ldw %0, dp[g_digData+8]" :"=r"(samplesIn[readBuffNo][ADAT_RX_INDEX])); asm("ldw %0, dp[g_digData+12]":"=r"(samplesIn[readBuffNo][ADAT_RX_INDEX + 1])); asm("ldw %0, dp[g_digData+16]":"=r"(samplesIn[readBuffNo][ADAT_RX_INDEX + 2])); @@ -439,7 +439,7 @@ unsigned static AudioHub_MainLoop(chanend ?c_out, chanend ?c_spd_out asm("ldw %0, dp[g_digData+36]":"=r"(samplesIn[readBuffNo][ADAT_RX_INDEX + 7])); #endif -#if (SPDIF_RX == 1) || (ADAT_RX == 1) +#if (XUA_SPDIF_RX_EN || ADAT_RX) /* Request digital data (with prefill) */ outuint(c_dig_rx, 0); #endif @@ -668,7 +668,7 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk, #if (XUA_SPDIF_TX_EN) //&& (SPDIF_TX_TILE != AUDIO_IO_TILE) , chanend c_spdif_out #endif -#if ((ADAT_RX == 1) || (SPDIF_RX == 1)) +#if (ADAT_RX || XUA_SPDIF_RX_EN) , chanend c_dig_rx #endif #if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0) && (XUA_DFU_EN == 1) @@ -905,7 +905,7 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk, , adatSmuxMode #endif , divide, curSamFreq -#if (ADAT_RX == 1) || (SPDIF_RX == 1) +#if (ADAT_RX || XUA_SPDIF_RX_EN) , c_dig_rx #endif #if (XUA_NUM_PDM_MICS > 0) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index 0a1e050c8..e75b527f0 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -46,7 +46,7 @@ unsigned g_speed = (AUDIO_CLASS == 2) ? (DEFAULT_FREQ/8000) << 16 : (DEFAULT_FRE unsigned g_freqChange = 0; unsigned feedbackValid = 0; -#if defined (SPDIF_RX) || defined (ADAT_RX) +#if (XUA_SPDIF_RX_EN || ADAT_RX) /* When digital Rx enabled we enable an interrupt EP to inform host about changes in clock validity */ /* Interrupt EP report data */ unsigned char g_intData[8] = @@ -103,7 +103,7 @@ void XUA_Buffer( chanend c_midi_to_host, chanend c_midi, #endif -#if (SPDIF_RX) || (ADAT_RX) +#if (XUA_SPDIF_RX_EN) || (ADAT_RX) chanend ?c_ep_int, chanend ?c_clk_int, #endif @@ -137,7 +137,7 @@ void XUA_Buffer( c_midi_to_host, /* MIDI In */ // 4 c_midi, #endif -#if (SPDIF_RX) || (ADAT_RX) +#if (XUA_SPDIF_RX_EN || ADAT_RX) /* Audio Interrupt - only used for interrupts on external clock change */ c_ep_int, c_clk_int, @@ -186,7 +186,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, chanend c_midi_to_host, chanend c_midi, #endif -#if (SPDIF_RX) || (ADAT_RX) +#if (XUA_SPDIF_RX_EN || ADAT_RX) chanend ?c_ep_int, chanend ?c_clk_int, #endif @@ -229,7 +229,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, XUD_ep ep_iap_ea_native_in = XUD_InitEp(c_iap_ea_native_in); #endif #endif -#if (SPDIF_RX) || (ADAT_RX) +#if (XUA_SPDIF_RX_EN || ADAT_RX) XUD_ep ep_int = XUD_InitEp(c_ep_int); #endif @@ -367,7 +367,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, /* Wait for response from XUD and service relevant EP */ select { -#if (SPDIF_RX) || (ADAT_RX) +#if (XUA_SPDIF_RX_EN || ADAT_RX) /* Clocking thread wants to produce an interrupt... */ case inuint_byref(c_clk_int, u_tmp): chkct(c_clk_int, XS1_CT_END); diff --git a/lib_xua/src/core/clocking/clockgen.xc b/lib_xua/src/core/clocking/clockgen.xc index 929aee5dd..c2264738c 100644 --- a/lib_xua/src/core/clocking/clockgen.xc +++ b/lib_xua/src/core/clocking/clockgen.xc @@ -9,7 +9,7 @@ #include "xua_commands.h" #include "clocking.h" -#if (SPDIF_RX) +#if (XUA_SPDIF_RX_EN) #include "spdif.h" #endif @@ -58,7 +58,7 @@ void PllRefPinTask(server interface sync_if i_sync, out port p_sync) } -#if (SPDIF_RX) || (ADAT_RX) +#if (XUA_SPDIF_RX_EN) || (ADAT_RX) static int abs(int x) { if (x < 0) return -x; @@ -93,7 +93,7 @@ static void outInterrupt(chanend c_interruptControl, int value) void VendorClockValidity(int valid); #endif -#if (SPDIF_RX) || (ADAT_RX) +#if (XUA_SPDIF_RX_EN || ADAT_RX) static inline void setClockValidity(chanend c_interruptControl, int clkIndex, int valid, int currentClkMode) { if (clockValid[clkIndex] != valid) @@ -108,7 +108,7 @@ static inline void setClockValidity(chanend c_interruptControl, int clkIndex, in VendorClockValidity(valid); } #endif -#if SPDIF_RX +#if (XUA_SPDIF_RX_EN) if (currentClkMode == CLOCK_SPDIF && clkIndex == CLOCK_SPDIF_INDEX) { VendorClockValidity(valid); @@ -196,7 +196,7 @@ static inline int validSamples(Counter &counter, int clockIndex) } #endif -#ifdef SPDIF_RX +#if (XUA_SPDIF_RX_EN) //:badParity /* Returns 1 for bad parity, else 0 */ static inline int badParity(unsigned x) @@ -235,11 +235,11 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch unsigned levelTime; #endif -#if (SPDIF_RX) || (ADAT_RX) +#if (XUA_SPDIF_RX_EN || ADAT_RX) timer t_external; #endif -#if SPDIF_RX +#if (XUA_SPDIF_RX_EN) /* S/PDIF buffer state */ int spdifSamples[MAX_SPDIF_SAMPLES]; /* S/PDIF sample buffer */ int spdifWr = 0; /* Write index */ @@ -275,7 +275,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch } /* Init clock unit state */ -#if SPDIF_RX +#if (XUA_SPDIF_RX_EN) clockFreq[CLOCK_SPDIF_INDEX] = 0; clockValid[CLOCK_SPDIF_INDEX] = 0; clockInt[CLOCK_SPDIF_INDEX] = 0; @@ -291,7 +291,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch clockValid[CLOCK_ADAT_INDEX] = 0; clockId[CLOCK_ADAT_INDEX] = ID_CLKSRC_ADAT; #endif -#if SPDIF_RX +#if (XUA_SPDIF_RX_EN) spdifCounters.receivedSamples = 0; spdifCounters.samples = 0; spdifCounters.savedSamples = 0; @@ -320,7 +320,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch levelTime+= LEVEL_UPDATE_RATE; #endif -#if (SPDIF_RX) || (ADAT_RX) +#if (XUA_SPDIF_RX_EN) || (ADAT_RX) /* Fill channel */ outuint(c_dig_rx, 1); #endif @@ -404,7 +404,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch VendorClockValidity(clockValid[CLOCK_ADAT_INDEX]); break; #endif -#if SPDIF_RX +#if (XUA_SPDIF_RX_EN) case CLOCK_SPDIF: VendorClockValidity(clockValid[CLOCK_SPDIF_INDEX]); break; @@ -466,7 +466,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch /* If we are in an external clock mode and this fire, then clock invalid */ -#if SPDIF_RX +#if (XUA_SPDIF_RX_EN) // if(clkMode == CLOCK_SPDIF) { /* We must have lost valid S/PDIF stream, reset counters, so we dont produce a double edge */ @@ -490,11 +490,11 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch break; -#if (SPDIF_RX) || (ADAT_RX) +#if (XUA_SPDIF_RX_EN || ADAT_RX) case t_external when timerafter(timeNextClockDetection) :> void: timeNextClockDetection += (LOCAL_CLOCK_INCREMENT); -#if SPDIF_RX +#if (XUA_SPDIF_RX_EN) tmp = spdifCounters.samplesPerTick; /* Returns 1 if valid clock found */ @@ -510,7 +510,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch #endif -#if SPDIF_RX +#if (XUA_SPDIF_RX_EN) /* Receive sample from S/PDIF RX thread (steaming chan) */ case c_spdif_rx :> tmp: @@ -713,10 +713,10 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch #endif -#if (SPDIF_RX) || (ADAT_RX) +#if (XUA_SPDIF_RX_EN || ADAT_RX) /* Mixer requests data */ case inuint_byref(c_dig_rx, tmp): -#if SPDIF_RX +#if (XUA_SPDIF_RX_EN) if(spdifUnderflow) { /* S/PDIF underflowing, send out zero samples */ diff --git a/lib_xua/src/core/endpoint0/chanstringgen.py b/lib_xua/src/core/endpoint0/chanstringgen.py index de74c9d02..b2131b1a4 100644 --- a/lib_xua/src/core/endpoint0/chanstringgen.py +++ b/lib_xua/src/core/endpoint0/chanstringgen.py @@ -1,4 +1,4 @@ -# Copyright 2015-2021 XMOS LIMITED. +# Copyright 2015-2022 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. @@ -6,7 +6,7 @@ def genstrings(outputChanCount, chanString, portString, structureString, adc_dac for i in range(1,outputChanCount): - print "#if (NUM_USB_CHAN_{c} > {i}-1)\n\ + print("#if (NUM_USB_CHAN_{c} > {i}-1)\n\ .{s}ChanStr_{i} = \"\"\n\ #if ({i} < I2S_CHANS_{adcdac}+1)\n\ \"Analogue {i}\"\n\ @@ -21,38 +21,38 @@ def genstrings(outputChanCount, chanString, portString, structureString, adc_dac \"SPDIF 2\"\n\ #endif\n\ #endif\n\ - #if (({i} < ADAT_{p}_INDEX+8+1) && ({i} > ADAT_{p}_INDEX)) && defined(ADAT_{p})\n\ + #if (({i} < ADAT_{p}_INDEX+8+1) && ({i} > ADAT_{p}_INDEX)) && (ADAT_{p})\n\ #if (({i} < SPDIF_{p}_INDEX+2+1) && ({i} > SPDIF_{p}_INDEX)) && (XUA_SPDIF_{p}_EN) || ({i} < I2S_CHANS_{adcdac}+1)\n\ \"/\"\n\ #endif\n\ - #if({i} - ADAT_TX_INDEX == 1)\n\ + #if({i} - ADAT_{p}_INDEX == 1)\n\ \"ADAT 1\"\n\ - #elif({i} - ADAT_TX_INDEX == 2)\n\ + #elif({i} - ADAT_{p}_INDEX == 2)\n\ \"ADAT 2\"\n\ - #elif({i} - ADAT_TX_INDEX == 3)\n\ + #elif({i} - ADAT_{p}_INDEX == 3)\n\ \"ADAT 3\"\n\ - #elif({i} - ADAT_TX_INDEX == 4)\n\ + #elif({i} - ADAT_{p}_INDEX == 4)\n\ \"ADAT 4\"\n\ - #elif({i} - ADAT_TX_INDEX == 5)\n\ + #elif({i} - ADAT_{p}_INDEX == 5)\n\ \"ADAT 5\"\n\ - #elif({i} - ADAT_TX_INDEX == 6)\n\ + #elif({i} - ADAT_{p}_INDEX == 6)\n\ \"ADAT 6\"\n\ - #elif({i} - ADAT_TX_INDEX == 7)\n\ + #elif({i} - ADAT_{p}_INDEX == 7)\n\ \"ADAT 7\"\n\ - #elif({i} - ADAT_TX_INDEX == 8)\n\ + #elif({i} - ADAT_{p}_INDEX == 8)\n\ \"ADAT 8\"\n\ #endif\n\ #endif\n\ - ,\n#endif\n".format(i=i, c=chanString, p=portString, s=structureString, adcdac=adc_dac); + ,\n#endif\n".format(i=i, c=chanString, p=portString, s=structureString, adcdac=adc_dac)); return; -print "/* AUTOGENERATED using chanstringgen.py */\n" -print "/* Not very nice looking but the standard preprocessor is not very powerful\n and we save some memory over doing this all at runtime */" +print("/* AUTOGENERATED using chanstringgen.py */\n") +print("/* Not very nice looking but the standard preprocessor is not very powerful\n and we save some memory over doing this all at runtime */") -print "/* Output Strings */\n\n" +print("/* Output Strings */\n\n") genstrings(33, "OUT", "TX", "output", "DAC"); -print "/* Input Strings */\n\n" +print("/* Input Strings */\n\n") genstrings(33, "IN", "RX", "input", "ADC"); diff --git a/lib_xua/src/core/endpoint0/chanstrings.h b/lib_xua/src/core/endpoint0/chanstrings.h index 68be34812..f1e98422e 100644 --- a/lib_xua/src/core/endpoint0/chanstrings.h +++ b/lib_xua/src/core/endpoint0/chanstrings.h @@ -22,7 +22,7 @@ "SPDIF 2" #endif #endif - #if ((1 < ADAT_TX_INDEX+8+1) && (1 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((1 < ADAT_TX_INDEX+8+1) && (1 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((1 < SPDIF_TX_INDEX+2+1) && (1 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (1 < I2S_CHANS_DAC+1) "/" #endif @@ -62,7 +62,7 @@ "SPDIF 2" #endif #endif - #if ((2 < ADAT_TX_INDEX+8+1) && (2 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((2 < ADAT_TX_INDEX+8+1) && (2 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((2 < SPDIF_TX_INDEX+2+1) && (2 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (2 < I2S_CHANS_DAC+1) "/" #endif @@ -102,7 +102,7 @@ "SPDIF 2" #endif #endif - #if ((3 < ADAT_TX_INDEX+8+1) && (3 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((3 < ADAT_TX_INDEX+8+1) && (3 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((3 < SPDIF_TX_INDEX+2+1) && (3 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (3 < I2S_CHANS_DAC+1) "/" #endif @@ -142,7 +142,7 @@ "SPDIF 2" #endif #endif - #if ((4 < ADAT_TX_INDEX+8+1) && (4 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((4 < ADAT_TX_INDEX+8+1) && (4 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((4 < SPDIF_TX_INDEX+2+1) && (4 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (4 < I2S_CHANS_DAC+1) "/" #endif @@ -182,7 +182,7 @@ "SPDIF 2" #endif #endif - #if ((5 < ADAT_TX_INDEX+8+1) && (5 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((5 < ADAT_TX_INDEX+8+1) && (5 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((5 < SPDIF_TX_INDEX+2+1) && (5 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (5 < I2S_CHANS_DAC+1) "/" #endif @@ -222,7 +222,7 @@ "SPDIF 2" #endif #endif - #if ((6 < ADAT_TX_INDEX+8+1) && (6 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((6 < ADAT_TX_INDEX+8+1) && (6 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((6 < SPDIF_TX_INDEX+2+1) && (6 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (6 < I2S_CHANS_DAC+1) "/" #endif @@ -262,7 +262,7 @@ "SPDIF 2" #endif #endif - #if ((7 < ADAT_TX_INDEX+8+1) && (7 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((7 < ADAT_TX_INDEX+8+1) && (7 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((7 < SPDIF_TX_INDEX+2+1) && (7 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (7 < I2S_CHANS_DAC+1) "/" #endif @@ -302,7 +302,7 @@ "SPDIF 2" #endif #endif - #if ((8 < ADAT_TX_INDEX+8+1) && (8 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((8 < ADAT_TX_INDEX+8+1) && (8 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((8 < SPDIF_TX_INDEX+2+1) && (8 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (8 < I2S_CHANS_DAC+1) "/" #endif @@ -342,7 +342,7 @@ "SPDIF 2" #endif #endif - #if ((9 < ADAT_TX_INDEX+8+1) && (9 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((9 < ADAT_TX_INDEX+8+1) && (9 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((9 < SPDIF_TX_INDEX+2+1) && (9 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (9 < I2S_CHANS_DAC+1) "/" #endif @@ -382,7 +382,7 @@ "SPDIF 2" #endif #endif - #if ((10 < ADAT_TX_INDEX+8+1) && (10 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((10 < ADAT_TX_INDEX+8+1) && (10 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((10 < SPDIF_TX_INDEX+2+1) && (10 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (10 < I2S_CHANS_DAC+1) "/" #endif @@ -422,7 +422,7 @@ "SPDIF 2" #endif #endif - #if ((11 < ADAT_TX_INDEX+8+1) && (11 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((11 < ADAT_TX_INDEX+8+1) && (11 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((11 < SPDIF_TX_INDEX+2+1) && (11 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (11 < I2S_CHANS_DAC+1) "/" #endif @@ -462,7 +462,7 @@ "SPDIF 2" #endif #endif - #if ((12 < ADAT_TX_INDEX+8+1) && (12 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((12 < ADAT_TX_INDEX+8+1) && (12 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((12 < SPDIF_TX_INDEX+2+1) && (12 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (12 < I2S_CHANS_DAC+1) "/" #endif @@ -502,7 +502,7 @@ "SPDIF 2" #endif #endif - #if ((13 < ADAT_TX_INDEX+8+1) && (13 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((13 < ADAT_TX_INDEX+8+1) && (13 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((13 < SPDIF_TX_INDEX+2+1) && (13 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (13 < I2S_CHANS_DAC+1) "/" #endif @@ -542,7 +542,7 @@ "SPDIF 2" #endif #endif - #if ((14 < ADAT_TX_INDEX+8+1) && (14 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((14 < ADAT_TX_INDEX+8+1) && (14 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((14 < SPDIF_TX_INDEX+2+1) && (14 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (14 < I2S_CHANS_DAC+1) "/" #endif @@ -582,7 +582,7 @@ "SPDIF 2" #endif #endif - #if ((15 < ADAT_TX_INDEX+8+1) && (15 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((15 < ADAT_TX_INDEX+8+1) && (15 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((15 < SPDIF_TX_INDEX+2+1) && (15 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (15 < I2S_CHANS_DAC+1) "/" #endif @@ -622,7 +622,7 @@ "SPDIF 2" #endif #endif - #if ((16 < ADAT_TX_INDEX+8+1) && (16 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((16 < ADAT_TX_INDEX+8+1) && (16 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((16 < SPDIF_TX_INDEX+2+1) && (16 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (16 < I2S_CHANS_DAC+1) "/" #endif @@ -662,7 +662,7 @@ "SPDIF 2" #endif #endif - #if ((17 < ADAT_TX_INDEX+8+1) && (17 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((17 < ADAT_TX_INDEX+8+1) && (17 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((17 < SPDIF_TX_INDEX+2+1) && (17 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (17 < I2S_CHANS_DAC+1) "/" #endif @@ -702,7 +702,7 @@ "SPDIF 2" #endif #endif - #if ((18 < ADAT_TX_INDEX+8+1) && (18 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((18 < ADAT_TX_INDEX+8+1) && (18 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((18 < SPDIF_TX_INDEX+2+1) && (18 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (18 < I2S_CHANS_DAC+1) "/" #endif @@ -742,7 +742,7 @@ "SPDIF 2" #endif #endif - #if ((19 < ADAT_TX_INDEX+8+1) && (19 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((19 < ADAT_TX_INDEX+8+1) && (19 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((19 < SPDIF_TX_INDEX+2+1) && (19 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (19 < I2S_CHANS_DAC+1) "/" #endif @@ -782,7 +782,7 @@ "SPDIF 2" #endif #endif - #if ((20 < ADAT_TX_INDEX+8+1) && (20 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((20 < ADAT_TX_INDEX+8+1) && (20 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((20 < SPDIF_TX_INDEX+2+1) && (20 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (20 < I2S_CHANS_DAC+1) "/" #endif @@ -822,7 +822,7 @@ "SPDIF 2" #endif #endif - #if ((21 < ADAT_TX_INDEX+8+1) && (21 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((21 < ADAT_TX_INDEX+8+1) && (21 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((21 < SPDIF_TX_INDEX+2+1) && (21 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (21 < I2S_CHANS_DAC+1) "/" #endif @@ -862,7 +862,7 @@ "SPDIF 2" #endif #endif - #if ((22 < ADAT_TX_INDEX+8+1) && (22 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((22 < ADAT_TX_INDEX+8+1) && (22 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((22 < SPDIF_TX_INDEX+2+1) && (22 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (22 < I2S_CHANS_DAC+1) "/" #endif @@ -902,7 +902,7 @@ "SPDIF 2" #endif #endif - #if ((23 < ADAT_TX_INDEX+8+1) && (23 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((23 < ADAT_TX_INDEX+8+1) && (23 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((23 < SPDIF_TX_INDEX+2+1) && (23 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (23 < I2S_CHANS_DAC+1) "/" #endif @@ -942,7 +942,7 @@ "SPDIF 2" #endif #endif - #if ((24 < ADAT_TX_INDEX+8+1) && (24 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((24 < ADAT_TX_INDEX+8+1) && (24 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((24 < SPDIF_TX_INDEX+2+1) && (24 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (24 < I2S_CHANS_DAC+1) "/" #endif @@ -982,7 +982,7 @@ "SPDIF 2" #endif #endif - #if ((25 < ADAT_TX_INDEX+8+1) && (25 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((25 < ADAT_TX_INDEX+8+1) && (25 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((25 < SPDIF_TX_INDEX+2+1) && (25 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (25 < I2S_CHANS_DAC+1) "/" #endif @@ -1022,7 +1022,7 @@ "SPDIF 2" #endif #endif - #if ((26 < ADAT_TX_INDEX+8+1) && (26 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((26 < ADAT_TX_INDEX+8+1) && (26 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((26 < SPDIF_TX_INDEX+2+1) && (26 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (26 < I2S_CHANS_DAC+1) "/" #endif @@ -1062,7 +1062,7 @@ "SPDIF 2" #endif #endif - #if ((27 < ADAT_TX_INDEX+8+1) && (27 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((27 < ADAT_TX_INDEX+8+1) && (27 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((27 < SPDIF_TX_INDEX+2+1) && (27 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (27 < I2S_CHANS_DAC+1) "/" #endif @@ -1102,7 +1102,7 @@ "SPDIF 2" #endif #endif - #if ((28 < ADAT_TX_INDEX+8+1) && (28 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((28 < ADAT_TX_INDEX+8+1) && (28 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((28 < SPDIF_TX_INDEX+2+1) && (28 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (28 < I2S_CHANS_DAC+1) "/" #endif @@ -1142,7 +1142,7 @@ "SPDIF 2" #endif #endif - #if ((29 < ADAT_TX_INDEX+8+1) && (29 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((29 < ADAT_TX_INDEX+8+1) && (29 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((29 < SPDIF_TX_INDEX+2+1) && (29 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (29 < I2S_CHANS_DAC+1) "/" #endif @@ -1182,7 +1182,7 @@ "SPDIF 2" #endif #endif - #if ((30 < ADAT_TX_INDEX+8+1) && (30 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((30 < ADAT_TX_INDEX+8+1) && (30 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((30 < SPDIF_TX_INDEX+2+1) && (30 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (30 < I2S_CHANS_DAC+1) "/" #endif @@ -1222,7 +1222,7 @@ "SPDIF 2" #endif #endif - #if ((31 < ADAT_TX_INDEX+8+1) && (31 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((31 < ADAT_TX_INDEX+8+1) && (31 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((31 < SPDIF_TX_INDEX+2+1) && (31 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (31 < I2S_CHANS_DAC+1) "/" #endif @@ -1262,7 +1262,7 @@ "SPDIF 2" #endif #endif - #if ((32 < ADAT_TX_INDEX+8+1) && (32 > ADAT_TX_INDEX)) && defined(ADAT_TX) + #if ((32 < ADAT_TX_INDEX+8+1) && (32 > ADAT_TX_INDEX)) && (ADAT_TX) #if ((32 < SPDIF_TX_INDEX+2+1) && (32 > SPDIF_TX_INDEX)) && (XUA_SPDIF_TX_EN) || (32 < I2S_CHANS_DAC+1) "/" #endif @@ -1305,7 +1305,7 @@ "SPDIF 2" #endif #endif - #if ((1 < ADAT_RX_INDEX+8+1) && (1 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((1 < ADAT_RX_INDEX+8+1) && (1 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((1 < SPDIF_RX_INDEX+2+1) && (1 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (1 < I2S_CHANS_ADC+1) "/" #endif @@ -1345,7 +1345,7 @@ "SPDIF 2" #endif #endif - #if ((2 < ADAT_RX_INDEX+8+1) && (2 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((2 < ADAT_RX_INDEX+8+1) && (2 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((2 < SPDIF_RX_INDEX+2+1) && (2 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (2 < I2S_CHANS_ADC+1) "/" #endif @@ -1385,7 +1385,7 @@ "SPDIF 2" #endif #endif - #if ((3 < ADAT_RX_INDEX+8+1) && (3 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((3 < ADAT_RX_INDEX+8+1) && (3 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((3 < SPDIF_RX_INDEX+2+1) && (3 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (3 < I2S_CHANS_ADC+1) "/" #endif @@ -1425,7 +1425,7 @@ "SPDIF 2" #endif #endif - #if ((4 < ADAT_RX_INDEX+8+1) && (4 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((4 < ADAT_RX_INDEX+8+1) && (4 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((4 < SPDIF_RX_INDEX+2+1) && (4 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (4 < I2S_CHANS_ADC+1) "/" #endif @@ -1465,7 +1465,7 @@ "SPDIF 2" #endif #endif - #if ((5 < ADAT_RX_INDEX+8+1) && (5 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((5 < ADAT_RX_INDEX+8+1) && (5 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((5 < SPDIF_RX_INDEX+2+1) && (5 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (5 < I2S_CHANS_ADC+1) "/" #endif @@ -1505,7 +1505,7 @@ "SPDIF 2" #endif #endif - #if ((6 < ADAT_RX_INDEX+8+1) && (6 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((6 < ADAT_RX_INDEX+8+1) && (6 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((6 < SPDIF_RX_INDEX+2+1) && (6 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (6 < I2S_CHANS_ADC+1) "/" #endif @@ -1545,7 +1545,7 @@ "SPDIF 2" #endif #endif - #if ((7 < ADAT_RX_INDEX+8+1) && (7 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((7 < ADAT_RX_INDEX+8+1) && (7 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((7 < SPDIF_RX_INDEX+2+1) && (7 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (7 < I2S_CHANS_ADC+1) "/" #endif @@ -1585,7 +1585,7 @@ "SPDIF 2" #endif #endif - #if ((8 < ADAT_RX_INDEX+8+1) && (8 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((8 < ADAT_RX_INDEX+8+1) && (8 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((8 < SPDIF_RX_INDEX+2+1) && (8 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (8 < I2S_CHANS_ADC+1) "/" #endif @@ -1625,7 +1625,7 @@ "SPDIF 2" #endif #endif - #if ((9 < ADAT_RX_INDEX+8+1) && (9 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((9 < ADAT_RX_INDEX+8+1) && (9 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((9 < SPDIF_RX_INDEX+2+1) && (9 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (9 < I2S_CHANS_ADC+1) "/" #endif @@ -1665,7 +1665,7 @@ "SPDIF 2" #endif #endif - #if ((10 < ADAT_RX_INDEX+8+1) && (10 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((10 < ADAT_RX_INDEX+8+1) && (10 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((10 < SPDIF_RX_INDEX+2+1) && (10 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (10 < I2S_CHANS_ADC+1) "/" #endif @@ -1705,7 +1705,7 @@ "SPDIF 2" #endif #endif - #if ((11 < ADAT_RX_INDEX+8+1) && (11 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((11 < ADAT_RX_INDEX+8+1) && (11 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((11 < SPDIF_RX_INDEX+2+1) && (11 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (11 < I2S_CHANS_ADC+1) "/" #endif @@ -1745,7 +1745,7 @@ "SPDIF 2" #endif #endif - #if ((12 < ADAT_RX_INDEX+8+1) && (12 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((12 < ADAT_RX_INDEX+8+1) && (12 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((12 < SPDIF_RX_INDEX+2+1) && (12 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (12 < I2S_CHANS_ADC+1) "/" #endif @@ -1785,7 +1785,7 @@ "SPDIF 2" #endif #endif - #if ((13 < ADAT_RX_INDEX+8+1) && (13 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((13 < ADAT_RX_INDEX+8+1) && (13 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((13 < SPDIF_RX_INDEX+2+1) && (13 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (13 < I2S_CHANS_ADC+1) "/" #endif @@ -1825,7 +1825,7 @@ "SPDIF 2" #endif #endif - #if ((14 < ADAT_RX_INDEX+8+1) && (14 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((14 < ADAT_RX_INDEX+8+1) && (14 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((14 < SPDIF_RX_INDEX+2+1) && (14 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (14 < I2S_CHANS_ADC+1) "/" #endif @@ -1865,7 +1865,7 @@ "SPDIF 2" #endif #endif - #if ((15 < ADAT_RX_INDEX+8+1) && (15 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((15 < ADAT_RX_INDEX+8+1) && (15 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((15 < SPDIF_RX_INDEX+2+1) && (15 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (15 < I2S_CHANS_ADC+1) "/" #endif @@ -1905,7 +1905,7 @@ "SPDIF 2" #endif #endif - #if ((16 < ADAT_RX_INDEX+8+1) && (16 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((16 < ADAT_RX_INDEX+8+1) && (16 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((16 < SPDIF_RX_INDEX+2+1) && (16 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (16 < I2S_CHANS_ADC+1) "/" #endif @@ -1945,7 +1945,7 @@ "SPDIF 2" #endif #endif - #if ((17 < ADAT_RX_INDEX+8+1) && (17 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((17 < ADAT_RX_INDEX+8+1) && (17 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((17 < SPDIF_RX_INDEX+2+1) && (17 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (17 < I2S_CHANS_ADC+1) "/" #endif @@ -1985,7 +1985,7 @@ "SPDIF 2" #endif #endif - #if ((18 < ADAT_RX_INDEX+8+1) && (18 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((18 < ADAT_RX_INDEX+8+1) && (18 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((18 < SPDIF_RX_INDEX+2+1) && (18 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (18 < I2S_CHANS_ADC+1) "/" #endif @@ -2025,7 +2025,7 @@ "SPDIF 2" #endif #endif - #if ((19 < ADAT_RX_INDEX+8+1) && (19 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((19 < ADAT_RX_INDEX+8+1) && (19 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((19 < SPDIF_RX_INDEX+2+1) && (19 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (19 < I2S_CHANS_ADC+1) "/" #endif @@ -2065,7 +2065,7 @@ "SPDIF 2" #endif #endif - #if ((20 < ADAT_RX_INDEX+8+1) && (20 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((20 < ADAT_RX_INDEX+8+1) && (20 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((20 < SPDIF_RX_INDEX+2+1) && (20 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (20 < I2S_CHANS_ADC+1) "/" #endif @@ -2105,7 +2105,7 @@ "SPDIF 2" #endif #endif - #if ((21 < ADAT_RX_INDEX+8+1) && (21 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((21 < ADAT_RX_INDEX+8+1) && (21 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((21 < SPDIF_RX_INDEX+2+1) && (21 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (21 < I2S_CHANS_ADC+1) "/" #endif @@ -2145,7 +2145,7 @@ "SPDIF 2" #endif #endif - #if ((22 < ADAT_RX_INDEX+8+1) && (22 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((22 < ADAT_RX_INDEX+8+1) && (22 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((22 < SPDIF_RX_INDEX+2+1) && (22 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (22 < I2S_CHANS_ADC+1) "/" #endif @@ -2185,7 +2185,7 @@ "SPDIF 2" #endif #endif - #if ((23 < ADAT_RX_INDEX+8+1) && (23 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((23 < ADAT_RX_INDEX+8+1) && (23 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((23 < SPDIF_RX_INDEX+2+1) && (23 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (23 < I2S_CHANS_ADC+1) "/" #endif @@ -2225,7 +2225,7 @@ "SPDIF 2" #endif #endif - #if ((24 < ADAT_RX_INDEX+8+1) && (24 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((24 < ADAT_RX_INDEX+8+1) && (24 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((24 < SPDIF_RX_INDEX+2+1) && (24 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (24 < I2S_CHANS_ADC+1) "/" #endif @@ -2265,7 +2265,7 @@ "SPDIF 2" #endif #endif - #if ((25 < ADAT_RX_INDEX+8+1) && (25 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((25 < ADAT_RX_INDEX+8+1) && (25 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((25 < SPDIF_RX_INDEX+2+1) && (25 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (25 < I2S_CHANS_ADC+1) "/" #endif @@ -2305,7 +2305,7 @@ "SPDIF 2" #endif #endif - #if ((26 < ADAT_RX_INDEX+8+1) && (26 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((26 < ADAT_RX_INDEX+8+1) && (26 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((26 < SPDIF_RX_INDEX+2+1) && (26 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (26 < I2S_CHANS_ADC+1) "/" #endif @@ -2345,7 +2345,7 @@ "SPDIF 2" #endif #endif - #if ((27 < ADAT_RX_INDEX+8+1) && (27 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((27 < ADAT_RX_INDEX+8+1) && (27 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((27 < SPDIF_RX_INDEX+2+1) && (27 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (27 < I2S_CHANS_ADC+1) "/" #endif @@ -2385,7 +2385,7 @@ "SPDIF 2" #endif #endif - #if ((28 < ADAT_RX_INDEX+8+1) && (28 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((28 < ADAT_RX_INDEX+8+1) && (28 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((28 < SPDIF_RX_INDEX+2+1) && (28 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (28 < I2S_CHANS_ADC+1) "/" #endif @@ -2425,7 +2425,7 @@ "SPDIF 2" #endif #endif - #if ((29 < ADAT_RX_INDEX+8+1) && (29 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((29 < ADAT_RX_INDEX+8+1) && (29 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((29 < SPDIF_RX_INDEX+2+1) && (29 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (29 < I2S_CHANS_ADC+1) "/" #endif @@ -2465,7 +2465,7 @@ "SPDIF 2" #endif #endif - #if ((30 < ADAT_RX_INDEX+8+1) && (30 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((30 < ADAT_RX_INDEX+8+1) && (30 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((30 < SPDIF_RX_INDEX+2+1) && (30 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (30 < I2S_CHANS_ADC+1) "/" #endif @@ -2505,7 +2505,7 @@ "SPDIF 2" #endif #endif - #if ((31 < ADAT_RX_INDEX+8+1) && (31 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((31 < ADAT_RX_INDEX+8+1) && (31 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((31 < SPDIF_RX_INDEX+2+1) && (31 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (31 < I2S_CHANS_ADC+1) "/" #endif @@ -2545,7 +2545,7 @@ "SPDIF 2" #endif #endif - #if ((32 < ADAT_RX_INDEX+8+1) && (32 > ADAT_RX_INDEX)) && defined(ADAT_RX) + #if ((32 < ADAT_RX_INDEX+8+1) && (32 > ADAT_RX_INDEX)) && (ADAT_RX) #if ((32 < SPDIF_RX_INDEX+2+1) && (32 > SPDIF_RX_INDEX)) && (XUA_SPDIF_RX_EN) || (32 < I2S_CHANS_ADC+1) "/" #endif diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index ae74bc941..6f56a4057 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -284,7 +284,7 @@ void XUA_Endpoint0_setStrTable() { concatenateAndCopyStrings(g_vendor_str, " Clock Selector", g_strTable.clockSelectorStr); concatenateAndCopyStrings(g_vendor_str, " Internal Clock", g_strTable.internalClockSourceStr); #endif -#if SPDIF_RX +#if (XUA_SPDIF_RX_EN) concatenateAndCopyStrings(g_vendor_str, " S/PDIF Clock", g_strTable.spdifClockSourceStr); #endif #if ADAT_RX diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 5c88faca2..537729748 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -88,7 +88,7 @@ typedef struct #if (AUDIO_CLASS == 2) STR_TABLE_ENTRY(clockSelectorStr); /* iClockSel */ STR_TABLE_ENTRY(internalClockSourceStr); /* iClockSource for internal clock */ -#if SPDIF_RX +#if XUA_SPDIF_RX_EN STR_TABLE_ENTRY(spdifClockSourceStr); /* iClockSource for external S/PDIF clock */ #endif #if ADAT_RX @@ -362,7 +362,7 @@ StringDescTable_t g_strTable = #if (AUDIO_CLASS == 2) .clockSelectorStr = XUA_CLOCK_SELECTOR_EMPTY_STRING, .internalClockSourceStr = XUA_INTERNAL_CLOCK_SELECTOR_EMPTY_STRING, -#if SPDIF_RX +#if XUA_SPDIF_RX_EN .spdifClockSourceStr = XUA_SPDIF_CLOCK_SOURCE_EMPTY_STRING, #endif #if ADAT_RX @@ -655,7 +655,7 @@ typedef struct /* Class Specific Audio Control Interface Header Descriptor */ UAC_Descriptor_Interface_AC_t Audio_ClassControlInterface; USB_Descriptor_Audio_ClockSource_t Audio_ClockSource; -#if SPDIF_RX +#if XUA_SPDIF_RX_EN USB_Descriptor_Audio_ClockSource_t Audio_ClockSource_SPDIF; #endif #if ADAT_RX @@ -690,7 +690,7 @@ typedef struct // USB_Descriptor_Audio_MixerUnit_t Audio_MixerUnit; unsigned char configDesc_MixerUnit[MIXER_LENGTH]; #endif -#if (SPDIF_RX) || (ADAT_RX) +#if (XUA_SPDIF_RX_EN) || (ADAT_RX) /* Interrupt EP */ USB_Descriptor_Endpoint_t Audio_Int_Endpoint; #endif @@ -832,7 +832,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= .bDescriptorType = USB_DESCTYPE_INTERFACE, .bInterfaceNumber = INTERFACE_NUMBER_AUDIO_CONTROL, .bAlternateSetting = 0x00, /* Must be 0 */ -#if (SPDIF_RX) || (ADAT_RX) +#if (XUA_SPDIF_RX_EN) || (ADAT_RX) .bNumEndpoints = 0x01, /* 0 or 1 if optional interrupt endpoint is present */ #else .bNumEndpoints = 0x00, @@ -879,7 +879,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= .iClockSource = offsetof(StringDescTable_t, internalClockSourceStr)/sizeof(char *), }, -#if SPDIF_RX +#if XUA_SPDIF_RX_EN /* Clock Source Descriptor (4.7.2.1) */ .Audio_ClockSource_SPDIF = { @@ -937,7 +937,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= .bClockID = ID_CLKSEL, .bNrPins = NUM_CLOCKS, .baCSourceId[0] = ID_CLKSRC_INT, /* baCSourceID */ -#if SPDIF_RX +#if XUA_SPDIF_RX_EN ID_CLKSRC_SPDIF, /* baCSourceID */ #endif @@ -1393,7 +1393,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= }, #endif /* defined(MIXER) && (MAX_MIX_COUNT > 0) */ -#if (SPDIF_RX) || (ADAT_RX) +#if (XUA_SPDIF_RX_EN) || (ADAT_RX) /* Standard AS Interrupt Endpoint Descriptor (4.8.2.1): */ .Audio_Int_Endpoint = { diff --git a/lib_xua/src/core/main.xc b/lib_xua/src/core/main.xc index 83cc313f6..d6264a605 100755 --- a/lib_xua/src/core/main.xc +++ b/lib_xua/src/core/main.xc @@ -37,7 +37,7 @@ #include "mixer.h" #endif -#if (SPDIF_RX == 1) +#if (XUA_SPDIF_RX_EN) #include "SpdifReceive.h" #endif @@ -150,11 +150,11 @@ on stdcore[AUDIO_IO_TILE] : buffered out port:32 p_adat_tx = PORT_ADAT_OUT; on stdcore[XUD_TILE] : buffered in port:32 p_adat_rx = PORT_ADAT_IN; #endif -#if (SPDIF_RX == 1) +#if (XUA_SPDIF_RX_EN) on tile[XUD_TILE] : buffered in port:4 p_spdif_rx = PORT_SPDIF_IN; #endif -#if (SPDIF_RX) || (ADAT_RX) || (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) +#if (XUA_SPDIF_RX_EN) || (ADAT_RX) || (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) /* Reference to external clock multiplier */ on tile[PLL_REF_TILE] : out port p_pll_ref = PORT_PLL_REF; #endif @@ -182,7 +182,7 @@ on tile[MIDI_TILE] : clock clk_midi = CLKBLK_MIDI; on tile[SPDIF_TX_TILE] : clock clk_mst_spd = CLKBLK_SPDIF_TX; #endif -#if (SPDIF_RX == 1) +#if (XUA_SPDIF_RX_EN) on tile[XUD_TILE] : clock clk_spd_rx = CLKBLK_SPDIF_RX; #endif @@ -236,7 +236,7 @@ XUD_EpType epTypeTableIn[ENDPOINT_COUNT_IN] = { XUD_EPTYPE_CTL | XUD_STATUS_ENAB #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) XUD_EPTYPE_ISO, /* Async feedback endpoint */ #endif -#if (SPDIF_RX == 1) || (ADAT_RX) +#if (XUA_SPDIF_RX_EN || ADAT_RX) XUD_EPTYPE_BUL, #endif #ifdef MIDI @@ -359,7 +359,7 @@ VENDOR_REQUESTS_PARAMS_DEC_ c_xud_in[ENDPOINT_NUMBER_IN_MIDI], /* MIDI In */ // 4 c_midi, #endif -#if (SPDIF_RX) || (ADAT_RX) +#if (XUA_SPDIF_RX_EN || ADAT_RX) /* Audio Interrupt - only used for interrupts on external clock change */ c_xud_in[ENDPOINT_NUMBER_IN_INTERRUPT], c_clk_int, @@ -438,7 +438,7 @@ void usb_audio_io(chanend ?c_aud_in, chan c_mix_out; #endif -#if (SPDIF_RX) || (ADAT_RX) +#if (XUA_SPDIF_RX_EN || ADAT_RX) chan c_dig_rx; #else #define c_dig_rx null @@ -485,7 +485,7 @@ void usb_audio_io(chanend ?c_aud_in, #if (XUA_SPDIF_TX_EN) //&& (SPDIF_TX_TILE != AUDIO_IO_TILE) , c_spdif_tx #endif -#if (SPDIF_RX) ||(ADAT_RX) +#if (XUA_SPDIF_RX_EN || ADAT_RX) , c_dig_rx #endif #if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0) && (XUA_DFU_EN == 1) @@ -501,7 +501,7 @@ void usb_audio_io(chanend ?c_aud_in, xua_pdm_mic(c_ds_output, p_pdm_mics); #endif -#if (SPDIF_RX) || (ADAT_RX) +#if (XUA_SPDIF_RX_EN || ADAT_RX) { thread_speed(); @@ -545,7 +545,7 @@ int main() chan c_mix_ctl; #endif -#if SPDIF_RX +#if (XUA_SPDIF_RX_EN) streaming chan c_spdif_rx; #else #define c_spdif_rx null @@ -561,8 +561,7 @@ int main() chan c_spdif_tx; #endif - -#if ((SPDIF_RX) || (ADAT_RX)) +#if (XUA_SPDIF_RX_EN || ADAT_RX) chan c_clk_ctl; chan c_clk_int; #else @@ -687,7 +686,7 @@ int main() #endif #endif -#if SPDIF_RX +#if (XUA_SPDIF_RX_EN) on tile[XUD_TILE]: { thread_speed(); From 3e0f127b92c815bb6de3181c34b59cad9d5fb958 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 27 Jun 2022 19:15:56 +0100 Subject: [PATCH 2/7] Use i_sync for sync signal to CS2100 interface when AUDIO_IO_TILE != PLL_REF_TILE and S/PDIF Rx is enabled. --- lib_xua/src/core/clocking/clockgen.xc | 57 ++++++++++++++++++++++++--- lib_xua/src/core/clocking/clocking.h | 26 +++++++----- lib_xua/src/core/main.xc | 17 ++++++-- 3 files changed, 82 insertions(+), 18 deletions(-) diff --git a/lib_xua/src/core/clocking/clockgen.xc b/lib_xua/src/core/clocking/clockgen.xc index c2264738c..b06a52501 100644 --- a/lib_xua/src/core/clocking/clockgen.xc +++ b/lib_xua/src/core/clocking/clockgen.xc @@ -40,10 +40,10 @@ static int clockInt[NUM_CLOCKS]; /* Interupt flag for static int clockId[NUM_CLOCKS]; [[combinable]] -void PllRefPinTask(server interface sync_if i_sync, out port p_sync) +void PllRefPinTask(server interface sync_if i_sync, out port p_pll_ref) { static unsigned pinVal= 0; - p_sync <: pinVal; + static unsigned short pinTime = 0; while(1) { @@ -51,7 +51,30 @@ void PllRefPinTask(server interface sync_if i_sync, out port p_sync) { case i_sync.toggle(): pinVal = ~pinVal; - p_sync <: pinVal; + p_pll_ref <: pinVal; + break; + + case i_sync.init(): + p_pll_ref <: pinVal @ pinTime; + pinTime += (unsigned short)(LOCAL_CLOCK_INCREMENT - (LOCAL_CLOCK_INCREMENT/2)); + p_pll_ref @ pinTime <: pinVal; + break; + + case i_sync.toggle_timed(int relative): + + if (!relative) + { + pinTime += (short) LOCAL_CLOCK_INCREMENT; + pinVal = !pinVal; + p_pll_ref @ pinTime <: pinVal; + } + else + { + p_pll_ref <: pinVal @ pinTime; + pinTime += (short) LOCAL_CLOCK_INCREMENT; + pinVal = !pinVal; + p_pll_ref @ pinTime <: pinVal; + } break; } } @@ -218,12 +241,19 @@ extern int samples_to_host_inputs_buff[NUM_USB_CHAN_IN]; int VendorAudCoreReqs(unsigned cmd, chanend c); #pragma unsafe arrays +#if (AUDIO_IO_TILE == PLL_REF_TILE) void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, chanend c_dig_rx, chanend c_clk_ctl, chanend c_clk_int) +#else +void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interface sync_if i_sync, chanend c_dig_rx, chanend c_clk_ctl, chanend c_clk_int) +#endif { timer t_local; unsigned timeNextEdge, timeLastEdge, timeNextClockDetection; + +#if (AUDIO_IO_TILE == PLL_REF_TILE) unsigned pinVal = 0; unsigned short pinTime; +#endif unsigned clkMode = CLOCK_INTERNAL; /* Current clocking mode in operation */ unsigned tmp; @@ -325,10 +355,15 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch outuint(c_dig_rx, 1); #endif +#if (AUDIO_IO_TILE == PLL_REF_TILE) /* Initial ref clock output and get timestamp */ p <: pinVal @ pinTime; pinTime += (unsigned short)(LOCAL_CLOCK_INCREMENT - (LOCAL_CLOCK_INCREMENT/2)); p @ pinTime <: pinVal; +#else + /* TODO ideally always use interface */ + i_sync.init(); +#endif while(1) { @@ -451,11 +486,15 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch /* Generate local clock from timer */ case t_local when timerafter(timeNextEdge) :> void: - +#if (AUDIO_IO_TILE == PLL_REF_TILE) /* Setup next local clock edge */ pinTime += (short) LOCAL_CLOCK_INCREMENT; pinVal = !pinVal; p @ pinTime <: pinVal; +#else + /* TODO ideally always use interface */ + i_sync.toggle_timed(0); +#endif /* Record time of edge */ timeLastEdge = timeNextEdge; @@ -584,11 +623,16 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch /* Setup for next edge */ timeNextEdge = spdifReceivedTime + LOCAL_CLOCK_INCREMENT + LOCAL_CLOCK_MARGIN; +#if (AUDIO_IO_TILE == PLL_REF_TILE) /* Toggle edge */ p <: pinVal @ pinTime; pinTime += (short) LOCAL_CLOCK_INCREMENT; pinVal = !pinVal; p @ pinTime <: pinVal; +#else + i_sync.toggle_timed(1); + +#endif /* Reset counters */ spdifCounters.receivedSamples = 0; @@ -693,12 +737,15 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch /* Setup for next edge */ timeNextEdge = adatReceivedTime + LOCAL_CLOCK_INCREMENT + LOCAL_CLOCK_MARGIN; +#if (AUDIO_IO_TILE == PLL_REF_TILE) /* Toggle edge */ p <: pinVal @ pinTime; pinTime += LOCAL_CLOCK_INCREMENT; pinVal = !pinVal; p @ pinTime <: pinVal; - +#else + i_sync.toggle_timed(1); +#endif /* Reset counters */ adatCounters.receivedSamples = 0; diff --git a/lib_xua/src/core/clocking/clocking.h b/lib_xua/src/core/clocking/clocking.h index a388f16aa..d892160da 100644 --- a/lib_xua/src/core/clocking/clocking.h +++ b/lib_xua/src/core/clocking/clocking.h @@ -4,6 +4,18 @@ #ifndef _CLOCKING_H_ #define _CLOCKING_H_ + + +interface sync_if +{ + void toggle(); + void init(); + void toggle_timed(int relative); +}; + +[[combinable]] +void PllRefPinTask(server interface sync_if i_sync, out port p_sync); + /** Clock generation and digital audio I/O handling. * * \param c_spdif_rx channel connected to S/PDIF receive thread @@ -15,14 +27,10 @@ * \param c_clk_int channel connected to the decouple() thread for clock interrupts */ -void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, chanend c_audio, chanend c_clk_ctl, chanend c_clk_int); - -interface sync_if -{ - void toggle(); -}; - -[[combinable]] -void PllRefPinTask(server interface sync_if i_sync, out port p_sync); +#if (AUDIO_IO_TILE == PLL_REF_TILE) +void clockGen(streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interface out port p_pll_ref, chanend c_audio, chanend c_clk_ctl, chanend c_clk_int); +#else +void clockGen(streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interface sync_if i_sync, chanend c_audio, chanend c_clk_ctl, chanend c_clk_int); +#endif #endif diff --git a/lib_xua/src/core/main.xc b/lib_xua/src/core/main.xc index d6264a605..a3aa94cf9 100755 --- a/lib_xua/src/core/main.xc +++ b/lib_xua/src/core/main.xc @@ -432,6 +432,9 @@ void usb_audio_io(chanend ?c_aud_in, #endif , chanend c_pdm_pcm #endif +#if (XUA_SPDIF_RX_EN && (AUDIO_IO_TILE != PLL_REF_TILE)) + , client interface sync_if i_sync +#endif ) { #ifdef MIXER @@ -503,9 +506,13 @@ void usb_audio_io(chanend ?c_aud_in, #if (XUA_SPDIF_RX_EN || ADAT_RX) { + /* ClockGen must currently run on same tile as AudioHub due to shared memory buffer */ thread_speed(); - +#if AUDIO_IO_TILE == PLL_REF_TILE clockGen(c_spdif_rx, c_adat_rx, p_pll_ref, c_dig_rx, c_clk_ctl, c_clk_int); +#else + clockGen(c_spdif_rx, c_adat_rx, i_sync, c_dig_rx, c_clk_ctl, c_clk_int); +#endif } #endif @@ -583,7 +590,7 @@ int main() #endif #endif -#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) +#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) || (XUA_SPDIF_RX_EN && (AUDIO_IO_TILE != PLL_REF_TILE)) interface sync_if i_sync; #endif @@ -593,9 +600,8 @@ int main() { USER_MAIN_CORES -#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) +#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) || (XUA_SPDIF_RX_EN && (AUDIO_IO_TILE != PLL_REF_TILE)) on tile[PLL_REF_TILE]: PllRefPinTask(i_sync, p_pll_ref); - #endif on tile[XUD_TILE]: par @@ -649,6 +655,9 @@ int main() , c_ds_output #endif , c_pdm_pcm +#endif +#if (XUA_SPDIF_RX_EN && (AUDIO_IO_TILE != PLL_REF_TILE)) + , i_sync #endif ); } From bb0dec49238d104927137b1dabb163bc7d4a6828 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 28 Jun 2022 10:39:01 +0100 Subject: [PATCH 3/7] - Renamed i_sync to i_pll_ref. - Always used i_pll_ref interface from clockgen rather than direct port access --- lib_xua/api/xua_buffer.h | 4 +- lib_xua/src/core/buffer/ep/ep_buffer.xc | 8 ++-- lib_xua/src/core/clocking/clockgen.xc | 55 +++++++------------------ lib_xua/src/core/clocking/clocking.h | 16 +++---- lib_xua/src/core/main.xc | 34 +++++++-------- 5 files changed, 41 insertions(+), 76 deletions(-) diff --git a/lib_xua/api/xua_buffer.h b/lib_xua/api/xua_buffer.h index 7be345784..75a905453 100644 --- a/lib_xua/api/xua_buffer.h +++ b/lib_xua/api/xua_buffer.h @@ -51,7 +51,7 @@ void XUA_Buffer( #endif , chanend c_aud #if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) - , client interface sync_if i_sync + , client interface pll_ref_if i_pll_ref #endif ); @@ -81,7 +81,7 @@ void XUA_Buffer_Ep(chanend c_aud_out, , chanend c_buff_ctrl #endif #if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) - , client interface sync_if i_sync + , client interface pll_ref_if i_pll_ref #endif ); diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index e75b527f0..d5d4db320 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -115,7 +115,7 @@ void XUA_Buffer( #endif , chanend c_aud #if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) - , client interface sync_if i_sync + , client interface pll_ref_if i_pll_ref #endif ) { @@ -150,7 +150,7 @@ void XUA_Buffer( , c_buff_ctrl #endif #if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) - , i_sync + , i_pll_ref #endif ); @@ -200,7 +200,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, , chanend c_buff_ctrl #endif #if XUA_SYNCMODE == XUA_SYNCMODE_SYNC - , client interface sync_if i_sync + , client interface pll_ref_if i_pll_ref #endif ) { @@ -529,7 +529,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, if (sofCount == framesPerSec) { /* Port is accessed via interface to allow flexibilty with location */ - i_sync.toggle(); + i_pll_ref.toggle(); sofCount = 0; } #else diff --git a/lib_xua/src/core/clocking/clockgen.xc b/lib_xua/src/core/clocking/clockgen.xc index b06a52501..cf3137c78 100644 --- a/lib_xua/src/core/clocking/clockgen.xc +++ b/lib_xua/src/core/clocking/clockgen.xc @@ -39,8 +39,8 @@ static int clockValid[NUM_CLOCKS]; /* Store current val static int clockInt[NUM_CLOCKS]; /* Interupt flag for clocks */ static int clockId[NUM_CLOCKS]; -[[combinable]] -void PllRefPinTask(server interface sync_if i_sync, out port p_pll_ref) +[[distributable]] +void PllRefPinTask(server interface pll_ref_if i_pll_ref, out port p_pll_ref) { static unsigned pinVal= 0; static unsigned short pinTime = 0; @@ -49,18 +49,18 @@ void PllRefPinTask(server interface sync_if i_sync, out port p_pll_ref) { select { - case i_sync.toggle(): + case i_pll_ref.toggle(): pinVal = ~pinVal; p_pll_ref <: pinVal; break; - case i_sync.init(): + case i_pll_ref.init(): p_pll_ref <: pinVal @ pinTime; pinTime += (unsigned short)(LOCAL_CLOCK_INCREMENT - (LOCAL_CLOCK_INCREMENT/2)); p_pll_ref @ pinTime <: pinVal; break; - case i_sync.toggle_timed(int relative): + case i_pll_ref.toggle_timed(int relative): if (!relative) { @@ -241,10 +241,11 @@ extern int samples_to_host_inputs_buff[NUM_USB_CHAN_IN]; int VendorAudCoreReqs(unsigned cmd, chanend c); #pragma unsafe arrays -#if (AUDIO_IO_TILE == PLL_REF_TILE) +//#if (AUDIO_IO_TILE == PLL_REF_TILE) +#if 0 void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, chanend c_dig_rx, chanend c_clk_ctl, chanend c_clk_int) #else -void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interface sync_if i_sync, chanend c_dig_rx, chanend c_clk_ctl, chanend c_clk_int) +void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interface pll_ref_if i_pll_ref, chanend c_dig_rx, chanend c_clk_ctl, chanend c_clk_int) #endif { timer t_local; @@ -355,16 +356,9 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa outuint(c_dig_rx, 1); #endif -#if (AUDIO_IO_TILE == PLL_REF_TILE) /* Initial ref clock output and get timestamp */ - p <: pinVal @ pinTime; - pinTime += (unsigned short)(LOCAL_CLOCK_INCREMENT - (LOCAL_CLOCK_INCREMENT/2)); - p @ pinTime <: pinVal; -#else - /* TODO ideally always use interface */ - i_sync.init(); -#endif - + i_pll_ref.init(); + while(1) { select @@ -486,15 +480,8 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa /* Generate local clock from timer */ case t_local when timerafter(timeNextEdge) :> void: -#if (AUDIO_IO_TILE == PLL_REF_TILE) /* Setup next local clock edge */ - pinTime += (short) LOCAL_CLOCK_INCREMENT; - pinVal = !pinVal; - p @ pinTime <: pinVal; -#else - /* TODO ideally always use interface */ - i_sync.toggle_timed(0); -#endif + i_pll_ref.toggle_timed(0); /* Record time of edge */ timeLastEdge = timeNextEdge; @@ -623,16 +610,8 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa /* Setup for next edge */ timeNextEdge = spdifReceivedTime + LOCAL_CLOCK_INCREMENT + LOCAL_CLOCK_MARGIN; -#if (AUDIO_IO_TILE == PLL_REF_TILE) /* Toggle edge */ - p <: pinVal @ pinTime; - pinTime += (short) LOCAL_CLOCK_INCREMENT; - pinVal = !pinVal; - p @ pinTime <: pinVal; -#else - i_sync.toggle_timed(1); - -#endif + i_pll_ref.toggle_timed(1); /* Reset counters */ spdifCounters.receivedSamples = 0; @@ -737,15 +716,9 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interfa /* Setup for next edge */ timeNextEdge = adatReceivedTime + LOCAL_CLOCK_INCREMENT + LOCAL_CLOCK_MARGIN; -#if (AUDIO_IO_TILE == PLL_REF_TILE) /* Toggle edge */ - p <: pinVal @ pinTime; - pinTime += LOCAL_CLOCK_INCREMENT; - pinVal = !pinVal; - p @ pinTime <: pinVal; -#else - i_sync.toggle_timed(1); -#endif + i_pll_ref.toggle_timed(1); + /* Reset counters */ adatCounters.receivedSamples = 0; diff --git a/lib_xua/src/core/clocking/clocking.h b/lib_xua/src/core/clocking/clocking.h index d892160da..bde1eb343 100644 --- a/lib_xua/src/core/clocking/clocking.h +++ b/lib_xua/src/core/clocking/clocking.h @@ -4,33 +4,27 @@ #ifndef _CLOCKING_H_ #define _CLOCKING_H_ - - -interface sync_if +interface pll_ref_if { void toggle(); void init(); void toggle_timed(int relative); }; -[[combinable]] -void PllRefPinTask(server interface sync_if i_sync, out port p_sync); +[[distributable]] +void PllRefPinTask(server interface pll_ref_if i_pll_ref, out port p_sync); /** Clock generation and digital audio I/O handling. * * \param c_spdif_rx channel connected to S/PDIF receive thread * \param c_adat_rx channel connect to ADAT receive thread - * \param p port to output clock signal to drive external frequency synthesizer + * \param i_pll_ref interface to taslk that outputs clock signal to drive external frequency synthesizer * \param c_audio channel connected to the audio() thread * \param c_clk_ctl channel connected to Endpoint0() for configuration of the * clock * \param c_clk_int channel connected to the decouple() thread for clock interrupts */ -#if (AUDIO_IO_TILE == PLL_REF_TILE) -void clockGen(streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interface out port p_pll_ref, chanend c_audio, chanend c_clk_ctl, chanend c_clk_int); -#else -void clockGen(streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interface sync_if i_sync, chanend c_audio, chanend c_clk_ctl, chanend c_clk_int); -#endif +void clockGen(streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, client interface pll_ref_if i_pll_ref, chanend c_audio, chanend c_clk_ctl, chanend c_clk_int); #endif diff --git a/lib_xua/src/core/main.xc b/lib_xua/src/core/main.xc index a3aa94cf9..541381549 100755 --- a/lib_xua/src/core/main.xc +++ b/lib_xua/src/core/main.xc @@ -289,7 +289,7 @@ void usb_audio_core(chanend c_mix_out , chanend ?c_clk_ctl , client interface i_dfu ?dfuInterface #if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) - , client interface sync_if i_sync + , client interface pll_ref_if i_pll_ref #endif VENDOR_REQUESTS_PARAMS_DEC_ ) @@ -373,7 +373,7 @@ VENDOR_REQUESTS_PARAMS_DEC_ #endif , c_mix_out #if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) - , i_sync + , i_pll_ref #endif ); //: @@ -432,8 +432,8 @@ void usb_audio_io(chanend ?c_aud_in, #endif , chanend c_pdm_pcm #endif -#if (XUA_SPDIF_RX_EN && (AUDIO_IO_TILE != PLL_REF_TILE)) - , client interface sync_if i_sync +#if (XUA_SPDIF_RX_EN || ADAT_RX) + , client interface pll_ref_if i_pll_ref #endif ) { @@ -506,13 +506,11 @@ void usb_audio_io(chanend ?c_aud_in, #if (XUA_SPDIF_RX_EN || ADAT_RX) { - /* ClockGen must currently run on same tile as AudioHub due to shared memory buffer */ + /* ClockGen must currently run on same tile as AudioHub due to shared memory buffer + * However, due to the use of an interface the pll reference signal port can be on another tile + */ thread_speed(); -#if AUDIO_IO_TILE == PLL_REF_TILE - clockGen(c_spdif_rx, c_adat_rx, p_pll_ref, c_dig_rx, c_clk_ctl, c_clk_int); -#else - clockGen(c_spdif_rx, c_adat_rx, i_sync, c_dig_rx, c_clk_ctl, c_clk_int); -#endif + clockGen(c_spdif_rx, c_adat_rx, i_pll_ref, c_dig_rx, c_clk_ctl, c_clk_int); } #endif @@ -590,8 +588,8 @@ int main() #endif #endif -#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) || (XUA_SPDIF_RX_EN && (AUDIO_IO_TILE != PLL_REF_TILE)) - interface sync_if i_sync; +#if ((XUA_SYNCMODE == XUA_SYNCMODE_SYNC) || XUA_SPDIF_RX_EN || ADAT_RX) + interface pll_ref_if i_pll_ref; #endif USER_MAIN_DECLARATIONS @@ -600,8 +598,8 @@ int main() { USER_MAIN_CORES -#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) || (XUA_SPDIF_RX_EN && (AUDIO_IO_TILE != PLL_REF_TILE)) - on tile[PLL_REF_TILE]: PllRefPinTask(i_sync, p_pll_ref); +#if ((XUA_SYNCMODE == XUA_SYNCMODE_SYNC) || XUA_SPDIF_RX_EN || ADAT_RX) + on tile[PLL_REF_TILE]: PllRefPinTask(i_pll_ref, p_pll_ref); #endif on tile[XUD_TILE]: par @@ -629,7 +627,7 @@ int main() #endif , c_clk_int, c_clk_ctl, dfuInterface #if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) - , i_sync + , i_pll_ref #endif VENDOR_REQUESTS_PARAMS_ @@ -656,8 +654,8 @@ int main() #endif , c_pdm_pcm #endif -#if (XUA_SPDIF_RX_EN && (AUDIO_IO_TILE != PLL_REF_TILE)) - , i_sync +#if (XUA_SPDIF_RX_EN || ADAT_RX) + , i_pll_ref #endif ); } @@ -720,7 +718,7 @@ int main() #if XUA_USB_EN #if (XUD_TILE != 0 ) && (AUDIO_IO_TILE != 0) && (XUA_DFU_EN == 1) /* Run flash code on its own - hope it gets combined */ -//#warning Running DFU flash code on its own + //#warning Running DFU flash code on its own on stdcore[0]: DFUHandler(dfuInterface, null); #endif #endif From 54410819272911372006c08b4ecc567c58bf3b68 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 29 Jun 2022 13:07:38 +0100 Subject: [PATCH 4/7] I2S_MODE_TDM now XUA_PCM_FORMAT --- lib_xua/api/xua_conf_default.h | 17 +++++++++++------ lib_xua/src/core/audiohub/audiohub_initport.xc | 2 +- lib_xua/src/core/audiohub/xua_audiohub.xc | 12 ++++++------ 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/lib_xua/api/xua_conf_default.h b/lib_xua/api/xua_conf_default.h index 79d1451ee..9fbee9510 100644 --- a/lib_xua/api/xua_conf_default.h +++ b/lib_xua/api/xua_conf_default.h @@ -98,20 +98,25 @@ #define DSD_CHANS_DAC 0 #endif +#define XUA_PCM_FORMAT_I2S (0) +#define XUA_PCM_FORMAT_TDM (1) -/* TODO not required */ -#ifndef I2S_MODE_TDM -#define I2S_MODE_TDM 0 +#ifdef XUA_PCM_FORMAT + #if (XUA_PCM_FORMAT != XUA_PCM_FORMAT_I2S) && (XUA_PCM_FORMAT != XUA_PCM_FORMAT_TDM) + #error Bad value for XUA_PCM_FORMAT + #endif +#else + #define XUA_PCM_FORMAT XUA_PCM_FORMAT_I2S #endif /** * @brief Channels per I2S frame. * * - * Default: 2 i.e standard stereo I2S (8 if using TDM i.e. I2S_MODE_TDM). + * Default: 2 i.e standard stereo I2S (8 if using TDM i.e. XUA_PCM_FORMAT_TDM). * **/ #ifndef I2S_CHANS_PER_FRAME - #if (I2S_MODE_TDM == 1) + #if (XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM) #define I2S_CHANS_PER_FRAME 8 #else #define I2S_CHANS_PER_FRAME 2 @@ -188,7 +193,7 @@ */ #if (I2S_DOWNSAMPLE_MONO_IN == 1) #define I2S_DOWNSAMPLE_CHANS_IN (I2S_CHANS_ADC / 2) - #if ((I2S_DOWNSAMPLE_FACTOR_IN > 1) && (I2S_MODE_TDM == 1)) + #if ((I2S_DOWNSAMPLE_FACTOR_IN > 1) && (XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM)) #error Mono I2S input downsampling is not avaliable in TDM mode #endif #else diff --git a/lib_xua/src/core/audiohub/audiohub_initport.xc b/lib_xua/src/core/audiohub/audiohub_initport.xc index 51c467ca0..e0e151614 100644 --- a/lib_xua/src/core/audiohub/audiohub_initport.xc +++ b/lib_xua/src/core/audiohub/audiohub_initport.xc @@ -85,7 +85,7 @@ void InitPorts_slave(unsigned divide, buffered _XUA_CLK_DIR port:32 p_lrclk, buf p_lrclk when pinseq(1) :> void; p_lrclk when pinseq(0) :> void; p_lrclk when pinseq(1) :> void; -#if I2S_MODE_TDM +#if (XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM) p_lrclk when pinseq(0) :> void; p_lrclk when pinseq(1) :> void @ tmp; #else diff --git a/lib_xua/src/core/audiohub/xua_audiohub.xc b/lib_xua/src/core/audiohub/xua_audiohub.xc index 10e0fc52d..5c9ce4e5a 100755 --- a/lib_xua/src/core/audiohub/xua_audiohub.xc +++ b/lib_xua/src/core/audiohub/xua_audiohub.xc @@ -161,7 +161,7 @@ static inline int HandleSampleClock(int frameCount, buffered _XUA_CLK_DIR port:3 unsigned lrval = 0; p_lrclk :> lrval; - if(I2S_MODE_TDM) + if(XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM) { /* Only check for the rising edge of frame sync being in the right place because falling edge timing not specified */ if (frameCount == 1) @@ -186,7 +186,7 @@ static inline int HandleSampleClock(int frameCount, buffered _XUA_CLK_DIR port:3 return syncError; #else - if(I2S_MODE_TDM) + if(XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM) { if(frameCount == (I2S_CHANS_PER_FRAME-1)) p_lrclk <: 0x80000000; @@ -553,7 +553,7 @@ unsigned static AudioHub_MainLoop(chanend ?c_out, chanend ?c_spd_out } #endif -#if I2S_MODE_TDM +#if (XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM) /* Increase frameCount by 2 since we have output two channels (per data line) */ frameCount+=1; if(frameCount == I2S_CHANS_PER_FRAME) @@ -724,7 +724,7 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk, while(1) { /* Calculate what master clock we should be using */ - if ((MCLK_441 % curSamFreq) == 0) + if (((MCLK_441) % curSamFreq) == 0) { mClk = MCLK_441; #ifdef ADAT_TX @@ -733,7 +733,7 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk, adatMultiple = mClk / 44100; #endif } - else if ((MCLK_48 % curSamFreq) == 0) + else if (((MCLK_48) % curSamFreq) == 0) { mClk = MCLK_48; #ifdef ADAT_TX @@ -746,7 +746,7 @@ 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 * e.g. 11.289600 / (176400 * 64) = 1 */ { -#if I2S_MODE_TDM +#if (XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM) /* I2S has 32 bits per sample. *8 as 8 channels */ unsigned numBits = 256; #else From 2a8f3b11d96ef3fb2a25f8b4860c373e57ec1038 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 11 Jul 2022 12:09:30 +0100 Subject: [PATCH 5/7] Updated copyright comment --- lib_xua/src/core/endpoint0/chanstrings.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/endpoint0/chanstrings.h b/lib_xua/src/core/endpoint0/chanstrings.h index f1e98422e..b30886a52 100644 --- a/lib_xua/src/core/endpoint0/chanstrings.h +++ b/lib_xua/src/core/endpoint0/chanstrings.h @@ -1,4 +1,4 @@ -// Copyright 2015-2021 XMOS LIMITED. +// Copyright 2015-2022 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. /* AUTOGENERATED using chanstringgen.py */ From 1ad26f6bac94a68a7160246c949256d1df25fc4a Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 11 Jul 2022 12:35:07 +0100 Subject: [PATCH 6/7] Update app_test_i2s_loopback for latest API related to TDM --- legacy_tests/app_test_i2s_loopback/Makefile | 8 ++++---- legacy_tests/app_test_i2s_loopback/main.xc | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/legacy_tests/app_test_i2s_loopback/Makefile b/legacy_tests/app_test_i2s_loopback/Makefile index c3e3ab403..51bec3885 100644 --- a/legacy_tests/app_test_i2s_loopback/Makefile +++ b/legacy_tests/app_test_i2s_loopback/Makefile @@ -45,25 +45,25 @@ BUILD_FLAGS_i2s_slave_8in_8out_192khz = $(BUILD_FLAGS) \ -D DEFAULT_FREQ=192000 -DCODEC_MASTER=1 \ -O2 # optimisations to meet timing -BUILD_FLAGS_tdm_master_8in_8out_48khz = $(BUILD_FLAGS) -D I2S_MODE_TDM=1 \ +BUILD_FLAGS_tdm_master_8in_8out_48khz = $(BUILD_FLAGS) -D XUA_PCM_FORMAT=XUA_PCM_FORMAT_TDM \ -D ADAT_RX=0 -D ADAT_TX=0 -D SPDIF_RX=0 -D SPDIF_TX=0 -D MIDI=0 \ -D NUM_USB_CHAN_IN=8 -D NUM_USB_CHAN_OUT=8 -D I2S_CHANS_ADC=8 -D I2S_CHANS_DAC=8 \ -D DEFAULT_FREQ=48000 \ -O2 # optimisations to meet timing -BUILD_FLAGS_tdm_slave_8in_8out_48khz = $(BUILD_FLAGS) -D I2S_MODE_TDM=1 \ +BUILD_FLAGS_tdm_slave_8in_8out_48khz = $(BUILD_FLAGS) -D XUA_PCM_FORMAT=XUA_PCM_FORMAT_TDM \ -D ADAT_RX=0 -D ADAT_TX=0 -D SPDIF_RX=0 -D SPDIF_TX=0 -D MIDI=0 \ -D NUM_USB_CHAN_IN=8 -D NUM_USB_CHAN_OUT=8 -D I2S_CHANS_ADC=8 -D I2S_CHANS_DAC=8 \ -D DEFAULT_FREQ=48000 -DCODEC_MASTER=1 \ -O2 # optimisations to meet timing -BUILD_FLAGS_tdm_master_16in_16out_48khz = $(BUILD_FLAGS) -D I2S_MODE_TDM=1 \ +BUILD_FLAGS_tdm_master_16in_16out_48khz = $(BUILD_FLAGS) -D XUA_PCM_FORMAT=XUA_PCM_FORMAT_TDM \ -D ADAT_RX=0 -D ADAT_TX=0 -D SPDIF_RX=0 -D SPDIF_TX=0 -D MIDI=0 \ -D NUM_USB_CHAN_IN=16 -D NUM_USB_CHAN_OUT=16 -D I2S_CHANS_ADC=16 -D I2S_CHANS_DAC=16 \ -D DEFAULT_FREQ=48000 \ -O2 # optimisations to meet timing -BUILD_FLAGS_tdm_slave_16in_16out_48khz = $(BUILD_FLAGS) -D I2S_MODE_TDM=1 \ +BUILD_FLAGS_tdm_slave_16in_16out_48khz = $(BUILD_FLAGS) -D XUA_PCM_FORMAT=XUD_PCM_FORMAT_TDM \ -D ADAT_RX=0 -D ADAT_TX=0 -D SPDIF_RX=0 -D SPDIF_TX=0 -D MIDI=0 \ -D NUM_USB_CHAN_IN=16 -D NUM_USB_CHAN_OUT=16 -D I2S_CHANS_ADC=16 -D I2S_CHANS_DAC=16 \ -D DEFAULT_FREQ=48000 -DCODEC_MASTER=1 \ diff --git a/legacy_tests/app_test_i2s_loopback/main.xc b/legacy_tests/app_test_i2s_loopback/main.xc index bfef1fd16..a98bc9ec9 100644 --- a/legacy_tests/app_test_i2s_loopback/main.xc +++ b/legacy_tests/app_test_i2s_loopback/main.xc @@ -203,7 +203,7 @@ void slave_mode_clk_setup(const unsigned samFreq, const unsigned chans_per_frame #endif -#if I2S_MODE_TDM +#if (XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM) const int i2s_tdm_mode = 8; #else const int i2s_tdm_mode = 2; From f534537b7657bfa243551691864b415594953022 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 11 Jul 2022 13:43:13 +0100 Subject: [PATCH 7/7] Fix typo in define --- legacy_tests/app_test_i2s_loopback/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/legacy_tests/app_test_i2s_loopback/Makefile b/legacy_tests/app_test_i2s_loopback/Makefile index 51bec3885..7fb0bb123 100644 --- a/legacy_tests/app_test_i2s_loopback/Makefile +++ b/legacy_tests/app_test_i2s_loopback/Makefile @@ -63,7 +63,7 @@ BUILD_FLAGS_tdm_master_16in_16out_48khz = $(BUILD_FLAGS) -D XUA_PCM_FORMAT=XUA_P -D DEFAULT_FREQ=48000 \ -O2 # optimisations to meet timing -BUILD_FLAGS_tdm_slave_16in_16out_48khz = $(BUILD_FLAGS) -D XUA_PCM_FORMAT=XUD_PCM_FORMAT_TDM \ +BUILD_FLAGS_tdm_slave_16in_16out_48khz = $(BUILD_FLAGS) -D XUA_PCM_FORMAT=XUA_PCM_FORMAT_TDM \ -D ADAT_RX=0 -D ADAT_TX=0 -D SPDIF_RX=0 -D SPDIF_TX=0 -D MIDI=0 \ -D NUM_USB_CHAN_IN=16 -D NUM_USB_CHAN_OUT=16 -D I2S_CHANS_ADC=16 -D I2S_CHANS_DAC=16 \ -D DEFAULT_FREQ=48000 -DCODEC_MASTER=1 \