aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
authorTrung N Tran <trung.tran@ettus.com>2018-02-22 10:57:33 -0800
committerMartin Braun <martin.braun@ettus.com>2018-02-22 14:11:20 -0800
commit1e5388e70de57aaaccd406a20a645f9b641fbeb4 (patch)
tree4dbfb733b1983a424b1e8f701292a527aa5a64fa /host/lib/usrp
parentc208452c81685d8bb865202f3ab4f5461023a22e (diff)
downloaduhd-1e5388e70de57aaaccd406a20a645f9b641fbeb4.tar.gz
uhd-1e5388e70de57aaaccd406a20a645f9b641fbeb4.tar.bz2
uhd-1e5388e70de57aaaccd406a20a645f9b641fbeb4.zip
fixup! x300,n230,e300,b200: changes to adapt to new usrp API
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/b200/b200_impl.cpp35
-rw-r--r--host/lib/usrp/e300/e300_impl.cpp10
-rw-r--r--host/lib/usrp/n230/n230_impl.cpp11
-rw-r--r--host/lib/usrp/x300/x300_radio_ctrl_impl.cpp11
4 files changed, 47 insertions, 20 deletions
diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp
index 3f92e44a9..88486dba6 100644
--- a/host/lib/usrp/b200/b200_impl.cpp
+++ b/host/lib/usrp/b200/b200_impl.cpp
@@ -660,13 +660,36 @@ b200_impl::b200_impl(const uhd::device_addr_t& device_addr, usb_device_handle::s
////////////////////////////////////////////////////////////////////
_radio_perifs[0].fp_gpio = gpio_atr_3000::make(_radio_perifs[0].ctrl, TOREG(SR_FP_GPIO), RB32_FP_GPIO);
for(const gpio_attr_map_t::value_type attr: gpio_attr_map)
- {
- _tree->create<uint32_t>(mb_path / "gpio" / "FP0" / attr.second)
- .set(0)
- .add_coerced_subscriber(boost::bind(&gpio_atr_3000::set_gpio_attr, _radio_perifs[0].fp_gpio, attr.first, _1));
+ { switch (attr.first){
+ case usrp::gpio_atr::GPIO_SRC:
+ _tree->create<std::vector<std::string>>(mb_path / "gpio" / "FP0" / attr.second)
+ .set(std::vector<std::string>(32, usrp::gpio_atr::default_attr_value_map.at(attr.first)))
+ .add_coerced_subscriber([this](const std::vector<std::string> str_val){
+ throw uhd::runtime_error("This device does not support set SRC attribute.");
+ });
+ break;
+ case usrp::gpio_atr::GPIO_CTRL:
+ case usrp::gpio_atr::GPIO_DDR:
+ _tree->create<std::vector<std::string>>(mb_path / "gpio" / "FP0" / attr.second)
+ .set(std::vector<std::string>(32, usrp::gpio_atr::default_attr_value_map.at(attr.first)))
+ .add_coerced_subscriber([this, attr](const std::vector<std::string> str_val){
+ uint32_t val = 0;
+ for(size_t i = 0 ; i < str_val.size() ; i++){
+ val += usrp::gpio_atr::gpio_attr_value_pair.at(attr.second).at(str_val[i])<<i;
+ }
+ _radio_perifs[0].fp_gpio->set_gpio_attr(attr.first, val);
+ });
+ break;
+ case usrp::gpio_atr::GPIO_READBACK:
+ _tree->create<uint32_t>(mb_path / "gpio" / "FP0" / "READBACK")
+ .set_publisher(boost::bind(&gpio_atr_3000::read_gpio, _radio_perifs[0].fp_gpio));
+ break;
+ default:
+ _tree->create<uint32_t>(mb_path / "gpio" / "FP0" / attr.second)
+ .set(0)
+ .add_coerced_subscriber(boost::bind(&gpio_atr_3000::set_gpio_attr, _radio_perifs[0].fp_gpio, attr.first, _1));
+ }
}
- _tree->create<uint32_t>(mb_path / "gpio" / "FP0" / "READBACK")
- .set_publisher(boost::bind(&gpio_atr_3000::read_gpio, _radio_perifs[0].fp_gpio));
////////////////////////////////////////////////////////////////////
// dboard eeproms but not really
diff --git a/host/lib/usrp/e300/e300_impl.cpp b/host/lib/usrp/e300/e300_impl.cpp
index 24e9c6f82..b4011eda0 100644
--- a/host/lib/usrp/e300/e300_impl.cpp
+++ b/host/lib/usrp/e300/e300_impl.cpp
@@ -542,6 +542,12 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr)
fp_gpio->set_gpio_attr(attr.first, val);
});
break;
+ case usrp::gpio_atr::GPIO_READBACK:
+ _tree->create<uint8_t>(mb_path / "gpio" / "INT0" / "READBACK")
+ .set_publisher([this, fp_gpio](){
+ return fp_gpio->read_gpio();
+ });
+ break;
default:
_tree->create<uint32_t>(mb_path / "gpio" / "INT0" / attr.second)
.set(0)
@@ -550,10 +556,6 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr)
});
}
}
- _tree->create<uint8_t>(mb_path / "gpio" / "INT0" / "READBACK")
- .set_publisher([this, fp_gpio](){
- return fp_gpio->read_gpio();
- });
////////////////////////////////////////////////////////////////////
diff --git a/host/lib/usrp/n230/n230_impl.cpp b/host/lib/usrp/n230/n230_impl.cpp
index 1b59793b8..04d404311 100644
--- a/host/lib/usrp/n230/n230_impl.cpp
+++ b/host/lib/usrp/n230/n230_impl.cpp
@@ -440,6 +440,12 @@ void n230_impl::_initialize_property_tree(const fs_path& mb_path)
_resource_mgr->get_minisas_gpio_ctrl_sptr(1)->set_gpio_attr(attr.first, val);
});
break;
+ case usrp::gpio_atr::GPIO_READBACK:
+ _tree->create<uint32_t>(mb_path / "gpio" / "FP0" / "READBACK")
+ .set_publisher(boost::bind(&gpio_atr::gpio_atr_3000::read_gpio, _resource_mgr->get_minisas_gpio_ctrl_sptr(0)));
+ _tree->create<uint32_t>(mb_path / "gpio" / "FP1" / "READBACK")
+ .set_publisher(boost::bind(&gpio_atr::gpio_atr_3000::read_gpio, _resource_mgr->get_minisas_gpio_ctrl_sptr(1)));
+ break;
default:
_tree->create<uint32_t>(mb_path / "gpio" / "FP0" / attr.second)
.set(0);
@@ -448,11 +454,6 @@ void n230_impl::_initialize_property_tree(const fs_path& mb_path)
break;
}
}
- _tree->create<uint32_t>(mb_path / "gpio" / "FP0" / "READBACK")
- .set_publisher(boost::bind(&gpio_atr::gpio_atr_3000::read_gpio, _resource_mgr->get_minisas_gpio_ctrl_sptr(0)));
- _tree->create<uint32_t>(mb_path / "gpio" / "FP1" / "READBACK")
- .set_publisher(boost::bind(&gpio_atr::gpio_atr_3000::read_gpio, _resource_mgr->get_minisas_gpio_ctrl_sptr(1)));
-
//------------------------------------------------------------------
// GPSDO sensors
//------------------------------------------------------------------
diff --git a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp
index b6b6e1824..88bbcf342 100644
--- a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp
+++ b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp
@@ -93,6 +93,12 @@ UHD_RFNOC_RADIO_BLOCK_CONSTRUCTOR(x300_radio_ctrl)
_fp_gpio->set_gpio_attr(attr.first, val);
});
break;
+ case usrp::gpio_atr::GPIO_READBACK:
+ _tree->create<uint32_t>(fs_path("gpio") / "FP0" / "READBACK")
+ .set_publisher([this](){
+ return _fp_gpio->read_gpio();
+ });
+ break;
default:
_tree->create<uint32_t>(fs_path("gpio") / "FP0" / attr.second)
.set(0)
@@ -102,10 +108,6 @@ UHD_RFNOC_RADIO_BLOCK_CONSTRUCTOR(x300_radio_ctrl)
}
}
- _tree->create<uint32_t>(fs_path("gpio") / "FP0" / "READBACK")
- .set_publisher([this](){
- return _fp_gpio->read_gpio();
- });
}
////////////////////////////////////////////////////////////////
@@ -169,7 +171,6 @@ x300_radio_ctrl_impl::~x300_radio_ctrl_impl()
for(const gpio_atr::gpio_attr_map_t::value_type attr: gpio_atr::gpio_attr_map) {
_tree->remove(fs_path("gpio") / "FP0" / attr.second);
}
- _tree->remove(fs_path("gpio") / "FP0" / "READBACK");
}
// Reset peripherals