[sw] Add uart idle

Combined with tx_empty, this can show when uart has completely sent all
TXFIFO contents to the outside host.

Signed-off-by: Timothy Chen <timothytim@google.com>
diff --git a/sw/device/lib/uart.c b/sw/device/lib/uart.c
index f184916..5fba477 100644
--- a/sw/device/lib/uart.c
+++ b/sw/device/lib/uart.c
@@ -35,6 +35,10 @@
   return !!(REG32(UART_STATUS(0)) & (1 << UART_STATUS_TXEMPTY));
 }
 
+int uart_tx_idle(void) {
+  return !!(REG32(UART_STATUS(0)) & (1 << UART_STATUS_TXIDLE));
+}
+
 void uart_send_str(char *str) {
   while (*str != '\0') {
     uart_send_char(*str++);
diff --git a/sw/device/lib/uart.h b/sw/device/lib/uart.h
index 8a4383f..5c79d68 100644
--- a/sw/device/lib/uart.h
+++ b/sw/device/lib/uart.h
@@ -25,6 +25,7 @@
 void uart_send_str(char *str);
 int uart_rx_empty(void);
 int uart_tx_empty(void);
+int uart_tx_idle(void);
 
 /**
  * Receive a single character from UART