Change in simtrace2[master]: console: drop data to be send when buffer is already full

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Jul 4 15:44:37 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/9876 )

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

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
---
M firmware/libboard/common/source/uart_console.c
1 file changed, 8 insertions(+), 10 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



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 @@
         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();
     }

-- 
To view, visit https://gerrit.osmocom.org/9876
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia625b09eb30bb7b43edd3989f697d8ef33200f28
Gerrit-Change-Number: 9876
Gerrit-PatchSet: 12
Gerrit-Owner: Kévin Redon <kredon at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180704/e3faddfb/attachment.htm>


More information about the gerrit-log mailing list