Merge branch 'bugfix/fixed_alloc_fail_when_use_uhci' into 'master'

fix(bluetooth/controller): fixed alloc memory fail when use uhci on ESP32-C6 and ESP32-H2

See merge request espressif/esp-idf!32141
This commit is contained in:
Island 2024-07-17 17:50:36 +08:00
commit 9ca974c8b3

View File

@ -423,6 +423,10 @@ int hci_driver_uart_dma_tx_start(esp_bt_hci_tl_callback_t callback, void *arg)
uart_env.tx.link_head = lldesc_head;
uart_env.tx.callback = callback;
uart_env.tx.arg = arg;
/* The DMA interrupt may have been triggered before setting the tx_state,
* So we set it first.
*/
hci_driver_uart_dma_txstate_set(HCI_TRANS_TX_START);
gdma_start(s_tx_channel, (intptr_t)(uart_env.tx.link_head));
return 0;
} else {
@ -513,6 +517,11 @@ hci_driver_uart_dma_process_task(void *p)
while (true) {
xSemaphoreTake(s_hci_driver_uart_dma_env.process_sem, portMAX_DELAY);
ESP_LOGD(TAG, "task run:%d\n",s_hci_driver_uart_dma_env.hci_tx_state);
/* Process Tx data */
if (s_hci_driver_uart_dma_env.hci_tx_state == HCI_TRANS_TX_IDLE) {
hci_driver_uart_dma_tx_start(hci_driver_uart_dma_send_callback, (void*)&uart_env);
}
if (s_hci_driver_uart_dma_env.rxinfo_mem_exhausted) {
rx_data = (void *)uart_env.rx.link_head->buf;
rx_len = uart_env.rx.link_head->length;
@ -553,14 +562,6 @@ hci_driver_uart_dma_process_task(void *p)
os_memblock_put(s_hci_driver_uart_dma_env.hci_rx_data_pool, rx_data);
}
}
/* Process Tx data */
if (s_hci_driver_uart_dma_env.hci_tx_state == HCI_TRANS_TX_IDLE) {
ret = hci_driver_uart_dma_tx_start(hci_driver_uart_dma_send_callback, (void*)&uart_env);
if (!ret) {
s_hci_driver_uart_dma_env.hci_tx_state = HCI_TRANS_TX_START;
}
}
}
}