1
From 1cd0587fee5aee4cdc45607b4547be39a3b99583 Mon Sep 17 00:00:00 2001
2
From: Peter Maydell <peter.maydell@linaro.org>
3
Date: Mon, 5 Aug 2013 16:13:01 +0100
4
Subject: [PATCH 39/70] fifo8: Add support for reading number of bytes in FIFO
6
Add a fifo8_num() function which returns the number
7
of bytes currently in the FIFO.
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
include/qemu/fifo8.h | 10 ++++++++++
12
util/fifo8.c | 5 +++++
13
2 files changed, 15 insertions(+)
15
diff --git a/include/qemu/fifo8.h b/include/qemu/fifo8.h
16
index d318f71..fec175c 100644
17
--- a/include/qemu/fifo8.h
18
+++ b/include/qemu/fifo8.h
19
@@ -86,6 +86,16 @@ bool fifo8_is_empty(Fifo8 *fifo);
21
bool fifo8_is_full(Fifo8 *fifo);
25
+ * @fifo: FIFO to check
27
+ * Return the number of bytes of data currently in the FIFO.
29
+ * Returns: number of bytes of data in FIFO.
31
+uint32_t fifo8_num(Fifo8 *fifo);
33
extern const VMStateDescription vmstate_fifo8;
35
#define VMSTATE_FIFO8(_field, _state) { \
36
diff --git a/util/fifo8.c b/util/fifo8.c
37
index 013e903..75f0f3b 100644
40
@@ -65,6 +65,11 @@ bool fifo8_is_full(Fifo8 *fifo)
41
return (fifo->num == fifo->capacity);
44
+uint32_t fifo8_num(Fifo8 *fifo)
49
const VMStateDescription vmstate_fifo8 = {