[hamradio-commits] [soapyuhd] 01/08: New upstream version 0.3.3
Andreas E. Bombe
aeb at moszumanska.debian.org
Mon Aug 7 16:02:42 UTC 2017
This is an automated email from the git hooks/post-receive script.
aeb pushed a commit to branch master
in repository soapyuhd.
commit ef7c8cf6bdcff5a6ac9caea28c2a93413a458a57
Author: Andreas Bombe <aeb at debian.org>
Date: Sun Aug 6 22:07:14 2017 -0400
New upstream version 0.3.3
---
Changelog.txt | 11 +++++
README.md | 7 +--
SoapyUHDDevice.cpp | 36 ++++++++++++++-
TypeHelpers.hpp | 22 ++++++++-
UHDSoapyDevice.cpp | 53 +++++++++++++++++++---
debian/changelog | 6 +++
debian/control | 4 +-
...-uhd.install => soapysdr0.6-module-uhd.install} | 0
8 files changed, 124 insertions(+), 15 deletions(-)
diff --git a/Changelog.txt b/Changelog.txt
index 80ea60d..26963fe 100644
--- a/Changelog.txt
+++ b/Changelog.txt
@@ -1,3 +1,14 @@
+Release 0.3.3 (2017-04-29)
+==========================
+
+- Results for frequency component with no tune result
+- Fix arg for set_rx_subdev_spec() in UHDSoapyDevice
+- Support getBandwidthRange()/getSampleRateRange()
+- UHDSoapyDevice supports zero length buffer send()
+- Implement timestamp interpolation for uhd rx streams
+- Added label convention to soapy uhd discovery routine
+- Support for optional gain range step in type conversions
+
Release 0.3.2 (2017-01-22)
==========================
diff --git a/README.md b/README.md
index 7a8789e..e15cd0e 100644
--- a/README.md
+++ b/README.md
@@ -1,15 +1,16 @@
# Soapy SDR plugins for UHD devices
-##Build Status
+## Build Status
- Travis: [](https://travis-ci.org/pothosware/SoapyUHD)
-##Dependencies
+## Dependencies
* UHD - https://github.com/EttusResearch/uhd/wiki
* SoapySDR - https://github.com/pothosware/SoapySDR/wiki
+* boost libraries - http://www.boost.org/
-##Documentation
+## Documentation
* https://github.com/pothosware/SoapyUHD/wiki
diff --git a/SoapyUHDDevice.cpp b/SoapyUHDDevice.cpp
index 9764977..8ab352a 100644
--- a/SoapyUHDDevice.cpp
+++ b/SoapyUHDDevice.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2016 Josh Blum
+// Copyright (c) 2014-2017 Josh Blum
// SPDX-License-Identifier: GPL-3.0
/***********************************************************************
@@ -37,7 +37,7 @@ public:
_type(args.at("type")),
_isNetworkDevice(args.count("addr") != 0)
{
- if (args.count("rx_subdev") != 0) _dev->set_tx_subdev_spec(args.at("rx_subdev"));
+ if (args.count("rx_subdev") != 0) _dev->set_rx_subdev_spec(args.at("rx_subdev"));
if (args.count("tx_subdev") != 0) _dev->set_tx_subdev_spec(args.at("tx_subdev"));
}
@@ -539,6 +539,13 @@ public:
double getFrequency(const int dir, const size_t channel, const std::string &name) const
{
+ //we have never tuned before, return the overall freq for RF, assume 0.0 for all else
+ if (_trCache.count(dir) == 0 or _trCache.at(dir).count(channel) == 0)
+ {
+ if (name == "RF") return this->getFrequency(dir, channel);
+ else return 0.0;
+ }
+
const uhd::tune_result_t tr = _trCache.at(dir).at(channel);
if (name == "RF") return tr.actual_rf_freq;
if (name == "BB") return tr.actual_dsp_freq;
@@ -602,6 +609,13 @@ public:
return SoapySDR::Device::listSampleRates(dir, channel);
}
+ SoapySDR::RangeList getSampleRateRange(const int dir, const size_t channel) const
+ {
+ if (dir == SOAPY_SDR_TX) return metaRangeToRangeList(_dev->get_tx_rates(channel));
+ if (dir == SOAPY_SDR_RX) return metaRangeToRangeList(_dev->get_rx_rates(channel));
+ return SoapySDR::Device::getSampleRateRange(dir, channel);
+ }
+
void setBandwidth(const int dir, const size_t channel, const double bw)
{
if (dir == SOAPY_SDR_TX) return _dev->set_tx_bandwidth(bw, channel);
@@ -622,6 +636,13 @@ public:
return SoapySDR::Device::listBandwidths(dir, channel);
}
+ SoapySDR::RangeList getBandwidthRange(const int dir, const size_t channel) const
+ {
+ if (dir == SOAPY_SDR_TX) return metaRangeToRangeList(_dev->get_tx_bandwidth_range(channel));
+ if (dir == SOAPY_SDR_RX) return metaRangeToRangeList(_dev->get_tx_bandwidth_range(channel));
+ return SoapySDR::Device::getBandwidthRange(dir, channel);
+ }
+
/*******************************************************************
* Clocking support
******************************************************************/
@@ -839,6 +860,17 @@ std::vector<SoapySDR::Kwargs> find_uhd(const SoapySDR::Kwargs &args_)
for (size_t i = 0; i < addrs.size(); i++)
{
SoapySDR::Kwargs result(dictToKwargs(addrs[i]));
+
+ //create displayable label if not present
+ if (result.count("label") == 0)
+ {
+ if (result.count("product") != 0)
+ result["label"] = result.at("product");
+
+ if (result.count("serial") != 0)
+ result["label"] += " " + result.at("serial");
+ }
+
result.erase(SOAPY_UHD_NO_DEEPER);
results.push_back(result);
}
diff --git a/TypeHelpers.hpp b/TypeHelpers.hpp
index 23bcb57..a7590f4 100644
--- a/TypeHelpers.hpp
+++ b/TypeHelpers.hpp
@@ -1,8 +1,9 @@
-// Copyright (c) 2014-2015 Josh Blum
+// Copyright (c) 2014-2017 Josh Blum
// SPDX-License-Identifier: GPL-3.0
#pragma once
#include <SoapySDR/Types.hpp>
+#include <SoapySDR/Version.hpp> //feature constants
#include <uhd/types/device_addr.hpp>
#include <uhd/types/ranges.hpp>
#include <uhd/types/sensors.hpp>
@@ -39,7 +40,11 @@ static inline SoapySDR::RangeList metaRangeToRangeList(const uhd::meta_range_t &
SoapySDR::RangeList out;
for (size_t i = 0; i < metaRange.size(); i++)
{
+ #ifdef SOAPY_SDR_API_HAS_RANGE_TYPE_STEP
+ out.push_back(SoapySDR::Range(metaRange[i].start(), metaRange[i].stop(), metaRange[i].step()));
+ #else
out.push_back(SoapySDR::Range(metaRange[i].start(), metaRange[i].stop()));
+ #endif
}
return out;
}
@@ -49,7 +54,11 @@ static inline uhd::meta_range_t rangeListToMetaRange(const SoapySDR::RangeList &
uhd::meta_range_t out;
for (size_t i = 0; i < ranges.size(); i++)
{
+ #ifdef SOAPY_SDR_API_HAS_RANGE_TYPE_STEP
+ out.push_back(uhd::range_t(ranges[i].minimum(), ranges[i].maximum(), ranges[i].step()));
+ #else
out.push_back(uhd::range_t(ranges[i].minimum(), ranges[i].maximum()));
+ #endif
}
if (out.empty()) out.push_back(uhd::range_t(0.0));
return out;
@@ -57,7 +66,11 @@ static inline uhd::meta_range_t rangeListToMetaRange(const SoapySDR::RangeList &
static inline SoapySDR::Range metaRangeToRange(const uhd::meta_range_t &metaRange)
{
+ #ifdef SOAPY_SDR_API_HAS_RANGE_TYPE_STEP
+ return SoapySDR::Range(metaRange.start(), metaRange.stop(), metaRange.step());
+ #else
return SoapySDR::Range(metaRange.start(), metaRange.stop());
+ #endif
}
static inline uhd::meta_range_t numberListToMetaRange(const std::vector<double> &nums)
@@ -91,8 +104,13 @@ static inline std::vector<double> metaRangeToNumericList(const uhd::meta_range_t
return out;
}
-static inline uhd::meta_range_t rangeToMetaRange(const SoapySDR::Range &range, const double step = 0.0)
+static inline uhd::meta_range_t rangeToMetaRange(const SoapySDR::Range &range, double step = 0.0)
{
+ //when range step is supported, use it only if initialized to non-zero
+ #ifdef SOAPY_SDR_API_HAS_RANGE_TYPE_STEP
+ if (range.step() != 0.0) step = range.step();
+ #endif
+
return uhd::meta_range_t(range.minimum(), range.maximum(), step);
}
diff --git a/UHDSoapyDevice.cpp b/UHDSoapyDevice.cpp
index b850d29..ea12ee7 100644
--- a/UHDSoapyDevice.cpp
+++ b/UHDSoapyDevice.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2015-2016 Josh Blum
+// Copyright (c) 2015-2017 Josh Blum
// SPDX-License-Identifier: GPL-3.0
#ifdef UHD_HAS_SET_PUBLISHER
@@ -102,12 +102,28 @@ public:
uhd::meta_range_t get_bw_range(const int dir, const size_t chan)
{
+ #ifdef SOAPY_SDR_API_HAS_GET_BANDWIDTH_RANGE
+ return rangeListToMetaRange(_device->getBandwidthRange(dir, chan));
+ #else
return numberListToMetaRange(_device->listBandwidths(dir, chan));
+ #endif
}
uhd::meta_range_t get_rate_range(const int dir, const size_t chan)
{
+ #ifdef SOAPY_SDR_API_HAS_GET_SAMPLE_RATE_RANGE
+ return rangeListToMetaRange(_device->getSampleRateRange(dir, chan));
+ #else
return numberListToMetaRange(_device->listSampleRates(dir, chan));
+ #endif
+ }
+
+ void set_sample_rate(const int dir, const size_t chan, const double rate)
+ {
+ _device->setSampleRate(dir, chan, rate);
+
+ //cache the sample rate for the streamer to use
+ _sampleRates[dir][chan] = _device->getSampleRate(dir, chan);
}
uhd::meta_range_t get_gain_range(const int dir, const size_t chan, const std::string &name)
@@ -153,6 +169,7 @@ public:
private:
SoapySDR::Device *_device;
+ std::map<int, std::map<size_t, double>> _sampleRates;
//stash streamers to implement old-style issue stream cmd and async message
std::map<size_t, boost::weak_ptr<uhd::rx_streamer> > _rx_streamers;
@@ -301,7 +318,7 @@ void UHDSoapyDevice::setupChannelHooks(const int dir, const size_t chan, const s
.publish(boost::bind(&UHDSoapyDevice::get_rate_range, this, dir, chan));
_tree->create<double>(dsp_path / "rate" / "value")
.publish(boost::bind(&SoapySDR::Device::getSampleRate, _device, dir, chan))
- .subscribe(boost::bind(&SoapySDR::Device::setSampleRate, _device, dir, chan, _1));
+ .subscribe(boost::bind(&UHDSoapyDevice::set_sample_rate, this, dir, chan, _1));
//dsp freq
_tree->create<double>(dsp_path / "freq" / "value")
@@ -489,11 +506,13 @@ static SoapySDR::Stream *make_stream(SoapySDR::Device *d, const int direction, c
class UHDSoapyRxStream : public uhd::rx_streamer
{
public:
- UHDSoapyRxStream(SoapySDR::Device *d, const uhd::stream_args_t &args):
+ UHDSoapyRxStream(SoapySDR::Device *d, const uhd::stream_args_t &args, const double &sampRate):
_device(d),
_stream(make_stream(d, SOAPY_SDR_RX, args)),
_nchan(std::max<size_t>(1, args.channels.size())),
- _elemSize(uhd::convert::get_bytes_per_item(args.cpu_format))
+ _elemSize(uhd::convert::get_bytes_per_item(args.cpu_format)),
+ _nextTimeValid(false),
+ _sampRate(sampRate)
{
_offsetBuffs.resize(_nchan);
}
@@ -568,6 +587,11 @@ public:
{
md.has_time_spec = (flags & SOAPY_SDR_HAS_TIME) != 0;
md.time_spec = uhd::time_spec_t::from_ticks(timeNs, 1e9);
+ if (md.has_time_spec)
+ {
+ _nextTimeValid = true;
+ _nextTime = md.time_spec;
+ }
}
//mark end of burst and exit call
@@ -588,6 +612,20 @@ public:
if (one_packet) break;
}
+ //time interpolation support
+ if (_sampRate != 0.0 and _nextTimeValid)
+ {
+ //if the metadata does not have a time, use the incremented time
+ if (not md.has_time_spec)
+ {
+ md.has_time_spec = true;
+ md.time_spec = _nextTime;
+ }
+
+ //increment for the next call
+ _nextTime += uhd::time_spec_t::from_ticks(total, _sampRate);
+ }
+
return total;
}
@@ -631,11 +669,15 @@ private:
const size_t _elemSize;
std::vector<void *> _offsetBuffs;
bool _doErrorOnNextRecv;
+ bool _nextTimeValid;
+ uhd::time_spec_t _nextTime;
+ const double &_sampRate;
};
uhd::rx_streamer::sptr UHDSoapyDevice::get_rx_stream(const uhd::stream_args_t &args)
{
- uhd::rx_streamer::sptr stream(new UHDSoapyRxStream(_device, args));
+ size_t ch = 0; if (not args.channels.empty()) ch = args.channels.front();
+ uhd::rx_streamer::sptr stream(new UHDSoapyRxStream(_device, args, _sampleRates[SOAPY_SDR_RX][ch]));
BOOST_FOREACH(const size_t ch, args.channels) _rx_streamers[ch] = stream;
if (args.channels.empty()) _rx_streamers[0] = stream;
return stream;
@@ -681,7 +723,6 @@ public:
)
{
size_t total = 0;
- if (nsamps_per_buff == 0) nsamps_per_buff = 1;
const long long timeNs(md.time_spec.to_ticks(1e9));
while (total < nsamps_per_buff)
diff --git a/debian/changelog b/debian/changelog
index a38c553..9ce0325 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+soapyuhd (0.3.3-1) unstable; urgency=low
+
+ * Release 0.3.3 (2017-04-29)
+
+ -- Josh Blum <josh at pothosware.com> Sat, 29 Apr 2017 15:11:18 -0000
+
soapyuhd (0.3.2-1) unstable; urgency=low
* Release 0.3.2 (2017-01-22)
diff --git a/debian/control b/debian/control
index 0dc0f0e..08a4334 100644
--- a/debian/control
+++ b/debian/control
@@ -13,7 +13,7 @@ Homepage: https://github.com/pothosware/SoapyUHD/wiki
Vcs-Git: https://github.com/pothosware/SoapyUHD.git
Vcs-Browser: https://github.com/pothosware/SoapyUHD
-Package: soapysdr0.5-2-module-uhd
+Package: soapysdr0.6-module-uhd
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends}, ${misc:Depends}
@@ -22,7 +22,7 @@ Description: Soapy UHD - UHD devices for Soapy SDR.
Package: soapysdr-module-uhd
Architecture: all
-Depends: soapysdr0.5-2-module-uhd, ${misc:Depends}
+Depends: soapysdr0.6-module-uhd, ${misc:Depends}
Description: Soapy UHD - UHD devices for Soapy SDR.
A Soapy module that supports UHD devices within the Soapy API.
.
diff --git a/debian/soapysdr0.5-2-module-uhd.install b/debian/soapysdr0.6-module-uhd.install
similarity index 100%
rename from debian/soapysdr0.5-2-module-uhd.install
rename to debian/soapysdr0.6-module-uhd.install
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/soapyuhd.git
More information about the pkg-hamradio-commits
mailing list