summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/sphinx/source/gr/index.rst7
-rw-r--r--docs/sphinx/source/gr/sync_blk.rst4
-rw-r--r--gnuradio-core/src/lib/general/CMakeLists.txt3
-rw-r--r--gnuradio-core/src/lib/general/general.i2
-rw-r--r--gnuradio-core/src/lib/general/gr_count_bits.cc93
-rw-r--r--gnuradio-core/src/lib/general/gr_count_bits.h33
-rw-r--r--gnuradio-core/src/lib/general/gr_simple_correlator.cc237
-rw-r--r--gnuradio-core/src/lib/general/gr_simple_correlator.h111
-rw-r--r--gnuradio-core/src/lib/general/gr_simple_correlator.i31
-rw-r--r--gr-digital/include/digital/CMakeLists.txt1
-rw-r--r--gr-digital/include/digital_simple_correlator.h107
-rw-r--r--gr-digital/lib/correlate_access_code_bb_impl.cc4
-rw-r--r--gr-digital/lib/correlate_access_code_tag_bb_impl.cc4
-rw-r--r--gr-digital/lib/packet_sink_impl.cc4
-rw-r--r--gr-digital/lib/simple_correlator_impl.cc2
-rwxr-xr-xgr-digital/python/qa_simple_correlator.py12
-rw-r--r--gr-digital/swig/digital_simple_correlator.i31
-rw-r--r--gr-pager/lib/CMakeLists.txt2
-rw-r--r--gr-pager/lib/flex_sync_impl.cc6
-rw-r--r--grc/blocks/block_tree.xml2
-rw-r--r--grc/blocks/gr_simple_correlator.xml25
21 files changed, 20 insertions, 701 deletions
diff --git a/docs/sphinx/source/gr/index.rst b/docs/sphinx/source/gr/index.rst
index 6d09b861ef..d946d46879 100644
--- a/docs/sphinx/source/gr/index.rst
+++ b/docs/sphinx/source/gr/index.rst
@@ -127,13 +127,6 @@ Information Coding and Decoding
gnuradio.gr.fake_channel_encoder_pp
gnuradio.gr.fake_channel_decoder_pp
-Synchronization
-^^^^^^^^^^^^^^^
-
-.. autosummary::
- :nosignatures:
-
- gnuradio.gr.simple_correlator
Type Conversions
^^^^^^^^^^^^^^^^
diff --git a/docs/sphinx/source/gr/sync_blk.rst b/docs/sphinx/source/gr/sync_blk.rst
deleted file mode 100644
index d5e3c3d7c5..0000000000
--- a/docs/sphinx/source/gr/sync_blk.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-gnuradio.gr: Synchronization
-============================
-
-.. autooldblock:: gnuradio.gr.simple_correlator
diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt
index 26dab910c9..c562224009 100644
--- a/gnuradio-core/src/lib/general/CMakeLists.txt
+++ b/gnuradio-core/src/lib/general/CMakeLists.txt
@@ -69,7 +69,6 @@ list(APPEND gnuradio_core_sources ${CMAKE_CURRENT_BINARY_DIR}/gr_constants.cc)
########################################################################
list(APPEND gnuradio_core_sources
${CMAKE_CURRENT_SOURCE_DIR}/gr_circular_file.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/gr_count_bits.cc
${CMAKE_CURRENT_SOURCE_DIR}/gr_fast_atan2f.cc
${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt.cc
${CMAKE_CURRENT_SOURCE_DIR}/gr_misc.cc
@@ -102,7 +101,6 @@ install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/gr_core_api.h
${CMAKE_CURRENT_SOURCE_DIR}/gr_circular_file.h
${CMAKE_CURRENT_SOURCE_DIR}/gr_constants.h
- ${CMAKE_CURRENT_SOURCE_DIR}/gr_count_bits.h
${CMAKE_CURRENT_SOURCE_DIR}/gr_expj.h
${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt.h
${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt_nco.h
@@ -174,7 +172,6 @@ set(gr_core_general_triple_threats
gr_remez
gr_rms_cf
gr_rms_ff
- gr_simple_correlator
gr_skiphead
gr_stretch_ff
gr_test
diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i
index e379c40867..53dcac6fb6 100644
--- a/gnuradio-core/src/lib/general/general.i
+++ b/gnuradio-core/src/lib/general/general.i
@@ -32,7 +32,6 @@
#include <gr_check_counting_s.h>
#include <gr_lfsr_32k_source_s.h>
#include <gr_check_lfsr_32k_s.h>
-#include <gr_simple_correlator.h>
#include <gr_align_on_samplenumbers_ss.h>
#include <gr_complex_to_xxx.h>
#include <gr_complex_to_interleaved_short.h>
@@ -82,7 +81,6 @@
%include "gr_check_counting_s.i"
%include "gr_lfsr_32k_source_s.i"
%include "gr_check_lfsr_32k_s.i"
-%include "gr_simple_correlator.i"
%include "gr_align_on_samplenumbers_ss.i"
%include "gr_complex_to_xxx.i"
%include "gr_complex_to_interleaved_short.i"
diff --git a/gnuradio-core/src/lib/general/gr_count_bits.cc b/gnuradio-core/src/lib/general/gr_count_bits.cc
deleted file mode 100644
index 4776fe61a9..0000000000
--- a/gnuradio-core/src/lib/general/gr_count_bits.cc
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2003 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <gr_count_bits.h>
-
-/*
- * these are slow and obvious. If you need something faster, fix these
- */
-
-// return number of set bits in the low 8 bits of x
-unsigned int
-gr_count_bits8 (unsigned int x)
-{
- int count = 0;
-
- for (int i = 0; i < 8; i++)
- if (x & (1 << i))
- count++;
-
- return count;
-}
-
-// return number of set bits in the low 16 bits of x
-unsigned int
-gr_count_bits16 (unsigned int x)
-{
- int count = 0;
-
- for (int i = 0; i < 16; i++)
- if (x & (1 << i))
- count++;
-
- return count;
-
-}
-
-
-#if 0 // slow and obvious
-
-// return number of set bits in the low 32 bits of x
-unsigned int
-gr_count_bits32 (unsigned int x)
-{
- int count = 0;
-
- for (int i = 0; i < 32; i++)
- if (x & (1 << i))
- count++;
-
- return count;
-}
-
-#else // fast and not so obvious
-
-// return number of set bits in the low 32 bits of x
-unsigned int
-gr_count_bits32 (unsigned int x)
-{
- unsigned res = (x & 0x55555555) + ((x >> 1) & 0x55555555);
- res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
- res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F);
- res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF);
- return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
-}
-
-#endif
-
-
-// return number of set bits in the low 64 bits of x
-unsigned int
-gr_count_bits64 (unsigned long long x)
-{
- return gr_count_bits32((x >> 32) & 0xffffffff) + gr_count_bits32(x & 0xffffffff);
-}
diff --git a/gnuradio-core/src/lib/general/gr_count_bits.h b/gnuradio-core/src/lib/general/gr_count_bits.h
deleted file mode 100644
index 76d0173eb5..0000000000
--- a/gnuradio-core/src/lib/general/gr_count_bits.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2003 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef _GR_COUNT_BITS_H_
-#define _GR_COUNT_BITS_H_
-
-#include <gr_core_api.h>
-
-GR_CORE_API unsigned int gr_count_bits8(unsigned int x); // return number of set bits in the low 8 bits of x
-GR_CORE_API unsigned int gr_count_bits16(unsigned int x); // return number of set bits in the low 16 bits of x
-GR_CORE_API unsigned int gr_count_bits32(unsigned int x); // return number of set bits in the low 32 bits of x
-GR_CORE_API unsigned int gr_count_bits64(unsigned long long int x);
-
-#endif /* _GR_COUNT_BITS_H_ */
diff --git a/gnuradio-core/src/lib/general/gr_simple_correlator.cc b/gnuradio-core/src/lib/general/gr_simple_correlator.cc
deleted file mode 100644
index b9209e74f0..0000000000
--- a/gnuradio-core/src/lib/general/gr_simple_correlator.cc
+++ /dev/null
@@ -1,237 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_simple_correlator.h>
-#include <gr_simple_framer_sync.h>
-#include <gr_io_signature.h>
-#include <assert.h>
-#include <stdexcept>
-#include <gr_count_bits.h>
-#include <string.h>
-#include <cstdio>
-
-
-static const int THRESHOLD = 3;
-
-gr_simple_correlator_sptr
-gr_make_simple_correlator (int payload_bytesize)
-{
- return gnuradio::get_initial_sptr(new gr_simple_correlator (payload_bytesize));
-}
-
-gr_simple_correlator::gr_simple_correlator (int payload_bytesize)
- : gr_block ("simple_correlator",
- gr_make_io_signature (1, 1, sizeof (float)),
- gr_make_io_signature (1, 1, sizeof (unsigned char))),
- d_payload_bytesize (payload_bytesize),
- d_state (ST_LOOKING), d_osi (0),
- d_bblen ((payload_bytesize + GRSF_PAYLOAD_OVERHEAD) * GRSF_BITS_PER_BYTE),
- d_bitbuf (new unsigned char [d_bblen]),
- d_pktbuf (new unsigned char [d_bblen/GRSF_BITS_PER_BYTE]),
- d_bbi (0)
-{
- d_avbi = 0;
- d_accum = 0.0;
- d_avg = 0.0;
- for (int i = 0; i < AVG_PERIOD; i++)
- d_avgbuf[i] = 0.0;
-
-#ifdef DEBUG_SIMPLE_CORRELATOR
- d_debug_fp = fopen("corr.log", "w");
-#endif
- enter_looking ();
-
-}
-
-gr_simple_correlator::~gr_simple_correlator ()
-{
-#ifdef DEBUG_SIMPLE_CORRELATOR
- fclose(d_debug_fp);
-#endif
- delete [] d_bitbuf;
- delete [] d_pktbuf;
-}
-
-
-void
-gr_simple_correlator::enter_looking ()
-{
- fflush (stdout);
- // fprintf (stderr, ">>> enter_looking\n");
- d_state = ST_LOOKING;
- for (int i = 0; i < OVERSAMPLE; i++)
- d_shift_reg[i] = 0;
- d_osi = 0;
-
- d_avbi = 0;
- d_avg = d_avg * 0.5;
- d_accum = 0;
- for (int i = 0; i < AVG_PERIOD; i++)
- d_avgbuf[i] = 0.0;
-}
-
-void
-gr_simple_correlator::enter_under_threshold ()
-{
- fflush (stdout);
- // fprintf (stderr, ">>> enter_under_threshold\n");
- d_state = ST_UNDER_THRESHOLD;
- d_transition_osi = d_osi;
-}
-
-void
-gr_simple_correlator::enter_locked ()
-{
- d_state = ST_LOCKED;
- int delta = sub_index (d_osi, d_transition_osi);
- d_center_osi = add_index (d_transition_osi, delta/2);
- d_center_osi = add_index (d_center_osi, 3); // FIXME
- d_bbi = 0;
- fflush (stdout);
- // fprintf (stderr, ">>> enter_locked d_center_osi = %d\n", d_center_osi);
-
- d_avg = std::max(-1.0, std::min(1.0, d_accum * (1.0/AVG_PERIOD)));
- // fprintf(stderr, ">>> enter_locked d_avg = %g\n", d_avg);
-}
-
-static void
-packit (unsigned char *pktbuf, const unsigned char *bitbuf, int bitcount)
-{
- for (int i = 0; i < bitcount; i += 8){
- int t = bitbuf[i+0] & 0x1;
- t = (t << 1) | (bitbuf[i+1] & 0x1);
- t = (t << 1) | (bitbuf[i+2] & 0x1);
- t = (t << 1) | (bitbuf[i+3] & 0x1);
- t = (t << 1) | (bitbuf[i+4] & 0x1);
- t = (t << 1) | (bitbuf[i+5] & 0x1);
- t = (t << 1) | (bitbuf[i+6] & 0x1);
- t = (t << 1) | (bitbuf[i+7] & 0x1);
- *pktbuf++ = t;
- }
-}
-
-void
-gr_simple_correlator::update_avg(float x)
-{
- d_accum -= d_avgbuf[d_avbi];
- d_avgbuf[d_avbi] = x;
- d_accum += x;
- d_avbi = (d_avbi + 1) & (AVG_PERIOD-1);
-}
-
-
-int
-gr_simple_correlator::general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const float *in = (const float *) input_items[0];
- unsigned char *out = (unsigned char *) output_items[0];
-
-
- int n = 0;
- int nin = ninput_items[0];
- int decision;
- int hamming_dist;
-
-#ifdef DEBUG_SIMPLE_CORRELATOR
- struct debug_data {
- float raw_data;
- float sampled;
- float enter_locked;
- } debug_data;
-#endif
-
- while (n < nin){
-
-#ifdef DEBUG_SIMPLE_CORRELATOR
- debug_data.raw_data = in[n];
- debug_data.sampled = 0.0;
- debug_data.enter_locked = 0.0;
-#endif
-
- switch (d_state){
-
- case ST_LOCKED:
- if (d_osi == d_center_osi){
-
-#ifdef DEBUG_SIMPLE_CORRELATOR
- debug_data.sampled = 1.0;
-#endif
- decision = slice (in[n]);
-
- d_bitbuf[d_bbi] = decision;
- d_bbi++;
- if (d_bbi >= d_bblen){
- // printf ("got whole packet\n");
- packit (d_pktbuf, d_bitbuf, d_bbi);
- printf ("seqno %3d\n", d_pktbuf[0]);
- memcpy (out, &d_pktbuf[GRSF_PAYLOAD_OVERHEAD], d_payload_bytesize);
- enter_looking ();
- consume_each (n + 1);
- return d_payload_bytesize;
- }
- }
- break;
-
- case ST_LOOKING:
- case ST_UNDER_THRESHOLD:
- update_avg(in[n]);
- decision = slice (in[n]);
- d_shift_reg[d_osi] = (d_shift_reg[d_osi] << 1) | decision;
-
- hamming_dist = gr_count_bits64 (d_shift_reg[d_osi] ^ GRSF_SYNC);
- // printf ("%2d %d\n", hamming_dist, d_osi);
-
- if (d_state == ST_LOOKING && hamming_dist <= THRESHOLD){
- // We're seeing a good PN code, remember location
- enter_under_threshold ();
- }
- else if (d_state == ST_UNDER_THRESHOLD && hamming_dist > THRESHOLD){
- // no longer seeing good PN code, compute center of goodness
- enter_locked ();
-#ifdef DEBUG_SIMPLE_CORRELATOR
- debug_data.enter_locked = 1.0;
-#endif
- }
- break;
-
- default:
- assert (0);
- }
-
-#ifdef DEBUG_SIMPLE_CORRELATOR
- fwrite(&debug_data, sizeof (debug_data), 1, d_debug_fp);
-#endif
-
- d_osi = add_index (d_osi, 1);
- n++;
- }
-
- consume_each (n);
- return 0;
-}
diff --git a/gnuradio-core/src/lib/general/gr_simple_correlator.h b/gnuradio-core/src/lib/general/gr_simple_correlator.h
deleted file mode 100644
index 37d00c125e..0000000000
--- a/gnuradio-core/src/lib/general/gr_simple_correlator.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* -*- 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 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_SIMPLE_CORRELATOR_H
-#define INCLUDED_GR_SIMPLE_CORRELATOR_H
-
-#include <gr_core_api.h>
-#include <gr_block.h>
-#include <assert.h>
-
-//#define DEBUG_SIMPLE_CORRELATOR
-
-class gr_simple_correlator;
-typedef boost::shared_ptr<gr_simple_correlator> gr_simple_correlator_sptr;
-
-GR_CORE_API gr_simple_correlator_sptr gr_make_simple_correlator (int payload_bytesize);
-
-/*!
- * \brief inverse of gr_simple_framer (more or less)
- * \ingroup sync_blk
- */
-class GR_CORE_API gr_simple_correlator : public gr_block
-{
- static const int OVERSAMPLE = 8;
- enum state_t { ST_LOOKING, ST_UNDER_THRESHOLD, ST_LOCKED };
-
- int d_payload_bytesize;
- state_t d_state;
- unsigned int d_osi; // over sample index [0,OVERSAMPLE-1]
- unsigned int d_transition_osi; // first index where Hamming dist < thresh
- unsigned int d_center_osi; // center of bit
- unsigned long long int d_shift_reg[OVERSAMPLE];
- int d_bblen; // length of bitbuf
- unsigned char *d_bitbuf; // demodulated bits
- unsigned char *d_pktbuf; // temp packet buf
- int d_bbi; // bitbuf index
-
- static const int AVG_PERIOD = 512; // must be power of 2 (for freq offset correction)
- int d_avbi;
- float d_avgbuf[AVG_PERIOD];
- float d_avg;
- float d_accum;
-
-#ifdef DEBUG_SIMPLE_CORRELATOR
- FILE *d_debug_fp; // binary log file
-#endif
-
- friend GR_CORE_API gr_simple_correlator_sptr gr_make_simple_correlator (int payload_bytesize);
- gr_simple_correlator (int payload_bytesize);
-
-
- inline int slice (float x)
- {
- return x >= d_avg ? 1 : 0;
- }
-
- void update_avg(float x);
-
- void enter_locked ();
- void enter_under_threshold ();
- void enter_looking ();
-
- static int add_index (int a, int b)
- {
- int t = a + b;
- if (t >= OVERSAMPLE)
- t -= OVERSAMPLE;
- assert (t >= 0 && t < OVERSAMPLE);
- return t;
- }
-
- static int sub_index (int a, int b)
- {
- int t = a - b;
- if (t < 0)
- t += OVERSAMPLE;
- assert (t >= 0 && t < OVERSAMPLE);
- return t;
- }
-
-
- public:
- ~gr_simple_correlator ();
-
- int general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-
-#endif /* INCLUDED_GR_SIMPLE_CORRELATOR_H */
diff --git a/gnuradio-core/src/lib/general/gr_simple_correlator.i b/gnuradio-core/src/lib/general/gr_simple_correlator.i
deleted file mode 100644
index 24d133072f..0000000000
--- a/gnuradio-core/src/lib/general/gr_simple_correlator.i
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- 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 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(gr,simple_correlator);
-
-gr_simple_correlator_sptr gr_make_simple_correlator (int payload_bytesize);
-
-class gr_simple_correlator : public gr_block
-{
- private:
- gr_simple_correlator (int payload_bytesize);
-};
diff --git a/gr-digital/include/digital/CMakeLists.txt b/gr-digital/include/digital/CMakeLists.txt
index 0cc043ed17..11cab88337 100644
--- a/gr-digital/include/digital/CMakeLists.txt
+++ b/gr-digital/include/digital/CMakeLists.txt
@@ -121,6 +121,7 @@ install(FILES
probe_mpsk_snr_est_c.h
scrambler_bb.h
simple_framer.h
+ simple_correlator.h
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/digital
COMPONENT "digital_devel"
)
diff --git a/gr-digital/include/digital_simple_correlator.h b/gr-digital/include/digital_simple_correlator.h
deleted file mode 100644
index 716c6995ca..0000000000
--- a/gr-digital/include/digital_simple_correlator.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2013 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_SIMPLE_CORRELATOR_H
-#define INCLUDED_GR_SIMPLE_CORRELATOR_H
-
-#include <digital_api.h>
-#include <gr_block.h>
-
-class digital_simple_correlator;
-typedef boost::shared_ptr<digital_simple_correlator> digital_simple_correlator_sptr;
-
-DIGITAL_API digital_simple_correlator_sptr digital_make_simple_correlator(int payload_bytesize);
-
-/*!
- * \brief inverse of simple_framer (more or less)
- * \ingroup sync_blk
- */
-class DIGITAL_API digital_simple_correlator : public gr_block
-{
- private:
- static const int OVERSAMPLE = 8;
- enum state_t { ST_LOOKING, ST_UNDER_THRESHOLD, ST_LOCKED };
-
- int d_payload_bytesize;
- state_t d_state;
- unsigned int d_osi; // over sample index [0,OVERSAMPLE-1]
- unsigned int d_transition_osi; // first index where Hamming dist < thresh
- unsigned int d_center_osi; // center of bit
- unsigned long long int d_shift_reg[OVERSAMPLE];
- int d_bblen; // length of bitbuf
- unsigned char *d_bitbuf; // demodulated bits
- unsigned char *d_pktbuf; // temp packet buf
- int d_bbi; // bitbuf index
-
- static const int AVG_PERIOD = 512; // must be power of 2 (for freq offset correction)
- int d_avbi;
- float d_avgbuf[AVG_PERIOD];
- float d_avg;
- float d_accum;
-
-#ifdef DEBUG_SIMPLE_CORRELATOR
- FILE *d_debug_fp; // binary log file
-#endif
-
- friend GR_CORE_API digital_simple_correlator_sptr
- digital_make_simple_correlator(int payload_bytesize);
- digital_simple_correlator(int payload_bytesize);
-
- inline int slice(float x)
- {
- return x >= d_avg ? 1 : 0;
- }
-
- void update_avg(float x);
-
- void enter_locked();
- void enter_under_threshold();
- void enter_looking();
-
- static int add_index(int a, int b)
- {
- int t = a + b;
- if(t >= OVERSAMPLE)
- t -= OVERSAMPLE;
- assert(t >= 0 && t < OVERSAMPLE);
- return t;
- }
-
- static int sub_index(int a, int b)
- {
- int t = a - b;
- if(t < 0)
- t += OVERSAMPLE;
- assert(t >= 0 && t < OVERSAMPLE);
- return t;
- }
-
- public:
- ~digital_simple_correlator();
-
- int general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_GR_SIMPLE_CORRELATOR_H */
diff --git a/gr-digital/lib/correlate_access_code_bb_impl.cc b/gr-digital/lib/correlate_access_code_bb_impl.cc
index 4e1131afda..0ada203c65 100644
--- a/gr-digital/lib/correlate_access_code_bb_impl.cc
+++ b/gr-digital/lib/correlate_access_code_bb_impl.cc
@@ -26,7 +26,7 @@
#include "correlate_access_code_bb_impl.h"
#include <gr_io_signature.h>
-#include <gr_count_bits.h>
+#include <blocks/count_bits.h>
#include <stdexcept>
#include <cstdio>
@@ -104,7 +104,7 @@ namespace gr {
int new_flag = 0;
wrong_bits = (d_data_reg ^ d_access_code) & d_mask;
- nwrong = gr_count_bits64(wrong_bits);
+ nwrong = gr::blocks::count_bits64(wrong_bits);
// test for access code with up to threshold errors
new_flag = (nwrong <= d_threshold);
diff --git a/gr-digital/lib/correlate_access_code_tag_bb_impl.cc b/gr-digital/lib/correlate_access_code_tag_bb_impl.cc
index 1ff27f02a5..8ac601bb9d 100644
--- a/gr-digital/lib/correlate_access_code_tag_bb_impl.cc
+++ b/gr-digital/lib/correlate_access_code_tag_bb_impl.cc
@@ -27,7 +27,7 @@
#include "correlate_access_code_tag_bb_impl.h"
#include <gr_io_signature.h>
#include <stdexcept>
-#include <gr_count_bits.h>
+#include <blocks/count_bits.h>
#include <cstdio>
#include <iostream>
@@ -109,7 +109,7 @@ namespace gr {
int new_flag = 0;
wrong_bits = (d_data_reg ^ d_access_code) & d_mask;
- nwrong = gr_count_bits64(wrong_bits);
+ nwrong = gr::blocks::count_bits64(wrong_bits);
// test for access code with up to threshold errors
new_flag = (nwrong <= d_threshold);
diff --git a/gr-digital/lib/packet_sink_impl.cc b/gr-digital/lib/packet_sink_impl.cc
index 0d1281b03b..1d79b3d717 100644
--- a/gr-digital/lib/packet_sink_impl.cc
+++ b/gr-digital/lib/packet_sink_impl.cc
@@ -32,7 +32,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <stdexcept>
-#include <gr_count_bits.h>
+#include <blocks/count_bits.h>
#include <string.h>
namespace gr {
@@ -130,7 +130,7 @@ static const int DEFAULT_THRESHOLD = 12;
d_shift_reg = d_shift_reg << 1;
// Compute popcnt of putative sync vector
- if(gr_count_bits64(d_shift_reg ^ d_sync_vector) <= d_threshold) {
+ if(gr::blocks::count_bits64(d_shift_reg ^ d_sync_vector) <= d_threshold) {
// Found it, set up for header decode
enter_have_sync();
break;
diff --git a/gr-digital/lib/simple_correlator_impl.cc b/gr-digital/lib/simple_correlator_impl.cc
index bc03d70193..6b35b4cf0d 100644
--- a/gr-digital/lib/simple_correlator_impl.cc
+++ b/gr-digital/lib/simple_correlator_impl.cc
@@ -187,7 +187,7 @@ namespace gr {
if(d_bbi >= d_bblen) {
// printf("got whole packet\n");
packit(d_pktbuf, d_bitbuf, d_bbi);
- printf("seqno %3d\n", d_pktbuf[0]);
+ //printf("seqno %3d\n", d_pktbuf[0]);
memcpy(out, &d_pktbuf[GRSF_PAYLOAD_OVERHEAD], d_payload_bytesize);
enter_looking();
consume_each(n + 1);
diff --git a/gr-digital/python/qa_simple_correlator.py b/gr-digital/python/qa_simple_correlator.py
index 124201a556..292dfd69fc 100755
--- a/gr-digital/python/qa_simple_correlator.py
+++ b/gr-digital/python/qa_simple_correlator.py
@@ -21,6 +21,8 @@
#
from gnuradio import gr, gr_unittest
+import blocks_swig as blocks
+import filter_swig as filter
import digital_swig as digital
class test_simple_correlator(gr_unittest.TestCase):
@@ -40,15 +42,15 @@ class test_simple_correlator(gr_unittest.TestCase):
# Filter taps to expand the data to oversample by 8
# Just using a RRC for some basic filter shape
- taps = gr.firdes.root_raised_cosine(8, 8, 1.0, 0.5, 21)
+ taps = filter.firdes.root_raised_cosine(8, 8, 1.0, 0.5, 21)
src = gr.vector_source_b(expected_result)
frame = digital.simple_framer(4)
unpack = gr.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST)
- expand = gr.interp_fir_filter_fff(8, taps)
- b2f = gr.char_to_float()
- mult2 = gr.multiply_const_ff(2)
- sub1 = gr.add_const_ff(-1)
+ expand = filter.interp_fir_filter_fff(8, taps)
+ b2f = blocks.char_to_float()
+ mult2 = blocks.multiply_const_ff(2)
+ sub1 = blocks.add_const_ff(-1)
op = digital.simple_correlator(4)
dst = gr.vector_sink_b()
self.tb.connect(src, frame, unpack, b2f, mult2, sub1, expand)
diff --git a/gr-digital/swig/digital_simple_correlator.i b/gr-digital/swig/digital_simple_correlator.i
deleted file mode 100644
index 5ad5ca26cc..0000000000
--- a/gr-digital/swig/digital_simple_correlator.i
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2013 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(digital,simple_correlator);
-
-digital_simple_correlator_sptr digital_make_simple_correlator(int payload_bytesize);
-
-class digital_simple_correlator : public gr_block
-{
- private:
- digital_simple_correlator(int payload_bytesize);
-};
diff --git a/gr-pager/lib/CMakeLists.txt b/gr-pager/lib/CMakeLists.txt
index b35553a696..bdf7445af9 100644
--- a/gr-pager/lib/CMakeLists.txt
+++ b/gr-pager/lib/CMakeLists.txt
@@ -22,6 +22,7 @@
########################################################################
include_directories(
${GR_PAGER_INCLUDE_DIRS}
+ ${GR_BLOCKS_INCLUDE_DIRS}
${GNURADIO_CORE_INCLUDE_DIRS}
${GRUEL_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
@@ -45,6 +46,7 @@ list(APPEND pager_sources
list(APPEND pager_libs
gnuradio-core
+ gnuradio-blocks
${Boost_LIBRARIES}
)
diff --git a/gr-pager/lib/flex_sync_impl.cc b/gr-pager/lib/flex_sync_impl.cc
index cdf68f0381..7701f56f7a 100644
--- a/gr-pager/lib/flex_sync_impl.cc
+++ b/gr-pager/lib/flex_sync_impl.cc
@@ -29,7 +29,7 @@
#include "bch3221.h"
#include "util.h"
#include <gr_io_signature.h>
-#include <gr_count_bits.h>
+#include <blocks/count_bits.h>
#include <cstdio>
namespace gr {
@@ -100,12 +100,12 @@ namespace gr {
int64_t val = d_sync[d_index];
int32_t marker = ((val & 0x0000FFFFFFFF0000ULL)) >> 16;
- if(gr_count_bits32(marker^FLEX_SYNC_MARKER) < 4) {
+ if(gr::blocks::count_bits32(marker^FLEX_SYNC_MARKER) < 4) {
int32_t code = ((val & 0xFFFF000000000000ULL) >> 32) |
(val & 0x000000000000FFFFULL);
for(int i = 0; i < num_flex_modes; i++) {
- if(gr_count_bits32(code^flex_modes[i].sync) < 4) {
+ if(gr::blocks::count_bits32(code^flex_modes[i].sync) < 4) {
d_mode = i;
return true;
}
diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml
index ce5acdb123..e51b1f72b0 100644
--- a/grc/blocks/block_tree.xml
+++ b/grc/blocks/block_tree.xml
@@ -83,8 +83,6 @@
<block>gr_mpsk_sync_cc</block>
- <block>gr_simple_correlator</block>
-
<block>blks2_packet_decoder</block>
<block>blks2_packet_encoder</block>
</cat>
diff --git a/grc/blocks/gr_simple_correlator.xml b/grc/blocks/gr_simple_correlator.xml
deleted file mode 100644
index 820523a644..0000000000
--- a/grc/blocks/gr_simple_correlator.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Simple Correlator
-###################################################
- -->
-<block>
- <name>Simple Correlator</name>
- <key>gr_simple_correlator</key>
- <import>from gnuradio import gr</import>
- <make>gr.simple_correlator($payload_bytesize)</make>
- <param>
- <name>Payload Byte Size</name>
- <key>payload_bytesize</key>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>