commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r4554 - gnuradio/branches/developers/n4hy/ofdm/gnuradi


From: n4hy
Subject: [Commit-gnuradio] r4554 - gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen
Date: Tue, 20 Feb 2007 20:43:16 -0700 (MST)

Author: n4hy
Date: 2007-02-20 20:43:15 -0700 (Tue, 20 Feb 2007)
New Revision: 4554

Added:
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_pll_XX.cc.t
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_pll_XX.h.t
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_pll_XX.i.t
Modified:
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/Makefile.am
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/Makefile.gen
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/generate_common.py
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gengen_generated.i
Log:
intermediate step to peak feeding pll

Modified: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/Makefile.am 
    2007-02-21 03:39:55 UTC (rev 4553)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/Makefile.am 
    2007-02-21 03:43:15 UTC (rev 4554)
@@ -74,6 +74,9 @@
        gr_peak_detector_XX.cc.t        \
        gr_peak_detector_XX.h.t         \
        gr_peak_detector_XX.i.t         \
+       gr_peak_detector_pll_XX.cc.t    \
+       gr_peak_detector_pll_XX.h.t     \
+       gr_peak_detector_pll_XX.i.t     \
        gr_sig_source_X.cc.t            \
        gr_sig_source_X.h.t             \
        gr_sig_source_X.i.t             \

Modified: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/Makefile.gen
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/Makefile.gen
    2007-02-21 03:39:55 UTC (rev 4553)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/Makefile.gen
    2007-02-21 03:43:15 UTC (rev 4554)
@@ -58,6 +58,9 @@
        gr_packed_to_unpacked_ss.h \
        gr_peak_detector_ff.h \
        gr_peak_detector_ii.h \
+       gr_peak_detector_pll_ff.h \
+       gr_peak_detector_pll_ii.h \
+       gr_peak_detector_pll_ss.h \
        gr_peak_detector_ss.h \
        gr_sample_and_hold_bb.h \
        gr_sample_and_hold_ff.h \
@@ -142,6 +145,9 @@
        gr_packed_to_unpacked_ss.i \
        gr_peak_detector_ff.i \
        gr_peak_detector_ii.i \
+       gr_peak_detector_pll_ff.i \
+       gr_peak_detector_pll_ii.i \
+       gr_peak_detector_pll_ss.i \
        gr_peak_detector_ss.i \
        gr_sample_and_hold_bb.i \
        gr_sample_and_hold_ff.i \
@@ -226,6 +232,9 @@
        gr_packed_to_unpacked_ss.cc \
        gr_peak_detector_ff.cc \
        gr_peak_detector_ii.cc \
+       gr_peak_detector_pll_ff.cc \
+       gr_peak_detector_pll_ii.cc \
+       gr_peak_detector_pll_ss.cc \
        gr_peak_detector_ss.cc \
        gr_sample_and_hold_bb.cc \
        gr_sample_and_hold_ff.cc \

Modified: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/generate_common.py
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/generate_common.py
      2007-02-21 03:39:55 UTC (rev 4553)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/generate_common.py
      2007-02-21 03:43:15 UTC (rev 4554)
@@ -59,7 +59,8 @@
     ('gr_unpacked_to_packed_XX',    ('bb','ss','ii')),
     ('gr_packed_to_unpacked_XX',    ('bb','ss','ii')),
     ('gr_sample_and_hold_XX',       ('bb','ss','ii','ff')),
-    ('gr_peak_detector_XX',         ('ff','ii','ss'))
+    ('gr_peak_detector_XX',         ('ff','ii','ss')),
+    ('gr_peak_detector_pll_XX',     ('ff', 'ii','ss'))
     )
 
 

Modified: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gengen_generated.i
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gengen_generated.i
      2007-02-21 03:39:55 UTC (rev 4553)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gengen_generated.i
      2007-02-21 03:43:15 UTC (rev 4554)
@@ -58,6 +58,9 @@
 #include <gr_packed_to_unpacked_ss.h>
 #include <gr_peak_detector_ff.h>
 #include <gr_peak_detector_ii.h>
+#include <gr_peak_detector_pll_ff.h>
+#include <gr_peak_detector_pll_ii.h>
+#include <gr_peak_detector_pll_ss.h>
 #include <gr_peak_detector_ss.h>
 #include <gr_sample_and_hold_bb.h>
 #include <gr_sample_and_hold_ff.h>
@@ -142,6 +145,9 @@
 %include <gr_packed_to_unpacked_ss.i>
 %include <gr_peak_detector_ff.i>
 %include <gr_peak_detector_ii.i>
+%include <gr_peak_detector_pll_ff.i>
+%include <gr_peak_detector_pll_ii.i>
+%include <gr_peak_detector_pll_ss.i>
 %include <gr_peak_detector_ss.i>
 %include <gr_sample_and_hold_bb.i>
 %include <gr_sample_and_hold_ff.i>

Added: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_pll_XX.cc.t
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_pll_XX.cc.t
                            (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_pll_XX.cc.t
    2007-02-21 03:43:15 UTC (rev 4554)
@@ -0,0 +1,108 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 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.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@address@hidden>
+#include <gr_io_signature.h>
+
address@hidden@
address@hidden@ (float period, float gain)
+{
+  return @SPTR_NAME@ (new @NAME@ (period, gain));
+}
+
address@hidden@::@NAME@ (float period, float gain)
+  : gr_sync_block ("@BASE_NAME@",
+                  gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
+                  gr_make_io_signature (1, 1, sizeof (@O_TYPE@))),
+    d_avg(0), d_found(0), d_restart(0),d_peak_phase(0)
+{
+  d_peak_frequency = 1.0f/period;
+  d_gain = gain;
+  d_decision_threshold = 1.0 - 0.5*d_peak_frequency;
+  set_history(1); // so we can look behind us
+}
+
+int
address@hidden@::work (int noutput_items,
+             gr_vector_const_void_star &input_items,
+             gr_vector_void_star &output_items)
+{
+  @I_TYPE@ *iptr = (@I_TYPE@ *) input_items[0];
+  @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
+
+  //unsigned char found = 0;
+  float alpha = 0.01;
+  for(int i=0;i<noutput_items;i++) {
+    d_avg = (alpha)*iptr[i] + (1-alpha)*d_avg;
+  }
+
+  for (int i = 1; i < noutput_items; i++){
+    if( (iptr[i-1] > d_avg*0.25) && (iptr[i-1] > iptr[i])) {
+      if(d_found==0) {
+       d_found = 1;
+       for(int j = 0; j < 10; j++) {
+         if(iptr[i+j] > iptr[i]) {
+           d_found = 0;
+         }
+       }
+      
+       if(d_found) {
+         optr[i-1] = (@O_TYPE@)1;
+       }
+       else {
+         optr[i-1] = (@O_TYPE@)0;
+       }
+      }
+      else {
+       optr[i-1] = (@O_TYPE@)0;
+      }
+    }
+    else {
+      d_found = 0;
+      optr[i-1] = (@O_TYPE@)0;
+    }
+    if (optr[i-1] == (@O_TYPE@)1) {
+      optr[i-1] = (@O_TYPE@)0;
+      if (d_restart == 0) {
+       d_peak_phase = 1;
+       d_restart += 2;
+      } else {
+       if (d_restart == 1) d_restart+=1;
+       if (d_peak_phase > 0.5) d_peak_phase += d_gain*(1.0-d_peak_phase);
+       else d_peak_phase -= d_gain*d_peak_phase;
+      }
+    }
+    if (d_peak_phase > d_decision_threshold) {
+      d_peak_phase -= 1.0;
+      if (d_restart > 0) d_restart -= 1;
+      optr[i-1] = (@O_TYPE@)1;
+    }
+    d_peak_phase += d_peak_frequency;
+  }
+  return noutput_items;
+}

Added: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_pll_XX.h.t
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_pll_XX.h.t
                             (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_pll_XX.h.t
     2007-02-21 03:43:15 UTC (rev 4554)
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 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.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
address@hidden@ address@hidden@ (float period, float gain);
+
+/*!
+ * \brief Detect the peak of a signal
+ * \ingroup block
+ *
+ * If a peak is detected, this block outputs a 1, 
+ * or it outputs 0's.
+ */
+class @NAME@ : public gr_sync_block
+{
+  friend @SPTR_NAME@ address@hidden@ (float period, float gain);
+
+  @NAME@ (float period, float gain);
+
+ private:
+  float d_avg;
+  unsigned char d_found,d_restart;
+  float d_peak_phase, d_peak_frequency,d_gain,d_decision_threshold;
+
+ public:
+
+  int work (int noutput_items,
+           gr_vector_const_void_star &input_items,
+           gr_vector_void_star &output_items);
+};
+
+#endif

Added: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_pll_XX.i.t
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_pll_XX.i.t
                             (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_peak_detector_pll_XX.i.t
     2007-02-21 03:43:15 UTC (rev 4554)
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 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.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+  @SPTR_NAME@ address@hidden@ (float period, float gain);
+
+class @NAME@ : public gr_sync_block
+{
+ private:
+  @NAME@ (float period, float gain);
+};





reply via email to

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