aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/common
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2015-01-23 19:49:25 +0100
committerMartin Braun <martin.braun@ettus.com>2015-01-23 19:49:25 +0100
commit91ae742f513515f88484f281c52414cd7ec78721 (patch)
treeb6f06d101a41246b642b14c33706d07b0687b235 /host/lib/usrp/common
parente97c4c72d88d3b5b0744c1f76813c9950fe6f820 (diff)
parent3807f816068abca5dbe0ca6c54a251dea270a11a (diff)
downloaduhd-91ae742f513515f88484f281c52414cd7ec78721.tar.gz
uhd-91ae742f513515f88484f281c52414cd7ec78721.tar.bz2
uhd-91ae742f513515f88484f281c52414cd7ec78721.zip
Merge branch 'maint'
Diffstat (limited to 'host/lib/usrp/common')
-rw-r--r--host/lib/usrp/common/ad9361_driver/ad9361_device.cpp21
-rw-r--r--host/lib/usrp/common/ad9361_driver/ad9361_device.h2
2 files changed, 16 insertions, 7 deletions
diff --git a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp
index ba8fe1f20..1d199cf0d 100644
--- a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp
+++ b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp
@@ -143,22 +143,25 @@ void ad9361_device_t::_program_fir_filter(direction_t direction, int num_taps, b
/* Program the RX FIR Filter. */
-void ad9361_device_t::_setup_rx_fir(size_t num_taps, boost::int32_t interpolation)
+void ad9361_device_t::_setup_rx_fir(size_t num_taps, boost::int32_t decimation)
{
+ if (not (decimation == 1 or decimation == 2 or decimation == 4)) {
+ throw uhd::runtime_error("[ad9361_device_t] Invalid Rx FIR decimation.");
+ }
boost::scoped_array<boost::uint16_t> coeffs(new boost::uint16_t[num_taps]);
for (size_t i = 0; i < num_taps; i++) {
switch (num_taps) {
case 128:
- coeffs[i] = boost::uint16_t((interpolation==4) ? fir_128_x4_coeffs[i] : hb127_coeffs[i]);
+ coeffs[i] = boost::uint16_t((decimation==4) ? fir_128_x4_coeffs[i] : hb127_coeffs[i]);
break;
case 96:
- coeffs[i] = boost::uint16_t((interpolation==4) ? fir_96_x4_coeffs[i] : hb95_coeffs[i]);
+ coeffs[i] = boost::uint16_t((decimation==4) ? fir_96_x4_coeffs[i] : hb95_coeffs[i]);
break;
case 64:
- coeffs[i] = boost::uint16_t((interpolation==4) ? fir_64_x4_coeffs[i] : hb63_coeffs[i]);
+ coeffs[i] = boost::uint16_t((decimation==4) ? fir_64_x4_coeffs[i] : hb63_coeffs[i]);
break;
case 48:
- coeffs[i] = boost::uint16_t((interpolation==4) ? fir_48_x4_coeffs[i] : hb47_coeffs[i]);
+ coeffs[i] = boost::uint16_t((decimation==4) ? fir_48_x4_coeffs[i] : hb47_coeffs[i]);
break;
default:
throw uhd::runtime_error("[ad9361_device_t] Unsupported number of Rx FIR taps.");
@@ -171,11 +174,17 @@ void ad9361_device_t::_setup_rx_fir(size_t num_taps, boost::int32_t interpolatio
/* Program the TX FIR Filter. */
void ad9361_device_t::_setup_tx_fir(size_t num_taps, boost::int32_t interpolation)
{
+ if (not (interpolation == 1 or interpolation == 2 or interpolation == 4)) {
+ throw uhd::runtime_error("[ad9361_device_t] Invalid Tx FIR interpolation.");
+ }
+ if (interpolation == 1 and num_taps > 64) {
+ throw uhd::runtime_error("[ad9361_device_t] Too many Tx FIR taps for interpolation value.");
+ }
boost::scoped_array<boost::uint16_t> coeffs(new boost::uint16_t[num_taps]);
for (size_t i = 0; i < num_taps; i++) {
switch (num_taps) {
case 128:
- coeffs[i] = boost::uint16_t((interpolation==4) ? fir_128_x4_coeffs[i] : hb127_coeffs[i]);
+ coeffs[i] = boost::uint16_t((interpolation==4) ? fir_128_x4_coeffs[i] : hb127_coeffs[i]);
break;
case 96:
coeffs[i] = boost::uint16_t((interpolation==4) ? fir_96_x4_coeffs[i] : hb95_coeffs[i]);
diff --git a/host/lib/usrp/common/ad9361_driver/ad9361_device.h b/host/lib/usrp/common/ad9361_driver/ad9361_device.h
index b178e46cc..8f64922f8 100644
--- a/host/lib/usrp/common/ad9361_driver/ad9361_device.h
+++ b/host/lib/usrp/common/ad9361_driver/ad9361_device.h
@@ -80,7 +80,7 @@ public:
private: //Methods
void _program_fir_filter(direction_t direction, int num_taps, boost::uint16_t *coeffs);
void _setup_tx_fir(size_t num_taps, boost::int32_t interpolation);
- void _setup_rx_fir(size_t num_taps, boost::int32_t interpolation);
+ void _setup_rx_fir(size_t num_taps, boost::int32_t decimation);
void _calibrate_lock_bbpll();
void _calibrate_synth_charge_pumps();
double _calibrate_baseband_rx_analog_filter();