commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r4873 - in gnuradio/branches/developers/n4hy/ofdm: con


From: n4hy
Subject: [Commit-gnuradio] r4873 - in gnuradio/branches/developers/n4hy/ofdm: config gnuradio-core/src/lib/general gnuradio-core/src/python/gnuradio/gr gnuradio-examples/python/hier gnuradio-examples/python/hier/dect gnuradio-examples/python/hier/sounder usrp/fpga/rbf/rev2 usrp/fpga/rbf/rev4
Date: Wed, 4 Apr 2007 08:08:39 -0600 (MDT)

Author: n4hy
Date: 2007-04-04 08:08:38 -0600 (Wed, 04 Apr 2007)
New Revision: 4873

Added:
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_f.cc
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_f.h
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_f.i
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_pn_correlator_cc.cc
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_pn_correlator_cc.h
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_pn_correlator_cc.i
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py
   gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/Makefile.am
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/README
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/dect_receiver.py
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/gmsk2.py
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/usrp_dect.py
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/usrp_source.py
Removed:
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source_b.py
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/Makefile.am
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/README
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/dect_receiver.py
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/gmsk2.py
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/usrp_dect.py
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/usrp_source.py
Modified:
   gnuradio/branches/developers/n4hy/ofdm/config/grc_gnuradio_examples.m4
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/Makefile.am
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/general.i
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/python/gnuradio/gr/Makefile.am
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/Makefile.am
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/sounder_rx.py
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/sounder_tx.py
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sounder_rx.py
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sounder_tx.py
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_source.py
   gnuradio/branches/developers/n4hy/ofdm/usrp/fpga/rbf/rev2/std_2rxhb_2tx.rbf
   gnuradio/branches/developers/n4hy/ofdm/usrp/fpga/rbf/rev2/std_4rx_0tx.rbf
   gnuradio/branches/developers/n4hy/ofdm/usrp/fpga/rbf/rev4/std_2rxhb_2tx.rbf
   gnuradio/branches/developers/n4hy/ofdm/usrp/fpga/rbf/rev4/std_4rx_0tx.rbf
Log:
merge -r 4847:4872 from trunk

Modified: gnuradio/branches/developers/n4hy/ofdm/config/grc_gnuradio_examples.m4
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/config/grc_gnuradio_examples.m4      
2007-04-04 03:21:05 UTC (rev 4872)
+++ gnuradio/branches/developers/n4hy/ofdm/config/grc_gnuradio_examples.m4      
2007-04-04 14:08:38 UTC (rev 4873)
@@ -35,6 +35,7 @@
        gnuradio-examples/python/hier/audio/Makefile \
        gnuradio-examples/python/hier/networking/Makefile \
        gnuradio-examples/python/hier/digital/Makefile \
+       gnuradio-examples/python/hier/dect/Makefile \
        gnuradio-examples/python/hier/ofdm/Makefile \
        gnuradio-examples/python/hier/sounder/Makefile \
        gnuradio-examples/python/hier/usrp/Makefile \

Modified: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/Makefile.am
    2007-04-04 03:21:05 UTC (rev 4872)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/Makefile.am
    2007-04-04 14:08:38 UTC (rev 4873)
@@ -79,6 +79,7 @@
        gr_fxpt.cc                      \
        gr_framer_sink_1.cc             \
        gr_glfsr_source_b.cc            \
+       gr_glfsr_source_f.cc            \
        gr_head.cc                      \
        gr_interleave.cc                \
        gr_interleaved_short_to_complex.cc \
@@ -108,6 +109,7 @@
        gr_pll_carriertracking_cc.cc    \
        gr_pll_freqdet_cf.cc            \
        gr_pll_refout_cc.cc             \
+       gr_pn_correlator_cc.cc          \
        gr_prefix.cc                    \
        gr_prefs.cc                     \
        gr_probe_avg_mag_sqrd_c.cc      \
@@ -211,6 +213,7 @@
        gr_fxpt_nco.h                   \
        gr_fxpt_vco.h                   \
        gr_glfsr_source_b.h             \
+       gr_glfsr_source_f.h             \
        gr_head.h                       \
        gr_interleave.h                 \
        gr_interleaved_short_to_complex.h \
@@ -242,6 +245,7 @@
        gr_pll_carriertracking_cc.h     \
        gr_pll_freqdet_cf.h             \
        gr_pll_refout_cc.h              \
+       gr_pn_correlator_cc.h           \
        gr_prefix.h                     \
        gr_prefs.h                      \
        gr_probe_avg_mag_sqrd_c.h       \
@@ -350,6 +354,7 @@
        gr_frequency_modulator_fc.i     \
        gr_framer_sink_1.i              \
        gr_glfsr_source_b.i             \
+       gr_glfsr_source_f.i             \
        gr_head.i                       \
        gr_interleave.i                 \
        gr_interleaved_short_to_complex.i \
@@ -377,6 +382,7 @@
        gr_pll_carriertracking_cc.i     \
        gr_pll_freqdet_cf.i             \
        gr_pll_refout_cc.i              \
+       gr_pn_correlator_cc.i           \
        gr_prefix.i                     \
        gr_prefs.i                      \
        gr_probe_avg_mag_sqrd_c.i       \

Modified: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/general.i
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/general.i  
    2007-04-04 03:21:05 UTC (rev 4872)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/general.i  
    2007-04-04 14:08:38 UTC (rev 4873)
@@ -87,6 +87,7 @@
 #include <gr_pll_freqdet_cf.h>
 #include <gr_pll_refout_cc.h>
 #include <gr_pll_carriertracking_cc.h>
+#include <gr_pn_correlator_cc.h>
 #include <gr_probe_avg_mag_sqrd_c.h>
 #include <gr_probe_avg_mag_sqrd_f.h>
 #include <gr_probe_signal_f.h>
@@ -118,6 +119,7 @@
 #include <gr_feedforward_agc_cc.h>
 #include <gr_bin_statistics_f.h>
 #include <gr_glfsr_source_b.h>
+#include <gr_glfsr_source_f.h>
 %}
 
 %include "gr_nop.i"
@@ -185,6 +187,7 @@
 %include "gr_pll_freqdet_cf.i"
 %include "gr_pll_refout_cc.i"
 %include "gr_pll_carriertracking_cc.i"
+%include "gr_pn_correlator_cc.i"
 %include "gr_probe_avg_mag_sqrd_c.i"
 %include "gr_probe_avg_mag_sqrd_f.i"
 %include "gr_probe_signal_f.i"
@@ -216,3 +219,4 @@
 %include "gr_feedforward_agc_cc.i"
 %include "gr_bin_statistics_f.i"
 %include "gr_glfsr_source_b.i"
+%include "gr_glfsr_source_f.i"

Copied: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_f.cc
 (from rev 4872, 
gnuradio/trunk/gnuradio-core/src/lib/general/gr_glfsr_source_f.cc)
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_f.cc
                           (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_f.cc
   2007-04-04 14:08:38 UTC (rev 4873)
@@ -0,0 +1,84 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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_glfsr_source_f.h>
+#include <gri_glfsr.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+
+gr_glfsr_source_f_sptr 
+gr_make_glfsr_source_f(int degree, bool repeat, int mask, int seed)
+{
+  return gr_glfsr_source_f_sptr(new gr_glfsr_source_f(degree, repeat, mask, 
seed));
+}
+
+gr_glfsr_source_f::gr_glfsr_source_f(int degree, bool repeat, int mask, int 
seed)
+  : gr_sync_block ("glfsr_source_f",
+                  gr_make_io_signature (0, 0, 0),
+                  gr_make_io_signature (1, 1, sizeof(float))),
+    d_repeat(repeat),
+    d_index(0)
+{
+  if (degree < 1 || degree > 32)
+    throw std::runtime_error("gr_glfsr_source_f: degree must be between 1 and 
32 inclusive");
+  d_length = (unsigned int)((1ULL << degree)-1);
+
+  if (mask == 0)
+    mask = gri_glfsr::glfsr_mask(degree);
+  d_glfsr = new gri_glfsr(mask, seed);
+}
+
+gr_glfsr_source_f::~gr_glfsr_source_f()
+{
+  delete d_glfsr;
+}
+
+int
+gr_glfsr_source_f::work(int noutput_items,
+                       gr_vector_const_void_star &input_items,
+                       gr_vector_void_star &output_items)
+{
+  float *out = (float *) output_items[0];
+  if ((d_index > d_length) && d_repeat == false)
+    return -1; /* once through the sequence */
+
+  int i;
+  for (i = 0; i < noutput_items; i++) {
+    out[i] = (float)d_glfsr->next_bit()*2.0-1.0;
+    d_index++;
+    if (d_index > d_length && d_repeat == false)
+      break;
+  }
+
+  return i;
+}
+
+int
+gr_glfsr_source_f::mask() const
+{
+  return d_glfsr->mask();
+}

Copied: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_f.h
 (from rev 4872, 
gnuradio/trunk/gnuradio-core/src/lib/general/gr_glfsr_source_f.h)
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_f.h
                            (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_f.h
    2007-04-04 14:08:38 UTC (rev 4873)
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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_GLFSR_SOURCE_F_H
+#define INCLUDED_GR_GLFSR_SOURCE_F_H
+
+#include <gr_sync_block.h>
+
+class gri_glfsr;
+
+class gr_glfsr_source_f;
+typedef boost::shared_ptr<gr_glfsr_source_f> gr_glfsr_source_f_sptr;
+
+gr_glfsr_source_f_sptr gr_make_glfsr_source_f(int degree, bool repeat=true, 
int mask=0, int seed=1);
+
+/*!
+ * \brief Galois LFSR pseudo-random source generating float outputs -1.0 - 1.0
+ * \ingroup source
+ */
+class gr_glfsr_source_f : public gr_sync_block 
+{
+ private:
+  friend gr_glfsr_source_f_sptr
+  gr_make_glfsr_source_f(int degree, bool repeat, int mask, int seed);
+  
+  gri_glfsr *d_glfsr;
+
+  bool d_repeat;
+  unsigned int d_index;
+  unsigned int d_length;
+  
+  gr_glfsr_source_f(int degree, bool repeat, int mask, int seed);
+
+ public:
+
+  ~gr_glfsr_source_f();
+
+  int work(int noutput_items,
+          gr_vector_const_void_star &input_items,
+          gr_vector_void_star &output_items);
+
+  unsigned int period() const { return d_length; }
+  int mask() const;
+};
+
+#endif /* INCLUDED_GR_GLFSR_SOURCE_F_H */

Copied: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_f.i
 (from rev 4872, 
gnuradio/trunk/gnuradio-core/src/lib/general/gr_glfsr_source_f.i)
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_f.i
                            (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_f.i
    2007-04-04 14:08:38 UTC (rev 4873)
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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,glfsr_source_f);
+
+gr_glfsr_source_f_sptr 
+gr_make_glfsr_source_f(int degree, bool repeat=true, int mask=0, int seed=1)
+  throw (std::runtime_error);
+
+class gr_glfsr_source_f : public gr_sync_block 
+{
+protected:
+  gr_glfsr_source_f(int degree, bool repeat, int mask, int seed);
+
+public:
+  unsigned int period() const;
+  int mask() const;
+};

Copied: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_pn_correlator_cc.cc
 (from rev 4872, 
gnuradio/trunk/gnuradio-core/src/lib/general/gr_pn_correlator_cc.cc)
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_pn_correlator_cc.cc
                         (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_pn_correlator_cc.cc
 2007-04-04 14:08:38 UTC (rev 4873)
@@ -0,0 +1,77 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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_pn_correlator_cc.h>
+#include <gr_io_signature.h>
+
+gr_pn_correlator_cc_sptr
+gr_make_pn_correlator_cc(int degree, int mask, int seed)
+{
+  return gr_pn_correlator_cc_sptr (new gr_pn_correlator_cc(degree, mask, 
seed));
+}
+
+gr_pn_correlator_cc::gr_pn_correlator_cc(int degree, int mask, int seed)
+  : gr_sync_decimator ("pn_correlator_cc",
+                      gr_make_io_signature (1, 1, sizeof(gr_complex)),
+                      gr_make_io_signature (1, 1, sizeof(gr_complex)),
+                      (unsigned int)((1ULL << degree)-1)) // PN code length
+{
+  d_len = (unsigned int)((1ULL << degree)-1);
+  if (mask == 0)
+    mask = gri_glfsr::glfsr_mask(degree);
+  d_reference = new gri_glfsr(mask, seed);
+  for (int i = 0; i < d_len; i++)      // initialize to last value in sequence
+    d_pn = 2.0*d_reference->next_bit()-1.0;
+}
+
+gr_pn_correlator_cc::~gr_pn_correlator_cc()
+{
+  delete d_reference;
+}
+
+int
+gr_pn_correlator_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];
+  gr_complex sum;
+
+  for (int i = 0; i < noutput_items; i++) {
+    sum = 0.0;
+
+    for (int j = 0; j < d_len; j++) {
+      if (j != 0)                          // retard PN generator one sample 
per period
+       d_pn = 2.0*d_reference->next_bit()-1.0; // no conditionals
+      sum += *in++ * d_pn;
+    }
+
+    *out++ = sum*gr_complex(1.0/d_len, 0.0);
+  }
+
+  return noutput_items;
+}

Copied: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_pn_correlator_cc.h
 (from rev 4872, 
gnuradio/trunk/gnuradio-core/src/lib/general/gr_pn_correlator_cc.h)
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_pn_correlator_cc.h
                          (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_pn_correlator_cc.h
  2007-04-04 14:08:38 UTC (rev 4873)
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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_PN_CORRELATOR_CC_H
+#define INCLUDED_GR_PN_CORRELATOR_CC_H
+
+#include <gr_sync_decimator.h>
+#include <gri_glfsr.h>
+
+class gr_pn_correlator_cc;
+typedef boost::shared_ptr<gr_pn_correlator_cc> gr_pn_correlator_cc_sptr;
+
+gr_pn_correlator_cc_sptr
+gr_make_pn_correlator_cc(int degree, int mask=0, int seed=1);
+/*!
+ * \brief PN code sequential search correlator
+ *
+ * Receives complex baseband signal, outputs complex correlation against
+ * reference PN code, one sample per PN code period
+ */
+
+class gr_pn_correlator_cc : public gr_sync_decimator
+{
+  friend gr_pn_correlator_cc_sptr gr_make_pn_correlator_cc(int degree, int 
mask, int seed);
+
+  int        d_len;
+  float      d_pn;
+  gri_glfsr *d_reference;
+
+ protected:
+  gr_pn_correlator_cc(int degree, int mask, int seed);
+
+ public:
+  virtual int work(int noutput_items,
+                  gr_vector_const_void_star &input_items,
+                  gr_vector_void_star &output_items);
+
+  ~gr_pn_correlator_cc();
+};
+
+#endif /* INCLUDED_GR_PN_CORRELATOR_CC_H */

Copied: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_pn_correlator_cc.i
 (from rev 4872, 
gnuradio/trunk/gnuradio-core/src/lib/general/gr_pn_correlator_cc.i)
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_pn_correlator_cc.i
                          (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_pn_correlator_cc.i
  2007-04-04 14:08:38 UTC (rev 4873)
@@ -0,0 +1,32 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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,pn_correlator_cc)
+
+gr_pn_correlator_cc_sptr 
+gr_make_pn_correlator_cc(int degree, int mask=0, int seed=1);
+
+class gr_pn_correlator_cc : public gr_sync_decimator
+{
+ protected:
+  gr_pn_correlator_cc();
+};

Modified: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/python/gnuradio/gr/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/python/gnuradio/gr/Makefile.am
     2007-04-04 03:21:05 UTC (rev 4872)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/python/gnuradio/gr/Makefile.am
     2007-04-04 14:08:38 UTC (rev 4873)
@@ -63,6 +63,7 @@
        qa_fractional_interpolator.py   \
        qa_frequency_modulator.py       \
        qa_fsk_stuff.py                 \
+       qa_glfsr_source.py              \
        qa_goertzel.py                  \
        qa_head.py                      \
        qa_hier_block2.py               \
@@ -81,6 +82,7 @@
        qa_pll_carriertracking.py       \
        qa_pll_freqdet.py               \
        qa_pll_refout.py                \
+       qa_pn_correlator_cc.py          \
        qa_rational_resampler.py        \
        qa_sig_source.py                \
        qa_single_pole_iir.py           \

Copied: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py
 (from rev 4872, 
gnuradio/trunk/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py)
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py
                              (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py
      2007-04-04 14:08:38 UTC (rev 4873)
@@ -0,0 +1,91 @@
+#!/usr/bin/env python
+#
+# Copyright 2007 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 2, 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.
+# 
+
+from gnuradio import gr, gr_unittest
+
+class test_glfsr_source(gr_unittest.TestCase):
+
+    def setUp (self):
+        self.fg = gr.flow_graph ()
+
+    def tearDown (self):
+        self.fg = None
+
+    def test_000_make_b(self):
+        src = gr.glfsr_source_b(16)
+        self.assertEquals(src.mask(), 0x8016)
+        self.assertEquals(src.period(), 2**16-1)
+
+    def test_001_degree_b(self):
+        self.assertRaises(RuntimeError,
+                          lambda: gr.glfsr_source_b(0))
+        self.assertRaises(RuntimeError,
+                          lambda: gr.glfsr_source_b(33))
+        
+    def test_002_correlation_b(self):
+        for degree in range(1,11):                # Higher degrees take too 
long to correlate
+            src = gr.glfsr_source_b(degree, False)
+            b2f = gr.chunks_to_symbols_bf((-1.0,1.0), 1)
+            dst = gr.vector_sink_f()
+            self.fg.connect(src, b2f, dst)
+            self.fg.run()
+
+            actual_result = dst.data()
+            R = auto_correlate(actual_result)
+            self.assertEqual(R[0], float(len(R))) # Auto-correlation peak at 
origin
+            for i in range(len(R)-1):
+                self.assertEqual(R[i+1], -1.0)    # Auto-correlation minimum 
everywhere else
+
+    def test_003_make_f(self):
+        src = gr.glfsr_source_f(16)
+        self.assertEquals(src.mask(), 0x8016)
+        self.assertEquals(src.period(), 2**16-1)
+
+    def test_004_degree_f(self):
+        self.assertRaises(RuntimeError,
+                          lambda: gr.glfsr_source_f(0))
+        self.assertRaises(RuntimeError,
+                          lambda: gr.glfsr_source_f(33))
+        
+    def test_005_correlation_f(self):
+        for degree in range(1,11):                # Higher degrees take too 
long to correlate
+            src = gr.glfsr_source_f(degree, False)
+            dst = gr.vector_sink_f()
+            self.fg.connect(src, dst)
+            self.fg.run()
+
+            actual_result = dst.data()
+            R = auto_correlate(actual_result)
+            self.assertEqual(R[0], float(len(R))) # Auto-correlation peak at 
origin
+            for i in range(len(R)-1):
+                self.assertEqual(R[i+1], -1.0)    # Auto-correlation minimum 
everywhere else
+
+def auto_correlate(data):
+    l = len(data)
+    R = [0,]*l
+    for lag in range(l):
+        for i in range(l):
+            R[lag] += data[i]*data[i-lag]
+    return R
+
+if __name__ == '__main__':
+    gr_unittest.main ()

Deleted: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source_b.py

Copied: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py
 (from rev 4872, 
gnuradio/trunk/gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py)
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py
                          (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py
  2007-04-04 14:08:38 UTC (rev 4873)
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+#
+# Copyright 2007 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 2, 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.
+# 
+
+from gnuradio import gr, gr_unittest
+
+class test_pn_correlator_cc(gr_unittest.TestCase):
+
+    def setUp(self):
+        self.fg = gr.flow_graph ()
+
+    def tearDown(self):
+        self.fg = None
+
+    def test_000_make(self):
+        c = gr.pn_correlator_cc(10)
+
+    def test_001_correlate(self):
+        degree = 10
+        length = 2**degree-1
+        src = gr.glfsr_source_f(degree)
+        head = gr.head(gr.sizeof_float, length*length)
+        f2c = gr.float_to_complex()
+        corr = gr.pn_correlator_cc(degree)
+        dst = gr.vector_sink_c()
+        self.fg.connect(src, head, f2c, corr, dst)
+        self.fg.run()
+        data = dst.data()
+        self.assertEqual(data[-1], (1.0+0j))
+        
+if __name__ == '__main__':
+    gr_unittest.main ()

Modified: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/Makefile.am
    2007-04-04 03:21:05 UTC (rev 4872)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/Makefile.am
    2007-04-04 14:08:38 UTC (rev 4873)
@@ -21,6 +21,7 @@
 
 SUBDIRS = \
     audio \
+    dect \
     digital \
     ofdm \
     networking \

Copied: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect (from 
rev 4872, gnuradio/trunk/gnuradio-examples/python/hier/dect)


Property changes on: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect
___________________________________________________________________
Name: svn:ignore
   + Makefile.in
Makefile
*.pyc


Deleted: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/Makefile.am

Copied: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/Makefile.am
 (from rev 4872, gnuradio/trunk/gnuradio-examples/python/hier/dect/Makefile.am)
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/Makefile.am
                               (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/Makefile.am
       2007-04-04 14:08:38 UTC (rev 4873)
@@ -0,0 +1,28 @@
+#
+# Copyright 2007 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 2, 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.
+# 
+
+EXTRA_DIST =                   \
+       README                  \
+       dect_receiver.py        \
+       usrp_source.py          \
+       usrp_dect.py
+
+MOSTLYCLEANFILES = *.pyc *~

Deleted: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/README

Copied: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/README
 (from rev 4872, gnuradio/trunk/gnuradio-examples/python/hier/dect/README)
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/README
                            (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/README
    2007-04-04 14:08:38 UTC (rev 4873)
@@ -0,0 +1,45 @@
+This directory contains a work in progress service monitor for DECT
+digital cordless phone base stations and handsets.
+
+
+Status
+------
+
+2007 Apr 03 - Development on hold.
+2007 Feb 11 - Added GMSK demodulation and option to log to file
+2007 Feb 10 - Able to tune and log filtered baseband to file
+
+
+Files
+-----
+
+usrp_dect.py     - DECT receiver application
+
+dect_receiver.py - Top-level hierarchical block (new type) implementing 
+                   receiver
+
+usrp_source.py   - Hierarchical block (new type) implementing a USRP 
+                   complex source, with convenience functions for tuning, 
+                   gain, decimation, etc.
+
+gmsk2.py         - Hierarchical block (new type) implementing GMSK
+                   modulation and demodulation.  This will eventually go
+                   into the core blksimpl directory
+
+DECT Modulation Details
+-----------------------
+
+In the US, the FCC has allocated four carrier frequencies for DECT usage:
+
+Channel                Frequency
+-------                ---------
+   1           1921.536 MHz
+   2           1923.264 MHz
+   3           1924.992 MHz
+   4           1926.720 MHz
+
+These are spaced at 1.728 MHz intervals.
+
+The DECT PHY uses GMSK with a 0.5 bandwidth-time product at 1.152 Msym/sec,
+for an occupied bandwidth (99% power) of 1.186 MHz (1.03 x symbol rate.)
+

Deleted: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/dect_receiver.py

Copied: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/dect_receiver.py
 (from rev 4872, 
gnuradio/trunk/gnuradio-examples/python/hier/dect/dect_receiver.py)
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/dect_receiver.py
                          (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/dect_receiver.py
  2007-04-04 14:08:38 UTC (rev 4873)
@@ -0,0 +1,91 @@
+#!/usr/bin/env python
+#
+# Copyright 2007 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 2, 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.
+# 
+
+from gnuradio import gr, optfir
+from usrp_source import usrp_source_c
+from gmsk2 import gmsk2_demod
+
+_dect_symbol_rate = 1.152e6
+_dect_occupied_bandwidth = _dect_symbol_rate * 1.03 # BT=0.5
+_dect_channel_bandwidth = 1.728e6
+
+# Top-level hierarchical block that implements DECT demodulation and
+# decoding.
+class dect_receiver(gr.hier_block2):
+    def __init__(self, options):
+       gr.hier_block2.__init__(self, 
+                                "dect_receiver",        # Block typename
+                               gr.io_signature(0,0,0), # Input signature
+                               gr.io_signature(0,0,0)) # Output signature
+        self._options = options
+
+        # Need greater than 2 samples per symbol. This makes a decimation
+        # rate of 26 and a samples per symbol of 2.136752
+        if_rate = 2.461538e6
+        self._usrp = usrp_source_c(self,
+                                   which=0,
+                                   subdev_spec=options.rx_subdev_spec,
+                                   if_rate=if_rate,
+                                   gain=options.gain,
+                                   freq=options.freq,
+                                   calibration=options.calibration,
+                                   verbose=options.verbose)
+
+        # Filter baseband to 1.186 MHz passband, 1.728 MHz stopband
+        chan_taps = optfir.low_pass(1.0,              # Gain
+                                    if_rate,          # Sample rate
+                                    _dect_occupied_bandwidth/2, # One sided 
modulation bandwidth
+                                    _dect_channel_bandwidth/2,  # One sided 
channel bandwidth
+                                    1.0,              # Passband ripple (db)
+                                    60)               # Stopband attenuation 
(db)
+        if self._options.verbose:
+            print "Channel filter has", len(chan_taps), "taps"
+        self._channel_filter = gr.freq_xlating_fir_filter_ccf(1,         # 
Decimation rate
+                                                              chan_taps, # 
Filter taps
+                                                              0.0,       # 
Offset frequency
+                                                              if_rate)   # 
Sample rate
+
+        self._demod = gmsk2_demod(samples_per_symbol=if_rate/_dect_symbol_rate,
+                                  verbose=options.verbose)
+
+        # Define and connect components
+        self.define_component("usrp", self._usrp)
+        self.define_component("channel", self._channel_filter)
+        self.define_component("demod", self._demod)
+        self.define_component("sink", gr.null_sink(gr.sizeof_char))
+        self.connect("usrp", 0, "channel", 0)
+        self.connect("channel", 0, "demod", 0)
+        self.connect("demod", 0, "sink", 0)
+
+        # Log baseband to file if requested
+        if options.log_baseband is not None:
+            if options.verbose:
+                print "Logging baseband to file", options.log_baseband
+            self.define_component("baseband_log", 
gr.file_sink(gr.sizeof_gr_complex, options.log_baseband))
+            self.connect("channel", 0, "baseband_log", 0)
+
+        # Log demodulator output to file if requested
+        if options.log_demod is not None:
+            if options.verbose:
+                print "Logging demodulator to file", options.log_demod
+            self.define_component("demod_log", gr.file_sink(gr.sizeof_char, 
options.log_demod))
+            self.connect("demod", 0, "demod_log", 0)

Deleted: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/gmsk2.py

Copied: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/gmsk2.py
 (from rev 4872, gnuradio/trunk/gnuradio-examples/python/hier/dect/gmsk2.py)
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/gmsk2.py
                          (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/gmsk2.py
  2007-04-04 14:08:38 UTC (rev 4873)
@@ -0,0 +1,300 @@
+#
+# GMSK modulation and demodulation.  
+#
+#
+# Copyright 2005,2006,2007 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 2, 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.
+# 
+
+# See gnuradio-examples/python/digital for examples
+
+from gnuradio import gr
+from gnuradio import modulation_utils
+from math import pi
+import Numeric
+from pprint import pprint
+import inspect
+
+# default values (used in __init__ and add_options)
+_def_samples_per_symbol = 2
+_def_bt = 0.35
+_def_verbose = False
+_def_log = False
+
+_def_gain_mu = 0.05
+_def_mu = 0.5
+_def_freq_error = 0.0
+_def_omega_relative_limit = 0.005
+
+
+# /////////////////////////////////////////////////////////////////////////////
+#                              GMSK modulator
+# /////////////////////////////////////////////////////////////////////////////
+
+class gmsk2_mod(gr.hier_block2):
+
+    def __init__(self,
+                 samples_per_symbol=_def_samples_per_symbol,
+                 bt=_def_bt,
+                 verbose=_def_verbose,
+                 log=_def_log):
+        """
+       Hierarchical block for Gaussian Minimum Shift Key (GMSK)
+       modulation.
+
+       The input is a byte stream (unsigned char) and the
+       output is the complex modulated signal at baseband.
+
+       @param samples_per_symbol: samples per baud >= 2
+       @type samples_per_symbol: integer
+       @param bt: Gaussian filter bandwidth * symbol time
+       @type bt: float
+        @param verbose: Print information about modulator?
+        @type verbose: bool
+        @param debug: Print modualtion data to files?
+        @type debug: bool       
+       """
+        gr.hier_block2.__init__(self,
+                                "gmsk2_mod",                               # 
Block typename
+                                gr.io_signature(1,1,gr.sizeof_char),       # 
Input signature
+                                gr.io_signature(1,1,gr.sizeof_gr_complex)) # 
Output signature
+
+        self._samples_per_symbol = samples_per_symbol
+        self._bt = bt
+
+        if not isinstance(samples_per_symbol, int) or samples_per_symbol < 2:
+            raise TypeError, ("samples_per_symbol must be an integer >= 2, is 
%r" % (samples_per_symbol,))
+
+       ntaps = 4 * samples_per_symbol                  # up to 3 bits in 
filter at once
+       sensitivity = (pi / 2) / samples_per_symbol     # phase change per bit 
= pi / 2
+
+       # Turn it into NRZ data.
+       self.nrz = gr.bytes_to_syms()
+
+       # Form Gaussian filter
+        # Generate Gaussian response (Needs to be convolved with window below).
+       self.gaussian_taps = gr.firdes.gaussian(
+               1,                     # gain
+               samples_per_symbol,    # symbol_rate
+               bt,                    # bandwidth * symbol time
+               ntaps                  # number of taps
+               )
+
+       self.sqwave = (1,) * samples_per_symbol       # rectangular window
+       self.taps = 
Numeric.convolve(Numeric.array(self.gaussian_taps),Numeric.array(self.sqwave))
+       self.gaussian_filter = gr.interp_fir_filter_fff(samples_per_symbol, 
self.taps)
+
+       # FM modulation
+       self.fmmod = gr.frequency_modulator_fc(sensitivity)
+               
+        if verbose:
+            self._print_verbage()
+         
+       # Define and connect components
+        self.define_component("nrz", self.nrz)
+        self.define_component("filter", self.gaussian_filter)
+        self.define_component("fmmod", self.fmmod)
+        self.connect("self", 0, "nrz", 0)
+        self.connect("nrz", 0, "filter", 0)
+        self.connect("filter", 0, "fmmod", 0)
+        self.connect("fmmod", 0, "self", 0)
+
+        if log:
+            self._setup_logging()
+
+    def samples_per_symbol(self):
+        return self._samples_per_symbol
+
+    def bits_per_symbol(self=None):     # staticmethod that's also callable on 
an instance
+        return 1
+    bits_per_symbol = staticmethod(bits_per_symbol)      # make it a static 
method.
+
+
+    def _print_verbage(self):
+        print "bits per symbol = %d" % self.bits_per_symbol()
+        print "Gaussian filter bt = %.2f" % self._bt
+
+
+    def _setup_logging(self):
+        print "Modulation logging turned on."
+        self.define_component("nrz_log", gr.file_sink(gr.sizeof_float, 
"nrz.dat"))
+        self.define_component("filter_log", gr.file_sink(gr.sizeof_float, 
"gaussian_filter.dat"))
+        self.define_component("fmmod_log", gr.file_sink(gr.sizeof_gr_complex, 
"fmmod.dat"))
+        self.connect("nrz", 0, "nrz_log", 0)
+        self.connect("filter", 0, "filter_log", 0)
+        self.connect("fmmod", 0, "fmmod_log", 0)
+
+    def add_options(parser):
+        """
+        Adds GMSK modulation-specific options to the standard parser
+        """
+        parser.add_option("", "--bt", type="float", default=_def_bt,
+                          help="set bandwidth-time product [default=%default] 
(GMSK)")
+    add_options=staticmethod(add_options)
+
+    # FIXME: figure out what has to change for gr.hier_block2 version
+    #def extract_kwargs_from_options(options):
+    #    """
+    #    Given command line options, create dictionary suitable for passing to 
__init__
+    #    """
+    #    return modulation_utils.extract_kwargs_from_options(gmsk_mod.__init__,
+    #                                                        ('self', 'fg'), 
options)
+    #extract_kwargs_from_options=staticmethod(extract_kwargs_from_options)
+
+
+# /////////////////////////////////////////////////////////////////////////////
+#                            GMSK demodulator
+# /////////////////////////////////////////////////////////////////////////////
+
+class gmsk2_demod(gr.hier_block2):
+
+    def __init__(self,
+                 samples_per_symbol=_def_samples_per_symbol,
+                 gain_mu=_def_gain_mu,
+                 mu=_def_mu,
+                 omega_relative_limit=_def_omega_relative_limit,
+                 freq_error=_def_freq_error,
+                 verbose=_def_verbose,
+                 log=_def_log):
+        """
+       Hierarchical block for Gaussian Minimum Shift Key (GMSK)
+       demodulation.
+
+       The input is the complex modulated signal at baseband.
+       The output is a stream of bits packed 1 bit per byte (the LSB)
+
+       @param samples_per_symbol: samples per baud
+       @type samples_per_symbol: integer
+        @param verbose: Print information about modulator?
+        @type verbose: bool
+        @param log: Print modualtion data to files?
+        @type log: bool 
+
+        Clock recovery parameters.  These all have reasonble defaults.
+        
+        @param gain_mu: controls rate of mu adjustment
+        @type gain_mu: float
+        @param mu: fractional delay [0.0, 1.0]
+        @type mu: float
+        @param omega_relative_limit: sets max variation in omega
+        @type omega_relative_limit: float, typically 0.000200 (200 ppm)
+        @param freq_error: bit rate error as a fraction
+        @param float
+       """
+
+        gr.hier_block2.__init__(self,
+                                "gmsk2_demod",                             # 
Block typename
+                                gr.io_signature(1,1,gr.sizeof_gr_complex), # 
Input signature
+                                gr.io_signature(1,1,gr.sizeof_char))       # 
Output signature
+                                
+        self._samples_per_symbol = samples_per_symbol
+        self._gain_mu = gain_mu
+        self._mu = mu
+        self._omega_relative_limit = omega_relative_limit
+        self._freq_error = freq_error
+        
+        if samples_per_symbol < 2:
+            raise TypeError, "samples_per_symbol >= 2, is %f" % 
samples_per_symbol
+
+        self._omega = samples_per_symbol*(1+self._freq_error)
+
+       self._gain_omega = .25 * self._gain_mu * self._gain_mu        # 
critically damped
+
+       # Demodulate FM
+       sensitivity = (pi / 2) / samples_per_symbol
+       self.fmdemod = gr.quadrature_demod_cf(1.0 / sensitivity)
+
+       # the clock recovery block tracks the symbol clock and resamples as 
needed.
+       # the output of the block is a stream of soft symbols (float)
+       self.clock_recovery = gr.clock_recovery_mm_ff(self._omega, 
self._gain_omega,
+                                                      self._mu, self._gain_mu,
+                                                      
self._omega_relative_limit)
+
+        # slice the floats at 0, outputting 1 bit (the LSB of the output byte) 
per sample
+        self.slicer = gr.binary_slicer_fb()
+
+        if verbose:
+            self._print_verbage()
+
+        # Define and connect components
+        self.define_component("fmdemod", self.fmdemod)
+        self.define_component("clock_recovery", self.clock_recovery)
+        self.define_component("slicer", self.slicer)
+        self.connect("self", 0, "fmdemod", 0)
+        self.connect("fmdemod", 0, "clock_recovery", 0)
+        self.connect("clock_recovery", 0, "slicer", 0)
+        self.connect("slicer", 0, "self", 0)
+
+        if log:
+            self._setup_logging()
+
+    def samples_per_symbol(self):
+        return self._samples_per_symbol
+
+    def bits_per_symbol(self=None):   # staticmethod that's also callable on 
an instance
+        return 1
+    bits_per_symbol = staticmethod(bits_per_symbol)      # make it a static 
method.
+
+
+    def _print_verbage(self):
+        print "bits per symbol = %d" % self.bits_per_symbol()
+        print "M&M clock recovery omega = %f" % self._omega
+        print "M&M clock recovery gain mu = %f" % self._gain_mu
+        print "M&M clock recovery mu = %f" % self._mu
+        print "M&M clock recovery omega rel. limit = %f" % 
self._omega_relative_limit
+        print "frequency error = %f" % self._freq_error
+
+
+    def _setup_logging(self):
+        print "Demodulation logging turned on."
+        self.define_component("fmdemod_log", gr.file_sink(gr.sizeof_float, 
"fmdemod.dat"))
+        self.define_component("clock_recovery_log", 
gr.file_sink(gr.sizeof_float, "clock_recovery.dat"))
+        self.define_component("slicer_log", gr.file_sink(gr.sizeof_char, 
"slicer.dat"))
+        self.connect("fmdemod", 0, "fmdemod_log", 0)
+        self.connect("clock_recovery", 0, "clock_recovery_log", 0)
+        self.connect("slicer", 0, "slicer_log", 0)
+
+    def add_options(parser):
+        """
+        Adds GMSK demodulation-specific options to the standard parser
+        """
+        parser.add_option("", "--gain-mu", type="float", default=_def_gain_mu,
+                          help="M&M clock recovery gain mu [default=%default] 
(GMSK/PSK)")
+        parser.add_option("", "--mu", type="float", default=_def_mu,
+                          help="M&M clock recovery mu [default=%default] 
(GMSK/PSK)")
+        parser.add_option("", "--omega-relative-limit", type="float", 
default=_def_omega_relative_limit,
+                          help="M&M clock recovery omega relative limit 
[default=%default] (GMSK/PSK)")
+        parser.add_option("", "--freq-error", type="float", 
default=_def_freq_error,
+                          help="M&M clock recovery frequency error 
[default=%default] (GMSK)")
+    add_options=staticmethod(add_options)
+
+    # FIXME: figure out what this is for gr.hier_block2 version
+    #def extract_kwargs_from_options(options):
+    #    """
+    #    Given command line options, create dictionary suitable for passing to 
__init__
+    #    """
+    #    return 
modulation_utils.extract_kwargs_from_options(gmsk_demod.__init__,
+    #                                                        ('self', 'fg'), 
options)
+    #extract_kwargs_from_options=staticmethod(extract_kwargs_from_options)
+
+#
+# Add these to the mod/demod registry
+#
+modulation_utils.add_type_1_mod('gmsk2', gmsk2_mod)
+modulation_utils.add_type_1_demod('gmsk2', gmsk2_demod)

Deleted: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/usrp_dect.py

Copied: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/usrp_dect.py
 (from rev 4872, gnuradio/trunk/gnuradio-examples/python/hier/dect/usrp_dect.py)
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/usrp_dect.py
                              (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/usrp_dect.py
      2007-04-04 14:08:38 UTC (rev 4873)
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+#
+# Copyright 2007 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 2, 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.
+# 
+
+from gnuradio import gr, eng_notation
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+from dect_receiver import dect_receiver
+import sys
+
+def main():
+       parser = OptionParser(option_class=eng_option)
+        parser.add_option("-R", "--rx-subdev-spec", type="subdev", 
default=None,
+                          help="select USRP Rx side A or B (default=first one 
with a daughterboard)")
+        parser.add_option("-f", "--freq", type="eng_float", default=None,
+                          help="set frequency to FREQ", metavar="FREQ")
+        parser.add_option("", "--calibration", type="eng_float", default=0.0,
+                          help="set frequency calibration offset to FREQ")
+        parser.add_option("-g", "--gain", type="eng_float", default=None,
+                          help="set gain in dB (default is midpoint)")
+       parser.add_option("-v", "--verbose", action="store_true", default=False,
+                         help="print extra debugging info")
+        parser.add_option("", "--log-baseband", default=None,
+                          help="log filtered baseband to file")
+        parser.add_option("", "--log-demod", default=None,
+                          help="log demodulator output to file")
+        (options, args) = parser.parse_args()
+
+       if len(sys.argv) == 1 or len(args) != 0:
+            parser.print_help()
+            sys.exit(1)
+       
+       # Create an instance of a hierarchical block
+       top_block = dect_receiver(options)
+                             
+       # Create an instance of a runtime, passing it the top block
+       # to process
+       runtime = gr.runtime(top_block)
+
+       try:    
+            # Run forever
+            runtime.run()
+       except KeyboardInterrupt:
+            # Ctrl-C exits
+            pass
+
+if __name__ == '__main__':
+    main ()

Deleted: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/usrp_source.py

Copied: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/usrp_source.py
 (from rev 4872, 
gnuradio/trunk/gnuradio-examples/python/hier/dect/usrp_source.py)
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/usrp_source.py
                            (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/dect/usrp_source.py
    2007-04-04 14:08:38 UTC (rev 4873)
@@ -0,0 +1,126 @@
+#!/usr/bin/env python
+#
+# Copyright 2007 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 2, 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.
+# 
+
+from gnuradio import gr, usrp, eng_notation
+n2s = eng_notation.num_to_str
+
+# Hierarchical block implementing a USRP source for complex floats,
+# with convenience functions for gain, tune, decimation, etc.
+#
+class usrp_source_c(gr.hier_block2):
+    """
+    Create a USRP source object supplying complex floats.
+    """
+    def __init__(self, which=0, subdev_spec=None, gain=None, if_rate=None,
+                 freq=0.0, calibration=0.0, verbose=False):
+       # Call hierarchical block constructor
+       gr.hier_block2.__init__(self,
+                                "usrp_source_c",                           # 
Block typename
+                               gr.io_signature(0,0,0),                    # 
Input signature
+                               gr.io_signature(1,1,gr.sizeof_gr_complex)) # 
Output signature
+
+        self._verbose = verbose
+        self._u = usrp.source_c(which)
+        if self._verbose:
+            print 'ADC sample rate is', n2s(self._u.adc_rate()), "sps"
+        self.set_subdev(subdev_spec)
+        self.set_if_rate(if_rate)
+        self.set_gain(gain)
+        self.set_calibration(calibration)
+        self.tune(freq)
+
+        self.define_component("usrp", self._u)
+        self.connect("usrp", 0, "self", 0)
+
+    def set_subdev(self, subdev_spec):
+        if subdev_spec is None:
+            subdev_spec = self.pick_subdevice()
+        self._subdev = usrp.selected_subdev(self._u, subdev_spec)
+        self._u.set_mux(usrp.determine_rx_mux_value(self._u, subdev_spec))
+        if self._verbose:
+            print 'RX using', self._subdev.name(), 'daughterboard'
+            
+    def pick_subdevice(self):
+        """
+        The user didn't specify a subdevice.
+        If there's a daughterboard on A, select A.
+        If there's a daughterboard on B, select B.
+        Otherwise, select A.
+        """
+        if self._u.db[0][0].dbid() >= 0:       # dbid is < 0 if there's no 
d'board or a problem
+            return (0, 0)
+        if self._u.db[1][0].dbid() >= 0:
+            return (1, 0)
+        return (0, 0)
+
+    def set_if_rate(self, if_rate):
+        # If no IF rate specified, set to maximum decimation
+        if if_rate is None:
+            self._decim = 256
+        else:
+            self._decim = int(self._u.adc_rate()/if_rate)
+
+        self._u.set_decim_rate(self._decim)
+        self._if_rate = self._u.adc_rate()/self._decim
+
+        if self._verbose:
+            print "USRP decimation rate is", self._decim
+            print "USRP IF rate is", n2s(self._if_rate), "sps"
+            
+    def set_gain(self, gain):
+       # If no gain specified, set to midrange
+       if gain is None:
+           g = self._subdev.gain_range()
+           gain = (g[0]+g[1])/2.0
+        self._gain = gain
+        self._subdev.set_gain(self._gain)
+
+    def set_calibration(self, calibration):
+        self._cal = calibration
+        if self._verbose:
+            print "Using frequency calibration offset of", n2s(calibration), 
"Hz"
+            
+    def tune(self, freq):
+        """
+        Set the center frequency we're interested in.
+
+        @param target_freq: frequency in Hz
+        @type: bool
+
+        Tuning is a two step process.  First we ask the front-end to
+        tune as close to the desired frequency as it can.  Then we use
+        the result of that operation and our target_frequency to
+        determine the value for the digital down converter.
+        """
+        self._tune_result = usrp.tune(self._u, 0, self._subdev, freq+self._cal)
+        if self._tune_result:
+            if self._verbose:
+                print "Baseband frequency is", 
n2s(self._tune_result.baseband_freq), "Hz"
+                print "DXC frequency is", n2s(self._tune_result.dxc_freq), "Hz"
+                print "Center frequency is", n2s(freq), "Hz"
+                print "Residual frequency is", 
n2s(self._tune_result.residual_freq), "Hz"
+            return True
+        
+        return False
+
+if __name__ == '__main__':
+    src = usrp_source_c(verbose=True)

Modified: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/sounder_rx.py
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/sounder_rx.py
  2007-04-04 03:21:05 UTC (rev 4872)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/sounder_rx.py
  2007-04-04 14:08:38 UTC (rev 4873)
@@ -28,51 +28,28 @@
 
 class sounder_rx(gr.hier_block2):
     """
-    Creates a top-level channel sounder block with the given parameters.
+    Creates a channel sounder receiver block with the given parameters.
     """
 
-    def __init__(self, subdev_spec, freq, cal, verbose, max_delay, chip_rate, 
gain):
+    def __init__(self, chip_rate, degree, verbose):
 
         # Call hierarchical block constructor
         # Top-level blocks have no inputs or outputs
         gr.hier_block2.__init__(self,
-                                "sounder_rx",           # Block typename
-                                gr.io_signature(0,0,0), # Input signature
-                                gr.io_signature(0,0,0)) # Output signature
-        self._freq = freq
-        self._cal = cal
+                                "sounder_rx",                                # 
Block typename
+                                gr.io_signature(1, 1, gr.sizeof_gr_complex), # 
Input signature
+                                gr.io_signature(1, 1, gr.sizeof_gr_complex)) # 
Output signature
+
+        self._degree = degree
+        self._chip_rate = chip_rate
         self._verbose = verbose
-        self._max_delay = max_delay
+        self._length = 2**self._degree-1
+        self._rep_rate = self._chip_rate/float(self._length)
 
-        self._u = usrp_source_c(0, subdev_spec, gain, chip_rate, self._freq, 
self._cal, verbose)
-        self.define_component("usrp", self._u)
-
-        self._chip_rate = self._u._if_rate
-        self._resolution = 1.0/self._chip_rate
-
-        min_chips = int(math.ceil(2.0*self._max_delay * self._chip_rate))
-        degree = int(math.ceil(math.log(min_chips)/math.log(2)))
-        self._length = 2**degree-1
-        self._seq_per_sec = self._chip_rate/self._length
-        self._tap = 0.0001
-
         if self._verbose:
-            print "Actual chip rate is", n2s(self._chip_rate), "chips/sec"
-            print "Resolution is", n2s(self._resolution), "sec"
-            print "Using specified maximum delay spread of", self._max_delay, 
"sec"
-            print "Mininum sequence length needed is", n2s(min_chips), "chips"
-            print "Using PN sequence of degree", degree, "length", self._length
-            print "Sequences per second is", self._seq_per_sec
-            print "IIR tap is", self._tap
+            print "Using PN sequence of degree", self._degree, "length", 
self._length
+            print "Sequence repetition rate is", n2s(self._rep_rate), "per sec"
         
-        self.define_component("s2v", gr.stream_to_vector(gr.sizeof_gr_complex, 
self._length))
-        self.define_component("fft", gr.fft_vcc(self._length, True, ())) # No 
window needed
-        self.define_component("avg", gr.single_pole_iir_filter_cc(self._tap, 
self._length))
-        self.define_component("keep", 
gr.keep_one_in_n(gr.sizeof_gr_complex*self._length, int(self._seq_per_sec)))
-        self.define_component("sink", 
gr.file_sink(gr.sizeof_gr_complex*self._length, "FFT.dat"))
-
-        self.connect("usrp", 0, "s2v", 0)
-        self.connect("s2v", 0, "fft", 0)
-        self.connect("fft", 0, "avg", 0)
-        self.connect("avg", 0, "keep", 0)
-        self.connect("keep", 0, "sink", 0)
+        self.define_component("corr", gr.pn_correlator_cc(self._degree))
+        self.connect("self", 0, "corr", 0)
+        self.connect("corr", 0, "self", 0)

Modified: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/sounder_tx.py
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/sounder_tx.py
  2007-04-04 03:21:05 UTC (rev 4872)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/sounder_tx.py
  2007-04-04 14:08:38 UTC (rev 4873)
@@ -21,50 +21,26 @@
 # 
 
 from gnuradio import gr, usrp, eng_notation
-from usrp_sink import usrp_sink_c
 import math
 
 n2s = eng_notation.num_to_str
 
 class sounder_tx(gr.hier_block2):
     """
-    Creates a top-level channel sounder block with the given parameters.
+    Creates a channel sounder generator with the given parameters.
     """
 
-    def __init__(self, subdev_spec, freq, cal, verbose, max_delay, chip_rate, 
amplitude):
-
-        # Call hierarchical block constructor
-        # Top-level blocks have no inputs or outputs
+    def __init__(self, degree, chip_rate, verbose):
         gr.hier_block2.__init__(self,
-                                "sounder_tx",           # Block typename
-                                gr.io_signature(0,0,0), # Input signature
-                                gr.io_signature(0,0,0)) # Output signature
-        self._freq = freq
-        self._cal = cal
-        self._verbose = verbose
-        self._max_delay = max_delay
+                                "sounder_tx",                           # 
Block typename
+                                gr.io_signature(0,0,0),                 # 
Input signature
+                                gr.io_signature(1, 1, gr.sizeof_float)) # 
Output signature
 
-        self._u = usrp_sink_c(0, subdev_spec, chip_rate, self._freq, 
self._cal, verbose)
-        self._chip_rate = self._u._if_rate
-        self._resolution = 1.0/self._chip_rate
-
-        min_chips = int(math.ceil(2.0*self._max_delay * self._chip_rate))
-        degree = int(math.ceil(math.log(min_chips)/math.log(2)))
+        self._degree = degree
+        self._chip_rate = chip_rate
+        self._verbose = verbose
         self._length = 2**degree-1
-
-        self._glfsr = gr.glfsr_source_b(degree)
-        self._mapper = gr.chunks_to_symbols_bc((-amplitude+0j, amplitude+0j), 
1)
         
-        if self._verbose:
-            print "Actual chip rate is", n2s(self._chip_rate), "chips/sec"
-            print "Resolution is", n2s(self._resolution), "sec"
-            print "Using specified maximum delay spread of", self._max_delay, 
"sec"
-            print "Mininum sequence length needed is", n2s(min_chips), "chips"
-            print "Using PN sequence of degree", degree, "length", self._length
-            print "Output amplitude is", amplitude
-            
-        self.define_component("glfsr", self._glfsr)
-        self.define_component("mapper", self._mapper)
-        self.define_component("usrp", self._u)
-        self.connect("glfsr", 0, "mapper", 0)
-        self.connect("mapper", 0, "usrp", 0)
+        # Connect PN source to block output
+        self.define_component("glfsr", gr.glfsr_source_f(degree))
+        self.connect("glfsr", 0, "self", 0)

Modified: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sounder_rx.py
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sounder_rx.py
     2007-04-04 03:21:05 UTC (rev 4872)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sounder_rx.py
     2007-04-04 14:08:38 UTC (rev 4873)
@@ -23,47 +23,85 @@
 from gnuradio import gr, eng_notation
 from gnuradio.eng_option import eng_option
 from optparse import OptionParser
+from usrp_source import usrp_source_c
 from sounder_rx import sounder_rx
 
-def main():
-       parser = OptionParser(option_class=eng_option)
+n2s = eng_notation.num_to_str
 
-       # Receive path options
-        parser.add_option("-R", "--rx-subdev-spec", type="subdev", 
default=None,
-                          help="select USRP Rx side A or B (default=first 
found)")
-        parser.add_option("-f", "--freq", type="eng_float", default=0.0,
-                          help="set center frequency (default=%default)")
-        parser.add_option("-c", "--cal", type="eng_float", default=0.0,
-                          help="set frequency calibration offset 
(default=%default)")
-       parser.add_option("-v", "--verbose", action="store_true", default=False,
-                         help="print extra debugging info")
-       parser.add_option("-d", "--max-delay", type="eng_float", default=10e-6,
-                         help="set maximum delay spread (default=%default)")
-       parser.add_option("-r", "--chip-rate", type="eng_float", default=8e6,
-                         help="set sounder chip rate (default=%default)")
-       parser.add_option("-g", "--gain", type="eng_float", default=None,
-                         help="set output amplitude (default=%default)")
-        (options, args) = parser.parse_args()
+class usrp_sounder_rx(gr.hier_block2):
+    def __init__(self, options):
+        gr.hier_block2.__init__(self, "usrp_sounder_rx",
+                                gr.io_signature(0,0,0),
+                                gr.io_signature(0,0,0))
 
-       if len(args) != 0:
-            parser.print_help()
-            sys.exit(1)
+        self._options = options
+        self._u = usrp_source_c(0,
+                                self._options.rx_subdev_spec,
+                                self._options.gain,
+                                self._options.chip_rate,
+                                self._options.freq,
+                                self._options.cal,
+                                self._options.verbose)
+        self._options.chip_rate = self._u._if_rate
+        self._length = 2**self._options.degree-1
+        self._receiver = sounder_rx(self._options.chip_rate,
+                                    self._options.degree,
+                                    self._options.verbose)
 
-       # Create an instance of a hierarchical block
-       top_block = sounder_rx(options.rx_subdev_spec, options.freq, 
options.cal,
-                              options.verbose, options.max_delay, 
options.chip_rate,
-                              options.gain)
-                             
-       # Create an instance of a runtime, passing it the top block
-       # to process
-       runtime = gr.runtime(top_block)
+        samples = 100 * self._length**2
 
-       try:    
-            # Run forever
-            runtime.run()
-       except KeyboardInterrupt:
-            # Ctrl-C exits
-            pass
+        self.define_component("usrp", self._u)
+        self.define_component("head", gr.head(gr.sizeof_gr_complex, samples))
+       self.define_component("rx",   self._receiver)
+        self.define_component("c2m",  gr.complex_to_mag())
+        self.define_component("s2v",  gr.stream_to_vector(gr.sizeof_float, 
self._length))
+        self.define_component("lpf",  
gr.single_pole_iir_filter_ff(self._options.alpha, self._length))
+        self.define_component("v2s",  gr.vector_to_stream(gr.sizeof_float, 
self._length))
+        self.define_component("sink", gr.file_sink(gr.sizeof_float, 
"impulse.dat"))
 
+        self.connect("usrp", 0, "head", 0)
+        self.connect("head", 0, "rx", 0)
+        self.connect("rx", 0, "c2m", 0)
+        self.connect("c2m", 0, "s2v", 0)
+        self.connect("s2v", 0, "lpf", 0)
+        self.connect("lpf", 0, "v2s", 0)
+        self.connect("v2s", 0, "sink", 0)
+
+       if self._options.verbose:
+            print "Chip rate is", n2s(self._options.chip_rate), "chips/sec"
+            print "Resolution is", n2s(1.0/self._options.chip_rate), "sec"
+            print "Using PN code of degree", self._options.degree
+
+def main():
+    parser = OptionParser(option_class=eng_option)
+    parser.add_option("-R", "--rx-subdev-spec", type="subdev", default=None,
+                      help="select USRP Rx side A or B (default=first found)")
+    parser.add_option("-f", "--freq", type="eng_float", default=0.0,
+                      help="set center frequency (default=%default)")
+    parser.add_option("-c", "--cal", type="eng_float", default=0.0,
+                      help="set frequency calibration offset 
(default=%default)")
+    parser.add_option("-v", "--verbose", action="store_true", default=False,
+                      help="print extra debugging info")
+    parser.add_option("-d", "--degree", type="int", default=10,
+                      help="set PN code degree (length=2**degree-1, 
default=%default)")
+    parser.add_option("-r", "--chip-rate", type="eng_float", default=8e6,
+                      help="set sounder chip rate (default=%default)")
+    parser.add_option("-g", "--gain", type="eng_float", default=None,
+                      help="set receiver gain (default=%default)")
+    parser.add_option("", "--alpha", type="eng_float", default=1.0,
+                      help="set smoothing constant (default=%default)")
+    (options, args) = parser.parse_args()
+    if len(args) != 0:
+        parser.print_help()
+        sys.exit(1)
+
+    top_block = usrp_sounder_rx(options)
+    runtime = gr.runtime(top_block)
+
+    try:
+        runtime.run()
+    except KeyboardInterrupt:
+        pass
+
 if __name__ == '__main__':
     main ()

Modified: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sounder_tx.py
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sounder_tx.py
     2007-04-04 03:21:05 UTC (rev 4872)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sounder_tx.py
     2007-04-04 14:08:38 UTC (rev 4873)
@@ -23,8 +23,49 @@
 from gnuradio import gr, eng_notation
 from gnuradio.eng_option import eng_option
 from optparse import OptionParser
+from usrp_sink import usrp_sink_c
 from sounder_tx import sounder_tx
 
+n2s = eng_notation.num_to_str
+
+class usrp_sounder_tx(gr.hier_block2):
+    def __init__(self, subdev_spec, freq, cal, verbose, degree, chip_rate, 
amplitude):
+
+        # Call hierarchical block constructor
+        # Top-level blocks have no inputs or outputs
+        gr.hier_block2.__init__(self,
+                                "usrp_sounder_tx",      # Block typename
+                                gr.io_signature(0,0,0), # Input signature
+                                gr.io_signature(0,0,0)) # Output signature
+
+        self._freq = freq
+        self._cal = cal
+        self._verbose = verbose
+        self._degree = degree
+        self._length = 2**degree-1
+       self._amplitude = amplitude
+       
+        self._u = usrp_sink_c(0, subdev_spec, chip_rate, self._freq, 
self._cal, self._verbose)
+       self.define_component("usrp", self._u)
+        self._chip_rate = self._u._if_rate
+        self._max_time = float(self._length)/self._chip_rate
+       self.define_component("pn", sounder_tx(self._degree, self._chip_rate, 
self._verbose))
+        self.define_component("gain", gr.multiply_const_ff(amplitude));
+        self.define_component("f2c", gr.float_to_complex())
+        
+        if self._verbose:
+            print "Chip rate is", n2s(self._chip_rate), "chips/sec"
+            print "Resolution is", n2s(1.0/self._chip_rate), "sec"
+            print "Using PN code of degree", self._degree, "length", 
2**self._degree-1
+            print "Maximum measurable impulse response is", 
n2s(self._max_time), "sec"
+            print "Output amplitude is", amplitude
+
+       # Ultimately this will be
+       # self.connect("pn gain f2c usrp")
+       self.connect("pn", 0, "gain", 0)
+        self.connect("gain", 0, "f2c", 0)
+        self.connect("f2c", 0, "usrp", 0)
+                              
 def main():
        parser = OptionParser(option_class=eng_option)
 
@@ -37,22 +78,35 @@
                           help="set frequency calibration offset 
(default=%default)")
        parser.add_option("-v", "--verbose", action="store_true", default=False,
                          help="print extra debugging info")
-       parser.add_option("-d", "--max-delay", type="eng_float", default=10e-6,
-                         help="set maximum delay spread (default=%default)")
+       parser.add_option("-d", "--degree", type="int", default=10,
+                         help="set PN code degree (length=2**degree-1, 
default=%default)")
        parser.add_option("-r", "--chip-rate", type="eng_float", default=8e6,
                          help="set sounder chip rate (default=%default)")
-       parser.add_option("-g", "--amplitude", type="eng_float", 
default=32000.0,
+       parser.add_option("-g", "--amplitude", type="eng_float", default=8000.0,
                          help="set output amplitude (default=%default)")
+        parser.add_option("", "--real-time", action="store_true", 
default=False,
+                          help="Attempt to enable real-time scheduling")
         (options, args) = parser.parse_args()
 
        if len(args) != 0:
             parser.print_help()
             sys.exit(1)
 
+        if not options.real_time:
+            realtime = False
+        else:
+            # Attempt to enable realtime scheduling
+            r = gr.enable_realtime_scheduling()
+            if r == gr.RT_OK:
+                realtime = True
+            else:
+                realtime = False
+                print "Note: failed to enable realtime scheduling"
+
        # Create an instance of a hierarchical block
-       top_block = sounder_tx(options.tx_subdev_spec, options.freq, 
options.cal,
-                              options.verbose, options.max_delay, 
options.chip_rate,
-                              options.amplitude)
+       top_block = usrp_sounder_tx(options.tx_subdev_spec, options.freq, 
options.cal,
+                                   options.verbose, options.degree, 
options.chip_rate,
+                                   options.amplitude)
                              
        # Create an instance of a runtime, passing it the top block
        # to process

Modified: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_source.py
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_source.py
 2007-04-04 03:21:05 UTC (rev 4872)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_source.py
 2007-04-04 14:08:38 UTC (rev 4873)
@@ -93,7 +93,9 @@
            gain = (g[0]+g[1])/2.0
         self._gain = gain
         self._subdev.set_gain(self._gain)
-
+        if self._verbose:
+            print "USRP gain set to", self._gain
+            
     def set_calibration(self, calibration):
         self._cal = calibration
         if self._verbose:

Modified: 
gnuradio/branches/developers/n4hy/ofdm/usrp/fpga/rbf/rev2/std_2rxhb_2tx.rbf
===================================================================
(Binary files differ)

Modified: 
gnuradio/branches/developers/n4hy/ofdm/usrp/fpga/rbf/rev2/std_4rx_0tx.rbf
===================================================================
(Binary files differ)

Modified: 
gnuradio/branches/developers/n4hy/ofdm/usrp/fpga/rbf/rev4/std_2rxhb_2tx.rbf
===================================================================
(Binary files differ)

Modified: 
gnuradio/branches/developers/n4hy/ofdm/usrp/fpga/rbf/rev4/std_4rx_0tx.rbf
===================================================================
(Binary files differ)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]