Skip to content

Commit

Permalink
Merge pull request #201 from sifive/uart-txready
Browse files Browse the repository at this point in the history
Hook up txready in sifive_uart0
  • Loading branch information
nategraff-sifive authored Nov 4, 2019
2 parents c0b0994 + 875aeca commit aab85ab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/drivers/sifive_uart0.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ int __metal_driver_sifive_uart0_rx_interrupt_disable(struct metal_uart *uart) {
int __metal_driver_sifive_uart0_txready(struct metal_uart *uart) {
long control_base = __metal_driver_sifive_uart0_control_base(uart);

return !((UART_REGW(METAL_SIFIVE_UART0_TXDATA) & UART_TXFULL));
return !!((UART_REGW(METAL_SIFIVE_UART0_TXDATA) & UART_TXFULL));
}

int __metal_driver_sifive_uart0_set_tx_watermark(struct metal_uart *uart,
Expand Down Expand Up @@ -107,7 +107,7 @@ size_t __metal_driver_sifive_uart0_get_rx_watermark(struct metal_uart *uart) {
int __metal_driver_sifive_uart0_putc(struct metal_uart *uart, int c) {
long control_base = __metal_driver_sifive_uart0_control_base(uart);

while (!__metal_driver_sifive_uart0_txready(uart)) {
while (__metal_driver_sifive_uart0_txready(uart) != 0) {
/* wait */
}
UART_REGW(METAL_SIFIVE_UART0_TXDATA) = c;
Expand Down Expand Up @@ -221,6 +221,7 @@ __METAL_DEFINE_VTABLE(__metal_driver_vtable_sifive_uart0) = {
.uart.init = __metal_driver_sifive_uart0_init,
.uart.putc = __metal_driver_sifive_uart0_putc,
.uart.getc = __metal_driver_sifive_uart0_getc,
.uart.txready = __metal_driver_sifive_uart0_txready,
.uart.get_baud_rate = __metal_driver_sifive_uart0_get_baud_rate,
.uart.set_baud_rate = __metal_driver_sifive_uart0_set_baud_rate,
.uart.controller_interrupt =
Expand Down

0 comments on commit aab85ab

Please sign in to comment.