From 285925a43bf39e02e85787aacc5a70c23ff6c882 Mon Sep 17 00:00:00 2001 From: baohongde Date: Mon, 23 Sep 2019 18:02:28 +0800 Subject: [PATCH] components:bt: backports release/v3.3 0903 Remove xtensa/xruntime.h Fix sending Lmp_feature_req_ext in a loop Fix 2 bugs in r_ld_fm_sket_isr fix data loss and send same pkt twice sometimes fix adv data error in air sometimes fix adv start/stop crash sometimes Fix connect fail with some speakers clear BT/BLE interruots after controller disable add sco_data_path to be set in sdkconfig and do not reset the value upon HCI reset command --- components/bt/Kconfig | 31 +++++++++++++++++++++++++++---- components/bt/include/esp_bt.h | 7 ++++++- components/bt/lib | 2 +- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/components/bt/Kconfig b/components/bt/Kconfig index 0bb8ad47d9..8ab98406f8 100644 --- a/components/bt/Kconfig +++ b/components/bt/Kconfig @@ -53,6 +53,29 @@ menu Bluetooth BR/EDR Synchronize maximum connections of bluetooth controller. Each connection uses 2KB static DRAM whenever the BT controller is enabled. + choice BTDM_CTRL_BR_EDR_SCO_DATA_PATH + prompt "BR/EDR Sync(SCO/eSCO) default data path" + depends on BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM + default BTDM_CTRL_BR_EDR_SCO_DATA_PATH_PCM + help + SCO data path, i.e. HCI or PCM. + SCO data can be sent/received through HCI synchronous packets, or the data + can be routed to on-chip PCM module on ESP32. PCM input/output signals can + be "matrixed" to GPIOs. The default data path can also be set using API + "esp_bredr_sco_datapath_set" + + config BTDM_CTRL_BR_EDR_SCO_DATA_PATH_HCI + bool "HCI" + config BTDM_CTRL_BR_EDR_SCO_DATA_PATH_PCM + bool "PCM" + endchoice + + config BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF + int + default 0 if BTDM_CTRL_BR_EDR_SCO_DATA_PATH_HCI + default 1 if BTDM_CTRL_BR_EDR_SCO_DATA_PATH_PCM + default 0 + config BTDM_CONTROLLER_BLE_MAX_CONN_EFF int default BTDM_CONTROLLER_BLE_MAX_CONN if BTDM_CONTROLLER_MODE_BLE_ONLY || BTDM_CONTROLLER_MODE_BTDM @@ -390,15 +413,15 @@ menu Bluetooth choice HFP_AUDIO_DATA_PATH prompt "audio(SCO) data path" depends on HFP_ENABLE + help + SCO data path, i.e. HCI or PCM. This option is set using API + "esp_bredr_sco_datapath_set" in Bluetooth host. Default SCO data + path can also be set in Bluetooth Controller. config HFP_AUDIO_DATA_PATH_PCM bool "PCM" - help - This enables the Serial Port Profile config HFP_AUDIO_DATA_PATH_HCI bool "HCI" - help - This enables the Serial Port Profile endchoice config BT_SSP_ENABLED diff --git a/components/bt/include/esp_bt.h b/components/bt/include/esp_bt.h index b098c133d9..1ee7edf952 100644 --- a/components/bt/include/esp_bt.h +++ b/components/bt/include/esp_bt.h @@ -25,7 +25,7 @@ extern "C" { #endif -#define ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL 0x5A5AA5A5 +#define ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL 0x20190506 /** * @brief Bluetooth mode for controller enable/disable @@ -100,6 +100,9 @@ the adv packet will be discarded until the memory is restored. */ #define BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_LIMIT 7 //Maximum ACL connection limitation #define BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_LIMIT 3 //Maximum SCO/eSCO connection limitation +#define BTDM_CONTROLLER_SCO_DATA_PATH_HCI 0 // SCO data is routed to HCI +#define BTDM_CONTROLLER_SCO_DATA_PATH_PCM 1 // SCO data path is PCM + #define BT_CONTROLLER_INIT_CONFIG_DEFAULT() { \ .controller_task_stack_size = ESP_TASK_BT_CONTROLLER_STACK, \ .controller_task_prio = ESP_TASK_BT_CONTROLLER_PRIO, \ @@ -114,6 +117,7 @@ the adv packet will be discarded until the memory is restored. */ .mode = BTDM_CONTROLLER_MODE_EFF, \ .ble_max_conn = CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF, \ .bt_max_acl_conn = CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_EFF, \ + .bt_sco_datapath = CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF, \ .bt_max_sync_conn = CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_EFF, \ .magic = ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL, \ }; @@ -144,6 +148,7 @@ typedef struct { uint8_t mode; /*!< Controller mode: BR/EDR, BLE or Dual Mode */ uint8_t ble_max_conn; /*!< BLE maximum connection numbers */ uint8_t bt_max_acl_conn; /*!< BR/EDR maximum ACL connection numbers */ + uint8_t bt_sco_datapath; /*!< SCO data path, i.e. HCI or PCM module */ /* * Following parameters can not be configured runtime when call esp_bt_controller_init() * It will be overwrite with a constant value which in menuconfig or from a macro. diff --git a/components/bt/lib b/components/bt/lib index 4b35933006..8e73c8d616 160000 --- a/components/bt/lib +++ b/components/bt/lib @@ -1 +1 @@ -Subproject commit 4b359330064adaa7a7f774b129e0d255816534c9 +Subproject commit 8e73c8d616da202265c76719ee9e37f40c7ad161