@@ -107,15 +107,6 @@ static int _i2s_adc_channel = -1;
107
107
static i2s_dma_t * i2s_create_dma_queue (i2s_port_t i2s_num , int dma_buf_count , int dma_buf_len );
108
108
static esp_err_t i2s_destroy_dma_queue (i2s_port_t i2s_num , i2s_dma_t * dma );
109
109
110
- static esp_err_t i2s_reset_fifo (i2s_port_t i2s_num )
111
- {
112
- I2S_CHECK ((i2s_num < I2S_NUM_MAX ), "i2s_num error" , ESP_ERR_INVALID_ARG );
113
- I2S_ENTER_CRITICAL ();
114
- i2s_hal_reset_fifo (& (p_i2s_obj [i2s_num ]-> hal ));
115
- I2S_EXIT_CRITICAL ();
116
- return ESP_OK ;
117
- }
118
-
119
110
static inline void gpio_matrix_out_check (uint32_t gpio , uint32_t signal_idx , bool out_inv , bool oen_inv )
120
111
{
121
112
//if pin = -1, do not need to configure
@@ -469,6 +460,14 @@ esp_err_t i2s_set_clk(i2s_port_t i2s_num, uint32_t rate, i2s_bits_per_sample_t b
469
460
ESP_LOGI (I2S_TAG , "PLL_D2: Req RATE: %d, real rate: %0.3f, BITS: %u, CLKM: %u, BCK: %u, MCLK: %0.3f, SCLK: %f, diva: %d, divb: %d" ,
470
461
rate , real_rate , bits , clkmInteger , bck , (double )I2S_BASE_CLK / mclk , real_rate * bits * channel , 64 , clkmDecimals );
471
462
}
463
+ if (p_i2s_obj [i2s_num ]-> mode & I2S_MODE_TX ) {
464
+ p_i2s_obj [i2s_num ]-> tx -> curr_ptr = NULL ;
465
+ p_i2s_obj [i2s_num ]-> tx -> rw_pos = 0 ;
466
+ }
467
+ if (p_i2s_obj [i2s_num ]-> mode & I2S_MODE_RX ) {
468
+ p_i2s_obj [i2s_num ]-> rx -> curr_ptr = NULL ;
469
+ p_i2s_obj [i2s_num ]-> rx -> rw_pos = 0 ;
470
+ }
472
471
473
472
i2s_hal_set_tx_bits_mod (& (p_i2s_obj [i2s_num ]-> hal ), bits );
474
473
i2s_hal_set_rx_bits_mod (& (p_i2s_obj [i2s_num ]-> hal ), bits );
@@ -643,9 +642,7 @@ static i2s_dma_t *i2s_create_dma_queue(i2s_port_t i2s_num, int dma_buf_count, in
643
642
}
644
643
dma -> queue = xQueueCreate (dma_buf_count - 1 , sizeof (char * ));
645
644
dma -> mux = xSemaphoreCreateMutex ();
646
- dma -> rw_pos = 0 ;
647
645
dma -> buf_size = dma_buf_len * sample_size ;
648
- dma -> curr_ptr = NULL ;
649
646
ESP_LOGI (I2S_TAG , "DMA Malloc info, datalen=blocksize=%d, dma_buf_count=%d" , dma_buf_len * sample_size , dma_buf_count );
650
647
return dma ;
651
648
}
@@ -655,8 +652,6 @@ esp_err_t i2s_start(i2s_port_t i2s_num)
655
652
I2S_CHECK ((i2s_num < I2S_NUM_MAX ), "i2s_num error" , ESP_ERR_INVALID_ARG );
656
653
//start DMA link
657
654
I2S_ENTER_CRITICAL ();
658
- i2s_reset_fifo (i2s_num );
659
-
660
655
i2s_hal_reset (& (p_i2s_obj [i2s_num ]-> hal ));
661
656
662
657
esp_intr_disable (p_i2s_obj [i2s_num ]-> i2s_isr_handle );
@@ -865,7 +860,6 @@ static esp_err_t i2s_param_config(i2s_port_t i2s_num, const i2s_config_t *i2s_co
865
860
}
866
861
#endif
867
862
// configure I2S data port interface.
868
- i2s_reset_fifo (i2s_num );
869
863
i2s_hal_config_param (& (p_i2s_obj [i2s_num ]-> hal ), i2s_config );
870
864
if ((p_i2s_obj [i2s_num ]-> mode & I2S_MODE_RX ) && (p_i2s_obj [i2s_num ]-> mode & I2S_MODE_TX )) {
871
865
i2s_hal_enable_sig_loopback (& (p_i2s_obj [i2s_num ]-> hal ));
0 commit comments