Re: Interrupt driven UART



In article <12jf7bg1ib8f5c8@xxxxxxxxxxxxxxxxxx>,
ms@xxxxxxxxxxxxxxxxxxxxxxxxx says...
"James Beck" <jim@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:MPG.1fa1600d44355be9989d48@xxxxxxxxxxxxxxxxxxxxxxxxxxx
When I think of FIFO I think of a linear system, possibly hardware
based, that may or may not have "wrap around" in the memory pointer
sense.

How can you implement a FIFO without wrapping pointers around?

Like a stack that pushes on one end and pops at the other

Which is a LIFO, not a fifo in my opinion.
The only difference in a LIFO and FIFO is how the data is pulled.
I guess maybe I'm not expressing myself well here.
I am speaking of how you mentally model the queue, not necessarily how
it is physically implemented.

In the end I was really just trying to point out that there will be
times when the pointers into the queue can wrap around at different
times and make doing simple math like
num_in_queue = queue_head - queue_tail
might not work....

Make the operations atomic.

OK, the operations are atomic.
How does that stop the head pointer from wrapping around and pointing at
a lower address that the tail pointer?



.