aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/x400/x400_radio_control.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/x400/x400_radio_control.cpp')
-rw-r--r--host/lib/usrp/x400/x400_radio_control.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/host/lib/usrp/x400/x400_radio_control.cpp b/host/lib/usrp/x400/x400_radio_control.cpp
index 281ae7916..8b0fbf906 100644
--- a/host/lib/usrp/x400/x400_radio_control.cpp
+++ b/host/lib/usrp/x400/x400_radio_control.cpp
@@ -12,6 +12,7 @@
#include <uhdlib/usrp/dboard/debug_dboard.hpp>
#include <uhdlib/usrp/dboard/null_dboard.hpp>
#include <uhdlib/usrp/dboard/zbx/zbx_dboard.hpp>
+#include <uhdlib/rfnoc/reg_iface_adapter.hpp>
namespace uhd { namespace rfnoc {
@@ -178,6 +179,9 @@ x400_radio_control_impl::x400_radio_control_impl(make_args_ptr make_args)
get_num_output_ports(), _adc_self_calibration, get_unique_id());
register_feature(_fpga_onload);
_mb_control->_fpga_onload->request_cb(_fpga_onload);
+
+ _gpios = std::make_shared<x400::gpio_control>(_rpcc,
+ RFNOC_MAKE_WB_IFACE(regmap::PERIPH_BASE + 0xC000, 0));
}
void x400_radio_control_impl::_init_prop_tree()
@@ -327,6 +331,37 @@ double x400_radio_control_impl::set_rate(const double rate)
return get_rate();
}
+std::vector<std::string> x400_radio_control_impl::get_gpio_banks() const
+{
+ return {x400::GPIO_BANK_NAME};
+}
+
+uint32_t x400_radio_control_impl::get_gpio_attr(
+ const std::string& bank, const std::string& attr)
+{
+ std::lock_guard<std::recursive_mutex> l(_lock);
+ if (bank != x400::GPIO_BANK_NAME) {
+ throw uhd::key_error("Invalid GPIO bank " + bank);
+ }
+ if (usrp::gpio_atr::gpio_attr_rev_map.count(attr) == 0) {
+ throw uhd::key_error("Invalid GPIO attribute " + attr);
+ }
+ return _gpios->get_gpio_attr(usrp::gpio_atr::gpio_attr_rev_map.at(attr));
+}
+
+void x400_radio_control_impl::set_gpio_attr(
+ const std::string& bank, const std::string& attr, const uint32_t value)
+{
+ std::lock_guard<std::recursive_mutex> l(_lock);
+ if (bank != x400::GPIO_BANK_NAME) {
+ throw uhd::key_error("Invalid GPIO bank " + bank);
+ }
+ if (usrp::gpio_atr::gpio_attr_rev_map.count(attr) == 0) {
+ throw uhd::key_error("Invalid GPIO attribute " + attr);
+ }
+ _gpios->set_gpio_attr(usrp::gpio_atr::gpio_attr_rev_map.at(attr), value);
+}
+
eeprom_map_t x400_radio_control_impl::get_db_eeprom()
{
std::lock_guard<std::recursive_mutex> l(_lock);