diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-10-09 17:44:02 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:04:02 -0800 |
commit | cea45dda8f7d7918930a6b1150913390d4480037 (patch) | |
tree | 66ca4ca6bdabe32e023317afae8bde674ecaf329 /host | |
parent | 9a9759e2cfea3de602dda3053c1a4a46005abeb1 (diff) | |
download | uhd-cea45dda8f7d7918930a6b1150913390d4480037.tar.gz uhd-cea45dda8f7d7918930a6b1150913390d4480037.tar.bz2 uhd-cea45dda8f7d7918930a6b1150913390d4480037.zip |
mpm: Add mboard EEPROM support
MPMD binds a property for the mboard EEPROM to the appropriate RPC
calls. PeriphManager now provides default implementations for an mboard
EEPROM.
Diffstat (limited to 'host')
-rw-r--r-- | host/include/uhd/types/eeprom.hpp | 20 | ||||
-rw-r--r-- | host/lib/usrp/mpmd/mpmd_impl.cpp | 25 |
2 files changed, 43 insertions, 2 deletions
diff --git a/host/include/uhd/types/eeprom.hpp b/host/include/uhd/types/eeprom.hpp new file mode 100644 index 000000000..814d429c8 --- /dev/null +++ b/host/include/uhd/types/eeprom.hpp @@ -0,0 +1,20 @@ +// +// Copyright 2017 Ettus Research (National Instruments Corp.) +// +// SPDX-License-Identifier: GPL-3.0 +// + +#ifndef INCLUDED_UHD_EEPROM_HPP +#define INCLUDED_UHD_EEPROM_HPP + +#include <map> +#include <string> + +namespace uhd { + + typedef std::map<std::string, std::string> eeprom_map_t; + + +} /* namespace uhd */ + +#endif /* INCLUDED_UHD_EEPROM_HPP */ diff --git a/host/lib/usrp/mpmd/mpmd_impl.cpp b/host/lib/usrp/mpmd/mpmd_impl.cpp index 1b22ed294..965ede6f5 100644 --- a/host/lib/usrp/mpmd/mpmd_impl.cpp +++ b/host/lib/usrp/mpmd/mpmd_impl.cpp @@ -26,6 +26,8 @@ #include <uhd/utils/static.hpp> #include <uhd/utils/tasks.hpp> #include <uhd/types/sensors.hpp> +#include <uhd/types/eeprom.hpp> +#include <uhd/usrp/mboard_eeprom.hpp> #include <boost/algorithm/string.hpp> #include <boost/asio.hpp> #include <boost/make_shared.hpp> @@ -128,6 +130,27 @@ namespace { }) ; } + + /*** EEPROM *********************************************************/ + tree->create<uhd::usrp::mboard_eeprom_t>(mb_path / "eeprom") + .add_coerced_subscriber([mb](const uhd::usrp::mboard_eeprom_t& mb_eeprom){ + eeprom_map_t eeprom_map; + for (const auto& key : mb_eeprom.keys()) { + eeprom_map[key] = mb_eeprom[key]; + } + mb->rpc->notify_with_token("set_mb_eeprom", eeprom_map); + }) + .set_publisher([mb](){ + auto mb_eeprom = + mb->rpc->request_with_token<std::map<std::string, std::string>>( + "get_mb_eeprom" + ); + uhd::usrp::mboard_eeprom_t mb_eeprom_dict( + mb_eeprom.cbegin(), mb_eeprom.cend() + ); + return mb_eeprom_dict; + }) + ; } void reset_time_synchronized(uhd::property_tree::sptr tree) @@ -284,8 +307,6 @@ mpmd_mboard_impl::uptr mpmd_impl::setup_mb( // query more information about FPGA/MPM - // Call init on periph_manager, this will init the dboards/mboard, maybe - // even selfcal and everything // Query time/clock sources on mboards/dboards // Throw rpc calls with boost bind into the property tree? |