]> git.cryptolib.org Git - arm-crypto-lib.git/blobdiff - test_src/uart_i.c
'hardening' infrastucture against toolchain bugs
[arm-crypto-lib.git] / test_src / uart_i.c
index 9fb5a899bb85bc656a03b1c1fb3b963e4f1ae4af..539dc222c81d72d1d145ec73cce4a91750f4060a 100644 (file)
@@ -266,3 +266,14 @@ uint32_t uart_dataavail(uint8_t uartno){
        }
        return(HW_REG(uart_base[uartno]+UARTFR_OFFSET)&_BV(UART_RXFE))?0:1;
 }
+
+
+void uart_flush(uint8_t uartno){
+       if(uartno>UART_MAX){
+               return;
+       }
+       while(circularbytebuffer_cnt(&(uart_tx_buffer[uartno])))
+               ;
+       while((HW_REG(uart_base[uartno]+UARTCTL_OFFSET)&_BV(UART_EOT)) == 0)
+               ;
+}