aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/single_usrp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/single_usrp.cpp')
-rw-r--r--host/lib/usrp/single_usrp.cpp62
1 files changed, 46 insertions, 16 deletions
diff --git a/host/lib/usrp/single_usrp.cpp b/host/lib/usrp/single_usrp.cpp
index bb4af44b8..2faa1280c 100644
--- a/host/lib/usrp/single_usrp.cpp
+++ b/host/lib/usrp/single_usrp.cpp
@@ -15,6 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
+#include "wrapper_utils.hpp"
#include <uhd/usrp/single_usrp.hpp>
#include <uhd/usrp/tune_helper.hpp>
#include <uhd/utils/assert.hpp>
@@ -32,11 +33,6 @@
using namespace uhd;
using namespace uhd::usrp;
-static inline freq_range_t add_dsp_shift(const freq_range_t &range, wax::obj dsp){
- double codec_rate = dsp[DSP_PROP_CODEC_RATE].as<double>();
- return freq_range_t(range.min - codec_rate/2.0, range.max + codec_rate/2.0);
-}
-
/***********************************************************************
* Simple USRP Implementation
**********************************************************************/
@@ -46,14 +42,13 @@ public:
_dev = device::make(addr);
}
- ~single_usrp_impl(void){
- /* NOP */
- }
-
device::sptr get_device(void){
return _dev;
}
+ /*******************************************************************
+ * Mboard methods
+ ******************************************************************/
std::string get_pp_string(void){
std::string buff = str(boost::format(
"Single USRP:\n"
@@ -101,9 +96,10 @@ public:
return buff;
}
- /*******************************************************************
- * Misc
- ******************************************************************/
+ std::string get_mboard_name(void){
+ return _mboard()[MBOARD_PROP_NAME].as<std::string>();
+ }
+
time_spec_t get_time_now(void){
return _mboard()[MBOARD_PROP_TIME_NOW].as<time_spec_t>();
}
@@ -135,8 +131,13 @@ public:
return _mboard()[MBOARD_PROP_RX_SUBDEV_SPEC].as<subdev_spec_t>();
}
+ std::string get_rx_subdev_name(size_t chan){
+ return _rx_subdev(chan)[SUBDEV_PROP_NAME].as<std::string>();
+ }
+
void set_rx_rate(double rate){
_rx_dsp()[DSP_PROP_HOST_RATE] = rate;
+ do_samp_rate_warning_message(rate, get_rx_rate(), "RX");
}
double get_rx_rate(void){
@@ -144,11 +145,15 @@ public:
}
tune_result_t set_rx_freq(double target_freq, size_t chan){
- return tune_rx_subdev_and_dsp(_rx_subdev(chan), _rx_dsp(), chan, target_freq);
+ tune_result_t r = tune_rx_subdev_and_dsp(_rx_subdev(chan), _rx_dsp(), chan, target_freq);
+ do_tune_freq_warning_message(target_freq, get_rx_freq(chan), "RX");
+ return r;
}
tune_result_t set_rx_freq(double target_freq, double lo_off, size_t chan){
- return tune_rx_subdev_and_dsp(_rx_subdev(chan), _rx_dsp(), chan, target_freq, lo_off);
+ tune_result_t r = tune_rx_subdev_and_dsp(_rx_subdev(chan), _rx_dsp(), chan, target_freq, lo_off);
+ do_tune_freq_warning_message(target_freq, get_rx_freq(chan), "RX");
+ return r;
}
double get_rx_freq(size_t chan){
@@ -187,6 +192,14 @@ public:
return _rx_subdev(chan)[SUBDEV_PROP_LO_LOCKED].as<bool>();
}
+ void set_rx_bandwidth(double bandwidth, size_t chan){
+ _rx_subdev(chan)[SUBDEV_PROP_BANDWIDTH] = bandwidth;
+ }
+
+ double get_rx_bandwidth(size_t chan){
+ return _rx_subdev(chan)[SUBDEV_PROP_BANDWIDTH].as<double>();
+ }
+
float read_rssi(size_t chan){
return _rx_subdev(chan)[SUBDEV_PROP_RSSI].as<float>();
}
@@ -206,8 +219,13 @@ public:
return _mboard()[MBOARD_PROP_TX_SUBDEV_SPEC].as<subdev_spec_t>();
}
+ std::string get_tx_subdev_name(size_t chan){
+ return _tx_subdev(chan)[SUBDEV_PROP_NAME].as<std::string>();
+ }
+
void set_tx_rate(double rate){
_tx_dsp()[DSP_PROP_HOST_RATE] = rate;
+ do_samp_rate_warning_message(rate, get_tx_rate(), "TX");
}
double get_tx_rate(void){
@@ -215,11 +233,15 @@ public:
}
tune_result_t set_tx_freq(double target_freq, size_t chan){
- return tune_tx_subdev_and_dsp(_tx_subdev(chan), _tx_dsp(), chan, target_freq);
+ tune_result_t r = tune_tx_subdev_and_dsp(_tx_subdev(chan), _tx_dsp(), chan, target_freq);
+ do_tune_freq_warning_message(target_freq, get_tx_freq(chan), "TX");
+ return r;
}
tune_result_t set_tx_freq(double target_freq, double lo_off, size_t chan){
- return tune_tx_subdev_and_dsp(_tx_subdev(chan), _tx_dsp(), chan, target_freq, lo_off);
+ tune_result_t r = tune_tx_subdev_and_dsp(_tx_subdev(chan), _tx_dsp(), chan, target_freq, lo_off);
+ do_tune_freq_warning_message(target_freq, get_tx_freq(chan), "TX");
+ return r;
}
double get_tx_freq(size_t chan){
@@ -258,6 +280,14 @@ public:
return _tx_subdev(chan)[SUBDEV_PROP_LO_LOCKED].as<bool>();
}
+ void set_tx_bandwidth(double bandwidth, size_t chan){
+ _tx_subdev(chan)[SUBDEV_PROP_BANDWIDTH] = bandwidth;
+ }
+
+ double get_tx_bandwidth(size_t chan){
+ return _tx_subdev(chan)[SUBDEV_PROP_BANDWIDTH].as<double>();
+ }
+
dboard_iface::sptr get_tx_dboard_iface(size_t chan){
return _tx_dboard(chan)[DBOARD_PROP_DBOARD_IFACE].as<dboard_iface::sptr>();
}