]> granicus.if.org Git - esp-idf/commitdiff
Fix uart tx function block issue
authorWangjialin <wangjialin@espressif.com>
Wed, 12 Apr 2017 08:57:37 +0000 (16:57 +0800)
committerWangjialin <wangjialin@espressif.com>
Wed, 12 Apr 2017 08:57:37 +0000 (16:57 +0800)
To enable tx empty interrupt each time the tx ringbuffer get filled, so that tx function will not block if tx data length is larger than tx ringbuffer size.
Reported from customer of Audio team.

components/driver/uart.c

index 78add6d2d04c2b2cec13a7d1d624d5c6e9e4185e..3787e05c9555dee830d721dde1073b98563d1097 100644 (file)
@@ -806,9 +806,9 @@ static int uart_tx_all(uart_port_t uart_num, const char* src, size_t size, bool
             xRingbufferSend(p_uart_obj[uart_num]->tx_ring_buf, (void*) (src + offset), send_size, portMAX_DELAY);
             size -= send_size;
             offset += send_size;
+            uart_enable_tx_intr(uart_num, 1, UART_EMPTY_THRESH_DEFAULT);
         }
         xSemaphoreGive(p_uart_obj[uart_num]->tx_mux);
-        uart_enable_tx_intr(uart_num, 1, UART_EMPTY_THRESH_DEFAULT);
     } else {
         while(size) {
             //semaphore for tx_fifo available