summaryrefslogtreecommitdiff
path: root/gr-blocks/include
diff options
context:
space:
mode:
Diffstat (limited to 'gr-blocks/include')
-rw-r--r--gr-blocks/include/blocks/CMakeLists.txt50
-rw-r--r--gr-blocks/include/blocks/annotator_1to1.h60
-rw-r--r--gr-blocks/include/blocks/annotator_alltoall.h61
-rw-r--r--gr-blocks/include/blocks/annotator_raw.h57
-rw-r--r--gr-blocks/include/blocks/api.h2
-rw-r--r--gr-blocks/include/blocks/check_lfsr_32k_s.h56
-rw-r--r--gr-blocks/include/blocks/control_loop.h234
-rw-r--r--gr-blocks/include/blocks/copy.h54
-rw-r--r--gr-blocks/include/blocks/ctrlport_probe2_c.h64
-rw-r--r--gr-blocks/include/blocks/ctrlport_probe_c.h62
-rw-r--r--gr-blocks/include/blocks/endian_swap.h50
-rw-r--r--gr-blocks/include/blocks/file_descriptor_sink.h54
-rw-r--r--gr-blocks/include/blocks/file_descriptor_source.h61
-rw-r--r--gr-blocks/include/blocks/file_sink.h55
-rw-r--r--gr-blocks/include/blocks/file_sink_base.h80
-rw-r--r--gr-blocks/include/blocks/head.h55
-rw-r--r--gr-blocks/include/blocks/lfsr_15_1_0.h69
-rw-r--r--gr-blocks/include/blocks/lfsr_32k.h90
-rw-r--r--gr-blocks/include/blocks/lfsr_32k_source_s.h55
-rw-r--r--gr-blocks/include/blocks/message_sink.h5
-rw-r--r--gr-blocks/include/blocks/message_source.h2
-rw-r--r--gr-blocks/include/blocks/mute_XX.h.t4
-rw-r--r--gr-blocks/include/blocks/nop.h59
-rw-r--r--gr-blocks/include/blocks/null_sink.h55
-rw-r--r--gr-blocks/include/blocks/null_source.h53
-rw-r--r--gr-blocks/include/blocks/pdu.h4
-rw-r--r--gr-blocks/include/blocks/peak_detector_XX.h.t2
-rw-r--r--gr-blocks/include/blocks/plateau_detector_fb.h71
-rw-r--r--gr-blocks/include/blocks/probe_rate.h60
-rw-r--r--gr-blocks/include/blocks/repack_bits_bb.h65
-rw-r--r--gr-blocks/include/blocks/rotator.h63
-rw-r--r--gr-blocks/include/blocks/skiphead.h53
-rw-r--r--gr-blocks/include/blocks/tagged_file_sink.h65
-rw-r--r--gr-blocks/include/blocks/tagged_stream_mux.h61
-rw-r--r--gr-blocks/include/blocks/udp_sink.h81
-rw-r--r--gr-blocks/include/blocks/udp_source.h84
-rw-r--r--gr-blocks/include/blocks/vco_f.h57
-rw-r--r--gr-blocks/include/blocks/vector_insert_X.h.t54
-rw-r--r--gr-blocks/include/blocks/vector_map.h71
-rw-r--r--gr-blocks/include/blocks/vector_sink_X.h.t54
-rw-r--r--gr-blocks/include/blocks/vector_source_X.h.t56
-rw-r--r--gr-blocks/include/blocks/wavfile.h101
-rw-r--r--gr-blocks/include/blocks/wavfile_sink.h87
-rw-r--r--gr-blocks/include/blocks/wavfile_source.h70
44 files changed, 2596 insertions, 10 deletions
diff --git a/gr-blocks/include/blocks/CMakeLists.txt b/gr-blocks/include/blocks/CMakeLists.txt
index 24451903d0..14346f9c15 100644
--- a/gr-blocks/include/blocks/CMakeLists.txt
+++ b/gr-blocks/include/blocks/CMakeLists.txt
@@ -26,7 +26,7 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py "
#!${PYTHON_EXECUTABLE}
import sys, os, re
-sys.path.append('${GR_CORE_PYTHONPATH}')
+sys.path.append('${GR_RUNTIME_PYTHONPATH}')
os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
@@ -65,8 +65,8 @@ endmacro(expand_h)
# Invoke macro to generate various sources
########################################################################
expand_h(add_XX ss ii cc)
-expand_h(add_const_XX ss ii ff cc)
-expand_h(add_const_vXX ss ii ff cc)
+expand_h(add_const_XX bb ss ii ff cc)
+expand_h(add_const_vXX bb ss ii ff cc)
expand_h(and_XX bb ss ii)
expand_h(and_const_XX bb ss ii)
expand_h(argmax_XX fs is ss)
@@ -88,6 +88,9 @@ expand_h(sub_XX ss ii ff cc)
expand_h(xor_XX bb ss ii)
expand_h(packed_to_unpacked_XX bb ss ii)
expand_h(unpacked_to_packed_XX bb ss ii)
+expand_h(vector_insert_X b s i f c)
+expand_h(vector_sink_X b s i f c)
+expand_h(vector_source_X b s i f c)
add_custom_target(blocks_generated_includes DEPENDS
${generated_includes}
@@ -99,13 +102,23 @@ add_custom_target(blocks_generated_includes DEPENDS
install(FILES
${generated_includes}
api.h
+ control_loop.h
count_bits.h
+ file_sink_base.h
+ lfsr_15_1_0.h
+ lfsr_32k.h
log2_const.h
+ rotator.h
+ wavfile.h
add_ff.h
+ annotator_1to1.h
+ annotator_alltoall.h
+ annotator_raw.h
bin_statistics_f.h
burst_tagger.h
char_to_float.h
char_to_short.h
+ check_lfsr_32k_s.h
complex_to_interleaved_short.h
complex_to_float.h
complex_to_imag.h
@@ -114,8 +127,13 @@ install(FILES
complex_to_mag_squared.h
complex_to_arg.h
conjugate_cc.h
+ copy.h
deinterleave.h
delay.h
+ endian_swap.h
+ file_descriptor_sink.h
+ file_descriptor_source.h
+ file_sink.h
file_source.h
file_meta_sink.h
file_meta_source.h
@@ -124,11 +142,13 @@ install(FILES
float_to_int.h
float_to_short.h
float_to_uchar.h
+ head.h
int_to_float.h
interleave.h
interleaved_short_to_complex.h
keep_m_in_n.h
keep_one_in_n.h
+ lfsr_32k_source_s.h
message_debug.h
message_sink.h
message_source.h
@@ -140,18 +160,25 @@ install(FILES
multiply_const_cc.h
multiply_const_ff.h
nlog10_ff.h
+ nop.h
+ null_sink.h
+ null_source.h
pack_k_bits_bb.h
patterned_interleaver.h
pdu.h
pdu_to_tagged_stream.h
peak_detector2_fb.h
random_pdu.h
+ plateau_detector_fb.h
+ probe_rate.h
regenerate_bb.h
+ repack_bits_bb.h
repeat.h
rms_cf.h
rms_ff.h
short_to_char.h
short_to_float.h
+ skiphead.h
socket_pdu.h
stream_mux.h
stream_to_streams.h
@@ -160,15 +187,32 @@ install(FILES
streams_to_vector.h
stretch_ff.h
tag_debug.h
+ tagged_file_sink.h
+ tagged_stream_mux.h
tagged_stream_to_pdu.h
threshold_ff.h
throttle.h
transcendental.h
tuntap_pdu.h
uchar_to_float.h
+ udp_sink.h
+ udp_source.h
unpack_k_bits_bb.h
+ vco_f.h
+ vector_map.h
vector_to_stream.h
vector_to_streams.h
+ wavfile_sink.h
+ wavfile_source.h
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/blocks
COMPONENT "blocks_devel"
)
+
+if(ENABLE_GR_CTRLPORT)
+install(FILES
+ ctrlport_probe_c.h
+ ctrlport_probe2_c.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/blocks
+ COMPONENT "blocks_devel"
+)
+endif(ENABLE_GR_CTRLPORT)
diff --git a/gr-blocks/include/blocks/annotator_1to1.h b/gr-blocks/include/blocks/annotator_1to1.h
new file mode 100644
index 0000000000..6cc8db6eef
--- /dev/null
+++ b/gr-blocks/include/blocks/annotator_1to1.h
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_ANNOTATOR_1TO1_H
+#define INCLUDED_GR_ANNOTATOR_1TO1_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief 1-to-1 stream annotator testing block. FOR TESTING PURPOSES ONLY.
+ *
+ * This block creates tags to be sent downstream every 10,000
+ * items it sees. The tags contain the name and ID of the
+ * instantiated block, use "seq" as a key, and have a counter that
+ * increments by 1 for every tag produced that is used as the
+ * tag's value. The tags are propagated using the 1-to-1 policy.
+ *
+ * It also stores a copy of all tags it sees flow past it. These
+ * tags can be recalled externally with the data() member.
+ *
+ * This block is only meant for testing and showing how to use the tags.
+ */
+ class BLOCKS_API annotator_1to1 : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::annotator_1to1::sptr
+ typedef boost::shared_ptr<annotator_1to1> sptr;
+
+ static sptr make(int when, size_t sizeof_stream_item);
+
+ virtual std::vector<gr_tag_t> data() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_ANNOTATOR_1TO1_H */
diff --git a/gr-blocks/include/blocks/annotator_alltoall.h b/gr-blocks/include/blocks/annotator_alltoall.h
new file mode 100644
index 0000000000..558aea69ca
--- /dev/null
+++ b/gr-blocks/include/blocks/annotator_alltoall.h
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_ANNOTATOR_ALLTOALL_H
+#define INCLUDED_GR_ANNOTATOR_ALLTOALL_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief All-to-all stream annotator testing block. FOR TESTING PURPOSES ONLY.
+ *
+ * This block creates tags to be sent downstream every 10,000
+ * items it sees. The tags contain the name and ID of the
+ * instantiated block, use "seq" as a key, and have a counter that
+ * increments by 1 for every tag produced that is used as the
+ * tag's value. The tags are propagated using the all-to-all
+ * policy.
+ *
+ * It also stores a copy of all tags it sees flow past it. These
+ * tags can be recalled externally with the data() member.
+ *
+ * This block is only meant for testing and showing how to use the tags.
+ */
+ class BLOCKS_API annotator_alltoall : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::annotator_alltoall::sptr
+ typedef boost::shared_ptr<annotator_alltoall> sptr;
+
+ static sptr make(int when, size_t sizeof_stream_item);
+
+ virtual std::vector<gr_tag_t> data() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_ANNOTATOR_ALLTOALL_H */
diff --git a/gr-blocks/include/blocks/annotator_raw.h b/gr-blocks/include/blocks/annotator_raw.h
new file mode 100644
index 0000000000..ae273c2a46
--- /dev/null
+++ b/gr-blocks/include/blocks/annotator_raw.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_ANNOTATOR_RAW_H
+#define INCLUDED_GR_ANNOTATOR_RAW_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+#include <gr_tags.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief raw stream annotator testing block.
+ *
+ * This block creates arbitrary tags to be sent downstream blocks
+ * to be sent are set manually via accessor methods and are sent
+ * only once.
+ *
+ * This block is intended for testing of tag related blocks
+ */
+ class BLOCKS_API annotator_raw : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::annotator_raw::sptr
+ typedef boost::shared_ptr<annotator_raw> sptr;
+
+ static sptr make(size_t sizeof_stream_item);
+
+ // insert a tag to be added
+ virtual void add_tag(uint64_t offset, pmt::pmt_t key, pmt::pmt_t val) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_ANNOTATOR_RAW_H */
diff --git a/gr-blocks/include/blocks/api.h b/gr-blocks/include/blocks/api.h
index 45fbc0d216..d77bdbdd5b 100644
--- a/gr-blocks/include/blocks/api.h
+++ b/gr-blocks/include/blocks/api.h
@@ -22,7 +22,7 @@
#ifndef INCLUDED_BLOCKS_API_H
#define INCLUDED_BLOCKS_API_H
-#include <gruel/attributes.h>
+#include <attributes.h>
#ifdef gnuradio_blocks_EXPORTS
# define BLOCKS_API __GR_ATTR_EXPORT
diff --git a/gr-blocks/include/blocks/check_lfsr_32k_s.h b/gr-blocks/include/blocks/check_lfsr_32k_s.h
new file mode 100644
index 0000000000..4eba436e80
--- /dev/null
+++ b/gr-blocks/include/blocks/check_lfsr_32k_s.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_CHECK_LFSR_32K_S_H
+#define INCLUDED_GR_CHECK_LFSR_32K_S_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief sink that checks if its input stream consists of a lfsr_32k sequence.
+ * \ingroup sink_blk
+ *
+ * This sink is typically used along with
+ * gr::blocks::lfsr_32k_source_s to test the USRP using its
+ * digital loopback mode.
+ */
+ class BLOCKS_API check_lfsr_32k_s : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::check_lfsr_32k_s::sptr
+ typedef boost::shared_ptr<check_lfsr_32k_s> sptr;
+
+ static sptr make();
+
+ virtual long ntotal () const = 0;
+ virtual long nright () const = 0;
+ virtual long runlength () const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_CHECK_LFSR_32K_S_H */
diff --git a/gr-blocks/include/blocks/control_loop.h b/gr-blocks/include/blocks/control_loop.h
new file mode 100644
index 0000000000..7c09f5915b
--- /dev/null
+++ b/gr-blocks/include/blocks/control_loop.h
@@ -0,0 +1,234 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GR_BLOCKS_CONTROL_LOOP
+#define GR_BLOCKS_CONTROL_LOOP
+
+#include <blocks/api.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API control_loop
+ {
+ protected:
+ float d_phase, d_freq;
+ float d_max_freq, d_min_freq;
+ float d_damping, d_loop_bw;
+ float d_alpha, d_beta;
+
+ public:
+ control_loop(void) {}
+ control_loop(float loop_bw, float max_freq, float min_freq);
+ virtual ~control_loop();
+
+ /*! \brief update the system gains from the loop bandwidth and damping factor
+ *
+ * This function updates the system gains based on the loop
+ * bandwidth and damping factor of the system. These two
+ * factors can be set separately through their own set
+ * functions.
+ */
+ void update_gains();
+
+ /*! \brief Advance the control loop based on the current gain
+ * settings and the inputted error signal.
+ */
+ void advance_loop(float error);
+
+ /*! \brief Keep the phase between -2pi and 2pi
+ *
+ * This function keeps the phase between -2pi and 2pi. If the
+ * phase is greater than 2pi by d, it wraps around to be -2pi+d;
+ * similarly if it is less than -2pi by d, it wraps around to
+ * 2pi-d.
+ *
+ * This function should be called after advance_loop to keep the
+ * phase in a good operating region. It is set as a separate
+ * method in case another way is desired as this is fairly
+ * heavy-handed.
+ */
+ void phase_wrap();
+
+ /*! \brief Keep the frequency between d_min_freq and d_max_freq
+ *
+ * This function keeps the frequency between d_min_freq and
+ * d_max_freq. If the frequency is greater than d_max_freq, it
+ * is set to d_max_freq. If the frequency is less than
+ * d_min_freq, it is set to d_min_freq.
+ *
+ * This function should be called after advance_loop to keep the
+ * frequency in the specified region. It is set as a separate
+ * method in case another way is desired as this is fairly
+ * heavy-handed.
+ */
+ void frequency_limit();
+
+ /*******************************************************************
+ * SET FUNCTIONS
+ *******************************************************************/
+
+ /*!
+ * \brief Set the loop bandwidth
+ *
+ * Set the loop filter's bandwidth to \p bw. This should be
+ * between 2*pi/200 and 2*pi/100 (in rads/samp). It must also be
+ * a positive number.
+ *
+ * When a new damping factor is set, the gains, alpha and beta,
+ * of the loop are recalculated by a call to update_gains().
+ *
+ * \param bw (float) new bandwidth
+ */
+ virtual void set_loop_bandwidth(float bw);
+
+ /*!
+ * \brief Set the loop damping factor
+ *
+ * Set the loop filter's damping factor to \p df. The damping
+ * factor should be sqrt(2)/2.0 for critically damped systems.
+ * Set it to anything else only if you know what you are
+ * doing. It must be a number between 0 and 1.
+ *
+ * When a new damping factor is set, the gains, alpha and beta,
+ * of the loop are recalculated by a call to update_gains().
+ *
+ * \param df (float) new damping factor
+ */
+ void set_damping_factor(float df);
+
+ /*!
+ * \brief Set the loop gain alpha
+ *
+ * Set's the loop filter's alpha gain parameter.
+ *
+ * This value should really only be set by adjusting the loop
+ * bandwidth and damping factor.
+ *
+ * \param alpha (float) new alpha gain
+ *
+ */
+ void set_alpha(float alpha);
+
+ /*!
+ * \brief Set the loop gain beta
+ *
+ * Set's the loop filter's beta gain parameter.
+ *
+ * This value should really only be set by adjusting the loop
+ * bandwidth and damping factor.
+ *
+ * \param beta (float) new beta gain
+ */
+ void set_beta(float beta);
+
+ /*!
+ * \brief Set the control loop's frequency.
+ *
+ * Set's the control loop's frequency. While this is normally
+ * updated by the inner loop of the algorithm, it could be
+ * useful to manually initialize, set, or reset this under
+ * certain circumstances.
+ *
+ * \param freq (float) new frequency
+ */
+ void set_frequency(float freq);
+
+ /*!
+ * \brief Set the control loop's phase.
+ *
+ * Set's the control loop's phase. While this is normally
+ * updated by the inner loop of the algorithm, it could be
+ * useful to manually initialize, set, or reset this under
+ * certain circumstances.
+ *
+ * \param phase (float) new phase
+ */
+ void set_phase(float phase);
+
+ /*!
+ * \brief Set the control loop's maximum frequency.
+ *
+ * Set the maximum frequency the control loop can track.
+ *
+ * \param freq (float) new max frequency
+ */
+ void set_max_freq(float freq);
+
+ /*!
+ * \brief Set the control loop's minimum frequency.
+ *
+ * Set the minimum frequency the control loop can track.
+ *
+ * \param freq (float) new min frequency
+ */
+ void set_min_freq(float freq);
+
+ /*******************************************************************
+ * GET FUNCTIONS
+ *******************************************************************/
+
+ /*!
+ * \brief Returns the loop bandwidth
+ */
+ float get_loop_bandwidth() const;
+
+ /*!
+ * \brief Returns the loop damping factor
+ */
+ float get_damping_factor() const;
+
+ /*!
+ * \brief Returns the loop gain alpha
+ */
+ float get_alpha() const;
+
+ /*!
+ * \brief Returns the loop gain beta
+ */
+ float get_beta() const;
+
+ /*!
+ * \brief Get the control loop's frequency estimate
+ */
+ float get_frequency() const;
+
+ /*!
+ * \brief Get the control loop's phase estimate
+ */
+ float get_phase() const;
+
+ /*!
+ * \brief Get the control loop's maximum frequency.
+ */
+ float get_max_freq() const;
+
+ /*!
+ * \brief Get the control loop's minimum frequency.
+ */
+ float get_min_freq() const;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* GR_BLOCKS_CONTROL_LOOP */
diff --git a/gr-blocks/include/blocks/copy.h b/gr-blocks/include/blocks/copy.h
new file mode 100644
index 0000000000..5ed0ea0e92
--- /dev/null
+++ b/gr-blocks/include/blocks/copy.h
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2009,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_COPY_H
+#define INCLUDED_GR_COPY_H
+
+#include <blocks/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief output[i] = input[i]
+ * \ingroup misc_blk
+ *
+ * When enabled (default), this block copies its input to its
+ * output. When disabled, this block drops its input on the floor.
+ */
+ class BLOCKS_API copy : virtual public gr_block
+ {
+ public:
+ // gr::blocks::copy::sptr
+ typedef boost::shared_ptr<copy> sptr;
+
+ static sptr make(size_t itemsize);
+
+ virtual void set_enabled(bool enable) = 0;
+ virtual bool enabled() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_COPY_H */
diff --git a/gr-blocks/include/blocks/ctrlport_probe2_c.h b/gr-blocks/include/blocks/ctrlport_probe2_c.h
new file mode 100644
index 0000000000..9a6034fcca
--- /dev/null
+++ b/gr-blocks/include/blocks/ctrlport_probe2_c.h
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012-2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_CTRLPORT_PROBE2_C_H
+#define INCLUDED_CTRLPORT_PROBE2_C_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief A ControlPort probe to export vectors of signals.
+ *
+ * This block acts as a sink in the flowgraph but also exports
+ * vectors of complex samples over ControlPort. This block holds
+ * the latest \p len number of complex samples so that every query
+ * by a ControlPort client will get the same length vector.
+ */
+ class BLOCKS_API ctrlport_probe2_c : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::ctrlport_probe2_c::sptr
+ typedef boost::shared_ptr<ctrlport_probe2_c> sptr;
+
+ /*!
+ * \brief Make a ControlPort probe block.
+ * \param id A string ID to name the probe over ControlPort.
+ * \param desc A string describing the probe.
+ * \param len Number of samples to transmit.
+ */
+ static sptr make(const std::string &id, const std::string &desc, int len);
+
+ virtual std::vector<gr_complex> get() = 0;
+
+ virtual void set_length(int len) = 0;
+ virtual int length() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_CTRLPORT_PROBE2_C_H */
+
diff --git a/gr-blocks/include/blocks/ctrlport_probe_c.h b/gr-blocks/include/blocks/ctrlport_probe_c.h
new file mode 100644
index 0000000000..92fe8c5600
--- /dev/null
+++ b/gr-blocks/include/blocks/ctrlport_probe_c.h
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012-2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_CTRLPORT_PROBE_C_H
+#define INCLUDED_CTRLPORT_PROBE_C_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+#include <rpcregisterhelpers.h>
+#include <boost/thread/shared_mutex.hpp>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief A ControlPort probe to export vectors of signals.
+ *
+ * This block acts as a sink in the flowgraph but also exports
+ * vectors of complex samples over ControlPort. This block simply
+ * sends the current vector held in the work function when the
+ * queried by a ControlPort client.
+ */
+ class BLOCKS_API ctrlport_probe_c : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::ctrlport_probe_c::sptr
+ typedef boost::shared_ptr<ctrlport_probe_c> sptr;
+
+ /*!
+ * \brief Make a ControlPort probe block.
+ * \param id A string ID to name the probe over ControlPort.
+ * \param desc A string describing the probe.
+ */
+ static sptr make(const std::string &id, const std::string &desc);
+
+ virtual std::vector<gr_complex> get() = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_CTRLPORT_GR_CTRLPORT_PROBE_C_H */
+
diff --git a/gr-blocks/include/blocks/endian_swap.h b/gr-blocks/include/blocks/endian_swap.h
new file mode 100644
index 0000000000..4b5a76218e
--- /dev/null
+++ b/gr-blocks/include/blocks/endian_swap.h
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_ENDIAN_SWAP_H
+#define INCLUDED_GR_ENDIAN_SWAP_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Convert stream of items into thier byte swapped version
+ *
+ * \param item_size_bytes number of bytes per item, 1=no-op,
+ * 2=uint16_t, 4=uint32_t, 8=uint64_t
+ */
+ class BLOCKS_API endian_swap : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::endian_swap::sptr
+ typedef boost::shared_ptr<endian_swap> sptr;
+
+ static sptr make(size_t item_size_bytes=1);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_ENDIAN_SWAP_H */
diff --git a/gr-blocks/include/blocks/file_descriptor_sink.h b/gr-blocks/include/blocks/file_descriptor_sink.h
new file mode 100644
index 0000000000..df59e24c0a
--- /dev/null
+++ b/gr-blocks/include/blocks/file_descriptor_sink.h
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_FILE_DESCRIPTOR_SINK_H
+#define INCLUDED_GR_FILE_DESCRIPTOR_SINK_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Write stream to file descriptor.
+ * \ingroup sink_blk
+ */
+ class BLOCKS_API file_descriptor_sink : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::file_descriptor_sink::sptr
+ typedef boost::shared_ptr<file_descriptor_sink> sptr;
+
+ /*!
+ * Build a file descriptor sink block.
+ *
+ * \param itemsize item size of the incoming data stream.
+ * \param fd file descriptor (as an integer).
+ */
+ static sptr make(size_t itemsize, int fd);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_FILE_DESCRIPTOR_SINK_H */
diff --git a/gr-blocks/include/blocks/file_descriptor_source.h b/gr-blocks/include/blocks/file_descriptor_source.h
new file mode 100644
index 0000000000..ff4f14792b
--- /dev/null
+++ b/gr-blocks/include/blocks/file_descriptor_source.h
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_H
+#define INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Read stream from file descriptor.
+ * \ingroup source_blk
+ */
+ class BLOCKS_API file_descriptor_source : virtual public gr_sync_block
+ {
+ protected:
+ virtual int read_items(char *buf, int nitems) = 0;
+ virtual int handle_residue(char *buf, int nbytes_read) = 0;
+ virtual void flush_residue() = 0;
+
+ public:
+ // gr::blocks::file_descriptor_source::sptr
+ typedef boost::shared_ptr<file_descriptor_source> sptr;
+
+ /*!
+ * Build a file descriptor source block.
+ *
+ * \param itemsize item size of the incoming data stream.
+ * \param fd file descriptor (as an integer).
+ * \param repeat repeat the data stream continuously.
+ */
+ static sptr make(size_t itemsize, int fd, bool repeat);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_H */
diff --git a/gr-blocks/include/blocks/file_sink.h b/gr-blocks/include/blocks/file_sink.h
new file mode 100644
index 0000000000..08c2adf1f7
--- /dev/null
+++ b/gr-blocks/include/blocks/file_sink.h
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_FILE_SINK_H
+#define INCLUDED_GR_FILE_SINK_H
+
+#include <blocks/api.h>
+#include <blocks/file_sink_base.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Write stream to file.
+ * \ingroup sink_blk
+ */
+ class BLOCKS_API file_sink : virtual public gr_sync_block,
+ virtual public file_sink_base
+ {
+ public:
+ // gr::blocks::file_sink::sptr
+ typedef boost::shared_ptr<file_sink> sptr;
+
+ /*!
+ * \brief Make a file sink.
+ * \param itemsize size of the input data items.
+ * \param filename name of the file to open and write output to.
+ */
+ static sptr make(size_t itemsize, const char *filename);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_FILE_SINK_H */
diff --git a/gr-blocks/include/blocks/file_sink_base.h b/gr-blocks/include/blocks/file_sink_base.h
new file mode 100644
index 0000000000..3eeb0e63da
--- /dev/null
+++ b/gr-blocks/include/blocks/file_sink_base.h
@@ -0,0 +1,80 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007,2008,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_FILE_SINK_BASE_H
+#define INCLUDED_GR_FILE_SINK_BASE_H
+
+#include <blocks/api.h>
+#include <boost/thread.hpp>
+#include <cstdio>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Common base class for file sinks
+ */
+ class BLOCKS_API file_sink_base
+ {
+ protected:
+ FILE *d_fp; // current FILE pointer
+ FILE *d_new_fp; // new FILE pointer
+ bool d_updated; // is there a new FILE pointer?
+ bool d_is_binary;
+ boost::mutex d_mutex;
+ bool d_unbuffered;
+
+ protected:
+ file_sink_base(const char *filename, bool is_binary);
+
+ public:
+ file_sink_base() {}
+ ~file_sink_base();
+
+ /*!
+ * \brief Open filename and begin output to it.
+ */
+ bool open(const char *filename);
+
+ /*!
+ * \brief Close current output file.
+ *
+ * Closes current output file and ignores any output until
+ * open is called to connect to another file.
+ */
+ void close();
+
+ /*!
+ * \brief if we've had an update, do it now.
+ */
+ void do_update();
+
+ /*!
+ * \brief turn on unbuffered writes for slower outputs
+ */
+ void set_unbuffered(bool unbuffered);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_FILE_SINK_BASE_H */
diff --git a/gr-blocks/include/blocks/head.h b/gr-blocks/include/blocks/head.h
new file mode 100644
index 0000000000..cc7d3808e5
--- /dev/null
+++ b/gr-blocks/include/blocks/head.h
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2009,2012,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_HEAD_H
+#define INCLUDED_GR_HEAD_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+#include <stddef.h> // size_t
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief copies the first N items to the output then signals done
+ * \ingroup slicedice_blk
+ *
+ * Useful for building test cases
+ */
+ class BLOCKS_API head : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::head::sptr
+ typedef boost::shared_ptr<head> sptr;
+
+ static sptr make(size_t sizeof_stream_item,
+ uint64_t nitems);
+
+ virtual void reset() = 0;
+ virtual void set_length(int nitems) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_HEAD_H */
diff --git a/gr-blocks/include/blocks/lfsr_15_1_0.h b/gr-blocks/include/blocks/lfsr_15_1_0.h
new file mode 100644
index 0000000000..a79ed62eb8
--- /dev/null
+++ b/gr-blocks/include/blocks/lfsr_15_1_0.h
@@ -0,0 +1,69 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GRI_LFSR_15_1_0_H
+#define INCLUDED_GRI_LFSR_15_1_0_H
+
+#include <blocks/api.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Linear Feedback Shift Register using primitive polynomial x^15 + x + 1
+ * \ingroup misc
+ *
+ * Generates a maximal length pseudo-random sequence of length
+ * 2^15 - 1 bits.
+ */
+ class BLOCKS_API lfsr_15_1_0
+ {
+ private:
+ unsigned long d_sr; // shift register
+
+ public:
+ lfsr_15_1_0() { reset(); }
+
+ void reset() { d_sr = 0x7fff; }
+
+ int next_bit()
+ {
+ d_sr = ((((d_sr >> 1) ^ d_sr) & 0x1) << 14) | (d_sr >> 1);
+ return d_sr & 0x1;
+ }
+
+ int next_byte ()
+ {
+ int v = 0;
+ for(int i = 0; i < 8; i++) {
+ v >>= 1;
+ if(next_bit ())
+ v |= 0x80;
+ }
+ return v;
+ }
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GRI_LFSR_15_1_0_H */
diff --git a/gr-blocks/include/blocks/lfsr_32k.h b/gr-blocks/include/blocks/lfsr_32k.h
new file mode 100644
index 0000000000..7e70f6512b
--- /dev/null
+++ b/gr-blocks/include/blocks/lfsr_32k.h
@@ -0,0 +1,90 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GRI_LFSR_32k_H
+#define INCLUDED_GRI_LFSR_32k_H
+
+#include <blocks/api.h>
+#include <blocks/lfsr_15_1_0.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief generate pseudo-random sequence of length 32768 bits.
+ * \ingroup misc
+ *
+ * This is based on gri_lfsr_15_1_0 with an extra 0 added at the
+ * end of the sequence.
+ */
+ class BLOCKS_API lfsr_32k
+ {
+ private:
+ lfsr_15_1_0 d_lfsr;
+ unsigned int d_count;
+
+ public:
+ lfsr_32k() { reset (); }
+
+ void reset()
+ {
+ d_lfsr.reset();
+ d_count = 0;
+ }
+
+ int next_bit()
+ {
+ if(d_count == 32767) {
+ d_count = 0;
+ return 0;
+ }
+ d_count++;
+ return d_lfsr.next_bit();
+ }
+
+ int next_byte()
+ {
+ int v = 0;
+ for(int i = 0; i < 8; i++) {
+ v >>= 1;
+ if(next_bit ())
+ v |= 0x80;
+ }
+ return v;
+ }
+
+ int next_short()
+ {
+ int v = 0;
+ for(int i = 0; i < 16; i++) {
+ v >>= 1;
+ if(next_bit ())
+ v |= 0x8000;
+ }
+ return v;
+ }
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GRI_LFSR_32k_H */
diff --git a/gr-blocks/include/blocks/lfsr_32k_source_s.h b/gr-blocks/include/blocks/lfsr_32k_source_s.h
new file mode 100644
index 0000000000..c24cc31b29
--- /dev/null
+++ b/gr-blocks/include/blocks/lfsr_32k_source_s.h
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_LFSR_32K_SOURCE_S_H
+#define INCLUDED_GR_LFSR_32K_SOURCE_S_H
+
+#include <blocks/api.h>
+#include <blocks/lfsr_32k.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief LFSR pseudo-random source with period of 2^15 bits (2^11 shorts)
+ * \ingroup source_blk
+ *
+ * This source is typically used along with gr::blocks::check_lfsr_32k_s to
+ * test the USRP using its digital loopback mode.
+ */
+ class BLOCKS_API lfsr_32k_source_s : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::lfsr_32k_source_s::sptr
+ typedef boost::shared_ptr<lfsr_32k_source_s> sptr;
+
+ /*!
+ * \brief Make a LFSR 32k source block.
+ */
+ static sptr make();
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_LFSR_32K_SOURCE_S_H */
diff --git a/gr-blocks/include/blocks/message_sink.h b/gr-blocks/include/blocks/message_sink.h
index 5d14836dd4..5d3084d02d 100644
--- a/gr-blocks/include/blocks/message_sink.h
+++ b/gr-blocks/include/blocks/message_sink.h
@@ -40,7 +40,10 @@ namespace gr {
// gr::blocks::message_sink::sptr
typedef boost::shared_ptr<message_sink> sptr;
- static sptr make (size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block);
+ static sptr make(size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block);
+ static sptr make(size_t itemsize, gr_msg_queue_sptr msgq, bool dont_block,
+ const std::string& lengthtagname);
+
};
} /* namespace blocks */
diff --git a/gr-blocks/include/blocks/message_source.h b/gr-blocks/include/blocks/message_source.h
index 5b55191880..cf4bafc22b 100644
--- a/gr-blocks/include/blocks/message_source.h
+++ b/gr-blocks/include/blocks/message_source.h
@@ -42,6 +42,8 @@ namespace gr {
static sptr make(size_t itemsize, int msgq_limit=0);
static sptr make(size_t itemsize, gr_msg_queue_sptr msgq);
+ static sptr make(size_t itemsize, gr_msg_queue_sptr msgq,
+ const std::string& lengthtagname);
virtual gr_msg_queue_sptr msgq() const = 0;
};
diff --git a/gr-blocks/include/blocks/mute_XX.h.t b/gr-blocks/include/blocks/mute_XX.h.t
index 3033248c4e..2b1c8b9a4d 100644
--- a/gr-blocks/include/blocks/mute_XX.h.t
+++ b/gr-blocks/include/blocks/mute_XX.h.t
@@ -41,10 +41,10 @@ namespace gr {
// gr::blocks::@NAME@::sptr
typedef boost::shared_ptr<@NAME@> sptr;
- static sptr make(bool mute);
+ static sptr make(bool mute=false);
virtual bool mute() const = 0;
- virtual void set_mute(bool mute) = 0;
+ virtual void set_mute(bool mute=false) = 0;
};
} /* namespace blocks */
diff --git a/gr-blocks/include/blocks/nop.h b/gr-blocks/include/blocks/nop.h
new file mode 100644
index 0000000000..a75adad621
--- /dev/null
+++ b/gr-blocks/include/blocks/nop.h
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_NOP_H
+#define INCLUDED_GR_NOP_H
+
+#include <blocks/api.h>
+#include <gr_block.h>
+#include <stddef.h> // size_t
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Does nothing. Used for testing only.
+ * \ingroup misc_blk
+ */
+ class BLOCKS_API nop : virtual public gr_block
+ {
+ public:
+ // gr::blocks::nop::sptr
+ typedef boost::shared_ptr<nop> sptr;
+
+ /*!
+ * Build a nop block.
+ *
+ * \param sizeof_stream_item size of the stream items in bytes.
+ */
+ static sptr make(size_t sizeof_stream_item);
+
+ virtual int nmsgs_received() const = 0;
+
+ virtual int ctrlport_test() const = 0;
+ virtual void set_ctrlport_test(int x) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_NOP_H */
diff --git a/gr-blocks/include/blocks/null_sink.h b/gr-blocks/include/blocks/null_sink.h
new file mode 100644
index 0000000000..c13a7552c6
--- /dev/null
+++ b/gr-blocks/include/blocks/null_sink.h
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_NULL_SINK_H
+#define INCLUDED_GR_NULL_SINK_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+#include <stddef.h> // size_t
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Bit bucket. Use as a termination point when a sink is
+ * required and we don't want to do anything real.
+ * \ingroup sink_blk
+ */
+ class BLOCKS_API null_sink : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::null_sink::sptr
+ typedef boost::shared_ptr<null_sink> sptr;
+
+ /*!
+ * Build a null sink block.
+ *
+ * \param sizeof_stream_item size of the stream items in bytes.
+ */
+ static sptr make(size_t sizeof_stream_item);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_NULL_SINK_H */
diff --git a/gr-blocks/include/blocks/null_source.h b/gr-blocks/include/blocks/null_source.h
new file mode 100644
index 0000000000..904a0c1ba3
--- /dev/null
+++ b/gr-blocks/include/blocks/null_source.h
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_NULL_SOURCE_H
+#define INCLUDED_GR_NULL_SOURCE_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief A source of zeros used mainly for testing.
+ * \ingroup source_blk
+ */
+ class BLOCKS_API null_source : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::null_source::sptr
+ typedef boost::shared_ptr<null_source> sptr;
+
+ /*!
+ * Build a null source block.
+ *
+ * \param sizeof_stream_item size of the stream items in bytes.
+ */
+ static sptr make(size_t sizeof_stream_item);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_NULL_SOURCE_H */
diff --git a/gr-blocks/include/blocks/pdu.h b/gr-blocks/include/blocks/pdu.h
index de0999c574..8890c5cb17 100644
--- a/gr-blocks/include/blocks/pdu.h
+++ b/gr-blocks/include/blocks/pdu.h
@@ -25,7 +25,7 @@
#include <blocks/api.h>
#include <gr_complex.h>
-#include <gruel/pmt.h>
+#include <pmt/pmt.h>
#define PDU_PORT_ID pmt::mp("pdus")
#define PDU_LENGTH_TAG pmt::mp("pdu_length")
@@ -38,7 +38,7 @@ namespace gr {
BLOCKS_API size_t itemsize(vector_type type);
BLOCKS_API bool type_matches(vector_type type, pmt::pmt_t v);
- BLOCKS_API pmt::pmt_t make_vector(vector_type type, const uint8_t* buf, size_t items);
+ BLOCKS_API pmt::pmt_t make_pdu_vector(vector_type type, const uint8_t* buf, size_t items);
BLOCKS_API vector_type type_from_pmt(pmt::pmt_t vector);
} /* namespace pdu */
diff --git a/gr-blocks/include/blocks/peak_detector_XX.h.t b/gr-blocks/include/blocks/peak_detector_XX.h.t
index 1c8ba0652f..fead53d208 100644
--- a/gr-blocks/include/blocks/peak_detector_XX.h.t
+++ b/gr-blocks/include/blocks/peak_detector_XX.h.t
@@ -38,7 +38,7 @@ namespace gr {
* If a peak is detected, this block outputs a 1,
* or it outputs 0's.
*/
- class GR_CORE_API @NAME@ : virtual public gr_sync_block
+ class BLOCKS_API @NAME@ : virtual public gr_sync_block
{
public:
// gr::blocks::@NAME@::sptr
diff --git a/gr-blocks/include/blocks/plateau_detector_fb.h b/gr-blocks/include/blocks/plateau_detector_fb.h
new file mode 100644
index 0000000000..041f9c1baf
--- /dev/null
+++ b/gr-blocks/include/blocks/plateau_detector_fb.h
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012-2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef INCLUDED_BLOCKS_PLATEAU_DETECTOR_FB_H
+#define INCLUDED_BLOCKS_PLATEAU_DETECTOR_FB_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Detects a plateau and marks the middle.
+ *
+ * Detect a plateau of a-priori known height. Input is a stream of floats,
+ * the output is a stream of bytes. Whenever a plateau is detected, the
+ * middle of that plateau is marked with a '1' on the output stream (all
+ * other samples are left at zero).
+ *
+ * You can use this in a Schmidl & Cox synchronisation algorithm to interpret
+ * the output of the normalized correlator. Just pass the length of the cyclic
+ * prefix (in samples) as the max_len parameter).
+ *
+ * Unlike the peak detectors, you must the now the absolute height of the plateau.
+ * Whenever the amplitude exceeds the given threshold, it starts assuming the
+ * presence of a plateau.
+ *
+ * An implicit hysteresis is provided by the fact that after detecting one plateau,
+ * it waits at least max_len samples before the next plateau can be detected.
+ *
+ * \ingroup level_blk
+ *
+ */
+ class BLOCKS_API plateau_detector_fb : virtual public gr_sync_block
+ {
+ public:
+ typedef boost::shared_ptr<plateau_detector_fb> sptr;
+
+ /*!
+ * \param max_len Maximum length of the plateau
+ * \param threshold Anything above this value is considered a plateau
+ */
+ static sptr make(int max_len, float threshold=0.9);
+ };
+
+ } // namespace blocks
+} // namespace gr
+
+#endif /* INCLUDED_BLOCKS_PLATEAU_DETECTOR_FB_H */
+
diff --git a/gr-blocks/include/blocks/probe_rate.h b/gr-blocks/include/blocks/probe_rate.h
new file mode 100644
index 0000000000..3401d2acd1
--- /dev/null
+++ b/gr-blocks/include/blocks/probe_rate.h
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_BLOCKS_PROBE_RATE_H
+#define INCLUDED_BLOCKS_PROBE_RATE_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief throughput measurement
+ */
+ class BLOCKS_API probe_rate : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::probe_rate::sptr
+ typedef boost::shared_ptr<probe_rate> sptr;
+
+ /*!
+ * \brief Make a throughput measurement block
+ * \param itemsize size of each stream item
+ * \param update_rate_ms minimum update time in milliseconds
+ * \param alpha gain for running average filter
+ */
+ static sptr make(size_t itemsize, double update_rate_ms = 500.0, double alpha = 0.0001);
+
+ virtual void set_alpha(double alpha) = 0;
+
+ virtual double rate() = 0;
+
+ virtual bool start() = 0;
+ virtual bool stop() = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_PROBE_RATE_H */
diff --git a/gr-blocks/include/blocks/repack_bits_bb.h b/gr-blocks/include/blocks/repack_bits_bb.h
new file mode 100644
index 0000000000..9ade0a4353
--- /dev/null
+++ b/gr-blocks/include/blocks/repack_bits_bb.h
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_BLOCKS_REPACK_BITS_BB_H
+#define INCLUDED_BLOCKS_REPACK_BITS_BB_H
+
+#include <blocks/api.h>
+#include <gr_tagged_stream_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Pack \p k bits from the input stream onto \p k bits of the output stream.
+ * \ingroup blocks
+ *
+ * No bits are lost here; any value for k and l (within [1, 8]) is allowed.
+ * On every fresh input byte, it starts reading on the LSB, and starts copying
+ * to the LSB as well.
+ *
+ * If a packet length tag is given, this block assumes a tagged stream.
+ * In this case, the tag with the packet length is updated accordingly.
+ * Also, the number of input bits is padded with zeros if the number of input
+ * bits is not an integer multiple of \p l, or bits are truncated from the input
+ * if \p align_output is set to true.
+ */
+ class BLOCKS_API repack_bits_bb : virtual public gr_tagged_stream_block
+ {
+ public:
+ typedef boost::shared_ptr<repack_bits_bb> sptr;
+
+ /*!
+ * \param k Number of relevant bits on the input stream
+ * \param l Number of relevant bits on the output stream
+ * \param len_tag_key If not empty, this is the key for the length tag.
+ * \param align_output If len_tag_key is given, this controls if the input
+ * or the output is aligned.
+ */
+ static sptr make(int k, int l=8, const std::string &len_tag_key="", bool align_output=false);
+ };
+
+ } // namespace blocks
+} // namespace gr
+
+#endif /* INCLUDED_BLOCKS_REPACK_BITS_BB_H */
+
diff --git a/gr-blocks/include/blocks/rotator.h b/gr-blocks/include/blocks/rotator.h
new file mode 100644
index 0000000000..96ece63574
--- /dev/null
+++ b/gr-blocks/include/blocks/rotator.h
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2008,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GR_ROTATOR_H_
+#define _GR_ROTATOR_H_
+
+#include <blocks/api.h>
+#include <gr_complex.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API rotator
+ {
+ private:
+ gr_complex d_phase;
+ gr_complex d_phase_incr;
+ unsigned int d_counter;
+
+ public:
+ rotator() : d_phase(1), d_phase_incr(1), d_counter(0)
+ { }
+
+ void set_phase(gr_complex phase) { d_phase = phase / abs(phase); }
+ void set_phase_incr(gr_complex incr) { d_phase_incr = incr / abs(incr); }
+
+ gr_complex rotate(gr_complex in)
+ {
+ d_counter++;
+
+ gr_complex z = in * d_phase; // rotate in by phase
+ d_phase *= d_phase_incr; // incr our phase (complex mult == add phases)
+
+ if((d_counter % 512) == 0)
+ d_phase /= abs(d_phase); // Normalize to ensure multiplication is rotation
+
+ return z;
+ }
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* _GR_ROTATOR_H_ */
diff --git a/gr-blocks/include/blocks/skiphead.h b/gr-blocks/include/blocks/skiphead.h
new file mode 100644
index 0000000000..e6745af8ea
--- /dev/null
+++ b/gr-blocks/include/blocks/skiphead.h
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_SKIPHEAD_H
+#define INCLUDED_GR_SKIPHEAD_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+#include <stddef.h> // size_t
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief skips the first N items, from then on copies items to the output
+ * \ingroup slicedice_blk
+ *
+ * Useful for building test cases and sources which have metadata
+ * or junk at the start
+ */
+ class BLOCKS_API skiphead : virtual public gr_block
+ {
+ public:
+ // gr::blocks::skiphead::sptr
+ typedef boost::shared_ptr<skiphead> sptr;
+
+ static sptr make(size_t itemsize,
+ uint64_t nitems_to_skip);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_SKIPHEAD_H */
diff --git a/gr-blocks/include/blocks/tagged_file_sink.h b/gr-blocks/include/blocks/tagged_file_sink.h
new file mode 100644
index 0000000000..62da72f789
--- /dev/null
+++ b/gr-blocks/include/blocks/tagged_file_sink.h
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_TAGGED_FILE_SINK_H
+#define INCLUDED_GR_TAGGED_FILE_SINK_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief A file sink that uses tags to save files.
+ * \ingroup sink_blk
+ *
+ * The sink uses a tag with the key 'burst' to trigger the saving
+ * of the burst data to a new file. If the value of this tag is
+ * True, it will open a new file and start writing all incoming
+ * data to it. If the tag is False, it will close the file (if
+ * already opened). The file names are based on the time when the
+ * burst tag was seen. If there is an 'rx_time' tag (standard with
+ * UHD sources), that is used as the time. If no 'rx_time' tag is
+ * found, the new time is calculated based off the sample rate of
+ * the block.
+ */
+ class BLOCKS_API tagged_file_sink : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::tagged_file_sink::sptr
+ typedef boost::shared_ptr<tagged_file_sink> sptr;
+
+ /*!
+ * \brief Build a tagged_file_sink block.
+ *
+ * \param itemsize The item size of the input data stream.
+ * \param samp_rate The sample rate used to determine the time
+ * difference between bursts
+ */
+ static sptr make(size_t itemsize, double samp_rate);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_TAGGED_FILE_SINK_H */
diff --git a/gr-blocks/include/blocks/tagged_stream_mux.h b/gr-blocks/include/blocks/tagged_stream_mux.h
new file mode 100644
index 0000000000..d271cf890f
--- /dev/null
+++ b/gr-blocks/include/blocks/tagged_stream_mux.h
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/* Copyright 2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_TAGGED_STREAM_MUX_H
+#define INCLUDED_TAGGED_STREAM_MUX_H
+
+#include <blocks/api.h>
+#include <gr_tagged_stream_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Combines tagged streams.
+ *
+ * Takes N streams as input. Each stream is tagged with packet lengths.
+ * Packets are output sequentially from each input stream.
+ *
+ * The output signal has a new length tag, which is the sum of all
+ * individual length tags. The old length tags are discarded.
+ *
+ * All other tags are propagated as expected, i.e. they stay associated
+ * with the same input item.
+ *
+ * \ingroup blocks
+ */
+ class BLOCKS_API tagged_stream_mux : virtual public gr_tagged_stream_block
+ {
+ public:
+ typedef boost::shared_ptr<tagged_stream_mux> sptr;
+
+ /*!
+ * \param itemsize Items size (number of bytes per item)
+ * \param lengthtagname Length tag key
+ */
+ static sptr make(size_t itemsize, const std::string &lengthtagname);
+ };
+
+ } // namespace blocks
+} // namespace gr
+
+#endif /* INCLUDED_TAGGED_STREAM_MUX_H */
+
diff --git a/gr-blocks/include/blocks/udp_sink.h b/gr-blocks/include/blocks/udp_sink.h
new file mode 100644
index 0000000000..69c5f0ffae
--- /dev/null
+++ b/gr-blocks/include/blocks/udp_sink.h
@@ -0,0 +1,81 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007-2010,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_UDP_SINK_H
+#define INCLUDED_GR_UDP_SINK_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Write stream to an UDP socket.
+ * \ingroup sink_blk
+ */
+ class BLOCKS_API udp_sink : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::udp_sink::sptr
+ typedef boost::shared_ptr<udp_sink> sptr;
+
+ /*!
+ * \brief UDP Sink Constructor
+ *
+ * \param itemsize The size (in bytes) of the item datatype
+ * \param host The name or IP address of the receiving host; use
+ * NULL or None for no connection
+ * \param port Destination port to connect to on receiving host
+ * \param payload_size UDP payload size by default set to
+ * 1472 = (1500 MTU - (8 byte UDP header) - (20 byte IP header))
+ * \param eof Send zero-length packet on disconnect
+ */
+ static sptr make(size_t itemsize,
+ const std::string &host, int port,
+ int payload_size=1472, bool eof=true);
+
+ /*! \brief return the PAYLOAD_SIZE of the socket */
+ virtual int payload_size() = 0;
+
+ /*! \brief Change the connection to a new destination
+ *
+ * \param host The name or IP address of the receiving host; use
+ * NULL or None to break the connection without closing
+ * \param port Destination port to connect to on receiving host
+ *
+ * Calls disconnect() to terminate any current connection first.
+ */
+ virtual void connect(const std::string &host, int port) = 0;
+
+ /*! \brief Send zero-length packet (if eof is requested) then stop sending
+ *
+ * Zero-byte packets can be interpreted as EOF by gr_udp_source.
+ * Note that disconnect occurs automatically when the sink is
+ * destroyed, but not when its top_block stops.*/
+ virtual void disconnect() = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_UDP_SINK_H */
diff --git a/gr-blocks/include/blocks/udp_source.h b/gr-blocks/include/blocks/udp_source.h
new file mode 100644
index 0000000000..b72db30db0
--- /dev/null
+++ b/gr-blocks/include/blocks/udp_source.h
@@ -0,0 +1,84 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007-2010,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_UDP_SOURCE_H
+#define INCLUDED_GR_UDP_SOURCE_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Read stream from an UDP socket.
+ * \ingroup source_blk
+ */
+ class BLOCKS_API udp_source : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::udp_source::sptr
+ typedef boost::shared_ptr<udp_source> sptr;
+
+ /*!
+ * \brief UDP Source Constructor
+ *
+ * \param itemsize The size (in bytes) of the item datatype
+ * \param host The name or IP address of the receiving host; can be
+ * NULL, None, or "0.0.0.0" to allow reading from any
+ * interface on the host
+ * \param port The port number on which to receive data; use 0 to
+ * have the system assign an unused port number
+ * \param payload_size UDP payload size by default set to 1472 =
+ * (1500 MTU - (8 byte UDP header) - (20 byte IP header))
+ * \param eof Interpret zero-length packet as EOF (default: true)
+ */
+ static sptr make(size_t itemsize,
+ const std::string &host, int port,
+ int payload_size=1472,
+ bool eof=true);
+
+ /*! \brief Change the connection to a new destination
+ *
+ * \param host The name or IP address of the receiving host; use
+ * NULL or None to break the connection without closing
+ * \param port Destination port to connect to on receiving host
+ *
+ * Calls disconnect() to terminate any current connection first.
+ */
+ virtual void connect(const std::string &host, int port) = 0;
+
+ /*! \brief Cut the connection if we have one set up.
+ */
+ virtual void disconnect() = 0;
+
+ /*! \brief return the PAYLOAD_SIZE of the socket */
+ virtual int payload_size() = 0;
+
+ /*! \brief return the port number of the socket */
+ virtual int get_port() = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_UDP_SOURCE_H */
diff --git a/gr-blocks/include/blocks/vco_f.h b/gr-blocks/include/blocks/vco_f.h
new file mode 100644
index 0000000000..0a5bf97d1f
--- /dev/null
+++ b/gr-blocks/include/blocks/vco_f.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_VCO_F_H
+#define INCLUDED_GR_VCO_F_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief VCO - Voltage controlled oscillator
+ * \ingroup misc
+ *
+ * input: float stream of control voltages; output: float oscillator output
+ */
+ class BLOCKS_API vco_f : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::vco_f::sptr
+ typedef boost::shared_ptr<vco_f> sptr;
+
+ /*!
+ * \brief VCO - Voltage controlled oscillator
+ *
+ * \param sampling_rate sampling rate (Hz)
+ * \param sensitivity units are radians/sec/volt
+ * \param amplitude output amplitude
+ */
+ static sptr make(double sampling_rate, double sensitivity, double amplitude);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_VCO_F_H */
diff --git a/gr-blocks/include/blocks/vector_insert_X.h.t b/gr-blocks/include/blocks/vector_insert_X.h.t
new file mode 100644
index 0000000000..aeb4a5248a
--- /dev/null
+++ b/gr-blocks/include/blocks/vector_insert_X.h.t
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012-2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <blocks/api.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief source of @TYPE@'s that gets its data from a vector
+ * \ingroup source_blk
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_block
+ {
+ public:
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ static sptr make(const std::vector<@TYPE@> &data,
+ int periodicity, int offset=0);
+
+ virtual void rewind() = 0;
+ virtual void set_data(const std::vector<@TYPE@> &data) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/include/blocks/vector_map.h b/gr-blocks/include/blocks/vector_map.h
new file mode 100644
index 0000000000..64c8744975
--- /dev/null
+++ b/gr-blocks/include/blocks/vector_map.h
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_VECTOR_MAP_H
+#define INCLUDED_GR_VECTOR_MAP_H
+
+#include <blocks/api.h>
+#include <vector>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Maps elements from a set of input vectors to a set of output vectors.
+ * \ingroup slicedice_blk
+ *
+ * If in[i] is the input vector in the i'th stream then the output
+ * vector in the j'th stream is:
+ *
+ * out[j][k] = in[mapping[j][k][0]][mapping[j][k][1]]
+ *
+ * That is mapping is of the form (out_stream1_mapping,
+ * out_stream2_mapping, ...) and out_stream1_mapping is of the
+ * form (element1_mapping, element2_mapping, ...) and
+ * element1_mapping is of the form (in_stream, in_element).
+ */
+ class BLOCKS_API vector_map : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::vector_map::sptr
+ typedef boost::shared_ptr<vector_map> sptr;
+
+ /*!
+ * Build a vector map block.
+ *
+ * \param item_size (integer) size of vector elements
+ * \param in_vlens (vector of integers) number of elements in each
+ * input vector
+ * \param mapping (vector of vectors of vectors of integers) how to
+ * map elements from input to output vectors
+ */
+ static sptr make(size_t item_size, std::vector<size_t> in_vlens,
+ std::vector< std::vector< std::vector<size_t> > > mapping);
+
+ virtual void set_mapping(std::vector< std::vector< std::vector<size_t> > > mapping) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_VECTOR_MAP_H */
diff --git a/gr-blocks/include/blocks/vector_sink_X.h.t b/gr-blocks/include/blocks/vector_sink_X.h.t
new file mode 100644
index 0000000000..d15c795721
--- /dev/null
+++ b/gr-blocks/include/blocks/vector_sink_X.h.t
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008,2009,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief @TYPE@ sink that writes to a vector
+ * \ingroup sink_blk
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ static sptr make(int vlen = 1);
+
+ virtual void reset() = 0;
+ virtual std::vector<@TYPE@> data() const = 0;
+ virtual std::vector<gr_tag_t> tags() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/include/blocks/vector_source_X.h.t b/gr-blocks/include/blocks/vector_source_X.h.t
new file mode 100644
index 0000000000..c68b638e62
--- /dev/null
+++ b/gr-blocks/include/blocks/vector_source_X.h.t
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008,2012-2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief source of @TYPE@'s that gets its data from a vector
+ * \ingroup source_blk
+ */
+ class BLOCKS_API @NAME@ : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::@NAME@::sptr
+ typedef boost::shared_ptr<@NAME@> sptr;
+
+ static sptr make(const std::vector<@TYPE@> &data,
+ bool repeat=false, int vlen=1,
+ const std::vector<gr_tag_t> &tags=std::vector<gr_tag_t>());
+
+ virtual void rewind() = 0;
+ virtual void set_data(const std::vector<@TYPE@> &data,
+ const std::vector<gr_tag_t> &tags=std::vector<gr_tag_t>()) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/include/blocks/wavfile.h b/gr-blocks/include/blocks/wavfile.h
new file mode 100644
index 0000000000..b852c01e2d
--- /dev/null
+++ b/gr-blocks/include/blocks/wavfile.h
@@ -0,0 +1,101 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// This file stores all the RIFF file type knowledge for the wavfile_*
+// blocks.
+
+#include <blocks/api.h>
+#include <cstdio>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Read signal information from a given WAV file.
+ *
+ * \param[in] fp File pointer to an opened, empty file.
+ * \param[out] sample_rate Stores the sample rate [S/s]
+ * \param[out] nchans Number of channels
+ * \param[out] bytes_per_sample Bytes per sample, can either be 1 or 2 (corresponding o
+ * 8 or 16 bit samples, respectively)
+ * \param[out] first_sample_pos Number of the first byte containing a sample. Use this
+ * with fseek() to jump from the end of the file to the
+ * first sample when in repeat mode.
+ * \param[out] samples_per_chan Number of samples per channel
+ * \return True on a successful read, false if the file could not be read or is
+ * not a valid WAV file.
+ */
+ bool
+ wavheader_parse(FILE *fp,
+ unsigned int &sample_rate,
+ int &nchans,
+ int &bytes_per_sample,
+ int &first_sample_pos,
+ unsigned int &samples_per_chan);
+
+ /*!
+ * \brief Read one sample from an open WAV file at the current position.
+ *
+ * Takes care of endianness.
+ */
+ short int
+ wav_read_sample(FILE *fp, int bytes_per_sample);
+
+
+ /*!
+ * \brief Write a valid RIFF file header
+ *
+ * Note: Some header values are kept blank because they're usually
+ * not known a-priori (file and chunk lengths). Use
+ * gri_wavheader_complete() to fill these in.
+ */
+ bool
+ wavheader_write(FILE *fp,
+ unsigned int sample_rate,
+ int nchans,
+ int bytes_per_sample);
+
+ /*!
+ * \brief Write one sample to an open WAV file at the current position.
+ *
+ * Takes care of endianness.
+ */
+ void
+ wav_write_sample(FILE *fp, short int sample, int bytes_per_sample);
+
+
+ /*!
+ * \brief Complete a WAV header
+ *
+ * Note: The stream position is changed during this function. If
+ * anything needs to be written to the WAV file after calling this
+ * function (which shouldn't happen), you need to fseek() to the
+ * end of the file (or whereever).
+ *
+ * \param[in] fp File pointer to an open WAV file with a blank header
+ * \param[in] byte_count Length of all samples written to the file in bytes.
+ */
+ bool
+ wavheader_complete(FILE *fp, unsigned int byte_count);
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/include/blocks/wavfile_sink.h b/gr-blocks/include/blocks/wavfile_sink.h
new file mode 100644
index 0000000000..b095191d07
--- /dev/null
+++ b/gr-blocks/include/blocks/wavfile_sink.h
@@ -0,0 +1,87 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_WAVFILE_SINK_H
+#define INCLUDED_GR_WAVFILE_SINK_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Write stream to a Microsoft PCM (.wav) file.
+ *
+ * Values must be floats within [-1;1].
+ * Check gr_make_wavfile_sink() for extra info.
+ *
+ * \ingroup sink_blk
+ */
+ class BLOCKS_API wavfile_sink : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::wavfile_sink::sptr
+ typedef boost::shared_ptr<wavfile_sink> sptr;
+
+ /*
+ * \p filename The .wav file to be opened
+ * \p n_channels Number of channels (2 = stereo or I/Q output)
+ * \p sample_rate Sample rate [S/s]
+ * \p bits_per_sample 16 or 8 bit, default is 16
+ */
+ static sptr make(const char *filename,
+ int n_channels,
+ unsigned int sample_rate,
+ int bits_per_sample = 16);
+
+ /*!
+ * \brief Opens a new file and writes a WAV header. Thread-safe.
+ */
+ virtual bool open(const char* filename) = 0;
+
+ /*!
+ * \brief Closes the currently active file and completes the WAV
+ * header. Thread-safe.
+ */
+ virtual void close() = 0;
+
+ /*!
+ * \brief Set the sample rate. This will not affect the WAV file
+ * currently opened. Any following open() calls will use this new
+ * sample rate.
+ */
+ virtual void set_sample_rate(unsigned int sample_rate) = 0;
+
+ /*!
+ * \brief Set bits per sample. This will not affect the WAV file
+ * currently opened (see set_sample_rate()). If the value is
+ * neither 8 nor 16, the call is ignored and the current value
+ * is kept.
+ */
+ virtual void set_bits_per_sample(int bits_per_sample) = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_WAVFILE_SINK_H */
diff --git a/gr-blocks/include/blocks/wavfile_source.h b/gr-blocks/include/blocks/wavfile_source.h
new file mode 100644
index 0000000000..46cb82b698
--- /dev/null
+++ b/gr-blocks/include/blocks/wavfile_source.h
@@ -0,0 +1,70 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_WAVFILE_SOURCE_H
+#define INCLUDED_GR_WAVFILE_SOURCE_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Read stream from a Microsoft PCM (.wav) file, output floats
+ *
+ * Unless otherwise called, values are within [-1;1].
+ * Check gr_make_wavfile_source() for extra info.
+ *
+ * \ingroup source_blk
+ */
+ class BLOCKS_API wavfile_source : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::wavfile_source::sptr
+ typedef boost::shared_ptr<wavfile_source> sptr;
+
+ static sptr make(const char *filename, bool repeat = false);
+
+ /*!
+ * \brief Read the sample rate as specified in the wav file header
+ */
+ virtual unsigned int sample_rate() const = 0;
+
+ /*!
+ * \brief Return the number of bits per sample as specified in
+ * the wav file header. Only 8 or 16 bit are supported here.
+ */
+ virtual int bits_per_sample() const = 0;
+
+ /*!
+ * \brief Return the number of channels in the wav file as
+ * specified in the wav file header. This is also the max number
+ * of outputs you can have.
+ */
+ virtual int channels() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_WAVFILE_SOURCE_H */