summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnuradio-core/src/lib/general/gr_burst_tagger.cc38
-rw-r--r--gnuradio-core/src/lib/general/gr_burst_tagger.h11
-rw-r--r--gnuradio-core/src/lib/general/gr_burst_tagger.i4
-rw-r--r--gr-digital/include/digital_mpsk_receiver_cc.h43
-rw-r--r--gr-digital/lib/digital_mpsk_receiver_cc.cc17
-rw-r--r--gr-digital/swig/digital_mpsk_receiver_cc.i5
-rw-r--r--gr-howto-write-a-block/version.sh4
-rwxr-xr-xgr-uhd/apps/uhd_fft.py16
-rwxr-xr-xgr-uhd/apps/uhd_rx_cfile.py17
-rwxr-xr-xgr-uhd/apps/uhd_rx_nogui.py15
-rwxr-xr-xgr-uhd/apps/uhd_siggen.py16
-rw-r--r--gr-uhd/include/gr_uhd_amsg_source.h7
-rw-r--r--gr-uhd/lib/gr_uhd_amsg_source.cc5
-rw-r--r--grc/blocks/Makefile.am1
-rw-r--r--grc/blocks/block_tree.xml1
-rw-r--r--grc/blocks/gr_burst_tagger.xml87
-rw-r--r--version.sh4
17 files changed, 257 insertions, 34 deletions
diff --git a/gnuradio-core/src/lib/general/gr_burst_tagger.cc b/gnuradio-core/src/lib/general/gr_burst_tagger.cc
index 4b3847b08..bd713d663 100644
--- a/gnuradio-core/src/lib/general/gr_burst_tagger.cc
+++ b/gnuradio-core/src/lib/general/gr_burst_tagger.cc
@@ -43,10 +43,39 @@ gr_burst_tagger::gr_burst_tagger(size_t itemsize)
std::stringstream str;
str << name() << unique_id();
- d_key = pmt::pmt_string_to_symbol("burst");
+ d_true_key = pmt::pmt_string_to_symbol("burst");
+ d_true_value = pmt::PMT_T;
+
+ d_false_key = pmt::pmt_string_to_symbol("burst");
+ d_false_value = pmt::PMT_F;
+
d_id = pmt::pmt_string_to_symbol(str.str());
}
+void
+gr_burst_tagger::set_true_tag (const std::string &key, bool value)
+{
+ d_true_key = pmt::pmt_string_to_symbol(key);
+ if(value == true) {
+ d_true_value = pmt::PMT_T;
+ }
+ else {
+ d_true_value = pmt::PMT_F;
+ }
+}
+
+void
+gr_burst_tagger::set_false_tag (const std::string &key, bool value)
+{
+ d_false_key = pmt::pmt_string_to_symbol(key);
+ if(value == true) {
+ d_false_value = pmt::PMT_T;
+ }
+ else {
+ d_false_value = pmt::PMT_F;
+ }
+}
+
gr_burst_tagger::~gr_burst_tagger()
{
}
@@ -66,18 +95,15 @@ gr_burst_tagger::work(int noutput_items,
if(trigger[i] > 0) {
if(d_state == false) {
d_state = true;
- pmt::pmt_t value = pmt::PMT_T;
- add_item_tag(0, nitems_written(0)+i, d_key, value, d_id);
+ add_item_tag(0, nitems_written(0)+i, d_true_key, d_true_value, d_id);
}
}
else {
if(d_state == true) {
d_state = false;
- pmt::pmt_t value = pmt::PMT_F;
- add_item_tag(0, nitems_written(0)+i, d_key, value, d_id);
+ add_item_tag(0, nitems_written(0)+i, d_false_key, d_false_value, d_id);
}
}
}
-
return noutput_items;
}
diff --git a/gnuradio-core/src/lib/general/gr_burst_tagger.h b/gnuradio-core/src/lib/general/gr_burst_tagger.h
index 7547ba9cc..663a146f2 100644
--- a/gnuradio-core/src/lib/general/gr_burst_tagger.h
+++ b/gnuradio-core/src/lib/general/gr_burst_tagger.h
@@ -40,14 +40,21 @@ class GR_CORE_API gr_burst_tagger : public gr_sync_block
{
size_t d_itemsize;
bool d_state;
- pmt::pmt_t d_key;
+ pmt::pmt_t d_true_key;
+ pmt::pmt_t d_true_value;
+
+ pmt::pmt_t d_false_key;
+ pmt::pmt_t d_false_value;
+
pmt::pmt_t d_id;
-
+
friend GR_CORE_API gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize);
gr_burst_tagger(size_t itemsize);
public:
~gr_burst_tagger();
+ void set_true_tag (const std::string &key, bool value);
+ void set_false_tag (const std::string &key, bool value);
int work(int noutput_items,
gr_vector_const_void_star &input_items,
diff --git a/gnuradio-core/src/lib/general/gr_burst_tagger.i b/gnuradio-core/src/lib/general/gr_burst_tagger.i
index ebf1eea8c..868941fc6 100644
--- a/gnuradio-core/src/lib/general/gr_burst_tagger.i
+++ b/gnuradio-core/src/lib/general/gr_burst_tagger.i
@@ -28,4 +28,8 @@ class gr_burst_tagger : public gr_sync_block
{
private:
gr_burst_tagger(size_t itemsize);
+
+ public:
+ void set_true_tag(const std::string &key, bool value);
+ void set_false_tag(const std::string &key, bool value);
};
diff --git a/gr-digital/include/digital_mpsk_receiver_cc.h b/gr-digital/include/digital_mpsk_receiver_cc.h
index e70495bfa..02cea8d25 100644
--- a/gr-digital/include/digital_mpsk_receiver_cc.h
+++ b/gr-digital/include/digital_mpsk_receiver_cc.h
@@ -91,23 +91,37 @@ class DIGITAL_API digital_mpsk_receiver_cc : public gr_block, public gri_control
gr_vector_void_star &output_items);
- // Member functions related to the symbol tracking portion of the receiver
- //! (M&M) Returns current value of mu
- float mu() const { return d_mu;}
+ //! Returns the modulation order (M) currently set
+ float modulation_order() const { return d_M; }
- //! (M&M) Returns current value of omega
- float omega() const { return d_omega;}
+ //! Returns current value of theta
+ float theta() const { return d_theta; }
- //! (M&M) Returns mu gain factor
- float gain_mu() const { return d_gain_mu;}
+ //! Returns current value of mu
+ float mu() const { return d_mu; }
- //! (M&M) Returns omega gain factor
- float gain_omega() const { return d_gain_omega;}
+ //! Returns current value of omega
+ float omega() const { return d_omega; }
- //! (M&M) Sets value of mu
+ //! Returns mu gain factor
+ float gain_mu() const { return d_gain_mu; }
+
+ //! Returns omega gain factor
+ float gain_omega() const { return d_gain_omega; }
+
+ //! Returns the relative omega limit
+ float gain_omega_rel() const {return d_omega_rel; }
+
+ //! Sets the modulation order (M) currently
+ void set_modulation_order(unsigned int M);
+
+ //! Sets value of theta
+ void set_theta(float theta) { d_theta = theta; }
+
+ //! Sets value of mu
void set_mu (float mu) { d_mu = mu; }
- //! (M&M) Sets value of omega and its min and max values
+ //! Sets value of omega and its min and max values
void set_omega (float omega) {
d_omega = omega;
d_min_omega = omega*(1.0 - d_omega_rel);
@@ -115,12 +129,15 @@ class DIGITAL_API digital_mpsk_receiver_cc : public gr_block, public gri_control
d_omega_mid = 0.5*(d_min_omega+d_max_omega);
}
- //! (M&M) Sets value for mu gain factor
+ //! Sets value for mu gain factor
void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; }
- //! (M&M) Sets value for omega gain factor
+ //! Sets value for omega gain factor
void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; }
+ //! Sets the relative omega limit and resets omega min/max values
+ void set_gain_omega_rel(float omega_rel);
+
protected:
/*!
diff --git a/gr-digital/lib/digital_mpsk_receiver_cc.cc b/gr-digital/lib/digital_mpsk_receiver_cc.cc
index 363b86c9f..6d2bab8a4 100644
--- a/gr-digital/lib/digital_mpsk_receiver_cc.cc
+++ b/gr-digital/lib/digital_mpsk_receiver_cc.cc
@@ -85,7 +85,18 @@ digital_mpsk_receiver_cc::digital_mpsk_receiver_cc (unsigned int M, float theta,
// zero double length delay line.
for (unsigned int i = 0; i < 2 * DLLEN; i++)
d_dl[i] = gr_complex(0.0,0.0);
+
+ set_modulation_order(d_M);
+}
+
+digital_mpsk_receiver_cc::~digital_mpsk_receiver_cc ()
+{
+ delete d_interp;
+}
+void
+digital_mpsk_receiver_cc::set_modulation_order(unsigned int M)
+{
// build the constellation vector from M
make_constellation();
@@ -108,9 +119,11 @@ digital_mpsk_receiver_cc::digital_mpsk_receiver_cc (unsigned int M, float theta,
}
}
-digital_mpsk_receiver_cc::~digital_mpsk_receiver_cc ()
+void
+digital_mpsk_receiver_cc::set_gain_omega_rel(float omega_rel)
{
- delete d_interp;
+ d_omega_rel = omega_rel;
+ set_omega(d_omega);
}
void
diff --git a/gr-digital/swig/digital_mpsk_receiver_cc.i b/gr-digital/swig/digital_mpsk_receiver_cc.i
index b51411f6f..2338a1854 100644
--- a/gr-digital/swig/digital_mpsk_receiver_cc.i
+++ b/gr-digital/swig/digital_mpsk_receiver_cc.i
@@ -37,16 +37,21 @@ class digital_mpsk_receiver_cc : public gr_block, public gri_control_loop
float mu, float gain_mu,
float omega, float gain_omega, float omega_rel);
public:
+ float modulation_order() const { return d_M; }
float mu() const { return d_mu;}
float omega() const { return d_omega;}
float gain_mu() const { return d_gain_mu;}
float gain_omega() const { return d_gain_omega;}
+ float gain_omega_rel() const {return d_omega_rel; }
+ void set_modulation_order(unsigned int M);
void set_mu (float mu) { d_mu = mu; }
void set_omega (float omega) {
d_omega = omega;
d_min_omega = omega*(1.0 - d_omega_rel);
d_max_omega = omega*(1.0 + d_omega_rel);
}
+ void set_theta(float theta) { d_theta = theta; }
void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; }
void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; }
+ void set_gain_omega_rel(float omega_rel);
};
diff --git a/gr-howto-write-a-block/version.sh b/gr-howto-write-a-block/version.sh
index 58ec712f6..88a3de947 100644
--- a/gr-howto-write-a-block/version.sh
+++ b/gr-howto-write-a-block/version.sh
@@ -1,4 +1,4 @@
MAJOR_VERSION=3
API_COMPAT=5
-MINOR_VERSION=1
-MAINT_VERSION=0
+MINOR_VERSION=2
+MAINT_VERSION=git
diff --git a/gr-uhd/apps/uhd_fft.py b/gr-uhd/apps/uhd_fft.py
index 7314c4759..18edc8f86 100755
--- a/gr-uhd/apps/uhd_fft.py
+++ b/gr-uhd/apps/uhd_fft.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -20,7 +20,7 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr
+from gnuradio import gr, gru
from gnuradio import uhd
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
@@ -75,6 +75,8 @@ class app_top_block(stdgui2.std_top_block):
help="Set wire format from USRP [default=%default]")
parser.add_option("", "--scalar", type="int", default=1024,
help="Set scalar multiplier value sc8 wire format [default=%default]")
+ parser.add_option("", "--show-async-msg", action="store_true", default=False,
+ help="Show asynchronous message notifications from UHD [default=%default]")
(options, args) = parser.parse_args()
if len(args) != 0:
parser.print_help()
@@ -146,6 +148,16 @@ class app_top_block(stdgui2.std_top_block):
if not(self.set_freq(options.freq)):
self._set_status_msg("Failed to set initial frequency")
+ # Direct asynchronous notifications to callback function
+ if self.options.show_async_msg:
+ self.async_msgq = gr.msg_queue(0)
+ self.async_src = uhd.amsg_source("", self.async_msgq)
+ self.async_rcv = gru.msgq_runner(self.async_msgq, self.async_callback)
+
+ def async_callback(self, msg):
+ md = self.async_src.msg_to_async_metadata_t(msg)
+ print "Channel: %i Time: %f Event: %i" % (md.channel, md.time_spec.get_real_secs(), md.event_code)
+
def _set_status_msg(self, msg):
self.frame.GetStatusBar().SetStatusText(msg, 0)
diff --git a/gr-uhd/apps/uhd_rx_cfile.py b/gr-uhd/apps/uhd_rx_cfile.py
index de44d4f56..718bb80b7 100755
--- a/gr-uhd/apps/uhd_rx_cfile.py
+++ b/gr-uhd/apps/uhd_rx_cfile.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -26,7 +26,7 @@ outputs single precision complex float values or complex short values
(interleaved 16 bit signed short integers).
"""
-from gnuradio import gr, eng_notation
+from gnuradio import gr, gru, eng_notation
from gnuradio import uhd
from gnuradio.eng_option import eng_option
from optparse import OptionParser
@@ -106,6 +106,17 @@ class rx_cfile_block(gr.top_block):
else:
print "Writing 32-bit complex floats"
print "Output filename:", filename
+
+ # Direct asynchronous notifications to callback function
+ if options.show_async_msg:
+ self.async_msgq = gr.msg_queue(0)
+ self.async_src = uhd.amsg_source("", self.async_msgq)
+ self.async_rcv = gru.msgq_runner(self.async_msgq, self.async_callback)
+
+ def async_callback(self, msg):
+ md = self.async_src.msg_to_async_metadata_t(msg)
+ print "Channel: %i Time: %f Event: %i" % (md.channel, md.time_spec.get_real_secs(), md.event_code)
+
def get_options():
usage="%prog: [options] output_filename"
@@ -134,6 +145,8 @@ def get_options():
help="set wire format from USRP [default=%default")
parser.add_option("", "--scalar", type="int", default=1024,
help="set scalar multiplier value for sc8 wire format [default=%default]")
+ parser.add_option("", "--show-async-msg", action="store_true", default=False,
+ help="Show asynchronous message notifications from UHD [default=%default]")
(options, args) = parser.parse_args ()
if len(args) != 1:
diff --git a/gr-uhd/apps/uhd_rx_nogui.py b/gr-uhd/apps/uhd_rx_nogui.py
index e692e6ea3..bcb52c619 100755
--- a/gr-uhd/apps/uhd_rx_nogui.py
+++ b/gr-uhd/apps/uhd_rx_nogui.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2006,2007,2011 Free Software Foundation, Inc.
+# Copyright 2006,2007,2011,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -190,6 +190,17 @@ class app_top_block(gr.top_block):
AUDIO = audio.sink(int(options.output_rate),
options.audio_output)
self.connect(tail, AUDIO)
+
+ # Direct asynchronous notifications to callback function
+ if self.options.show_async_msg:
+ self.async_msgq = gr.msg_queue(0)
+ self.async_src = uhd.amsg_source("", self.async_msgq)
+ self.async_rcv = gru.msgq_runner(self.async_msgq, self.async_callback)
+
+ def async_callback(self, msg):
+ md = self.async_src.msg_to_async_metadata_t(msg)
+ print "Channel: %i Time: %f Event: %i" % (md.channel, md.time_spec.get_real_secs(), md.event_code)
+
def main():
parser = OptionParser(option_class=eng_option)
@@ -222,6 +233,8 @@ def main():
help="set CTCSS squelch to FREQ [default=%default]")
parser.add_option("-O", "--audio-output", type="string", default="",
help="pcm device name. E.g., hw:0,0 or surround51 or /dev/dsp")
+ parser.add_option("", "--show-async-msg", action="store_true", default=False,
+ help="Show asynchronous message notifications from UHD [default=%default]")
(options, args) = parser.parse_args()
if options.frequency is None:
diff --git a/gr-uhd/apps/uhd_siggen.py b/gr-uhd/apps/uhd_siggen.py
index 27e9e8e01..e1af586ae 100755
--- a/gr-uhd/apps/uhd_siggen.py
+++ b/gr-uhd/apps/uhd_siggen.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2008,2009,2011 Free Software Foundation, Inc.
+# Copyright 2008,2009,2011,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -38,7 +38,7 @@ TYPE_KEY = 'type'
def setter(ps, key, val): ps[key] = val
-from gnuradio import gr, uhd, eng_notation
+from gnuradio import gr, gru, uhd, eng_notation
from gnuradio.gr.pubsub import pubsub
from gnuradio.eng_option import eng_option
from optparse import OptionParser
@@ -114,6 +114,16 @@ class top_block(gr.top_block, pubsub):
if self._verbose:
print str(self._u)
+ # Direct asynchronous notifications to callback function
+ if options.show_async_msg:
+ self.async_msgq = gr.msg_queue(0)
+ self.async_src = uhd.amsg_source("", self.async_msgq)
+ self.async_rcv = gru.msgq_runner(self.async_msgq, self.async_callback)
+
+ def async_callback(self, msg):
+ md = self.async_src.msg_to_async_metadata_t(msg)
+ print "Channel: %i Time: %f Event: %i" % (md.channel, md.time_spec.get_real_secs(), md.event_code)
+
def _set_tx_amplitude(self, ampl):
"""
Sets the transmit amplitude sent to the USRP
@@ -325,6 +335,8 @@ def get_options():
metavar="AMPL")
parser.add_option("-v", "--verbose", action="store_true", default=False,
help="Use verbose console output [default=%default]")
+ parser.add_option("", "--show-async-msg", action="store_true", default=False,
+ help="Show asynchronous message notifications from UHD [default=%default]")
(options, args) = parser.parse_args()
diff --git a/gr-uhd/include/gr_uhd_amsg_source.h b/gr-uhd/include/gr_uhd_amsg_source.h
index accf15ce2..3c1b59fa7 100644
--- a/gr-uhd/include/gr_uhd_amsg_source.h
+++ b/gr-uhd/include/gr_uhd_amsg_source.h
@@ -38,6 +38,13 @@ GR_UHD_API boost::shared_ptr<uhd_amsg_source> uhd_make_amsg_source(
);
class GR_UHD_API uhd_amsg_source{
+public:
+ /*!
+ * Convert a raw asynchronous message to an asynchronous metatdata object.
+ * \return The asynchronous metadata object.
+ */
+ static uhd::async_metadata_t msg_to_async_metadata_t(const gr_message_sptr msg);
+
};
#endif /* INCLUDED_GR_UHD_AMSG_SOURCE_H */
diff --git a/gr-uhd/lib/gr_uhd_amsg_source.cc b/gr-uhd/lib/gr_uhd_amsg_source.cc
index f2958f115..08941584b 100644
--- a/gr-uhd/lib/gr_uhd_amsg_source.cc
+++ b/gr-uhd/lib/gr_uhd_amsg_source.cc
@@ -75,6 +75,11 @@ protected:
bool _running;
};
+uhd::async_metadata_t uhd_amsg_source::msg_to_async_metadata_t(const gr_message_sptr msg)
+{
+ return *(uhd::async_metadata_t *)msg->msg();
+}
+
/***********************************************************************
* Make UHD Asynchronous Message Source
**********************************************************************/
diff --git a/grc/blocks/Makefile.am b/grc/blocks/Makefile.am
index 020dcecdd..738e79f24 100644
--- a/grc/blocks/Makefile.am
+++ b/grc/blocks/Makefile.am
@@ -162,6 +162,7 @@ dist_ourdata_DATA = \
gr_stream_to_vector.xml \
gr_streams_to_stream.xml \
gr_streams_to_vector.xml \
+ gr_burst_tagger.xml \
gr_sub_xx.xml \
gr_threshold_ff.xml \
gr_throttle.xml \
diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml
index 183408cec..abc12b97f 100644
--- a/grc/blocks/block_tree.xml
+++ b/grc/blocks/block_tree.xml
@@ -104,6 +104,7 @@
<block>blks2_stream_to_vector_decimator</block>
<block>gr_stream_mux</block>
+ <block>gr_burst_tagger</block>
</cat>
<cat>
<name>Misc Conversions</name>
diff --git a/grc/blocks/gr_burst_tagger.xml b/grc/blocks/gr_burst_tagger.xml
new file mode 100644
index 000000000..58c909999
--- /dev/null
+++ b/grc/blocks/gr_burst_tagger.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Burst tagger:
+## all types, 1 output, 2 input: stream & trigger (short)
+###################################################
+ -->
+<block>
+ <name>Burst Tagger</name>
+ <key>gr_burst_tagger</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.burst_tagger($type.size)
+self.$(id).set_true_tag($true_key,$true_value)
+self.$(id).set_false_tag($false_key,$false_value)
+ </make>
+ <callback>set_true_tag($true_key,$true_value)</callback>
+ <callback>set_false_tag($false_key,$false_value)</callback>
+ <param>
+ <name>Stream Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>True KeyID</name>
+ <key>true_key</key>
+ <value>burst</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>True Value</name>
+ <key>true_value</key>
+ <value>True</value>
+ <type>bool</type>
+ </param>
+ <param>
+ <name>False KeyID</name>
+ <key>false_key</key>
+ <value>burst</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>False Value</name>
+ <key>false_value</key>
+ <value>False</value>
+ <type>bool</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>1</vlen>
+ </sink>
+ <sink>
+ <name>trigger</name>
+ <type>short</type>
+ <vlen>1</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>1</vlen>
+ </source>
+</block>
diff --git a/version.sh b/version.sh
index 58ec712f6..88a3de947 100644
--- a/version.sh
+++ b/version.sh
@@ -1,4 +1,4 @@
MAJOR_VERSION=3
API_COMPAT=5
-MINOR_VERSION=1
-MAINT_VERSION=0
+MINOR_VERSION=2
+MAINT_VERSION=git