component/bt : add option to release about 30K from BT if BLE only

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.
This commit is contained in:
Tian Hao 2017-02-21 17:46:59 +08:00
parent 1405fd1fef
commit 55693b1168
4 changed files with 37 additions and 3 deletions

View 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

View File

@ -32,9 +32,14 @@
#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 */

@ -1 +1 @@
Subproject commit dbac82b5c2694f2639161b0a2b3c0bd8c7d3efc5
Subproject commit 9f9f6a004e42519f54555c42a037b8ef25bf2238

View 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