From b6b507ccfcf31cead47faff4a2ba5550d0469113 Mon Sep 17 00:00:00 2001 From: Trung Tran Date: Fri, 3 Aug 2018 09:09:03 -0700 Subject: uhd: rfnoc: add async message handler --- host/lib/usrp/device3/device3_impl.cpp | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'host/lib/usrp/device3/device3_impl.cpp') diff --git a/host/lib/usrp/device3/device3_impl.cpp b/host/lib/usrp/device3/device3_impl.cpp index d8241ae74..fb74d4712 100644 --- a/host/lib/usrp/device3/device3_impl.cpp +++ b/host/lib/usrp/device3/device3_impl.cpp @@ -186,9 +186,36 @@ void device3_impl::enumerate_rfnoc_blocks( uhd::rfnoc::graph::sptr device3_impl::create_graph(const std::string &name) { - return boost::make_shared( + // Create an async message handler + UHD_LOGGER_TRACE("DEVICE3") << "Creating async message handler for graph `" << name << "'..."; + // FIXME: right now this only can only handle source sid of 0 and xbar local addr of 2. + // This is ok for now because that most of our device has xbard local addr hardcode to 2. + sid_t async_sid(0); + async_sid.set_dst_addr(2); + both_xports_t async_xports = make_transport( + async_sid, + ASYNC_MSG, + //FIXME: only get rx_hints from mb index of 0 + get_rx_hints(0) + ); + UHD_LOGGER_TRACE("DEVICE3") << " Async transport ready." << std::endl; + uhd::rfnoc::async_msg_handler::sptr async_msg_handler = + uhd::rfnoc::async_msg_handler::make( + async_xports.recv, + async_xports.send, + async_xports.send_sid, + async_xports.endianness + ); + UHD_LOGGER_TRACE("DEVICE3") << "Async message has address " << async_xports.send_sid << std::endl; + + // Create the graph + UHD_LOGGER_TRACE("DEVICE3") << "Creating graph `" << name << "'..." << std::endl; + uhd::rfnoc::graph::sptr graph = boost::make_shared( name, - shared_from_this() + shared_from_this(), + async_msg_handler ); + + return graph; } -- cgit v1.2.3