summaryrefslogtreecommitdiff
path: root/gr-uhd
diff options
context:
space:
mode:
authorJohnathan Corgan2012-04-04 17:08:42 -0700
committerJohnathan Corgan2012-04-04 17:08:42 -0700
commit29c887da604206aa6f3ad1859f70958231a7a1cb (patch)
treebea8f24090bf4c1755a9445d16c15339e86d648d /gr-uhd
parentc787fb66bf3512b5cd4870ef74cd1e4d91802820 (diff)
parentb711a8683c8c4578c7a4ff0f3664f1321da1dcad (diff)
downloadgnuradio-29c887da604206aa6f3ad1859f70958231a7a1cb.tar.gz
gnuradio-29c887da604206aa6f3ad1859f70958231a7a1cb.tar.bz2
gnuradio-29c887da604206aa6f3ad1859f70958231a7a1cb.zip
Merge branch 'master' into next
Diffstat (limited to 'gr-uhd')
-rwxr-xr-xgr-uhd/apps/uhd_fft.py26
-rwxr-xr-xgr-uhd/apps/uhd_siggen.py26
-rwxr-xr-xgr-uhd/apps/uhd_siggen_gui.py6
-rw-r--r--gr-uhd/include/gr_uhd_usrp_sink.h14
-rw-r--r--gr-uhd/include/gr_uhd_usrp_source.h13
-rw-r--r--gr-uhd/lib/gr_uhd_usrp_sink.cc8
-rw-r--r--gr-uhd/lib/gr_uhd_usrp_source.cc8
7 files changed, 84 insertions, 17 deletions
diff --git a/gr-uhd/apps/uhd_fft.py b/gr-uhd/apps/uhd_fft.py
index 39ba3838e..9e2554768 100755
--- a/gr-uhd/apps/uhd_fft.py
+++ b/gr-uhd/apps/uhd_fft.py
@@ -31,6 +31,7 @@ import numpy
try:
from gnuradio.wxgui import stdgui2, form, slider
+ from gnuradio.wxgui import forms
from gnuradio.wxgui import fftsink2, waterfallsink2, scopesink2
import wx
except ImportError:
@@ -194,6 +195,26 @@ class app_top_block(stdgui2.std_top_block):
min=int(glow), max=int(ghigh),
callback=self.set_gain)
+ try:
+ usrp_config_val = "%s (%s), %s (%s, %s, %s)" % (self.u.get_usrp_rx_info().get("mboard_id").split(" ")[0], self.u.get_usrp_rx_info().get("mboard_serial"),
+ self.u.get_usrp_rx_info().get("rx_id").split(" ")[0].split(",")[0], self.u.get_usrp_rx_info().get("rx_serial"), self.u.get_subdev_spec(), self.u.get_antenna())
+ except:
+ usrp_config_val = "Not implemented in this version."
+
+ uhd_box = forms.static_box_sizer(parent=self.panel,
+ label="UHD (%s)" % (uhd.get_version_string()),
+ orient=wx.HORIZONTAL,
+ bold=True)
+ usrp_config_form = forms.static_text(
+ parent=self.panel,
+ sizer=uhd_box,
+ value=usrp_config_val,
+ label="USRP",
+ converter=forms.str_converter(),
+ )
+ vbox.Add(uhd_box, 0, wx.EXPAND)
+ vbox.AddSpacer(5)
+
hbox.Add((5,0), 0, 0)
vbox.Add(hbox, 0, wx.EXPAND)
@@ -231,8 +252,10 @@ class app_top_block(stdgui2.std_top_block):
myform['dspfreq'] = form.static_float_field(
parent=panel, sizer=hbox, label="DSP Freq.")
- hbox.Add((5,0), 0)
+ vbox.AddSpacer(5)
+
vbox.Add(hbox, 0, wx.EXPAND)
+ vbox.AddSpacer(5)
def set_freq(self, target_freq):
"""
@@ -247,6 +270,7 @@ class app_top_block(stdgui2.std_top_block):
self.myform['freq'].set_value(self.u.get_center_freq())
self.myform['rffreq'].set_value(r.actual_rf_freq)
self.myform['dspfreq'].set_value(r.actual_dsp_freq)
+
if not self.options.oscilloscope:
self.scope.set_baseband_freq(target_freq)
return True
diff --git a/gr-uhd/apps/uhd_siggen.py b/gr-uhd/apps/uhd_siggen.py
index e1af586ae..ff36b4f4d 100755
--- a/gr-uhd/apps/uhd_siggen.py
+++ b/gr-uhd/apps/uhd_siggen.py
@@ -107,12 +107,32 @@ class top_block(gr.top_block, pubsub):
if(options.antenna):
self._u.set_antenna(options.antenna, 0)
- self.publish(DESC_KEY, lambda: str(self._u))
+ # Setup USRP Configuration value
+ try:
+ usrp_info = self._u.get_usrp_tx_info()
+ usrp_mb = usrp_info.get("mboard_id").split(" ")[0]
+ usrp_mbs = usrp_info.get("mboard_serial")
+ usrp_db = usrp_info.get("tx_id").split(" ")[0]
+ usrp_dbs = usrp_info.get("tx_serial")
+ usrp_sd = self._u.get_subdev_spec()
+ usrp_ant = self._u.get_antenna()
+
+ desc_key_str = "Motherboard: %s [%s]\n" % (usrp_mb, usrp_mbs)
+ desc_key_str += "Daughterboard: %s [%s]\n" % (usrp_db, usrp_dbs)
+ desc_key_str += "Subdev: %s\n" % usrp_sd
+ desc_key_str += "Antenna: %s" % usrp_ant
+ except:
+ desc_key_str = "USRP configuration output not implemented in this version"
+
+ self.publish(DESC_KEY, lambda: desc_key_str)
self.publish(FREQ_RANGE_KEY, self._u.get_freq_range)
self.publish(GAIN_RANGE_KEY, self._u.get_gain_range)
self.publish(GAIN_KEY, self._u.get_gain)
- if self._verbose:
- print str(self._u)
+
+ print "UHD Signal Generator"
+ print "Version: %s" % uhd.get_version_string()
+ print "\nUsing USRP configuration:"
+ print desc_key_str + "\n"
# Direct asynchronous notifications to callback function
if options.show_async_msg:
diff --git a/gr-uhd/apps/uhd_siggen_gui.py b/gr-uhd/apps/uhd_siggen_gui.py
index 2ef6ea40f..1f6a73c2c 100755
--- a/gr-uhd/apps/uhd_siggen_gui.py
+++ b/gr-uhd/apps/uhd_siggen_gui.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2009,2011 Free Software Foundation, Inc.
+# Copyright 2009,2011,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,7 +21,7 @@
#
import wx
-from gnuradio import gr
+from gnuradio import gr, uhd
from gnuradio.gr.pubsub import pubsub
from gnuradio.wxgui import gui, forms
import uhd_siggen
@@ -269,7 +269,7 @@ class app_gui(pubsub):
# UHD status
##################################################
u2_hbox = forms.static_box_sizer(parent=self.panel,
- label="UHD Status",
+ label="UHD (%s)" % (uhd.get_version_string()),
orient=wx.HORIZONTAL,
bold=True)
self.vbox.Add(u2_hbox, 0, wx.EXPAND)
diff --git a/gr-uhd/include/gr_uhd_usrp_sink.h b/gr-uhd/include/gr_uhd_usrp_sink.h
index 169d58152..fff567438 100644
--- a/gr-uhd/include/gr_uhd_usrp_sink.h
+++ b/gr-uhd/include/gr_uhd_usrp_sink.h
@@ -133,11 +133,11 @@ public:
/*!
* Returns identifying information about this USRP's configuration.
* Returns motherboard ID, name, and serial.
- * Returns daughterboard TX/RX ID, subdev name, and serial.
- * \param mboard the motherboard index 0 to M-1
+ * Returns daughterboard TX ID, subdev name, and serial.
* \param chan channel index 0 to N-1
+ * \return TX info
*/
- virtual uhd::dict<std::string, std::string> get_usrp_info(size_t mboard = 0, size_t chan = 0) = 0;
+ virtual uhd::dict<std::string, std::string> get_usrp_tx_info(size_t chan = 0) = 0;
/*!
* Set the frontend specification.
@@ -146,6 +146,14 @@ public:
*/
virtual void set_subdev_spec(const std::string &spec, size_t mboard = 0) = 0;
+
+ /*!
+ * Get the TX frontend specification.
+ * \param mboard the motherboard index 0 to M-1
+ * \return the frontend specification in use
+ */
+ virtual std::string get_subdev_spec (size_t mboard = 0) = 0;
+
/*!
* Set the sample rate for the usrp device.
* \param rate a new rate in Sps
diff --git a/gr-uhd/include/gr_uhd_usrp_source.h b/gr-uhd/include/gr_uhd_usrp_source.h
index 20cc863d7..0dde4b194 100644
--- a/gr-uhd/include/gr_uhd_usrp_source.h
+++ b/gr-uhd/include/gr_uhd_usrp_source.h
@@ -125,11 +125,11 @@ public:
/*!
* Returns identifying information about this USRP's configuration.
* Returns motherboard ID, name, and serial.
- * Returns daughterboard TX/RX ID, subdev name, and serial.
- * \param mboard the motherboard index 0 to M-1
+ * Returns daughterboard RX ID, subdev name, and serial.
* \param chan channel index 0 to N-1
+ * \return RX info
*/
- virtual uhd::dict<std::string, std::string> get_usrp_info(size_t mboard = 0, size_t chan = 0) = 0;
+ virtual uhd::dict<std::string, std::string> get_usrp_rx_info(size_t chan = 0) = 0;
/*!
* Set the frontend specification.
@@ -139,6 +139,13 @@ public:
virtual void set_subdev_spec(const std::string &spec, size_t mboard = 0) = 0;
/*!
+ * Get the RX frontend specification.
+ * \param mboard the motherboard index 0 to M-1
+ * \return the frontend specification in use
+ */
+ virtual std::string get_subdev_spec(size_t mboard = 0) = 0;
+
+ /*!
* Set the sample rate for the usrp device.
* \param rate a new rate in Sps
*/
diff --git a/gr-uhd/lib/gr_uhd_usrp_sink.cc b/gr-uhd/lib/gr_uhd_usrp_sink.cc
index 66be056df..d86165f65 100644
--- a/gr-uhd/lib/gr_uhd_usrp_sink.cc
+++ b/gr-uhd/lib/gr_uhd_usrp_sink.cc
@@ -66,9 +66,9 @@ public:
_dev = uhd::usrp::multi_usrp::make(device_addr);
}
- uhd::dict<std::string, std::string> get_usrp_info(size_t mboard, size_t chan){
+ uhd::dict<std::string, std::string> get_usrp_tx_info(size_t chan){
#ifdef UHD_USRP_MULTI_USRP_GET_USRP_INFO_API
- return _dev->get_usrp_info(mboard, chan);
+ return _dev->get_usrp_tx_info(chan);
#else
throw std::runtime_error("not implemented in this version");
#endif
@@ -78,6 +78,10 @@ public:
return _dev->set_tx_subdev_spec(spec, mboard);
}
+ std::string get_subdev_spec(size_t mboard){
+ return _dev->get_tx_subdev_spec(mboard).to_string();
+ }
+
void set_samp_rate(double rate){
_dev->set_tx_rate(rate);
_sample_rate = this->get_samp_rate();
diff --git a/gr-uhd/lib/gr_uhd_usrp_source.cc b/gr-uhd/lib/gr_uhd_usrp_source.cc
index ba87ae8e0..49558cee6 100644
--- a/gr-uhd/lib/gr_uhd_usrp_source.cc
+++ b/gr-uhd/lib/gr_uhd_usrp_source.cc
@@ -70,9 +70,9 @@ public:
_dev = uhd::usrp::multi_usrp::make(device_addr);
}
- uhd::dict<std::string, std::string> get_usrp_info(size_t mboard, size_t chan){
+ uhd::dict<std::string, std::string> get_usrp_rx_info(size_t chan){
#ifdef UHD_USRP_MULTI_USRP_GET_USRP_INFO_API
- return _dev->get_usrp_info(mboard, chan);
+ return _dev->get_usrp_rx_info(chan);
#else
throw std::runtime_error("not implemented in this version");
#endif
@@ -82,6 +82,10 @@ public:
return _dev->set_rx_subdev_spec(spec, mboard);
}
+ std::string get_subdev_spec(size_t mboard){
+ return _dev->get_rx_subdev_spec(mboard).to_string();
+ }
+
void set_samp_rate(double rate){
_dev->set_rx_rate(rate);
}