This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

UART BUFFER

i have seen some UART code implemented using BUFFER.....
I have donE simple uart program using interrupt with lpc2148........
what is the advantage of using BUFFER

Parents
  • Sometimes, the name round-robin is also used for the ring buffers.

    And the magic with a ring buffer is that data is never moved. Instead, the insert and remove positions are stepped in a circular way. Not needing to move the data when an entry is consumed means that both insert and remove operations are constant-time and not affected by the size of the buffer or the amount of data currently stored in the buffer.

    Another advantage - having a separate insert and remove pointer means that one task (the inserting one) is owning and updating the insert position. Another task (the consumer) is updating the read position. This means that a ring buffer in many situations can insert and remove data without any locking primitives (in some part depending on atomicity for the given hw platform).

    But all this - and more - can be found with a bit of Google usage.

Reply
  • Sometimes, the name round-robin is also used for the ring buffers.

    And the magic with a ring buffer is that data is never moved. Instead, the insert and remove positions are stepped in a circular way. Not needing to move the data when an entry is consumed means that both insert and remove operations are constant-time and not affected by the size of the buffer or the amount of data currently stored in the buffer.

    Another advantage - having a separate insert and remove pointer means that one task (the inserting one) is owning and updating the insert position. Another task (the consumer) is updating the read position. This means that a ring buffer in many situations can insert and remove data without any locking primitives (in some part depending on atomicity for the given hw platform).

    But all this - and more - can be found with a bit of Google usage.

Children