diff options
Diffstat (limited to 'gr-uhd')
-rwxr-xr-x | gr-uhd/apps/uhd_fft.py | 26 | ||||
-rwxr-xr-x | gr-uhd/apps/uhd_siggen.py | 26 | ||||
-rwxr-xr-x | gr-uhd/apps/uhd_siggen_gui.py | 6 | ||||
-rw-r--r-- | gr-uhd/include/gr_uhd_usrp_sink.h | 19 | ||||
-rw-r--r-- | gr-uhd/include/gr_uhd_usrp_source.h | 16 | ||||
-rw-r--r-- | gr-uhd/lib/gr_uhd_usrp_sink.cc | 12 | ||||
-rw-r--r-- | gr-uhd/lib/gr_uhd_usrp_source.cc | 12 | ||||
-rw-r--r-- | gr-uhd/swig/__init__.py | 2 | ||||
-rw-r--r-- | gr-uhd/swig/uhd_swig.i | 10 |
9 files changed, 119 insertions, 10 deletions
diff --git a/gr-uhd/apps/uhd_fft.py b/gr-uhd/apps/uhd_fft.py index 18edc8f86..a3858e341 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: @@ -195,6 +196,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) @@ -232,8 +253,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): """ @@ -248,6 +271,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 ff4856f9b..fff567438 100644 --- a/gr-uhd/include/gr_uhd_usrp_sink.h +++ b/gr-uhd/include/gr_uhd_usrp_sink.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2011 Free Software Foundation, Inc. + * Copyright 2010-2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -131,12 +131,29 @@ public: virtual void set_start_time(const uhd::time_spec_t &time) = 0; /*! + * Returns identifying information about this USRP's configuration. + * Returns motherboard ID, name, and serial. + * 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_tx_info(size_t chan = 0) = 0; + + /*! * Set the frontend specification. * \param spec the subdev spec markup string * \param mboard the motherboard index 0 to M-1 */ 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 415503bc1..0dde4b194 100644 --- a/gr-uhd/include/gr_uhd_usrp_source.h +++ b/gr-uhd/include/gr_uhd_usrp_source.h @@ -123,6 +123,15 @@ public: virtual void set_start_time(const uhd::time_spec_t &time) = 0; /*! + * Returns identifying information about this USRP's configuration. + * Returns motherboard ID, name, and serial. + * 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_rx_info(size_t chan = 0) = 0; + + /*! * Set the frontend specification. * \param spec the subdev spec markup string * \param mboard the motherboard index 0 to M-1 @@ -130,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 7e7875898..d86165f65 100644 --- a/gr-uhd/lib/gr_uhd_usrp_sink.cc +++ b/gr-uhd/lib/gr_uhd_usrp_sink.cc @@ -66,10 +66,22 @@ public: _dev = uhd::usrp::multi_usrp::make(device_addr); } + 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_tx_info(chan); + #else + throw std::runtime_error("not implemented in this version"); + #endif + } + void set_subdev_spec(const std::string &spec, size_t mboard){ 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 bd7f4e21d..49558cee6 100644 --- a/gr-uhd/lib/gr_uhd_usrp_source.cc +++ b/gr-uhd/lib/gr_uhd_usrp_source.cc @@ -70,10 +70,22 @@ public: _dev = uhd::usrp::multi_usrp::make(device_addr); } + 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_rx_info(chan); + #else + throw std::runtime_error("not implemented in this version"); + #endif + } + void set_subdev_spec(const std::string &spec, size_t mboard){ 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); } diff --git a/gr-uhd/swig/__init__.py b/gr-uhd/swig/__init__.py index 82dbdd9e7..b4045e77f 100644 --- a/gr-uhd/swig/__init__.py +++ b/gr-uhd/swig/__init__.py @@ -1,5 +1,5 @@ # -# Copyright 2010-2011 Free Software Foundation, Inc. +# Copyright 2010-2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 0b2f9febc..729719dcb 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2010-2011 Free Software Foundation, Inc. + * Copyright 2010-2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -125,6 +125,14 @@ static const size_t ALL_MBOARDS = uhd::usrp::multi_usrp::ALL_MBOARDS; %} static const size_t ALL_MBOARDS; +%{ +#include <uhd/version.hpp> +std::string get_version_string(void){ + return uhd::get_version_string(); +} +%} +std::string get_version_string(void); + #if SWIGGUILE %scheme %{ (load-extension-global "libguile-gnuradio-uhd_swig" "scm_init_gnuradio_uhd_swig_module") |