@@ -156,7 +156,7 @@ static void i2s_tx_stream_disable(const struct device *dev, bool drop)
156
156
}
157
157
158
158
/* Disable the channel FIFO */
159
- dev_cfg -> base -> TCR3 &= ~ I2S_TCR3_TCE_MASK ;
159
+ SAI_TxSetChannelFIFOMask ( dev_cfg -> base , 0 ) ;
160
160
161
161
/* Disable Tx */
162
162
SAI_TxEnable (dev_cfg -> base , false);
@@ -182,7 +182,7 @@ static void i2s_rx_stream_disable(const struct device *dev, bool in_drop, bool o
182
182
dma_stop (dev_dma , strm -> dma_channel );
183
183
184
184
/* Disable the channel FIFO */
185
- dev_cfg -> base -> RCR3 &= ~ I2S_RCR3_RCE_MASK ;
185
+ SAI_RxSetChannelFIFOMask ( dev_cfg -> base , 0 ) ;
186
186
187
187
/* Disable DMA enable bit */
188
188
SAI_RxEnableDMA (dev_cfg -> base , kSAI_FIFORequestDMAEnable , false);
@@ -613,11 +613,18 @@ static int i2s_mcux_config(const struct device *dev, enum i2s_dir dir,
613
613
LOG_DBG ("tx slab buffer = 0x%x" , (uint32_t )i2s_cfg -> mem_slab -> buffer );
614
614
615
615
config .fifo .fifoWatermark = (uint32_t )FSL_FEATURE_SAI_FIFO_COUNTn (base ) - 1 ;
616
+ #if defined(FSL_FEATURE_SAI_HAS_FIFO_COMBINE_MODE ) && FSL_FEATURE_SAI_HAS_FIFO_COMBINE_MODE
617
+ /*
618
+ * TX FIFO combine on write. The value below has correct value and wrong name
619
+ * because RX and TX definitions are different but MCUX uses the same for both.
620
+ */
621
+ config .fifo .fifoCombine = kSAI_FifoCombineModeEnabledOnRead ;
622
+ #endif
616
623
/* set bit clock divider */
617
624
SAI_TxSetConfig (base , & config );
618
625
dev_data -> tx .start_channel = config .startChannel ;
619
626
/* Disable the channel FIFO */
620
- base -> TCR3 &= ~ I2S_TCR3_TCE_MASK ;
627
+ SAI_TxSetChannelFIFOMask ( base , 0 ) ;
621
628
SAI_TxSetBitClockRate (base , mclk , i2s_cfg -> frame_clk_freq , word_size_bits ,
622
629
i2s_cfg -> channels );
623
630
LOG_DBG ("tx start_channel = %d" , dev_data -> tx .start_channel );
@@ -631,6 +638,9 @@ static int i2s_mcux_config(const struct device *dev, enum i2s_dir dir,
631
638
} else {
632
639
/* For RX, DMA reads from FIFO whenever data present */
633
640
config .fifo .fifoWatermark = 0 ;
641
+ #if defined(FSL_FEATURE_SAI_HAS_FIFO_COMBINE_MODE ) && FSL_FEATURE_SAI_HAS_FIFO_COMBINE_MODE
642
+ config .fifo .fifoCombine = kSAI_FifoCombineModeEnabledOnRead ;
643
+ #endif
634
644
635
645
memcpy (& dev_data -> rx .cfg , i2s_cfg , sizeof (struct i2s_config ));
636
646
LOG_DBG ("rx slab free_list = 0x%x" , (uint32_t )i2s_cfg -> mem_slab -> free_list );
@@ -742,7 +752,7 @@ static int i2s_tx_stream_start(const struct device *dev)
742
752
SAI_TxEnableDMA (base , kSAI_FIFORequestDMAEnable , true);
743
753
744
754
/* Enable the channel FIFO */
745
- base -> TCR3 |= I2S_TCR3_TCE ( 1UL << strm -> start_channel );
755
+ SAI_TxSetChannelFIFOMask ( base , dev_cfg -> tx_channel );
746
756
747
757
/* Enable SAI Tx clock */
748
758
SAI_TxEnable (base , true);
@@ -840,7 +850,7 @@ static int i2s_rx_stream_start(const struct device *dev)
840
850
SAI_RxEnableDMA (base , kSAI_FIFORequestDMAEnable , true);
841
851
842
852
/* Enable the channel FIFO */
843
- base -> RCR3 |= I2S_RCR3_RCE ( 1UL << strm -> start_channel );
853
+ SAI_RxSetChannelFIFOMask ( base , dev_cfg -> tx_channel );
844
854
845
855
/* Enable SAI Rx clock */
846
856
SAI_RxEnable (base , true);
0 commit comments