aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-06-03 01:33:54 -0700
committerMartin Braun <martin.braun@ettus.com>2017-12-22 15:03:59 -0800
commit40235b8c5aba6acec2acdc4135b828b1d9785a96 (patch)
tree6570aa9f99872979e51106f5249fe82080c611dc /host/lib/usrp
parent0d659863da607acaaf15ab69a662af2da006f65e (diff)
downloaduhd-40235b8c5aba6acec2acdc4135b828b1d9785a96.tar.gz
uhd-40235b8c5aba6acec2acdc4135b828b1d9785a96.tar.bz2
uhd-40235b8c5aba6acec2acdc4135b828b1d9785a96.zip
mpm/mpmd: Call init() during UHD session init, not on hwd spawn
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/mpmd/mpmd_mboard_impl.cpp39
1 files changed, 32 insertions, 7 deletions
diff --git a/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp b/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp
index 82967ecad..135d2973e 100644
--- a/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp
+++ b/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp
@@ -22,7 +22,12 @@
#include <thread>
namespace {
- const size_t MPMD_RECLAIM_INTERVAL_MS = 1000;
+ //! Time between reclaims (ms)
+ const size_t MPMD_RECLAIM_INTERVAL_MS = 1000;
+ //! Default timeout value for the init() RPC call (ms)
+ const size_t MPMD_DEFAULT_INIT_TIMEOUT = 30000;
+ //! Default timeout value for RPC calls (ms)
+ const size_t MPMD_DEFAULT_RPC_TIMEOUT = 2000;
const std::string MPMD_DEFAULT_SESSION_ID = "UHD";
}
@@ -43,12 +48,6 @@ mpmd_mboard_impl::mpmd_mboard_impl(
<< rpc_server_addr
<< " mboard args: " << mb_args.to_string()
;
- auto device_info_dict = rpc->request<dev_info>("get_device_info");
- for (const auto &info_pair: device_info_dict) {
- device_info[info_pair.first] = info_pair.second;
- }
- UHD_LOGGER_TRACE("MPMD")
- << "MPM reports device info: " << device_info.to_string();
// Claim logic
auto rpc_token = rpc->request<std::string>("claim",
@@ -68,6 +67,32 @@ mpmd_mboard_impl::mpmd_mboard_impl(
);
});
+ // Init and query info
+ std::map<std::string, std::string> mpm_device_args;
+ const std::set<std::string> key_blacklist{ // TODO put this somewhere else
+ "serial", "claimed", "type", "rev", "addr"
+ };
+ for (const auto &key : mb_args.keys()) {
+ if (not key_blacklist.count(key)) {
+ mpm_device_args[key] = mb_args[key];
+ }
+ }
+ rpc->set_timeout(mb_args.cast<size_t>(
+ "init_timeout", MPMD_DEFAULT_INIT_TIMEOUT
+ ));
+ if (not rpc->request_with_token<bool>("init", mpm_device_args)) {
+ throw uhd::runtime_error("Failed to initialize device.");
+ }
+ auto device_info_dict = rpc->request<dev_info>("get_device_info");
+ for (const auto &info_pair : device_info_dict) {
+ device_info[info_pair.first] = info_pair.second;
+ }
+ UHD_LOGGER_TRACE("MPMD")
+ << "MPM reports device info: " << device_info.to_string();
+ rpc->set_timeout(mb_args.cast<size_t>(
+ "rpc_timeout", MPMD_DEFAULT_RPC_TIMEOUT
+ ));
+
// Initialize properties
this->num_xbars = rpc->request<size_t>("get_num_xbars");
// Local addresses are not yet valid after this!