aboutsummaryrefslogtreecommitdiffstats
path: root/host/tests/rfnoc_chdr_test.cpp
diff options
context:
space:
mode:
authorCiro Nishiguchi <ciro.nishiguchi@ni.com>2019-05-23 20:38:07 -0500
committerMartin Braun <martin.braun@ettus.com>2019-11-26 11:49:29 -0800
commit75a090543b8fb8e7c875387eee6d3fe7227e4450 (patch)
tree2904b48607cc07158aa6b068ada35ab56c4da516 /host/tests/rfnoc_chdr_test.cpp
parentd8e9705bc6c34b8d015b56a76955ee2f15426bd8 (diff)
downloaduhd-75a090543b8fb8e7c875387eee6d3fe7227e4450.tar.gz
uhd-75a090543b8fb8e7c875387eee6d3fe7227e4450.tar.bz2
uhd-75a090543b8fb8e7c875387eee6d3fe7227e4450.zip
rfnoc: add rx and tx transports, and amend rfnoc_graph
transports: Transports build on I/O service and implements flow control and sequence number checking. The rx streamer subclass extends the streamer implementation to connect it to the rfnoc graph. It receives configuration values from property propagation and configures the streamer accordingly. It also implements the issue_stream_cmd rx_streamer API method. Add implementation of rx streamer creation and method to connect it to an rfnoc block. rfnoc_graph: Cache more connection info, clarify contract Summary of changes: - rfnoc_graph stores more information about static connections at the beginning. Some search algorithms are replaced by simpler lookups. - The contract for connect() was clarified. It is required to call connect, even for static connections.
Diffstat (limited to 'host/tests/rfnoc_chdr_test.cpp')
-rw-r--r--host/tests/rfnoc_chdr_test.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/host/tests/rfnoc_chdr_test.cpp b/host/tests/rfnoc_chdr_test.cpp
index 417ed2f96..1c63d5976 100644
--- a/host/tests/rfnoc_chdr_test.cpp
+++ b/host/tests/rfnoc_chdr_test.cpp
@@ -222,3 +222,49 @@ BOOST_AUTO_TEST_CASE(chdr_strc_packet_no_swap_64)
std::cout << pyld.to_string();
}
}
+
+BOOST_AUTO_TEST_CASE(chdr_generic_packet_calculate_pyld_offset_64)
+{
+ // Check calculation without timestamp
+ auto test_pyld_offset = [](chdr_packet::uptr& pkt,
+ const packet_type_t pkt_type,
+ const size_t num_mdata)
+ {
+ uint64_t buff[MAX_BUF_SIZE_WORDS];
+ chdr_header header;
+ header.set_pkt_type(pkt_type);
+ header.set_num_mdata(num_mdata);
+
+ pkt->refresh(reinterpret_cast<void*>(buff), header, 0);
+
+ const size_t pyld_offset = pkt->calculate_payload_offset(
+ pkt_type, num_mdata);
+
+ void* pyld_ptr = pkt->get_payload_ptr();
+
+ const size_t non_pyld_bytes = static_cast<size_t>(
+ reinterpret_cast<uint8_t*>(pyld_ptr) -
+ reinterpret_cast<uint8_t*>(buff));
+
+ BOOST_CHECK(pyld_offset == non_pyld_bytes);
+ };
+
+ {
+ chdr_packet::uptr pkt = chdr64_be_factory.make_generic();
+ test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 0);
+ test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 1);
+ test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 2);
+ test_pyld_offset(pkt, PKT_TYPE_DATA_WITH_TS, 0);
+ test_pyld_offset(pkt, PKT_TYPE_DATA_WITH_TS, 1);
+ test_pyld_offset(pkt, PKT_TYPE_DATA_WITH_TS, 2);
+ }
+ {
+ chdr_packet::uptr pkt = chdr256_be_factory.make_generic();
+ test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 0);
+ test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 1);
+ test_pyld_offset(pkt, PKT_TYPE_DATA_NO_TS, 2);
+ test_pyld_offset(pkt, PKT_TYPE_DATA_WITH_TS, 0);
+ test_pyld_offset(pkt, PKT_TYPE_DATA_WITH_TS, 1);
+ test_pyld_offset(pkt, PKT_TYPE_DATA_WITH_TS, 2);
+ }
+}