aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc/chdr_packet.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/lib/rfnoc/chdr_packet.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/lib/rfnoc/chdr_packet.cpp')
-rw-r--r--host/lib/rfnoc/chdr_packet.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/host/lib/rfnoc/chdr_packet.cpp b/host/lib/rfnoc/chdr_packet.cpp
index 653181c04..d4b7494e2 100644
--- a/host/lib/rfnoc/chdr_packet.cpp
+++ b/host/lib/rfnoc/chdr_packet.cpp
@@ -31,7 +31,7 @@ public:
{
assert(pkt_buff);
_pkt_buff = const_cast<uint64_t*>(reinterpret_cast<const uint64_t*>(pkt_buff));
- _compute_mdata_offset();
+ _mdata_offset = _compute_mdata_offset(get_chdr_header());
}
virtual void refresh(void* pkt_buff, chdr_header& header, uint64_t timestamp = 0)
@@ -42,7 +42,7 @@ public:
if (_has_timestamp(header)) {
_pkt_buff[1] = u64_from_host(timestamp);
}
- _compute_mdata_offset();
+ _mdata_offset = _compute_mdata_offset(get_chdr_header());
}
virtual void update_payload_size(size_t payload_size_bytes)
@@ -115,19 +115,27 @@ public:
+ (chdr_w_stride * (_mdata_offset + get_chdr_header().get_num_mdata())));
}
+ virtual size_t calculate_payload_offset(const packet_type_t pkt_type,
+ const uint8_t num_mdata = 0) const
+ {
+ chdr_header header;
+ header.set_pkt_type(pkt_type);
+ return (_compute_mdata_offset(header) + num_mdata) * chdr_w_bytes;
+ }
+
private:
inline bool _has_timestamp(const chdr_header& header) const
{
return (header.get_pkt_type() == PKT_TYPE_DATA_WITH_TS);
}
- inline void _compute_mdata_offset() const
+ inline size_t _compute_mdata_offset(const chdr_header& header) const
{
// The metadata offset depends on the chdr_w and whether we have a timestamp
if (chdr_w == 64) {
- _mdata_offset = _has_timestamp(get_chdr_header()) ? 2 : 1;
+ return _has_timestamp(header) ? 2 : 1;
} else {
- _mdata_offset = 1;
+ return 1;
}
}