[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9227 - gnuradio/branches/developers/trondeau/dbs/usrp
From: |
trondeau |
Subject: |
[Commit-gnuradio] r9227 - gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy |
Date: |
Sun, 10 Aug 2008 16:19:43 -0600 (MDT) |
Author: trondeau
Date: 2008-08-10 16:19:41 -0600 (Sun, 10 Aug 2008)
New Revision: 9227
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.cc
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.h
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_basic.cc
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_basic.h
Log:
creating a struct for returning calc_dxc_freq.
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.cc
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.cc
2008-08-10 22:09:26 UTC (rev 9226)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.cc
2008-08-10 22:19:41 UTC (rev 9227)
@@ -297,28 +297,27 @@
ok = (bool)freq[0];
baseband_freq = freq[1];
- bool inverted;
- float dxc_freq = calc_dxc_freq(target_freq, baseband_freq,
d_usrp->converter_rate(), inverted);
+ struct dxc_freq_t dxc_freq = calc_dxc_freq(target_freq, baseband_freq,
d_usrp->converter_rate());
// If the spectrum is inverted, and the daughterboard doesn't do
// quadrature downconversion, we can fix the inversion by flipping the
// sign of the dxc_freq... (This only happens using the basic_rx board)
if(spectrum_inverted()) {
- inverted = !(inverted);
+ dxc_freq.inverted = !(dxc_freq.inverted);
}
- if(inverted && (!is_quadrature())) {
- dxc_freq = -dxc_freq;
- inverted = !(inverted);
+ if(dxc_freq.inverted && (!is_quadrature())) {
+ dxc_freq.ddc_freq = -dxc_freq.ddc_freq;
+ dxc_freq.inverted = !(dxc_freq.inverted);
}
if (!d_tx) {
- ok = ok && ((usrp_standard_rx*)d_usrp)->set_rx_freq(chan, dxc_freq);
+ ok = ok && ((usrp_standard_rx*)d_usrp)->set_rx_freq(chan,
dxc_freq.ddc_freq);
}
else {
- dxc_freq = -dxc_freq;
- ok = ok && ((usrp_standard_tx*)d_usrp)->set_tx_freq(chan, dxc_freq);
+ dxc_freq.ddc_freq = -dxc_freq.ddc_freq;
+ ok = ok && ((usrp_standard_tx*)d_usrp)->set_tx_freq(chan,
dxc_freq.ddc_freq);
}
if(!ok) {
@@ -328,14 +327,14 @@
// residual_freq is the offset left over because of dxc tuning step size
float residual_freq;
if(!d_tx) {
- residual_freq = dxc_freq - ((usrp_standard_rx*)d_usrp)->rx_freq(chan);
+ residual_freq = dxc_freq.ddc_freq -
((usrp_standard_rx*)d_usrp)->rx_freq(chan);
}
else {
// FIXME 50-50 chance this has the wrong sign...
- residual_freq = dxc_freq - ((usrp_standard_tx*)d_usrp)->tx_freq(chan);
+ residual_freq = dxc_freq.ddc_freq -
((usrp_standard_tx*)d_usrp)->tx_freq(chan);
}
- tune_result res = tune_result(baseband_freq, dxc_freq, residual_freq,
inverted);
+ tune_result res = tune_result(baseband_freq, dxc_freq.ddc_freq,
residual_freq, dxc_freq.inverted);
res.ok = true;
return res;
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.h
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.h
2008-08-10 22:09:26 UTC (rev 9226)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.h
2008-08-10 22:19:41 UTC (rev 9227)
@@ -50,7 +50,6 @@
bool inverted;
};
-
/******************************************************************************/
class db_base
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_basic.cc
===================================================================
---
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_basic.cc
2008-08-10 22:09:26 UTC (rev 9226)
+++
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_basic.cc
2008-08-10 22:19:41 UTC (rev 9227)
@@ -91,8 +91,8 @@
return reg[slot_id];
}
-float
-calc_dxc_freq(float target_freq, float baseband_freq, long fs, bool &inverted)
+struct dxc_freq_t
+calc_dxc_freq(float target_freq, float baseband_freq, long fs)
{
/*
Calculate the frequency to use for setting the digital up or down
converter.
@@ -109,6 +109,7 @@
Nyquist zone.
*/
+ struct dxc_freq_t ret;
float delta = target_freq - baseband_freq;
if(delta >= 0) {
@@ -116,12 +117,14 @@
delta -= fs;
}
if(delta <= fs/2) {
- inverted = false;
- return (-delta); // non-inverted region
+ ret.inverted = false;
+ ret.ddc_freq = -delta; // non-inverted region
+ return ret;
}
else {
- inverted = true;
- return (delta - fs); // inverted region
+ ret.inverted = true;
+ ret.ddc_freq = delta - fs; // inverted region
+ return ret;
}
}
else {
@@ -129,12 +132,14 @@
delta += fs;
}
if(delta >= -fs/2) {
- inverted = false;
- return (-delta); // non-inverted region
+ ret.inverted = false;
+ ret.ddc_freq = -delta; // non-inverted region
+ return ret;
}
else {
- inverted = true;
- return (delta + fs); // inverted region
+ ret.inverted = true;
+ ret.ddc_freq = delta+fs; // inverted region
+ return ret;
}
}
}
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_basic.h
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_basic.h
2008-08-10 22:09:26 UTC (rev 9226)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_basic.h
2008-08-10 22:19:41 UTC (rev 9227)
@@ -42,8 +42,14 @@
#include <usrp_slots.h>
#include <string>
-float calc_dxc_freq(float target_freq, float baseband_freq, long fs, bool
&inverted);
+struct dxc_freq_t
+{
+ float ddc_freq;
+ bool inverted;
+};
+struct dxc_freq_t calc_dxc_freq(float target_freq, float baseband_freq, long
fs);
+
struct usb_dev_handle;
class fusb_devhandle;
class fusb_ephandle;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9227 - gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy,
trondeau <=