aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorBeniamino Galvani <b.galvani@gmail.com>2014-01-30 23:02:05 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-02-08 14:50:48 +0000
commit58892d4782bf516e8356e3adfe4fc9b10c397b2f (patch)
tree70f8c399ddefcbbeea7aeb49428e0a253a8c46c8 /util
parentc4e57af85272f98c28ccaaace040d2abb0ec85c4 (diff)
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>
Diffstat (limited to 'util')
-rw-r--r--util/fifo8.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/util/fifo8.c b/util/fifo8.c
index a7503c2293..6a43482c9e 100644
--- a/util/fifo8.c
+++ b/util/fifo8.c
@@ -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)