commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: matt
Subject: [Commit-gnuradio] r4122 - gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general
Date: Sun, 17 Dec 2006 18:55:22 -0700 (MST)

Author: matt
Date: 2006-12-17 18:55:22 -0700 (Sun, 17 Dec 2006)
New Revision: 4122

Added:
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.cc
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.h
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.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:
OFDM bpsk demodulator -- looks like its working

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
    2006-12-18 01:48:25 UTC (rev 4121)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/Makefile.am
    2006-12-18 01:55:22 UTC (rev 4122)
@@ -165,6 +165,7 @@
        gr_ofdm_cyclic_prefixer.cc      \
        gr_ofdm_demapper_vcb.cc         \
        gr_ofdm_mapper_bcv.cc           \
+       gr_ofdm_bpsk_demapper.cc        \
        gr_ofdm_bpsk_mapper.cc          \
        gr_ofdm_sampler.cc              \
        gr_pa_2x2_phase_combiner.cc     \
@@ -299,6 +300,7 @@
        gr_ofdm_demapper_vcb.h          \
        gr_ofdm_mapper_bcv.h            \
        gr_ofdm_bpsk_mapper.h           \
+       gr_ofdm_bpsk_demapper.h         \
        gr_ofdm_sampler.h               \
        gr_pa_2x2_phase_combiner.h      \
        gr_packet_sink.h                \
@@ -433,8 +435,8 @@
        gr_ofdm_cyclic_prefixer.i       \
        gr_ofdm_demapper_vcb.i          \
        gr_ofdm_mapper_bcv.i            \
+       gr_ofdm_bpsk_demapper.i         \
        gr_ofdm_bpsk_mapper.i           \
-       gr_ofdm_bpsk_mapper.i           \
        gr_ofdm_sampler.i               \
        gr_pa_2x2_phase_combiner.i      \
        gr_packet_sink.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  
    2006-12-18 01:48:25 UTC (rev 4121)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/general.i  
    2006-12-18 01:55:22 UTC (rev 4122)
@@ -92,6 +92,7 @@
 #include <gr_probe_avg_mag_sqrd_f.h>
 #include <gr_probe_signal_f.h>
 #include <gr_ofdm_cyclic_prefixer.h>
+#include <gr_ofdm_bpsk_demapper.h>
 #include <gr_ofdm_bpsk_mapper.h>
 #include <gr_ofdm_sampler.h>
 #include <gr_costas_loop_cc.h>
@@ -189,6 +190,7 @@
 %include "gr_probe_avg_mag_sqrd_f.i"
 %include "gr_probe_signal_f.i"
 %include "gr_ofdm_cyclic_prefixer.i"
+%include "gr_ofdm_bpsk_demapper.i"
 %include "gr_ofdm_bpsk_mapper.i"
 %include "gr_ofdm_sampler.i"
 %include "gr_costas_loop_cc.i"

Added: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.cc
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.cc
                               (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.cc
       2006-12-18 01:55:22 UTC (rev 4122)
@@ -0,0 +1,76 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 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_ofdm_bpsk_demapper.h>
+#include <gr_io_signature.h>
+#include <vector>
+
+gr_ofdm_bpsk_demapper_sptr
+gr_make_ofdm_bpsk_demapper (unsigned int bits_per_symbol, unsigned int vlen)
+{
+  return gr_ofdm_bpsk_demapper_sptr (new gr_ofdm_bpsk_demapper 
(bits_per_symbol, vlen));
+}
+
+gr_ofdm_bpsk_demapper::gr_ofdm_bpsk_demapper (unsigned 
bits_per_symbol,unsigned int vlen)
+  : gr_sync_interpolator ("ofdm_bpsk_demapper",
+                         gr_make_io_signature (1, 1, sizeof(gr_complex)*vlen),
+                         gr_make_io_signature (1, 1, sizeof(unsigned char)),
+                         bits_per_symbol),
+    d_bits_per_symbol(bits_per_symbol),
+    d_vlen(vlen)
+{
+}
+
+gr_ofdm_bpsk_demapper::~gr_ofdm_bpsk_demapper(void)
+{
+}
+
+unsigned char gr_ofdm_bpsk_demapper::slicer(gr_complex x)
+{
+  return (unsigned char)(x.real() > 0 ? 1 : 0);
+}
+
+int
+gr_ofdm_bpsk_demapper::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];
+  unsigned char *out = (unsigned char *) output_items[0];
+  
+  unsigned int i=0, j=0;
+
+  for(i=0;i<ceil(d_bits_per_symbol/2);i++) {
+    unsigned int k=ceil(d_bits_per_symbol/2);
+    out[i+k] = slicer(in[i]);
+  }
+  for(i+=(d_vlen-d_bits_per_symbol);i<d_vlen;i++,j++) {
+    out[j]= slicer(in[i]);
+  }
+
+  return 1;
+}

Added: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.h
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.h
                                (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.h
        2006-12-18 01:55:22 UTC (rev 4122)
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 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_OFDM_BPSK_DEMAPPER_H
+#define INCLUDED_GR_OFDM_BPSK_DEMAPPER_H
+
+
+#include <gr_sync_interpolator.h>
+
+class gr_ofdm_bpsk_demapper;
+typedef boost::shared_ptr<gr_ofdm_bpsk_demapper> gr_ofdm_bpsk_demapper_sptr;
+
+gr_ofdm_bpsk_demapper_sptr 
+gr_make_ofdm_bpsk_demapper (unsigned int bits_per_symbol, unsigned int vlen);
+
+
+/*!
+ * \brief take a vector of complex constellation points in from an FFT
+ * and demodulate to a stream of bits. Simple BPSK version.
+ */
+
+class gr_ofdm_bpsk_demapper : public gr_sync_interpolator
+{
+  friend gr_ofdm_bpsk_demapper_sptr
+    gr_make_ofdm_bpsk_demapper (unsigned int bits_per_symbol, unsigned int 
vlen);
+  
+ protected:
+  gr_ofdm_bpsk_demapper (unsigned int bits_per_symbol, unsigned int vlen);
+  
+ private:
+  unsigned char slicer(gr_complex x);
+
+  unsigned int d_bits_per_symbol;
+  unsigned int d_vlen;
+
+ public:
+  ~gr_ofdm_bpsk_demapper(void);
+  int work(int noutput_items,
+          gr_vector_const_void_star &input_times,
+          gr_vector_void_star &output_items);
+};
+
+
+#endif

Added: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.i
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.i
                                (rev 0)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.i
        2006-12-18 01:55:22 UTC (rev 4122)
@@ -0,0 +1,40 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006 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,ofdm_bpsk_demapper)
+
+gr_ofdm_bpsk_demapper_sptr 
+gr_make_ofdm_bpsk_demapper (unsigned int bits_per_symbol, 
+                           unsigned int vlen);
+
+class gr_ofdm_bpsk_demapper : public gr_sync_decimator
+{
+ protected:
+  gr_ofdm_bpsk_demapper (unsigned int bits_per_symbol,
+                        unsigned int vlen);
+
+ public:
+  int work (int noutput_items,
+           gr_vector_const_void_star &input_items,
+           gr_vector_void_star &output_items);
+
+};





reply via email to

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