aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
Diffstat (limited to 'host')
-rw-r--r--host/lib/usrp/x400/x400_radio_control.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/host/lib/usrp/x400/x400_radio_control.cpp b/host/lib/usrp/x400/x400_radio_control.cpp
index 8b0fbf906..a58f522bf 100644
--- a/host/lib/usrp/x400/x400_radio_control.cpp
+++ b/host/lib/usrp/x400/x400_radio_control.cpp
@@ -180,8 +180,11 @@ x400_radio_control_impl::x400_radio_control_impl(make_args_ptr make_args)
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));
+ auto mpm_rpc = _mb_control->dynamic_cast_rpc_as<uhd::usrp::mpmd_rpc_iface>();
+ if (mpm_rpc->get_gpio_banks().size() > 0) {
+ _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()
@@ -333,12 +336,18 @@ double x400_radio_control_impl::set_rate(const double rate)
std::vector<std::string> x400_radio_control_impl::get_gpio_banks() const
{
+ if (!_gpios) {
+ return {};
+ }
return {x400::GPIO_BANK_NAME};
}
uint32_t x400_radio_control_impl::get_gpio_attr(
const std::string& bank, const std::string& attr)
{
+ if (!_gpios) {
+ throw uhd::runtime_error("X410 does not have sufficient GPIO support!");
+ }
std::lock_guard<std::recursive_mutex> l(_lock);
if (bank != x400::GPIO_BANK_NAME) {
throw uhd::key_error("Invalid GPIO bank " + bank);
@@ -352,6 +361,9 @@ uint32_t x400_radio_control_impl::get_gpio_attr(
void x400_radio_control_impl::set_gpio_attr(
const std::string& bank, const std::string& attr, const uint32_t value)
{
+ if (!_gpios) {
+ throw uhd::runtime_error("X410 does not have sufficient GPIO support!");
+ }
std::lock_guard<std::recursive_mutex> l(_lock);
if (bank != x400::GPIO_BANK_NAME) {
throw uhd::key_error("Invalid GPIO bank " + bank);