Pārlūkot izejas kodu

Merge branch 'bugfix/keep_sco_data_path_on_hci_reset' into 'master'

Bugfix/keep_sco_data_path_on_hci_reset

See merge request idf/esp-idf!4949
Jiang Jiang Jian 6 gadi atpakaļ
vecāks
revīzija
d95cedd782

+ 10 - 0
components/bt/CMakeLists.txt

@@ -95,6 +95,14 @@ if(CONFIG_BT_ENABLED)
                    "bluedroid/bta/jv/bta_jv_api.c"
                    "bluedroid/bta/jv/bta_jv_cfg.c"
                    "bluedroid/bta/jv/bta_jv_main.c"
+                   "bluedroid/bta/hf_client/bta_hf_client_act.c"
+                   "bluedroid/bta/hf_client/bta_hf_client_api.c"
+                   "bluedroid/bta/hf_client/bta_hf_client_at.c"
+                   "bluedroid/bta/hf_client/bta_hf_client_cmd.c"
+                   "bluedroid/bta/hf_client/bta_hf_client_main.c"
+                   "bluedroid/bta/hf_client/bta_hf_client_rfc.c"
+                   "bluedroid/bta/hf_client/bta_hf_client_sco.c"
+                   "bluedroid/bta/hf_client/bta_hf_client_sdp.c"
                    "bluedroid/bta/sdp/bta_sdp.c"
                    "bluedroid/bta/sdp/bta_sdp_act.c"
                    "bluedroid/bta/sdp/bta_sdp_api.c"
@@ -125,6 +133,8 @@ if(CONFIG_BT_ENABLED)
                    "bluedroid/btc/profile/std/a2dp/btc_av.c"
                    "bluedroid/btc/profile/std/avrc/btc_avrc.c"
                    "bluedroid/btc/profile/std/avrc/bta_avrc_co.c"
+                   "bluedroid/btc/profile/std/hf_client/btc_hf_client.c"
+                   "bluedroid/btc/profile/std/hf_client/bta_hf_client_co.c"
                    "bluedroid/btc/profile/std/gap/btc_gap_ble.c"
                    "bluedroid/btc/profile/std/gap/btc_gap_bt.c"
                    "bluedroid/btc/profile/std/gatt/btc_gatt_common.c"

+ 29 - 4
components/bt/Kconfig

@@ -53,6 +53,31 @@ 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_CTRL_BLE_MAX_CONN_EFF
             int
             default BTDM_CTRL_BLE_MAX_CONN if BTDM_CTRL_MODE_BLE_ONLY || BTDM_CTRL_MODE_BTDM
@@ -432,15 +457,15 @@ menu Bluetooth
     choice BT_HFP_AUDIO_DATA_PATH
         prompt "audio(SCO) data path"
         depends on BT_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 BT_HFP_AUDIO_DATA_PATH_PCM
             bool "PCM"
-            help
-                This enables the Serial Port Profile
         config BT_HFP_AUDIO_DATA_PATH_HCI
             bool "HCI"
-            help
-                This enables the Serial Port Profile
     endchoice
 
     config BT_SSP_ENABLED

+ 7 - 2
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
@@ -115,6 +115,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,                   \
@@ -129,8 +132,9 @@ the adv packet will be discarded until the memory is restored. */
     .mode = BTDM_CONTROLLER_MODE_EFF,                                      \
     .ble_max_conn = CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF,                     \
     .bt_max_acl_conn = CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF,           \
+    .bt_sco_datapath = CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF,          \
     .bt_max_sync_conn = CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF,         \
-    .ble_sca = CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF,                  \
+    .ble_sca = CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF,             \
     .magic = ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL,                           \
 };
 
@@ -160,6 +164,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.

+ 1 - 1
components/bt/lib

@@ -1 +1 @@
-Subproject commit be2b20bbfc75f5644551eae135fa7547f82377aa
+Subproject commit 6834a6bfcfd395acc37249fae1c3121fc2e705cb