diff --git a/components/efuse/esp32c2/esp_efuse_rtc_calib.c b/components/efuse/esp32c2/esp_efuse_rtc_calib.c index 467b2048e7..e5ddf5b4c8 100644 --- a/components/efuse/esp32c2/esp_efuse_rtc_calib.c +++ b/components/efuse/esp32c2/esp_efuse_rtc_calib.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -108,21 +108,3 @@ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, in return ESP_OK; } - -esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal) -{ - const esp_efuse_desc_t** cal_temp_efuse; - cal_temp_efuse = ESP_EFUSE_TEMP_CALIB; - int cal_temp_size = esp_efuse_get_field_size(cal_temp_efuse); - assert(cal_temp_size == 9); - - uint32_t cal_temp = 0; - esp_err_t err = esp_efuse_read_field_blob(cal_temp_efuse, &cal_temp, cal_temp_size); - if (err != ESP_OK) { - *tsens_cal = 0.0; - return err; - } - // BIT(8) stands for sign: 1: negative, 0: positive - *tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp; - return ESP_OK; -} diff --git a/components/efuse/esp32c2/include/esp_efuse_rtc_calib.h b/components/efuse/esp32c2/include/esp_efuse_rtc_calib.h index a012fc872d..611931312a 100644 --- a/components/efuse/esp32c2/include/esp_efuse_rtc_calib.h +++ b/components/efuse/esp32c2/include/esp_efuse_rtc_calib.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -47,16 +47,6 @@ uint32_t esp_efuse_rtc_calib_get_init_code(int version, uint32_t adc_unit, int a */ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, int atten, uint32_t *out_digi, uint32_t *out_vol_mv); -/** - * @brief Get the temperature sensor calibration number delta_T stored in the efuse. - * - * @param tsens_cal Pointer of the specification of temperature sensor calibration number in efuse. - * - * @return ESP_OK if get the calibration value successfully. - * ESP_ERR_INVALID_ARG if can't get the calibration value. - */ -esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal); - #ifdef __cplusplus } #endif diff --git a/components/efuse/esp32c3/esp_efuse_rtc_calib.c b/components/efuse/esp32c3/esp_efuse_rtc_calib.c index be61b54f89..c0bb8e2ffa 100644 --- a/components/efuse/esp32c3/esp_efuse_rtc_calib.c +++ b/components/efuse/esp32c3/esp_efuse_rtc_calib.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -82,24 +82,3 @@ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, in *out_vol_mv = calib_vol_expected_mv; return ESP_OK; } - -esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal) -{ - uint32_t version = esp_efuse_rtc_calib_get_ver(); - if (version != 1) { - *tsens_cal = 0.0; - return ESP_ERR_NOT_SUPPORTED; - } - const esp_efuse_desc_t** cal_temp_efuse; - cal_temp_efuse = ESP_EFUSE_TEMP_CALIB; - int cal_temp_size = esp_efuse_get_field_size(cal_temp_efuse); - assert(cal_temp_size == 9); - - uint32_t cal_temp = 0; - esp_err_t err = esp_efuse_read_field_blob(cal_temp_efuse, &cal_temp, cal_temp_size); - assert(err == ESP_OK); - (void)err; - // BIT(8) stands for sign: 1: negtive, 0: positive - *tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp; - return ESP_OK; -} diff --git a/components/efuse/esp32c3/include/esp_efuse_rtc_calib.h b/components/efuse/esp32c3/include/esp_efuse_rtc_calib.h index b5c9912d20..36209d44d7 100644 --- a/components/efuse/esp32c3/include/esp_efuse_rtc_calib.h +++ b/components/efuse/esp32c3/include/esp_efuse_rtc_calib.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -47,16 +47,6 @@ uint32_t esp_efuse_rtc_calib_get_init_code(int version, uint32_t adc_unit, int a */ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, int atten, uint32_t* out_digi, uint32_t* out_vol_mv); -/** - * @brief Get the temperature sensor calibration number delta_T stored in the efuse. - * - * @param tsens_cal Pointer of the specification of temperature sensor calibration number in efuse. - * - * @return ESP_OK if get the calibration value successfully. - * ESP_ERR_INVALID_ARG if can't get the calibration value. - */ -esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal); - #ifdef __cplusplus } #endif diff --git a/components/efuse/esp32c5/esp_efuse_rtc_calib.c b/components/efuse/esp32c5/esp_efuse_rtc_calib.c index 7616a7728f..d32944996b 100644 --- a/components/efuse/esp32c5/esp_efuse_rtc_calib.c +++ b/components/efuse/esp32c5/esp_efuse_rtc_calib.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -145,21 +145,3 @@ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, in return ESP_OK; } - -esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal) -{ - const esp_efuse_desc_t** cal_temp_efuse; - cal_temp_efuse = ESP_EFUSE_TEMPERATURE_SENSOR; - int cal_temp_size = esp_efuse_get_field_size(cal_temp_efuse); - assert(cal_temp_size == 9); - - uint32_t cal_temp = 0; - esp_err_t err = esp_efuse_read_field_blob(cal_temp_efuse, &cal_temp, cal_temp_size); - if (err != ESP_OK) { - *tsens_cal = 0.0; - return err; - } - // BIT(8) stands for sign: 1: negative, 0: positive - *tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp; - return ESP_OK; -} diff --git a/components/efuse/esp32c5/include/esp_efuse_rtc_calib.h b/components/efuse/esp32c5/include/esp_efuse_rtc_calib.h index 9d28078921..940917b925 100644 --- a/components/efuse/esp32c5/include/esp_efuse_rtc_calib.h +++ b/components/efuse/esp32c5/include/esp_efuse_rtc_calib.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -59,16 +59,6 @@ int esp_efuse_rtc_calib_get_chan_compens(int version, uint32_t adc_unit, uint32_ */ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, int atten, uint32_t* out_digi, uint32_t* out_vol_mv); -/** - * @brief Get the temperature sensor calibration number delta_T stored in the efuse. - * - * @param tsens_cal Pointer of the specification of temperature sensor calibration number in efuse. - * - * @return ESP_OK if get the calibration value successfully. - * ESP_ERR_INVALID_ARG if can't get the calibration value. - */ -esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal); - #ifdef __cplusplus } #endif diff --git a/components/efuse/esp32c6/esp_efuse_rtc_calib.c b/components/efuse/esp32c6/esp_efuse_rtc_calib.c index 3a3573d93a..5b1fba2914 100644 --- a/components/efuse/esp32c6/esp_efuse_rtc_calib.c +++ b/components/efuse/esp32c6/esp_efuse_rtc_calib.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -129,21 +129,3 @@ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, in *out_vol_mv = input_vout_mv[VER2IDX(version)][atten]; return ESP_OK; } - -esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal) -{ - const esp_efuse_desc_t** cal_temp_efuse; - cal_temp_efuse = ESP_EFUSE_TEMP_CALIB; - int cal_temp_size = esp_efuse_get_field_size(cal_temp_efuse); - assert(cal_temp_size == 9); - - uint32_t cal_temp = 0; - esp_err_t err = esp_efuse_read_field_blob(cal_temp_efuse, &cal_temp, cal_temp_size); - if (err != ESP_OK) { - *tsens_cal = 0.0; - return err; - } - // BIT(8) stands for sign: 1: negative, 0: positive - *tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp; - return ESP_OK; -} diff --git a/components/efuse/esp32c6/include/esp_efuse_rtc_calib.h b/components/efuse/esp32c6/include/esp_efuse_rtc_calib.h index 9e65f777b5..b4510065b9 100644 --- a/components/efuse/esp32c6/include/esp_efuse_rtc_calib.h +++ b/components/efuse/esp32c6/include/esp_efuse_rtc_calib.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -59,16 +59,6 @@ int esp_efuse_rtc_calib_get_chan_compens(int version, uint32_t adc_unit, uint32_ */ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, int atten, uint32_t* out_digi, uint32_t* out_vol_mv); -/** - * @brief Get the temperature sensor calibration number delta_T stored in the efuse. - * - * @param tsens_cal Pointer of the specification of temperature sensor calibration number in efuse. - * - * @return ESP_OK if get the calibration value successfully. - * ESP_ERR_INVALID_ARG if can't get the calibration value. - */ -esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal); - #ifdef __cplusplus } #endif diff --git a/components/efuse/esp32c61/esp_efuse_rtc_calib.c b/components/efuse/esp32c61/esp_efuse_rtc_calib.c index 2daa2dae09..2ecb41b2e6 100644 --- a/components/efuse/esp32c61/esp_efuse_rtc_calib.c +++ b/components/efuse/esp32c61/esp_efuse_rtc_calib.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -46,21 +46,3 @@ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, in abort(); return ESP_OK; } - -esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal) -{ - const esp_efuse_desc_t** cal_temp_efuse; - cal_temp_efuse = ESP_EFUSE_TEMPERATURE_SENSOR; - int cal_temp_size = esp_efuse_get_field_size(cal_temp_efuse); - assert(cal_temp_size == 9); - - uint32_t cal_temp = 0; - esp_err_t err = esp_efuse_read_field_blob(cal_temp_efuse, &cal_temp, cal_temp_size); - if (err != ESP_OK) { - *tsens_cal = 0.0; - return err; - } - // BIT(8) stands for sign: 1: negative, 0: positive - *tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp; - return ESP_OK; -} diff --git a/components/efuse/esp32c61/include/esp_efuse_rtc_calib.h b/components/efuse/esp32c61/include/esp_efuse_rtc_calib.h index dad36bb85c..94fb05b75a 100644 --- a/components/efuse/esp32c61/include/esp_efuse_rtc_calib.h +++ b/components/efuse/esp32c61/include/esp_efuse_rtc_calib.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -61,16 +61,6 @@ int esp_efuse_rtc_calib_get_chan_compens(int version, uint32_t adc_unit, uint32_ */ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, int atten, uint32_t* out_digi, uint32_t* out_vol_mv); -/** - * @brief Get the temperature sensor calibration number delta_T stored in the efuse. - * - * @param tsens_cal Pointer of the specification of temperature sensor calibration number in efuse. - * - * @return ESP_OK if get the calibration value successfully. - * ESP_ERR_INVALID_ARG if can't get the calibration value. - */ -esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal); - #ifdef __cplusplus } #endif diff --git a/components/efuse/esp32h2/esp_efuse_rtc_calib.c b/components/efuse/esp32h2/esp_efuse_rtc_calib.c index 9d782c8954..d3cbf8e5a6 100644 --- a/components/efuse/esp32h2/esp_efuse_rtc_calib.c +++ b/components/efuse/esp32h2/esp_efuse_rtc_calib.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -121,21 +121,3 @@ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, in *out_vol_mv = input_vout_mv[VER2IDX(version)][atten]; return ESP_OK; } - -esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal) -{ - const esp_efuse_desc_t** cal_temp_efuse; - cal_temp_efuse = ESP_EFUSE_TEMP_CALIB; - int cal_temp_size = esp_efuse_get_field_size(cal_temp_efuse); - assert(cal_temp_size == 9); - - uint32_t cal_temp = 0; - esp_err_t err = esp_efuse_read_field_blob(cal_temp_efuse, &cal_temp, cal_temp_size); - if (err != ESP_OK) { - *tsens_cal = 0.0; - return err; - } - // BIT(8) stands for sign: 1: negative, 0: positive - *tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp; - return ESP_OK; -} diff --git a/components/efuse/esp32h2/include/esp_efuse_rtc_calib.h b/components/efuse/esp32h2/include/esp_efuse_rtc_calib.h index 2101902a7b..505b6a69bd 100644 --- a/components/efuse/esp32h2/include/esp_efuse_rtc_calib.h +++ b/components/efuse/esp32h2/include/esp_efuse_rtc_calib.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -58,16 +58,6 @@ int esp_efuse_rtc_calib_get_chan_compens(int version, uint32_t adc_unit, uint32_ */ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, int atten, uint32_t* out_digi, uint32_t* out_vol_mv); -/** - * @brief Get the temperature sensor calibration number delta_T stored in the efuse. - * - * @param tsens_cal Pointer of the specification of temperature sensor calibration number in efuse. - * - * @return ESP_OK if get the calibration value successfully. - * ESP_ERR_INVALID_ARG if can't get the calibration value. - */ -esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal); - #ifdef __cplusplus } #endif diff --git a/components/efuse/esp32h21/esp_efuse_rtc_calib.c b/components/efuse/esp32h21/esp_efuse_rtc_calib.c index cbc135cbbb..280c5f6fc0 100644 --- a/components/efuse/esp32h21/esp_efuse_rtc_calib.c +++ b/components/efuse/esp32h21/esp_efuse_rtc_calib.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -46,9 +46,3 @@ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, in // TODO: [ESP32H21] IDF-11590 return ESP_OK; } - -esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal) -{ - // TODO: [ESP32H21] IDF-11624 - return ESP_OK; -} diff --git a/components/efuse/esp32h21/include/esp_efuse_rtc_calib.h b/components/efuse/esp32h21/include/esp_efuse_rtc_calib.h index de7995cdf2..31bf7eb35b 100644 --- a/components/efuse/esp32h21/include/esp_efuse_rtc_calib.h +++ b/components/efuse/esp32h21/include/esp_efuse_rtc_calib.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -60,16 +60,6 @@ int esp_efuse_rtc_calib_get_chan_compens(int version, uint32_t adc_unit, uint32_ */ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, int atten, uint32_t* out_digi, uint32_t* out_vol_mv); -/** - * @brief Get the temperature sensor calibration number delta_T stored in the efuse. - * - * @param tsens_cal Pointer of the specification of temperature sensor calibration number in efuse. - * - * @return ESP_OK if get the calibration value successfully. - * ESP_ERR_INVALID_ARG if can't get the calibration value. - */ -esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal); - #ifdef __cplusplus } #endif diff --git a/components/efuse/esp32p4/esp_efuse_rtc_calib.c b/components/efuse/esp32p4/esp_efuse_rtc_calib.c index 74a6687c37..99c25df2c5 100644 --- a/components/efuse/esp32p4/esp_efuse_rtc_calib.c +++ b/components/efuse/esp32p4/esp_efuse_rtc_calib.c @@ -193,21 +193,3 @@ int esp_efuse_rtc_calib_get_chan_compens(int version, uint32_t adc_unit, uint32_ return RTC_CALIB_GET_SIGNED_VAL(chan_diff, 3) * (4 - atten); } - -esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal) -{ - const esp_efuse_desc_t** cal_temp_efuse; - cal_temp_efuse = ESP_EFUSE_TEMPERATURE_SENSOR; - int cal_temp_size = esp_efuse_get_field_size(cal_temp_efuse); - assert(cal_temp_size == 9); - - uint32_t cal_temp = 0; - esp_err_t err = esp_efuse_read_field_blob(cal_temp_efuse, &cal_temp, cal_temp_size); - if (err != ESP_OK) { - *tsens_cal = 0.0; - return err; - } - // BIT(8) stands for sign: 1: negative, 0: positive - *tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp; - return ESP_OK; -} diff --git a/components/efuse/esp32p4/include/esp_efuse_rtc_calib.h b/components/efuse/esp32p4/include/esp_efuse_rtc_calib.h index b3b9e5092c..416c697e94 100644 --- a/components/efuse/esp32p4/include/esp_efuse_rtc_calib.h +++ b/components/efuse/esp32p4/include/esp_efuse_rtc_calib.h @@ -57,16 +57,6 @@ int esp_efuse_rtc_calib_get_chan_compens(int version, uint32_t adc_unit, uint32_ */ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, int atten, uint32_t* out_digi, uint32_t* out_vol_mv); -/** - * @brief Get the temperature sensor calibration number delta_T stored in the efuse. - * - * @param tsens_cal Pointer of the specification of temperature sensor calibration number in efuse. - * - * @return ESP_OK if get the calibration value successfully. - * ESP_ERR_INVALID_ARG if can't get the calibration value. - */ -esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal); - #ifdef __cplusplus } #endif diff --git a/components/efuse/esp32s2/esp_efuse_rtc_calib.c b/components/efuse/esp32s2/esp_efuse_rtc_calib.c deleted file mode 100644 index 40202ecfba..0000000000 --- a/components/efuse/esp32s2/esp_efuse_rtc_calib.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include "esp_bit_defs.h" -#include "esp_efuse.h" -#include "esp_efuse_rtc_table.h" - -esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal) -{ - uint32_t version = esp_efuse_rtc_table_read_calib_version(); - if ((version != 1) && (version != 2)) { - *tsens_cal = 0.0; - return ESP_ERR_NOT_SUPPORTED; - } - *tsens_cal = esp_efuse_rtc_table_get_parsed_efuse_value(RTCCALIB_IDX_TMPSENSOR, false); - - return ESP_OK; -} diff --git a/components/efuse/esp32s2/include/esp_efuse_rtc_calib.h b/components/efuse/esp32s2/include/esp_efuse_rtc_calib.h deleted file mode 100644 index c6393e5959..0000000000 --- a/components/efuse/esp32s2/include/esp_efuse_rtc_calib.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "esp_types.h" -#include "esp_err.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * @brief Get the temperature sensor calibration number delta_T stored in the efuse. - * - * @param tsens_cal Pointer of the specification of temperature sensor calibration number in efuse. - * - * @return ESP_OK if get the calibration value successfully. - * ESP_ERR_INVALID_ARG if can't get the calibration value. - */ -esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal); - -#ifdef __cplusplus -} -#endif diff --git a/components/efuse/esp32s2/sources.cmake b/components/efuse/esp32s2/sources.cmake index cd0ea6f9a6..a498623c4f 100644 --- a/components/efuse/esp32s2/sources.cmake +++ b/components/efuse/esp32s2/sources.cmake @@ -1,5 +1,4 @@ set(EFUSE_SOC_SRCS "esp_efuse_table.c" "esp_efuse_fields.c" "esp_efuse_rtc_table.c" - "esp_efuse_rtc_calib.c" "esp_efuse_utility.c") diff --git a/components/efuse/esp32s3/esp_efuse_rtc_calib.c b/components/efuse/esp32s3/esp_efuse_rtc_calib.c index 2ede5610ba..2e13e3611e 100644 --- a/components/efuse/esp32s3/esp_efuse_rtc_calib.c +++ b/components/efuse/esp32s3/esp_efuse_rtc_calib.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -97,24 +97,3 @@ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, in return ESP_OK; } - -esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal) -{ - uint32_t version = esp_efuse_rtc_calib_get_ver(); - if (version != 1) { - *tsens_cal = 0.0; - return ESP_ERR_NOT_SUPPORTED; - } - const esp_efuse_desc_t** cal_temp_efuse; - cal_temp_efuse = ESP_EFUSE_TEMP_CALIB; - int cal_temp_size = esp_efuse_get_field_size(cal_temp_efuse); - assert(cal_temp_size == 9); - - uint32_t cal_temp = 0; - esp_err_t err = esp_efuse_read_field_blob(cal_temp_efuse, &cal_temp, cal_temp_size); - assert(err == ESP_OK); - (void)err; - // BIT(8) stands for sign: 1: negtive, 0: positive - *tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp; - return ESP_OK; -} diff --git a/components/efuse/esp32s3/include/esp_efuse_rtc_calib.h b/components/efuse/esp32s3/include/esp_efuse_rtc_calib.h index 49712040a0..3c80eb4a86 100644 --- a/components/efuse/esp32s3/include/esp_efuse_rtc_calib.h +++ b/components/efuse/esp32s3/include/esp_efuse_rtc_calib.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -47,16 +47,6 @@ uint32_t esp_efuse_rtc_calib_get_init_code(int version, uint32_t adc_unit, int a */ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, int atten, uint32_t* out_digi, uint32_t* out_vol_mv); -/** - * @brief Get the temperature sensor calibration number delta_T stored in the efuse. - * - * @param tsens_cal Pointer of the specification of temperature sensor calibration number in efuse. - * - * @return ESP_OK if get the calibration value successfully. - * ESP_ERR_INVALID_ARG if can't get the calibration value. - */ -esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal); - #ifdef __cplusplus } #endif diff --git a/components/esp_driver_tsens/src/temperature_sensor.c b/components/esp_driver_tsens/src/temperature_sensor.c index ef002f1538..5353b21c59 100644 --- a/components/esp_driver_tsens/src/temperature_sensor.c +++ b/components/esp_driver_tsens/src/temperature_sensor.c @@ -274,7 +274,7 @@ esp_err_t temperature_sensor_disable(temperature_sensor_handle_t tsens) static esp_err_t read_delta_t_from_efuse(void) { - if (esp_efuse_rtc_calib_get_tsens_val(&s_deltaT) != ESP_OK) { + if (temperature_sensor_ll_calib_get_tsens_val(&s_deltaT) != true) { ESP_LOGW(TAG, "Calibration failed"); } ESP_LOGD(TAG, "s_deltaT = %f", s_deltaT); diff --git a/components/hal/esp32c2/include/hal/temperature_sensor_ll.h b/components/hal/esp32c2/include/hal/temperature_sensor_ll.h index 6153c012b3..a9e77ae80d 100644 --- a/components/hal/esp32c2/include/hal/temperature_sensor_ll.h +++ b/components/hal/esp32c2/include/hal/temperature_sensor_ll.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -25,6 +25,7 @@ #include "hal/temperature_sensor_types.h" #include "hal/assert.h" #include "hal/misc.h" +#include "soc/efuse_struct.h" #ifdef __cplusplus extern "C" { @@ -151,6 +152,23 @@ static inline void temperature_sensor_ll_set_clk_div(uint8_t clk_div) HAL_FORCE_MODIFY_U32_REG_FIELD(APB_SARADC.saradc_apb_tsens_ctrl, saradc_reg_tsens_clk_div, clk_div); } +/** + * @brief Retrieve and calculate the temperature sensor calibration value. + * + * @param[out] tsens_cal Pointer to a float where the calculated calibration value will be stored. + * The output is a signed floating-point value based on the efuse data. + * + * @return returns true to indicate successful retrieval. false for calibration failed. + */ +static inline bool temperature_sensor_ll_calib_get_tsens_val(float* tsens_cal) +{ + uint32_t cal_temp = 0; + cal_temp = EFUSE.rd_blk2_data2.temp_calib; + // BIT(8) stands for sign: 1: negative, 0: positive + *tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp; + return true; +} + #ifdef __cplusplus } #endif diff --git a/components/hal/esp32c3/include/hal/temperature_sensor_ll.h b/components/hal/esp32c3/include/hal/temperature_sensor_ll.h index 38902bac73..2d14d04b1d 100644 --- a/components/hal/esp32c3/include/hal/temperature_sensor_ll.h +++ b/components/hal/esp32c3/include/hal/temperature_sensor_ll.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -25,6 +25,7 @@ #include "hal/temperature_sensor_types.h" #include "hal/assert.h" #include "hal/misc.h" +#include "hal/efuse_ll.h" #ifdef __cplusplus extern "C" { @@ -151,6 +152,27 @@ static inline void temperature_sensor_ll_set_clk_div(uint8_t clk_div) HAL_FORCE_MODIFY_U32_REG_FIELD(APB_SARADC.apb_tsens_ctrl, tsens_clk_div, clk_div); } +/** + * @brief Retrieve and calculate the temperature sensor calibration value. + * + * @param[out] tsens_cal Pointer to a float where the calculated calibration value will be stored. + * The output is a signed floating-point value based on the efuse data. + * + * @return returns true to indicate successful retrieval. false for calibration failed. + */ +static inline bool temperature_sensor_ll_calib_get_tsens_val(float* tsens_cal) +{ + uint32_t version = efuse_ll_get_blk_version_major(); + if (version == 0) { + *tsens_cal = 0.0; + return ESP_ERR_NOT_SUPPORTED; + } + + uint32_t cal_temp = EFUSE.rd_sys_part1_data4.temp_calib; + *tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp; + return ESP_OK; +} + #ifdef __cplusplus } #endif diff --git a/components/hal/esp32c5/include/hal/temperature_sensor_ll.h b/components/hal/esp32c5/include/hal/temperature_sensor_ll.h index 4c73df1a1f..20fa2afcb8 100644 --- a/components/hal/esp32c5/include/hal/temperature_sensor_ll.h +++ b/components/hal/esp32c5/include/hal/temperature_sensor_ll.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -29,6 +29,7 @@ #include "hal/temperature_sensor_types.h" #include "hal/assert.h" #include "hal/misc.h" +#include "hal/efuse_ll.h" #ifdef __cplusplus extern "C" { @@ -266,6 +267,21 @@ static inline void temperature_sensor_ll_set_sample_rate(uint16_t rate) HAL_FORCE_MODIFY_U32_REG_FIELD(APB_SARADC.tsens_sample, saradc_tsens_sample_rate, rate); } +/** + * @brief Retrieve and calculate the temperature sensor calibration value. + * + * @param[out] tsens_cal Pointer to a float where the calculated calibration value will be stored. + * The output is a signed floating-point value based on the efuse data. + * + * @return returns true to indicate successful retrieval. false for calibration failed. + */ +static inline bool temperature_sensor_ll_calib_get_tsens_val(float* tsens_cal) +{ + uint32_t cal_temp = EFUSE.rd_sys_part1_data4.temperature_sensor; + *tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp; + return true; +} + #ifdef __cplusplus } #endif diff --git a/components/hal/esp32c6/include/hal/temperature_sensor_ll.h b/components/hal/esp32c6/include/hal/temperature_sensor_ll.h index 4c73df1a1f..3c9b61ca29 100644 --- a/components/hal/esp32c6/include/hal/temperature_sensor_ll.h +++ b/components/hal/esp32c6/include/hal/temperature_sensor_ll.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -29,6 +29,7 @@ #include "hal/temperature_sensor_types.h" #include "hal/assert.h" #include "hal/misc.h" +#include "hal/efuse_ll.h" #ifdef __cplusplus extern "C" { @@ -266,6 +267,21 @@ static inline void temperature_sensor_ll_set_sample_rate(uint16_t rate) HAL_FORCE_MODIFY_U32_REG_FIELD(APB_SARADC.tsens_sample, saradc_tsens_sample_rate, rate); } +/** + * @brief Retrieve and calculate the temperature sensor calibration value. + * + * @param[out] tsens_cal Pointer to a float where the calculated calibration value will be stored. + * The output is a signed floating-point value based on the efuse data. + * + * @return returns true to indicate successful retrieval. false for calibration failed. + */ +static inline bool temperature_sensor_ll_calib_get_tsens_val(float* tsens_cal) +{ + uint32_t cal_temp = EFUSE.rd_sys_part1_data4.temp_calib; + *tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp; + return true; +} + #ifdef __cplusplus } #endif diff --git a/components/hal/esp32c61/include/hal/temperature_sensor_ll.h b/components/hal/esp32c61/include/hal/temperature_sensor_ll.h index 1e6d3b013f..42a03f7bc6 100644 --- a/components/hal/esp32c61/include/hal/temperature_sensor_ll.h +++ b/components/hal/esp32c61/include/hal/temperature_sensor_ll.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -29,6 +29,7 @@ #include "hal/temperature_sensor_types.h" #include "hal/assert.h" #include "hal/misc.h" +#include "hal/efuse_ll.h" #ifdef __cplusplus extern "C" { @@ -266,6 +267,21 @@ static inline void temperature_sensor_ll_set_sample_rate(uint16_t rate) HAL_FORCE_MODIFY_U32_REG_FIELD(ADC.tsens_sample, saradc_tsens_sample_rate, rate); } +/** + * @brief Retrieve and calculate the temperature sensor calibration value. + * + * @param[out] tsens_cal Pointer to a float where the calculated calibration value will be stored. + * The output is a signed floating-point value based on the efuse data. + * + * @return returns true to indicate successful retrieval. false for calibration failed. + */ +static inline bool temperature_sensor_ll_calib_get_tsens_val(float* tsens_cal) +{ + uint32_t cal_temp = EFUSE0.rd_sys_part1_data4.temperature_sensor; + *tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp; + return true; +} + #ifdef __cplusplus } #endif diff --git a/components/hal/esp32h2/include/hal/temperature_sensor_ll.h b/components/hal/esp32h2/include/hal/temperature_sensor_ll.h index 71e9d87507..644d4c4342 100644 --- a/components/hal/esp32h2/include/hal/temperature_sensor_ll.h +++ b/components/hal/esp32h2/include/hal/temperature_sensor_ll.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -28,6 +28,7 @@ #include "hal/temperature_sensor_types.h" #include "hal/assert.h" #include "hal/misc.h" +#include "hal/efuse_ll.h" #ifdef __cplusplus extern "C" { @@ -265,6 +266,21 @@ static inline void temperature_sensor_ll_set_sample_rate(uint16_t rate) HAL_FORCE_MODIFY_U32_REG_FIELD(APB_SARADC.tsens_sample, saradc_tsens_sample_rate, rate); } +/** + * @brief Retrieve and calculate the temperature sensor calibration value. + * + * @param[out] tsens_cal Pointer to a float where the calculated calibration value will be stored. + * The output is a signed floating-point value based on the efuse data. + * + * @return returns true to indicate successful retrieval. false for calibration failed. + */ +static inline bool temperature_sensor_ll_calib_get_tsens_val(float* tsens_cal) +{ + uint32_t cal_temp = EFUSE.rd_sys_part1_data4.temp_calib; + *tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp; + return true; +} + #ifdef __cplusplus } #endif diff --git a/components/hal/esp32p4/include/hal/temperature_sensor_ll.h b/components/hal/esp32p4/include/hal/temperature_sensor_ll.h index 72c76d2273..1045dfd173 100644 --- a/components/hal/esp32p4/include/hal/temperature_sensor_ll.h +++ b/components/hal/esp32p4/include/hal/temperature_sensor_ll.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -28,6 +28,7 @@ #include "hal/temperature_sensor_types.h" #include "hal/assert.h" #include "hal/misc.h" +#include "hal/efuse_ll.h" #ifdef __cplusplus extern "C" { @@ -258,6 +259,21 @@ static inline void temperature_sensor_ll_set_sample_rate(uint16_t rate) HAL_FORCE_MODIFY_U32_REG_FIELD(LP_TSENS.sample_rate, sample_rate, rate); } +/** + * @brief Retrieve and calculate the temperature sensor calibration value. + * + * @param[out] tsens_cal Pointer to a float where the calculated calibration value will be stored. + * The output is a signed floating-point value based on the efuse data. + * + * @return returns true to indicate successful retrieval. false for calibration failed. + */ +static inline bool temperature_sensor_ll_calib_get_tsens_val(float* tsens_cal) +{ + uint32_t cal_temp = EFUSE.rd_sys_part2_data3.temperature_sensor; + *tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp; + return true; +} + #ifdef __cplusplus } #endif diff --git a/components/hal/esp32s2/include/hal/temperature_sensor_ll.h b/components/hal/esp32s2/include/hal/temperature_sensor_ll.h index 9e356e163f..cb01bdcb93 100644 --- a/components/hal/esp32s2/include/hal/temperature_sensor_ll.h +++ b/components/hal/esp32s2/include/hal/temperature_sensor_ll.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -22,6 +22,7 @@ #include "soc/sens_struct.h" #include "hal/temperature_sensor_types.h" #include "hal/misc.h" +#include "hal/efuse_ll.h" #ifdef __cplusplus extern "C" { @@ -140,6 +141,27 @@ static inline void temperature_sensor_ll_set_clk_div(uint8_t clk_div) HAL_FORCE_MODIFY_U32_REG_FIELD(SENS.sar_tctrl, tsens_clk_div, clk_div); } +/** + * @brief Retrieve and calculate the temperature sensor calibration value. + * + * @param[out] tsens_cal Pointer to a float where the calculated calibration value will be stored. + * The output is a signed floating-point value based on the efuse data. + * + * @return returns true to indicate successful retrieval. false for calibration failed. + */ +static inline bool temperature_sensor_ll_calib_get_tsens_val(float* tsens_cal) +{ + uint32_t version = efuse_ll_get_blk_version_major(); + if (version == 0) { + *tsens_cal = 0.0; + return false; + } + + uint32_t cal_temp = EFUSE.rd_sys_part1_data4.temp_calib; + *tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp; + return true; +} + #ifdef __cplusplus } #endif diff --git a/components/hal/esp32s3/include/hal/temperature_sensor_ll.h b/components/hal/esp32s3/include/hal/temperature_sensor_ll.h index 52fb122134..28951b6a5a 100644 --- a/components/hal/esp32s3/include/hal/temperature_sensor_ll.h +++ b/components/hal/esp32s3/include/hal/temperature_sensor_ll.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -22,6 +22,7 @@ #include "soc/sens_struct.h" #include "hal/temperature_sensor_types.h" #include "hal/misc.h" +#include "hal/efuse_ll.h" #ifdef __cplusplus extern "C" { @@ -140,6 +141,27 @@ static inline void temperature_sensor_ll_set_clk_div(uint8_t clk_div) HAL_FORCE_MODIFY_U32_REG_FIELD(SENS.sar_tctrl, tsens_clk_div, clk_div); } +/** + * @brief Retrieve and calculate the temperature sensor calibration value. + * + * @param[out] tsens_cal Pointer to a float where the calculated calibration value will be stored. + * The output is a signed floating-point value based on the efuse data. + * + * @return returns true to indicate successful retrieval. false for calibration failed. + */ +static inline bool temperature_sensor_ll_calib_get_tsens_val(float* tsens_cal) +{ + uint32_t version = efuse_ll_get_blk_version_major(); + if (version == 0) { + *tsens_cal = 0.0; + return false; + } + + uint32_t cal_temp = EFUSE.rd_sys_part1_data4.temp_calib; + *tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp; + return true; +} + #ifdef __cplusplus } #endif