Merge branch 'feature/btdm_ram_config' into 'master'

Optimize or release memory in bluetooth

1. add option to release about 30K from BT if BLE only
2. later BT/BLE will be separated by BT/BLE macro, but this option should use when user make sure that in BLE only mode.

See merge request !520
This commit is contained in:
Ivan Grokhotkov 2017-02-23 18:21:16 +08:00
commit 36b3963efb
4 changed files with 37 additions and 3 deletions

View file

@ -17,6 +17,15 @@ config BLUEDROID_MEM_DEBUG
help help
Bluedroid memory debug 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 # Memory reserved at start of DRAM for Bluetooth stack
config BT_RESERVE_DRAM config BT_RESERVE_DRAM
hex hex

View file

@ -32,9 +32,14 @@
#if CONFIG_BT_ENABLED #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 */ /* not for user call, so don't put to include file */
extern void btdm_osi_funcs_register(void *osi_funcs); 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_schedule(void);
extern void btdm_controller_deinit(void); extern void btdm_controller_deinit(void);
extern int btdm_controller_enable(esp_bt_mode_t mode); 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); 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) static void bt_controller_task(void *pvParam)
{ {
uint32_t btdm_cfg_mask = 0;
btdm_osi_funcs_register(&osi_funcs); 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; btdm_controller_status = ESP_BT_CONTROLLER_STATUS_INITED;
/* Loop */ /* 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 disable_mem_region((void*)0x3ffe0000, (void*)0x3ffe8000); //knock out ROM data region
#if CONFIG_BT_ENABLED #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 disable_mem_region((void*)0x3ffb0000, (void*)0x3ffc0000); //knock out BT data region
#endif #endif
#endif
#if CONFIG_MEMMAP_TRACEMEM #if CONFIG_MEMMAP_TRACEMEM
#if CONFIG_MEMMAP_TRACEMEM_TWOBANKS #if CONFIG_MEMMAP_TRACEMEM_TWOBANKS