Use CT_END in sw_pll comms to clear switch path

This commit is contained in:
Ed
2024-01-23 11:43:36 +00:00
parent d49c6b4656
commit 44049ecfca
3 changed files with 13 additions and 2 deletions

View File

@@ -385,7 +385,9 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
0, /* Assume precise timing of sampling */ 0, /* Assume precise timing of sampling */
pfd_ppm_max); pfd_ppm_max);
outuint(c_sw_pll, masterClockFreq); outuint(c_sw_pll, masterClockFreq);
outct(c_sw_pll, XS1_CT_END);
inuint(c_sw_pll); /* receive ACK */ inuint(c_sw_pll); /* receive ACK */
inct(c_sw_pll);
#else /* XUA_USE_SW_PLL */ #else /* XUA_USE_SW_PLL */
timer t_sofCheck; timer t_sofCheck;
@@ -602,8 +604,9 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
sw_pll_pfd.mclk_pt_last = mclk_pt; sw_pll_pfd.mclk_pt_last = mclk_pt;
outuint(c_sw_pll, error); outuint(c_sw_pll, error);
outct(c_sw_pll, XS1_CT_END);
printintln(error); printintln(error);
// outct(c_sw_pll, XS1_CT_END);
} }
#endif #endif
@@ -1044,6 +1047,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
#if (XUA_USE_SW_PLL) #if (XUA_USE_SW_PLL)
/* This is fired when sw_pll has completed initialising a new mclk_rate */ /* This is fired when sw_pll has completed initialising a new mclk_rate */
case inuint_byref(c_sw_pll, u_tmp): case inuint_byref(c_sw_pll, u_tmp):
inct(c_sw_pll);
printstr("SWPLL synch\n"); printstr("SWPLL synch\n");
c_audio_rate_change <: 0; /* ACK back to audio to release */ c_audio_rate_change <: 0; /* ACK back to audio to release */

View File

@@ -520,7 +520,8 @@ void clockGen ( streaming chanend ?c_spdif_rx,
#endif #endif
#if ((XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN) && XUA_USE_SW_PLL) #if ((XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN) && XUA_USE_SW_PLL)
case inuint_byref(c_sw_pll, tmp): case inuint_byref(c_sw_pll, tmp):
inct(c_sw_pll);
/* Send ACK back to audiohub to allow I2S to start /* Send ACK back to audiohub to allow I2S to start
This happens only on SDM restart and only once */ This happens only on SDM restart and only once */
if(require_ack_to_audio) if(require_ack_to_audio)

View File

@@ -107,6 +107,7 @@ void do_sw_pll_phase_frequency_detector_dig_rx( unsigned short mclk_time_stamp,
/* send PFD output to the sigma delta thread */ /* send PFD output to the sigma delta thread */
outuint(c_sw_pll, (int) f_error); outuint(c_sw_pll, (int) f_error);
outct(c_sw_pll, XS1_CT_END);
last_mclk_time_stamp = mclk_time_stamp; last_mclk_time_stamp = mclk_time_stamp;
control_loop_counter = 0; control_loop_counter = 0;
@@ -122,6 +123,7 @@ void sw_pll_task(chanend c_sw_pll){
while(1) while(1)
{ {
unsigned selected_mclk_rate = inuint(c_sw_pll); unsigned selected_mclk_rate = inuint(c_sw_pll);
inct(c_sw_pll);
int f_error = 0; int f_error = 0;
int dco_setting = 0; /* gets set at init_sw_pll */ int dco_setting = 0; /* gets set at init_sw_pll */
@@ -139,6 +141,7 @@ void sw_pll_task(chanend c_sw_pll){
int running = 1; int running = 1;
outuint(c_sw_pll, 0); /* Signal back via clockgen to audio to start I2S */ outuint(c_sw_pll, 0); /* Signal back via clockgen to audio to start I2S */
outct(c_sw_pll, XS1_CT_END);
unsigned rx_word = 0; unsigned rx_word = 0;
while(running) while(running)
@@ -147,6 +150,7 @@ void sw_pll_task(chanend c_sw_pll){
select select
{ {
case inuint_byref(c_sw_pll, rx_word): case inuint_byref(c_sw_pll, rx_word):
inct(c_sw_pll);
if(rx_word == DISABLE_SDM) if(rx_word == DISABLE_SDM)
{ {
f_error = 0; f_error = 0;
@@ -189,7 +193,9 @@ void sw_pll_task(chanend c_sw_pll){
void restart_sigma_delta(chanend c_sw_pll, unsigned selected_mclk_rate) void restart_sigma_delta(chanend c_sw_pll, unsigned selected_mclk_rate)
{ {
outuint(c_sw_pll, DISABLE_SDM); /* Resets SDM */ outuint(c_sw_pll, DISABLE_SDM); /* Resets SDM */
outct(c_sw_pll, XS1_CT_END);
outuint(c_sw_pll, selected_mclk_rate); outuint(c_sw_pll, selected_mclk_rate);
outct(c_sw_pll, XS1_CT_END);
} }
#endif /* XUA_USE_SW_PLL */ #endif /* XUA_USE_SW_PLL */