Merge branch 'bugfix/btdm_mem_release' into 'master'

component/bt : fix btdm mem release cause 0x3ffbbb28-0x3ffbdb28 add to region but should not.

See merge request !1660
This commit is contained in:
Jiang Jiang Jian
2017-12-19 17:31:09 +08:00
14 changed files with 50 additions and 25 deletions

View File

@@ -398,10 +398,8 @@ esp_err_t esp_bt_controller_mem_release(esp_bt_mode_t mode)
bool update = true;
intptr_t mem_start, mem_end;
//get the mode which can be released, skip the mode which is running
mode &= ~btdm_controller_get_mode();
if (mode == 0x0) {
return ESP_ERR_INVALID_ARG;
if (btdm_controller_status != ESP_BT_CONTROLLER_STATUS_IDLE) {
return ESP_ERR_INVALID_STATE;
}
//already relesed

View File

@@ -212,20 +212,18 @@ void esp_vhci_host_register_callback(const esp_vhci_host_callback_t *callback);
* it can release the .bbs, .data and other section to heap.
* The total size is about 70k bytes.
*
* If esp_bt_controller_enable(mode) has already been called, calling
* esp_bt_controller_mem_release(ESP_BT_MODE_BTDM) will automatically
* release all memory which is not needed for the currently enabled
* Bluetooth controller mode.
* esp_bt_controller_mem_release(mode) should be called only before esp_bt_controller_init()
* or after esp_bt_controller_deinit().
*
* For example, calling esp_bt_controller_enable(ESP_BT_MODE_BLE) then
* esp_bt_controller_mem_release(ESP_BT_MODE_BTDM) will enable BLE modes
* and release memory only used by BT Classic. Also, call esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT)
* is the same.
* Note that once BT controller memory is released, the process cannot be reversed. It means you can not use the bluetooth
* mode which you have released by this function.
*
* Note that once BT controller memory is released, the process cannot be reversed.
* If your firmware will later upgrade the Bluetooth controller mode (BLE -> BT Classic or disabled -> enabled)
* then do not call this function.
*
* If the app calls esp_bt_controller_enable(ESP_BT_MODE_BLE) to use BLE only then it is safe to call
* esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT) at initialisation time to free unused BT Classic memory.
*
* If user never use bluetooth controller, could call esp_bt_controller_mem_release(ESP_BT_MODE_BTDM)
* before esp_bt_controller_init or after esp_bt_controller_deinit.
*