Permalink
Browse files

improvement for libbase uart.c

  uart_isr, when applicable, will reset CSR_UART_STAT after it has
  written new data to the UART module. If the UART module is able
  to finish that request before uart_isr writes to CSR_UART_STAT,
  then uart_isr will end up clearing the wrong event. This prevents
  uart_isr from ever being called again, and stalls all outgoing data
  • Loading branch information...
1 parent 0a5dc08 commit 832e989a21fd86ba16f1e238b280294bee392564 @fpgaminer fpgaminer committed with Xiangfu Liu Feb 10, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 software/libbase/uart.c
View
@@ -48,6 +48,7 @@ static int force_sync;
void uart_isr(void)
{
unsigned int stat = CSR_UART_STAT;
+ CSR_UART_STAT = stat;
if(stat & UART_STAT_RX_EVT) {
rx_buf[rx_produce] = CSR_UART_RXTX;
@@ -62,7 +63,6 @@ void uart_isr(void)
tx_cts = 1;
}
- CSR_UART_STAT = stat;
irq_ack(IRQ_UART);
}

0 comments on commit 832e989

Please sign in to comment.