diff options
Diffstat (limited to 'src/sbefw/core/sbeConsole.C')
-rw-r--r-- | src/sbefw/core/sbeConsole.C | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/src/sbefw/core/sbeConsole.C b/src/sbefw/core/sbeConsole.C index d3d3f3f6..a79974f2 100644 --- a/src/sbefw/core/sbeConsole.C +++ b/src/sbefw/core/sbeConsole.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER sbe Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2018 */ +/* Contributors Listed Below - COPYRIGHT 2018,2020 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -165,7 +165,9 @@ static void uartPutChar(char c) { #define SBE_FUNC "uartPutChar" uint32_t rc = SBE_SEC_OPERATION_SUCCESSFUL; - do { + static unsigned char tx_room = 16; + if(tx_room < 1) + { static const uint64_t DELAY_NS = 100; static const uint64_t DELAY_LOOPS = 100000000; @@ -188,27 +190,21 @@ static void uartPutChar(char c) if(rc != SBE_SEC_OPERATION_SUCCESSFUL) { SBE_ERROR(SBE_FUNC " LSR read error."); - break; - } - if(data == LSR_BAD) - { + } else if(data == LSR_BAD) { SBE_ERROR(SBE_FUNC " LSR_BAD data error."); - break; - } - if(loops >= DELAY_LOOPS) - { + } else if(loops >= DELAY_LOOPS) { SBE_ERROR(SBE_FUNC " FIFO timeout."); - break; - } - - rc = writeReg(THR, c); - if(rc != SBE_SEC_OPERATION_SUCCESSFUL) - { - SBE_ERROR(SBE_FUNC " failure to write THR"); - break; + } else { + tx_room = 16; } + } - } while(0); + rc = writeReg(THR, c); + if(rc != SBE_SEC_OPERATION_SUCCESSFUL) { + SBE_ERROR(SBE_FUNC " failure to write THR"); + } else { + tx_room--; + } #undef SBE_FUNC } |