diff mbox

[v5,2/4] util/fifo8: clear fifo head upon reset

Message ID 1391119327-18190-3-git-send-email-b.galvani@gmail.com
State New
Headers show

Commit Message

Beniamino Galvani Jan. 30, 2014, 10:02 p.m. UTC
To improve the predictability of fifo8_pop_buf(), the fifo head is set
to 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>
---
 util/fifo8.c |    1 +
 1 file changed, 1 insertion(+)

Comments

Peter Crosthwaite Feb. 5, 2014, 5:28 a.m. UTC | #1
On Fri, Jan 31, 2014 at 8:02 AM, Beniamino Galvani <b.galvani@gmail.com> wrote:
> To improve the predictability of fifo8_pop_buf(), the fifo head is set
> to start of data buffer upon a reset so that the first call to the

A nit:

"the start of 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>

Thanks for your contributions.

Regards,
Peter

> ---
>  util/fifo8.c |    1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/util/fifo8.c b/util/fifo8.c
> index a7503c2..6a43482 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)
> --
> 1.7.10.4
>
>
diff mbox

Patch

diff --git a/util/fifo8.c b/util/fifo8.c
index a7503c2..6a43482 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)