commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: trondeau
Subject: [Commit-gnuradio] r4658 - gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general
Date: Tue, 27 Feb 2007 08:24:07 -0700 (MST)

Author: trondeau
Date: 2007-02-27 08:24:07 -0700 (Tue, 27 Feb 2007)
New Revision: 4658

Added:
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_delay.cc
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_delay.h
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_delay.i
Modified:
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/Makefile.am
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/general.i
Log:
added a delay block

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-02-27 13:33:36 UTC (rev 4657)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/Makefile.am
    2007-02-27 15:24:07 UTC (rev 4658)
@@ -59,6 +59,7 @@
        gr_ctcss_squelch_ff.cc          \
        gr_dd_mpsk_sync_cc.cc           \
        gr_deinterleave.cc              \
+       gr_delay.cc                     \
        gr_diff_decoder_bb.cc           \
        gr_diff_encoder_bb.cc           \
        gr_diff_phasor_cc.cc            \
@@ -187,6 +188,7 @@
        gr_diff_decoder_bb.h            \
        gr_diff_encoder_bb.h            \
        gr_deinterleave.h               \
+       gr_delay.h                      \
        gr_diff_phasor_cc.h             \
        gr_dpll_ff.h                    \
        gr_expj.h                       \
@@ -328,6 +330,7 @@
        gr_diff_phasor_cc.i             \
        gr_dpll_ff.i                    \
        gr_deinterleave.i               \
+       gr_delay.i                      \
        gr_fake_channel_coder_pp.i      \
        gr_feedforward_agc_cc.i         \
        gr_feval.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-02-27 13:33:36 UTC (rev 4657)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/general.i  
    2007-02-27 15:24:07 UTC (rev 4658)
@@ -57,6 +57,7 @@
 #include <gr_firdes.h>
 #include <gr_interleave.h>
 #include <gr_deinterleave.h>
+#include <gr_delay.h>
 #include <gr_simple_squelch_cc.h>
 #include <gr_agc_ff.h>
 #include <gr_agc_cc.h>
@@ -152,6 +153,7 @@
 %include "gr_firdes.i"
 %include "gr_interleave.i"
 %include "gr_deinterleave.i"
+%include "gr_delay.i"
 %include "gr_simple_squelch_cc.i"
 %include "gr_agc_ff.i"
 %include "gr_agc_cc.i"

Added: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_delay.cc
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_delay.cc
                            (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_delay.cc
    2007-02-27 15:24:07 UTC (rev 4658)
@@ -0,0 +1,63 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_delay.h>
+#include <gr_io_signature.h>
+
+gr_delay_sptr
+gr_make_delay (size_t itemsize, int delay)
+{
+  return gr_delay_sptr (new gr_delay (itemsize, delay));
+}
+
+gr_delay::gr_delay (size_t itemsize, int delay)
+  : gr_sync_block ("delay",
+                  gr_make_io_signature (1, -1, itemsize),
+                  gr_make_io_signature (1, -1, itemsize)),
+    d_itemsize(itemsize)
+{
+  set_delay(delay);
+}
+
+int
+gr_delay::work (int noutput_items,
+               gr_vector_const_void_star &input_items,
+               gr_vector_void_star &output_items)
+{
+  assert(input_items.size() == output_items.size());
+
+  const char *iptr;
+  char *optr;
+
+  for(int i = 0; i < input_items.size(); i++) {
+    iptr = (const char *) input_items[i];
+    optr = (char *) output_items[i];
+
+    memcpy(optr, iptr + delay()*d_itemsize, noutput_items*d_itemsize);
+  }
+  
+  return noutput_items;
+}

Added: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_delay.h
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_delay.h 
                            (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_delay.h 
    2007-02-27 15:24:07 UTC (rev 4658)
@@ -0,0 +1,54 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_DELAY_H
+#define INCLUDED_GR_DELAY_H
+
+#include <gr_sync_block.h>
+
+class gr_delay;
+typedef boost::shared_ptr<gr_delay> gr_delay_sptr;
+
+gr_delay_sptr gr_make_delay (size_t itemsize, int delay);
+
+/*!
+ * \brief delay the input by a certain number of samples
+ * \ingroup block
+ */
+class gr_delay : public gr_sync_block
+{
+  friend gr_delay_sptr gr_make_delay (size_t itemsize, int delay);
+
+  gr_delay (size_t itemsize, int delay);
+
+  size_t d_itemsize;
+
+ public:
+  int delay () const { return history()-1; }
+  void set_delay (int delay) { set_history(delay+1); }
+
+  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/general/gr_delay.i
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_delay.i 
                            (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_delay.i 
    2007-02-27 15:24:07 UTC (rev 4658)
@@ -0,0 +1,35 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,delay)
+
+  gr_delay_sptr gr_make_delay (size_t itemsize, int delay);
+
+class gr_delay : public gr_sync_block
+{
+ private:
+  gr_delay (size_t itemsize, int delay);
+
+ public:
+  int  delay() const { return history()-1; }
+  void set_delay (int delay) { set_history(delay+1); }
+};





reply via email to

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