aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/mpmd/mpmd_impl.cpp
diff options
context:
space:
mode:
authorSamuel O'Brien <sam.obrien@ni.com>2020-07-24 08:35:35 -0500
committerAaron Rossetto <aaron.rossetto@ni.com>2020-10-28 15:25:48 -0500
commit00c306d5c441e60e7dfd2516e05e4e433977ecee (patch)
tree998752676d4ff9dbd06ad194056a214e7fdc763c /host/lib/usrp/mpmd/mpmd_impl.cpp
parentbd278a4b936f3e30f51d7cb9ff489f3ff7215379 (diff)
downloaduhd-00c306d5c441e60e7dfd2516e05e4e433977ecee.tar.gz
uhd-00c306d5c441e60e7dfd2516e05e4e433977ecee.tar.bz2
uhd-00c306d5c441e60e7dfd2516e05e4e433977ecee.zip
sim: Integrate simulator into UHD
This commit adds a device::register_device which allows uhd to start up a simulator when uhd is called with the arguments type=sim. Creating the device object creates a subprocess using pybind and an embedded interpreter, and destroying the object cleans up those subprocesses. Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
Diffstat (limited to 'host/lib/usrp/mpmd/mpmd_impl.cpp')
-rw-r--r--host/lib/usrp/mpmd/mpmd_impl.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/host/lib/usrp/mpmd/mpmd_impl.cpp b/host/lib/usrp/mpmd/mpmd_impl.cpp
index 7aa9fd8bb..f02e7795c 100644
--- a/host/lib/usrp/mpmd/mpmd_impl.cpp
+++ b/host/lib/usrp/mpmd/mpmd_impl.cpp
@@ -152,11 +152,10 @@ mpmd_impl::mpmd_impl(const device_addr_t& device_args)
{
const device_addrs_t mb_args_without_prefs = separate_device_addr(device_args);
device_addrs_t mb_args;
- for (size_t i = 0; i < mb_args_without_prefs.size(); ++i)
- {
+ for (size_t i = 0; i < mb_args_without_prefs.size(); ++i) {
mb_args.push_back(prefs::get_usrp_args(mb_args_without_prefs[i]));
}
- const size_t num_mboards = mb_args.size();
+ const size_t num_mboards = mb_args.size();
_mb.reserve(num_mboards);
const bool serialize_init = device_args.has_key("serialize_init");
const bool skip_init = device_args.has_key("skip_init");
@@ -209,6 +208,14 @@ mpmd_impl::mpmd_impl(const device_addr_t& device_args)
mpmd_impl::~mpmd_impl()
{
+ _deinit();
+}
+
+/*****************************************************************************
+ * Protected methods
+ ****************************************************************************/
+void mpmd_impl::_deinit()
+{
_tree.reset();
_mb.clear();
}