diff options
author | michael-west <michael.west@ettus.com> | 2017-12-05 15:49:28 -0800 |
---|---|---|
committer | michael-west <michael.west@ettus.com> | 2017-12-19 18:25:54 -0800 |
commit | 109a2d26b61ce753ed5eca75e7b525bdf538e148 (patch) | |
tree | 66c1dbbae782b38876a1eead55daa6b95a499274 | |
parent | ffc8b89b4472fe12756f88e7edb67afc5634c13f (diff) | |
download | uhd-109a2d26b61ce753ed5eca75e7b525bdf538e148.tar.gz uhd-109a2d26b61ce753ed5eca75e7b525bdf538e148.tar.bz2 uhd-109a2d26b61ce753ed5eca75e7b525bdf538e148.zip |
UHD: Add eeprom info to dboard_base
-rw-r--r-- | host/include/uhd/usrp/dboard_base.hpp | 5 | ||||
-rw-r--r-- | host/include/uhd/usrp/dboard_manager.hpp | 15 | ||||
-rw-r--r-- | host/lib/usrp/b100/b100_impl.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/dboard_base.cpp | 14 | ||||
-rw-r--r-- | host/lib/usrp/dboard_ctor_args.hpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/dboard_manager.cpp | 57 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_impl.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_radio_ctrl_impl.cpp | 8 |
9 files changed, 67 insertions, 50 deletions
diff --git a/host/include/uhd/usrp/dboard_base.hpp b/host/include/uhd/usrp/dboard_base.hpp index b106a1ac6..109297bb4 100644 --- a/host/include/uhd/usrp/dboard_base.hpp +++ b/host/include/uhd/usrp/dboard_base.hpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010,2017 Ettus Research, A National Instruments Company // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -25,6 +25,7 @@ #include <boost/shared_ptr.hpp> #include <uhd/usrp/dboard_id.hpp> #include <uhd/usrp/dboard_iface.hpp> +#include <uhd/usrp/dboard_eeprom.hpp> namespace uhd{ namespace usrp{ @@ -54,6 +55,8 @@ protected: dboard_iface::sptr get_iface(void); dboard_id_t get_rx_id(void); dboard_id_t get_tx_id(void); + dboard_eeprom_t get_rx_eeprom(void); + dboard_eeprom_t get_tx_eeprom(void); property_tree::sptr get_rx_subtree(void); property_tree::sptr get_tx_subtree(void); diff --git a/host/include/uhd/usrp/dboard_manager.hpp b/host/include/uhd/usrp/dboard_manager.hpp index e07b87ad8..46716eab9 100644 --- a/host/include/uhd/usrp/dboard_manager.hpp +++ b/host/include/uhd/usrp/dboard_manager.hpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010,2017 Ettus Research, A National Instruments Company // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -22,6 +22,7 @@ #include <uhd/property_tree.hpp> #include <uhd/usrp/dboard_base.hpp> #include <uhd/usrp/dboard_id.hpp> +#include <uhd/usrp/dboard_eeprom.hpp> #include <boost/utility.hpp> #include <boost/shared_ptr.hpp> #include <string> @@ -119,18 +120,18 @@ public: /*! * Make a new dboard manager. - * \param rx_dboard_id the id of the rx dboard - * \param tx_dboard_id the id of the tx dboard - * \param gdboard_id the id of the grand-dboard + * \param rx_eeprom the RX EEPROM data + * \param tx_eeprom the TX EEPROM data + * \param gdb_eeprom the grand-dboard EEPROM data * \param iface the custom dboard interface * \param subtree the subtree to load with props * \param defer_db_init initialising the daughterboards (DEPRECATED) * \return an sptr to the new dboard manager */ static sptr make( - dboard_id_t rx_dboard_id, - dboard_id_t tx_dboard_id, - dboard_id_t gdboard_id, + dboard_eeprom_t rx_eeprom, + dboard_eeprom_t tx_eeprom, + dboard_eeprom_t gdb_eeprom, dboard_iface::sptr iface, property_tree::sptr subtree, bool defer_db_init = false diff --git a/host/lib/usrp/b100/b100_impl.cpp b/host/lib/usrp/b100/b100_impl.cpp index 1a38bf3b7..b73552ec5 100644 --- a/host/lib/usrp/b100/b100_impl.cpp +++ b/host/lib/usrp/b100/b100_impl.cpp @@ -1,5 +1,5 @@ // -// Copyright 2012-2014 Ettus Research LLC +// Copyright 2012-2014,2017 Ettus Research, A National Instruments Company // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -471,7 +471,7 @@ b100_impl::b100_impl(const device_addr_t &device_addr){ //create a new dboard interface and manager _dboard_manager = dboard_manager::make( - rx_db_eeprom.id, tx_db_eeprom.id, gdb_eeprom.id, + rx_db_eeprom, tx_db_eeprom, gdb_eeprom, make_b100_dboard_iface(_fifo_ctrl, _fpga_i2c_ctrl, _fifo_ctrl/*spi*/, _clock_ctrl, _codec_ctrl), _tree->subtree(mb_path / "dboards/A") ); diff --git a/host/lib/usrp/dboard_base.cpp b/host/lib/usrp/dboard_base.cpp index 465b9e489..bacb2a5a1 100644 --- a/host/lib/usrp/dboard_base.cpp +++ b/host/lib/usrp/dboard_base.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010-2011 Ettus Research LLC +// Copyright 2010-2011,2017 Ettus Research, A National Instruments Company // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -44,11 +44,19 @@ dboard_iface::sptr dboard_base::get_iface(void){ } dboard_id_t dboard_base::get_rx_id(void){ - return _impl->args.rx_id; + return _impl->args.rx_eeprom.id; } dboard_id_t dboard_base::get_tx_id(void){ - return _impl->args.tx_id; + return _impl->args.tx_eeprom.id; +} + +dboard_eeprom_t dboard_base::get_rx_eeprom(void){ + return _impl->args.rx_eeprom; +} + +dboard_eeprom_t dboard_base::get_tx_eeprom(void){ + return _impl->args.tx_eeprom; } property_tree::sptr dboard_base::get_rx_subtree(void){ diff --git a/host/lib/usrp/dboard_ctor_args.hpp b/host/lib/usrp/dboard_ctor_args.hpp index c8e4006d1..db26193cc 100644 --- a/host/lib/usrp/dboard_ctor_args.hpp +++ b/host/lib/usrp/dboard_ctor_args.hpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010,2017 Ettus Research, A National Instruments Company // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -19,9 +19,9 @@ #define INCLUDED_LIBUHD_USRP_DBOARD_CTOR_ARGS_HPP #include <uhd/property_tree.hpp> -#include <uhd/usrp/dboard_id.hpp> #include <uhd/usrp/dboard_base.hpp> #include <uhd/usrp/dboard_iface.hpp> +#include <uhd/usrp/dboard_eeprom.hpp> #include <string> namespace uhd{ namespace usrp{ @@ -30,7 +30,7 @@ namespace uhd{ namespace usrp{ public: std::string sd_name; dboard_iface::sptr db_iface; - dboard_id_t rx_id, tx_id; + dboard_eeprom_t rx_eeprom, tx_eeprom; property_tree::sptr rx_subtree, tx_subtree; dboard_base::sptr rx_container, tx_container; diff --git a/host/lib/usrp/dboard_manager.cpp b/host/lib/usrp/dboard_manager.cpp index 56cd08fd7..6132b4259 100644 --- a/host/lib/usrp/dboard_manager.cpp +++ b/host/lib/usrp/dboard_manager.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010-2011 Ettus Research LLC +// Copyright 2010-2011,2017 Ettus Research, A National Instruments Company // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -179,8 +179,8 @@ class dboard_manager_impl : public dboard_manager{ public: dboard_manager_impl( - dboard_id_t rx_dboard_id, - dboard_id_t tx_dboard_id, + dboard_eeprom_t rx_eeprom, + dboard_eeprom_t tx_eeprom, dboard_iface::sptr iface, property_tree::sptr subtree, bool defer_db_init @@ -198,7 +198,7 @@ public: void initialize_dboards(); private: - void init(dboard_id_t, dboard_id_t, property_tree::sptr, bool); + void init(dboard_eeprom_t, dboard_eeprom_t, property_tree::sptr, bool); //list of rx and tx dboards in this dboard_manager //each dboard here is actually a subdevice proxy //the subdevice proxy is internal to the cpp file @@ -216,17 +216,17 @@ private: * make routine for dboard manager **********************************************************************/ dboard_manager::sptr dboard_manager::make( - dboard_id_t rx_dboard_id, - dboard_id_t tx_dboard_id, - dboard_id_t gdboard_id, + dboard_eeprom_t rx_eeprom, + dboard_eeprom_t tx_eeprom, + dboard_eeprom_t gdb_eeprom, dboard_iface::sptr iface, property_tree::sptr subtree, bool defer_db_init ){ return dboard_manager::sptr( new dboard_manager_impl( - rx_dboard_id, - (gdboard_id == dboard_id_t::none())? tx_dboard_id : gdboard_id, + rx_eeprom, + (gdb_eeprom.id == dboard_id_t::none())? tx_eeprom : gdb_eeprom, iface, subtree, defer_db_init ) ); @@ -236,8 +236,8 @@ dboard_manager::sptr dboard_manager::make( * implementation class methods **********************************************************************/ dboard_manager_impl::dboard_manager_impl( - dboard_id_t rx_dboard_id, - dboard_id_t tx_dboard_id, + dboard_eeprom_t rx_eeprom, + dboard_eeprom_t tx_eeprom, dboard_iface::sptr iface, property_tree::sptr subtree, bool defer_db_init @@ -245,7 +245,7 @@ dboard_manager_impl::dboard_manager_impl( _iface(iface) { try{ - this->init(rx_dboard_id, tx_dboard_id, subtree, defer_db_init); + this->init(rx_eeprom, tx_eeprom, subtree, defer_db_init); } catch(const std::exception &e){ UHD_MSG(error) << boost::format( @@ -257,24 +257,29 @@ dboard_manager_impl::dboard_manager_impl( if (subtree->exists("rx_frontends")) subtree->remove("rx_frontends"); if (subtree->exists("tx_frontends")) subtree->remove("tx_frontends"); if (subtree->exists("iface")) subtree->remove("iface"); - this->init(dboard_id_t::none(), dboard_id_t::none(), subtree, false); + dboard_eeprom_t dummy_eeprom; + dummy_eeprom.id = dboard_id_t::none(); + this->init(dummy_eeprom, dummy_eeprom, subtree, false); } } void dboard_manager_impl::init( - dboard_id_t rx_dboard_id, dboard_id_t tx_dboard_id, property_tree::sptr subtree, bool defer_db_init + dboard_eeprom_t rx_eeprom, + dboard_eeprom_t tx_eeprom, + property_tree::sptr subtree, + bool defer_db_init ){ //find the dboard key matches for the dboard ids dboard_key_t rx_dboard_key, tx_dboard_key, xcvr_dboard_key; BOOST_FOREACH(const dboard_key_t &key, get_id_to_args_map().keys()){ if (key.is_xcvr()){ - if (rx_dboard_id == key.rx_id() and tx_dboard_id == key.tx_id()) xcvr_dboard_key = key; - if (rx_dboard_id == key.rx_id()) rx_dboard_key = key; //kept to handle warning - if (tx_dboard_id == key.tx_id()) tx_dboard_key = key; //kept to handle warning + if (rx_eeprom.id == key.rx_id() and tx_eeprom.id == key.tx_id()) xcvr_dboard_key = key; + if (rx_eeprom.id == key.rx_id()) rx_dboard_key = key; //kept to handle warning + if (rx_eeprom.id == key.tx_id()) tx_dboard_key = key; //kept to handle warning } else{ - if (rx_dboard_id == key.xx_id()) rx_dboard_key = key; - if (tx_dboard_id == key.xx_id()) tx_dboard_key = key; + if (rx_eeprom.id == key.xx_id()) rx_dboard_key = key; + if (tx_eeprom.id == key.xx_id()) tx_dboard_key = key; } } @@ -285,7 +290,7 @@ void dboard_manager_impl::init( "Is your daughter-board mounted properly?\n" "RX dboard ID: %s\n" "TX dboard ID: %s\n" - ) % rx_dboard_id.to_pp_string() % tx_dboard_id.to_pp_string(); + ) % rx_eeprom.id.to_pp_string() % tx_eeprom.id.to_pp_string(); } //initialize the gpio pins before creating subdevs @@ -310,8 +315,8 @@ void dboard_manager_impl::init( //create the container class. //a container class exists per N subdevs registered in a register_dboard* call db_ctor_args.sd_name = "common"; - db_ctor_args.rx_id = rx_dboard_id; - db_ctor_args.tx_id = tx_dboard_id; + db_ctor_args.rx_eeprom = rx_eeprom; + db_ctor_args.tx_eeprom = tx_eeprom; db_ctor_args.rx_subtree = subtree->subtree("rx_frontends/" + db_ctor_args.sd_name); db_ctor_args.tx_subtree = subtree->subtree("tx_frontends/" + db_ctor_args.sd_name); if (container_ctor) { @@ -362,8 +367,8 @@ void dboard_manager_impl::init( //create the container class. //a container class exists per N subdevs registered in a register_dboard* call db_ctor_args.sd_name = "common"; - db_ctor_args.rx_id = rx_dboard_id; - db_ctor_args.tx_id = dboard_id_t::none(); + db_ctor_args.rx_eeprom = rx_eeprom; + db_ctor_args.tx_eeprom.id = dboard_id_t::none(); db_ctor_args.rx_subtree = subtree->subtree("rx_frontends/" + db_ctor_args.sd_name); db_ctor_args.tx_subtree = property_tree::sptr(); if (rx_cont_ctor) { @@ -401,8 +406,8 @@ void dboard_manager_impl::init( //create the container class. //a container class exists per N subdevs registered in a register_dboard* call db_ctor_args.sd_name = "common"; - db_ctor_args.rx_id = dboard_id_t::none(); - db_ctor_args.tx_id = tx_dboard_id; + db_ctor_args.rx_eeprom.id = dboard_id_t::none(); + db_ctor_args.tx_eeprom = tx_eeprom; db_ctor_args.rx_subtree = property_tree::sptr(); db_ctor_args.tx_subtree = subtree->subtree("tx_frontends/" + db_ctor_args.sd_name); if (tx_cont_ctor) { diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp index 09352c5e0..b55a78f91 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.cpp +++ b/host/lib/usrp/usrp1/usrp1_impl.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010-2012,2014 Ettus Research LLC +// Copyright 2010-2012,2014,2017 Ettus Research, A National Instruments Company // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -378,7 +378,7 @@ usrp1_impl::usrp1_impl(const device_addr_t &device_addr){ _master_clock_rate, rx_db_eeprom.id ); _dbc[db].dboard_manager = dboard_manager::make( - rx_db_eeprom.id, tx_db_eeprom.id, gdb_eeprom.id, + rx_db_eeprom, tx_db_eeprom, gdb_eeprom, dboard_iface, _tree->subtree(mb_path / "dboards" / db) ); diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index ee2434fab..1a8dbeceb 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010-2012,2014 Ettus Research LLC +// Copyright 2010-2012,2014,2017 Ettus Research, A National Instruments Company // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -736,7 +736,7 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr) : //create a new dboard interface and manager _mbc[mb].dboard_manager = dboard_manager::make( - rx_db_eeprom.id, tx_db_eeprom.id, gdb_eeprom.id, + rx_db_eeprom, tx_db_eeprom, gdb_eeprom, make_usrp2_dboard_iface(_mbc[mb].wbiface, _mbc[mb].iface/*i2c*/, _mbc[mb].spiface, _mbc[mb].clock), _tree->subtree(mb_path / "dboards/A") ); diff --git a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp index a3bc2e691..a462ceea4 100644 --- a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp +++ b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015-2016 Ettus Research +// Copyright 2015-2017 Ettus Research, A National Instruments Company // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -372,9 +372,9 @@ void x300_radio_ctrl_impl::setup_radio( //create a new dboard manager boost::shared_ptr<x300_dboard_iface> db_iface = boost::make_shared<x300_dboard_iface>(db_config); _db_manager = dboard_manager::make( - _db_eeproms[RX_EEPROM_ADDR + DB_OFFSET].id, - _db_eeproms[TX_EEPROM_ADDR + DB_OFFSET].id, - _db_eeproms[GDB_EEPROM_ADDR + DB_OFFSET].id, + _db_eeproms[RX_EEPROM_ADDR + DB_OFFSET], + _db_eeproms[TX_EEPROM_ADDR + DB_OFFSET], + _db_eeproms[GDB_EEPROM_ADDR + DB_OFFSET], db_iface, _tree->subtree(db_path), true // defer daughterboard intitialization ); |