fix(ble/bluedroid): Fixed BLE build fail when enable dynamic memory and BLE5.0

(cherry picked from commit 94d1a4f1c009031c7623153b885f1f75b39b4555)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
This commit is contained in:
Zhang Hai Peng 2024-11-05 16:13:34 +08:00
parent 740de1465f
commit 0d56d39b0d
2 changed files with 8 additions and 4 deletions

View File

@ -310,7 +310,7 @@ static void btc_deinit_mem(void) {
btc_profile_cb_tab = NULL;
}
#if (BLE_INCLUDED == TRUE)
#if (BLE_42_FEATURE_SUPPORT == TRUE)
if (gl_bta_adv_data_ptr) {
osi_free(gl_bta_adv_data_ptr);
gl_bta_adv_data_ptr = NULL;
@ -320,7 +320,7 @@ static void btc_deinit_mem(void) {
osi_free(gl_bta_scan_rsp_data_ptr);
gl_bta_scan_rsp_data_ptr = NULL;
}
#endif ///BLE_INCLUDED == TRUE
#endif // BLE_42_FEATURE_SUPPORT
#if GATTS_INCLUDED == TRUE && GATT_DYNAMIC_MEMORY == TRUE
if (btc_creat_tab_env_ptr) {
@ -372,7 +372,8 @@ static bt_status_t btc_init_mem(void) {
}
memset((void *)btc_profile_cb_tab, 0, sizeof(void *) * BTC_PID_NUM);
#if (BLE_INCLUDED == TRUE)
#if BTC_DYNAMIC_MEMORY == TRUE
#if (BLE_42_FEATURE_SUPPORT == TRUE)
if ((gl_bta_adv_data_ptr = (tBTA_BLE_ADV_DATA *)osi_malloc(sizeof(tBTA_BLE_ADV_DATA))) == NULL) {
goto error_exit;
}
@ -382,7 +383,8 @@ static bt_status_t btc_init_mem(void) {
goto error_exit;
}
memset((void *)gl_bta_scan_rsp_data_ptr, 0, sizeof(tBTA_BLE_ADV_DATA));
#endif ///BLE_INCLUDED == TRUE
#endif // (BLE_42_FEATURE_SUPPORT == TRUE)
#endif // BTC_DYNAMIC_MEMORY == TRUE
#if GATTS_INCLUDED == TRUE && GATT_DYNAMIC_MEMORY == TRUE
if ((btc_creat_tab_env_ptr = (esp_btc_creat_tab_t *)osi_malloc(sizeof(esp_btc_creat_tab_t))) == NULL) {

View File

@ -11,11 +11,13 @@
#include "esp_gap_ble_api.h"
#if BTC_DYNAMIC_MEMORY == TRUE
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#include "bta/bta_api.h"
extern tBTA_BLE_ADV_DATA *gl_bta_adv_data_ptr;
extern tBTA_BLE_ADV_DATA *gl_bta_scan_rsp_data_ptr;
#define gl_bta_adv_data (*gl_bta_adv_data_ptr)
#define gl_bta_scan_rsp_data (*gl_bta_scan_rsp_data_ptr)
#endif // BLE_42_FEATURE_SUPPORT
#endif
#define BLE_ISVALID_PARAM(x, min, max) (((x) >= (min) && (x) <= (max)))