fix bta_dm_deinit_cb
This commit is contained in:
parent
5895ecff50
commit
026cec78e9
3 changed files with 16 additions and 1 deletions
|
@ -323,6 +323,9 @@ void bta_dm_deinit_cb(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
memset(&bta_dm_cb, 0, sizeof(bta_dm_cb));
|
memset(&bta_dm_cb, 0, sizeof(bta_dm_cb));
|
||||||
|
#if BTA_DYNAMIC_MEMORY
|
||||||
|
xSemaphoreGive(deinit_semaphore);
|
||||||
|
#endif /* #if BTA_DYNAMIC_MEMORY */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#define BTA_DM_INT_H
|
#define BTA_DM_INT_H
|
||||||
|
|
||||||
#include "common/bt_target.h"
|
#include "common/bt_target.h"
|
||||||
|
#include "freertos/semphr.h"
|
||||||
#if (BLE_INCLUDED == TRUE && (defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE))
|
#if (BLE_INCLUDED == TRUE && (defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE))
|
||||||
#include "bta/bta_gatt_api.h"
|
#include "bta/bta_gatt_api.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -1191,6 +1191,7 @@ extern tBTA_DM_DI_CB bta_dm_di_cb;
|
||||||
#else
|
#else
|
||||||
extern tBTA_DM_DI_CB *bta_dm_di_cb_ptr;
|
extern tBTA_DM_DI_CB *bta_dm_di_cb_ptr;
|
||||||
#define bta_dm_di_cb (*bta_dm_di_cb_ptr)
|
#define bta_dm_di_cb (*bta_dm_di_cb_ptr)
|
||||||
|
SemaphoreHandle_t deinit_semaphore;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern BOOLEAN bta_dm_sm_execute(BT_HDR *p_msg);
|
extern BOOLEAN bta_dm_sm_execute(BT_HDR *p_msg);
|
||||||
|
|
|
@ -67,11 +67,18 @@ static void btc_init_bluetooth(void)
|
||||||
//load the ble local key which has been stored in the flash
|
//load the ble local key which has been stored in the flash
|
||||||
btc_dm_load_ble_local_keys();
|
btc_dm_load_ble_local_keys();
|
||||||
#endif /* #if (SMP_INCLUDED) */
|
#endif /* #if (SMP_INCLUDED) */
|
||||||
|
#if BTA_DYNAMIC_MEMORY
|
||||||
|
deinit_semaphore = xSemaphoreCreateBinary();
|
||||||
|
#endif /* #if BTA_DYNAMIC_MEMORY */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void btc_deinit_bluetooth(void)
|
static void btc_deinit_bluetooth(void)
|
||||||
{
|
{
|
||||||
|
/* Wait for the disable operation to complete */
|
||||||
|
#if BTA_DYNAMIC_MEMORY
|
||||||
|
xSemaphoreTake(deinit_semaphore, BTA_DISABLE_DELAY / portTICK_PERIOD_MS);
|
||||||
|
#endif /* #if BTA_DYNAMIC_MEMORY */
|
||||||
btc_gap_ble_deinit();
|
btc_gap_ble_deinit();
|
||||||
bta_dm_sm_deinit();
|
bta_dm_sm_deinit();
|
||||||
#if (GATTC_INCLUDED)
|
#if (GATTC_INCLUDED)
|
||||||
|
@ -87,6 +94,10 @@ static void btc_deinit_bluetooth(void)
|
||||||
osi_alarm_deinit();
|
osi_alarm_deinit();
|
||||||
osi_alarm_delete_mux();
|
osi_alarm_delete_mux();
|
||||||
future_ready(*btc_main_get_future_p(BTC_MAIN_DEINIT_FUTURE), FUTURE_SUCCESS);
|
future_ready(*btc_main_get_future_p(BTC_MAIN_DEINIT_FUTURE), FUTURE_SUCCESS);
|
||||||
|
#if BTA_DYNAMIC_MEMORY
|
||||||
|
vSemaphoreDelete(deinit_semaphore);
|
||||||
|
deinit_semaphore = NULL;
|
||||||
|
#endif /* #if BTA_DYNAMIC_MEMORY */
|
||||||
}
|
}
|
||||||
|
|
||||||
void btc_main_call_handler(btc_msg_t *msg)
|
void btc_main_call_handler(btc_msg_t *msg)
|
||||||
|
|
Loading…
Reference in a new issue