util/fifo8: clear fifo head upon reset

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>
This commit is contained in:
Beniamino Galvani 2014-01-30 23:02:05 +01:00 committed by Peter Maydell
parent c4e57af852
commit 58892d4782
1 changed files with 1 additions and 0 deletions

View 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)