X-Git-Url: https://git.cryptolib.org/?p=arm-crypto-lib.git;a=blobdiff_plain;f=test_src%2Fuart_i.c;h=539dc222c81d72d1d145ec73cce4a91750f4060a;hp=9c002af43f5e8bcbf64c97ea9b0902a6783ad175;hb=a0b23b3327c8bc2ecd7278c95662fdebf6f15d6b;hpb=5e75eafde9b0269aa78395bbeb3e79ff36a1f082 diff --git a/test_src/uart_i.c b/test_src/uart_i.c index 9c002af..539dc22 100644 --- a/test_src/uart_i.c +++ b/test_src/uart_i.c @@ -212,7 +212,7 @@ uint8_t uart_init(uint8_t uartno, uint32_t baudrate, uint8_t databits, uint8_t p } /* uart interrupt enable */ HW_REG(uart_base[uartno]+UARTIM_OFFSET) |= _BV(UART_TXIM) | _BV(UART_RXIM); - HW_REG(ISR_ENABLE_VECTOR+uart_isr_vector[uartno]/32) |= + HW_REG(ISR_ENABLE_VECTOR+4*(uart_isr_vector[uartno]/32)) |= _BV(uart_isr_vector[uartno]%32); HW_REG(uart_base[uartno]+UARTCTL_OFFSET) |= _BV(UART_EOT); @@ -267,11 +267,13 @@ 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(uart_tx_buffer[uartno].fillcount>0){ + while(circularbytebuffer_cnt(&(uart_tx_buffer[uartno]))) + ; + while((HW_REG(uart_base[uartno]+UARTCTL_OFFSET)&_BV(UART_EOT)) == 0) ; - } }