mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
Merge branch 'feat/move_ag_cb_malloc_to_btc_v5.2' into 'release/v5.2'
feat(bt/bluedroid): Moved the memory allocation of HF AG control blocks to BTC module (v5.2) See merge request espressif/esp-idf!29631
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -405,6 +405,13 @@ static void btc_deinit_mem(void) {
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if BTC_HF_INCLUDED == TRUE && HFP_DYNAMIC_MEMORY == TRUE
|
||||||
|
if (hf_local_param_ptr) {
|
||||||
|
osi_free(hf_local_param_ptr);
|
||||||
|
hf_local_param_ptr = NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if BTC_HF_CLIENT_INCLUDED == TRUE && HFP_DYNAMIC_MEMORY == TRUE
|
#if BTC_HF_CLIENT_INCLUDED == TRUE && HFP_DYNAMIC_MEMORY == TRUE
|
||||||
if (hf_client_local_param_ptr) {
|
if (hf_client_local_param_ptr) {
|
||||||
osi_free(hf_client_local_param_ptr);
|
osi_free(hf_client_local_param_ptr);
|
||||||
@ -460,6 +467,13 @@ static bt_status_t btc_init_mem(void) {
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if BTC_HF_INCLUDED == TRUE && HFP_DYNAMIC_MEMORY == TRUE
|
||||||
|
if ((hf_local_param_ptr = (hf_local_param_t *)osi_malloc(BTC_HF_NUM_CB * sizeof(hf_local_param_t))) == NULL) {
|
||||||
|
goto error_exit;
|
||||||
|
}
|
||||||
|
memset((void *)hf_local_param_ptr, 0, BTC_HF_NUM_CB * sizeof(hf_local_param_t));
|
||||||
|
#endif
|
||||||
|
|
||||||
#if BTC_HF_CLIENT_INCLUDED == TRUE && HFP_DYNAMIC_MEMORY == TRUE
|
#if BTC_HF_CLIENT_INCLUDED == TRUE && HFP_DYNAMIC_MEMORY == TRUE
|
||||||
if ((hf_client_local_param_ptr = (hf_client_local_param_t *)osi_malloc(sizeof(hf_client_local_param_t))) == NULL) {
|
if ((hf_client_local_param_ptr = (hf_client_local_param_t *)osi_malloc(sizeof(hf_client_local_param_t))) == NULL) {
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -68,7 +68,7 @@ static UINT16 btc_max_hf_clients = BTC_HF_NUM_CB;
|
|||||||
#if HFP_DYNAMIC_MEMORY == FALSE
|
#if HFP_DYNAMIC_MEMORY == FALSE
|
||||||
static hf_local_param_t hf_local_param[BTC_HF_NUM_CB];
|
static hf_local_param_t hf_local_param[BTC_HF_NUM_CB];
|
||||||
#else
|
#else
|
||||||
static hf_local_param_t *hf_local_param = NULL;
|
hf_local_param_t *hf_local_param_ptr = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (BTM_WBS_INCLUDED == TRUE)
|
#if (BTM_WBS_INCLUDED == TRUE)
|
||||||
@ -318,18 +318,6 @@ bt_status_t btc_hf_init(void)
|
|||||||
|
|
||||||
BTC_TRACE_DEBUG("%s - max_hf_clients=%d", __func__, btc_max_hf_clients);
|
BTC_TRACE_DEBUG("%s - max_hf_clients=%d", __func__, btc_max_hf_clients);
|
||||||
|
|
||||||
#if HFP_DYNAMIC_MEMORY == TRUE
|
|
||||||
if (hf_local_param != NULL) {
|
|
||||||
return BT_STATUS_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((hf_local_param = (hf_local_param_t *)osi_malloc(BTC_HF_NUM_CB * sizeof(hf_local_param_t))) == NULL) {
|
|
||||||
APPL_TRACE_ERROR("%s malloc failed!", __func__);
|
|
||||||
return BT_STATUS_NOMEM;
|
|
||||||
}
|
|
||||||
memset((void *)hf_local_param, 0, BTC_HF_NUM_CB * sizeof(hf_local_param_t));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Invoke the enable service API to the core to set the appropriate service_id
|
/* Invoke the enable service API to the core to set the appropriate service_id
|
||||||
* Internally, the HSP_SERVICE_ID shall also be enabled if HFP is enabled (phone)
|
* Internally, the HSP_SERVICE_ID shall also be enabled if HFP is enabled (phone)
|
||||||
* othwerwise only HSP is enabled (tablet)*/
|
* othwerwise only HSP is enabled (tablet)*/
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -233,6 +233,11 @@ typedef struct
|
|||||||
esp_hf_outgoing_data_cb_t btc_hf_outgoing_data_cb;
|
esp_hf_outgoing_data_cb_t btc_hf_outgoing_data_cb;
|
||||||
} hf_local_param_t;
|
} hf_local_param_t;
|
||||||
|
|
||||||
|
#if HFP_DYNAMIC_MEMORY == TRUE
|
||||||
|
extern hf_local_param_t *hf_local_param_ptr;
|
||||||
|
#define hf_local_param (hf_local_param_ptr)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** BTC HF AG Handle Hub
|
** BTC HF AG Handle Hub
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
Reference in New Issue
Block a user