diff --git a/lib_xua/src/core/audiohub/audiohub_initport.xc b/lib_xua/src/core/audiohub/audiohub_initport.xc index 724c1e83..45ce5e29 100644 --- a/lib_xua/src/core/audiohub/audiohub_initport.xc +++ b/lib_xua/src/core/audiohub/audiohub_initport.xc @@ -39,7 +39,7 @@ void InitPorts_master(unsigned divide, buffered _XUA_CLK_DIR port:32 p_lrclk, bu #pragma xta endpoint "divide_1" unsigned tmp; - p_lrclk <: 0 @ tmp; + tmp = partout_timestamped(p_lrclk, N_BITS_I2S, 0); tmp += 100; /* Since BCLK is free-running, setup outputs/inputs at a known point in the future */ @@ -47,16 +47,17 @@ void InitPorts_master(unsigned divide, buffered _XUA_CLK_DIR port:32 p_lrclk, bu #pragma loop unroll for(int i = 0; i < I2S_WIRES_DAC; i++) { - p_i2s_dac[i] @ tmp <: 0; + partout_timed(p_i2s_dac[i], N_BITS_I2S, 0, tmp); } #endif - p_lrclk @ tmp <: 0x7FFFFFFF; + partout_timed(p_lrclk, N_BITS_I2S, 0x7FFFFFFF, tmp); #if (I2S_CHANS_ADC != 0) for(int i = 0; i < I2S_WIRES_ADC; i++) { asm("setpt res[%0], %1"::"r"(p_i2s_adc[i]),"r"(tmp-1)); + set_port_shift_count(p_i2s_adc[i], N_BITS_I2S); } #endif #endif /* (I2S_CHANS_ADC != 0 || I2S_CHANS_DAC != 0) */ diff --git a/lib_xua/src/core/audiohub/xua_audiohub.xc b/lib_xua/src/core/audiohub/xua_audiohub.xc index 29a2a363..3964fba5 100755 --- a/lib_xua/src/core/audiohub/xua_audiohub.xc +++ b/lib_xua/src/core/audiohub/xua_audiohub.xc @@ -211,9 +211,10 @@ static inline int HandleSampleClock(int frameCount, buffered _XUA_CLK_DIR port:3 else { if(frameCount == 0) - p_lrclk <: 0x80000000; + partout(p_lrclk, N_BITS_I2S, 0x80000000); else - p_lrclk <: 0x7fffffff; + partout(p_lrclk, N_BITS_I2S, 0x7fffffff); + } return 0; @@ -769,9 +770,14 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk, #if I2S_MODE_TDM /* I2S has 32 bits per sample. *8 as 8 channels */ unsigned numBits = 256; + +#if N_BITS_I2S != 32 +#error TDM mode only supports 32 bclks per sample +#endif + #else /* I2S has 32 bits per sample. *2 as 2 channels */ - unsigned numBits = 64; + unsigned numBits = 2 * N_BITS_I2S; #endif #if (DSD_CHANS_DAC > 0)