diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-09-26 18:22:25 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-09-29 10:50:56 -0700 |
commit | 83dde40090e0bbd91c304602cc0e3c365f7878bb (patch) | |
tree | c404968e3d6d35795f331ade6ad3c176f3c1bc8b /host/lib/usrp/x300/x300_impl.cpp | |
parent | 59736a5bf512db83a6bd7250e14b13c7464770fc (diff) | |
download | uhd-83dde40090e0bbd91c304602cc0e3c365f7878bb.tar.gz uhd-83dde40090e0bbd91c304602cc0e3c365f7878bb.tar.bz2 uhd-83dde40090e0bbd91c304602cc0e3c365f7878bb.zip |
uhd: Changed mboard_eeprom_t interface, refactored MB EEPROM code
- uhd::usrp::mboard_eeprom_t is now simply a map. Its commit() method
has no utility being a public API call, because the user never gets
access to the appropriate I2C object (Minor API breakage)
- The central mboard_eeprom.cpp file was broken up and put into many
smaller compilation units in every device's implementation folder.
- Renamed some of the constants (e.g. B000_* -> USRP1_*, N100_* ->
N200_*)
- Removed the N000_* EEPROM code, because, well, you know, there's no
such device
Diffstat (limited to 'host/lib/usrp/x300/x300_impl.cpp')
-rw-r--r-- | host/lib/usrp/x300/x300_impl.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index 1e22f7fb7..f98bdb5b1 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -18,7 +18,7 @@ #include "x300_impl.hpp" #include "x300_lvbitx.hpp" #include "x310_lvbitx.hpp" -#include "x300_mb_eeprom.hpp" +#include "x300_mb_eeprom_iface.hpp" #include "apply_corrections.hpp" #include <boost/algorithm/string.hpp> #include <boost/asio.hpp> @@ -125,7 +125,8 @@ static device_addrs_t x300_find_with_addr(const device_addr_t &hint) i2c_core_100_wb32::sptr zpu_i2c = i2c_core_100_wb32::make(zpu_ctrl, I2C1_BASE); x300_mb_eeprom_iface::sptr eeprom_iface = x300_mb_eeprom_iface::make(zpu_ctrl, zpu_i2c); - const mboard_eeprom_t mb_eeprom(*eeprom_iface, "X300"); + const mboard_eeprom_t mb_eeprom = + x300_impl::get_mb_eeprom(eeprom_iface); if (mb_eeprom.size() == 0 or x300_impl::claim_status(zpu_ctrl) == x300_impl::CLAIMED_BY_OTHER) { // Skip device claimed by another process @@ -233,7 +234,8 @@ static device_addrs_t x300_find_pcie(const device_addr_t &hint, bool explicit_qu i2c_core_100_wb32::sptr zpu_i2c = i2c_core_100_wb32::make(zpu_ctrl, I2C1_BASE); x300_mb_eeprom_iface::sptr eeprom_iface = x300_mb_eeprom_iface::make(zpu_ctrl, zpu_i2c); - const mboard_eeprom_t mb_eeprom(*eeprom_iface, "X300"); + const mboard_eeprom_t mb_eeprom = + x300_impl::get_mb_eeprom(eeprom_iface); if (mb_eeprom.size() == 0 or x300_impl::claim_status(zpu_ctrl) == x300_impl::CLAIMED_BY_OTHER) { // Skip device claimed by another process @@ -783,13 +785,21 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr) x300_mb_eeprom_iface::sptr eeprom16 = x300_mb_eeprom_iface::make(mb.zpu_ctrl, mb.zpu_i2c); if (dev_addr.has_key("blank_eeprom")) { - UHD_LOGGER_WARNING("X300") << "Obliterating the motherboard EEPROM..." ; + UHD_LOGGER_WARNING("X300") << "Obliterating the motherboard EEPROM..."; eeprom16->write_eeprom(0x50, 0, byte_vector_t(256, 0xff)); } - const mboard_eeprom_t mb_eeprom(*eeprom16, "X300"); + + const mboard_eeprom_t mb_eeprom = get_mb_eeprom(eeprom16); _tree->create<mboard_eeprom_t>(mb_path / "eeprom") + // Initialize the property with a current copy of the EEPROM contents .set(mb_eeprom) - .add_coerced_subscriber(boost::bind(&x300_impl::set_mb_eeprom, this, mb.zpu_i2c, _1)); + // Whenever this property is written, update the chip + .add_coerced_subscriber( + [this, eeprom16](const mboard_eeprom_t &mb_eeprom){ + this->set_mb_eeprom(eeprom16, mb_eeprom); + } + ) + ; bool recover_mb_eeprom = dev_addr.has_key("recover_mb_eeprom"); if (recover_mb_eeprom) { @@ -1524,16 +1534,6 @@ bool x300_impl::is_pps_present(mboard_members_t& mb) } /*********************************************************************** - * eeprom - **********************************************************************/ - -void x300_impl::set_mb_eeprom(i2c_iface::sptr i2c, const mboard_eeprom_t &mb_eeprom) -{ - i2c_iface::sptr eeprom16 = i2c->eeprom16(); - mb_eeprom.commit(*eeprom16, "X300"); -} - -/*********************************************************************** * claimer logic **********************************************************************/ |