mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/btdm_some_unallocated_memory' into 'master'
Bugfix/btdm some unallocated memory See merge request espressif/esp-idf!5629
This commit is contained in:
commit
b803c7328a
@ -73,8 +73,8 @@ static bta_hf_client_co_cb_t *bta_hf_client_co_cb_ptr;
|
||||
#define bta_hf_client_co_cb (*bta_hf_client_co_cb_ptr)
|
||||
#endif /* HFP_DYNAMIC_MEMORY == FALSE */
|
||||
|
||||
static UINT8 hf_air_mode;
|
||||
static UINT8 hf_inout_pkt_size;
|
||||
static UINT8 hf_air_mode = BTM_SCO_AIR_MODE_UNKNOWN;
|
||||
static UINT8 hf_inout_pkt_size = 0;
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -223,6 +223,9 @@ void bta_hf_client_sco_co_open(UINT16 handle, UINT8 air_mode, UINT8 inout_pkt_si
|
||||
|
||||
#if (HFP_DYNAMIC_MEMORY == TRUE)
|
||||
error_exit:;
|
||||
hf_air_mode = BTM_SCO_AIR_MODE_UNKNOWN;
|
||||
hf_inout_pkt_size = 0;
|
||||
|
||||
if (bta_hf_client_co_cb_ptr) {
|
||||
osi_free(bta_hf_client_co_cb_ptr);
|
||||
bta_hf_client_co_cb_ptr = NULL;
|
||||
@ -271,6 +274,9 @@ void bta_hf_client_sco_co_close(void)
|
||||
} else {
|
||||
// Nothing to do
|
||||
}
|
||||
|
||||
hf_air_mode = BTM_SCO_AIR_MODE_UNKNOWN;
|
||||
hf_inout_pkt_size = 0;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -129,12 +129,12 @@ void btu_free_core(void)
|
||||
#if (defined(GATT_INCLUDED) && GATT_INCLUDED == true)
|
||||
gatt_free();
|
||||
#endif
|
||||
btm_ble_free();
|
||||
#endif
|
||||
btm_free();
|
||||
#if SMP_INCLUDED == TRUE
|
||||
SMP_Free();
|
||||
#endif
|
||||
btm_ble_free();
|
||||
#endif
|
||||
btm_free();
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -983,6 +983,7 @@ typedef UINT16 tBTM_SCO_CODEC_TYPE;
|
||||
#define BTM_SCO_AIR_MODE_A_LAW 1
|
||||
#define BTM_SCO_AIR_MODE_CVSD 2
|
||||
#define BTM_SCO_AIR_MODE_TRANSPNT 3
|
||||
#define BTM_SCO_AIR_MODE_UNKNOWN 0xFF
|
||||
typedef UINT8 tBTM_SCO_AIR_MODE_TYPE;
|
||||
|
||||
/*******************
|
||||
|
@ -26,7 +26,7 @@ static void bt_app_work_dispatched(bt_app_msg_t *msg);
|
||||
static xQueueHandle s_bt_app_task_queue = NULL;
|
||||
static xTaskHandle s_bt_app_task_handle = NULL;
|
||||
static xTaskHandle s_bt_i2s_task_handle = NULL;
|
||||
static RingbufHandle_t ringbuf_i2s = NULL;;
|
||||
static RingbufHandle_t s_ringbuf_i2s = NULL;;
|
||||
|
||||
bool bt_app_work_dispatch(bt_app_cb_t p_cback, uint16_t event, void *p_params, int param_len, bt_app_copy_cb_t p_copy_cback)
|
||||
{
|
||||
@ -123,18 +123,18 @@ static void bt_i2s_task_handler(void *arg)
|
||||
size_t bytes_written = 0;
|
||||
|
||||
for (;;) {
|
||||
data = (uint8_t *)xRingbufferReceive(ringbuf_i2s, &item_size, (portTickType)portMAX_DELAY);
|
||||
data = (uint8_t *)xRingbufferReceive(s_ringbuf_i2s, &item_size, (portTickType)portMAX_DELAY);
|
||||
if (item_size != 0){
|
||||
i2s_write(0, data, item_size, &bytes_written, portMAX_DELAY);
|
||||
vRingbufferReturnItem(ringbuf_i2s,(void *)data);
|
||||
vRingbufferReturnItem(s_ringbuf_i2s,(void *)data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bt_i2s_task_start_up(void)
|
||||
{
|
||||
ringbuf_i2s = xRingbufferCreate(8 * 1024, RINGBUF_TYPE_BYTEBUF);
|
||||
if(ringbuf_i2s == NULL){
|
||||
s_ringbuf_i2s = xRingbufferCreate(8 * 1024, RINGBUF_TYPE_BYTEBUF);
|
||||
if(s_ringbuf_i2s == NULL){
|
||||
return;
|
||||
}
|
||||
|
||||
@ -149,13 +149,15 @@ void bt_i2s_task_shut_down(void)
|
||||
s_bt_i2s_task_handle = NULL;
|
||||
}
|
||||
|
||||
vRingbufferDelete(ringbuf_i2s);
|
||||
ringbuf_i2s = NULL;
|
||||
if (s_ringbuf_i2s) {
|
||||
vRingbufferDelete(s_ringbuf_i2s);
|
||||
s_ringbuf_i2s = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
size_t write_ringbuf(const uint8_t *data, size_t size)
|
||||
{
|
||||
BaseType_t done = xRingbufferSend(ringbuf_i2s, (void *)data, size, (portTickType)portMAX_DELAY);
|
||||
BaseType_t done = xRingbufferSend(s_ringbuf_i2s, (void *)data, size, (portTickType)portMAX_DELAY);
|
||||
if(done){
|
||||
return size;
|
||||
} else {
|
||||
|
@ -26,7 +26,7 @@ static void bt_app_work_dispatched(bt_app_msg_t *msg);
|
||||
static xQueueHandle s_bt_app_task_queue = NULL;
|
||||
static xTaskHandle s_bt_app_task_handle = NULL;
|
||||
static xTaskHandle s_bt_i2s_task_handle = NULL;
|
||||
static RingbufHandle_t ringbuf_i2s = NULL;;
|
||||
static RingbufHandle_t s_ringbuf_i2s = NULL;;
|
||||
|
||||
bool bt_app_work_dispatch(bt_app_cb_t p_cback, uint16_t event, void *p_params, int param_len, bt_app_copy_cb_t p_copy_cback)
|
||||
{
|
||||
@ -123,18 +123,18 @@ static void bt_i2s_task_handler(void *arg)
|
||||
size_t bytes_written = 0;
|
||||
|
||||
for (;;) {
|
||||
data = (uint8_t *)xRingbufferReceive(ringbuf_i2s, &item_size, (portTickType)portMAX_DELAY);
|
||||
data = (uint8_t *)xRingbufferReceive(s_ringbuf_i2s, &item_size, (portTickType)portMAX_DELAY);
|
||||
if (item_size != 0){
|
||||
i2s_write(0, data, item_size, &bytes_written, portMAX_DELAY);
|
||||
vRingbufferReturnItem(ringbuf_i2s,(void *)data);
|
||||
vRingbufferReturnItem(s_ringbuf_i2s,(void *)data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bt_i2s_task_start_up(void)
|
||||
{
|
||||
ringbuf_i2s = xRingbufferCreate(8 * 1024, RINGBUF_TYPE_BYTEBUF);
|
||||
if(ringbuf_i2s == NULL){
|
||||
s_ringbuf_i2s = xRingbufferCreate(8 * 1024, RINGBUF_TYPE_BYTEBUF);
|
||||
if(s_ringbuf_i2s == NULL){
|
||||
return;
|
||||
}
|
||||
|
||||
@ -149,13 +149,15 @@ void bt_i2s_task_shut_down(void)
|
||||
s_bt_i2s_task_handle = NULL;
|
||||
}
|
||||
|
||||
vRingbufferDelete(ringbuf_i2s);
|
||||
ringbuf_i2s = NULL;
|
||||
if (s_ringbuf_i2s) {
|
||||
vRingbufferDelete(s_ringbuf_i2s);
|
||||
s_ringbuf_i2s = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
size_t write_ringbuf(const uint8_t *data, size_t size)
|
||||
{
|
||||
BaseType_t done = xRingbufferSend(ringbuf_i2s, (void *)data, size, (portTickType)portMAX_DELAY);
|
||||
BaseType_t done = xRingbufferSend(s_ringbuf_i2s, (void *)data, size, (portTickType)portMAX_DELAY);
|
||||
if(done){
|
||||
return size;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user