aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/tune_helper.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-09-20 18:17:52 -0700
committerJosh Blum <josh@joshknows.com>2010-09-20 18:17:52 -0700
commitd68922ed306cd73eb761165369619cdbac2ca637 (patch)
treeb5e0e50faee9cb906d4b316270c1d1a72a61d682 /host/lib/usrp/tune_helper.cpp
parent1625bcb4139a317189ff2a4c71b96473944aba50 (diff)
downloaduhd-d68922ed306cd73eb761165369619cdbac2ca637.tar.gz
uhd-d68922ed306cd73eb761165369619cdbac2ca637.tar.bz2
uhd-d68922ed306cd73eb761165369619cdbac2ca637.zip
usrp1: implemented multi-channel dsp control of shift freq
usrp: simple usrp calls into single usrp and prints deprecation warning usrp: tune helper now supports multi-channel dsps
Diffstat (limited to 'host/lib/usrp/tune_helper.cpp')
-rw-r--r--host/lib/usrp/tune_helper.cpp38
1 files changed, 22 insertions, 16 deletions
diff --git a/host/lib/usrp/tune_helper.cpp b/host/lib/usrp/tune_helper.cpp
index e516477d3..7633c67f2 100644
--- a/host/lib/usrp/tune_helper.cpp
+++ b/host/lib/usrp/tune_helper.cpp
@@ -30,11 +30,12 @@ using namespace uhd::usrp;
**********************************************************************/
static tune_result_t tune_xx_subdev_and_dxc(
dboard_iface::unit_t unit,
- wax::obj subdev, wax::obj dxc,
+ wax::obj subdev, wax::obj dxc, size_t chan,
double target_freq, double lo_offset
){
wax::obj subdev_freq_proxy = subdev[SUBDEV_PROP_FREQ];
- wax::obj dxc_freq_proxy = dxc[DSP_PROP_FREQ_SHIFT];
+ std::string freq_name = dxc[DSP_PROP_FREQ_SHIFT_NAMES].as<prop_names_t>().at(chan);
+ wax::obj dxc_freq_proxy = dxc[named_prop_t(DSP_PROP_FREQ_SHIFT, freq_name)];
double dxc_sample_rate = dxc[DSP_PROP_CODEC_RATE].as<double>();
// Ask the d'board to tune as closely as it can to target_freq+lo_offset
@@ -65,11 +66,12 @@ static tune_result_t tune_xx_subdev_and_dxc(
static double derive_freq_from_xx_subdev_and_dxc(
dboard_iface::unit_t unit,
- wax::obj subdev, wax::obj dxc
+ wax::obj subdev, wax::obj dxc, size_t chan
){
//extract actual dsp and IF frequencies
double actual_inter_freq = subdev[SUBDEV_PROP_FREQ].as<double>();
- double actual_dxc_freq = dxc[DSP_PROP_FREQ_SHIFT].as<double>();
+ std::string freq_name = dxc[DSP_PROP_FREQ_SHIFT_NAMES].as<prop_names_t>().at(chan);
+ double actual_dxc_freq = dxc[named_prop_t(DSP_PROP_FREQ_SHIFT, freq_name)].as<double>();
//invert the sign on the dxc freq given the following conditions
if (unit == dboard_iface::UNIT_TX) actual_dxc_freq *= -1.0;
@@ -81,50 +83,54 @@ static double derive_freq_from_xx_subdev_and_dxc(
* RX Tune
**********************************************************************/
tune_result_t usrp::tune_rx_subdev_and_dsp(
- wax::obj subdev, wax::obj ddc,
+ wax::obj subdev, wax::obj ddc, size_t chan,
double target_freq, double lo_offset
){
- return tune_xx_subdev_and_dxc(dboard_iface::UNIT_RX, subdev, ddc, target_freq, lo_offset);
+ return tune_xx_subdev_and_dxc(dboard_iface::UNIT_RX, subdev, ddc, chan, target_freq, lo_offset);
}
tune_result_t usrp::tune_rx_subdev_and_dsp(
wax::obj subdev, wax::obj ddc,
- double target_freq
+ size_t chan, double target_freq
){
double lo_offset = 0.0;
//if the local oscillator will be in the passband, use an offset
if (subdev[SUBDEV_PROP_USE_LO_OFFSET].as<bool>()){
lo_offset = 2.0*ddc[DSP_PROP_HOST_RATE].as<double>();
}
- return tune_rx_subdev_and_dsp(subdev, ddc, target_freq, lo_offset);
+ return tune_rx_subdev_and_dsp(subdev, ddc, chan, target_freq, lo_offset);
}
-double usrp::derive_freq_from_rx_subdev_and_dsp(wax::obj subdev, wax::obj ddc){
- return derive_freq_from_xx_subdev_and_dxc(dboard_iface::UNIT_RX, subdev, ddc);
+double usrp::derive_freq_from_rx_subdev_and_dsp(
+ wax::obj subdev, wax::obj ddc, size_t chan
+){
+ return derive_freq_from_xx_subdev_and_dxc(dboard_iface::UNIT_RX, subdev, ddc, chan);
}
/***********************************************************************
* TX Tune
**********************************************************************/
tune_result_t usrp::tune_tx_subdev_and_dsp(
- wax::obj subdev, wax::obj duc,
+ wax::obj subdev, wax::obj duc, size_t chan,
double target_freq, double lo_offset
){
- return tune_xx_subdev_and_dxc(dboard_iface::UNIT_TX, subdev, duc, target_freq, lo_offset);
+ return tune_xx_subdev_and_dxc(dboard_iface::UNIT_TX, subdev, duc, chan, target_freq, lo_offset);
}
tune_result_t usrp::tune_tx_subdev_and_dsp(
wax::obj subdev, wax::obj duc,
- double target_freq
+ size_t chan, double target_freq
){
double lo_offset = 0.0;
//if the local oscillator will be in the passband, use an offset
if (subdev[SUBDEV_PROP_USE_LO_OFFSET].as<bool>()){
lo_offset = 2.0*duc[DSP_PROP_HOST_RATE].as<double>();
}
- return tune_tx_subdev_and_dsp(subdev, duc, target_freq, lo_offset);
+ return tune_tx_subdev_and_dsp(subdev, duc, chan, target_freq, lo_offset);
}
-double usrp::derive_freq_from_tx_subdev_and_dsp(wax::obj subdev, wax::obj duc){
- return derive_freq_from_xx_subdev_and_dxc(dboard_iface::UNIT_TX, subdev, duc);
+double usrp::derive_freq_from_tx_subdev_and_dsp(
+ wax::obj subdev, wax::obj duc, size_t chan
+){
+ return derive_freq_from_xx_subdev_and_dxc(dboard_iface::UNIT_TX, subdev, duc, chan);
}