diff options
Diffstat (limited to 'host')
-rw-r--r-- | host/include/uhd/usrp/dboard_props.hpp | 1 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/dboard_impl.cpp | 12 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_impl.hpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/dboard_impl.cpp | 14 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.hpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/usrp_e100/dboard_impl.cpp | 15 | ||||
-rw-r--r-- | host/lib/usrp/usrp_e100/usrp_e100_impl.hpp | 2 | ||||
-rw-r--r-- | host/utils/uhd_usrp_probe.cpp | 23 | ||||
-rw-r--r-- | host/utils/usrp_burn_db_eeprom.cpp | 15 |
9 files changed, 67 insertions, 19 deletions
diff --git a/host/include/uhd/usrp/dboard_props.hpp b/host/include/uhd/usrp/dboard_props.hpp index 35721ab47..29211ec8c 100644 --- a/host/include/uhd/usrp/dboard_props.hpp +++ b/host/include/uhd/usrp/dboard_props.hpp @@ -32,6 +32,7 @@ namespace uhd{ namespace usrp{ DBOARD_PROP_SUBDEV, //ro, wax::obj DBOARD_PROP_SUBDEV_NAMES, //ro, prop_names_t DBOARD_PROP_DBOARD_EEPROM, //rw, dboard_eeprom_t + DBOARD_PROP_GBOARD_EEPROM, //rw, dboard_eeprom_t DBOARD_PROP_DBOARD_IFACE, //ro, dboard_iface::sptr DBOARD_PROP_CODEC, //ro, wax::obj DBOARD_PROP_GAIN_GROUP //ro, gain_group diff --git a/host/lib/usrp/usrp1/dboard_impl.cpp b/host/lib/usrp/usrp1/dboard_impl.cpp index 02906fc45..df0bb6261 100644 --- a/host/lib/usrp/usrp1/dboard_impl.cpp +++ b/host/lib/usrp/usrp1/dboard_impl.cpp @@ -59,6 +59,7 @@ void usrp1_impl::dboard_init(void) //read the tx and rx dboard eeproms _rx_db_eeproms[dboard_slot].load(*_iface, get_rx_ee_addr(dboard_slot)); _tx_db_eeproms[dboard_slot].load(*_iface, get_tx_ee_addr(dboard_slot)); + _gdb_eeproms[dboard_slot].load(*_iface, get_tx_ee_addr(dboard_slot) ^ 5); //create a new dboard interface and manager _dboard_ifaces[dboard_slot] = make_dboard_iface( @@ -68,7 +69,7 @@ void usrp1_impl::dboard_init(void) _dboard_managers[dboard_slot] = dboard_manager::make( _rx_db_eeproms[dboard_slot].id, - _tx_db_eeproms[dboard_slot].id, + ((_gdb_eeproms[dboard_slot].id == dboard_id_t::none())? _tx_db_eeproms[dboard_slot] : _gdb_eeproms[dboard_slot]).id, _dboard_ifaces[dboard_slot] ); @@ -171,6 +172,10 @@ void usrp1_impl::tx_dboard_get(const wax::obj &key_, wax::obj &val, dboard_slot_ val = _tx_db_eeproms[dboard_slot]; return; + case DBOARD_PROP_GBOARD_EEPROM: + val = _gdb_eeproms[dboard_slot]; + return; + case DBOARD_PROP_DBOARD_IFACE: val = _dboard_ifaces[dboard_slot]; return; @@ -203,6 +208,11 @@ void usrp1_impl::tx_dboard_set(const wax::obj &key, const wax::obj &val, dboard_ _tx_db_eeproms[dboard_slot].store(*_iface, get_tx_ee_addr(dboard_slot)); return; + case DBOARD_PROP_GBOARD_EEPROM: + _gdb_eeproms[dboard_slot] = val.as<dboard_eeprom_t>(); + _gdb_eeproms[dboard_slot].store(*_iface, get_tx_ee_addr(dboard_slot) ^ 5); + return; + default: UHD_THROW_PROP_SET_ERROR(); } } diff --git a/host/lib/usrp/usrp1/usrp1_impl.hpp b/host/lib/usrp/usrp1/usrp1_impl.hpp index 9755c466d..f53894b29 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.hpp +++ b/host/lib/usrp/usrp1/usrp1_impl.hpp @@ -175,7 +175,7 @@ private: uhd::dict<dboard_slot_t, wax_obj_proxy::sptr> _rx_dboard_proxies; //tx dboard functions and settings - uhd::dict<dboard_slot_t, uhd::usrp::dboard_eeprom_t> _tx_db_eeproms; + uhd::dict<dboard_slot_t, uhd::usrp::dboard_eeprom_t> _tx_db_eeproms, _gdb_eeproms; void tx_dboard_get(const wax::obj &, wax::obj &, dboard_slot_t); void tx_dboard_set(const wax::obj &, const wax::obj &, dboard_slot_t); uhd::dict<dboard_slot_t, wax_obj_proxy::sptr> _tx_dboard_proxies; diff --git a/host/lib/usrp/usrp2/dboard_impl.cpp b/host/lib/usrp/usrp2/dboard_impl.cpp index 3f41cddcf..8c6379d66 100644 --- a/host/lib/usrp/usrp2/dboard_impl.cpp +++ b/host/lib/usrp/usrp2/dboard_impl.cpp @@ -38,11 +38,14 @@ void usrp2_mboard_impl::dboard_init(void){ //read the dboard eeprom to extract the dboard ids _rx_db_eeprom.load(*_iface, USRP2_I2C_ADDR_RX_DB); _tx_db_eeprom.load(*_iface, USRP2_I2C_ADDR_TX_DB); + _gdb_eeprom.load(*_iface, USRP2_I2C_ADDR_TX_DB ^ 5); //create a new dboard interface and manager _dboard_iface = make_usrp2_dboard_iface(_iface, _clock_ctrl); _dboard_manager = dboard_manager::make( - _rx_db_eeprom.id, _tx_db_eeprom.id, _dboard_iface + _rx_db_eeprom.id, + ((_gdb_eeprom.id == dboard_id_t::none())? _tx_db_eeprom : _gdb_eeprom).id, + _dboard_iface ); //load dboards @@ -137,6 +140,10 @@ void usrp2_mboard_impl::tx_dboard_get(const wax::obj &key_, wax::obj &val){ val = _tx_db_eeprom; return; + case DBOARD_PROP_GBOARD_EEPROM: + val = _gdb_eeprom; + return; + case DBOARD_PROP_DBOARD_IFACE: val = _dboard_iface; return; @@ -166,6 +173,11 @@ void usrp2_mboard_impl::tx_dboard_set(const wax::obj &key, const wax::obj &val){ _tx_db_eeprom.store(*_iface, USRP2_I2C_ADDR_TX_DB); return; + case DBOARD_PROP_GBOARD_EEPROM: + _gdb_eeprom = val.as<dboard_eeprom_t>(); + _gdb_eeprom.store(*_iface, USRP2_I2C_ADDR_TX_DB ^ 5); + return; + default: UHD_THROW_PROP_SET_ERROR(); } } diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp index 0676cecf2..e9ff22b13 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.hpp +++ b/host/lib/usrp/usrp2/usrp2_impl.hpp @@ -147,7 +147,7 @@ private: void tx_dboard_get(const wax::obj &, wax::obj &); void tx_dboard_set(const wax::obj &, const wax::obj &); wax_obj_proxy::sptr _tx_dboard_proxy; - uhd::usrp::dboard_eeprom_t _tx_db_eeprom; + uhd::usrp::dboard_eeprom_t _tx_db_eeprom, _gdb_eeprom; //methods and shadows for the dsps UHD_PIMPL_DECL(dsp_impl) _dsp_impl; diff --git a/host/lib/usrp/usrp_e100/dboard_impl.cpp b/host/lib/usrp/usrp_e100/dboard_impl.cpp index 0b89fed9f..f6bbbd5e8 100644 --- a/host/lib/usrp/usrp_e100/dboard_impl.cpp +++ b/host/lib/usrp/usrp_e100/dboard_impl.cpp @@ -31,15 +31,19 @@ using namespace uhd::usrp; * Dboard Initialization **********************************************************************/ void usrp_e100_impl::dboard_init(void){ + //read the dboard eeprom to extract the dboard ids _rx_db_eeprom.load(*_iface, I2C_ADDR_RX_DB); _tx_db_eeprom.load(*_iface, I2C_ADDR_TX_DB); + _gdb_eeprom.load(*_iface, I2C_ADDR_TX_DB ^ 5); //create a new dboard interface and manager _dboard_iface = make_usrp_e100_dboard_iface( _iface, _clock_ctrl, _codec_ctrl ); _dboard_manager = dboard_manager::make( - _rx_db_eeprom.id, _tx_db_eeprom.id, _dboard_iface + _rx_db_eeprom.id, + ((_gdb_eeprom.id == dboard_id_t::none())? _tx_db_eeprom : _gdb_eeprom).id, + _dboard_iface ); //setup the dboard proxies @@ -136,6 +140,10 @@ void usrp_e100_impl::tx_dboard_get(const wax::obj &key_, wax::obj &val){ val = _tx_db_eeprom; return; + case DBOARD_PROP_GBOARD_EEPROM: + val = _gdb_eeprom; + return; + case DBOARD_PROP_DBOARD_IFACE: val = _dboard_iface; return; @@ -167,6 +175,11 @@ void usrp_e100_impl::tx_dboard_set(const wax::obj &key, const wax::obj &val){ _tx_db_eeprom.store(*_iface, I2C_ADDR_TX_DB); return; + case DBOARD_PROP_GBOARD_EEPROM: + _gdb_eeprom = val.as<dboard_eeprom_t>(); + _gdb_eeprom.store(*_iface, I2C_ADDR_TX_DB ^ 5); + return; + default: UHD_THROW_PROP_SET_ERROR(); } } diff --git a/host/lib/usrp/usrp_e100/usrp_e100_impl.hpp b/host/lib/usrp/usrp_e100/usrp_e100_impl.hpp index 98117cf26..737aa4e8f 100644 --- a/host/lib/usrp/usrp_e100/usrp_e100_impl.hpp +++ b/host/lib/usrp/usrp_e100/usrp_e100_impl.hpp @@ -132,7 +132,7 @@ private: wax_obj_proxy::sptr _rx_dboard_proxy; //tx dboard functions and settings - uhd::usrp::dboard_eeprom_t _tx_db_eeprom; + uhd::usrp::dboard_eeprom_t _tx_db_eeprom, _gdb_eeprom; void tx_dboard_get(const wax::obj &, wax::obj &); void tx_dboard_set(const wax::obj &, const wax::obj &); wax_obj_proxy::sptr _tx_dboard_proxy; diff --git a/host/utils/uhd_usrp_probe.cpp b/host/utils/uhd_usrp_probe.cpp index b32131b2a..3ea63c4bb 100644 --- a/host/utils/uhd_usrp_probe.cpp +++ b/host/utils/uhd_usrp_probe.cpp @@ -27,6 +27,7 @@ #include <uhd/usrp/subdev_props.hpp> #include <uhd/usrp/dboard_id.hpp> #include <uhd/usrp/mboard_eeprom.hpp> +#include <uhd/usrp/dboard_eeprom.hpp> #include <boost/program_options.hpp> #include <boost/format.hpp> #include <boost/foreach.hpp> @@ -46,12 +47,12 @@ static std::string make_border(const std::string &text){ ss << boost::format(" _____________________________________________________") << std::endl; ss << boost::format(" /") << std::endl; std::vector<std::string> lines; boost::split(lines, text, boost::is_any_of("\n")); - while (lines.back() == "") lines.pop_back(); //strip trailing newlines + while (lines.back().empty()) lines.pop_back(); //strip trailing newlines if (lines.size()) lines[0] = " " + lines[0]; //indent the title line BOOST_FOREACH(const std::string &line, lines){ ss << boost::format("| %s") % line << std::endl; } - //ss << boost::format(" \\____________________________________________________") << std::endl; + //ss << boost::format(" \\_____________________________________________________") << std::endl; return ss.str(); } @@ -114,6 +115,14 @@ static std::string get_dboard_pp_string(const std::string &type, wax::obj dboard std::stringstream ss; ss << boost::format("%s Dboard: %s") % type % dboard[usrp::DBOARD_PROP_NAME].as<std::string>() << std::endl; //ss << std::endl; + usrp::dboard_eeprom_t db_eeprom = dboard[usrp::DBOARD_PROP_DBOARD_EEPROM].as<usrp::dboard_eeprom_t>(); + if (db_eeprom.id != usrp::dboard_id_t::none()) ss << boost::format("ID: %s") % db_eeprom.id.to_pp_string() << std::endl; + if (not db_eeprom.serial.empty()) ss << boost::format("Serial: %s") % db_eeprom.serial << std::endl; + if (type == "TX"){ + usrp::dboard_eeprom_t gdb_eeprom = dboard[usrp::DBOARD_PROP_GBOARD_EEPROM].as<usrp::dboard_eeprom_t>(); + if (gdb_eeprom.id != usrp::dboard_id_t::none()) ss << boost::format("GDB ID: %s") % gdb_eeprom.id.to_pp_string() << std::endl; + if (not gdb_eeprom.serial.empty()) ss << boost::format("GDB Serial: %s") % gdb_eeprom.serial << std::endl; + } BOOST_FOREACH(const std::string &subdev_name, dboard[usrp::DBOARD_PROP_SUBDEV_NAMES].as<prop_names_t>()){ ss << make_border(get_subdev_pp_string(type, dboard[named_prop_t(usrp::DBOARD_PROP_SUBDEV, subdev_name)])); } @@ -132,14 +141,14 @@ static std::string get_mboard_pp_string(wax::obj mboard){ BOOST_FOREACH(const std::string &dsp_name, mboard[usrp::MBOARD_PROP_RX_DSP_NAMES].as<prop_names_t>()){ ss << make_border(get_dsp_pp_string("RX", mboard[named_prop_t(usrp::MBOARD_PROP_RX_DSP, dsp_name)])); } + BOOST_FOREACH(const std::string &db_name, mboard[usrp::MBOARD_PROP_RX_DBOARD_NAMES].as<prop_names_t>()){ + ss << make_border(get_dboard_pp_string("RX", mboard[named_prop_t(usrp::MBOARD_PROP_RX_DBOARD, db_name)])); + } BOOST_FOREACH(const std::string &dsp_name, mboard[usrp::MBOARD_PROP_TX_DSP_NAMES].as<prop_names_t>()){ ss << make_border(get_dsp_pp_string("TX", mboard[named_prop_t(usrp::MBOARD_PROP_TX_DSP, dsp_name)])); } - BOOST_FOREACH(const std::string &dsp_name, mboard[usrp::MBOARD_PROP_RX_DBOARD_NAMES].as<prop_names_t>()){ - ss << make_border(get_dboard_pp_string("RX", mboard[named_prop_t(usrp::MBOARD_PROP_RX_DBOARD, dsp_name)])); - } - BOOST_FOREACH(const std::string &dsp_name, mboard[usrp::MBOARD_PROP_TX_DBOARD_NAMES].as<prop_names_t>()){ - ss << make_border(get_dboard_pp_string("TX", mboard[named_prop_t(usrp::MBOARD_PROP_TX_DBOARD, dsp_name)])); + BOOST_FOREACH(const std::string &db_name, mboard[usrp::MBOARD_PROP_TX_DBOARD_NAMES].as<prop_names_t>()){ + ss << make_border(get_dboard_pp_string("TX", mboard[named_prop_t(usrp::MBOARD_PROP_TX_DBOARD, db_name)])); } return ss.str(); } diff --git a/host/utils/usrp_burn_db_eeprom.cpp b/host/utils/usrp_burn_db_eeprom.cpp index 617417e09..58417bd68 100644 --- a/host/utils/usrp_burn_db_eeprom.cpp +++ b/host/utils/usrp_burn_db_eeprom.cpp @@ -37,10 +37,13 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //command line variables std::string args, slot, unit; static const uhd::dict<std::string, mboard_prop_t> unit_to_db_prop = boost::assign::map_list_of - ("RX", MBOARD_PROP_RX_DBOARD) ("TX", MBOARD_PROP_TX_DBOARD) + ("RX", MBOARD_PROP_RX_DBOARD) ("TX", MBOARD_PROP_TX_DBOARD) ("GDB", MBOARD_PROP_TX_DBOARD) ; static const uhd::dict<std::string, mboard_prop_t> unit_to_db_names_prop = boost::assign::map_list_of - ("RX", MBOARD_PROP_RX_DBOARD_NAMES) ("TX", MBOARD_PROP_TX_DBOARD_NAMES) + ("RX", MBOARD_PROP_RX_DBOARD_NAMES) ("TX", MBOARD_PROP_TX_DBOARD_NAMES) ("GDB", MBOARD_PROP_TX_DBOARD_NAMES) + ; + static const uhd::dict<std::string, dboard_prop_t> unit_to_db_eeprom_prop = boost::assign::map_list_of + ("RX", DBOARD_PROP_DBOARD_EEPROM) ("TX", DBOARD_PROP_DBOARD_EEPROM) ("GDB", DBOARD_PROP_GBOARD_EEPROM) ; po::options_description desc("Allowed options"); @@ -48,7 +51,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ ("help", "help message") ("args", po::value<std::string>(&args)->default_value(""), "device address args [default = \"\"]") ("slot", po::value<std::string>(&slot)->default_value(""), "dboard slot name [default is blank for automatic]") - ("unit", po::value<std::string>(&unit)->default_value(""), "which unit [RX or TX]") + ("unit", po::value<std::string>(&unit)->default_value(""), "which unit [RX, TX, or GDB]") ("id", po::value<std::string>(), "dboard id to burn, omit for readback") ("ser", po::value<std::string>(), "serial to burn, omit for readback") ; @@ -82,19 +85,19 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ std::string prefix = unit + ":" + slot; std::cout << boost::format("Reading EEPROM on %s dboard...") % prefix << std::endl; - dboard_eeprom_t db_eeprom = dboard[DBOARD_PROP_DBOARD_EEPROM].as<dboard_eeprom_t>(); + dboard_eeprom_t db_eeprom = dboard[unit_to_db_eeprom_prop[unit]].as<dboard_eeprom_t>(); //------------- handle the dboard ID -----------------------------// if (vm.count("id")){ db_eeprom.id = dboard_id_t::from_string(vm["id"].as<std::string>()); - dboard[DBOARD_PROP_DBOARD_EEPROM] = db_eeprom; + dboard[unit_to_db_eeprom_prop[unit]] = db_eeprom; } std::cout << boost::format(" Current ID: %s") % db_eeprom.id.to_pp_string() << std::endl; //------------- handle the dboard serial--------------------------// if (vm.count("ser")){ db_eeprom.serial = vm["ser"].as<std::string>(); - dboard[DBOARD_PROP_DBOARD_EEPROM] = db_eeprom; + dboard[unit_to_db_eeprom_prop[unit]] = db_eeprom; } std::cout << boost::format(" Current serial: \"%s\"") % db_eeprom.serial << std::endl; |