mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-02 12:14:32 +02:00
Merge branch 'bugfix/i2s_driver_apll_test_regression' into 'master'
i2s: fix regression in retrieval of chip revision causing apll test to fail See merge request espressif/esp-idf!6786
This commit is contained in:
@@ -40,6 +40,7 @@ endif()
|
|||||||
idf_component_register(SRCS "${srcs}"
|
idf_component_register(SRCS "${srcs}"
|
||||||
INCLUDE_DIRS ${includes}
|
INCLUDE_DIRS ${includes}
|
||||||
PRIV_INCLUDE_DIRS "include/driver"
|
PRIV_INCLUDE_DIRS "include/driver"
|
||||||
|
PRIV_REQUIRES efuse
|
||||||
REQUIRES esp_ringbuf soc) #cannot totally hide soc headers, since there are a lot arguments in the driver are chip-dependent
|
REQUIRES esp_ringbuf soc) #cannot totally hide soc headers, since there are a lot arguments in the driver are chip-dependent
|
||||||
|
|
||||||
# uses C11 atomic feature
|
# uses C11 atomic feature
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "esp_pm.h"
|
#include "esp_pm.h"
|
||||||
|
#include "esp_efuse.h"
|
||||||
|
|
||||||
static const char* I2S_TAG = "I2S";
|
static const char* I2S_TAG = "I2S";
|
||||||
|
|
||||||
@@ -180,12 +181,14 @@ static esp_err_t i2s_isr_register(i2s_port_t i2s_num, int intr_alloc_flags, void
|
|||||||
static float i2s_apll_get_fi2s(int bits_per_sample, int sdm0, int sdm1, int sdm2, int odir)
|
static float i2s_apll_get_fi2s(int bits_per_sample, int sdm0, int sdm1, int sdm2, int odir)
|
||||||
{
|
{
|
||||||
int f_xtal = (int)rtc_clk_xtal_freq_get() * 1000000;
|
int f_xtal = (int)rtc_clk_xtal_freq_get() * 1000000;
|
||||||
uint32_t rev;
|
|
||||||
i2s_hal_get_rev(&(p_i2s_obj[0]->hal), &rev); // I2S hardware instance address will not be used
|
#if CONFIG_IDF_TARGET_ESP32
|
||||||
if (rev) {
|
/* ESP32 rev0 silicon issue for APLL range/accuracy, please see ESP32 ECO document for more information on this */
|
||||||
|
if (esp_efuse_get_chip_ver() == 0) {
|
||||||
sdm0 = 0;
|
sdm0 = 0;
|
||||||
sdm1 = 0;
|
sdm1 = 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
float fout = f_xtal * (sdm2 + sdm1 / 256.0f + sdm0 / 65536.0f + 4);
|
float fout = f_xtal * (sdm2 + sdm1 / 256.0f + sdm0 / 65536.0f + 4);
|
||||||
if (fout < APLL_MIN_FREQ || fout > APLL_MAX_FREQ) {
|
if (fout < APLL_MIN_FREQ || fout > APLL_MAX_FREQ) {
|
||||||
return APLL_MAX_FREQ;
|
return APLL_MAX_FREQ;
|
||||||
|
@@ -246,19 +246,6 @@ static inline void i2s_ll_enable_dma(i2s_dev_t *hw)
|
|||||||
hw->lc_conf.val = lc_conf.val;
|
hw->lc_conf.val = lc_conf.val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get I2S revision
|
|
||||||
*
|
|
||||||
* @param hw Peripheral I2S hardware instance address.
|
|
||||||
* @param val value to get revision
|
|
||||||
*/
|
|
||||||
static inline void i2s_ll_get_rev(i2s_dev_t *hw, uint32_t *val)
|
|
||||||
{
|
|
||||||
if (GET_PERI_REG_BITS2(EFUSE_BLK0_RDATA3_REG, 1, 15) == 0) {
|
|
||||||
*val = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get I2S interrupt status
|
* @brief Get I2S interrupt status
|
||||||
*
|
*
|
||||||
|
@@ -243,17 +243,6 @@ static inline void i2s_ll_enable_dma(i2s_dev_t *hw)
|
|||||||
hw->lc_conf.val = lc_conf.val;
|
hw->lc_conf.val = lc_conf.val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get I2S revision
|
|
||||||
*
|
|
||||||
* @param hw Peripheral I2S hardware instance address.
|
|
||||||
* @param val value to get revision
|
|
||||||
*/
|
|
||||||
static inline void i2s_ll_get_rev(i2s_dev_t *hw, uint32_t *val)
|
|
||||||
{
|
|
||||||
*val = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get I2S interrupt status
|
* @brief Get I2S interrupt status
|
||||||
*
|
*
|
||||||
|
@@ -47,14 +47,6 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
void i2s_hal_reset_fifo(i2s_hal_context_t *hal);
|
void i2s_hal_reset_fifo(i2s_hal_context_t *hal);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get I2S revision
|
|
||||||
*
|
|
||||||
* @param hal Context of the HAL layer
|
|
||||||
* @param rev I2S revision
|
|
||||||
*/
|
|
||||||
#define i2s_hal_get_rev(hal, rev) i2s_ll_get_rev((hal)->dev, rev)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get I2S interrupt status
|
* @brief Get I2S interrupt status
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user