From 9851de0713b4c6d14a870a1d8816451ca518ff52 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 20 Jul 2011 14:13:37 -0700 Subject: uhd: add get_tree call directly to the device Does away with the need for wax cast to get the tree. You can still do this but it will eventually be removed. There was some compiler issue on ubuntu 10.04 with any cast and a shared ptr to property tree. --- host/include/uhd/device.hpp | 4 ++++ host/lib/usrp/b100/b100_impl.hpp | 3 +++ host/lib/usrp/e100/e100_impl.hpp | 3 +++ host/lib/usrp/usrp1/usrp1_impl.hpp | 3 +++ host/lib/usrp/usrp2/usrp2_impl.hpp | 3 +++ host/utils/uhd_usrp_probe.cpp | 2 +- host/utils/usrp1_init_eeprom.cpp | 2 +- host/utils/usrp_burn_db_eeprom.cpp | 2 +- 8 files changed, 19 insertions(+), 3 deletions(-) (limited to 'host') diff --git a/host/include/uhd/device.hpp b/host/include/uhd/device.hpp index 50237472b..40969c29c 100644 --- a/host/include/uhd/device.hpp +++ b/host/include/uhd/device.hpp @@ -19,6 +19,7 @@ #define INCLUDED_UHD_DEVICE_HPP #include +#include #include #include #include @@ -197,6 +198,9 @@ public: async_metadata_t &async_metadata, double timeout = 0.1 ) = 0; + //! Get access to the underlying property structure + virtual property_tree::sptr get_tree(void) const = 0; + }; } //namespace uhd diff --git a/host/lib/usrp/b100/b100_impl.hpp b/host/lib/usrp/b100/b100_impl.hpp index 62a22674e..26f363479 100644 --- a/host/lib/usrp/b100/b100_impl.hpp +++ b/host/lib/usrp/b100/b100_impl.hpp @@ -113,6 +113,9 @@ private: void get(const wax::obj &, wax::obj &val){ val = _tree; //entry point into property tree } + uhd::property_tree::sptr get_tree(void) const{ + return _tree; + } void check_fw_compat(void); void check_fpga_compat(void); diff --git a/host/lib/usrp/e100/e100_impl.hpp b/host/lib/usrp/e100/e100_impl.hpp index e24360223..d60d6a63c 100644 --- a/host/lib/usrp/e100/e100_impl.hpp +++ b/host/lib/usrp/e100/e100_impl.hpp @@ -113,6 +113,9 @@ private: void get(const wax::obj &, wax::obj &val){ val = _tree; //entry point into property tree } + uhd::property_tree::sptr get_tree(void) const{ + return _tree; + } double update_rx_codec_gain(const double); //sets A and B at once void set_mb_eeprom(const uhd::usrp::mboard_eeprom_t &); diff --git a/host/lib/usrp/usrp1/usrp1_impl.hpp b/host/lib/usrp/usrp1/usrp1_impl.hpp index 1fe0c1784..261223883 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.hpp +++ b/host/lib/usrp/usrp1/usrp1_impl.hpp @@ -79,6 +79,9 @@ private: void get(const wax::obj &, wax::obj &val){ val = _tree; //entry point into property tree } + uhd::property_tree::sptr get_tree(void) const{ + return _tree; + } //controllers uhd::usrp::fx2_ctrl::sptr _fx2_ctrl; diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp index 644eab824..cdbcc895f 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.hpp +++ b/host/lib/usrp/usrp2/usrp2_impl.hpp @@ -117,6 +117,9 @@ private: void get(const wax::obj &, wax::obj &val){ val = _tree; //entry point into property tree } + uhd::property_tree::sptr get_tree(void) const{ + return _tree; + } //io impl methods and members uhd::otw_type_t _rx_otw_type, _tx_otw_type; diff --git a/host/utils/uhd_usrp_probe.cpp b/host/utils/uhd_usrp_probe.cpp index cb6d78255..6c5f451cd 100644 --- a/host/utils/uhd_usrp_probe.cpp +++ b/host/utils/uhd_usrp_probe.cpp @@ -192,7 +192,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ } device::sptr dev = device::make(vm["args"].as()); - property_tree::sptr tree = (*dev)[0].as(); + property_tree::sptr tree = dev->get_tree(); if (vm.count("tree") != 0) print_tree("/", tree); else std::cout << make_border(get_device_pp_string(tree)) << std::endl; diff --git a/host/utils/usrp1_init_eeprom.cpp b/host/utils/usrp1_init_eeprom.cpp index 5bc07daf6..1778d5f9d 100644 --- a/host/utils/usrp1_init_eeprom.cpp +++ b/host/utils/usrp1_init_eeprom.cpp @@ -65,7 +65,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ std::cout << "Writing EEPROM data..." << std::endl; //uhd::device_addrs_t devs = uhd::device::find(found_addrs[i]); uhd::device::sptr dev = uhd::device::make(found_addrs[i]); - uhd::property_tree::sptr tree = (*dev)[0].as(); + uhd::property_tree::sptr tree = dev->get_tree(); tree->access("/mboards/0/load_eeprom").set(vm["image"].as()); } diff --git a/host/utils/usrp_burn_db_eeprom.cpp b/host/utils/usrp_burn_db_eeprom.cpp index 7ebbe7756..9dfce141b 100644 --- a/host/utils/usrp_burn_db_eeprom.cpp +++ b/host/utils/usrp_burn_db_eeprom.cpp @@ -62,7 +62,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //make the device and extract the dboard w/ property device::sptr dev = device::make(args); - uhd::property_tree::sptr tree = (*dev)[0].as(); + uhd::property_tree::sptr tree = dev->get_tree(); const uhd::property_tree::path_type db_root = "/mboards/0/dboards"; std::vector dboard_names = tree->list(db_root); if (dboard_names.size() == 1 and slot.empty()) slot = dboard_names.front(); -- cgit v1.2.3