aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
authorGrant Meyerhoff <grant.meyerhoff@ni.com>2021-08-19 14:26:35 -0500
committerAaron Rossetto <aaron.rossetto@ni.com>2021-09-02 13:34:02 -0500
commit18de8c32716f04fb394822921a1482aa64a0b87d (patch)
tree87b6223857474ade95188b04d16dc060e1542d01 /host/lib/usrp
parent570b4c6ab30be081a0119a2bf2f1d8ee7fb7f5b9 (diff)
downloaduhd-18de8c32716f04fb394822921a1482aa64a0b87d.tar.gz
uhd-18de8c32716f04fb394822921a1482aa64a0b87d.tar.bz2
uhd-18de8c32716f04fb394822921a1482aa64a0b87d.zip
mpmd: Add discoverable feature for trig i/o mode
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/mpmd/mpmd_mb_controller.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/host/lib/usrp/mpmd/mpmd_mb_controller.cpp b/host/lib/usrp/mpmd/mpmd_mb_controller.cpp
index 665a38152..b79abcee0 100644
--- a/host/lib/usrp/mpmd/mpmd_mb_controller.cpp
+++ b/host/lib/usrp/mpmd/mpmd_mb_controller.cpp
@@ -52,6 +52,28 @@ void mpmd_mb_controller::ref_clk_calibration::store_ref_clk_tuning_word(uint32_t
_rpcc->store_ref_clk_tuning_word(tuning_word);
}
+mpmd_mb_controller::trig_io_mode::trig_io_mode(uhd::usrp::mpmd_rpc_iface::sptr rpcc)
+ : _rpcc(rpcc)
+{
+}
+
+void mpmd_mb_controller::trig_io_mode::set_trig_io_mode(const uhd::trig_io_mode_t mode)
+{
+ switch (mode) {
+ case uhd::trig_io_mode_t::PPS_OUTPUT:
+ _rpcc->set_trigger_io("pps_output");
+ break;
+ case uhd::trig_io_mode_t::INPUT:
+ _rpcc->set_trigger_io("input");
+ break;
+ case uhd::trig_io_mode_t::OFF:
+ _rpcc->set_trigger_io("off");
+ break;
+ default:
+ throw uhd::value_error("set_trig_io_mode: Requested mode is invalid.");
+ }
+}
+
mpmd_mb_controller::mpmd_mb_controller(
uhd::usrp::mpmd_rpc_iface::sptr rpcc, uhd::device_addr_t device_info)
: _rpc(rpcc), _device_info(device_info)
@@ -79,6 +101,11 @@ mpmd_mb_controller::mpmd_mb_controller(
_ref_clk_cal = std::make_shared<ref_clk_calibration>(_rpc);
register_feature(_ref_clk_cal);
}
+
+ if (_rpc->supports_feature("trig_io_mode")) {
+ _trig_io_mode = std::make_shared<trig_io_mode>(_rpc);
+ register_feature(_trig_io_mode);
+ }
}
/******************************************************************************