]> granicus.if.org Git - esp-idf/commitdiff
component/bt : add option to release about 30K from BT if BLE only
authorTian Hao <tianhao@espressif.com>
Tue, 21 Feb 2017 09:46:59 +0000 (17:46 +0800)
committerTian Hao <tianhao@espressif.com>
Tue, 21 Feb 2017 09:46:59 +0000 (17:46 +0800)
1. later BT/BLE will be separated by BT/BLE macro, but this option should use when user make sure that in BLE only mode.

components/bt/Kconfig
components/bt/bt.c
components/bt/lib
components/esp32/heap_alloc_caps.c

index d2227868cef71af60e1c3bd562df335b93d26127..63dce8d1f93166ddd491beb3c2d1e5f41596bea6 100644 (file)
@@ -17,6 +17,15 @@ config BLUEDROID_MEM_DEBUG
        help
                Bluedroid memory debug
 
+config BT_DRAM_RELEASE
+       bool "Release DRAM from Classic BT controller"
+    depends on BT_ENABLED
+       default n
+       help
+               This option should only be used when BLE only.
+               Open this option will release about 30K DRAM from Classic BT.
+               The released DRAM will be used as system heap memory.
+
 # Memory reserved at start of DRAM for Bluetooth stack
 config BT_RESERVE_DRAM
     hex
index 6a81d11accad9bcbc459f47862ec5c34dae123e9..4943b9acbf8c5aeb692d11ea7015741412621c40 100644 (file)
 
 #if CONFIG_BT_ENABLED
 
+/* Bluetooth system and controller config */
+#define BTDM_CFG_BT_EM_RELEASE      (1<<0)
+#define BTDM_CFG_BT_DATA_RELEASE    (1<<1)
+/* Other reserved for future */
+
 /* not for user call, so don't put to include file */
 extern void btdm_osi_funcs_register(void *osi_funcs);
-extern void btdm_controller_init(void);
+extern void btdm_controller_init(uint32_t config_mask);
 extern void btdm_controller_schedule(void);
 extern void btdm_controller_deinit(void);
 extern int btdm_controller_enable(esp_bt_mode_t mode);
@@ -154,11 +159,25 @@ void esp_vhci_host_register_callback(const esp_vhci_host_callback_t *callback)
     API_vhci_host_register_callback((const vhci_host_callback_t *)callback);
 }
 
+static uint32_t btdm_config_mask_load(void)
+{
+    uint32_t mask = 0x0;
+
+#ifdef CONFIG_BT_DRAM_RELEASE
+    mask |= (BTDM_CFG_BT_EM_RELEASE | BTDM_CFG_BT_DATA_RELEASE);
+#endif
+    return mask;
+}
+
 static void bt_controller_task(void *pvParam)
 {
+    uint32_t btdm_cfg_mask = 0;
+
     btdm_osi_funcs_register(&osi_funcs);
 
-    btdm_controller_init();
+    btdm_cfg_mask = btdm_config_mask_load();
+    btdm_controller_init(btdm_cfg_mask);
+
     btdm_controller_status = ESP_BT_CONTROLLER_STATUS_INITED;
 
     /* Loop */
index dbac82b5c2694f2639161b0a2b3c0bd8c7d3efc5..9f9f6a004e42519f54555c42a037b8ef25bf2238 160000 (submodule)
@@ -1 +1 @@
-Subproject commit dbac82b5c2694f2639161b0a2b3c0bd8c7d3efc5
+Subproject commit 9f9f6a004e42519f54555c42a037b8ef25bf2238
index a4ff870f390136150ba304726af7e24b2d12f533..7d2a26e64eb757d82e5321dcd2708f0d9693c4f1 100644 (file)
@@ -193,8 +193,14 @@ void heap_alloc_caps_init() {
     disable_mem_region((void*)0x3ffe0000, (void*)0x3ffe8000); //knock out ROM data region
 
 #if CONFIG_BT_ENABLED
+#if CONFIG_BT_DRAM_RELEASE
+    disable_mem_region((void*)0x3ffb0000, (void*)0x3ffb3000); //knock out BT data region
+    disable_mem_region((void*)0x3ffb8000, (void*)0x3ffbbb28); //knock out BT data region
+    disable_mem_region((void*)0x3ffbdb28, (void*)0x3ffc0000); //knock out BT data region
+#else
     disable_mem_region((void*)0x3ffb0000, (void*)0x3ffc0000); //knock out BT data region
 #endif
+#endif
 
 #if CONFIG_MEMMAP_TRACEMEM
 #if CONFIG_MEMMAP_TRACEMEM_TWOBANKS