uart_isr: fix interrupts clear
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 22 Oct 2013 17:44:58 +0000 (19:44 +0200)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Wed, 23 Oct 2013 11:04:49 +0000 (13:04 +0200)
software/libbase/uart.c

index dc11d3e7ec167f11b7deed11a799002654f86e35..5b88569bf8c106c9394c730c195e9c8cd98d7086 100644 (file)
@@ -33,9 +33,11 @@ void uart_isr(void)
        if(stat & UART_EV_RX) {
                rx_buf[rx_produce] = uart_rxtx_read();
                rx_produce = (rx_produce + 1) & UART_RINGBUFFER_MASK_RX;
+               uart_ev_pending_write(UART_EV_RX);
        }
 
        if(stat & UART_EV_TX) {
+               uart_ev_pending_write(UART_EV_TX);
                if(tx_level > 0) {
                        uart_rxtx_write(tx_buf[tx_consume]);
                        tx_consume = (tx_consume + 1) & UART_RINGBUFFER_MASK_TX;
@@ -43,8 +45,6 @@ void uart_isr(void)
                } else
                        tx_cts = 1;
        }
-
-       uart_ev_pending_write(stat);
 }
 
 /* Do not use in interrupt handlers! */