summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib/general
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core/src/lib/general')
-rw-r--r--gnuradio-core/src/lib/general/Makefile.am6
-rw-r--r--gnuradio-core/src/lib/general/general.i4
-rw-r--r--gnuradio-core/src/lib/general/gr_additive_scrambler_bb.cc65
-rw-r--r--gnuradio-core/src/lib/general/gr_additive_scrambler_bb.h67
-rw-r--r--gnuradio-core/src/lib/general/gr_additive_scrambler_bb.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_fll_band_edge_cc.cc213
-rw-r--r--gnuradio-core/src/lib/general/gr_fll_band_edge_cc.h139
-rw-r--r--gnuradio-core/src/lib/general/gr_fll_band_edge_cc.i41
-rw-r--r--gnuradio-core/src/lib/general/gr_head.cc6
-rw-r--r--gnuradio-core/src/lib/general/gr_head.h10
-rw-r--r--gnuradio-core/src/lib/general/gr_head.i2
-rw-r--r--gnuradio-core/src/lib/general/gr_ofdm_sampler.cc3
-rw-r--r--gnuradio-core/src/lib/general/gri_lfsr.h12
13 files changed, 587 insertions, 12 deletions
diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am
index cf6ff1e65..b5f5c346b 100644
--- a/gnuradio-core/src/lib/general/Makefile.am
+++ b/gnuradio-core/src/lib/general/Makefile.am
@@ -34,6 +34,7 @@ EXTRA_DIST = \
gr_constants.cc.in
libgeneral_la_SOURCES = \
+ gr_additive_scrambler_bb.cc \
gr_agc_cc.cc \
gr_agc_ff.cc \
gr_agc2_cc.cc \
@@ -76,6 +77,7 @@ libgeneral_la_SOURCES = \
gr_fft_vcc_fftw.cc \
gr_fft_vfc.cc \
gr_firdes.cc \
+ gr_fll_band_edge_cc.cc \
gr_float_to_char.cc \
gr_float_to_complex.cc \
gr_float_to_short.cc \
@@ -187,6 +189,7 @@ libgeneral_qa_la_SOURCES = \
qa_gri_lfsr.cc
grinclude_HEADERS = \
+ gr_additive_scrambler_bb.h \
gr_agc_cc.h \
gr_agc_ff.h \
gr_agc2_cc.h \
@@ -229,6 +232,7 @@ grinclude_HEADERS = \
gr_fft_vcc_fftw.h \
gr_fft_vfc.h \
gr_firdes.h \
+ gr_fll_band_edge_cc.h \
gr_float_to_char.h \
gr_float_to_complex.h \
gr_float_to_short.h \
@@ -358,6 +362,7 @@ noinst_HEADERS = \
if PYTHON
swiginclude_HEADERS = \
general.i \
+ gr_additive_scrambler_bb.i \
gr_agc_cc.i \
gr_agc_ff.i \
gr_agc2_cc.i \
@@ -396,6 +401,7 @@ swiginclude_HEADERS = \
gr_fft_vcc.i \
gr_fft_vfc.i \
gr_firdes.i \
+ gr_fll_band_edge_cc.i \
gr_float_to_char.i \
gr_float_to_complex.i \
gr_float_to_short.i \
diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i
index e1161c8eb..6929f1e6e 100644
--- a/gnuradio-core/src/lib/general/general.i
+++ b/gnuradio-core/src/lib/general/general.i
@@ -140,6 +140,8 @@
#include <gr_wavelet_ff.h>
#include <gr_wvps_ff.h>
#include <gr_copy.h>
+#include <gr_fll_band_edge_cc.h>
+#include <gr_additive_scrambler_bb.h>
%}
%include "gr_nop.i"
@@ -260,3 +262,5 @@
%include "gr_wavelet_ff.i"
%include "gr_wvps_ff.i"
%include "gr_copy.i"
+%include "gr_fll_band_edge_cc.i"
+%include "gr_additive_scrambler_bb.i"
diff --git a/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.cc b/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.cc
new file mode 100644
index 000000000..91e02c2d3
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.cc
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2010 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_additive_scrambler_bb.h>
+#include <gr_io_signature.h>
+
+gr_additive_scrambler_bb_sptr
+gr_make_additive_scrambler_bb(int mask, int seed, int len, int count)
+{
+ return gr_additive_scrambler_bb_sptr(new gr_additive_scrambler_bb(mask, seed, len, count));
+}
+
+gr_additive_scrambler_bb::gr_additive_scrambler_bb(int mask, int seed, int len, int count)
+ : gr_sync_block("additive_scrambler_bb",
+ gr_make_io_signature (1, 1, sizeof (unsigned char)),
+ gr_make_io_signature (1, 1, sizeof (unsigned char))),
+ d_lfsr(mask, seed, len),
+ d_count(count),
+ d_bits(0)
+{
+}
+
+int
+gr_additive_scrambler_bb::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const unsigned char *in = (const unsigned char *) input_items[0];
+ unsigned char *out = (unsigned char *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++) {
+ out[i] = in[i]^d_lfsr.next_bit();
+ if (d_count > 0) {
+ if (++d_bits == d_count) {
+ d_lfsr.reset();
+ d_bits = 0;
+ }
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.h b/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.h
new file mode 100644
index 000000000..6c9493050
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.h
@@ -0,0 +1,67 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2010 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_ADDITIVE_SCRAMBLER_BB_H
+#define INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H
+
+#include <gr_sync_block.h>
+#include "gri_lfsr.h"
+
+class gr_additive_scrambler_bb;
+typedef boost::shared_ptr<gr_additive_scrambler_bb> gr_additive_scrambler_bb_sptr;
+
+gr_additive_scrambler_bb_sptr gr_make_additive_scrambler_bb(int mask, int seed, int len, int count=0);
+
+/*!
+ * Scramble an input stream using an LFSR. This block works on the LSB only
+ * of the input data stream, i.e., on an "unpacked binary" stream, and
+ * produces the same format on its output.
+ *
+ * \param mask Polynomial mask for LFSR
+ * \param seed Initial shift register contents
+ * \param len Shift register length
+ * \param count Number of bits after which shift register is reset, 0=never
+ *
+ * The scrambler works by XORing the incoming bit stream by the output of
+ * the LFSR. Optionally, after 'count' bits have been processed, the shift
+ * register is reset to the seed value. This allows processing fixed length
+ * vectors of samples.
+ *
+ * \ingroup coding_blk
+ */
+
+class gr_additive_scrambler_bb : public gr_sync_block
+{
+ friend gr_additive_scrambler_bb_sptr gr_make_additive_scrambler_bb(int mask, int seed, int len, int count);
+
+ gri_lfsr d_lfsr;
+ int d_count;
+ int d_bits;
+
+ gr_additive_scrambler_bb(int mask, int seed, int len, int count);
+
+public:
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H */
diff --git a/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.i b/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.i
new file mode 100644
index 000000000..0ca9c1cd7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.i
@@ -0,0 +1,31 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2010 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,additive_scrambler_bb);
+
+gr_additive_scrambler_bb_sptr gr_make_additive_scrambler_bb(int mask, int seed, int len, int count=0);
+
+class gr_additive_scrambler_bb : public gr_sync_block
+{
+private:
+ gr_additive_scrambler_bb(int mask, int seed, int len, int count);
+};
diff --git a/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.cc b/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.cc
new file mode 100644
index 000000000..7f2c468b7
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.cc
@@ -0,0 +1,213 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_fll_band_edge_cc.h>
+#include <gr_fir_ccc.h>
+#include <gr_fir_util.h>
+#include <gri_fft.h>
+#include <gr_io_signature.h>
+#include <gr_expj.h>
+#include <gr_math.h>
+#include <cstdio>
+
+#define M_TWOPI (2*M_PI)
+
+float sinc(float x)
+{
+ if(x == 0)
+ return 1;
+ else
+ return sin(M_PI*x)/(M_PI*x);
+}
+
+
+
+gr_fll_band_edge_cc_sptr gr_make_fll_band_edge_cc (float samps_per_sym, float rolloff,
+ int filter_size, float gain_alpha, float gain_beta)
+{
+ return gr_fll_band_edge_cc_sptr (new gr_fll_band_edge_cc (samps_per_sym, rolloff,
+ filter_size, gain_alpha, gain_beta));
+}
+
+
+static int ios[] = {sizeof(gr_complex), sizeof(float), sizeof(float), sizeof(gr_complex)};
+static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int));
+gr_fll_band_edge_cc::gr_fll_band_edge_cc (float samps_per_sym, float rolloff,
+ int filter_size, float alpha, float beta)
+ : gr_sync_block ("fll_band_edge_cc",
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ gr_make_io_signaturev (1, 4, iosig)),
+ d_alpha(alpha), d_beta(beta), d_updated (false)
+{
+ // base this on the number of samples per symbol
+ d_max_freq = M_TWOPI * (2.0/samps_per_sym);
+ d_min_freq = -M_TWOPI * (2.0/samps_per_sym);
+
+ d_freq = 0;
+ d_phase = 0;
+
+ set_alpha(alpha);
+
+ design_filter(samps_per_sym, rolloff, filter_size);
+}
+
+gr_fll_band_edge_cc::~gr_fll_band_edge_cc ()
+{
+ delete d_filter_lower;
+ delete d_filter_upper;
+}
+
+void
+gr_fll_band_edge_cc::set_alpha(float alpha)
+{
+ //float eta = sqrt(2.0)/2.0;
+ //float theta = alpha;
+ //d_alpha = (4*eta*theta) / (1.0 + 2.0*eta*theta + theta*theta);
+ //d_beta = (4*theta*theta) / (1.0 + 2.0*eta*theta + theta*theta);
+ d_alpha = alpha;
+}
+
+void
+gr_fll_band_edge_cc::design_filter(float samps_per_sym, float rolloff, int filter_size)
+{
+ int M = rint(filter_size / samps_per_sym);
+ float power = 0;
+ std::vector<float> bb_taps;
+ for(int i = 0; i < filter_size; i++) {
+ float k = -M + i*2.0/samps_per_sym;
+ float tap = sinc(rolloff*k - 0.5) + sinc(rolloff*k + 0.5);
+ power += tap;
+
+ bb_taps.push_back(tap);
+ }
+
+ int N = (bb_taps.size() - 1.0)/2.0;
+ std::vector<gr_complex> taps_lower;
+ std::vector<gr_complex> taps_upper;
+ for(unsigned int i = 0; i < bb_taps.size(); i++) {
+ float tap = bb_taps[i] / power;
+
+ float k = (-N + (int)i)/(2.0*samps_per_sym);
+
+ gr_complex t1 = tap * gr_expj(-2*M_PI*(1+rolloff)*k);
+ gr_complex t2 = tap * gr_expj(2*M_PI*(1+rolloff)*k);
+
+ taps_lower.push_back(t1);
+ taps_upper.push_back(t2);
+ }
+
+ std::vector<gr_complex> vtaps(0, taps_lower.size());
+ d_filter_upper = gr_fir_util::create_gr_fir_ccc(vtaps);
+ d_filter_lower = gr_fir_util::create_gr_fir_ccc(vtaps);
+
+ d_filter_lower->set_taps(taps_lower);
+ d_filter_upper->set_taps(taps_upper);
+
+ d_updated = true;
+
+ // Set the history to ensure enough input items for each filter
+ set_history(filter_size+1);
+
+}
+
+void
+gr_fll_band_edge_cc::print_taps()
+{
+ unsigned int i;
+ std::vector<gr_complex> taps_upper = d_filter_upper->get_taps();
+ std::vector<gr_complex> taps_lower = d_filter_lower->get_taps();
+
+ printf("Upper Band-edge: [");
+ for(i = 0; i < taps_upper.size(); i++) {
+ printf(" %.4e + %.4ej,", taps_upper[i].real(), taps_upper[i].imag());
+ }
+ printf("]\n\n");
+
+ printf("Lower Band-edge: [");
+ for(i = 0; i < taps_lower.size(); i++) {
+ printf(" %.4e + %.4ej,", taps_lower[i].real(), taps_lower[i].imag());
+ }
+ printf("]\n\n");
+}
+
+int
+gr_fll_band_edge_cc::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ float *frq, *phs;
+ gr_complex *err;
+ if(output_items.size() > 2) {
+ frq = (float *) output_items[1];
+ phs = (float *) output_items[2];
+ err = (gr_complex *) output_items[3];
+ }
+
+ if (d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ int i;
+ gr_complex nco_out;
+ gr_complex out_upper, out_lower;
+ float error;
+ float avg_k = 0.1;
+ for(i = 0; i < noutput_items; i++) {
+ nco_out = gr_expj(d_phase);
+ out[i] = in[i] * nco_out;
+
+ out_upper = (d_filter_upper->filter(&out[i]));
+ out_lower = (d_filter_lower->filter(&out[i]));
+ error = -real((out_upper + out_lower) * conj(out_upper - out_lower));
+ d_error = avg_k*error + avg_k*d_error; // average error
+
+ d_freq = d_freq + d_beta * d_error;
+ d_phase = d_phase + d_freq + d_alpha * d_error;
+
+ if(d_phase > M_PI)
+ d_phase -= M_TWOPI;
+ else if(d_phase < -M_PI)
+ d_phase += M_TWOPI;
+
+ if (d_freq > d_max_freq)
+ d_freq = d_max_freq;
+ else if (d_freq < d_min_freq)
+ d_freq = d_min_freq;
+
+ if(output_items.size() > 2) {
+ frq[i] = d_freq;
+ phs[i] = d_phase;
+ err[i] = d_error;
+ }
+ }
+
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.h b/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.h
new file mode 100644
index 000000000..db060793e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.h
@@ -0,0 +1,139 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 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_FLL_BAND_EDGE_CC_H
+#define INCLUDED_GR_FLL_BAND_EDGE_CC_H
+
+#include <gr_sync_block.h>
+
+class gr_fll_band_edge_cc;
+typedef boost::shared_ptr<gr_fll_band_edge_cc> gr_fll_band_edge_cc_sptr;
+gr_fll_band_edge_cc_sptr gr_make_fll_band_edge_cc (float samps_per_sym, float rolloff,
+ int filter_size, float alpha, float beta);
+
+class gr_fir_ccc;
+class gri_fft_complex;
+
+/*!
+ * \class gr_fll_band_edge_cc
+ * \brief Frequency Lock Loop using band-edge filters
+ *
+ * \ingroup general
+ *
+ * The frequency lock loop derives a band-edge filter that covers the upper and lower bandwidths
+ * of a digitally-modulated signal. The bandwidth range is determined by the excess bandwidth
+ * (e.g., rolloff factor) of the modulated signal. The placement in frequency of the band-edges
+ * is determined by the oversampling ratio (number of samples per symbol) and the excess bandwidth.
+ * The size of the filters should be fairly large so as to average over a number of symbols.
+ *
+ * The FLL works by filtering the upper and lower band edges into x_u(t) and x_l(t), respectively.
+ * These are combined to form cc(t) = x_u(t) + x_l(t) and ss(t) = x_u(t) - x_l(t). Combining
+ * these to form the signal e(t) = Re{cc(t) \\times ss(t)^*} (where ^* is the complex conjugate)
+ * provides an error signal at the DC term that is directly proportional to the carrier frequency.
+ * We then make a second-order loop using the error signal that is the running average of e(t).
+ *
+ * In theory, the band-edge filter is the derivative of the matched filter in frequency,
+ * (H_be(f) = \\frac{H(f)}{df}. In practice, this comes down to a quarter sine wave at the point
+ * of the matched filter's rolloff (if it's a raised-cosine, the derivative of a cosine is a sine).
+ * Extend this sine by another quarter wave to make a half wave around the band-edges is equivalent
+ * in time to the sum of two sinc functions. The baseband filter fot the band edges is therefore
+ * derived from this sum of sincs. The band edge filters are then just the baseband signal
+ * modulated to the correct place in frequency. All of these calculations are done in the
+ * 'design_filter' function.
+ *
+ * Note: We use FIR filters here because the filters have to have a flat phase response over the
+ * entire frequency range to allow their comparisons to be valid.
+ */
+
+class gr_fll_band_edge_cc : public gr_sync_block
+{
+ private:
+ /*!
+ * Build the FLL
+ * \param samps_per_sym (float) Number of samples per symbol of signal
+ * \param rolloff (float) Rolloff factor of signal
+ * \param filter_size (int) Size (in taps) of the filter
+ * \param alpha (float) Loop gain 1
+ * \param beta (float) Loop gain 2
+ */
+ friend gr_fll_band_edge_cc_sptr gr_make_fll_band_edge_cc (float samps_per_sym, float rolloff,
+ int filter_size, float alpha, float beta);
+
+ float d_alpha;
+ float d_beta;
+ float d_max_freq;
+ float d_min_freq;
+
+ gr_fir_ccc* d_filter_upper;
+ gr_fir_ccc* d_filter_lower;
+ bool d_updated;
+ float d_error;
+ float d_freq;
+ float d_phase;
+
+ /*!
+ * Build the FLL
+ * \param samps_per_sym (float) number of samples per symbol
+ * \param rolloff (float) Rolloff (excess bandwidth) of signal filter
+ * \param filter_size (int) number of filter taps to generate
+ * \param alpha (float) Alpha gain in the control loop
+ * \param beta (float) Beta gain in the control loop
+ */
+ gr_fll_band_edge_cc(float samps_per_sym, float rolloff,
+ int filter_size, float alpha, float beta);
+
+public:
+ ~gr_fll_band_edge_cc ();
+
+ /*!
+ * Design the band-edge filter based on the number of samples per symbol,
+ * filter rolloff factor, and the filter size
+ * \param samps_per_sym (float) Number of samples per symbol of signal
+ * \param rolloff (float) Rolloff factor of signal
+ * \param filter_size (int) Size (in taps) of the filter
+ */
+ void design_filter(float samps_per_sym, float rolloff, int filter_size);
+
+ /*!
+ * Set the alpha gainvalue
+ * \param alpha (float) new gain value
+ */
+ void set_alpha(float alpha);
+
+ /*!
+ * Set the beta gain value
+ * \param beta (float) new gain value
+ */
+ void set_beta(float beta) { d_beta = beta; }
+
+ /*!
+ * Print the taps to screen.
+ */
+ void print_taps();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.i b/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.i
new file mode 100644
index 000000000..c9c792c8a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.i
@@ -0,0 +1,41 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,fll_band_edge_cc);
+
+gr_fll_band_edge_cc_sptr gr_make_fll_band_edge_cc (float samps_per_sym, float rolloff,
+ int filter_size, float alpha, float beta);
+
+class gr_fll_band_edge_cc : public gr_sync_block
+{
+ private:
+ gr_fll_band_edge_cc (float samps_per_sym, float rolloff,
+ int filter_size, float alpha, float beta);
+
+ public:
+ ~gr_fll_band_edge_cc ();
+
+ void set_alpha (float alpha);
+ void set_beta (float beta);
+ void design_filter(float samps_per_sym, float rolloff, int filter_size);
+ void print_taps();
+};
diff --git a/gnuradio-core/src/lib/general/gr_head.cc b/gnuradio-core/src/lib/general/gr_head.cc
index 01035ffcd..b52735c06 100644
--- a/gnuradio-core/src/lib/general/gr_head.cc
+++ b/gnuradio-core/src/lib/general/gr_head.cc
@@ -27,7 +27,7 @@
#include <gr_io_signature.h>
#include <string.h>
-gr_head::gr_head (size_t sizeof_stream_item, int nitems)
+gr_head::gr_head (size_t sizeof_stream_item, unsigned long long nitems)
: gr_sync_block ("head",
gr_make_io_signature (1, 1, sizeof_stream_item),
gr_make_io_signature (1, 1, sizeof_stream_item)),
@@ -36,7 +36,7 @@ gr_head::gr_head (size_t sizeof_stream_item, int nitems)
}
gr_head_sptr
-gr_make_head (size_t sizeof_stream_item, int nitems)
+gr_make_head (size_t sizeof_stream_item, unsigned long long nitems)
{
return gnuradio::get_initial_sptr(new gr_head (sizeof_stream_item, nitems));
}
@@ -49,7 +49,7 @@ gr_head::work (int noutput_items,
if (d_ncopied_items >= d_nitems)
return -1; // Done!
- unsigned n = std::min (d_nitems - d_ncopied_items, noutput_items);
+ unsigned n = std::min (d_nitems - d_ncopied_items, (unsigned long long) noutput_items);
if (n == 0)
return 0;
diff --git a/gnuradio-core/src/lib/general/gr_head.h b/gnuradio-core/src/lib/general/gr_head.h
index 430d5f8b9..f7eee1064 100644
--- a/gnuradio-core/src/lib/general/gr_head.h
+++ b/gnuradio-core/src/lib/general/gr_head.h
@@ -38,11 +38,11 @@ typedef boost::shared_ptr<gr_head> gr_head_sptr;
class gr_head : public gr_sync_block
{
- friend gr_head_sptr gr_make_head (size_t sizeof_stream_item, int nitems);
- gr_head (size_t sizeof_stream_item, int nitems);
+ friend gr_head_sptr gr_make_head (size_t sizeof_stream_item, unsigned long long nitems);
+ gr_head (size_t sizeof_stream_item, unsigned long long nitems);
- int d_nitems;
- int d_ncopied_items;
+ unsigned long long d_nitems;
+ unsigned long long d_ncopied_items;
public:
int work (int noutput_items,
@@ -53,7 +53,7 @@ class gr_head : public gr_sync_block
};
gr_head_sptr
-gr_make_head (size_t sizeof_stream_item, int nitems);
+gr_make_head (size_t sizeof_stream_item, unsigned long long nitems);
#endif /* INCLUDED_GR_HEAD_H */
diff --git a/gnuradio-core/src/lib/general/gr_head.i b/gnuradio-core/src/lib/general/gr_head.i
index 2a88b885f..3aece9601 100644
--- a/gnuradio-core/src/lib/general/gr_head.i
+++ b/gnuradio-core/src/lib/general/gr_head.i
@@ -22,7 +22,7 @@
GR_SWIG_BLOCK_MAGIC(gr,head);
-gr_head_sptr gr_make_head(size_t sizeof_stream_item, int nitems);
+gr_head_sptr gr_make_head(size_t sizeof_stream_item, unsigned long long nitems);
class gr_head : public gr_block {
gr_head();
diff --git a/gnuradio-core/src/lib/general/gr_ofdm_sampler.cc b/gnuradio-core/src/lib/general/gr_ofdm_sampler.cc
index 74bd65a50..7f6b2b01c 100644
--- a/gnuradio-core/src/lib/general/gr_ofdm_sampler.cc
+++ b/gnuradio-core/src/lib/general/gr_ofdm_sampler.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007,2008 Free Software Foundation, Inc.
+ * Copyright 2007,2008,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -45,6 +45,7 @@ gr_ofdm_sampler::gr_ofdm_sampler (unsigned int fft_length,
gr_make_io_signature2 (2, 2, sizeof (gr_complex)*fft_length, sizeof(char)*fft_length)),
d_state(STATE_NO_SIG), d_timeout_max(timeout), d_fft_length(fft_length), d_symbol_length(symbol_length)
{
+ set_relative_rate(1.0/(double) fft_length); // buffer allocator hint
}
void
diff --git a/gnuradio-core/src/lib/general/gri_lfsr.h b/gnuradio-core/src/lib/general/gri_lfsr.h
index 715da78a9..f691e36ec 100644
--- a/gnuradio-core/src/lib/general/gri_lfsr.h
+++ b/gnuradio-core/src/lib/general/gri_lfsr.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008 Free Software Foundation, Inc.
+ * Copyright 2008,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -86,6 +86,7 @@ class gri_lfsr
private:
uint32_t d_shift_register;
uint32_t d_mask;
+ uint32_t d_seed;
uint32_t d_shift_register_length; // less than 32
static uint32_t
@@ -99,7 +100,10 @@ class gri_lfsr
public:
gri_lfsr(uint32_t mask, uint32_t seed, uint32_t reg_len)
- : d_shift_register(seed), d_mask(mask), d_shift_register_length(reg_len)
+ : d_shift_register(seed),
+ d_mask(mask),
+ d_seed(seed),
+ d_shift_register_length(reg_len)
{
if (reg_len > 31)
throw std::invalid_argument("reg_len must be <= 31");
@@ -126,6 +130,10 @@ class gri_lfsr
return output;
}
+ /*!
+ * Reset shift register to initial seed value
+ */
+ void reset() { d_shift_register = d_seed; }
/*!
* Rotate the register through x number of bits