diff options
Diffstat (limited to 'host/lib/include/uhdlib')
-rw-r--r-- | host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp | 2 | ||||
-rw-r--r-- | host/lib/include/uhdlib/rfnoc/chdr_packet.hpp (renamed from host/lib/include/uhdlib/rfnoc/chdr/chdr_packet.hpp) | 10 | ||||
-rw-r--r-- | host/lib/include/uhdlib/rfnoc/chdr_types.hpp (renamed from host/lib/include/uhdlib/rfnoc/chdr/chdr_types.hpp) | 46 | ||||
-rw-r--r-- | host/lib/include/uhdlib/rfnoc/ctrlport_endpoint.hpp | 2 | ||||
-rw-r--r-- | host/lib/include/uhdlib/rfnoc/mb_iface.hpp | 2 | ||||
-rw-r--r-- | host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp | 2 | ||||
-rw-r--r-- | host/lib/include/uhdlib/rfnoc/rfnoc_common.hpp | 59 |
7 files changed, 80 insertions, 43 deletions
diff --git a/host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp b/host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp index 29f4da7c2..b50e06d3c 100644 --- a/host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp +++ b/host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp @@ -7,7 +7,7 @@ #ifndef INCLUDED_LIBUHD_RFNOC_CHDR_CTRL_ENDPOINT_HPP #define INCLUDED_LIBUHD_RFNOC_CHDR_CTRL_ENDPOINT_HPP -#include <uhdlib/rfnoc/chdr/chdr_packet.hpp> +#include <uhdlib/rfnoc/chdr_packet.hpp> #include <uhdlib/rfnoc/ctrlport_endpoint.hpp> #include <uhdlib/rfnoc/xports.hpp> #include <functional> diff --git a/host/lib/include/uhdlib/rfnoc/chdr/chdr_packet.hpp b/host/lib/include/uhdlib/rfnoc/chdr_packet.hpp index 102a6e104..89b33a66a 100644 --- a/host/lib/include/uhdlib/rfnoc/chdr/chdr_packet.hpp +++ b/host/lib/include/uhdlib/rfnoc/chdr_packet.hpp @@ -9,7 +9,7 @@ #include <uhd/types/endianness.hpp> #include <uhd/utils/byteswap.hpp> -#include <uhdlib/rfnoc/chdr/chdr_types.hpp> +#include <uhdlib/rfnoc/chdr_types.hpp> #include <limits> namespace uhd { namespace rfnoc { namespace chdr { @@ -213,7 +213,7 @@ public: payload.deserialize(_chdr_pkt->get_payload_const_ptr_as<uint64_t>(), _chdr_pkt->get_payload_size() / sizeof(uint64_t), _chdr_pkt->conv_to_host<uint64_t>()); - return std::move(payload); + return payload; } //! Fills the CHDR payload into the specified parameter @@ -255,6 +255,12 @@ class chdr_packet_factory { public: //! A parametrized ctor that takes in all the info required to generate a CHDR packet + // + // \param chdr_w The CHDR width of the remote device + // \param endianness The endianness of the link being used (e.g., Ethernet + // typically uses big-endian, PCIe typically uses + // little-endian). Note: The host endianness is + // automatically derived. chdr_packet_factory(chdr_w_t chdr_w, endianness_t endianness); chdr_packet_factory() = delete; chdr_packet_factory(const chdr_packet_factory& rhs) = default; diff --git a/host/lib/include/uhdlib/rfnoc/chdr/chdr_types.hpp b/host/lib/include/uhdlib/rfnoc/chdr_types.hpp index 447e7db91..62b24ab61 100644 --- a/host/lib/include/uhdlib/rfnoc/chdr/chdr_types.hpp +++ b/host/lib/include/uhdlib/rfnoc/chdr_types.hpp @@ -9,46 +9,13 @@ #include <uhd/types/endianness.hpp> #include <uhd/utils/byteswap.hpp> +#include <uhdlib/rfnoc/rfnoc_common.hpp> #include <boost/optional.hpp> #include <list> #include <memory> #include <vector> -namespace uhd { namespace rfnoc { - -enum chdr_w_t { - //! CHDR_W = 64 bits - CHDR_W_64 = 0, - //! CHDR_W = 128 bits - CHDR_W_128 = 1, - //! CHDR_W = 256 bits - CHDR_W_256 = 2, - //! CHDR_W = 512 bits - CHDR_W_512 = 3 -}; - -using device_id_t = uint16_t; -using sep_inst_t = uint16_t; -using sep_addr_t = std::pair<device_id_t, sep_inst_t>; -using sep_id_t = uint16_t; - -constexpr size_t chdr_w_to_bits(chdr_w_t chdr_w) -{ - switch (chdr_w) { - case CHDR_W_64: - return 64; - case CHDR_W_128: - return 128; - case CHDR_W_256: - return 256; - case CHDR_W_512: - return 512; - default: - return 0; - } -} - -namespace chdr { +namespace uhd { namespace rfnoc { namespace chdr { enum packet_type_t { PKT_TYPE_MGMT = 0x0, //! Management packet @@ -832,6 +799,12 @@ public: //! Return a string representation of this object const std::string to_string() const; + //! Return the source EPID for this transaction + inline const sep_id_t get_src_epid() const + { + return _src_epid; + } + private: sep_id_t _src_epid = 0; uint16_t _protover = 0; @@ -839,7 +812,6 @@ private: std::vector<mgmt_hop_t> _hops; }; -} // namespace chdr -}} // namespace uhd::rfnoc +}}} // namespace uhd::rfnoc::chdr #endif /* INCLUDED_RFNOC_CHDR_TYPES_HPP */ diff --git a/host/lib/include/uhdlib/rfnoc/ctrlport_endpoint.hpp b/host/lib/include/uhdlib/rfnoc/ctrlport_endpoint.hpp index 00ebe38b9..8f54932e5 100644 --- a/host/lib/include/uhdlib/rfnoc/ctrlport_endpoint.hpp +++ b/host/lib/include/uhdlib/rfnoc/ctrlport_endpoint.hpp @@ -8,8 +8,8 @@ #define INCLUDED_LIBUHD_RFNOC_CTRLPORT_ENDPOINT_HPP #include <uhd/rfnoc/register_iface.hpp> -#include <uhdlib/rfnoc/chdr/chdr_types.hpp> #include <uhdlib/rfnoc/clock_iface.hpp> +#include <uhdlib/rfnoc/chdr_types.hpp> #include <memory> namespace uhd { namespace rfnoc { diff --git a/host/lib/include/uhdlib/rfnoc/mb_iface.hpp b/host/lib/include/uhdlib/rfnoc/mb_iface.hpp index 466ec0cbf..60afa92fa 100644 --- a/host/lib/include/uhdlib/rfnoc/mb_iface.hpp +++ b/host/lib/include/uhdlib/rfnoc/mb_iface.hpp @@ -7,7 +7,7 @@ #ifndef INCLUDED_LIBUHD_MB_IFACE_HPP #define INCLUDED_LIBUHD_MB_IFACE_HPP -#include <uhdlib/rfnoc/chdr/chdr_types.hpp> +#include <uhdlib/rfnoc/chdr_types.hpp> #include <memory> namespace uhd { namespace rfnoc { diff --git a/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp b/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp index 305f8fb85..09a155fa0 100644 --- a/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp +++ b/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp @@ -7,7 +7,7 @@ #ifndef INCLUDED_LIBUHD_MGMT_PORTAL_HPP #define INCLUDED_LIBUHD_MGMT_PORTAL_HPP -#include <uhdlib/rfnoc/chdr/chdr_types.hpp> +#include <uhdlib/rfnoc/chdr_types.hpp> #include <uhdlib/rfnoc/xports.hpp> #include <memory> diff --git a/host/lib/include/uhdlib/rfnoc/rfnoc_common.hpp b/host/lib/include/uhdlib/rfnoc/rfnoc_common.hpp new file mode 100644 index 000000000..1fee0d40e --- /dev/null +++ b/host/lib/include/uhdlib/rfnoc/rfnoc_common.hpp @@ -0,0 +1,59 @@ +// +// Copyright 2019 Ettus Research, a National Instruments Brand +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#ifndef INCLUDED_RFNOC_RFNOC_COMMON_HPP +#define INCLUDED_RFNOC_RFNOC_COMMON_HPP + +#include <memory> + +namespace uhd { namespace rfnoc { + +//---------------------------------------------- +// Types +//---------------------------------------------- + +//! Type that indicates the CHDR Width in bits +enum chdr_w_t { CHDR_W_64 = 0, CHDR_W_128 = 1, CHDR_W_256 = 2, CHDR_W_512 = 3 }; +//! Conversion from chdr_w_t to a number of bits +constexpr size_t chdr_w_to_bits(chdr_w_t chdr_w) +{ + switch (chdr_w) { + case CHDR_W_64: + return 64; + case CHDR_W_128: + return 128; + case CHDR_W_256: + return 256; + case CHDR_W_512: + return 512; + default: + return 0; + } +} + +//! Device ID Type +using device_id_t = uint16_t; +//! Stream Endpoint Instance Number Type +using sep_inst_t = uint16_t; +//! Stream Endpoint Physical Address Type +using sep_addr_t = std::pair<device_id_t, sep_inst_t>; +//! Stream Endpoint ID Type +using sep_id_t = uint16_t; + +//! Type of data carried by the stream endpoint +enum class sep_type_t { CTRL, DATA }; + + +//---------------------------------------------- +// Constants +//---------------------------------------------- + +constexpr uint16_t RFNOC_PROTO_VER = 0x0100; + + +}} // namespace uhd::rfnoc + +#endif /* INCLUDED_RFNOC_RFNOC_COMMON_HPP */ |