From 85e299b9391b355dd05428f10bb3df5f1cff247a Mon Sep 17 00:00:00 2001 From: Zhao Wei Liang Date: Tue, 24 Dec 2024 15:20:54 +0800 Subject: [PATCH] feat(ble): Support get ble controller free heap size on ESP32-C2 (cherry picked from commit 2cb7d2437bc81124c2cc4a0f4b9e94bac2318f0e) Co-authored-by: zwl --- components/bt/controller/esp32c2/bt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/components/bt/controller/esp32c2/bt.c b/components/bt/controller/esp32c2/bt.c index e2a5e9a5ea..b6bc70531d 100644 --- a/components/bt/controller/esp32c2/bt.c +++ b/components/bt/controller/esp32c2/bt.c @@ -447,6 +447,17 @@ static DRAM_ATTR ble_rtc_slow_clk_src_t s_bt_lpclk_src = BT_SLOW_CLK_SRC_INVALID #define BLE_RTC_DELAY_US (1800) +#define BLE_CONTROLLER_MALLOC_CAPS (MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT|MALLOC_CAP_DMA) +void *malloc_ble_controller_mem(size_t size) +{ + return heap_caps_malloc(size, BLE_CONTROLLER_MALLOC_CAPS); +} + +uint32_t get_ble_controller_free_heap_size(void) +{ + return heap_caps_get_free_size(BLE_CONTROLLER_MALLOC_CAPS); +} + static const struct osi_coex_funcs_t s_osi_coex_funcs_ro = { ._magic = OSI_COEX_MAGIC_VALUE, ._version = OSI_COEX_VERSION,