aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/include
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2019-07-03 20:15:35 -0700
committerMartin Braun <martin.braun@ettus.com>2019-11-26 12:16:25 -0800
commitc256b9df6502536c2e451e690f1ad5962c664d1a (patch)
treea83ad13e6f5978bbe14bb3ecf8294ba1e3d28db4 /host/lib/include
parent9a8435ed998fc5c65257f4c55768750b227ab19e (diff)
downloaduhd-c256b9df6502536c2e451e690f1ad5962c664d1a.tar.gz
uhd-c256b9df6502536c2e451e690f1ad5962c664d1a.tar.bz2
uhd-c256b9df6502536c2e451e690f1ad5962c664d1a.zip
x300/mpmd: Port all RFNoC devices to the new RFNoC framework
Co-Authored-By: Alex Williams <alex.williams@ni.com> Co-Authored-By: Sugandha Gupta <sugandha.gupta@ettus.com> Co-Authored-By: Brent Stapleton <brent.stapleton@ettus.com> Co-Authored-By: Ciro Nishiguchi <ciro.nishiguchi@ni.com>
Diffstat (limited to 'host/lib/include')
-rw-r--r--host/lib/include/uhdlib/usrp/common/apply_corrections.hpp40
-rw-r--r--host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp101
2 files changed, 119 insertions, 22 deletions
diff --git a/host/lib/include/uhdlib/usrp/common/apply_corrections.hpp b/host/lib/include/uhdlib/usrp/common/apply_corrections.hpp
index 3b4669f9a..fca566493 100644
--- a/host/lib/include/uhdlib/usrp/common/apply_corrections.hpp
+++ b/host/lib/include/uhdlib/usrp/common/apply_corrections.hpp
@@ -14,30 +14,26 @@
namespace uhd{ namespace usrp{
- void apply_tx_fe_corrections(
- property_tree::sptr sub_tree, //starts at mboards/x
- const fs_path db_path,
- const fs_path tx_fe_corr_path,
- const double tx_lo_freq //actual lo freq
- );
+void apply_tx_fe_corrections(property_tree::sptr sub_tree, // starts at mboards/x
+ const std::string& db_serial,
+ const fs_path tx_fe_corr_path,
+ const double tx_lo_freq // actual lo freq
+);
- void apply_tx_fe_corrections(
- property_tree::sptr sub_tree, //starts at mboards/x
- const std::string &slot, //name of dboard slot
- const double tx_lo_freq //actual lo freq
- );
- void apply_rx_fe_corrections(
- property_tree::sptr sub_tree, //starts at mboards/x
- const std::string &slot, //name of dboard slot
- const double rx_lo_freq //actual lo freq
- );
+void apply_tx_fe_corrections(property_tree::sptr sub_tree, // starts at mboards/x
+ const std::string& slot, // name of dboard slot
+ const double tx_lo_freq // actual lo freq
+);
+void apply_rx_fe_corrections(property_tree::sptr sub_tree, // starts at mboards/x
+ const std::string& slot, // name of dboard slot
+ const double rx_lo_freq // actual lo freq
+);
- void apply_rx_fe_corrections(
- property_tree::sptr sub_tree, //starts at mboards/x
- const fs_path db_path,
- const fs_path rx_fe_corr_path,
- const double rx_lo_freq //actual lo freq
- );
+void apply_rx_fe_corrections(property_tree::sptr sub_tree, // starts at mboards/x
+ const std::string& db_serial,
+ const fs_path rx_fe_corr_path,
+ const double rx_lo_freq // actual lo freq
+);
}} //namespace uhd::usrp
#endif /* INCLUDED_LIBUHD_USRP_COMMON_APPLY_CORRECTIONS_HPP */
diff --git a/host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp b/host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp
new file mode 100644
index 000000000..0c64ecbad
--- /dev/null
+++ b/host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp
@@ -0,0 +1,101 @@
+//
+// Copyright 2019 Ettus Research, a National Instruments Brand
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+
+#ifndef INCLUDED_LIBUHD_MPMD_MB_CONTROLLER_HPP
+#define INCLUDED_LIBUHD_MPMD_MB_CONTROLLER_HPP
+
+#include <uhd/rfnoc/mb_controller.hpp>
+#include <uhdlib/utils/rpc.hpp>
+#include <memory>
+
+namespace uhd { namespace rfnoc {
+
+/*! MPM-Specific version of the mb_controller
+ *
+ * Reminder: There is one of these per motherboard.
+ *
+ * This motherboard controller abstracts out a bunch of RPC calls.
+ */
+class mpmd_mb_controller : public mb_controller
+{
+public:
+ using sptr = std::shared_ptr<mpmd_mb_controller>;
+
+ mpmd_mb_controller(uhd::rpc_client::sptr rpcc, uhd::device_addr_t device_info);
+
+ //! Return reference to the RPC client
+ uhd::rpc_client::sptr get_rpc_client() { return _rpc; }
+
+ /**************************************************************************
+ * Timekeeper API
+ *************************************************************************/
+ //! MPM-specific version of the timekeeper controls
+ //
+ // MPM devices talk to MPM via RPC to control the timekeeper
+ class mpmd_timekeeper : public mb_controller::timekeeper
+ {
+ public:
+ using sptr = std::shared_ptr<mpmd_timekeeper>;
+
+ mpmd_timekeeper(const size_t tk_idx, uhd::rpc_client::sptr rpc_client)
+ : _tk_idx(tk_idx), _rpc(rpc_client)
+ {
+ // nop
+ }
+
+ uint64_t get_ticks_now();
+ uint64_t get_ticks_last_pps();
+ void set_ticks_now(const uint64_t ticks);
+ void set_ticks_next_pps(const uint64_t ticks);
+ void set_period(const uint64_t period_ns);
+
+ /*! Update the tick rate
+ * Note: This is separate from set_tick_rate because the latter is
+ * protected, and we need to implement mpmd-specific functionality here
+ */
+ void update_tick_rate(const double tick_rate);
+
+ private:
+ const size_t _tk_idx;
+ uhd::rpc_client::sptr _rpc;
+ };
+
+ /**************************************************************************
+ * Motherboard Control API (see mb_controller.hpp)
+ *************************************************************************/
+ std::string get_mboard_name() const;
+ void set_time_source(const std::string& source);
+ std::string get_time_source() const;
+ std::vector<std::string> get_time_sources() const;
+ void set_clock_source(const std::string& source);
+ std::string get_clock_source() const;
+ std::vector<std::string> get_clock_sources() const;
+ void set_sync_source(const std::string& clock_source, const std::string& time_source);
+ void set_sync_source(const uhd::device_addr_t& sync_source);
+ uhd::device_addr_t get_sync_source() const;
+ std::vector<uhd::device_addr_t> get_sync_sources();
+ void set_clock_source_out(const bool enb);
+ void set_time_source_out(const bool enb);
+ uhd::sensor_value_t get_sensor(const std::string& name);
+ std::vector<std::string> get_sensor_names();
+ uhd::usrp::mboard_eeprom_t get_eeprom();
+
+private:
+ /**************************************************************************
+ * Attributes
+ *************************************************************************/
+ //! Reference to RPC interface
+ mutable uhd::rpc_client::sptr _rpc;
+
+ uhd::device_addr_t _device_info;
+
+ //! List of MB sensor names
+ std::unordered_set<std::string> _sensor_names;
+};
+
+}} // namespace uhd::rfnoc
+
+#endif /* INCLUDED_LIBUHD_MPMD_MB_CONTROLLER_HPP */