i2s: add mclk_div underflow check

Closes https://github.com/espressif/esp-idf/issues/8344
pull/7148/merge
laokaiyao 2022-02-23 19:43:53 +08:00 zatwierdzone przez Kevin (Lao Kaiyao)
rodzic 2f0e7e9b6c
commit db3a1c707e
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -985,7 +985,7 @@ static esp_err_t i2s_calculate_adc_dac_clock(int i2s_num, i2s_hal_clock_cfg_t *c
/* Set I2S bit clock */ /* Set I2S bit clock */
clk_cfg->bclk = p_i2s[i2s_num]->hal_cfg.sample_rate * I2S_LL_AD_BCK_FACTOR; clk_cfg->bclk = p_i2s[i2s_num]->hal_cfg.sample_rate * I2S_LL_AD_BCK_FACTOR;
/* Set I2S bit clock default division */ /* Set I2S bit clock default division */
clk_cfg->bclk_div = I2S_LL_AD_BCK_FACTOR * 16; clk_cfg->bclk_div = p_i2s[i2s_num]->hal_cfg.chan_bits;
/* If fixed_mclk and use_apll are set, use fixed_mclk as mclk frequency, otherwise calculate by mclk = sample_rate * multiple */ /* If fixed_mclk and use_apll are set, use fixed_mclk as mclk frequency, otherwise calculate by mclk = sample_rate * multiple */
clk_cfg->mclk = (p_i2s[i2s_num]->use_apll && p_i2s[i2s_num]->fixed_mclk) ? clk_cfg->mclk = (p_i2s[i2s_num]->use_apll && p_i2s[i2s_num]->fixed_mclk) ?
p_i2s[i2s_num]->fixed_mclk : clk_cfg->bclk * clk_cfg->bclk_div; p_i2s[i2s_num]->fixed_mclk : clk_cfg->bclk * clk_cfg->bclk_div;