Переглянути джерело

Merge branch 'feature/final_h2_bluedroid_skc_common' into 'master'

Feature/final h2 bluedroid skc common

See merge request espressif/esp-idf!17710
Island 3 роки тому
батько
коміт
74b7a3fc83

+ 20 - 13
components/bt/CMakeLists.txt

@@ -27,7 +27,17 @@ if(CONFIG_BT_ENABLED)
     elseif(CONFIG_IDF_TARGET_ESP32S3)
        list(APPEND include_dirs include/esp32s3/include)
     elseif(CONFIG_IDF_TARGET_ESP32H2)
-       list(APPEND include_dirs include/esp32h2/include)
+       if(CONFIG_BT_BLUEDROID_ENABLED)
+           list(APPEND include_dirs
+                host/nimble/nimble/porting/nimble/include
+                host/nimble/nimble/nimble/include
+                host/nimble/nimble/porting/npl/freertos/include
+                host/nimble/nimble/nimble/transport/ram/include
+                host/nimble/port/include
+                include/esp32h2/include)
+       else()
+           list(APPEND include_dirs include/esp32h2/include)
+       endif()
     endif()
 
     list(APPEND priv_include_dirs
@@ -351,6 +361,14 @@ if(CONFIG_BT_ENABLED)
                    "host/bluedroid/stack/smp/smp_l2c.c"
                    "host/bluedroid/stack/smp/smp_main.c"
                    "host/bluedroid/stack/smp/smp_utils.c")
+if(CONFIG_IDF_TARGET_ESP32H2)
+       if(CONFIG_BT_BLUEDROID_ENABLED)
+                   list(APPEND srcs
+                   "host/nimble/nimble/porting/npl/freertos/src/npl_os_freertos.c"
+                   "host/nimble/nimble/porting/nimble/src/os_msys_init.c"
+                   "host/nimble/port/src/esp_nimble_mem.c")
+       endif()
+endif()
 
             list(APPEND srcs "common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c")
         if(CONFIG_BLE_MESH)
@@ -663,19 +681,8 @@ if(CONFIG_BT_ENABLED)
                 "-L${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c3_family/esp32s3")
         target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app)
     elseif(CONFIG_IDF_TARGET_ESP32H2)
-
-        if(CONFIG_BT_NIMBLE_CONTROL_SEQUENCE_MODE_ENABLED)
-            add_prebuilt_library(nimblelib "controller/lib_esp32h2/esp32h2-bt-lib/libcontroller_5p0_seq.a")
-        else()
-            if(CONFIG_BLE_50_FEATURE_SUPPORT)
-                add_prebuilt_library(nimblelib "controller/lib_esp32h2/esp32h2-bt-lib/libcontroller_5p0.a")
-            else()
-                add_prebuilt_library(nimblelib "controller/lib_esp32h2/esp32h2-bt-lib/libcontroller_4p2.a")
-            endif()
-        endif()
-
+        add_prebuilt_library(nimblelib "controller/lib_esp32h2/esp32h2-bt-lib/libcontroller_5p0_seq.a")
         target_link_libraries(${COMPONENT_LIB} PRIVATE nimblelib)
-
     endif()
 
     set_source_files_properties(

+ 167 - 9
components/bt/controller/esp32h2/bt.c

@@ -42,14 +42,15 @@
 #include "esp_phy_init.h"
 #include "soc/system_reg.h"
 #include "hal/hal_uart.h"
+#ifdef CONFIG_BT_BLUEDROID_ENABLED
+#include "hci/hci_hal.h"
+#endif
 
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
 
-#include "host/ble_hs.h"
-
 #include "esp_private/periph_ctrl.h"
-
+#include "nimble/hci_common.h"
 /* Macro definition
  ************************************************************************
  */
@@ -113,6 +114,9 @@ extern int esp_ble_ll_set_public_addr(const uint8_t *addr);
 extern int esp_register_npl_funcs (struct npl_funcs_t *p_npl_func);
 extern void esp_unregister_npl_funcs (void);
 extern void npl_freertos_mempool_deinit(void);
+/* TX power */
+int ble_txpwr_set(int power_type, int power_level);
+int ble_txpwr_get(int power_type);
 extern void coex_pti_v2(void);
 extern void bt_bb_v2_init_cmplx(uint8_t i);
 extern int os_msys_buf_alloc(void);
@@ -226,7 +230,90 @@ static void coex_schm_status_bit_clear_wrapper(uint32_t type, uint32_t status)
     coex_schm_status_bit_clear(type, status);
 #endif
 }
+#ifdef CONFIG_BT_BLUEDROID_ENABLED
+bool esp_vhci_host_check_send_available(void)
+{
+    if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) {
+        return false;
+    }
+    return 1;
+}
+
+/**
+ * Allocates an mbuf for use by the nimble host.
+ */
+static struct os_mbuf *
+ble_hs_mbuf_gen_pkt(uint16_t leading_space)
+{
+    struct os_mbuf *om;
+    int rc;
+
+    om = os_msys_get_pkthdr(0, 0);
+    if (om == NULL) {
+        return NULL;
+    }
+
+    if (om->om_omp->omp_databuf_len < leading_space) {
+        rc = os_mbuf_free_chain(om);
+        assert(rc == 0);
+        return NULL;
+    }
+
+    om->om_data += leading_space;
+
+    return om;
+}
+
+/**
+ * Allocates an mbuf suitable for an HCI ACL data packet.
+ *
+ * @return                  An empty mbuf on success; null on memory
+ *                              exhaustion.
+ */
+struct os_mbuf *
+ble_hs_mbuf_acl_pkt(void)
+{
+    return ble_hs_mbuf_gen_pkt(4 + 1);
+}
+
+void esp_vhci_host_send_packet(uint8_t *data, uint16_t len)
+{
+    if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) {
+        return;
+    }
+
+    if (*(data) == DATA_TYPE_COMMAND)
+    {
+         struct ble_hci_cmd *cmd = NULL;
+	 cmd = (void *) ble_hci_trans_buf_alloc(BLE_HCI_TRANS_BUF_CMD);
+	 memcpy((uint8_t *)cmd, data + 1, len - 1);
+	 ble_hci_trans_hs_cmd_tx(cmd);
+    }
+
+    if (*(data) == DATA_TYPE_ACL)
+    {
+        struct os_mbuf *om = os_msys_get_pkthdr(0, 0);
+	assert(om);
+        memcpy(om->om_data, &data[1], len - 1);
+        om->om_len = len - 1;
+        OS_MBUF_PKTHDR(om)->omp_len = len - 1;
+        ble_hci_trans_hs_acl_tx(om);
+    }
+
+}
+
+esp_err_t esp_vhci_host_register_callback(const esp_vhci_host_callback_t *callback)
+{
+    if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) {
+        return ESP_FAIL;
+    }
+
+    ble_hci_trans_cfg_hs(ble_hs_hci_rx_evt,NULL,ble_hs_rx_data,NULL);
+
+    return ESP_OK;
+}
 
+#endif
 static int task_create_wrapper(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle, uint32_t core_id)
 {
     return (uint32_t)xTaskCreatePinnedToCore(task_func, name, stack_depth, param, prio, task_handle, (core_id < portNUM_PROCESSORS ? core_id : tskNO_AFFINITY));
@@ -483,7 +570,6 @@ esp_err_t esp_bt_controller_init(struct esp_bt_controller_config_t *cfg)
         ESP_LOGW(NIMBLE_PORT_LOG_TAG, "invalid controller state");
         return ESP_FAIL;
     }
-
     if (cfg == NULL) {
         return ESP_ERR_INVALID_ARG;
     }
@@ -518,11 +604,11 @@ esp_err_t esp_bt_controller_init(struct esp_bt_controller_config_t *cfg)
     }
 
     os_msys_init();
-
+#if CONFIG_BT_NIMBLE_ENABLED
     // ble_npl_eventq_init() need to use npl function in rom and must be called after esp_bt_controller_init()
     /* Initialize default event queue */
     ble_npl_eventq_init(nimble_port_get_dflt_eventq());
-
+#endif
     periph_module_enable(PERIPH_BT_MODULE);
 
     // init phy
@@ -554,7 +640,9 @@ esp_err_t esp_bt_controller_init(struct esp_bt_controller_config_t *cfg)
     esp_ble_ll_set_public_addr(mac);
 
     ble_controller_status = ESP_BT_CONTROLLER_STATUS_INITED;
-
+#ifdef CONFIG_BT_BLUEDROID_ENABLED
+    ble_hci_trans_cfg_hs(ble_hs_hci_rx_evt,NULL,ble_hs_rx_data,NULL);
+#endif
     return ESP_OK;
 }
 
@@ -570,10 +658,10 @@ esp_err_t esp_bt_controller_deinit(void)
     if (ble_controller_deinit() != 0) {
         return ESP_FAIL;
     }
-
+#if CONFIG_BT_NIMBLE_ENABLED
     /* De-initialize default event queue */
     ble_npl_eventq_deinit(nimble_port_get_dflt_eventq());
-
+#endif
     os_msys_buf_free();
 
     esp_unregister_npl_funcs();
@@ -592,6 +680,70 @@ esp_err_t esp_bt_controller_deinit(void)
     return ESP_OK;
 }
 
+esp_bt_controller_status_t esp_bt_controller_get_status(void)
+{
+    return ble_controller_status;
+}
+
+/* extra functions */
+esp_err_t esp_ble_tx_power_set(esp_ble_power_type_t power_type, esp_power_level_t power_level)
+{
+    esp_err_t stat = ESP_FAIL;
+
+    switch (power_type) {
+    case ESP_BLE_PWR_TYPE_ADV:
+    case ESP_BLE_PWR_TYPE_SCAN:
+    case ESP_BLE_PWR_TYPE_DEFAULT:
+        if (ble_txpwr_set(power_type, power_level) == 0) {
+            stat = ESP_OK;
+        }
+        break;
+    default:
+        stat = ESP_ERR_NOT_SUPPORTED;
+        break;
+    }
+
+    return stat;
+}
+
+int ble_txpwr_get(int power_type)
+{
+    return 0;
+}
+
+int ble_txpwr_set(int power_type, int power_level)
+{
+    return 0;
+}
+esp_power_level_t esp_ble_tx_power_get(esp_ble_power_type_t power_type)
+{
+    esp_power_level_t lvl;
+
+    switch (power_type) {
+    case ESP_BLE_PWR_TYPE_ADV:
+    case ESP_BLE_PWR_TYPE_SCAN:
+        lvl = (esp_power_level_t)ble_txpwr_get(power_type);
+        break;
+    case ESP_BLE_PWR_TYPE_CONN_HDL0:
+    case ESP_BLE_PWR_TYPE_CONN_HDL1:
+    case ESP_BLE_PWR_TYPE_CONN_HDL2:
+    case ESP_BLE_PWR_TYPE_CONN_HDL3:
+    case ESP_BLE_PWR_TYPE_CONN_HDL4:
+    case ESP_BLE_PWR_TYPE_CONN_HDL5:
+    case ESP_BLE_PWR_TYPE_CONN_HDL6:
+    case ESP_BLE_PWR_TYPE_CONN_HDL7:
+    case ESP_BLE_PWR_TYPE_CONN_HDL8:
+    case ESP_BLE_PWR_TYPE_DEFAULT:
+        lvl = (esp_power_level_t)ble_txpwr_get(ESP_BLE_PWR_TYPE_DEFAULT);
+        break;
+    default:
+        lvl = ESP_PWR_LVL_INVALID;
+        break;
+    }
+
+    return lvl;
+}
+
 esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
 {
     if (mode != ESP_BT_MODE_BLE) {
@@ -622,6 +774,12 @@ esp_err_t esp_bt_controller_disable(void)
     return ESP_OK;
 }
 
+esp_err_t esp_bt_controller_mem_release(esp_bt_mode_t mode)
+{
+    ESP_LOGW(NIMBLE_PORT_LOG_TAG, "%s not implemented, return OK", __func__);
+    return ESP_OK;
+}
+
 esp_err_t esp_bt_mem_release(esp_bt_mode_t mode)
 {
     ESP_LOGW(NIMBLE_PORT_LOG_TAG, "%s not implemented, return OK", __func__);

+ 240 - 1
components/bt/host/bluedroid/Kconfig.in

@@ -26,6 +26,245 @@ config BT_BLUEDROID_PINNED_TO_CORE
     default 1 if BT_BLUEDROID_PINNED_TO_CORE_1
     default 0
 
+config BT_BLE_CONTROLLER_ENABLED
+    bool "Enable BLE controller"
+    depends on SOC_ESP_NIMBLE_CONTROLLER
+    default y
+    help
+            Enable or Disable NimBLE controller
+
+choice BT_BLE_SELECT_HCI_INTERFACE
+    prompt "Select HCI interface"
+    depends on SOC_ESP_NIMBLE_CONTROLLER
+    default BT_BLE_CONTROL_USE_RAM_HCI
+
+    config BT_BLE_CONTROL_USE_RAM_HCI
+        bool "ram"
+        help
+                Use RAM as HCI interface
+    config BT_BLE_CONTROL_USE_UART_HCI
+        bool "uart"
+        help
+                Use UART as HCI interface
+endchoice
+
+config BT_BLE_HCI_EVT_BUF_SIZE
+    int "HCI Event Buffer size"
+    depends on BT_BLUEDROID_ENABLED && SOC_ESP_NIMBLE_CONTROLLER
+    default 257 if BT_BLE_EXT_ADV
+    default 70
+    help
+        This is the size of each HCI event buffer in bytes. In case of
+        extended advertising, packets can be fragmented. 257 bytes is the
+        maximum size of a packet.
+
+menuconfig BT_BLE_MEMORY_SETTINGS
+    bool "OS Memory Settings"
+    depends on SOC_ESP_NIMBLE_CONTROLLER
+    default y
+    help
+            Settings memory blocks
+
+config BT_BLE_MSYS_1_BLOCK_COUNT
+    int "MSYS_1 Block Count"
+    depends on BT_BLE_MEMORY_SETTINGS
+    default 12
+    help
+        MSYS is a system level mbuf registry. For prepare write & prepare
+        responses MBUFs are allocated out of msys_1 pool. For NIMBLE_MESH
+        enabled cases, this block count is increased by 8 than user defined
+        count.
+
+config BT_BLE_MSYS_1_BLOCK_SIZE
+    int    "MSYS_1 Block Size"
+    depends on BT_BLE_MEMORY_SETTINGS
+    default 256
+    help
+            Dynamic memory size of block 1
+
+config BT_BLE_MSYS_2_BLOCK_COUNT
+    int    "MSYS_2 Block Count"
+    depends on BT_BLE_MEMORY_SETTINGS
+    default 24
+    help
+            Dynamic memory count
+
+config BT_BLE_MSYS_2_BLOCK_SIZE
+    int    "MSYS_2 Block Size"
+    depends on BT_BLE_MEMORY_SETTINGS
+    default 320
+    help
+            Dynamic memory size of block 2
+
+config BT_BLE_LL_RESOLV_LIST_SIZE
+    int "BLE LL Resolving list size"
+    range 1 5
+    default 5
+    depends on SOC_ESP_NIMBLE_CONTROLLER
+    help
+            Configure the size of resolving list used in link layer.
+
+
+config BT_BLE_HCI_EVT_HI_BUF_COUNT
+    int "High Priority HCI Event Buffer count"
+    depends on BT_BLUEDROID_ENABLED && SOC_ESP_NIMBLE_CONTROLLER
+    default 30
+    help
+        This is the high priority HCI events' buffer size. High-priority
+        event buffers are for everything except advertising reports. If there
+        are no free high-priority event buffers then host will try to allocate a
+        low-priority buffer instead
+
+config BT_BLE_HCI_EVT_LO_BUF_COUNT
+    int "Low Priority HCI Event Buffer count"
+    depends on BT_BLUEDROID_ENABLED && SOC_ESP_NIMBLE_CONTROLLER
+    default 8
+    help
+        This is the low priority HCI events' buffer size. Low-priority event
+        buffers are only used for advertising reports. If there are no free
+        low-priority event buffers, then an incoming advertising report will
+        get dropped
+
+config BT_BLE_LL_DUP_SCAN_LIST_COUNT
+    int "BLE duplicate scan list count"
+    range 1 20
+    default 10
+    depends on SOC_ESP_NIMBLE_CONTROLLER
+    help
+            config the max count of duplicate scan list
+
+config BT_BLE_MAX_CONNECTIONS
+    int "Maximum number of concurrent connections"
+    range 1 2 if ( SOC_ESP_NIMBLE_CONTROLLER)
+    default 2
+    depends on BT_BLUEDROID_ENABLED && SOC_ESP_NIMBLE_CONTROLLER
+    help
+        Defines maximum number of concurrent BLE connections. For ESP32, user
+        is expected to configure BTDM_CTRL_BLE_MAX_CONN from controller menu
+        along with this option. Similarly for ESP32-C3 or ESP32-S3, user is expected to
+        configure BT_CTRL_BLE_MAX_ACT from controller menu.
+
+config BT_BLE_ACL_BUF_COUNT
+    int "ACL Buffer count"
+    depends on BT_BLUEDROID_ENABLED && SOC_ESP_NIMBLE_CONTROLLER
+    default 24
+    help
+        The number of ACL data buffers.
+
+config BT_BLE_ACL_BUF_SIZE
+    int "ACL Buffer size"
+    depends on BT_BLUEDROID_ENABLED && SOC_ESP_NIMBLE_CONTROLLER
+    default 251
+    help
+        This is the maximum size of the data portion of HCI ACL data packets.
+        It does not include the HCI data header (of 4 bytes)
+
+config BT_BLE_HCI_UART_PORT
+    int "HCI UART port"
+    depends on BT_BLE_USE_UART_HCI
+    default 1
+    help
+        Set the port number of HCI UART
+
+config BT_BLE_HCI_UART_BAUD
+    int "HCI uart baudrate"
+    depends on BT_BLE_USE_UART_HCI
+    default 921600
+    help
+            HCI uart baud rate 115200 ~ 1000000
+
+config BT_BLE_SLEEP_ENABLE
+    bool "Enable BLE sleep"
+    depends on BT_BLUEDROID_ENABLED && SOC_ESP_NIMBLE_CONTROLLER
+    default n
+    help
+            Enable BLE sleep
+
+
+choice BT_BLE_COEX_PHY_CODED_TX_RX_TLIM
+    prompt "Coexistence: limit on MAX Tx/Rx time for coded-PHY connection"
+    default BT_BLE_COEX_PHY_CODED_TX_RX_TLIM_DIS
+    depends on ESP32_WIFI_SW_COEXIST_ENABLE && (BT_BLUEDROID_ENABLED && SOC_ESP_NIMBLE_CONTROLLER)
+    help
+            When using PHY-Coded in BLE connection, limitation on max tx/rx time can be applied to
+            better avoid dramatic performance deterioration of Wi-Fi.
+
+        config BT_BLE_COEX_PHY_CODED_TX_RX_TLIM_EN
+            bool "Force Enable"
+            help
+                Always enable the limitation on max tx/rx time for Coded-PHY connection
+
+        config BT_BLE_COEX_PHY_CODED_TX_RX_TLIM_DIS
+            bool "Force Disable"
+            help
+                Disable the limitation on max tx/rx time for Coded-PHY connection
+endchoice
+
+config BT_BLE_COEX_PHY_CODED_TX_RX_TLIM_EFF
+    int
+    default 0 if !(ESP32_WIFI_SW_COEXIST_ENABLE && (BT_BLUEDROID_ENABLED || BT_NIMBLE_ENABLED))
+    default 1 if BT_BLE_COEX_PHY_CODED_TX_RX_TLIM_EN
+    default 0 if BT_BLE_COEX_PHY_CODED_TX_RX_TLIM_DIS
+
+config BT_BLE_MAX_BONDS
+    int "Maximum number of bonds to save across reboots"
+    default 3
+    depends on BT_BLUEDROID_ENABLED && SOC_ESP_NIMBLE_CONTROLLER
+    help
+        Defines maximum number of bonds to save for peer security and our security
+
+
+config BT_BLE_WHITELIST_SIZE
+    int "BLE white list size"
+    depends on BT_BLUEDROID_ENABLED && SOC_ESP_NIMBLE_CONTROLLER
+    range 1 5
+    default 5
+    help
+            BLE list size
+
+config BT_BLE_CONTROLLER_TASK_STACK_SIZE
+    int "NimBLE Controller task stack size"
+    depends on (BT_BLUEDROID_ENABLED) && SOC_ESP_NIMBLE_CONTROLLER
+    default 5120 if BLE_MESH
+    default 4096
+    help
+            This configures stack size of NimBLE controller task
+
+choice BT_BLE_MEM_ALLOC_MODE
+    prompt "Memory allocation strategy"
+    default BT_BLE_MEM_ALLOC_MODE_INTERNAL
+    depends on SOC_ESP_NIMBLE_CONTROLLER
+    help
+        Allocation strategy for NimBLE host stack, essentially provides ability to
+        allocate all required dynamic allocations from,
+
+        - Internal DRAM memory only
+        - External SPIRAM memory only
+        - Either internal or external memory based on default malloc()
+          behavior in ESP-IDF
+        - Internal IRAM memory wherever applicable else internal DRAM
+
+    config BT_BLE_MEM_ALLOC_MODE_INTERNAL
+        bool "Internal memory"
+
+    config BT_BLE_MEM_ALLOC_MODE_EXTERNAL
+        bool "External SPIRAM"
+        depends on SPIRAM_USE_CAPS_ALLOC || SPIRAM_USE_MALLOC
+
+    config BT_BLE_MEM_ALLOC_MODE_DEFAULT
+        bool "Default alloc mode"
+
+    config BT_BLE_MEM_ALLOC_MODE_IRAM_8BIT
+        bool "Internal IRAM"
+        depends on ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY
+        help
+            Allows to use IRAM memory region as 8bit accessible region.
+
+            Every unaligned (8bit or 16bit) access will result in an exception
+            and incur penalty of certain clock cycles per unaligned read/write.
+
+endchoice #BT_BLE_MEM_ALLOC_MODE
+
 config BT_BTU_TASK_STACK_SIZE
     int "Bluetooth Bluedroid Host Stack task stack size"
     depends on BT_BLUEDROID_ENABLED
@@ -1077,7 +1316,7 @@ config BT_BLE_RPA_SUPPORTED
 
 config BT_BLE_50_FEATURES_SUPPORTED
     bool "Enable BLE 5.0 features"
-    depends on (BT_BLUEDROID_ENABLED && (IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3))
+    depends on (BT_BLUEDROID_ENABLED && (IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3 || SOC_ESP_NIMBLE_CONTROLLER))
     default y
     help
         This enables BLE 5.0 features, this option only support esp32c3/esp32s3 chip

+ 40 - 2
components/bt/host/bluedroid/hci/hci_hal_h4.c

@@ -26,12 +26,13 @@
 #include "osi/thread.h"
 #include "esp_bt.h"
 #include "stack/hcimsgs.h"
-
 #if (C2H_FLOW_CONTROL_INCLUDED == TRUE)
 #include "l2c_int.h"
 #endif ///C2H_FLOW_CONTROL_INCLUDED == TRUE
 #include "stack/hcimsgs.h"
-
+#if SOC_ESP_NIMBLE_CONTROLLER
+#include "nimble/ble_hci_trans.h"
+#endif
 #define HCI_HAL_SERIAL_BUFFER_SIZE 1026
 #define HCI_BLE_EVENT 0x3e
 #define PACKET_TYPE_TO_INBOUND_INDEX(type) ((type) - 2)
@@ -342,7 +343,44 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
 
     return 0;
 }
+#if SOC_ESP_NIMBLE_CONTROLLER
+
+int
+ble_hs_hci_rx_evt(uint8_t *hci_ev, void *arg)
+{
+    if(esp_bluedroid_get_status() == ESP_BLUEDROID_STATUS_UNINITIALIZED) {
+	return 0;
+    }
+    uint8_t len = hci_ev[1] + 3;
+    uint8_t *data = (uint8_t *)malloc(len);
+    data[0] = 0x04;
+    memcpy(&data[1], hci_ev, len - 1);
+    ble_hci_trans_buf_free(hci_ev);
+    host_recv_pkt_cb(data, len);
+    free(data);
+    return 0;
+}
 
+static void *trans_om;
+void hci_trans_free_mbuf(void)
+{
+    os_mbuf_free_chain(trans_om);
+}
+int
+ble_hs_rx_data(struct os_mbuf *om, void *arg)
+{
+    uint8_t len = om->om_len + 1;
+    uint8_t *data = (uint8_t *)malloc(len);
+    data[0] = 0x02;
+    memcpy(&data[1], om->om_data, len - 1);
+    host_recv_pkt_cb(data, len);
+    trans_om = om;
+    free(data);
+    hci_trans_free_mbuf();
+    return 0;
+}
+
+#endif
 static const esp_vhci_host_callback_t vhci_host_cb = {
     .notify_host_send_available = host_send_pkt_available_cb,
     .notify_host_recv = host_recv_pkt_cb,

+ 9 - 1
components/bt/host/bluedroid/hci/include/hci/hci_hal.h

@@ -23,7 +23,9 @@
 #include <stdint.h>
 
 #include "stack/bt_types.h"
-
+#if SOC_ESP_NIMBLE_CONTROLLER
+#include "os/os_mbuf.h"
+#endif
 typedef enum {
     DATA_TYPE_COMMAND = 1,
     DATA_TYPE_ACL     = 2,
@@ -81,5 +83,11 @@ typedef struct hci_hal_t {
 
 // Gets the correct hal implementation, as compiled for.
 const hci_hal_t *hci_hal_h4_get_interface(void);
+#if SOC_ESP_NIMBLE_CONTROLLER
+int ble_hs_hci_rx_evt(uint8_t *hci_ev, void *arg);
+
+int ble_hs_rx_data(struct os_mbuf *om, void *arg);
+#endif
+
 
 #endif /* _HCI_HAL_H */

+ 3 - 2
components/bt/host/nimble/port/include/esp_nimble_cfg.h

@@ -111,12 +111,14 @@
 #endif
 
 /*** nimble */
+#if CONFIG_BT_NIMBLE_ENABLED
+
 #ifndef CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT
 #define BLE_50_FEATURE_SUPPORT (0)
 #else
 #define BLE_50_FEATURE_SUPPORT (CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT)
 #endif
-
+#endif
 #ifndef CONFIG_BT_NIMBLE_EXT_ADV
 #define MYNEWT_VAL_BLE_EXT_ADV (0)
 #else
@@ -188,7 +190,6 @@
 #ifndef MYNEWT_VAL_BLE_WHITELIST
 #define MYNEWT_VAL_BLE_WHITELIST (1)
 #endif
-
 /*** @apache-mynewt-nimble/nimble/controller */
 /*** @apache-mynewt-nimble/nimble/controller */
 #ifndef MYNEWT_VAL_BLE_CONTROLLER

+ 173 - 5
components/bt/include/esp32h2/include/esp_bt.h

@@ -22,6 +22,10 @@
 extern "C" {
 #endif
 
+#if (SOC_ESP_NIMBLE_CONTROLLER)
+#define NIMBLE_LL_STACK_SIZE CONFIG_BT_NIMBLE_CONTROLLER_TASK_STACK_SIZE
+#endif
+
 /**
  * @brief Bluetooth mode for controller enable/disable
  */
@@ -44,6 +48,73 @@ typedef enum {
     ESP_BT_CONTROLLER_STATUS_NUM,        /*!< Controller is in disabled state */
 } esp_bt_controller_status_t;
 
+/**
+ * @brief BLE tx power type
+ *        ESP_BLE_PWR_TYPE_CONN_HDL0-8: for each connection, and only be set after connection completed.
+ *                                      when disconnect, the correspond TX power is not effected.
+ *        ESP_BLE_PWR_TYPE_ADV : for advertising/scan response.
+ *        ESP_BLE_PWR_TYPE_SCAN : for scan.
+ *        ESP_BLE_PWR_TYPE_DEFAULT : if each connection's TX power is not set, it will use this default value.
+ *                                   if neither in scan mode nor in adv mode, it will use this default value.
+ *        If none of power type is set, system will use ESP_PWR_LVL_P3 as default for ADV/SCAN/CONN0-9.
+ */
+typedef enum {
+    ESP_BLE_PWR_TYPE_CONN_HDL0  = 0,            /*!< For connection handle 0 */
+    ESP_BLE_PWR_TYPE_CONN_HDL1  = 1,            /*!< For connection handle 1 */
+    ESP_BLE_PWR_TYPE_CONN_HDL2  = 2,            /*!< For connection handle 2 */
+    ESP_BLE_PWR_TYPE_CONN_HDL3  = 3,            /*!< For connection handle 3 */
+    ESP_BLE_PWR_TYPE_CONN_HDL4  = 4,            /*!< For connection handle 4 */
+    ESP_BLE_PWR_TYPE_CONN_HDL5  = 5,            /*!< For connection handle 5 */
+    ESP_BLE_PWR_TYPE_CONN_HDL6  = 6,            /*!< For connection handle 6 */
+    ESP_BLE_PWR_TYPE_CONN_HDL7  = 7,            /*!< For connection handle 7 */
+    ESP_BLE_PWR_TYPE_CONN_HDL8  = 8,            /*!< For connection handle 8 */
+    ESP_BLE_PWR_TYPE_ADV        = 9,            /*!< For advertising */
+    ESP_BLE_PWR_TYPE_SCAN       = 10,           /*!< For scan */
+    ESP_BLE_PWR_TYPE_DEFAULT    = 11,           /*!< For default, if not set other, it will use default value */
+    ESP_BLE_PWR_TYPE_NUM        = 12,           /*!< TYPE numbers */
+} esp_ble_power_type_t;
+
+/**
+ * @brief Bluetooth TX power level(index), it's just a index corresponding to power(dbm).
+ */
+typedef enum {
+    ESP_PWR_LVL_N27 = 0,              /*!< Corresponding to -27dbm */
+    ESP_PWR_LVL_N24 = 1,              /*!< Corresponding to -24dbm */
+    ESP_PWR_LVL_N21 = 2,              /*!< Corresponding to -21dbm */
+    ESP_PWR_LVL_N18 = 3,              /*!< Corresponding to -18dbm */
+    ESP_PWR_LVL_N15 = 4,              /*!< Corresponding to -15dbm */
+    ESP_PWR_LVL_N12 = 5,              /*!< Corresponding to -12dbm */
+    ESP_PWR_LVL_N9  = 6,              /*!< Corresponding to  -9dbm */
+    ESP_PWR_LVL_N6  = 7,              /*!< Corresponding to  -6dbm */
+    ESP_PWR_LVL_N3  = 8,              /*!< Corresponding to  -3dbm */
+    ESP_PWR_LVL_N0  = 9,              /*!< Corresponding to   0dbm */
+    ESP_PWR_LVL_P3  = 10,             /*!< Corresponding to  +3dbm */
+    ESP_PWR_LVL_P6  = 11,             /*!< Corresponding to  +6dbm */
+    ESP_PWR_LVL_P9  = 12,             /*!< Corresponding to  +9dbm */
+    ESP_PWR_LVL_P12 = 13,             /*!< Corresponding to  +12dbm */
+    ESP_PWR_LVL_P15 = 14,             /*!< Corresponding to  +15dbm */
+    ESP_PWR_LVL_P18 = 15,             /*!< Corresponding to  +18dbm */
+    ESP_PWR_LVL_INVALID = 0xFF,         /*!< Indicates an invalid value */
+} esp_power_level_t;
+
+/**
+ * @brief  Set BLE TX power
+ *         Connection Tx power should only be set after connection created.
+ * @param  power_type : The type of which tx power, could set Advertising/Connection/Default and etc
+ * @param  power_level: Power level(index) corresponding to absolute value(dbm)
+ * @return              ESP_OK - success, other - failed
+ */
+esp_err_t esp_ble_tx_power_set(esp_ble_power_type_t power_type, esp_power_level_t power_level);
+
+/**
+ * @brief  Get BLE TX power
+ *         Connection Tx power should only be get after connection created.
+ * @param  power_type : The type of which tx power, could set Advertising/Connection/Default and etc
+ * @return             >= 0 - Power level, < 0 - Invalid
+ */
+esp_power_level_t esp_ble_tx_power_get(esp_ble_power_type_t power_type);
+
+
 #define CONFIG_VERSION  0x02109228
 #define CONFIG_MAGIC    0x5A5AA5A5
 
@@ -53,7 +124,7 @@ typedef enum {
  *        some options or parameters of some functions enabled by config mask.
  */
 
-struct esp_bt_controller_config_t {
+struct esp_bt_controller_config_t{
     uint32_t config_version;
     uint16_t ble_ll_resolv_list_size;
     uint16_t ble_hci_evt_hi_buf_count;
@@ -100,6 +171,8 @@ struct esp_bt_controller_config_t {
     uint32_t config_magic;
 };
 
+typedef struct esp_bt_controller_config_t esp_bt_controller_config_t;
+
 #ifdef CONFIG_BT_NIMBLE_RUN_BQB_TEST
 #define RUN_BQB_TEST CONFIG_BT_NIMBLE_RUN_BQB_TEST
 #else
@@ -153,13 +226,13 @@ struct esp_bt_controller_config_t {
     .ble_multi_adv_instances = MYNEWT_VAL(BLE_MULTI_ADV_INSTANCES),                     \
     .ble_ext_adv_max_size = MYNEWT_VAL(BLE_EXT_ADV_MAX_SIZE),                           \
     .controller_task_stack_size = NIMBLE_LL_STACK_SIZE,                                 \
-    .controller_task_prio       = CONFIG_BT_NIMBLE_CONTROLLER_TASK_PRIORITY,            \
+    .controller_task_prio       = ESP_TASK_BT_CONTROLLER_PRIO,                          \
     .controller_run_cpu         = 0,                                                    \
-    .enable_qa_test             = RUN_QA_TEST,                                  \
-    .enable_bqb_test            = RUN_BQB_TEST,                                     \
+    .enable_qa_test             = RUN_QA_TEST,                                          \
+    .enable_bqb_test            = RUN_BQB_TEST,                                         \
     .enable_uart_hci            = HCI_UART_EN,                                          \
     .ble_hci_uart_port          = MYNEWT_VAL(BLE_HCI_UART_PORT),                        \
-    .ble_hci_uart_baud          = MYNEWT_VAL(BLE_HCI_UART_BAUD),                    \
+    .ble_hci_uart_baud          = MYNEWT_VAL(BLE_HCI_UART_BAUD),                        \
     .ble_hci_uart_data_bits     = MYNEWT_VAL(BLE_HCI_UART_DATA_BITS),                   \
     .ble_hci_uart_stop_bits     = MYNEWT_VAL(BLE_HCI_UART_STOP_BITS),                   \
     .ble_hci_uart_flow_ctrl     = MYNEWT_VAL(BLE_HCI_UART_FLOW_CTRL),                   \
@@ -171,11 +244,106 @@ struct esp_bt_controller_config_t {
     .config_magic = CONFIG_MAGIC,                                                       \
 };
 
+
 esp_err_t esp_bt_controller_init(struct esp_bt_controller_config_t *cfg);
+
+/**
+ * @brief  Get BT controller is initialised/de-initialised/enabled/disabled
+ * @return status value
+ */
+esp_bt_controller_status_t esp_bt_controller_get_status(void);
+esp_power_level_t esp_ble_tx_power_get(esp_ble_power_type_t power_type);
 esp_err_t esp_bt_controller_deinit(void);
 esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode);
 esp_err_t esp_bt_controller_disable(void);
+
+typedef struct esp_vhci_host_callback {
+    void (*notify_host_send_available)(void);               /*!< callback used to notify that the host can send packet to controller */
+    int (*notify_host_recv)(uint8_t *data, uint16_t len);   /*!< callback used to notify that the controller has a packet to send to the host*/
+} esp_vhci_host_callback_t;
+
+/** @brief esp_vhci_host_check_send_available
+ *  used for check actively if the host can send packet to controller or not.
+ *  @return true for ready to send, false means cannot send packet
+ */
+bool esp_vhci_host_check_send_available(void);
+
+/** @brief esp_vhci_host_send_packet
+ * host send packet to controller
+ *
+ * Should not call this function from within a critical section
+ * or when the scheduler is suspended.
+ *
+ * @param data the packet point
+ * @param len the packet length
+ */
+void esp_vhci_host_send_packet(uint8_t *data, uint16_t len);
+
+/** @brief esp_vhci_host_register_callback
+ * register the vhci reference callback
+ * struct defined by vhci_host_callback structure.
+ * @param callback esp_vhci_host_callback type variable
+ * @return ESP_OK - success, ESP_FAIL - failed
+ */
+esp_err_t esp_vhci_host_register_callback(const esp_vhci_host_callback_t *callback);
+
+/** @brief esp_bt_controller_mem_release
+ * release the controller memory as per the mode
+ *
+ * This function releases the BSS, data and other sections of the controller to heap. The total size is about 70k bytes.
+ *
+ * esp_bt_controller_mem_release(mode) should be called only before esp_bt_controller_init()
+ * or after esp_bt_controller_deinit().
+ *
+ * Note that once BT controller memory is released, the process cannot be reversed. It means you cannot use the bluetooth
+ * mode which you have released by this function.
+ *
+ * If your firmware will later upgrade the Bluetooth controller mode (BLE -> BT Classic or disabled -> enabled)
+ * then do not call this function.
+ *
+ * If the app calls esp_bt_controller_enable(ESP_BT_MODE_BLE) to use BLE only then it is safe to call
+ * esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT) at initialization time to free unused BT Classic memory.
+ *
+ * If the mode is ESP_BT_MODE_BTDM, then it may be useful to call API esp_bt_mem_release(ESP_BT_MODE_BTDM) instead,
+ * which internally calls esp_bt_controller_mem_release(ESP_BT_MODE_BTDM) and additionally releases the BSS and data
+ * consumed by the BT/BLE host stack to heap. For more details about usage please refer to the documentation of
+ * esp_bt_mem_release() function
+ *
+ * @param mode : the mode want to release memory
+ * @return ESP_OK - success, other - failed
+ */
+esp_err_t esp_bt_controller_mem_release(esp_bt_mode_t mode);
+
+/** @brief esp_bt_mem_release
+ * release controller memory and BSS and data section of the BT/BLE host stack as per the mode
+ *
+ * This function first releases controller memory by internally calling esp_bt_controller_mem_release().
+ * Additionally, if the mode is set to ESP_BT_MODE_BTDM, it also releases the BSS and data consumed by the BT/BLE host stack to heap
+ *
+ * Note that once BT memory is released, the process cannot be reversed. It means you cannot use the bluetooth
+ * mode which you have released by this function.
+ *
+ * If your firmware will later upgrade the Bluetooth controller mode (BLE -> BT Classic or disabled -> enabled)
+ * then do not call this function.
+ *
+ * If you never intend to use bluetooth in a current boot-up cycle, you can call esp_bt_mem_release(ESP_BT_MODE_BTDM)
+ * before esp_bt_controller_init or after esp_bt_controller_deinit.
+ *
+ * For example, if a user only uses bluetooth for setting the WiFi configuration, and does not use bluetooth in the rest of the product operation".
+ * In such cases, after receiving the WiFi configuration, you can disable/deinit bluetooth and release its memory.
+ * Below is the sequence of APIs to be called for such scenarios:
+ *
+ *      esp_bluedroid_disable();
+ *      esp_bluedroid_deinit();
+ *      esp_bt_controller_disable();
+ *      esp_bt_controller_deinit();
+ *      esp_bt_mem_release(ESP_BT_MODE_BTDM);
+ *
+ * @param mode : the mode whose memory is to be released
+ * @return ESP_OK - success, other - failed
+ */
 esp_err_t esp_bt_mem_release(esp_bt_mode_t mode);
+
 /* Returns random static address or -1 if not present */
 extern int esp_ble_hw_get_static_addr(ble_addr_t *addr);
 

+ 34 - 0
components/bt/sdkconfig.rename.esp32h2

@@ -0,0 +1,34 @@
+# sdkconfig replacement configurations for deprecated options formatted as
+# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION
+
+CONFIG_BT_NIMBLE_CONTROLLER_ENABLED                         CONFIG_BT_BLE_CONTROLLER_ENABLED
+CONFIG_BT_NIMBLE_CONTROL_USE_RAM_HCI                        CONFIG_BT_BLE_CONTROL_USE_RAM_HCI
+CONFIG_BT_NIMBLE_CONTROL_USE_UART_HCI                       CONFIG_BT_BLE_CONTROL_USE_UART_HCI
+CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE                           CONFIG_BT_BLE_HCI_EVT_BUF_SIZE
+CONFIG_BT_NIMBLE_MEMORY_SETTINGS                            CONFIG_BT_BLE_MEMORY_SETTINGS
+CONFIG_BT_NIMBLE_MSYS_1_BLOCK_COUNT                         CONFIG_BT_BLE_MSYS_1_BLOCK_COUNT
+CONFIG_BT_NIMBLE_MSYS_1_BLOCK_SIZE                          CONFIG_BT_BLE_MSYS_1_BLOCK_SIZE
+CONFIG_BT_NIMBLE_MSYS_2_BLOCK_COUNT                         CONFIG_BT_BLE_MSYS_2_BLOCK_COUNT
+CONFIG_BT_NIMBLE_MSYS_2_BLOCK_SIZE                          CONFIG_BT_BLE_MSYS_2_BLOCK_SIZE
+CONFIG_BT_NIMBLE_LL_RESOLV_LIST_SIZE                        CONFIG_BT_BLE_LL_RESOLV_LIST_SIZE
+CONFIG_BT_NIMBLE_HCI_EVT_HI_BUF_COUNT                       CONFIG_BT_BLE_HCI_EVT_HI_BUF_COUNT
+CONFIG_BT_NIMBLE_HCI_EVT_LO_BUF_COUNT                       CONFIG_BT_BLE_HCI_EVT_LO_BUF_COUNT
+CONFIG_BT_NIMBLE_LL_DUP_SCAN_LIST_COUNT                     CONFIG_BT_BLE_LL_DUP_SCAN_LIST_COUNT
+CONFIG_BT_NIMBLE_MAX_CONNECTIONS                            CONFIG_BT_BLE_MAX_CONNECTIONS
+CONFIG_BT_NIMBLE_ACL_BUF_COUNT                              CONFIG_BT_BLE_ACL_BUF_COUNT
+CONFIG_BT_NIMBLE_ACL_BUF_SIZE                               CONFIG_BT_BLE_ACL_BUF_SIZE
+CONFIG_BT_NIMBLE_HCI_UART_PORT                              CONFIG_BT_BLE_HCI_UART_PORT
+CONFIG_BT_NIMBLE_HCI_UART_BAUD                              CONFIG_BT_BLE_HCI_UART_BAUD
+CONFIG_BT_NIMBLE_SLEEP_ENABLE                               CONFIG_BT_BLE_SLEEP_ENABLE
+CONFIG_BT_NIMBLE_COEX_PHY_CODED_TX_RX_TLIM                  CONFIG_BT_BLE_COEX_PHY_CODED_TX_RX_TLIM
+CONFIG_BT_NIMBLE_COEX_PHY_CODED_TX_RX_TLIM_EFF              CONFIG_BT_BLE_COEX_PHY_CODED_TX_RX_TLIM_EFF
+CONFIG_BT_NIMBLE_COEX_PHY_CODED_TX_RX_TLIM_EN               CONFIG_BT_BLE_COEX_PHY_CODED_TX_RX_TLIM_EN
+CONFIG_BT_NIMBLE_COEX_PHY_CODED_TX_RX_TLIM_DIS              CONFIG_BT_BLE_COEX_PHY_CODED_TX_RX_TLIM_DIS
+CONFIG_BT_NIMBLE_MAX_BONDS                                  CONFIG_BT_BLE_MAX_BONDS
+CONFIG_BT_NIMBLE_WHITELIST_SIZE                             CONFIG_BT_BLE_WHITELIST_SIZE
+CONFIG_BT_NIMBLE_CONTROLLER_TASK_STACK_SIZE                 CONFIG_BT_BLE_CONTROLLER_TASK_STACK_SIZE
+CONFIG_BT_NIMBLE_MEM_ALLOC_MODE                             CONFIG_BT_BLE_MEM_ALLOC_MODE
+CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL                    CONFIG_BT_BLE_MEM_ALLOC_MODE_INTERNAL
+CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL                    CONFIG_BT_BLE_MEM_ALLOC_MODE_EXTERNAL
+CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_DEFAULT                     CONFIG_BT_BLE_MEM_ALLOC_MODE_DEFAULT
+CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_IRAM_8BIT                   CONFIG_BT_BLE_MEM_ALLOC_MODE_IRAM_8BIT

+ 1 - 1
components/soc/esp32h2/include/soc/Kconfig.soc_caps.in

@@ -29,7 +29,7 @@ config SOC_BT_SUPPORTED
 
 config SOC_BLUEDROID_SUPPORTED
     bool
-    default n
+    default y
 
 config SOC_ESP_NIMBLE_CONTROLLER
     bool

+ 2 - 2
components/soc/esp32h2/include/soc/soc_caps.h

@@ -39,8 +39,8 @@
 #define SOC_GDMA_SUPPORTED              1
 #define SOC_TWAI_SUPPORTED              1
 #define SOC_BT_SUPPORTED                1
-#define SOC_BLUEDROID_SUPPORTED                0
-#define SOC_ESP_NIMBLE_CONTROLLER   1
+#define SOC_BLUEDROID_SUPPORTED         1
+#define SOC_ESP_NIMBLE_CONTROLLER       1
 #define SOC_ASYNC_MEMCPY_SUPPORTED      1
 #define SOC_USB_SERIAL_JTAG_SUPPORTED   1
 #define SOC_SUPPORTS_SECURE_DL_MODE         1

+ 10 - 0
examples/bluetooth/bluedroid/ble/ble_ancs/sdkconfig.defaults.esp32h2

@@ -0,0 +1,10 @@
+#This file was generated using idf.py save-defconfig. It can be edited manually.
+# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
+#
+CONFIG_IDF_TARGET="esp32h2"
+CONFIG_ESP32H2_RTC_CLK_SRC_EXT_CRYS=y
+CONFIG_ESP32H2_RTC_CLK_CAL_CYCLES=576
+CONFIG_BT_BLUEDROID_ENABLED=y
+CONFIG_BT_NIMBLE_ENABLED=n
+CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
+CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n

+ 10 - 0
examples/bluetooth/bluedroid/ble/gatt_client/sdkconfig.defaults.esp32h2

@@ -0,0 +1,10 @@
+#This file was generated using idf.py save-defconfig. It can be edited manually.
+# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
+#
+CONFIG_IDF_TARGET="esp32h2"
+CONFIG_ESP32H2_RTC_CLK_SRC_EXT_CRYS=y
+CONFIG_ESP32H2_RTC_CLK_CAL_CYCLES=576
+CONFIG_BT_BLUEDROID_ENABLED=y
+CONFIG_BT_NIMBLE_ENABLED=n
+CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
+CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n

+ 10 - 0
examples/bluetooth/bluedroid/ble/gatt_security_client/sdkconfig.defaults.esp32h2

@@ -0,0 +1,10 @@
+#This file was generated using idf.py save-defconfig. It can be edited manually.
+# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
+#
+CONFIG_IDF_TARGET="esp32h2"
+CONFIG_ESP32H2_RTC_CLK_SRC_EXT_CRYS=y
+CONFIG_ESP32H2_RTC_CLK_CAL_CYCLES=576
+CONFIG_BT_BLUEDROID_ENABLED=y
+CONFIG_BT_NIMBLE_ENABLED=n
+CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
+CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n

+ 10 - 0
examples/bluetooth/bluedroid/ble/gatt_security_server/sdkconfig.defaults.esp32h2

@@ -0,0 +1,10 @@
+#This file was generated using idf.py save-defconfig. It can be edited manually.
+# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
+#
+CONFIG_IDF_TARGET="esp32h2"
+CONFIG_ESP32H2_RTC_CLK_SRC_EXT_CRYS=y
+CONFIG_ESP32H2_RTC_CLK_CAL_CYCLES=576
+CONFIG_BT_BLUEDROID_ENABLED=y
+CONFIG_BT_NIMBLE_ENABLED=n
+CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
+CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n

+ 10 - 0
examples/bluetooth/bluedroid/ble/gatt_server/sdkconfig.defaults.esp32h2

@@ -0,0 +1,10 @@
+#This file was generated using idf.py save-defconfig. It can be edited manually.
+# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
+#
+CONFIG_IDF_TARGET="esp32h2"
+CONFIG_ESP32H2_RTC_CLK_SRC_EXT_CRYS=y
+CONFIG_ESP32H2_RTC_CLK_CAL_CYCLES=576
+CONFIG_BT_BLUEDROID_ENABLED=y
+CONFIG_BT_NIMBLE_ENABLED=n
+CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
+CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n

+ 8 - 0
examples/bluetooth/bluedroid/ble_50/ble50_security_client/sdkconfig.defaults.esp32h2

@@ -0,0 +1,8 @@
+#This file was generated using idf.py save-defconfig. It can be edited manually.
+# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
+#
+CONFIG_IDF_TARGET="esp32h2"
+CONFIG_ESP32H2_RTC_CLK_SRC_EXT_CRYS=y
+CONFIG_ESP32H2_RTC_CLK_CAL_CYCLES=576
+CONFIG_BT_BLUEDROID_ENABLED=y
+CONFIG_BT_NIMBLE_ENABLED=n

+ 8 - 0
examples/bluetooth/bluedroid/ble_50/ble50_security_server/sdkconfig.defaults.esp32h2

@@ -0,0 +1,8 @@
+#This file was generated using idf.py save-defconfig. It can be edited manually.
+# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
+#
+CONFIG_IDF_TARGET="esp32h2"
+CONFIG_ESP32H2_RTC_CLK_SRC_EXT_CRYS=y
+CONFIG_ESP32H2_RTC_CLK_CAL_CYCLES=576
+CONFIG_BT_BLUEDROID_ENABLED=y
+CONFIG_BT_NIMBLE_ENABLED=n

+ 10 - 0
examples/bluetooth/nimble/throughput_app/blecent_throughput/sdkconfig.defaults.esp32h2

@@ -0,0 +1,10 @@
+# This file was generated using idf.py save-defconfig. It can be edited manually.
+# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
+#
+CONFIG_IDF_TARGET="esp32h2"
+CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
+CONFIG_BT_ENABLED=y
+CONFIG_BT_NIMBLE_ENABLED=y
+CONFIG_BT_NIMBLE_USE_ESP_TIMER=n
+CONFIG_ESP32H2_RTC_CLK_SRC_EXT_CRYS=y
+CONFIG_ESP32H2_RTC_CLK_CAL_CYCLES=576

+ 10 - 0
examples/bluetooth/nimble/throughput_app/bleprph_throughput/sdkconfig.defaults.esp32h2

@@ -0,0 +1,10 @@
+# This file was generated using idf.py save-defconfig. It can be edited manually.
+# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
+#
+CONFIG_IDF_TARGET="esp32h2"
+CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
+CONFIG_BT_ENABLED=y
+CONFIG_BT_NIMBLE_ENABLED=y
+CONFIG_BT_NIMBLE_USE_ESP_TIMER=n
+CONFIG_ESP32H2_RTC_CLK_SRC_EXT_CRYS=y
+CONFIG_ESP32H2_RTC_CLK_CAL_CYCLES=576