aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M/UHDDevice.cpp
diff options
context:
space:
mode:
authorTom Tsou <tom.tsou@ettus.com>2016-07-17 19:29:08 -0700
committerTom Tsou <tom.tsou@ettus.com>2016-07-17 19:34:22 -0700
commit2f3e60bc1f7da051183fe00f961d14da6d2c5981 (patch)
treec4a8ffdb1e0f2c23f4899078ba1a7153b537a16f /Transceiver52M/UHDDevice.cpp
parentcbfef6e40a030a7e99c8bba49482ac53f05b803b (diff)
uhd: Add command line option for GPS reference
Unlike earlier versions of UHD, the current release (3.9.2) does not automatically select on-board GPSDO as the reference source. Modify the command line settings to allow explicit selection of GPS in addition to the external setting. Simultaneous GPS and external reference settingis disallowed. Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
Diffstat (limited to 'Transceiver52M/UHDDevice.cpp')
-rw-r--r--Transceiver52M/UHDDevice.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp
index e6a5326..4ed539e 100644
--- a/Transceiver52M/UHDDevice.cpp
+++ b/Transceiver52M/UHDDevice.cpp
@@ -269,7 +269,7 @@ public:
size_t chans, double offset);
~uhd_device();
- int open(const std::string &args, bool extref, bool swap_channels);
+ int open(const std::string &args, int ref, bool swap_channels);
bool start();
bool stop();
bool restart();
@@ -770,8 +770,10 @@ static bool uhd_e3xx_version_chk()
return true;
}
-int uhd_device::open(const std::string &args, bool extref, bool swap_channels)
+int uhd_device::open(const std::string &args, int ref, bool swap_channels)
{
+ const char *refstr;
+
// Find UHD devices
uhd::device_addr_t addr(args);
uhd::device_addrs_t dev_addrs = uhd::device::find(addr);
@@ -828,8 +830,22 @@ int uhd_device::open(const std::string &args, bool extref, bool swap_channels)
rx_gains.resize(chans);
rx_buffers.resize(chans);
- if (extref)
- usrp_dev->set_clock_source("external");
+ switch (ref) {
+ case REF_INTERNAL:
+ refstr = "internal";
+ break;
+ case REF_EXTERNAL:
+ refstr = "external";
+ break;
+ case REF_GPS:
+ refstr = "gpsdo";
+ break;
+ default:
+ LOG(ALERT) << "Invalid reference type";
+ return -1;
+ }
+
+ usrp_dev->set_clock_source(refstr);
// Set rates
double _rx_rate = select_rate(dev_type, rx_sps, iface);