]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commitdiff
util/fifo8: clear fifo head upon reset
authorBeniamino Galvani <b.galvani@gmail.com>
Thu, 30 Jan 2014 22:02:05 +0000 (23:02 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Sat, 8 Feb 2014 14:50:48 +0000 (14:50 +0000)
To improve the predictability of fifo8_pop_buf(), the fifo head is set
to the start of data buffer upon a reset so that the first call to the
function will be able to retrieve all data in the fifo.

Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
util/fifo8.c

index a7503c22938e351c4f369ca75c10eb9023586325..6a43482c9e12ef1564965a1e5bf12d87740aaba1 100644 (file)
@@ -89,6 +89,7 @@ const uint8_t *fifo8_pop_buf(Fifo8 *fifo, uint32_t max, uint32_t *num)
 void fifo8_reset(Fifo8 *fifo)
 {
     fifo->num = 0;
+    fifo->head = 0;
 }
 
 bool fifo8_is_empty(Fifo8 *fifo)