Procházet zdrojové kódy

component/bt: add Kconfig option "CLASSIC_BT_ENABLED"

wangmengyang před 9 roky
rodič
revize
b2f52dd22e

+ 7 - 0
components/bt/Kconfig

@@ -17,6 +17,13 @@ config BLUEDROID_MEM_DEBUG
 	help
 		Bluedroid memory debug
 
+config CLASSIC_BT_ENABLED
+	bool "Classic Bluetooth"
+    depends on BT_ENABLED
+	default n
+	help
+		BT_DRAM_RELEASE should be set TRUE if Classic Bluetooth is enabled
+
 config BT_DRAM_RELEASE
 	bool "Release DRAM from Classic BT controller"
     depends on BT_ENABLED

+ 2 - 2
components/bt/bluedroid/bta/dm/bta_dm_act.c

@@ -4111,7 +4111,7 @@ static UINT8 bta_dm_ble_smp_cback (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_D
     memset(&sec_event, 0, sizeof(tBTA_DM_SEC));
     switch (event) {
     case BTM_LE_IO_REQ_EVT:
-#if (BTM_LOCAL_IO_CAPS != BTM_IO_CAP_NONE)
+        // #if (BTM_LOCAL_IO_CAPS != BTM_IO_CAP_NONE)
 
         bta_dm_co_ble_io_req(bda,
                              &p_data->io_req.io_cap,
@@ -4120,7 +4120,7 @@ static UINT8 bta_dm_ble_smp_cback (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_D
                              &p_data->io_req.max_key_size,
                              &p_data->io_req.init_keys,
                              &p_data->io_req.resp_keys);
-#endif
+        // #endif
 #if BTM_OOB_INCLUDED == FALSE
         status = BTM_SUCCESS;
 #endif

+ 8 - 4
components/bt/bluedroid/btc/core/btc_task.c

@@ -23,13 +23,15 @@
 #include "btc_gatts.h"
 #include "btc_gattc.h"
 #include "btc_gap_ble.h"
-#include "btc_gap_bt.h"
 #include "btc_blufi_prf.h"
 #include "btc_dm.h"
+#include "bta_gatt_api.h"
+#if CONFIG_CLASSIC_BT_ENABLED
+#include "btc_gap_bt.h"
 #include "btc_profile_queue.h"
 #include "btc_av.h"
 #include "btc_avrc.h"
-#include "bta_gatt_api.h"
+#endif /* #if CONFIG_CLASSIC_BT_ENABLED */
 
 
 static xTaskHandle  xBtcTaskHandle = NULL;
@@ -43,11 +45,13 @@ static btc_func_t profile_tab[BTC_PID_NUM] = {
     [BTC_PID_BLE_HID]   = {NULL, NULL},
     [BTC_PID_SPPLIKE]   = {NULL, NULL},
     [BTC_PID_BLUFI]     = {btc_blufi_call_handler,      btc_blufi_cb_handler    },
-    [BTC_PID_GAP_BT]    = {btc_gap_bt_call_handler,     NULL                    },
     [BTC_PID_DM_SEC]    = {NULL,                        btc_dm_sec_cb_handler   },
+#if CONFIG_CLASSIC_BT_ENABLED
+    [BTC_PID_GAP_BT]    = {btc_gap_bt_call_handler,     NULL                    },
     [BTC_PID_PRF_QUE]   = {btc_profile_queue_handler,   NULL                    },
     [BTC_PID_A2DP]      = {btc_a2dp_call_handler,       btc_a2dp_cb_handler     },
-    [BTC_PID_AVRC]      = {btc_avrc_call_handler,       NULL                    }
+    [BTC_PID_AVRC]      = {btc_avrc_call_handler,       NULL                    },
+#endif /* #if CONFIG_CLASSIC_BT_ENABLED */
 };
 
 /*****************************************************************************

+ 4 - 1
components/bt/bluedroid/btc/include/btc_task.h

@@ -16,6 +16,7 @@
 #define __BTC_TASK_H__
 
 #include <stdint.h>
+#include "bt_target.h"
 #include "bt_defs.h"
 #include "thread.h"
 
@@ -41,11 +42,13 @@ typedef enum {
     BTC_PID_BLE_HID,
     BTC_PID_SPPLIKE,
     BTC_PID_BLUFI,
-    BTC_PID_GAP_BT,
     BTC_PID_DM_SEC,
+#if CONFIG_CLASSIC_BT_ENABLED
+    BTC_PID_GAP_BT,
     BTC_PID_PRF_QUE,
     BTC_PID_A2DP,
     BTC_PID_AVRC,
+#endif  /* CONFIG_CLASSIC_BT_ENABLED */
     BTC_PID_NUM,
 } btc_pid_t; //btc profile id
 

+ 31 - 3
components/bt/bluedroid/include/bt_target.h

@@ -34,16 +34,44 @@
 #include "bdroid_buildcfg.h"
 #endif
 
+#include "sdkconfig.h"
 #include "bt_types.h"   /* This must be defined AFTER buildcfg.h */
 
 /* Include common GKI definitions used by this platform */
 #include "gki_target.h"
 #include "dyn_mem.h"    /* defines static and/or dynamic memory for components */
 
+#if CONFIG_CLASSIC_BT_ENABLED
 
-#ifndef CLASSIC_BT_INCLUDED
-#define CLASSIC_BT_INCLUDED TRUE
-#endif  ///CLASSIC_BT_INCLUDED
+#define BTA_PAN_INCLUDED            FALSE
+#define BTA_HH_INCLUDED             FALSE
+#define BTA_AR_INCLUDED             TRUE
+#define BTA_AV_INCLUDED             TRUE
+#define BTA_AV_SINK_INCLUDED        TRUE
+#define SDP_INCLUDED                TRUE
+#define RFCOMM_INCLUDED             FALSE
+#define PAN_INCLUDED                FALSE
+#define HID_HOST_INCLUDED           FALSE
+#define A2D_INCLUDED                TRUE
+#define AVRC_INCLUDED               TRUE
+#define MCA_INCLUDED                FALSE
+
+#else /* #if CONFIG_CLASSIC_BT_ENABLED */
+
+#define BTA_PAN_INCLUDED            FALSE
+#define BTA_HH_INCLUDED             FALSE
+#define BTA_AR_INCLUDED             FALSE
+#define BTA_AV_INCLUDED             FALSE
+#define BTA_AV_SINK_INCLUDED        FALSE
+#define SDP_INCLUDED                FALSE
+#define RFCOMM_INCLUDED             FALSE
+#define PAN_INCLUDED                FALSE
+#define HID_HOST_INCLUDED           FALSE
+#define A2D_INCLUDED                FALSE
+#define AVRC_INCLUDED               FALSE
+#define MCA_INCLUDED                FALSE
+
+#endif /* #if CONFIG_CLASSIC_BT_ENABLED */
 
 //------------------Added from bdroid_buildcfg.h---------------------
 #ifndef L2CAP_EXTFEA_SUPPORTED_MASK

+ 56 - 0
components/bt/bluedroid/stack/include/dyn_mem.h

@@ -18,6 +18,62 @@
 #ifndef DYN_MEM_H
 #define DYN_MEM_H
 
+#include "sdkconfig.h"
+#if CONFIG_CLASSIC_BT_ENABLED
+
+#define SDP_DYNAMIC_MEMORY         FALSE
+#define RFC_DYNAMIC_MEMORY         FALSE
+#define TCS_DYNAMIC_MEMORY         FALSE
+#define BNEP_DYNAMIC_MEMORY        FALSE
+#define AVDT_DYNAMIC_MEMORY        FALSE
+#define AVCT_DYNAMIC_MEMORY        FALSE
+#define MCA_DYNAMIC_MEMORY         FALSE
+#define A2D_DYNAMIC_MEMORY         FALSE
+#define VDP_DYNAMIC_MEMORY         FALSE
+#define AVRC_DYNAMIC_MEMORY        FALSE
+#define BIP_DYNAMIC_MEMORY         FALSE
+#define BPP_DYNAMIC_MEMORY         FALSE
+#define CTP_DYNAMIC_MEMORY         FALSE
+#define FTP_DYNAMIC_MEMORY         FALSE
+#define HCRP_DYNAMIC_MEMORY        FALSE
+#define HFP_DYNAMIC_MEMORY         FALSE
+#define HID_DYNAMIC_MEMORY         FALSE
+#define HSP2_DYNAMIC_MEMORY        FALSE
+#define ICP_DYNAMIC_MEMORY         FALSE
+#define OPP_DYNAMIC_MEMORY         FALSE
+#define PAN_DYNAMIC_MEMORY         FALSE
+#define SPP_DYNAMIC_MEMORY         FALSE
+#define SLIP_DYNAMIC_MEMORY        FALSE
+#define LLCP_DYNAMIC_MEMORY        FALSE
+
+#else  /* #if CONFIG_CLASSIC_BT_ENABLED */
+
+#define SDP_DYNAMIC_MEMORY         TRUE
+#define RFC_DYNAMIC_MEMORY         TRUE
+#define TCS_DYNAMIC_MEMORY         TRUE
+#define BNEP_DYNAMIC_MEMORY        TRUE
+#define AVDT_DYNAMIC_MEMORY        TRUE
+#define AVCT_DYNAMIC_MEMORY        TRUE
+#define MCA_DYNAMIC_MEMORY         TRUE
+#define A2D_DYNAMIC_MEMORY         TRUE
+#define VDP_DYNAMIC_MEMORY         TRUE
+#define AVRC_DYNAMIC_MEMORY        TRUE
+#define BIP_DYNAMIC_MEMORY         TRUE
+#define BPP_DYNAMIC_MEMORY         TRUE
+#define CTP_DYNAMIC_MEMORY         TRUE
+#define FTP_DYNAMIC_MEMORY         TRUE
+#define HCRP_DYNAMIC_MEMORY        TRUE
+#define HFP_DYNAMIC_MEMORY         TRUE
+#define HID_DYNAMIC_MEMORY         TRUE
+#define HSP2_DYNAMIC_MEMORY        TRUE
+#define ICP_DYNAMIC_MEMORY         TRUE
+#define OPP_DYNAMIC_MEMORY         TRUE
+#define PAN_DYNAMIC_MEMORY         TRUE
+#define SPP_DYNAMIC_MEMORY         TRUE
+#define SLIP_DYNAMIC_MEMORY        TRUE
+#define LLCP_DYNAMIC_MEMORY        TRUE
+
+#endif /* #if CONFIG_CLASSIC_BT_ENABLED */
 /****************************************************************************
 ** Define memory usage for each CORE component (if not defined in bdroid_buildcfg.h)
 **  The default for each component is to use static memory allocations.

+ 1 - 1
components/esp32/include/esp_task.h

@@ -33,7 +33,7 @@
 
 /* Bt contoller Task */
 /* controller */
-#define ESP_TASK_BT_CONTROLLER_PRIO   (ESP_TASK_PRIO_MAX - 1)
+#define ESP_TASK_BT_CONTROLLER_PRIO   (ESP_TASK_PRIO_MAX - 2)
 #ifdef CONFIG_NEWLIB_NANO_FORMAT
 #define BT_TASK_EXTRA_STACK_SIZE      (0)
 #else