From 1e5388e70de57aaaccd406a20a645f9b641fbeb4 Mon Sep 17 00:00:00 2001 From: Trung N Tran Date: Thu, 22 Feb 2018 10:57:33 -0800 Subject: fixup! x300,n230,e300,b200: changes to adapt to new usrp API --- host/lib/usrp/b200/b200_impl.cpp | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) (limited to 'host/lib/usrp/b200') 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(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>(mb_path / "gpio" / "FP0" / attr.second) + .set(std::vector(32, usrp::gpio_atr::default_attr_value_map.at(attr.first))) + .add_coerced_subscriber([this](const std::vector 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>(mb_path / "gpio" / "FP0" / attr.second) + .set(std::vector(32, usrp::gpio_atr::default_attr_value_map.at(attr.first))) + .add_coerced_subscriber([this, attr](const std::vector 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])<set_gpio_attr(attr.first, val); + }); + break; + case usrp::gpio_atr::GPIO_READBACK: + _tree->create(mb_path / "gpio" / "FP0" / "READBACK") + .set_publisher(boost::bind(&gpio_atr_3000::read_gpio, _radio_perifs[0].fp_gpio)); + break; + default: + _tree->create(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(mb_path / "gpio" / "FP0" / "READBACK") - .set_publisher(boost::bind(&gpio_atr_3000::read_gpio, _radio_perifs[0].fp_gpio)); //////////////////////////////////////////////////////////////////// // dboard eeproms but not really -- cgit v1.2.3