From: Octavian Purdila <tavip@google.com>
To: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, stefanst@google.com, pbonzini@redhat.com,
peter.maydell@linaro.org, marcandre.lureau@redhat.com,
berrange@redhat.com, eduardo@habkost.net, luc@lmichel.fr,
damien.hedde@dahe.fr, alistair@alistair23.me, thuth@redhat.com,
philmd@linaro.org, jsnow@redhat.com, crosa@redhat.com,
lvivier@redhat.com
Subject: [PATCH 01/25] fifo32: add peek function
Date: Wed, 18 Sep 2024 12:22:29 -0700 [thread overview]
Message-ID: <20240918192254.3136903-2-tavip@google.com> (raw)
In-Reply-To: <20240918192254.3136903-1-tavip@google.com>
Add fifo32_peek() that returns the first element from the queue
without popping it.
Signed-off-by: Octavian Purdila <tavip@google.com>
---
include/qemu/fifo32.h | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/include/qemu/fifo32.h b/include/qemu/fifo32.h
index 4e9fd1b5ef..9de1807375 100644
--- a/include/qemu/fifo32.h
+++ b/include/qemu/fifo32.h
@@ -140,6 +140,34 @@ static inline uint32_t fifo32_pop(Fifo32 *fifo)
return ret;
}
+/**
+ * fifo32_peek:
+ * @fifo: fifo to peek at
+ *
+ * Returns the value from the FIFO's head without poping it. Behaviour
+ * is undefined if the FIFO is empty. Clients are responsible for
+ * checking for emptiness using fifo32_is_empty().
+ *
+ * Returns: the value from the FIFO's head
+ */
+
+static inline uint32_t fifo32_peek(Fifo32 *fifo)
+{
+ uint32_t ret = 0, num;
+ const uint8_t *buf;
+
+ buf = fifo8_peek_bufptr(&fifo->fifo, 4, &num);
+ if (num != 4) {
+ return ret;
+ }
+
+ for (int i = 0; i < sizeof(uint32_t); i++) {
+ ret |= buf[i] << (i * 8);
+ }
+
+ return ret;
+}
+
/**
* There is no fifo32_pop_buf() because the data is not stored in the buffer
* as a set of native-order words.
--
2.46.0.662.g92d0881bb0-goog
next prev parent reply other threads:[~2024-09-18 19:23 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-18 19:22 [PATCH 00/25] NXP i.MX RT595 Octavian Purdila
2024-09-18 19:22 ` Octavian Purdila [this message]
2024-09-18 19:22 ` [PATCH 02/25] tests/unit: add fifo32 tests Octavian Purdila
2024-09-18 19:22 ` [PATCH 03/25] scripts: add script to generate C header files from SVD XML files Octavian Purdila
2024-09-18 19:22 ` [PATCH 04/25] Add mcux-soc-svd subproject Octavian Purdila
2024-09-18 19:22 ` [PATCH 05/25] hw/misc: add support for flexcomm Octavian Purdila
2024-09-18 19:22 ` [PATCH 06/25] hw/misc/flexcomm.c: add common fifo functionality Octavian Purdila
2024-09-18 19:22 ` [PATCH 07/25] hw/char: add support for flexcomm usart Octavian Purdila
2024-09-18 19:22 ` [PATCH 08/25] hw/i2c: add support for flexcomm i2c Octavian Purdila
2024-09-18 20:17 ` Corey Minyard
2024-09-18 21:04 ` Octavian Purdila
2024-09-18 21:31 ` Corey Minyard
2024-09-18 22:25 ` Octavian Purdila
2024-09-19 9:36 ` Peter Maydell
2024-09-20 18:02 ` Octavian Purdila
2024-09-20 18:09 ` Corey Minyard
2024-09-18 19:22 ` [PATCH 09/25] hw/ssi: add support for flexcomm spi Octavian Purdila
2024-09-18 19:22 ` [PATCH 10/25] hw/misc: add support for RT500's clock controller Octavian Purdila
2024-09-18 19:22 ` [PATCH 11/25] hw/ssi: add support for flexspi Octavian Purdila
2024-09-18 19:22 ` [PATCH 12/25] hw/misc: add support for RT500's reset controller Octavian Purdila
2024-09-18 19:22 ` [PATCH 13/25] hw/arm: add basic support for the RT500 SoC Octavian Purdila
2024-09-18 19:22 ` [PATCH 14/25] hw/arm: add RT595-EVK board Octavian Purdila
2024-09-18 19:22 ` [PATCH 15/25] tests/qtest: add register access macros and functions Octavian Purdila
2024-09-18 19:22 ` [PATCH 16/25] system/qtest: add APIS to check for memory access failures Octavian Purdila
2024-09-18 19:22 ` [PATCH 17/25] tests/qtest: add flexcomm tests Octavian Purdila
2024-09-18 19:22 ` [PATCH 18/25] tests/qtest: add flexcomm usart tests Octavian Purdila
2024-09-18 19:22 ` [PATCH 19/25] hw/misc: add i2c-tester Octavian Purdila
2024-09-18 20:05 ` Corey Minyard
2024-09-18 23:03 ` Octavian Purdila
2024-09-18 23:52 ` Corey Minyard
2024-09-18 19:22 ` [PATCH 20/25] tests/qtest: add tests for flexcomm i2c Octavian Purdila
2024-09-18 19:22 ` [PATCH 21/25] hw/ssi: allow NULL realize callbacks for peripherals Octavian Purdila
2024-09-18 19:22 ` [PATCH 22/25] hw/misc: add spi-tester Octavian Purdila
2024-09-18 19:22 ` [PATCH 23/25] tests/qtest: add tests for flexcomm spi Octavian Purdila
2024-09-18 19:22 ` [PATCH 24/25] systems/qtest: add device clock APIs Octavian Purdila
2024-09-18 19:22 ` [PATCH 25/25] tests/qtest: add tests for RT500's clock controller Octavian Purdila
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240918192254.3136903-2-tavip@google.com \
--to=tavip@google.com \
--cc=alistair@alistair23.me \
--cc=berrange@redhat.com \
--cc=crosa@redhat.com \
--cc=damien.hedde@dahe.fr \
--cc=eduardo@habkost.net \
--cc=jsnow@redhat.com \
--cc=luc@lmichel.fr \
--cc=lvivier@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanst@google.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.