From 56a2d0b8a235c6a9538f1ced29a750aaea300292 Mon Sep 17 00:00:00 2001 From: Cao Sen Miao Date: Tue, 3 Jan 2023 18:58:29 +0800 Subject: [PATCH] BOD: Bringup for ESP32C6 --- components/esp_system/port/CMakeLists.txt | 6 +- components/esp_system/port/brownout.c | 21 ++-- components/hal/CMakeLists.txt | 12 +- components/hal/brownout_hal.c | 19 +++ components/hal/esp32/brownout_hal.c | 34 ------ .../hal/esp32/include/hal/brownout_ll.h | 107 +++++++++++++++++ components/hal/esp32c2/brownout_hal.c | 38 ------ .../hal/esp32c2/include/hal/brownout_ll.h | 110 +++++++++++++++++ components/hal/esp32c3/brownout_hal.c | 37 ------ .../hal/esp32c3/include/hal/brownout_ll.h | 110 +++++++++++++++++ components/hal/esp32c6/brownout_hal.c | 26 ---- .../hal/esp32c6/include/hal/brownout_ll.h | 110 +++++++++++++++++ .../hal/esp32h2/include/hal/brownout_ll.h | 110 +++++++++++++++++ components/hal/esp32h4/brownout_hal.c | 39 ------ .../hal/esp32h4/include/hal/brownout_ll.h | 111 ++++++++++++++++++ components/hal/esp32s2/brownout_hal.c | 39 ------ .../hal/esp32s2/include/hal/brownout_ll.h | 111 ++++++++++++++++++ components/hal/esp32s3/brownout_hal.c | 39 ------ .../hal/esp32s3/include/hal/brownout_ll.h | 110 +++++++++++++++++ components/hal/include/hal/brownout_hal.h | 8 +- .../soc/esp32/include/soc/Kconfig.soc_caps.in | 4 + components/soc/esp32/include/soc/soc_caps.h | 1 + .../esp32c2/include/soc/Kconfig.soc_caps.in | 4 + components/soc/esp32c2/include/soc/soc_caps.h | 1 + .../esp32c3/include/soc/Kconfig.soc_caps.in | 4 + components/soc/esp32c3/include/soc/soc_caps.h | 1 + .../esp32c6/include/soc/Kconfig.soc_caps.in | 4 + components/soc/esp32c6/include/soc/soc_caps.h | 1 + .../esp32h2/include/soc/Kconfig.soc_caps.in | 4 + components/soc/esp32h2/include/soc/soc_caps.h | 1 + .../esp32h4/include/soc/Kconfig.soc_caps.in | 4 + components/soc/esp32h4/include/soc/soc_caps.h | 1 + .../esp32s2/include/soc/Kconfig.soc_caps.in | 4 + components/soc/esp32s2/include/soc/soc_caps.h | 1 + .../esp32s3/include/soc/Kconfig.soc_caps.in | 4 + components/soc/esp32s3/include/soc/soc_caps.h | 1 + 36 files changed, 961 insertions(+), 276 deletions(-) create mode 100644 components/hal/brownout_hal.c delete mode 100644 components/hal/esp32/brownout_hal.c create mode 100644 components/hal/esp32/include/hal/brownout_ll.h delete mode 100644 components/hal/esp32c2/brownout_hal.c create mode 100644 components/hal/esp32c2/include/hal/brownout_ll.h delete mode 100644 components/hal/esp32c3/brownout_hal.c create mode 100644 components/hal/esp32c3/include/hal/brownout_ll.h delete mode 100644 components/hal/esp32c6/brownout_hal.c create mode 100644 components/hal/esp32c6/include/hal/brownout_ll.h create mode 100644 components/hal/esp32h2/include/hal/brownout_ll.h delete mode 100644 components/hal/esp32h4/brownout_hal.c create mode 100644 components/hal/esp32h4/include/hal/brownout_ll.h delete mode 100644 components/hal/esp32s2/brownout_hal.c create mode 100644 components/hal/esp32s2/include/hal/brownout_ll.h delete mode 100644 components/hal/esp32s3/brownout_hal.c create mode 100644 components/hal/esp32s3/include/hal/brownout_ll.h diff --git a/components/esp_system/port/CMakeLists.txt b/components/esp_system/port/CMakeLists.txt index b82c9af37b..d14df8b8fb 100644 --- a/components/esp_system/port/CMakeLists.txt +++ b/components/esp_system/port/CMakeLists.txt @@ -6,7 +6,11 @@ endif() target_include_directories(${COMPONENT_LIB} PRIVATE ${INCLUDE_FILES} include/private) -set(srcs "cpu_start.c" "panic_handler.c" "brownout.c" "esp_system_chip.c") +set(srcs "cpu_start.c" "panic_handler.c" "esp_system_chip.c") + +if(CONFIG_SOC_BOD_SUPPORTED) + list(APPEND srcs "brownout.c") +endif() add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" ${srcs}) diff --git a/components/esp_system/port/brownout.c b/components/esp_system/port/brownout.c index c5cf8f2c33..cb1e823221 100644 --- a/components/esp_system/port/brownout.c +++ b/components/esp_system/port/brownout.c @@ -8,23 +8,18 @@ #include #include #include - #include "esp_private/system_internal.h" #include "esp_private/rtc_ctrl.h" #include "esp_private/spi_flash_os.h" - #include "esp_rom_sys.h" #include "esp_cpu.h" - #include "soc/soc.h" - #include "soc/rtc_periph.h" #include "esp_attr.h" #include "bootloader_flash.h" #include "esp_intr_alloc.h" - #include "hal/brownout_hal.h" - +#include "hal/brownout_ll.h" #include "sdkconfig.h" #if defined(CONFIG_ESP_BROWNOUT_DET_LVL) @@ -40,7 +35,7 @@ IRAM_ATTR static void rtc_brownout_isr_handler(void *arg) * handler returns. Since restart is called here, the flag needs to be * cleared manually. */ - brownout_hal_intr_clear(); + brownout_ll_intr_clear(); // Stop the other core. #if !CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE @@ -75,13 +70,15 @@ void esp_brownout_init(void) }; brownout_hal_config(&cfg); - brownout_hal_intr_clear(); -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2// ESP32-C6, ESP32-H2 TODO: IDF-5645 - rtc_isr_register(rtc_brownout_isr_handler, NULL, LP_ANALOG_PERI_LP_ANA_BOD_MODE0_LP_INT_ENA_M, RTC_INTR_FLAG_IRAM); + brownout_ll_intr_clear(); +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 + // TODO IDF-6606: LP_RTC_TIMER interrupt source is shared by lp_timer and brownout detector, but lp_timer interrupt + // is not used now. An interrupt allocator is needed when lp_timer intr gets supported. + esp_intr_alloc(ETS_LP_RTC_TIMER_INTR_SOURCE, ESP_INTR_FLAG_IRAM, &rtc_brownout_isr_handler, NULL, NULL); #else rtc_isr_register(rtc_brownout_isr_handler, NULL, RTC_CNTL_BROWN_OUT_INT_ENA_M, RTC_INTR_FLAG_IRAM); #endif - brownout_hal_intr_enable(true); + brownout_ll_intr_enable(true); #else // brownout without interrupt @@ -105,7 +102,7 @@ void esp_brownout_disable(void) brownout_hal_config(&cfg); #if CONFIG_ESP_SYSTEM_BROWNOUT_INTR - brownout_hal_intr_enable(false); + brownout_ll_intr_enable(false); rtc_isr_deregister(rtc_brownout_isr_handler, NULL); #endif // CONFIG_ESP_SYSTEM_BROWNOUT_INTR } diff --git a/components/hal/CMakeLists.txt b/components/hal/CMakeLists.txt index e9deffc1e3..1e5df6331b 100644 --- a/components/hal/CMakeLists.txt +++ b/components/hal/CMakeLists.txt @@ -115,6 +115,10 @@ if(NOT BOOTLOADER_BUILD) list(APPEND srcs "${target}/modem_clock_hal.c") endif() + if(CONFIG_SOC_BOD_SUPPORTED) + list(APPEND srcs "brownout_hal.c") + endif() + if(CONFIG_SOC_GPSPI_SUPPORTED) list(APPEND srcs "spi_hal.c" @@ -132,7 +136,6 @@ if(NOT BOOTLOADER_BUILD) list(APPEND srcs "sdio_slave_hal.c" "touch_sensor_hal.c" - "esp32/brownout_hal.c" "esp32/touch_sensor_hal.c" "esp32/gpio_hal_workaround.c") endif() @@ -144,7 +147,6 @@ if(NOT BOOTLOADER_BUILD) "usb_hal.c" "usb_phy_hal.c" "xt_wdt_hal.c" - "esp32s2/brownout_hal.c" "esp32s2/cp_dma_hal.c" "esp32s2/touch_sensor_hal.c" "usb_dwc_hal.c") @@ -158,7 +160,6 @@ if(NOT BOOTLOADER_BUILD) "usb_hal.c" "usb_phy_hal.c" "xt_wdt_hal.c" - "esp32s3/brownout_hal.c" "hmac_hal.c" "esp32s3/touch_sensor_hal.c" "esp32s3/rtc_cntl_hal.c" @@ -170,7 +171,6 @@ if(NOT BOOTLOADER_BUILD) "ds_hal.c" "spi_flash_hal_gpspi.c" "xt_wdt_hal.c" - "esp32c3/brownout_hal.c" "hmac_hal.c" "esp32c3/rtc_cntl_hal.c") endif() @@ -180,7 +180,6 @@ if(NOT BOOTLOADER_BUILD) "ds_hal.c" "spi_flash_hal_gpspi.c" "aes_hal.c" - "esp32h4/brownout_hal.c" "hmac_hal.c" "esp32h4/rtc_cntl_hal.c") endif() @@ -188,14 +187,12 @@ if(NOT BOOTLOADER_BUILD) if(${target} STREQUAL "esp32c2") list(APPEND srcs "spi_flash_hal_gpspi.c" - "esp32c2/brownout_hal.c" "esp32c2/rtc_cntl_hal.c") endif() if(${target} STREQUAL "esp32c6") list(APPEND srcs "spi_flash_hal_gpspi.c" - "esp32c6/brownout_hal.c" "esp32c6/rtc_cntl_hal.c" ) @@ -209,7 +206,6 @@ if(NOT BOOTLOADER_BUILD) list(REMOVE_ITEM srcs "adc_oneshot_hal.c" # TODO: IDF-6214 "adc_hal_common.c" # TODO: IDF-6215 - "esp32h2/brownout_hal.c" "esp32h2/rtc_cntl_hal.c" "timer_hal.c" "timer_hal_iram.c" diff --git a/components/hal/brownout_hal.c b/components/hal/brownout_hal.c new file mode 100644 index 0000000000..8d0c13c3c5 --- /dev/null +++ b/components/hal/brownout_hal.c @@ -0,0 +1,19 @@ + +/* + * SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "hal/brownout_ll.h" +#include "hal/brownout_hal.h" + +void brownout_hal_config(const brownout_hal_config_t *cfg) +{ + brownout_ll_set_intr_wait_cycles(2); + brownout_ll_enable_flash_power_down(cfg->flash_power_down); + brownout_ll_enable_rf_power_down(cfg->rf_power_down); + brownout_ll_reset_config(cfg->reset_enabled, 0x3ff, 1); + brownout_ll_set_threshold(cfg->threshold); + brownout_ll_bod_enable(cfg->enabled); +} diff --git a/components/hal/esp32/brownout_hal.c b/components/hal/esp32/brownout_hal.c deleted file mode 100644 index 0d53698068..0000000000 --- a/components/hal/esp32/brownout_hal.c +++ /dev/null @@ -1,34 +0,0 @@ - -/* - * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "hal/brownout_hal.h" -#include "soc/rtc_cntl_struct.h" -#include "esp_attr.h" - -void brownout_hal_config(const brownout_hal_config_t *cfg) -{ - typeof(RTCCNTL.brown_out) brown_out_reg = { - .close_flash_ena = cfg->flash_power_down, - .pd_rf_ena = cfg->rf_power_down, - .rst_wait = 0x3ff, - .rst_ena = cfg->reset_enabled, - .thres = cfg->threshold, - .ena = cfg->enabled, - }; - - RTCCNTL.brown_out = brown_out_reg; -} - -void brownout_hal_intr_enable(bool enable) -{ - RTCCNTL.int_ena.rtc_brown_out = enable; -} - -IRAM_ATTR void brownout_hal_intr_clear(void) -{ - RTCCNTL.int_clr.rtc_brown_out = 1; -} diff --git a/components/hal/esp32/include/hal/brownout_ll.h b/components/hal/esp32/include/hal/brownout_ll.h new file mode 100644 index 0000000000..cae801d8b5 --- /dev/null +++ b/components/hal/esp32/include/hal/brownout_ll.h @@ -0,0 +1,107 @@ +/* + * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/******************************************************************************* + * NOTICE + * The ll is not public api, don't use in application code. + * See readme.md in hal/readme.md + ******************************************************************************/ + +#pragma once +#include +#include "soc/rtc_cntl_struct.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief power down the flash when a brown out happens. + * + * @param enable true: power down flash. false: not power down + */ +static inline void brownout_ll_enable_flash_power_down(bool enable) +{ + RTCCNTL.brown_out.close_flash_ena = enable; +} + +/** + * @brief power down the RF circuits when a brown out happens + * + * @param enable true: power down. false: not power done. + */ +static inline void brownout_ll_enable_rf_power_down(bool enable) +{ + RTCCNTL.brown_out.pd_rf_ena = enable; +} + +/** + * @brief Enable this to reset brown out + * + * @note: If brown out interrupt is used, this should be disabled. + * + * @param reset_ena true: enable reset. false: disable reset. + * @param reset_wait brown out reset wait cycles + * @param select 1: chip reset, 0: system reset + */ +static inline void brownout_ll_reset_config(bool reset_ena, uint32_t reset_wait, uint8_t select) +{ + RTCCNTL.brown_out.rst_wait = reset_wait; + RTCCNTL.brown_out.rst_ena = reset_ena; +} + +/** + * @brief Set brown out threshold + * + * @param threshold brownout threshold + */ +static inline void brownout_ll_set_threshold(uint8_t threshold) +{ + RTCCNTL.brown_out.thres = threshold; +} + +/** + * @brief Set this bit to enable the brown out detection + * + * @param bod_enable true: enable, false: disable + */ +static inline void brownout_ll_bod_enable(bool bod_enable) +{ + RTCCNTL.brown_out.ena = bod_enable; +} + +/** + * @brief configure the waiting cycles before sending an interrupt + * + * @param cycle waiting cycles. + */ +static inline void brownout_ll_set_intr_wait_cycles(uint8_t cycle) +{ + // Not supported on ESP32 +} + +/** + * @brief Enable brown out interrupt + * + * @param enable true: enable, false: disable + */ +static inline void brownout_ll_intr_enable(bool enable) +{ + RTCCNTL.int_ena.rtc_brown_out = enable; +} + +/** + * @brief Clear interrupt bits. + */ +__attribute__((always_inline)) +static inline void brownout_ll_intr_clear(void) +{ + RTCCNTL.int_clr.rtc_brown_out = 1; +} + +#ifdef __cplusplus +} +#endif diff --git a/components/hal/esp32c2/brownout_hal.c b/components/hal/esp32c2/brownout_hal.c deleted file mode 100644 index 64b42f73c2..0000000000 --- a/components/hal/esp32c2/brownout_hal.c +++ /dev/null @@ -1,38 +0,0 @@ - -/* - * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "hal/brownout_hal.h" -#include "soc/rtc_cntl_struct.h" -#include "soc/rtc_cntl_reg.h" -#include "esp_attr.h" -#include "hal/regi2c_ctrl.h" -#include "soc/regi2c_brownout.h" - - -void brownout_hal_config(const brownout_hal_config_t *cfg) -{ - REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD, cfg->threshold); - typeof(RTCCNTL.brown_out) brown_out_reg = { - .close_flash_ena = cfg->flash_power_down, - .pd_rf_ena = cfg->rf_power_down, - .rst_wait = 0x3ff, - .rst_ena = cfg->reset_enabled, - .ena = cfg->enabled, - .rst_sel = 1, - }; - RTCCNTL.brown_out = brown_out_reg; -} - -void brownout_hal_intr_enable(bool enable) -{ - RTCCNTL.int_ena.rtc_brown_out = enable; -} - -IRAM_ATTR void brownout_hal_intr_clear(void) -{ - RTCCNTL.int_clr.rtc_brown_out = 1; -} diff --git a/components/hal/esp32c2/include/hal/brownout_ll.h b/components/hal/esp32c2/include/hal/brownout_ll.h new file mode 100644 index 0000000000..8a384f8798 --- /dev/null +++ b/components/hal/esp32c2/include/hal/brownout_ll.h @@ -0,0 +1,110 @@ +/* + * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/******************************************************************************* + * NOTICE + * The ll is not public api, don't use in application code. + * See readme.md in hal/readme.md + ******************************************************************************/ + +#pragma once +#include +#include "soc/rtc_cntl_struct.h" +#include "hal/regi2c_ctrl.h" +#include "soc/regi2c_brownout.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief power down the flash when a brown out happens. + * + * @param enable true: power down flash. false: not power down + */ +static inline void brownout_ll_enable_flash_power_down(bool enable) +{ + RTCCNTL.brown_out.close_flash_ena = enable; +} + +/** + * @brief power down the RF circuits when a brown out happens + * + * @param enable true: power down. false: not power done. + */ +static inline void brownout_ll_enable_rf_power_down(bool enable) +{ + RTCCNTL.brown_out.pd_rf_ena = enable; +} + +/** + * @brief Enable this to reset brown out + * + * @note: If brown out interrupt is used, this should be disabled. + * + * @param reset_ena true: enable reset. false: disable reset. + * @param reset_wait brown out reset wait cycles + * @param select 1: chip reset, 0: system reset + */ +static inline void brownout_ll_reset_config(bool reset_ena, uint32_t reset_wait, uint8_t select) +{ + RTCCNTL.brown_out.rst_wait = reset_wait; + RTCCNTL.brown_out.rst_ena = reset_ena; + RTCCNTL.brown_out.rst_sel = select; +} + +/** + * @brief Set brown out threshold + * + * @param threshold brownout threshold + */ +static inline void brownout_ll_set_threshold(uint8_t threshold) +{ + REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD, threshold); +} + +/** + * @brief Set this bit to enable the brown out detection + * + * @param bod_enable true: enable, false: disable + */ +static inline void brownout_ll_bod_enable(bool bod_enable) +{ + RTCCNTL.brown_out.ena = bod_enable; +} + +/** + * @brief configure the waiting cycles before sending an interrupt + * + * @param cycle waiting cycles. + */ +static inline void brownout_ll_set_intr_wait_cycles(uint8_t cycle) +{ + // Not supported on ESP32C2 +} + +/** + * @brief Enable brown out interrupt + * + * @param enable true: enable, false: disable + */ +static inline void brownout_ll_intr_enable(bool enable) +{ + RTCCNTL.int_ena.rtc_brown_out = enable; +} + +/** + * @brief Clear interrupt bits. + */ +__attribute__((always_inline)) +static inline void brownout_ll_intr_clear(void) +{ + RTCCNTL.int_clr.rtc_brown_out = 1; +} + +#ifdef __cplusplus +} +#endif diff --git a/components/hal/esp32c3/brownout_hal.c b/components/hal/esp32c3/brownout_hal.c deleted file mode 100644 index 7fa9a3b68f..0000000000 --- a/components/hal/esp32c3/brownout_hal.c +++ /dev/null @@ -1,37 +0,0 @@ - -/* - * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "hal/brownout_hal.h" -#include "soc/rtc_cntl_struct.h" -#include "soc/rtc_cntl_reg.h" -#include "esp_attr.h" -#include "hal/regi2c_ctrl.h" -#include "soc/regi2c_brownout.h" - -void brownout_hal_config(const brownout_hal_config_t *cfg) -{ - REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD, cfg->threshold); - typeof(RTCCNTL.brown_out) brown_out_reg = { - .close_flash_ena = cfg->flash_power_down, - .pd_rf_ena = cfg->rf_power_down, - .rst_wait = 0x3ff, - .rst_ena = cfg->reset_enabled, - .ena = cfg->enabled, - .rst_sel = 1, - }; - RTCCNTL.brown_out = brown_out_reg; -} - -void brownout_hal_intr_enable(bool enable) -{ - RTCCNTL.int_ena.rtc_brown_out = enable; -} - -IRAM_ATTR void brownout_hal_intr_clear(void) -{ - RTCCNTL.int_clr.rtc_brown_out = 1; -} diff --git a/components/hal/esp32c3/include/hal/brownout_ll.h b/components/hal/esp32c3/include/hal/brownout_ll.h new file mode 100644 index 0000000000..203544e3eb --- /dev/null +++ b/components/hal/esp32c3/include/hal/brownout_ll.h @@ -0,0 +1,110 @@ +/* + * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/******************************************************************************* + * NOTICE + * The ll is not public api, don't use in application code. + * See readme.md in hal/readme.md + ******************************************************************************/ + +#pragma once +#include +#include "soc/rtc_cntl_struct.h" +#include "hal/regi2c_ctrl.h" +#include "soc/regi2c_brownout.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief power down the flash when a brown out happens. + * + * @param enable true: power down flash. false: not power down + */ +static inline void brownout_ll_enable_flash_power_down(bool enable) +{ + RTCCNTL.brown_out.close_flash_ena = enable; +} + +/** + * @brief power down the RF circuits when a brown out happens + * + * @param enable true: power down. false: not power done. + */ +static inline void brownout_ll_enable_rf_power_down(bool enable) +{ + RTCCNTL.brown_out.pd_rf_ena = enable; +} + +/** + * @brief Enable this to reset brown out + * + * @note: If brown out interrupt is used, this should be disabled. + * + * @param reset_ena true: enable reset. false: disable reset. + * @param reset_wait brown out reset wait cycles + * @param select 1: chip reset, 0: system reset + */ +static inline void brownout_ll_reset_config(bool reset_ena, uint32_t reset_wait, uint8_t select) +{ + RTCCNTL.brown_out.rst_wait = reset_wait; + RTCCNTL.brown_out.rst_ena = reset_ena; + RTCCNTL.brown_out.rst_sel = select; +} + +/** + * @brief Set brown out threshold + * + * @param threshold brownout threshold + */ +static inline void brownout_ll_set_threshold(uint8_t threshold) +{ + REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD, threshold); +} + +/** + * @brief Set this bit to enable the brown out detection + * + * @param bod_enable true: enable, false: disable + */ +static inline void brownout_ll_bod_enable(bool bod_enable) +{ + RTCCNTL.brown_out.ena = bod_enable; +} + +/** + * @brief configure the waiting cycles before sending an interrupt + * + * @param cycle waiting cycles. + */ +static inline void brownout_ll_set_intr_wait_cycles(uint8_t cycle) +{ + // Not supported on ESP32C3 +} + +/** + * @brief Enable brown out interrupt + * + * @param enable true: enable, false: disable + */ +static inline void brownout_ll_intr_enable(bool enable) +{ + RTCCNTL.int_ena.rtc_brown_out = enable; +} + +/** + * @brief Clear interrupt bits. + */ +__attribute__((always_inline)) +static inline void brownout_ll_intr_clear(void) +{ + RTCCNTL.int_clr.rtc_brown_out = 1; +} + +#ifdef __cplusplus +} +#endif diff --git a/components/hal/esp32c6/brownout_hal.c b/components/hal/esp32c6/brownout_hal.c deleted file mode 100644 index 31d98e5264..0000000000 --- a/components/hal/esp32c6/brownout_hal.c +++ /dev/null @@ -1,26 +0,0 @@ - -/* - * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "hal/brownout_hal.h" -#include "esp_attr.h" -#include "hal/regi2c_ctrl.h" -#include "soc/regi2c_brownout.h" - -void brownout_hal_config(const brownout_hal_config_t *cfg) -{ - // TODO: IDF-5711 -} - -void brownout_hal_intr_enable(bool enable) -{ - // TODO: IDF-5711 -} - -IRAM_ATTR void brownout_hal_intr_clear(void) -{ - // TODO: IDF-5711 -} diff --git a/components/hal/esp32c6/include/hal/brownout_ll.h b/components/hal/esp32c6/include/hal/brownout_ll.h new file mode 100644 index 0000000000..197d2e2771 --- /dev/null +++ b/components/hal/esp32c6/include/hal/brownout_ll.h @@ -0,0 +1,110 @@ +/* + * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/******************************************************************************* + * NOTICE + * The ll is not public api, don't use in application code. + * See readme.md in hal/readme.md + ******************************************************************************/ + +#pragma once +#include +#include "soc/lp_analog_peri_struct.h" +#include "hal/regi2c_ctrl.h" +#include "soc/regi2c_brownout.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief power down the flash when a brown out happens. + * + * @param enable true: power down flash. false: not power down + */ +static inline void brownout_ll_enable_flash_power_down(bool enable) +{ + LP_ANA_PERI.bod_mode0_cntl.bod_mode0_close_flash_ena = enable; +} + +/** + * @brief power down the RF circuits when a brown out happens + * + * @param enable true: power down. false: not power done. + */ +static inline void brownout_ll_enable_rf_power_down(bool enable) +{ + LP_ANA_PERI.bod_mode0_cntl.bod_mode0_pd_rf_ena = enable; +} + +/** + * @brief Enable this to reset brown out + * + * @note: If brown out interrupt is used, this should be disabled. + * + * @param reset_ena true: enable reset. false: disable reset. + * @param reset_wait brown out reset wait cycles + * @param select 1: chip reset, 0: system reset + */ +static inline void brownout_ll_reset_config(bool reset_ena, uint32_t reset_wait, uint8_t select) +{ + LP_ANA_PERI.bod_mode0_cntl.bod_mode0_reset_wait = reset_wait; + LP_ANA_PERI.bod_mode0_cntl.bod_mode0_reset_ena = reset_ena; + LP_ANA_PERI.bod_mode0_cntl.bod_mode0_reset_sel = select; +} + +/** + * @brief Set brown out threshold + * + * @param threshold brownout threshold + */ +static inline void brownout_ll_set_threshold(uint8_t threshold) +{ + REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD, threshold); +} + +/** + * @brief Set this bit to enable the brown out detection + * + * @param bod_enable true: enable, false: disable + */ +static inline void brownout_ll_bod_enable(bool bod_enable) +{ + LP_ANA_PERI.bod_mode0_cntl.bod_mode0_intr_ena = bod_enable; +} + +/** + * @brief configure the waiting cycles before sending an interrupt + * + * @param cycle waiting cycles. + */ +static inline void brownout_ll_set_intr_wait_cycles(uint8_t cycle) +{ + LP_ANA_PERI.bod_mode0_cntl.bod_mode0_intr_wait = cycle; +} + +/** + * @brief Enable brown out interrupt + * + * @param enable true: enable, false: disable + */ +static inline void brownout_ll_intr_enable(bool enable) +{ + LP_ANA_PERI.int_ena.bod_mode0 = enable; +} + +/** + * @brief Clear interrupt bits. + */ +__attribute__((always_inline)) +static inline void brownout_ll_intr_clear(void) +{ + LP_ANA_PERI.int_clr.bod_mode0 = 1; +} + +#ifdef __cplusplus +} +#endif diff --git a/components/hal/esp32h2/include/hal/brownout_ll.h b/components/hal/esp32h2/include/hal/brownout_ll.h new file mode 100644 index 0000000000..9d0ca3b00b --- /dev/null +++ b/components/hal/esp32h2/include/hal/brownout_ll.h @@ -0,0 +1,110 @@ +/* + * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/******************************************************************************* + * NOTICE + * The ll is not public api, don't use in application code. + * See readme.md in hal/readme.md + ******************************************************************************/ + +#pragma once +#include +#include "soc/lp_analog_peri_struct.h" +#include "hal/regi2c_ctrl.h" +#include "soc/regi2c_brownout.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief power down the flash when a brown out happens. + * + * @param enable true: power down flash. false: not power down + */ +static inline void brownout_ll_enable_flash_power_down(bool enable) +{ + LP_ANA_PERI.bod_mode0_cntl.bod_mode0_close_flash_ena = enable; +} + +/** + * @brief power down the RF circuits when a brown out happens + * + * @param enable true: power down. false: not power done. + */ +static inline void brownout_ll_enable_rf_power_down(bool enable) +{ + LP_ANA_PERI.bod_mode0_cntl.bod_mode0_pd_rf_ena = enable; +} + +/** + * @brief Enable this to reset brown out + * + * @note: If brown out interrupt is used, this should be disabled. + * + * @param reset_ena true: enable reset. false: disable reset. + * @param reset_wait brown out reset wait cycles + * @param select 1: chip reset, 0: system reset + */ +static inline void brownout_ll_reset_config(bool reset_ena, uint32_t reset_wait, uint8_t select) +{ + LP_ANA_PERI.bod_mode0_cntl.bod_mode0_reset_wait = reset_wait; + LP_ANA_PERI.bod_mode0_cntl.bod_mode0_reset_ena = reset_ena; + LP_ANA_PERI.bod_mode0_cntl.bod_mode0_reset_sel = select; +} + +/** + * @brief Set brown out threshold + * + * @param threshold brownout threshold + */ +static inline void brownout_ll_set_threshold(uint8_t threshold) +{ + REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD, threshold); +} + +/** + * @brief Set this bit to enable the brown out detection + * + * @param bod_enable true: enable, false: disable + */ +static inline void brownout_ll_bod_enable(bool bod_enable) +{ + LP_ANA_PERI.bod_mode0_cntl.bod_mode0_intr_ena = bod_enable; +} + +/** + * @brief configure the waiting cycles before sending an interrupt + * + * @param cycle waiting cycles. + */ +static inline void brownout_ll_set_intr_wait_cycles(uint8_t cycle) +{ + LP_ANA_PERI.bod_mode0_cntl.bod_mode0_intr_wait = cycle; +} + +/** + * @brief Enable brown out interrupt + * + * @param enable true: enable, false: disable + */ +static inline void brownout_ll_intr_enable(bool enable) +{ + LP_ANA_PERI.int_ena.bod_mode0_int_ena = enable; +} + +/** + * @brief Clear interrupt bits. + */ +__attribute__((always_inline)) +static inline void brownout_ll_intr_clear(void) +{ + LP_ANA_PERI.int_clr.bod_mode0_int_clr = 1; +} + +#ifdef __cplusplus +} +#endif diff --git a/components/hal/esp32h4/brownout_hal.c b/components/hal/esp32h4/brownout_hal.c deleted file mode 100644 index a08e4da50e..0000000000 --- a/components/hal/esp32h4/brownout_hal.c +++ /dev/null @@ -1,39 +0,0 @@ - -/* - * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "hal/brownout_hal.h" -#include "soc/rtc_cntl_struct.h" -#include "soc/rtc_cntl_reg.h" -#include "i2c_pmu.h" -#include "esp_attr.h" -#include "hal/regi2c_ctrl.h" -#include "soc/regi2c_brownout.h" - - -void brownout_hal_config(const brownout_hal_config_t *cfg) -{ - REGI2C_WRITE_MASK(I2C_PMU, I2C_PMU_OC_DREF_LVDET, cfg->threshold); - typeof(RTCCNTL.brown_out) brown_out_reg = { - .close_flash_ena = cfg->flash_power_down, - .pd_rf_ena = cfg->rf_power_down, - .rst_wait = 0x3ff, - .rst_ena = cfg->reset_enabled, - .ena = cfg->enabled, - .rst_sel = 1, - }; - RTCCNTL.brown_out = brown_out_reg; -} - -void brownout_hal_intr_enable(bool enable) -{ - RTCCNTL.int_ena.rtc_brown_out = enable; -} - -IRAM_ATTR void brownout_hal_intr_clear(void) -{ - RTCCNTL.int_clr.rtc_brown_out = 1; -} diff --git a/components/hal/esp32h4/include/hal/brownout_ll.h b/components/hal/esp32h4/include/hal/brownout_ll.h new file mode 100644 index 0000000000..0629229e6a --- /dev/null +++ b/components/hal/esp32h4/include/hal/brownout_ll.h @@ -0,0 +1,111 @@ +/* + * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/******************************************************************************* + * NOTICE + * The ll is not public api, don't use in application code. + * See readme.md in hal/readme.md + ******************************************************************************/ + +#pragma once +#include +#include "soc/rtc_cntl_struct.h" +#include "hal/regi2c_ctrl.h" +#include "soc/regi2c_brownout.h" +#include "i2c_pmu.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief power down the flash when a brown out happens. + * + * @param enable true: power down flash. false: not power down + */ +static inline void brownout_ll_enable_flash_power_down(bool enable) +{ + RTCCNTL.brown_out.close_flash_ena = enable; +} + +/** + * @brief power down the RF circuits when a brown out happens + * + * @param enable true: power down. false: not power done. + */ +static inline void brownout_ll_enable_rf_power_down(bool enable) +{ + RTCCNTL.brown_out.pd_rf_ena = enable; +} + +/** + * @brief Enable this to reset brown out + * + * @note: If brown out interrupt is used, this should be disabled. + * + * @param reset_ena true: enable reset. false: disable reset. + * @param reset_wait brown out reset wait cycles + * @param select 1: chip reset, 0: system reset + */ +static inline void brownout_ll_reset_config(bool reset_ena, uint32_t reset_wait, uint8_t select) +{ + RTCCNTL.brown_out.rst_wait = reset_wait; + RTCCNTL.brown_out.rst_ena = reset_ena; + RTCCNTL.brown_out.rst_sel = select; +} + +/** + * @brief Set brown out threshold + * + * @param threshold brownout threshold + */ +static inline void brownout_ll_set_threshold(uint8_t threshold) +{ + REGI2C_WRITE_MASK(I2C_PMU, I2C_PMU_OC_DREF_LVDET, threshold); +} + +/** + * @brief Set this bit to enable the brown out detection + * + * @param bod_enable true: enable, false: disable + */ +static inline void brownout_ll_bod_enable(bool bod_enable) +{ + RTCCNTL.brown_out.ena = bod_enable; +} + +/** + * @brief configure the waiting cycles before sending an interrupt + * + * @param cycle waiting cycles. + */ +static inline void brownout_ll_set_intr_wait_cycles(uint8_t cycle) +{ + // Not supported on ESP32H4 +} + +/** + * @brief Enable brown out interrupt + * + * @param enable true: enable, false: disable + */ +static inline void brownout_ll_intr_enable(bool enable) +{ + RTCCNTL.int_ena.rtc_brown_out = enable; +} + +/** + * @brief Clear interrupt bits. + */ +__attribute__((always_inline)) +static inline void brownout_ll_intr_clear(void) +{ + RTCCNTL.int_clr.rtc_brown_out = 1; +} + +#ifdef __cplusplus +} +#endif diff --git a/components/hal/esp32s2/brownout_hal.c b/components/hal/esp32s2/brownout_hal.c deleted file mode 100644 index ddad13f2ca..0000000000 --- a/components/hal/esp32s2/brownout_hal.c +++ /dev/null @@ -1,39 +0,0 @@ - -/* - * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "hal/brownout_hal.h" -#include "soc/rtc_cntl_struct.h" -#include "soc/rtc_cntl_reg.h" -#include "esp_attr.h" -#include "hal/regi2c_ctrl.h" -#include "soc/regi2c_brownout.h" - -void brownout_hal_config(const brownout_hal_config_t *cfg) -{ - REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD, cfg->threshold); - typeof(RTCCNTL.brown_out) brown_out_reg = { - .out2_ena = 1, - .int_wait = 0x002, - .close_flash_ena = cfg->flash_power_down, - .pd_rf_ena = cfg->rf_power_down, - .rst_wait = 0x3ff, - .rst_ena = cfg->reset_enabled, - .ena = cfg->enabled, - .rst_sel = 1, - }; - RTCCNTL.brown_out = brown_out_reg; -} - -void brownout_hal_intr_enable(bool enable) -{ - RTCCNTL.int_ena.rtc_brown_out = enable; -} - -IRAM_ATTR void brownout_hal_intr_clear(void) -{ - RTCCNTL.int_clr.rtc_brown_out = 1; -} diff --git a/components/hal/esp32s2/include/hal/brownout_ll.h b/components/hal/esp32s2/include/hal/brownout_ll.h new file mode 100644 index 0000000000..0a683e9cb3 --- /dev/null +++ b/components/hal/esp32s2/include/hal/brownout_ll.h @@ -0,0 +1,111 @@ +/* + * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/******************************************************************************* + * NOTICE + * The ll is not public api, don't use in application code. + * See readme.md in hal/readme.md + ******************************************************************************/ + +#pragma once +#include +#include "soc/rtc_cntl_struct.h" +#include "hal/regi2c_ctrl.h" +#include "soc/regi2c_brownout.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief power down the flash when a brown out happens. + * + * @param enable true: power down flash. false: not power down + */ +static inline void brownout_ll_enable_flash_power_down(bool enable) +{ + RTCCNTL.brown_out.close_flash_ena = enable; +} + +/** + * @brief power down the RF circuits when a brown out happens + * + * @param enable true: power down. false: not power done. + */ +static inline void brownout_ll_enable_rf_power_down(bool enable) +{ + RTCCNTL.brown_out.pd_rf_ena = enable; +} + +/** + * @brief Enable this to reset brown out + * + * @note: If brown out interrupt is used, this should be disabled. + * + * @param reset_ena true: enable reset. false: disable reset. + * @param reset_wait brown out reset wait cycles + * @param select 1: chip reset, 0: system reset + */ +static inline void brownout_ll_reset_config(bool reset_ena, uint32_t reset_wait, uint8_t select) +{ + RTCCNTL.brown_out.rst_wait = reset_wait; + RTCCNTL.brown_out.rst_ena = reset_ena; + RTCCNTL.brown_out.out2_ena = true; + RTCCNTL.brown_out.rst_sel = select; +} + +/** + * @brief Set brown out threshold + * + * @param threshold brownout threshold + */ +static inline void brownout_ll_set_threshold(uint8_t threshold) +{ + REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD, threshold); +} + +/** + * @brief Set this bit to enable the brown out detection + * + * @param bod_enable true: enable, false: disable + */ +static inline void brownout_ll_bod_enable(bool bod_enable) +{ + RTCCNTL.brown_out.ena = bod_enable; +} + +/** + * @brief configure the waiting cycles before sending an interrupt + * + * @param cycle waiting cycles. + */ +static inline void brownout_ll_set_intr_wait_cycles(uint8_t cycle) +{ + RTCCNTL.brown_out.int_wait = cycle; +} + +/** + * @brief Enable brown out interrupt + * + * @param enable true: enable, false: disable + */ +static inline void brownout_ll_intr_enable(bool enable) +{ + RTCCNTL.int_ena.rtc_brown_out = enable; +} + +/** + * @brief Clear interrupt bits. + */ +__attribute__((always_inline)) +static inline void brownout_ll_intr_clear(void) +{ + RTCCNTL.int_clr.rtc_brown_out = 1; +} + +#ifdef __cplusplus +} +#endif diff --git a/components/hal/esp32s3/brownout_hal.c b/components/hal/esp32s3/brownout_hal.c deleted file mode 100644 index 0836141b3d..0000000000 --- a/components/hal/esp32s3/brownout_hal.c +++ /dev/null @@ -1,39 +0,0 @@ - -/* - * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "hal/brownout_hal.h" -#include "soc/rtc_cntl_struct.h" -#include "soc/rtc_cntl_reg.h" -#include "esp_attr.h" -#include "hal/regi2c_ctrl.h" -#include "soc/regi2c_brownout.h" - - -void brownout_hal_config(const brownout_hal_config_t *cfg) -{ - REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD, cfg->threshold); - typeof(RTCCNTL.brown_out) brown_out_reg = { - .int_wait = 0x002, - .close_flash_ena = cfg->flash_power_down, - .pd_rf_ena = cfg->rf_power_down, - .rst_wait = 0x3ff, - .rst_ena = cfg->reset_enabled, - .ena = cfg->enabled, - .rst_sel = 1, - }; - RTCCNTL.brown_out = brown_out_reg; -} - -void brownout_hal_intr_enable(bool enable) -{ - RTCCNTL.int_ena.rtc_brown_out = enable; -} - -IRAM_ATTR void brownout_hal_intr_clear(void) -{ - RTCCNTL.int_clr.rtc_brown_out = 1; -} diff --git a/components/hal/esp32s3/include/hal/brownout_ll.h b/components/hal/esp32s3/include/hal/brownout_ll.h new file mode 100644 index 0000000000..9e6f5458c9 --- /dev/null +++ b/components/hal/esp32s3/include/hal/brownout_ll.h @@ -0,0 +1,110 @@ +/* + * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/******************************************************************************* + * NOTICE + * The ll is not public api, don't use in application code. + * See readme.md in hal/readme.md + ******************************************************************************/ + +#pragma once +#include +#include "soc/rtc_cntl_struct.h" +#include "hal/regi2c_ctrl.h" +#include "soc/regi2c_brownout.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief power down the flash when a brown out happens. + * + * @param enable true: power down flash. false: not power down + */ +static inline void brownout_ll_enable_flash_power_down(bool enable) +{ + RTCCNTL.brown_out.close_flash_ena = enable; +} + +/** + * @brief power down the RF circuits when a brown out happens + * + * @param enable true: power down. false: not power done. + */ +static inline void brownout_ll_enable_rf_power_down(bool enable) +{ + RTCCNTL.brown_out.pd_rf_ena = enable; +} + +/** + * @brief Enable this to reset brown out + * + * @note: If brown out interrupt is used, this should be disabled. + * + * @param reset_ena true: enable reset. false: disable reset. + * @param reset_wait brown out reset wait cycles + * @param select 1: chip reset, 0: system reset + */ +static inline void brownout_ll_reset_config(bool reset_ena, uint32_t reset_wait, uint8_t select) +{ + RTCCNTL.brown_out.rst_wait = reset_wait; + RTCCNTL.brown_out.rst_ena = reset_ena; + RTCCNTL.brown_out.rst_sel = select; +} + +/** + * @brief Set brown out threshold + * + * @param threshold brownout threshold + */ +static inline void brownout_ll_set_threshold(uint8_t threshold) +{ + REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD, threshold); +} + +/** + * @brief Set this bit to enable the brown out detection + * + * @param bod_enable true: enable, false: disable + */ +static inline void brownout_ll_bod_enable(bool bod_enable) +{ + RTCCNTL.brown_out.ena = bod_enable; +} + +/** + * @brief configure the waiting cycles before sending an interrupt + * + * @param cycle waiting cycles. + */ +static inline void brownout_ll_set_intr_wait_cycles(uint8_t cycle) +{ + RTCCNTL.brown_out.int_wait = cycle; +} + +/** + * @brief Enable brown out interrupt + * + * @param enable true: enable, false: disable + */ +static inline void brownout_ll_intr_enable(bool enable) +{ + RTCCNTL.int_ena.rtc_brown_out = enable; +} + +/** + * @brief Clear interrupt bits. + */ +__attribute__((always_inline)) +static inline void brownout_ll_intr_clear(void) +{ + RTCCNTL.int_clr.rtc_brown_out = 1; +} + +#ifdef __cplusplus +} +#endif diff --git a/components/hal/include/hal/brownout_hal.h b/components/hal/include/hal/brownout_hal.h index 07952bbc65..84ea785a79 100644 --- a/components/hal/include/hal/brownout_hal.h +++ b/components/hal/include/hal/brownout_hal.h @@ -29,11 +29,13 @@ typedef struct { bool rf_power_down; } brownout_hal_config_t; +/** + * @brief Config brown out hal. + * + * @param cfg Pointer of brown out configuration structure. + */ void brownout_hal_config(const brownout_hal_config_t *cfg); -void brownout_hal_intr_enable(bool enable); - -void brownout_hal_intr_clear(void); #ifdef __cplusplus } diff --git a/components/soc/esp32/include/soc/Kconfig.soc_caps.in b/components/soc/esp32/include/soc/Kconfig.soc_caps.in index 5b1462b6ef..3e1d304732 100644 --- a/components/soc/esp32/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32/include/soc/Kconfig.soc_caps.in @@ -131,6 +131,10 @@ config SOC_TOUCH_SENSOR_SUPPORTED bool default y +config SOC_BOD_SUPPORTED + bool + default y + config SOC_DPORT_WORKAROUND_DIS_INTERRUPT_LVL int default 5 diff --git a/components/soc/esp32/include/soc/soc_caps.h b/components/soc/esp32/include/soc/soc_caps.h index d6bcf3dad7..db372d666c 100644 --- a/components/soc/esp32/include/soc/soc_caps.h +++ b/components/soc/esp32/include/soc/soc_caps.h @@ -92,6 +92,7 @@ #define SOC_FLASH_ENC_SUPPORTED 1 #define SOC_SECURE_BOOT_SUPPORTED 1 #define SOC_TOUCH_SENSOR_SUPPORTED 1 +#define SOC_BOD_SUPPORTED 1 #if SOC_CAPS_ECO_VER < 200 #define SOC_DPORT_WORKAROUND 1 diff --git a/components/soc/esp32c2/include/soc/Kconfig.soc_caps.in b/components/soc/esp32c2/include/soc/Kconfig.soc_caps.in index 52ebd59001..be804c3b45 100644 --- a/components/soc/esp32c2/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32c2/include/soc/Kconfig.soc_caps.in @@ -75,6 +75,10 @@ config SOC_SYSTIMER_SUPPORTED bool default y +config SOC_BOD_SUPPORTED + bool + default y + config SOC_XTAL_SUPPORT_26M bool default y diff --git a/components/soc/esp32c2/include/soc/soc_caps.h b/components/soc/esp32c2/include/soc/soc_caps.h index 75a2abde71..acdf21f05a 100644 --- a/components/soc/esp32c2/include/soc/soc_caps.h +++ b/components/soc/esp32c2/include/soc/soc_caps.h @@ -43,6 +43,7 @@ #define SOC_FLASH_ENC_SUPPORTED 1 #define SOC_SECURE_BOOT_SUPPORTED 1 #define SOC_SYSTIMER_SUPPORTED 1 +#define SOC_BOD_SUPPORTED 1 /*-------------------------- XTAL CAPS ---------------------------------------*/ #define SOC_XTAL_SUPPORT_26M 1 diff --git a/components/soc/esp32c3/include/soc/Kconfig.soc_caps.in b/components/soc/esp32c3/include/soc/Kconfig.soc_caps.in index b05589991e..cc01eb971e 100644 --- a/components/soc/esp32c3/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32c3/include/soc/Kconfig.soc_caps.in @@ -127,6 +127,10 @@ config SOC_MEMPROT_SUPPORTED bool default y +config SOC_BOD_SUPPORTED + bool + default y + config SOC_XTAL_SUPPORT_40M bool default y diff --git a/components/soc/esp32c3/include/soc/soc_caps.h b/components/soc/esp32c3/include/soc/soc_caps.h index 6da277bd46..d5453850c6 100644 --- a/components/soc/esp32c3/include/soc/soc_caps.h +++ b/components/soc/esp32c3/include/soc/soc_caps.h @@ -59,6 +59,7 @@ * earlier revisions */ #define SOC_SECURE_BOOT_SUPPORTED 1 #define SOC_MEMPROT_SUPPORTED 1 +#define SOC_BOD_SUPPORTED 1 /*-------------------------- XTAL CAPS ---------------------------------------*/ #define SOC_XTAL_SUPPORT_40M 1 diff --git a/components/soc/esp32c6/include/soc/Kconfig.soc_caps.in b/components/soc/esp32c6/include/soc/Kconfig.soc_caps.in index 3df991320f..d1cbdd392d 100644 --- a/components/soc/esp32c6/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32c6/include/soc/Kconfig.soc_caps.in @@ -123,6 +123,10 @@ config SOC_SECURE_BOOT_SUPPORTED bool default y +config SOC_BOD_SUPPORTED + bool + default y + config SOC_XTAL_SUPPORT_40M bool default y diff --git a/components/soc/esp32c6/include/soc/soc_caps.h b/components/soc/esp32c6/include/soc/soc_caps.h index 845a3083a0..f3f54e108a 100644 --- a/components/soc/esp32c6/include/soc/soc_caps.h +++ b/components/soc/esp32c6/include/soc/soc_caps.h @@ -59,6 +59,7 @@ #define SOC_ECC_SUPPORTED 1 #define SOC_FLASH_ENC_SUPPORTED 1 #define SOC_SECURE_BOOT_SUPPORTED 1 +#define SOC_BOD_SUPPORTED 1 /*-------------------------- XTAL CAPS ---------------------------------------*/ #define SOC_XTAL_SUPPORT_40M 1 diff --git a/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in b/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in index 5383d3f348..4f1a922874 100644 --- a/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in @@ -27,6 +27,10 @@ config SOC_SYSTIMER_SUPPORTED bool default y +config SOC_BOD_SUPPORTED + bool + default y + config SOC_XTAL_SUPPORT_32M bool default y diff --git a/components/soc/esp32h2/include/soc/soc_caps.h b/components/soc/esp32h2/include/soc/soc_caps.h index ca420c73f9..482a2a43ce 100644 --- a/components/soc/esp32h2/include/soc/soc_caps.h +++ b/components/soc/esp32h2/include/soc/soc_caps.h @@ -56,6 +56,7 @@ // #define SOC_DIG_SIGN_SUPPORTED 1 // TODO: IDF-6285 // #define SOC_FLASH_ENC_SUPPORTED 1 // TODO: IDF-6282 // #define SOC_SECURE_BOOT_SUPPORTED 1 // TODO: IDF-6281 +#define SOC_BOD_SUPPORTED 1 /*-------------------------- XTAL CAPS ---------------------------------------*/ #define SOC_XTAL_SUPPORT_32M 1 diff --git a/components/soc/esp32h4/include/soc/Kconfig.soc_caps.in b/components/soc/esp32h4/include/soc/Kconfig.soc_caps.in index dfbcea933b..34d6728f22 100644 --- a/components/soc/esp32h4/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32h4/include/soc/Kconfig.soc_caps.in @@ -115,6 +115,10 @@ config SOC_SECURE_BOOT_SUPPORTED bool default y +config SOC_BOD_SUPPORTED + bool + default y + config SOC_XTAL_SUPPORT_32M bool default y diff --git a/components/soc/esp32h4/include/soc/soc_caps.h b/components/soc/esp32h4/include/soc/soc_caps.h index 2b64b7ca8f..2cc33e629e 100644 --- a/components/soc/esp32h4/include/soc/soc_caps.h +++ b/components/soc/esp32h4/include/soc/soc_caps.h @@ -61,6 +61,7 @@ #define SOC_ECC_SUPPORTED 1 #define SOC_FLASH_ENC_SUPPORTED 1 #define SOC_SECURE_BOOT_SUPPORTED 1 +#define SOC_BOD_SUPPORTED 1 /*-------------------------- XTAL CAPS ---------------------------------------*/ #define SOC_XTAL_SUPPORT_32M 1 diff --git a/components/soc/esp32s2/include/soc/Kconfig.soc_caps.in b/components/soc/esp32s2/include/soc/Kconfig.soc_caps.in index 300f791b69..586799f870 100644 --- a/components/soc/esp32s2/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32s2/include/soc/Kconfig.soc_caps.in @@ -155,6 +155,10 @@ config SOC_TOUCH_SENSOR_SUPPORTED bool default y +config SOC_BOD_SUPPORTED + bool + default y + config SOC_XTAL_SUPPORT_40M bool default y diff --git a/components/soc/esp32s2/include/soc/soc_caps.h b/components/soc/esp32s2/include/soc/soc_caps.h index 7e604cbc8e..2e2b1a5dfd 100644 --- a/components/soc/esp32s2/include/soc/soc_caps.h +++ b/components/soc/esp32s2/include/soc/soc_caps.h @@ -77,6 +77,7 @@ #define SOC_SECURE_BOOT_SUPPORTED 1 #define SOC_MEMPROT_SUPPORTED 1 #define SOC_TOUCH_SENSOR_SUPPORTED 1 +#define SOC_BOD_SUPPORTED 1 /*-------------------------- XTAL CAPS ---------------------------------------*/ #define SOC_XTAL_SUPPORT_40M 1 diff --git a/components/soc/esp32s3/include/soc/Kconfig.soc_caps.in b/components/soc/esp32s3/include/soc/Kconfig.soc_caps.in index 8569912684..507574808e 100644 --- a/components/soc/esp32s3/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32s3/include/soc/Kconfig.soc_caps.in @@ -191,6 +191,10 @@ config SOC_TOUCH_SENSOR_SUPPORTED bool default y +config SOC_BOD_SUPPORTED + bool + default y + config SOC_XTAL_SUPPORT_40M bool default y diff --git a/components/soc/esp32s3/include/soc/soc_caps.h b/components/soc/esp32s3/include/soc/soc_caps.h index ceb50b1224..c21f8a3a5b 100644 --- a/components/soc/esp32s3/include/soc/soc_caps.h +++ b/components/soc/esp32s3/include/soc/soc_caps.h @@ -67,6 +67,7 @@ #define SOC_SECURE_BOOT_SUPPORTED 1 #define SOC_MEMPROT_SUPPORTED 1 #define SOC_TOUCH_SENSOR_SUPPORTED 1 +#define SOC_BOD_SUPPORTED 1 /*-------------------------- XTAL CAPS ---------------------------------------*/ #define SOC_XTAL_SUPPORT_40M 1