feat(bt): Add initial support of Bluetooth Classic on ESP32-S31

- feat(soc_caps): Enable BT Classic and BLE in esp32s31
- Add git submodule for ESP32-S31 bt controller lib files
- changed sdkconfig.defaults and README for Bluetooth Classic examples
- change(docs): Added vendor HCI documentations for ESP32-S31
- change(Bluedroid): Adapt to ESP32-S31 due to some API differences on
  Bluetooth controller from ESP32
- change(bt): Modify CMakeLists.txt to support the Bluetooth dual-mode
  architecture on ESP32-S31
- change(bt): Add ECC P-192 functions to tinycrypt
This commit is contained in:
wangmengyang
2026-04-21 17:50:34 +08:00
committed by Wang Mengyang
parent 9c2bde6b64
commit 11268d8bfb
95 changed files with 5312 additions and 165 deletions
@@ -0,0 +1,25 @@
/*
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __ESP_BREDR_PRIV_H__
#define __ESP_BREDR_PRIV_H__
#include "btdm_osal.h"
int bredr_stack_init(esp_bt_controller_config_t *cfg);
void bredr_stack_deinit(void);
int bredr_stack_enable(void);
void bredr_stack_disable(void);
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
esp_err_t sleep_modem_bredr_mac_modem_state_init(void);
#endif // CONFIG_FREERTOS_USE_TICKLESS_IDLE
void bredr_osal_elem_calc(esp_bt_controller_config_t *cfg, btdm_osal_elem_num_t *elem);
#endif // __ESP_BREDR_PRIV_H__
@@ -0,0 +1,216 @@
/*
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "sdkconfig.h"
#include "btdm_user_cfg.h"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(CONFIG_BT_BLUEDROID_ENABLED) && (CONFIG_BT_BLUEDROID_ENABLED) && (CONFIG_BT_HFP_ENABLE) && \
defined(CONFIG_BT_CTRL_BR_EDR_MAX_SYNC_CONN) && (CONFIG_BT_CTRL_BR_EDR_MAX_SYNC_CONN == 0)
#pragma message ("BT: forcing BR/EDR max sync conn eff to 1 (Bluedroid HFP requires SCO/eSCO)")
#define UC_BR_EDR_CTRL_MAX_SYNC_CONN (1)
#elif defined(CONFIG_BT_CTRL_BR_EDR_MAX_SYNC_CONN)
#define UC_BR_EDR_CTRL_MAX_SYNC_CONN (CONFIG_BT_CTRL_BR_EDR_MAX_SYNC_CONN)
#else
#define UC_BR_EDR_CTRL_MAX_SYNC_CONN (0)
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_MAX_ACL_CONN)
#define UC_BR_EDR_MAX_ACL_CONN (CONFIG_BT_CTRL_BR_EDR_MAX_ACL_CONN)
#else
#define UC_BR_EDR_MAX_ACL_CONN (0)
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_TEST_MODE_EN)
#define UC_BR_EDR_TEST_MODE_EN 1
#else
#define UC_BR_EDR_TEST_MODE_EN 0
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_APB_EN) && CONFIG_BT_CTRL_BR_EDR_APB_EN
#define UC_BR_EDR_APB_EN 1
#else
#define UC_BR_EDR_APB_EN 0
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_APB_EXT_BCST_ENC_EN) && CONFIG_BT_CTRL_BR_EDR_APB_EXT_BCST_ENC_EN
#define UC_BR_EDR_APB_EXT_BCST_ENC_EN 1
#else
#define UC_BR_EDR_APB_EXT_BCST_ENC_EN 0
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_APB_EXT_PCA_EN) && CONFIG_BT_CTRL_BR_EDR_APB_EXT_PCA_EN
#define UC_BR_EDR_APB_EXT_PCA_EN 1
#else
#define UC_BR_EDR_APB_EXT_PCA_EN 0
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_LK_STORE_EN) && CONFIG_BT_CTRL_BR_EDR_LK_STORE_EN
#define UC_BR_EDR_LK_STORE_EN 1
#else
#define UC_BR_EDR_LK_STORE_EN 0
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_TX_CCA_ENABLED)
#define UC_BR_EDR_TX_CCA_EN (CONFIG_BT_CTRL_BR_EDR_TX_CCA_ENABLED)
#else
#define UC_BR_EDR_TX_CCA_EN (0)
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_CCA_RSSI_THRESH)
#define UC_BR_EDR_CCA_RSSI_THRESH (CONFIG_BT_CTRL_BR_EDR_CCA_RSSI_THRESH)
#else
#define UC_BR_EDR_CCA_RSSI_THRESH (50)
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_ACLU_TX_BUF_NB)
#define UC_BR_EDR_ACLU_TX_BUF_NB (CONFIG_BT_CTRL_BR_EDR_ACLU_TX_BUF_NB)
#else
#define UC_BR_EDR_ACLU_TX_BUF_NB (0)
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_DYNAMIC_ACLU_TX_BUF_NB)
#define UC_BR_EDR_DYNAMIC_ACLU_TX_BUF_NB (CONFIG_BT_CTRL_BR_EDR_DYNAMIC_ACLU_TX_BUF_NB)
#else
#define UC_BR_EDR_DYNAMIC_ACLU_TX_BUF_NB (0)
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_ESCO_EV4_SUPP) && CONFIG_BT_CTRL_BR_EDR_ESCO_EV4_SUPP
#define UC_BR_EDR_ESCO_EV4_SUPP (1)
#else
#define UC_BR_EDR_ESCO_EV4_SUPP (0)
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_ESCO_EV5_SUPP) && CONFIG_BT_CTRL_BR_EDR_ESCO_EV5_SUPP
#define UC_BR_EDR_ESCO_EV5_SUPP (1)
#else
#define UC_BR_EDR_ESCO_EV5_SUPP (0)
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_ESCO_EV3_2_SUPP) && CONFIG_BT_CTRL_BR_EDR_ESCO_EV3_2_SUPP
#define UC_BR_EDR_ESCO_EV3_2_SUPP (1)
#else
#define UC_BR_EDR_ESCO_EV3_2_SUPP (0)
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_ESCO_EV3_3_SUPP) && CONFIG_BT_CTRL_BR_EDR_ESCO_EV3_3_SUPP
#define UC_BR_EDR_ESCO_EV3_3_SUPP (1)
#else
#define UC_BR_EDR_ESCO_EV3_3_SUPP (0)
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_ESCO_3_SLOTS_SUPP) && CONFIG_BT_CTRL_BR_EDR_ESCO_3_SLOTS_SUPP
#define UC_BR_EDR_ESCO_3_SLOTS_SUPP (1)
#else
#define UC_BR_EDR_ESCO_3_SLOTS_SUPP (0)
#endif
#if (UC_BR_EDR_CTRL_MAX_SYNC_CONN != 0) && defined(CONFIG_BT_CTRL_BR_EDR_SYNC_TX_BUF_NB)
#define UC_BR_EDR_SYNC_TX_BUF_NB (CONFIG_BT_CTRL_BR_EDR_SYNC_TX_BUF_NB)
#else
#define UC_BR_EDR_SYNC_TX_BUF_NB (0)
#endif
#if (UC_BR_EDR_CTRL_MAX_SYNC_CONN != 0) && defined(CONFIG_BT_CTRL_BR_EDR_SYNC_RX_BUF_NB)
#define UC_BR_EDR_SYNC_RX_BUF_NB (CONFIG_BT_CTRL_BR_EDR_SYNC_RX_BUF_NB)
#else
#define UC_BR_EDR_SYNC_RX_BUF_NB (0)
#endif
#if (UC_BR_EDR_MAX_ACL_CONN != 0) && defined(CONFIG_BT_CTRL_BR_EDR_ACLU_RX_BUF_NB)
#define UC_BR_EDR_ACLU_RX_BUF_NB (CONFIG_BT_CTRL_BR_EDR_ACLU_RX_BUF_NB)
#else
#define UC_BR_EDR_ACLU_RX_BUF_NB (0)
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_CPB_TX_EN) && CONFIG_BT_CTRL_BR_EDR_CPB_TX_EN
#define UC_BR_EDR_CPB_TX_LINK_NB (1)
#else
#define UC_BR_EDR_CPB_TX_LINK_NB (0)
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_CPB_RX_EN) && CONFIG_BT_CTRL_BR_EDR_CPB_RX_EN
#define UC_BR_EDR_CPB_RX_LINK_NB (1)
#else
#define UC_BR_EDR_CPB_RX_LINK_NB (0)
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_SCO_DATA_PATH_PCM) && CONFIG_BT_CTRL_BR_EDR_SCO_DATA_PATH_PCM
#define UC_BR_EDR_SCO_DATA_PATH (1)
#else
#define UC_BR_EDR_SCO_DATA_PATH (0)
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_TX_PWR_ACL_MIN)
#define UC_BR_EDR_TX_PWR_ACL_MIN (CONFIG_BT_CTRL_BR_EDR_TX_PWR_ACL_MIN)
#else
#define UC_BR_EDR_TX_PWR_ACL_MIN (0)
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_TX_PWR_ACL_MAX)
#define UC_BR_EDR_TX_PWR_ACL_MAX (CONFIG_BT_CTRL_BR_EDR_TX_PWR_ACL_MAX)
#else
#define UC_BR_EDR_TX_PWR_ACL_MAX (0)
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_APB_EN) && CONFIG_BT_CTRL_BR_EDR_APB_EN && defined(CONFIG_BT_CTRL_BR_EDR_TX_PWR_APB)
#define UC_BR_EDR_TX_PWR_APB (CONFIG_BT_CTRL_BR_EDR_TX_PWR_APB)
#else
#define UC_BR_EDR_TX_PWR_APB (0)
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_TX_PWR_PAGE)
#define UC_BR_EDR_TX_PWR_PAGE (CONFIG_BT_CTRL_BR_EDR_TX_PWR_PAGE)
#else
#define UC_BR_EDR_TX_PWR_PAGE (0)
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_TX_PWR_PSCAN)
#define UC_BR_EDR_TX_PWR_PSCAN (CONFIG_BT_CTRL_BR_EDR_TX_PWR_PSCAN)
#else
#define UC_BR_EDR_TX_PWR_PSCAN (0)
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_TX_PWR_ISCAN)
#define UC_BR_EDR_TX_PWR_ISCAN (CONFIG_BT_CTRL_BR_EDR_TX_PWR_ISCAN)
#else
#define UC_BR_EDR_TX_PWR_ISCAN (0)
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_CPB_TX_EN) && CONFIG_BT_CTRL_BR_EDR_CPB_TX_EN && defined(CONFIG_BT_CTRL_BR_EDR_TX_PWR_CPB)
#define UC_BR_EDR_TX_PWR_CPB (CONFIG_BT_CTRL_BR_EDR_TX_PWR_CPB)
#else
#define UC_BR_EDR_TX_PWR_CPB (0)
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_CPB_TX_EN) && CONFIG_BT_CTRL_BR_EDR_CPB_TX_EN && defined(CONFIG_BT_CTRL_BR_EDR_TX_PWR_STRAIN)
#define UC_BR_EDR_TX_PWR_STRAIN (CONFIG_BT_CTRL_BR_EDR_TX_PWR_STRAIN)
#else
#define UC_BR_EDR_TX_PWR_STRAIN (0)
#endif
#if defined(CONFIG_BT_CTRL_BR_EDR_LEGACY_AUTH_VENDOR_EVT) && CONFIG_BT_CTRL_BR_EDR_LEGACY_AUTH_VENDOR_EVT
#define UC_BR_EDR_LEGACY_AUTH_VENDOR_EVT (1)
#else
#define UC_BR_EDR_LEGACY_AUTH_VENDOR_EVT (0)
#endif
#define UC_BR_EDR_BASIC_VENDOR (1)
#ifdef __cplusplus
}
#endif