aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/include/uhdlib/rfnoc/tx_async_msg_queue.hpp
diff options
context:
space:
mode:
authorCiro Nishiguchi <ciro.nishiguchi@ni.com>2019-08-08 10:25:20 -0500
committerMartin Braun <martin.braun@ettus.com>2019-11-26 11:49:36 -0800
commitbffef674fbbcd892967017e81515bb76e0b850b5 (patch)
tree8f56eb8548d0fb56094b555ae11d16eb61e6c381 /host/lib/include/uhdlib/rfnoc/tx_async_msg_queue.hpp
parent91e01c484475600fcd659bb433ab86efa5146426 (diff)
downloaduhd-bffef674fbbcd892967017e81515bb76e0b850b5.tar.gz
uhd-bffef674fbbcd892967017e81515bb76e0b850b5.tar.bz2
uhd-bffef674fbbcd892967017e81515bb76e0b850b5.zip
rfnoc: tx_streamer: add support for async messages
Add an async message queue that aggregates errors from multiple sources. Errors can come from the strs packets originating from the stream endpoint or from the radio block through control packets to the host.
Diffstat (limited to 'host/lib/include/uhdlib/rfnoc/tx_async_msg_queue.hpp')
-rw-r--r--host/lib/include/uhdlib/rfnoc/tx_async_msg_queue.hpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/host/lib/include/uhdlib/rfnoc/tx_async_msg_queue.hpp b/host/lib/include/uhdlib/rfnoc/tx_async_msg_queue.hpp
new file mode 100644
index 000000000..181a31754
--- /dev/null
+++ b/host/lib/include/uhdlib/rfnoc/tx_async_msg_queue.hpp
@@ -0,0 +1,49 @@
+//
+// Copyright 2019 Ettus Research, a National Instruments Brand
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+
+#ifndef INCLUDED_LIBUHD_TX_ASYNC_MSG_QUEUE_HPP
+#define INCLUDED_LIBUHD_TX_ASYNC_MSG_QUEUE_HPP
+
+#include <uhd/types/metadata.hpp>
+#include <boost/lockfree/queue.hpp>
+
+namespace uhd { namespace rfnoc {
+
+/*!
+ * Implements queue of async messages originating from the tx data transport
+ * and from the rfnoc graph.
+ */
+class tx_async_msg_queue
+{
+public:
+ using sptr = std::shared_ptr<tx_async_msg_queue>;
+
+ //! Constructor
+ tx_async_msg_queue(size_t capacity);
+
+ /*!
+ * Retrieve async message from queue
+ *
+ * \param async_metadata the metadata to be filled in
+ * \param timeout_ms the timeout in milliseconds to wait for a message
+ * \return true when the async_metadata is valid, false for timeout
+ */
+ bool recv_async_msg(async_metadata_t& async_metadata, int32_t timeout_ms);
+
+ /*!
+ * Push an async message onto the queue
+ *
+ * \param async_metadata the metadata to be pushed
+ */
+ void enqueue(const async_metadata_t& async_metadata);
+
+private:
+ boost::lockfree::queue<async_metadata_t> _queue;
+};
+
+}} // namespace uhd::rfnoc
+
+#endif /* INCLUDED_LIBUHD_TX_ASYNC_MSG_QUEUE_HPP */