Module UARTkstr (v1)


  • String IO procedures
  • HW-buffered (FIFO)
  • Yield control to kernel to await buffer not full on transmit, or buffer not empty on receive.


  • Kernel is required.



  • The current implementation attempts to read and salvage as much input as possible, also with
    • buffer overflow
    • FIFO overrun
  • This implementation could be simplified if we just bail out with these errors, and report back the error. Returning non-complete input may be of questionable value, depending on the use case.
  • Use three subsequent loops:
    • read until either
      • input buffer is full
      • the end-of-line (EOL) character is received
      • a FIFO overrun is detected
    • if FIFO was overrun, but input buffer not yet full, and no EOL was detected
      • read the valid data from the FIFO
    • if EOL was not detected
      • flush input until the terminal stops sending
  • As described here, FIFO overrun happens if the program cannot start to empty the FIFO before the sending terminal has filled it, which is determined by several factors, from program design to baud-rate.

See Also