From bffef674fbbcd892967017e81515bb76e0b850b5 Mon Sep 17 00:00:00 2001 From: Ciro Nishiguchi Date: Thu, 8 Aug 2019 10:25:20 -0500 Subject: 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. --- .../include/uhdlib/rfnoc/tx_async_msg_queue.hpp | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 host/lib/include/uhdlib/rfnoc/tx_async_msg_queue.hpp (limited to 'host/lib/include/uhdlib/rfnoc/tx_async_msg_queue.hpp') 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 +#include + +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; + + //! 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 _queue; +}; + +}} // namespace uhd::rfnoc + +#endif /* INCLUDED_LIBUHD_TX_ASYNC_MSG_QUEUE_HPP */ -- cgit v1.2.3