Initial conflict resolve following merge

This commit is contained in:
Ed
2024-01-15 15:20:37 +00:00
parent c0a844c303
commit aac2b4b7fb
8 changed files with 58 additions and 49 deletions

View File

@@ -86,8 +86,29 @@ void AudioHwConfig(unsigned samFreq, unsigned mClk, unsigned dsdMode,
#endif // __XC__ #endif // __XC__
void UserBufferManagementInit(unsigned samFreq); /**
* @brief User buffer management code
*
* This function is called at the sample rate of the USB Audio stack (e.g,. 48 kHz) and between the two parameter arrays
* contain a full multi-channel audio-frame. The first array carries all the data that has been received from the USB host
* and is to be presented to the audio interfaces. The second array carries all the data received from the interfaces and
* is to be presented to the USB host. The user can chose to intercept and overwrite the samples stored in these arrays.
*
* \param sampsFromUsbToAudio Samples received from USB host and to be presented to audio interfaces
*
* \param sampsFromAudioToUsb Samples received from the audio interfaces and to be presented to the USB host
*/
void UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudioToUsb[]); void UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudioToUsb[]);
/**
* @brief User buffer managment init code
*
* This function is called once, before the first call to UserBufferManagement(), and can be used to initialise any
* related user state
*
* \param sampFreq The initial sample frequency
*
*/
void UserBufferManagementInit(unsigned sampFreq);
#endif // _XUA_AUDIOHUB_H_ #endif // _XUA_AUDIOHUB_H_

View File

@@ -53,10 +53,10 @@ void XUA_Buffer(
#endif #endif
, chanend c_aud , chanend c_aud
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) || defined(__DOYXGEN__) #if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) || defined(__DOYXGEN__)
#if (!XUA_USE_APP_PLL) || defined(__DOXYGEN__) #if (!USE_SW_PLL) || defined(__DOXYGEN__)
, client interface pll_ref_if i_pll_ref , client interface pll_ref_if i_pll_ref
#endif #endif
#if (XUA_USE_APP_PLL) || defined(__DOXYGEN__) #if (USE_SW_PLL) || defined(__DOXYGEN__)
, chanend c_swpll_update , chanend c_swpll_update
#endif #endif
#endif #endif
@@ -88,10 +88,10 @@ void XUA_Buffer_Ep(chanend c_aud_out,
, chanend c_buff_ctrl , chanend c_buff_ctrl
#endif #endif
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) || defined(__DOYXGEN__) #if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) || defined(__DOYXGEN__)
#if (!XUA_USE_APP_PLL) || defined(__DOXYGEN__) #if (!USE_SW_PLL) || defined(__DOXYGEN__)
, client interface pll_ref_if i_pll_ref , client interface pll_ref_if i_pll_ref
#endif #endif
#if (XUA_USE_APP_PLL) || defined(__DOXYGEN__) #if (USE_SW_PLL) || defined(__DOXYGEN__)
, chanend c_swpll_update , chanend c_swpll_update
#endif #endif
#endif #endif

View File

@@ -39,6 +39,7 @@ void clockGen( streaming chanend ?c_spdif_rx,
port ?p_for_mclk_count_aud, port ?p_for_mclk_count_aud,
chanend c_mclk_change); chanend c_mclk_change);
#if (XUA_USE_APP_PLL)
interface SoftPll_if interface SoftPll_if
{ {

View File

@@ -265,21 +265,16 @@
#endif #endif
/** /**
* @brief Enable/disable the use of the secondary/application PLL for generating master-clocks. * @brief Enable/disable the use of the secondary/application PLL for generating and recovering master-clocks.
* Only available on xcore.ai devices. * Only available on xcore.ai devices.
* *
* Default: Enabled (for xcore.ai devices) * Default: Enabled (for xcore.ai devices)
*/ */
#ifndef XUA_USE_APP_PLL #ifndef USE_SW_PLL
#if defined(__XS3A__) #if defined(__XS3A__)
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN) #define USE_SW_PLL (1)
/* Currently must use an external CS2100 device for syncing to external digital streams */
#define XUA_USE_APP_PLL (0)
#else
#define XUA_USE_APP_PLL (1)
#endif
#else #else
#define XUA_USE_APP_PLL (0) #define USE_SW_PLL (0)
#endif #endif
#endif #endif

View File

@@ -54,6 +54,7 @@ INCLUDE_DIRS = $(EXPORT_INCLUDE_DIRS) \
src/core/support \ src/core/support \
src/core/user \ src/core/user \
src/core/user/audiostream \ src/core/user/audiostream \
src/core/user/audiohw \
src/core/user/hid \ src/core/user/hid \
src/core/user/hostactive \ src/core/user/hostactive \
src/hid \ src/hid \
@@ -70,6 +71,7 @@ SOURCE_DIRS = src/core \
src/core/ports \ src/core/ports \
src/core/support \ src/core/support \
src/core/user/audiostream \ src/core/user/audiostream \
src/core/user/audiohw \
src/core/user/hostactive \ src/core/user/hostactive \
src/core/xuduser \ src/core/xuduser \
src/dfu \ src/dfu \

View File

@@ -814,9 +814,10 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk,
/* User should mute audio hardware */ /* User should mute audio hardware */
AudioHwConfig_Mute(); AudioHwConfig_Mute();
#if (XUA_USE_APP_PLL) #if (USE_SW_PLL)
i_softPll.init(mClk); // i_softPll.init(mClk);
#endif #warning SORT THIS
#endif
/* User code should configure audio harware for SampleFreq/MClk etc */ /* User code should configure audio harware for SampleFreq/MClk etc */
AudioHwConfig(curFreq, mClk, dsdMode, curSamRes_DAC, curSamRes_ADC); AudioHwConfig(curFreq, mClk, dsdMode, curSamRes_DAC, curSamRes_ADC);

View File

@@ -105,7 +105,7 @@ void XUA_Buffer(
#endif #endif
, chanend c_aud , chanend c_aud
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) #if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
#if(XUA_USE_APP_PLL) #if(USE_SW_PLL)
, chanend c_swpll_update , chanend c_swpll_update
#else #else
, client interface pll_ref_if i_pll_ref , client interface pll_ref_if i_pll_ref
@@ -145,7 +145,7 @@ void XUA_Buffer(
, c_buff_ctrl , c_buff_ctrl
#endif #endif
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) #if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
#if(XUA_USE_APP_PLL) #if(USE_SW_PLL)
, c_swpll_update , c_swpll_update
#else #else
, i_pll_ref , i_pll_ref
@@ -199,7 +199,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
, chanend c_buff_ctrl , chanend c_buff_ctrl
#endif #endif
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) #if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
#if (XUA_USE_APP_PLL) #if (USE_SW_PLL)
, chanend c_swpll_update , chanend c_swpll_update
#else #else
, client interface pll_ref_if i_pll_ref , client interface pll_ref_if i_pll_ref
@@ -370,7 +370,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
#define LOCAL_CLOCK_MARGIN (1000) #define LOCAL_CLOCK_MARGIN (1000)
#endif #endif
#if (!XUA_USE_APP_PLL) #if (!USE_SW_PLL)
timer t_sofCheck; timer t_sofCheck;
unsigned timeLastEdge; unsigned timeLastEdge;
unsigned timeNextEdge; unsigned timeNextEdge;
@@ -379,7 +379,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
i_pll_ref.toggle(); i_pll_ref.toggle();
#endif #endif
#endif #endif /* (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) */
while(1) while(1)
{ {
@@ -525,7 +525,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
} }
break; break;
} }
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) && (!XUA_USE_APP_PLL) #if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) && (!USE_SW_PLL)
case t_sofCheck when timerafter(timeNextEdge) :> void: case t_sofCheck when timerafter(timeNextEdge) :> void:
i_pll_ref.toggle(); i_pll_ref.toggle();
timeLastEdge = timeNextEdge; timeLastEdge = timeNextEdge;
@@ -557,14 +557,14 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
{ {
sofCount = 0; sofCount = 0;
pllUpdate++; pllUpdate++;
#if (!XUA_USE_APP_PLL) #if (!USE_SW_PLL)
/* Port is accessed via interface to allow flexibilty with location */ /* Port is accessed via interface to allow flexibilty with location */
i_pll_ref.toggle(); i_pll_ref.toggle();
t_sofCheck :> timeLastEdge; t_sofCheck :> timeLastEdge;
timeNextEdge = timeLastEdge + LOCAL_CLOCK_INCREMENT + LOCAL_CLOCK_MARGIN; timeNextEdge = timeLastEdge + LOCAL_CLOCK_INCREMENT + LOCAL_CLOCK_MARGIN;
#endif #endif
} }
#if (XUA_USE_APP_PLL) #if (USE_SW_PLL)
// Update PLL @ 100Hz // Update PLL @ 100Hz
if(pllUpdate == 10) if(pllUpdate == 10)
{ {

View File

@@ -316,9 +316,6 @@ void usb_audio_io(chanend ?c_aud_in,
, client interface pll_ref_if i_pll_ref , client interface pll_ref_if i_pll_ref
, port ?p_for_mclk_count_aud , port ?p_for_mclk_count_aud
#endif #endif
#if (XUA_USE_APP_PLL)
, client interface SoftPll_if i_softPll
#endif
) )
{ {
#if (MIXER) #if (MIXER)
@@ -376,9 +373,6 @@ void usb_audio_io(chanend ?c_aud_in,
#define AUDIO_CHANNEL c_aud_in #define AUDIO_CHANNEL c_aud_in
#endif #endif
XUA_AudioHub(AUDIO_CHANNEL, clk_audio_mclk, clk_audio_bclk, p_mclk_in, p_lrclk, p_bclk, p_i2s_dac, p_i2s_adc XUA_AudioHub(AUDIO_CHANNEL, clk_audio_mclk, clk_audio_bclk, p_mclk_in, p_lrclk, p_bclk, p_i2s_dac, p_i2s_adc
if (XUA_USE_APP_PLL)
, i_softPll
#endif
#if (XUA_SPDIF_TX_EN) //&& (SPDIF_TX_TILE != AUDIO_IO_TILE) #if (XUA_SPDIF_TX_EN) //&& (SPDIF_TX_TILE != AUDIO_IO_TILE)
, c_spdif_tx , c_spdif_tx
#endif #endif
@@ -489,13 +483,12 @@ int main()
#endif #endif
#endif #endif
#if (((XUA_SYNCMODE == XUA_SYNCMODE_SYNC) && !XUA_USE_APP_PLL) || XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN) #if ((XUA_SYNCMODE == XUA_SYNCMODE_SYNC || XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN) && !USE_SW_PLL)
interface pll_ref_if i_pll_ref; interface pll_ref_if i_pll_ref;
#endif #endif
#if (XUA_USE_APP_PLL) #if ((XUA_SYNCMODE == XUA_SYNCMODE_SYNC || XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN) && USE_SW_PLL)
interface SoftPll_if i_softPll; chan c_sw_pll;
chan c_swpll_update;
#endif #endif
chan c_sof; chan c_sof;
chan c_xud_out[ENDPOINT_COUNT_OUT]; /* Endpoint channels for XUD */ chan c_xud_out[ENDPOINT_COUNT_OUT]; /* Endpoint channels for XUD */
@@ -518,7 +511,7 @@ int main()
{ {
USER_MAIN_CORES USER_MAIN_CORES
#if (((XUA_SYNCMODE == XUA_SYNCMODE_SYNC) && XUA_USE_APP_PLL) || XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN) #if ((XUA_SYNCMODE == XUA_SYNCMODE_SYNC || XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN) && !USE_SW_PLL)
on tile[PLL_REF_TILE]: PllRefPinTask(i_pll_ref, p_pll_ref); on tile[PLL_REF_TILE]: PllRefPinTask(i_pll_ref, p_pll_ref);
#endif #endif
on tile[XUD_TILE]: on tile[XUD_TILE]:
@@ -531,7 +524,7 @@ int main()
DFUHandler(dfuInterface, null); DFUHandler(dfuInterface, null);
#endif #endif
#if (XUA_USE_APP_PLL) #if ((XUA_SYNCMODE == XUA_SYNCMODE_SYNC || XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN) && USE_SW_PLL)
//XUA_SoftPll(tile[0], i_softPll, c_swpll_update); //XUA_SoftPll(tile[0], i_softPll, c_swpll_update);
#endif #endif
@@ -593,13 +586,11 @@ int main()
#endif #endif
, c_mix_out , c_mix_out
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) #if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
#if (!XUA_USE_APP_PLL) #if (!USE_SW_PLL)
, i_pll_ref , i_pll_ref
#else #else
, c_swpll_update , c_sw_pll
#endif #endif
#endif
#endif #endif
); );
//: //:
@@ -614,8 +605,8 @@ int main()
#endif /* XUA_USB_EN */ #endif /* XUA_USB_EN */
} }
#if(XUA_USE_APP_PLL) #if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC && !USE_SW_PLL)
on tile[AUDIO_IO_TILE]: XUA_SoftPll(tile[0], i_softPll, c_swpll_update); // on tile[AUDIO_IO_TILE]: XUA_SoftPll(tile[0], i_softPll, c_swpll_update);
#endif #endif
on tile[AUDIO_IO_TILE]: on tile[AUDIO_IO_TILE]:
@@ -634,17 +625,15 @@ int main()
, dfuInterface , dfuInterface
#endif #endif
#if (XUA_NUM_PDM_MICS > 0) #if (XUA_NUM_PDM_MICS > 0)
#if (PDM_TILE == AUDIO_IO_TILE) #if (PDM_TILE == AUDIO_IO_TILE)
, c_ds_output , c_ds_output
#endif #endif
, c_pdm_pcm , c_pdm_pcm
#endif #endif
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN) #if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
, i_pll_ref , i_pll_ref
#endif #endif
if (XUA_USE_APP_PLL) #if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
, i_softPll
#endif
, p_for_mclk_count_audio , p_for_mclk_count_audio
#endif #endif
); );