From fab4a5dd1708de6c5dc5fb4dc50b396a4adfeb51 Mon Sep 17 00:00:00 2001 From: Virendra Kakade Date: Tue, 30 Apr 2019 17:05:28 -0500 Subject: mpmd: Add support to delay and trigger fpga/dts load after update Add a new image_loader argument delay_reload to provide a way to update components but optionally delay the actual load. Similarly add a new argument, just_reload, to enable uhd to reload the fpga/dts components. Signed-off-by: Virendra Kakade --- host/lib/usrp/mpmd/mpmd_prop_tree.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'host/lib/usrp/mpmd/mpmd_prop_tree.cpp') diff --git a/host/lib/usrp/mpmd/mpmd_prop_tree.cpp b/host/lib/usrp/mpmd/mpmd_prop_tree.cpp index 556e2e48d..2bd955194 100644 --- a/host/lib/usrp/mpmd/mpmd_prop_tree.cpp +++ b/host/lib/usrp/mpmd/mpmd_prop_tree.cpp @@ -13,6 +13,8 @@ #include #include #include +#include +#include using namespace uhd; using namespace uhd::mpmd; @@ -34,6 +36,7 @@ uhd::usrp::component_files_t _update_component( // Also construct a copy of just the metadata to store in the property tree uhd::usrp::component_files_t all_comps_copy; + bool just_reload = false; for (const auto& comp : comps) { // Make a map for update components args std::map metadata; @@ -43,6 +46,12 @@ uhd::usrp::component_files_t _update_component( for (const auto& key : comp.metadata.keys()) { metadata[key] = comp.metadata[key]; comp_copy.metadata[key] = comp.metadata[key]; + if (key == "just_reload") { + just_reload = + just_reload + | uhd::cast::from_str(metadata.at("just_reload")); + //| (boost::to_lower_copy(metadata.at("just_reload")) == "true"); + } } // Copy to the update component args all_data.push_back(comp.data); @@ -51,6 +60,15 @@ uhd::usrp::component_files_t _update_component( all_comps_copy.push_back(comp_copy); } + // If reset is specified we presume that the fpga/dts + // components were updated in the last uhd::image_loader::load() + // call and just reload the fpga/dts by resetting the peripheral + // manager. + if (just_reload) { + mb->rpc->notify_with_token(MPMD_DEFAULT_INIT_TIMEOUT, "reset_timer_and_mgr"); + return all_comps_copy; + } + // Now call update component mb->rpc->notify_with_token( MPMD_DEFAULT_INIT_TIMEOUT, "update_component", all_metadata, all_data); -- cgit v1.2.3