From be54951d4c14b11e21518f2e7d87fd527102c948 Mon Sep 17 00:00:00 2001 From: michael-west Date: Wed, 15 Apr 2015 13:55:10 -0700 Subject: UHD host code changes for B200 rev 5 support. --- host/lib/usrp/b200/b200_impl.cpp | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'host/lib/usrp/b200/b200_impl.cpp') diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index e567ff434..cea7e5969 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -43,10 +43,6 @@ using namespace uhd::transport; static const boost::posix_time::milliseconds REENUMERATION_TIMEOUT_MS(3000); -//! mapping of frontend to radio perif index -static const size_t FE1 = 1; -static const size_t FE2 = 0; - class b200_ad9361_client_t : public ad9361_params { public: ~b200_ad9361_client_t() {} @@ -264,6 +260,19 @@ b200_impl::b200_impl(const device_addr_t &device_addr) : UHD_ASSERT_THROW(device_addr.has_key("fpga")); } + //set up frontend mapping + _fe1 = 1; + _fe2 = 0; + if (not mb_eeprom["revision"].empty()) + { + size_t rev = boost::lexical_cast(mb_eeprom["revision"]); + if (rev == 5) + { + _fe1 = 0; + _fe2 = 1; + } + } + //extract the FPGA path for the B200 std::string b200_fpga_image = find_image_path( device_addr.has_key("fpga")? device_addr["fpga"] : default_file_name @@ -628,7 +637,7 @@ void b200_impl::setup_radio(const size_t dspno) for(size_t direction = 0; direction < 2; direction++) { const std::string x = direction? "rx" : "tx"; - const std::string key = std::string((direction? "RX" : "TX")) + std::string(((dspno == FE1)? "1" : "2")); + const std::string key = std::string((direction? "RX" : "TX")) + std::string(((dspno == _fe1)? "1" : "2")); const fs_path rf_fe_path = mb_path / "dboards" / "A" / (x+"_frontends") / (dspno? "B" : "A"); _tree->create(rf_fe_path / "name").set("FE-"+key); @@ -924,9 +933,9 @@ void b200_impl::reset_codec_dcm(void) void b200_impl::update_atrs(void) { - if (_radio_perifs.size() > FE1 and _radio_perifs[FE1].atr) + if (_radio_perifs.size() > _fe1 and _radio_perifs[_fe1].atr) { - radio_perifs_t &perif = _radio_perifs[FE1]; + radio_perifs_t &perif = _radio_perifs[_fe1]; const bool enb_rx = bool(perif.rx_streamer.lock()); const bool enb_tx = bool(perif.tx_streamer.lock()); const bool is_rx2 = perif.ant_rx2; @@ -942,9 +951,9 @@ void b200_impl::update_atrs(void) atr->set_atr_reg(dboard_iface::ATR_REG_TX_ONLY, txonly); atr->set_atr_reg(dboard_iface::ATR_REG_FULL_DUPLEX, fd); } - if (_radio_perifs.size() > FE2 and _radio_perifs[FE2].atr) + if (_radio_perifs.size() > _fe2 and _radio_perifs[_fe2].atr) { - radio_perifs_t &perif = _radio_perifs[FE2]; + radio_perifs_t &perif = _radio_perifs[_fe2]; const bool enb_rx = bool(perif.rx_streamer.lock()); const bool enb_tx = bool(perif.tx_streamer.lock()); const bool is_rx2 = perif.ant_rx2; @@ -972,10 +981,10 @@ void b200_impl::update_antenna_sel(const size_t which, const std::string &ant) void b200_impl::update_enables(void) { //extract settings from state variables - const bool enb_tx1 = (_radio_perifs.size() > FE1) and bool(_radio_perifs[FE1].tx_streamer.lock()); - const bool enb_rx1 = (_radio_perifs.size() > FE1) and bool(_radio_perifs[FE1].rx_streamer.lock()); - const bool enb_tx2 = (_radio_perifs.size() > FE2) and bool(_radio_perifs[FE2].tx_streamer.lock()); - const bool enb_rx2 = (_radio_perifs.size() > FE2) and bool(_radio_perifs[FE2].rx_streamer.lock()); + const bool enb_tx1 = (_radio_perifs.size() > _fe1) and bool(_radio_perifs[_fe1].tx_streamer.lock()); + const bool enb_rx1 = (_radio_perifs.size() > _fe1) and bool(_radio_perifs[_fe1].rx_streamer.lock()); + const bool enb_tx2 = (_radio_perifs.size() > _fe2) and bool(_radio_perifs[_fe2].tx_streamer.lock()); + const bool enb_rx2 = (_radio_perifs.size() > _fe2) and bool(_radio_perifs[_fe2].rx_streamer.lock()); const size_t num_rx = (enb_rx1?1:0) + (enb_rx2?1:0); const size_t num_tx = (enb_tx1?1:0) + (enb_tx2?1:0); const bool mimo = num_rx == 2 or num_tx == 2; -- cgit v1.2.3