mirror of
https://github.com/espressif/esp-idf
synced 2025-03-10 01:29:21 -04:00
fix(bt/bluedroid): Added dynamic memory allocation for HFP control blocks
This commit is contained in:
parent
86f06e0560
commit
886a0cfe84
@ -66,7 +66,7 @@ static UINT16 btc_max_hf_clients = BTC_HF_NUM_CB;
|
||||
#if HFP_DYNAMIC_MEMORY == FALSE
|
||||
static hf_local_param_t hf_local_param[BTC_HF_NUM_CB];
|
||||
#else
|
||||
static hf_local_param_t *hf_local_param;
|
||||
static hf_local_param_t *hf_local_param = NULL;
|
||||
#endif
|
||||
|
||||
#if (BTM_WBS_INCLUDED == TRUE)
|
||||
@ -315,6 +315,19 @@ bt_status_t btc_hf_init(void)
|
||||
int idx = 0;
|
||||
|
||||
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
|
||||
* Internally, the HSP_SERVICE_ID shall also be enabled if HFP is enabled (phone)
|
||||
* othwerwise only HSP is enabled (tablet)*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user