aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Transceiver52M/UHDDevice.cpp43
-rw-r--r--configure.ac2
2 files changed, 16 insertions, 29 deletions
diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp
index a6ac8e6..65bf345 100644
--- a/Transceiver52M/UHDDevice.cpp
+++ b/Transceiver52M/UHDDevice.cpp
@@ -210,6 +210,8 @@ public:
private:
uhd::usrp::multi_usrp::sptr usrp_dev;
+ uhd::tx_streamer::sptr tx_stream;
+ uhd::rx_streamer::sptr rx_stream;
enum busType bus;
double desired_smpl_rt, actual_smpl_rt;
@@ -316,16 +318,8 @@ void uhd_device::init_gains()
void uhd_device::set_ref_clk(bool ext_clk)
{
- uhd::clock_config_t clk_cfg;
-
- clk_cfg.pps_source = uhd::clock_config_t::PPS_SMA;
-
if (ext_clk)
- clk_cfg.ref_source = uhd::clock_config_t::REF_SMA;
- else
- clk_cfg.ref_source = uhd::clock_config_t::REF_INT;
-
- usrp_dev->set_clock_config(clk_cfg);
+ usrp_dev->set_clock_source("external");
return;
}
@@ -477,10 +471,14 @@ bool uhd_device::open(const std::string &args)
#ifdef EXTREF
set_ref_clk(true);
#endif
+ // Create TX and RX streamers
+ uhd::stream_args_t stream_args("sc16");
+ tx_stream = usrp_dev->get_tx_stream(stream_args);
+ rx_stream = usrp_dev->get_rx_stream(stream_args);
// Number of samples per over-the-wire packet
- tx_spp = usrp_dev->get_device()->get_max_send_samps_per_packet();
- rx_spp = usrp_dev->get_device()->get_max_recv_samps_per_packet();
+ tx_spp = tx_stream->get_max_num_samps();
+ rx_spp = rx_stream->get_max_num_samps();
// Set rates
actual_smpl_rt = set_rates(desired_smpl_rt);
@@ -514,14 +512,8 @@ bool uhd_device::flush_recv(size_t num_pkts)
timeout = .01;
for (size_t i = 0; i < num_pkts; i++) {
- num_smpls = usrp_dev->get_device()->recv(
- buff,
- rx_spp,
- md,
- uhd::io_type_t::COMPLEX_INT16,
- uhd::device::RECV_MODE_ONE_PACKET,
- timeout);
-
+ num_smpls = rx_stream->recv(buff, rx_spp, md,
+ timeout, true);
if (!num_smpls) {
switch (md.error_code) {
case uhd::rx_metadata_t::ERROR_CODE_TIMEOUT:
@@ -673,13 +665,12 @@ int uhd_device::readSamples(short *buf, int len, bool *overrun,
// Receive samples from the usrp until we have enough
while (rx_smpl_buf->avail_smpls(timestamp) < len) {
- size_t num_smpls = usrp_dev->get_device()->recv(
+ size_t num_smpls = rx_stream->recv(
(void*)pkt_buf,
rx_spp,
metadata,
- uhd::io_type_t::COMPLEX_INT16,
- uhd::device::RECV_MODE_ONE_PACKET);
-
+ 0.1,
+ true);
rx_pkt_cnt++;
// Check for errors
@@ -757,11 +748,7 @@ int uhd_device::writeSamples(short *buf, int len, bool *underrun,
}
}
- size_t num_smpls = usrp_dev->get_device()->send(buf,
- len,
- metadata,
- uhd::io_type_t::COMPLEX_INT16,
- uhd::device::SEND_MODE_FULL_BUFF);
+ size_t num_smpls = tx_stream->send(buf, len, metadata);
if (num_smpls != (unsigned) len) {
LOG(ALERT) << "UHD: Device send timed out";
diff --git a/configure.ac b/configure.ac
index 03028c2..1c96f51 100644
--- a/configure.ac
+++ b/configure.ac
@@ -98,7 +98,7 @@ AS_IF([test "x$with_usrp1" = "xyes"], [
])
AS_IF([test "x$with_uhd" = "xyes"],[
- PKG_CHECK_MODULES(UHD, uhd >= 003.002.000)
+ PKG_CHECK_MODULES(UHD, uhd >= 003.004.000)
AC_DEFINE(USE_UHD, 1, Define to 1 if using UHD)
])