diff options
author | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-05-17 13:20:21 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-05-19 12:34:00 -0500 |
commit | 75738ff113bf88568c6cb741be413aa8b9268e57 (patch) | |
tree | 5ed248fc2e0b1bedfe7a4ced765f25dad7b02344 /host/lib | |
parent | 01b631dc126b677bdad4698eba88481b83ad611b (diff) | |
download | uhd-75738ff113bf88568c6cb741be413aa8b9268e57.tar.gz uhd-75738ff113bf88568c6cb741be413aa8b9268e57.tar.bz2 uhd-75738ff113bf88568c6cb741be413aa8b9268e57.zip |
multi_usrp, x300: Relax LO set API strictness
This PR relaxes the set_{rx|tx}_lo_{source|sources|export_enabled}()
functions to allow them to be called with 'internal'/ALL_LOS or
false/ALL_LOS on devices which do not support changing their LO source
or exporting. This makes the get and set functions for those LOs
settings more symmetrical in that the values returned from the get
function can be successfully passed to the set function. Prior to this
change, calling the set functions would throw an error indicating that
the device does not support manual configuration of the LO.
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/usrp/multi_usrp.cpp | 24 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_radio_control.cpp | 12 |
2 files changed, 24 insertions, 12 deletions
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index b80790f64..bb5b9e5fc 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -1145,8 +1145,10 @@ public: } } } else { - throw uhd::runtime_error( - "This device does not support manual configuration of LOs"); + if (not(src == "internal" and name == ALL_LOS)) { + throw uhd::runtime_error( + "This device only supports setting internal source on all LOs"); + } } } @@ -1232,8 +1234,10 @@ public: } } } else { - throw uhd::runtime_error( - "This device does not support manual configuration of LOs"); + if (not(enabled == false and name == ALL_LOS)) { + throw uhd::runtime_error("This device only supports setting LO export " + "enabled to false on all LOs"); + } } } @@ -1374,8 +1378,10 @@ public: } } } else { - throw uhd::runtime_error("This device does not support manual " - "configuration of LOs"); + if (not(src == "internal" and name == ALL_LOS)) { + throw uhd::runtime_error( + "This device only supports setting internal source on all LOs"); + } } } @@ -1456,8 +1462,10 @@ public: } } } else { - throw uhd::runtime_error( - "This device does not support manual configuration of LOs"); + if (not(enabled == false and name == ALL_LOS)) { + throw uhd::runtime_error("This device only supports setting LO export " + "enabled to false on all LOs"); + } } } diff --git a/host/lib/usrp/x300/x300_radio_control.cpp b/host/lib/usrp/x300/x300_radio_control.cpp index c6750e397..73006a7c8 100644 --- a/host/lib/usrp/x300/x300_radio_control.cpp +++ b/host/lib/usrp/x300/x300_radio_control.cpp @@ -630,8 +630,10 @@ public: } } } else { - throw uhd::runtime_error( - "This device does not support manual configuration of LOs"); + if (not(src == "internal" and name == ALL_LOS)) { + throw uhd::runtime_error( + "This device only supports setting internal source on all LOs"); + } } } @@ -691,8 +693,10 @@ public: } } } else { - throw uhd::runtime_error( - "This device does not support manual configuration of LOs"); + if (not(enabled == false and name == ALL_LOS)) { + throw uhd::runtime_error("This device only supports setting LO export " + "enabled to false on all LOs"); + } } } |