console: drop data to be send when buffer is already full

Change-Id: Ia625b09eb30bb7b43edd3989f697d8ef33200f28

don't wait for space to be available in the buffer since since would
prevent from processing non-console (e.g. debug) more important data
This commit is contained in:
Kevin Redon 2018-07-03 15:59:51 +02:00
parent 05cc8bd36a
commit b65e4b6823
1 changed files with 8 additions and 10 deletions

View File

@ -133,17 +133,15 @@ extern void UART_PutChar( uint8_t c )
UART_Configure(CONSOLE_BAUDRATE, BOARD_MCK); UART_Configure(CONSOLE_BAUDRATE, BOARD_MCK);
} }
/* Wait until there is space in the buffer */ /* Only store input if buffer is not full, else drop it */
while (rbuf_is_full(&uart_tx_buffer)) { bool trigger_isr = false;
if (pUart->UART_SR & UART_SR_TXEMPTY) { if (rbuf_is_empty(&uart_tx_buffer)) {
pUart->UART_IER = UART_IER_TXRDY; trigger_isr = true;
CONSOLE_ISR();
}
} }
if (!rbuf_is_full(&uart_tx_buffer)) {
/* Put character into buffer */ rbuf_write(&uart_tx_buffer, c);
rbuf_write(&uart_tx_buffer, c); }
if (pUart->UART_SR & UART_SR_TXEMPTY) { if (trigger_isr) {
pUart->UART_IER = UART_IER_TXRDY; pUart->UART_IER = UART_IER_TXRDY;
CONSOLE_ISR(); CONSOLE_ISR();
} }