mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
Merge branch 'feat/support_blecrt_515_v5.3' into 'release/v5.3'
feat(bt/bluedroid): Support get allocated heap size (v5.3) See merge request espressif/esp-idf!44861
This commit is contained in:
@@ -404,6 +404,14 @@ menu "Bluedroid debug option"
|
||||
help
|
||||
Bluedroid memory debug
|
||||
|
||||
config BT_BLUEDROID_MEM_STATS
|
||||
bool "Bluedroid memory statistics"
|
||||
depends on BT_BLUEDROID_ENABLED
|
||||
depends on !BT_BLUEDROID_MEM_DEBUG
|
||||
default n
|
||||
help
|
||||
Enable Bluedroid memory usage statistics
|
||||
|
||||
config BT_BLUEDROID_THREAD_DEBUG
|
||||
bool "Bluedroid thread debug"
|
||||
depends on BT_BLUEDROID_ENABLED
|
||||
|
||||
@@ -138,6 +138,13 @@ esp_err_t esp_bluedroid_init_with_cfg(esp_bluedroid_config_t *cfg)
|
||||
osi_mem_dbg_init();
|
||||
#endif
|
||||
|
||||
#if HEAP_MEMORY_STATS
|
||||
if (osi_mem_init() != 0) {
|
||||
LOG_ERROR("Bluedroid Initialize Fail");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = bluedroid_config_init(cfg);
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
LOG_ERROR("Bluedroid stack initialize fail, ret:%d", ret);
|
||||
@@ -228,6 +235,10 @@ esp_err_t esp_bluedroid_deinit(void)
|
||||
bt_hci_log_deinit();
|
||||
#endif // (BT_HCI_LOG_INCLUDED == TRUE)
|
||||
|
||||
#if HEAP_MEMORY_STATS
|
||||
osi_mem_deinit();
|
||||
#endif
|
||||
|
||||
s_bt_host_state = ESP_BLUEDROID_STATUS_UNINITIALIZED;
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
@@ -666,7 +666,7 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
|
||||
}
|
||||
#endif
|
||||
pkt_size = BT_PKT_LINKED_HDR_SIZE + BT_HDR_SIZE + len;
|
||||
#if HEAP_MEMORY_DEBUG
|
||||
#if (HEAP_MEMORY_DEBUG || HEAP_MEMORY_STATS)
|
||||
linked_pkt = (pkt_linked_item_t *) osi_calloc(pkt_size);
|
||||
#else
|
||||
linked_pkt = (pkt_linked_item_t *) osi_calloc_base(pkt_size);
|
||||
|
||||
Reference in New Issue
Block a user