diff options
author | kurtis.heimerl <kurtis.heimerl@19bc5d8c-e614-43d4-8b26-e1612bc8e597> | 2011-11-26 03:18:57 +0000 |
---|---|---|
committer | kurtis.heimerl <kurtis.heimerl@19bc5d8c-e614-43d4-8b26-e1612bc8e597> | 2011-11-26 03:18:57 +0000 |
commit | b7358ce43873b432c7b4672e1d48be2663d9b930 (patch) | |
tree | f79ed96e7f5594cfbdb1b6f462ff4ca20fac777c /Transceiver52M/UHDDevice.cpp | |
parent | e380af3ecc94b64754de501deb211a31ba6573f9 (diff) |
transceiver: reject usrp1 if detected using uhd
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2678 19bc5d8c-e614-43d4-8b26-e1612bc8e597
Diffstat (limited to 'Transceiver52M/UHDDevice.cpp')
-rw-r--r-- | Transceiver52M/UHDDevice.cpp | 60 |
1 files changed, 40 insertions, 20 deletions
diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp index e72fcfe..b3d41d7 100644 --- a/Transceiver52M/UHDDevice.cpp +++ b/Transceiver52M/UHDDevice.cpp @@ -227,6 +227,7 @@ private: void init_gains(); void set_ref_clk(bool ext_clk); double set_rates(double rate); + bool parse_dev_type(); bool flush_recv(size_t num_pkts); int check_rx_md_err(uhd::rx_metadata_t &md, ssize_t num_smpls); @@ -374,11 +375,44 @@ double uhd_device::setRxGain(double db) return rx_gain; } -bool uhd_device::open() +/* + Parse the UHD device tree and mboard name to find out what device we're + dealing with. We need the bus type so that the transceiver knows how to + deal with the transport latency. Reject the USRP1 because UHD doesn't + support timestamped samples with it. + */ +bool uhd_device::parse_dev_type() { - std::string dev_str; + std::string mboard_str, dev_str; uhd::property_tree::sptr prop_tree; + size_t usrp1_str, usrp2_str, b100_str1, b100_str2; + + prop_tree = usrp_dev->get_device()->get_tree(); + dev_str = prop_tree->access<std::string>("/name").get(); + mboard_str = usrp_dev->get_mboard_name(); + + usrp1_str = dev_str.find("USRP1"); + b100_str1 = dev_str.find("B-Series"); + b100_str2 = mboard_str.find("B100"); + + if (usrp1_str != std::string::npos) { + LOG(ERROR) << "USRP1 is not supported using UHD driver"; + return false; + } + + if ((b100_str1 != std::string::npos) || (b100_str2 != std::string::npos)) { + bus = USB; + LOG(INFO) << "Using USB bus for " << dev_str; + } else { + bus = NET; + LOG(INFO) << "Using network bus for " << dev_str; + } + + return true; +} +bool uhd_device::open() +{ // Register msg handler uhd::msg::register_handler(&uhd_msg_handler); @@ -392,24 +426,6 @@ bool uhd_device::open() return false; } - // Set the device name and bus type - dev_str = usrp_dev->get_mboard_name(); - LOG(NOTICE) << "Found " << dev_str; - - prop_tree = usrp_dev->get_device()->get_tree(); - dev_str = prop_tree->access<std::string>("/name").get(); - - size_t res1 = dev_str.find("B100"); - size_t res2 = dev_str.find("B-Series"); - - if ((res1 != std::string::npos) || (res2 != std::string::npos)) { - bus = USB; - LOG(NOTICE) << "Using USB bus for " << dev_str; - } else { - bus = NET; - LOG(NOTICE) << "Using network bus for " << dev_str; - } - // Number of samples per over-the-wire packet tx_spp = usrp_dev->get_device()->get_max_send_samps_per_packet(); rx_spp = usrp_dev->get_device()->get_max_recv_samps_per_packet(); @@ -435,6 +451,10 @@ bool uhd_device::open() // Print configuration LOG(INFO) << usrp_dev->get_pp_string(); + // Check for a valid device type and set bus type + if (!parse_dev_type()) + return false; + return true; } |