aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/device3/device3_impl.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/device3/device3_impl.hpp')
-rw-r--r--host/lib/usrp/device3/device3_impl.hpp154
1 files changed, 77 insertions, 77 deletions
diff --git a/host/lib/usrp/device3/device3_impl.hpp b/host/lib/usrp/device3/device3_impl.hpp
index e82597b9b..3bf6f6111 100644
--- a/host/lib/usrp/device3/device3_impl.hpp
+++ b/host/lib/usrp/device3/device3_impl.hpp
@@ -11,20 +11,20 @@
#ifndef INCLUDED_DEVICE3_IMPL_HPP
#define INCLUDED_DEVICE3_IMPL_HPP
+#include "../../transport/super_recv_packet_handler.hpp"
+#include "../../transport/super_send_packet_handler.hpp"
+#include <uhd/device3.hpp>
#include <uhd/transport/bounded_buffer.hpp>
-#include <uhd/transport/vrt_if_packet.hpp>
#include <uhd/transport/chdr.hpp>
+#include <uhd/transport/vrt_if_packet.hpp>
#include <uhd/transport/zero_copy.hpp>
-#include <uhd/types/sid.hpp>
-#include <uhd/types/metadata.hpp>
-#include <uhd/types/endianness.hpp>
#include <uhd/types/direction.hpp>
+#include <uhd/types/endianness.hpp>
+#include <uhd/types/metadata.hpp>
+#include <uhd/types/sid.hpp>
#include <uhd/utils/tasks.hpp>
-#include <uhd/device3.hpp>
-#include "../../transport/super_send_packet_handler.hpp"
-#include "../../transport/super_recv_packet_handler.hpp"
-#include <uhdlib/rfnoc/tx_stream_terminator.hpp>
#include <uhdlib/rfnoc/rx_stream_terminator.hpp>
+#include <uhdlib/rfnoc/tx_stream_terminator.hpp>
#include <uhdlib/rfnoc/xports.hpp>
namespace uhd { namespace usrp {
@@ -32,31 +32,33 @@ namespace uhd { namespace usrp {
/***********************************************************************
* Default settings (any device3 may override these)
**********************************************************************/
-static const size_t DEVICE3_RX_FC_REQUEST_FREQ = 32; //per flow-control window
-static const size_t DEVICE3_TX_FC_RESPONSE_FREQ = 8;
-static const size_t DEVICE3_FC_PACKET_LEN_IN_WORDS32 = 2;
-static const size_t DEVICE3_FC_PACKET_COUNT_OFFSET = 0;
-static const size_t DEVICE3_FC_BYTE_COUNT_OFFSET = 1;
-static const size_t DEVICE3_LINE_SIZE = 8;
-
-static const size_t DEVICE3_TX_MAX_HDR_LEN = uhd::transport::vrt::chdr::max_if_hdr_words64 * sizeof(uint64_t); // Bytes
-static const size_t DEVICE3_RX_MAX_HDR_LEN = uhd::transport::vrt::chdr::max_if_hdr_words64 * sizeof(uint64_t); // Bytes
-
-// This class manages the lifetime of the TX async message handler task, transports, and terminator
+static const size_t DEVICE3_RX_FC_REQUEST_FREQ = 32; // per flow-control window
+static const size_t DEVICE3_TX_FC_RESPONSE_FREQ = 8;
+static const size_t DEVICE3_FC_PACKET_LEN_IN_WORDS32 = 2;
+static const size_t DEVICE3_FC_PACKET_COUNT_OFFSET = 0;
+static const size_t DEVICE3_FC_BYTE_COUNT_OFFSET = 1;
+static const size_t DEVICE3_LINE_SIZE = 8;
+
+static const size_t DEVICE3_TX_MAX_HDR_LEN =
+ uhd::transport::vrt::chdr::max_if_hdr_words64 * sizeof(uint64_t); // Bytes
+static const size_t DEVICE3_RX_MAX_HDR_LEN =
+ uhd::transport::vrt::chdr::max_if_hdr_words64 * sizeof(uint64_t); // Bytes
+
+// This class manages the lifetime of the TX async message handler task, transports, and
+// terminator
class device3_send_packet_streamer : public uhd::transport::sph::send_packet_streamer
{
public:
- device3_send_packet_streamer(
- const size_t max_num_samps,
- const uhd::rfnoc::tx_stream_terminator::sptr terminator,
- const both_xports_t data_xport,
- const both_xports_t async_msg_xport
- ) :
- uhd::transport::sph::send_packet_streamer(max_num_samps),
- _terminator(terminator),
- _data_xport(data_xport),
- _async_msg_xport(async_msg_xport)
- {}
+ device3_send_packet_streamer(const size_t max_num_samps,
+ const uhd::rfnoc::tx_stream_terminator::sptr terminator,
+ const both_xports_t data_xport,
+ const both_xports_t async_msg_xport)
+ : uhd::transport::sph::send_packet_streamer(max_num_samps)
+ , _terminator(terminator)
+ , _data_xport(data_xport)
+ , _async_msg_xport(async_msg_xport)
+ {
+ }
~device3_send_packet_streamer()
{
@@ -81,18 +83,19 @@ private:
std::vector<task::sptr> _tx_async_msg_tasks;
};
-// This class manages the lifetime of the RX transports and terminator and provides access to both
+// This class manages the lifetime of the RX transports and terminator and provides access
+// to both
class device3_recv_packet_streamer : public uhd::transport::sph::recv_packet_streamer
{
public:
- device3_recv_packet_streamer(
- const size_t max_num_samps,
- const uhd::rfnoc::rx_stream_terminator::sptr terminator,
- const both_xports_t xport
- ) :
- uhd::transport::sph::recv_packet_streamer(max_num_samps),
- _terminator(terminator),
- _xport(xport) {}
+ device3_recv_packet_streamer(const size_t max_num_samps,
+ const uhd::rfnoc::rx_stream_terminator::sptr terminator,
+ const both_xports_t xport)
+ : uhd::transport::sph::recv_packet_streamer(max_num_samps)
+ , _terminator(terminator)
+ , _xport(xport)
+ {
+ }
~device3_recv_packet_streamer() {}
@@ -111,7 +114,8 @@ private:
both_xports_t _xport;
};
-class device3_impl : public uhd::device3, public boost::enable_shared_from_this<device3_impl>
+class device3_impl : public uhd::device3,
+ public boost::enable_shared_from_this<device3_impl>
{
public:
/***********************************************************************
@@ -120,14 +124,9 @@ public:
typedef uhd::transport::bounded_buffer<uhd::async_metadata_t> async_md_type;
//! The purpose of a transport
- enum xport_type_t {
- CTRL = 0,
- ASYNC_MSG,
- TX_DATA,
- RX_DATA
- };
+ enum xport_type_t { CTRL = 0, ASYNC_MSG, TX_DATA, RX_DATA };
- enum xport_t {AXI, ETH, PCIE};
+ enum xport_t { AXI, ETH, PCIE };
//! Stores all streaming-related options
struct stream_options_t
@@ -145,20 +144,21 @@ public:
, rx_max_len_hdr(DEVICE3_RX_MAX_HDR_LEN)
, rx_fc_request_freq(DEVICE3_RX_FC_REQUEST_FREQ)
, tx_fc_response_freq(DEVICE3_TX_FC_RESPONSE_FREQ)
- {}
+ {
+ }
};
/***********************************************************************
* I/O Interface
**********************************************************************/
- uhd::tx_streamer::sptr get_tx_stream(const uhd::stream_args_t &);
- uhd::rx_streamer::sptr get_rx_stream(const uhd::stream_args_t &);
- bool recv_async_msg(uhd::async_metadata_t &async_metadata, double timeout);
+ uhd::tx_streamer::sptr get_tx_stream(const uhd::stream_args_t&);
+ uhd::rx_streamer::sptr get_rx_stream(const uhd::stream_args_t&);
+ bool recv_async_msg(uhd::async_metadata_t& async_metadata, double timeout);
/***********************************************************************
* Other public APIs
**********************************************************************/
- rfnoc::graph::sptr create_graph(const std::string &name="");
+ rfnoc::graph::sptr create_graph(const std::string& name = "");
protected:
/***********************************************************************
@@ -172,10 +172,10 @@ protected:
**********************************************************************/
// The 'rate' argument is so we can use these as subscribers to rate changes
public: // TODO make these protected again
- void update_rx_streamers(double rate=-1.0);
- void update_tx_streamers(double rate=-1.0);
-protected:
+ void update_rx_streamers(double rate = -1.0);
+ void update_tx_streamers(double rate = -1.0);
+protected:
/***********************************************************************
* Transport-related
**********************************************************************/
@@ -187,17 +187,21 @@ protected:
* The source address in this value is not considered, only the
* destination address.
* \param xport_type Specify which kind of transport this is.
- * \param args Additional arguments for the transport generation. See \ref page_transport
- * for valid arguments.
+ * \param args Additional arguments for the transport generation. See \ref
+ * page_transport for valid arguments.
*/
- virtual uhd::both_xports_t make_transport(
- const uhd::sid_t &address,
+ virtual uhd::both_xports_t make_transport(const uhd::sid_t& address,
const xport_type_t xport_type,
- const uhd::device_addr_t& args
- ) = 0;
+ const uhd::device_addr_t& args) = 0;
- virtual uhd::device_addr_t get_tx_hints(size_t) { return uhd::device_addr_t(); }
- virtual uhd::device_addr_t get_rx_hints(size_t) { return uhd::device_addr_t(); }
+ virtual uhd::device_addr_t get_tx_hints(size_t)
+ {
+ return uhd::device_addr_t();
+ }
+ virtual uhd::device_addr_t get_rx_hints(size_t)
+ {
+ return uhd::device_addr_t();
+ }
//! Is called after a streamer is generated
virtual void post_streamer_hooks(uhd::direction_t) {}
@@ -216,29 +220,25 @@ protected:
* \param chan_args New channel args. Must have same length as chan_ids.
*
*/
- void merge_channel_defs(
- const std::vector<rfnoc::block_id_t> &chan_ids,
- const std::vector<uhd::device_addr_t> &chan_args,
- const uhd::direction_t dir
- );
+ void merge_channel_defs(const std::vector<rfnoc::block_id_t>& chan_ids,
+ const std::vector<uhd::device_addr_t>& chan_args,
+ const uhd::direction_t dir);
/***********************************************************************
* RFNoC-Specific
**********************************************************************/
- void enumerate_rfnoc_blocks(
- size_t device_index,
- size_t n_blocks,
- size_t base_port,
- const uhd::sid_t &base_sid,
- uhd::device_addr_t transport_args
- );
+ void enumerate_rfnoc_blocks(size_t device_index,
+ size_t n_blocks,
+ size_t base_port,
+ const uhd::sid_t& base_sid,
+ uhd::device_addr_t transport_args);
/***********************************************************************
* Members
**********************************************************************/
// TODO: Maybe move these to private
- uhd::dict<std::string, boost::weak_ptr<uhd::rx_streamer> > _rx_streamers;
- uhd::dict<std::string, boost::weak_ptr<uhd::tx_streamer> > _tx_streamers;
+ uhd::dict<std::string, boost::weak_ptr<uhd::rx_streamer>> _rx_streamers;
+ uhd::dict<std::string, boost::weak_ptr<uhd::tx_streamer>> _tx_streamers;
private:
/***********************************************************************