diff options
author | Lane Kolbly <lane.kolbly@ni.com> | 2022-03-18 15:41:55 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2022-03-23 16:14:07 -0500 |
commit | 1ba8c2517d7162e0a5df1006abffcfc0ca910394 (patch) | |
tree | eaeb4a6e21c0a928b963118fcfbd184229254477 /host | |
parent | 2e8f7484a4497c1b3f1f2caff32d9269ca492ffb (diff) | |
download | uhd-1ba8c2517d7162e0a5df1006abffcfc0ca910394.tar.gz uhd-1ba8c2517d7162e0a5df1006abffcfc0ca910394.tar.bz2 uhd-1ba8c2517d7162e0a5df1006abffcfc0ca910394.zip |
host: x410: Cache GPIO source in mb_controller
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp | 3 | ||||
-rw-r--r-- | host/lib/include/uhdlib/usrp/common/rpc.py | 3 | ||||
-rw-r--r-- | host/lib/usrp/mpmd/mpmd_mb_controller.cpp | 7 |
3 files changed, 12 insertions, 1 deletions
diff --git a/host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp b/host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp index f4f6e0ba7..fffa85628 100644 --- a/host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp +++ b/host/lib/include/uhdlib/usrp/common/mpmd_mb_controller.hpp @@ -123,6 +123,9 @@ private: std::vector<std::string> _gpio_banks; std::unordered_map<std::string, std::vector<std::string>> _gpio_srcs; + //! Cache of currently set GPIO sources + std::unordered_map<std::string, std::vector<std::string>> _current_gpio_src; + std::vector<mb_controller::sync_source_updater_t> _sync_source_updaters; public: diff --git a/host/lib/include/uhdlib/usrp/common/rpc.py b/host/lib/include/uhdlib/usrp/common/rpc.py index b33ec773b..f51d2796d 100644 --- a/host/lib/include/uhdlib/usrp/common/rpc.py +++ b/host/lib/include/uhdlib/usrp/common/rpc.py @@ -92,6 +92,9 @@ IFACES = [ fn_from_string("void dio_set_voltage_level(const std::string& port, const std::string& level)"), fn_from_string("void dio_set_port_mapping(const std::string& mapping)"), fn_from_string("void dio_set_pin_directions(const std::string& port, uint32_t values)"), + + # GPIO + fn_from_string("std::vector<std::string> get_gpio_src(const std::string& bank)"), ]), Interface("dio_rpc", [ fn_from_string("std::vector<std::string> dio_get_supported_voltage_levels(const std::string& port)"), diff --git a/host/lib/usrp/mpmd/mpmd_mb_controller.cpp b/host/lib/usrp/mpmd/mpmd_mb_controller.cpp index cdc86b086..c03f66da3 100644 --- a/host/lib/usrp/mpmd/mpmd_mb_controller.cpp +++ b/host/lib/usrp/mpmd/mpmd_mb_controller.cpp @@ -334,7 +334,11 @@ std::vector<std::string> mpmd_mb_controller::get_gpio_src(const std::string& ban UHD_LOG_ERROR("MPMD", "Invalid GPIO bank: `" << bank << "'"); throw uhd::key_error(std::string("Invalid GPIO bank: ") + bank); } - return _rpc->get_gpio_src(bank); + if (_current_gpio_src.count(bank)) { + return _current_gpio_src[bank]; + } else { + return _rpc->get_gpio_src(bank); + } } void mpmd_mb_controller::set_gpio_src( @@ -345,6 +349,7 @@ void mpmd_mb_controller::set_gpio_src( throw uhd::key_error(std::string("Invalid GPIO bank: ") + bank); } _rpc->set_gpio_src(bank, src); + _current_gpio_src[bank] = src; } void mpmd_mb_controller::register_sync_source_updater( |