aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/libboard
diff options
context:
space:
mode:
authorKévin Redon <kredon@sysmocom.de>2018-07-03 15:59:51 +0200
committerKing Kévin <kingkevin@cuvoodoo.info>2018-07-04 17:10:08 +0200
commit30f90a78fc57ee5ad7b071edf010ca021bf17f46 (patch)
tree93b7d710c7e8199bf80a95e5f741c7380c2857e8 /firmware/libboard
parent7406337a7fe92c8c2e06b0329b22ae76447f3ced (diff)
console: drop data to be send when buffer is already full
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 Change-Id: Ia625b09eb30bb7b43edd3989f697d8ef33200f28
Diffstat (limited to 'firmware/libboard')
-rw-r--r--firmware/libboard/common/source/uart_console.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/firmware/libboard/common/source/uart_console.c b/firmware/libboard/common/source/uart_console.c
index e52cd51..a47ba0c 100644
--- a/firmware/libboard/common/source/uart_console.c
+++ b/firmware/libboard/common/source/uart_console.c
@@ -133,17 +133,15 @@ extern void UART_PutChar( uint8_t c )
UART_Configure(CONSOLE_BAUDRATE, BOARD_MCK);
}
- /* Wait until there is space in the buffer */
- while (rbuf_is_full(&uart_tx_buffer)) {
- if (pUart->UART_SR & UART_SR_TXEMPTY) {
- pUart->UART_IER = UART_IER_TXRDY;
- CONSOLE_ISR();
- }
+ /* Only store input if buffer is not full, else drop it */
+ bool trigger_isr = false;
+ if (rbuf_is_empty(&uart_tx_buffer)) {
+ trigger_isr = true;
}
-
- /* Put character into buffer */
- rbuf_write(&uart_tx_buffer, c);
- if (pUart->UART_SR & UART_SR_TXEMPTY) {
+ if (!rbuf_is_full(&uart_tx_buffer)) {
+ rbuf_write(&uart_tx_buffer, c);
+ }
+ if (trigger_isr) {
pUart->UART_IER = UART_IER_TXRDY;
CONSOLE_ISR();
}