summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2012-08-09 20:30:09 -0400
committerTom Rondeau <trondeau@vt.edu>2012-08-09 20:30:09 -0400
commit38069c9ac14b44597ee053486ca00838c758a47c (patch)
tree7baa0e3e8fee6913b168fe1f915ffa05891a1d11
parent9d8c03e8d6bd322661765e7ebc740dbdd743b798 (diff)
digital: converting to new pimpl standard for 3.7.
Structure is basically set up. Additive scrambler converted.
-rw-r--r--gr-digital/CMakeLists.txt2
-rw-r--r--gr-digital/include/digital/CMakeLists.txt (renamed from gr-digital/include/CMakeLists.txt)105
-rw-r--r--gr-digital/include/digital/additive_scrambler_bb.h74
-rw-r--r--gr-digital/include/digital/api.h (renamed from gr-digital/include/digital_api.h)0
-rw-r--r--gr-digital/include/digital_additive_scrambler_bb.h73
-rw-r--r--gr-digital/lib/CMakeLists.txt90
-rw-r--r--gr-digital/lib/additive_scrambler_bb_impl.cc104
-rw-r--r--gr-digital/lib/additive_scrambler_bb_impl.h60
-rw-r--r--gr-digital/lib/digital_additive_scrambler_bb.cc69
-rw-r--r--gr-digital/swig/CMakeLists.txt141
-rw-r--r--gr-digital/swig/digital_additive_scrambler_bb.i31
-rw-r--r--gr-digital/swig/digital_swig.i112
12 files changed, 359 insertions, 502 deletions
diff --git a/gr-digital/CMakeLists.txt b/gr-digital/CMakeLists.txt
index eb7ed67e16..05a9bc6874 100644
--- a/gr-digital/CMakeLists.txt
+++ b/gr-digital/CMakeLists.txt
@@ -83,7 +83,7 @@ CPACK_COMPONENT("digital_swig"
########################################################################
# Add subdirectories
########################################################################
-add_subdirectory(include)
+add_subdirectory(include/digital)
add_subdirectory(lib)
add_subdirectory(doc)
if(ENABLE_PYTHON)
diff --git a/gr-digital/include/CMakeLists.txt b/gr-digital/include/digital/CMakeLists.txt
index f863b28757..c6384ecd6e 100644
--- a/gr-digital/include/CMakeLists.txt
+++ b/gr-digital/include/digital/CMakeLists.txt
@@ -17,7 +17,6 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-
########################################################################
# generate helper scripts to expand templated files
########################################################################
@@ -36,7 +35,7 @@ if __name__ == '__main__':
root, inp = sys.argv[1:3]
for sig in sys.argv[3:]:
name = re.sub ('X+', sig, root)
- d = build_utils.standard_dict(name, sig, 'digital')
+ d = build_utils.standard_dict2(name, sig, 'digital')
build_utils.expand_template(d, inp)
")
@@ -64,8 +63,8 @@ endmacro(expand_h)
########################################################################
# Invoke macro to generate various sources
-########################################################################
-expand_h(digital_chunks_to_symbols_XX bf bc sf sc if ic)
+#######################################################################
+#expand_h(chunks_to_symbols_XX bf bc sf sc if ic)
add_custom_target(digital_generated_includes DEPENDS
${generated_includes}
@@ -75,55 +74,55 @@ add_custom_target(digital_generated_includes DEPENDS
# Install header files
########################################################################
install(FILES
- ${generated_includes}
- digital_api.h
- digital_impl_glfsr.h
- digital_impl_mpsk_snr_est.h
- digital_additive_scrambler_bb.h
- digital_binary_slicer_fb.h
- digital_bytes_to_syms.h
- digital_clock_recovery_mm_cc.h
- digital_clock_recovery_mm_ff.h
- digital_cma_equalizer_cc.h
- digital_cpmmod_bc.h
- digital_constellation.h
- digital_constellation_receiver_cb.h
- digital_constellation_decoder_cb.h
- digital_correlate_access_code_bb.h
- digital_correlate_access_code_tag_bb.h
- digital_costas_loop_cc.h
- digital_crc32.h
- digital_descrambler_bb.h
- digital_diff_decoder_bb.h
- digital_diff_encoder_bb.h
- digital_diff_phasor_cc.h
- digital_framer_sink_1.h
- digital_fll_band_edge_cc.h
- digital_glfsr_source_b.h
- digital_glfsr_source_f.h
- digital_gmskmod_bc.h
- digital_lms_dd_equalizer_cc.h
- digital_kurtotic_equalizer_cc.h
- digital_map_bb.h
- digital_metric_type.h
- digital_mpsk_receiver_cc.h
- digital_mpsk_snr_est_cc.h
- digital_ofdm_cyclic_prefixer.h
- digital_ofdm_frame_acquisition.h
- digital_ofdm_frame_sink.h
- digital_ofdm_insert_preamble.h
- digital_ofdm_mapper_bcv.h
- digital_ofdm_sampler.h
- digital_packet_sink.h
- digital_pfb_clock_sync_ccf.h
- digital_pfb_clock_sync_fff.h
- digital_pn_correlator_cc.h
- digital_probe_density_b.h
- digital_probe_mpsk_snr_est_c.h
- digital_scrambler_bb.h
- digital_simple_framer.h
- digital_simple_framer_sync.h
- DESTINATION ${GR_INCLUDE_DIR}/gnuradio
+ ${digital_generated_includes}
+ api.h
+# impl_glfsr.h
+# impl_mpsk_snr_est.h
+ additive_scrambler_bb.h
+# binary_slicer_fb.h
+# bytes_to_syms.h
+# clock_recovery_mm_cc.h
+# clock_recovery_mm_ff.h
+# cma_equalizer_cc.h
+# cpmmod_bc.h
+# constellation.h
+# constellation_receiver_cb.h
+# constellation_decoder_cb.h
+# correlate_access_code_bb.h
+# correlate_access_code_tag_bb.h
+# costas_loop_cc.h
+# crc32.h
+# descrambler_bb.h
+# diff_decoder_bb.h
+# diff_encoder_bb.h
+# diff_phasor_cc.h
+# framer_sink_1.h
+# fll_band_edge_cc.h
+# glfsr_source_b.h
+# glfsr_source_f.h
+# gmskmod_bc.h
+# lms_dd_equalizer_cc.h
+# kurtotic_equalizer_cc.h
+# map_bb.h
+# metric_type.h
+# mpsk_receiver_cc.h
+# mpsk_snr_est_cc.h
+# ofdm_cyclic_prefixer.h
+# ofdm_frame_acquisition.h
+# ofdm_frame_sink.h
+# ofdm_insert_preamble.h
+# ofdm_mapper_bcv.h
+# ofdm_sampler.h
+# packet_sink.h
+# pfb_clock_sync_ccf.h
+# pfb_clock_sync_fff.h
+# pn_correlator_cc.h
+# probe_density_b.h
+# probe_mpsk_snr_est_c.h
+# scrambler_bb.h
+# simple_framer.h
+# simple_framer_sync.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/digital
COMPONENT "digital_devel"
)
diff --git a/gr-digital/include/digital/additive_scrambler_bb.h b/gr-digital/include/digital/additive_scrambler_bb.h
new file mode 100644
index 0000000000..b7322f6a0b
--- /dev/null
+++ b/gr-digital/include/digital/additive_scrambler_bb.h
@@ -0,0 +1,74 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2010,2012 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_DIGITAL_ADDITIVE_SCRAMBLER_BB_H
+#define INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_H
+
+#include <digital/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace digital {
+
+ /*!
+ * \ingroup coding_blk
+ *
+ * Scramble an input stream using an LFSR. This block works on the
+ * LSB only of the input data stream, i.e., on an "unpacked
+ * binary" stream, and produces the same format on its output.
+ */
+ class DIGITAL_API additive_scrambler_bb : virtual public gr_sync_block
+ {
+ public:
+ // gr::digital::additive_scrambler_bb::sptr
+ typedef boost::shared_ptr<additive_scrambler_bb> sptr;
+
+ /*!
+ * \brief Create additive scrambler.
+ *
+ * Scramble an input stream using an LFSR. This block works on
+ * the LSB only of the input data stream, i.e., on an "unpacked
+ * binary" stream, and produces the same format on its output.
+ *
+ * \param mask Polynomial mask for LFSR
+ * \param seed Initial shift register contents
+ * \param len Shift register length
+ * \param count Number of bits after which shift register is reset, 0=never
+ *
+ * The scrambler works by XORing the incoming bit stream by the
+ * output of the LFSR. Optionally, after 'count' bits have been
+ * processed, the shift register is reset to the seed value.
+ * This allows processing fixed length vectors of samples.
+ */
+ static sptr make(int mask, int seed, int len, int count);
+
+ virtual int mask() const = 0;
+ virtual int seed() const = 0;
+ virtual int len() const = 0;
+ virtual int count() const = 0;
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+
+#endif /* INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_H */
diff --git a/gr-digital/include/digital_api.h b/gr-digital/include/digital/api.h
index d45ace13f2..d45ace13f2 100644
--- a/gr-digital/include/digital_api.h
+++ b/gr-digital/include/digital/api.h
diff --git a/gr-digital/include/digital_additive_scrambler_bb.h b/gr-digital/include/digital_additive_scrambler_bb.h
deleted file mode 100644
index d4bd7d4ae8..0000000000
--- a/gr-digital/include/digital_additive_scrambler_bb.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2008,2010,2012 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_ADDITIVE_SCRAMBLER_BB_H
-#define INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H
-
-#include <digital_api.h>
-#include <gr_sync_block.h>
-#include <gri_lfsr.h>
-
-class digital_additive_scrambler_bb;
-typedef boost::shared_ptr<digital_additive_scrambler_bb> digital_additive_scrambler_bb_sptr;
-
-DIGITAL_API digital_additive_scrambler_bb_sptr
-digital_make_additive_scrambler_bb(int mask, int seed,
- int len, int count=0);
-
-/*!
- * Scramble an input stream using an LFSR. This block works on the LSB only
- * of the input data stream, i.e., on an "unpacked binary" stream, and
- * produces the same format on its output.
- *
- * \param mask Polynomial mask for LFSR
- * \param seed Initial shift register contents
- * \param len Shift register length
- * \param count Number of bits after which shift register is reset, 0=never
- *
- * The scrambler works by XORing the incoming bit stream by the output of
- * the LFSR. Optionally, after 'count' bits have been processed, the shift
- * register is reset to the seed value. This allows processing fixed length
- * vectors of samples.
- *
- * \ingroup coding_blk
- */
-
-class DIGITAL_API digital_additive_scrambler_bb : public gr_sync_block
-{
- friend DIGITAL_API digital_additive_scrambler_bb_sptr
- digital_make_additive_scrambler_bb(int mask, int seed,
- int len, int count);
-
- gri_lfsr d_lfsr;
- int d_count;
- int d_bits;
-
- digital_additive_scrambler_bb(int mask, int seed,
- int len, int count);
-
-public:
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H */
diff --git a/gr-digital/lib/CMakeLists.txt b/gr-digital/lib/CMakeLists.txt
index bd4f1a5004..15107a6ad1 100644
--- a/gr-digital/lib/CMakeLists.txt
+++ b/gr-digital/lib/CMakeLists.txt
@@ -84,57 +84,57 @@ endmacro(expand_cc)
########################################################################
# Invoke macro to generate various sources
########################################################################
-expand_cc(digital_chunks_to_symbols_XX bf bc sf sc if ic)
+#expand_cc(digital_chunks_to_symbols_XX bf bc sf sc if ic)
########################################################################
# Setup library
########################################################################
list(APPEND gr_digital_sources
${generated_sources}
- digital_impl_glfsr.cc
- digital_impl_mpsk_snr_est.cc
- digital_additive_scrambler_bb.cc
- digital_binary_slicer_fb.cc
- digital_bytes_to_syms.cc
- digital_clock_recovery_mm_cc.cc
- digital_clock_recovery_mm_ff.cc
- digital_cma_equalizer_cc.cc
- digital_constellation.cc
- digital_constellation_receiver_cb.cc
- digital_constellation_decoder_cb.cc
- digital_correlate_access_code_bb.cc
- digital_correlate_access_code_tag_bb.cc
- digital_costas_loop_cc.cc
- digital_cpmmod_bc.cc
- digital_crc32.cc
- digital_descrambler_bb.cc
- digital_diff_decoder_bb.cc
- digital_diff_encoder_bb.cc
- digital_diff_phasor_cc.cc
- digital_fll_band_edge_cc.cc
- digital_framer_sink_1.cc
- digital_glfsr_source_b.cc
- digital_glfsr_source_f.cc
- digital_gmskmod_bc.cc
- digital_lms_dd_equalizer_cc.cc
- digital_kurtotic_equalizer_cc.cc
- digital_map_bb.cc
- digital_mpsk_receiver_cc.cc
- digital_mpsk_snr_est_cc.cc
- digital_ofdm_cyclic_prefixer.cc
- digital_ofdm_frame_acquisition.cc
- digital_ofdm_frame_sink.cc
- digital_ofdm_insert_preamble.cc
- digital_ofdm_mapper_bcv.cc
- digital_ofdm_sampler.cc
- digital_packet_sink.cc
- digital_pfb_clock_sync_ccf.cc
- digital_pfb_clock_sync_fff.cc
- digital_pn_correlator_cc.cc
- digital_probe_density_b.cc
- digital_probe_mpsk_snr_est_c.cc
- digital_scrambler_bb.cc
- digital_simple_framer.cc
+ #digital_impl_glfsr.cc
+ #digital_impl_mpsk_snr_est.cc
+ additive_scrambler_bb_impl.cc
+ #digital_binary_slicer_fb.cc
+ #digital_bytes_to_syms.cc
+ #digital_clock_recovery_mm_cc.cc
+ #digital_clock_recovery_mm_ff.cc
+ #digital_cma_equalizer_cc.cc
+ #digital_constellation.cc
+ #digital_constellation_receiver_cb.cc
+ #digital_constellation_decoder_cb.cc
+ #digital_correlate_access_code_bb.cc
+ #digital_correlate_access_code_tag_bb.cc
+ #digital_costas_loop_cc.cc
+ #digital_cpmmod_bc.cc
+ #digital_crc32.cc
+ #digital_descrambler_bb.cc
+ #digital_diff_decoder_bb.cc
+ #digital_diff_encoder_bb.cc
+ #digital_diff_phasor_cc.cc
+ #digital_fll_band_edge_cc.cc
+ #digital_framer_sink_1.cc
+ #digital_glfsr_source_b.cc
+ #digital_glfsr_source_f.cc
+ #digital_gmskmod_bc.cc
+ #digital_lms_dd_equalizer_cc.cc
+ #digital_kurtotic_equalizer_cc.cc
+ #digital_map_bb.cc
+ #digital_mpsk_receiver_cc.cc
+ #digital_mpsk_snr_est_cc.cc
+ #digital_ofdm_cyclic_prefixer.cc
+ #digital_ofdm_frame_acquisition.cc
+ #digital_ofdm_frame_sink.cc
+ #digital_ofdm_insert_preamble.cc
+ #digital_ofdm_mapper_bcv.cc
+ #digital_ofdm_sampler.cc
+ #digital_packet_sink.cc
+ #digital_pfb_clock_sync_ccf.cc
+ #digital_pfb_clock_sync_fff.cc
+ #digital_pn_correlator_cc.cc
+ #digital_probe_density_b.cc
+ #digital_probe_mpsk_snr_est_c.cc
+ #digital_scrambler_bb.cc
+ #digital_simple_framer.cc
)
list(APPEND digital_libs
diff --git a/gr-digital/lib/additive_scrambler_bb_impl.cc b/gr-digital/lib/additive_scrambler_bb_impl.cc
new file mode 100644
index 0000000000..8238f2d988
--- /dev/null
+++ b/gr-digital/lib/additive_scrambler_bb_impl.cc
@@ -0,0 +1,104 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2010,2012 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 "additive_scrambler_bb_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace digital {
+
+ additive_scrambler_bb::sptr
+ additive_scrambler_bb::make(int mask, int seed, int len, int count)
+ {
+ return gnuradio::get_initial_sptr(new additive_scrambler_bb_impl
+ (mask, seed, len, count));
+ }
+
+ additive_scrambler_bb_impl::additive_scrambler_bb_impl(int mask,
+ int seed,
+ int len,
+ int count)
+ : gr_sync_block("additive_scrambler_bb",
+ gr_make_io_signature(1, 1, sizeof(unsigned char)),
+ gr_make_io_signature(1, 1, sizeof(unsigned char))),
+ d_lfsr(mask, seed, len),
+ d_count(count),
+ d_bits(0), d_len(len), d_seed(seed)
+ {
+ }
+
+ additive_scrambler_bb_impl::~additive_scrambler_bb_impl()
+ {
+ }
+
+ int
+ additive_scrambler_bb_impl::mask() const
+ {
+ return d_lfsr.mask();
+ }
+
+ int
+ additive_scrambler_bb_impl::seed() const
+ {
+ return d_seed;
+ }
+
+ int
+ additive_scrambler_bb_impl::len() const
+ {
+ return d_len;
+ }
+
+ int
+ additive_scrambler_bb_impl::count() const
+ {
+ return d_count;
+ }
+
+ int
+ additive_scrambler_bb_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const unsigned char *in = (const unsigned char *)input_items[0];
+ unsigned char *out = (unsigned char *)output_items[0];
+
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = in[i]^d_lfsr.next_bit();
+ if(d_count > 0) {
+ if(++d_bits == d_count) {
+ d_lfsr.reset();
+ d_bits = 0;
+ }
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace digital */
+} /* namespace gr */
+
diff --git a/gr-digital/lib/additive_scrambler_bb_impl.h b/gr-digital/lib/additive_scrambler_bb_impl.h
new file mode 100644
index 0000000000..51566fb0e3
--- /dev/null
+++ b/gr-digital/lib/additive_scrambler_bb_impl.h
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2010,2012 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_DIGITAL_ADDITIVE_SCRAMBLER_BB_IMPL_H
+#define INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_IMPL_H
+
+#include <digital/additive_scrambler_bb.h>
+#include <gri_lfsr.h>
+
+namespace gr {
+ namespace digital {
+
+ class DIGITAL_API additive_scrambler_bb_impl
+ : public additive_scrambler_bb
+ {
+ private:
+ gri_lfsr d_lfsr;
+ int d_count;
+ int d_bits;
+ int d_len;
+ int d_seed;
+
+ public:
+ additive_scrambler_bb_impl(int mask, int seed,
+ int len, int count);
+ ~additive_scrambler_bb_impl();
+
+ int mask() const;
+ int seed() const;
+ int len() const;
+ int count() const;
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace digital */
+} /* namespace gr */
+
+#endif /* INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_IMPL_H */
diff --git a/gr-digital/lib/digital_additive_scrambler_bb.cc b/gr-digital/lib/digital_additive_scrambler_bb.cc
deleted file mode 100644
index a8affaa78f..0000000000
--- a/gr-digital/lib/digital_additive_scrambler_bb.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2008,2010,2012 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 <digital_additive_scrambler_bb.h>
-#include <gr_io_signature.h>
-
-digital_additive_scrambler_bb_sptr
-digital_make_additive_scrambler_bb(int mask, int seed, int len, int count)
-{
- return gnuradio::get_initial_sptr(new digital_additive_scrambler_bb
- (mask, seed, len, count));
-}
-
-digital_additive_scrambler_bb::digital_additive_scrambler_bb(int mask,
- int seed,
- int len,
- int count)
- : gr_sync_block("additive_scrambler_bb",
- gr_make_io_signature (1, 1, sizeof (unsigned char)),
- gr_make_io_signature (1, 1, sizeof (unsigned char))),
- d_lfsr(mask, seed, len),
- d_count(count),
- d_bits(0)
-{
-}
-
-int
-digital_additive_scrambler_bb::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const unsigned char *in = (const unsigned char *) input_items[0];
- unsigned char *out = (unsigned char *) output_items[0];
-
- for (int i = 0; i < noutput_items; i++) {
- out[i] = in[i]^d_lfsr.next_bit();
- if (d_count > 0) {
- if (++d_bits == d_count) {
- d_lfsr.reset();
- d_bits = 0;
- }
- }
- }
-
- return noutput_items;
-}
diff --git a/gr-digital/swig/CMakeLists.txt b/gr-digital/swig/CMakeLists.txt
index df5f04148c..72ef18832f 100644
--- a/gr-digital/swig/CMakeLists.txt
+++ b/gr-digital/swig/CMakeLists.txt
@@ -18,107 +18,24 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# generate helper scripts to expand templated files
-########################################################################
-include(GrPython)
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py "
-#!${PYTHON_EXECUTABLE}
-
-import sys, os, re
-sys.path.append('${GR_CORE_PYTHONPATH}')
-os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
-os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
-
-if __name__ == '__main__':
- import build_utils
- root, inp = sys.argv[1:3]
- for sig in sys.argv[3:]:
- name = re.sub ('X+', sig, root)
- d = build_utils.standard_dict(name, sig, 'digital')
- build_utils.expand_template(d, inp)
-
-")
-
-macro(expand_i root)
- # make a list of the .i generated files
- unset(expanded_files_i)
- foreach(sig ${ARGN})
- string(REGEX REPLACE "X+" ${sig} name ${root})
- list(APPEND expanded_files_i ${CMAKE_CURRENT_BINARY_DIR}/${name}.i)
- endforeach(sig)
-
- #create a command to generate the .i files
- add_custom_command(
- OUTPUT ${expanded_files_i}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.i.t
- COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}.i.t ${ARGN}
- )
-
- # Lists of generated i files
- list(APPEND generated_swigs ${expanded_files_i})
-endmacro(expand_i)
-
-
-########################################################################
-# Invoke macro to generate various sources
-########################################################################
-expand_i(digital_chunks_to_symbols_XX bf bc sf sc if ic)
-
-add_custom_target(digital_generated_swigs DEPENDS
- ${generated_swigs}
-)
-
-########################################################################
# Setup swig generation
########################################################################
+include(GrPython)
include(GrSwig)
-########################################################################
-# Create the master gengen swig include files
-########################################################################
-set(generated_index ${CMAKE_CURRENT_BINARY_DIR}/digital_generated.i.in)
-file(WRITE ${generated_index} "
-//
-// This file is machine generated. All edits will be overwritten
-//
-")
-
-file(APPEND ${generated_index} "%include \"gnuradio.i\"\n\n")
-file(APPEND ${generated_index} "%{\n")
-
-foreach(swig_file ${generated_swigs})
- get_filename_component(name ${swig_file} NAME_WE)
- file(APPEND ${generated_index} "#include<${name}.h>\n")
-endforeach(swig_file)
-file(APPEND ${generated_index} "%}\n")
-
-foreach(swig_file ${generated_swigs})
- get_filename_component(name ${swig_file} NAME)
- file(APPEND ${generated_index} "%include<${name}>\n")
-endforeach(swig_file)
-
-execute_process(
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
- ${generated_index} ${CMAKE_CURRENT_BINARY_DIR}/digital_generated.i
-)
-
set(GR_SWIG_INCLUDE_DIRS
${GR_DIGITAL_INCLUDE_DIRS}
+ ${GNURADIO_CORE_INCLUDE_DIRS}
${GNURADIO_CORE_SWIG_INCLUDE_DIRS}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}/../include
)
-# Setup swig docs to depend on includes and pull in from build directory
-set(GR_SWIG_LIBRARIES gnuradio-digital)
-set(GR_SWIG_TARGET_DEPS digital_generated_includes core_swig)
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/digital_swig_doc.i)
-set(GR_SWIG_DOC_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/../include
- ${CMAKE_CURRENT_BINARY_DIR}/../include)
+set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../lib)
+
+set(GR_SWIG_LIBRARIES gnuradio-digital)
+
GR_SWIG_MAKE(digital_swig digital_swig.i)
+
GR_SWIG_INSTALL(
TARGETS digital_swig
DESTINATION ${GR_PYTHON_DIR}/gnuradio/digital
@@ -129,50 +46,6 @@ install(
FILES
digital_swig.i
${CMAKE_CURRENT_BINARY_DIR}/digital_swig_doc.i
- ${CMAKE_CURRENT_BINARY_DIR}/digital_generated.i
- ${generated_swigs}
- digital_additive_scrambler_bb.i
- digital_binary_slicer_fb.i
- digital_bytes_to_syms.i
- digital_clock_recovery_mm_cc.i
- digital_clock_recovery_mm_ff.i
- digital_cma_equalizer_cc.i
- digital_constellation.i
- digital_constellation_receiver_cb.i
- digital_constellation_decoder_cb.i
- digital_correlate_access_code_bb.i
- digital_correlate_access_code_tag_bb.i
- digital_costas_loop_cc.i
- digital_cpmmod_bc.i
- digital_crc32.i
- digital_descrambler_bb.i
- digital_diff_decoder_bb.i
- digital_diff_encoder_bb.i
- digital_diff_phasor_cc.i
- digital_fll_band_edge_cc.i
- digital_framer_sink_1.i
- digital_glfsr_source_b.i
- digital_glfsr_source_f.i
- digital_gmskmod_bc.i
- digital_lms_dd_equalizer_cc.i
- digital_kurtotic_equalizer_cc.i
- digital_map_bb.i
- digital_mpsk_receiver_cc.i
- digital_mpsk_snr_est_cc.i
- digital_ofdm_cyclic_prefixer.i
- digital_ofdm_frame_acquisition.i
- digital_ofdm_frame_sink.i
- digital_ofdm_insert_preamble.i
- digital_ofdm_mapper_bcv.i
- digital_ofdm_sampler.i
- digital_packet_sink.i
- digital_pfb_clock_sync_ccf.i
- digital_pfb_clock_sync_fff.i
- digital_pn_correlator_cc.i
- digital_probe_density_b.i
- digital_probe_mpsk_snr_est_c.i
- digital_scrambler_bb.i
- digital_simple_framer.i
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
COMPONENT "digital_swig"
)
diff --git a/gr-digital/swig/digital_additive_scrambler_bb.i b/gr-digital/swig/digital_additive_scrambler_bb.i
deleted file mode 100644
index b063f06725..0000000000
--- a/gr-digital/swig/digital_additive_scrambler_bb.i
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2008,2010,2012 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,additive_scrambler_bb);
-
-digital_additive_scrambler_bb_sptr
-digital_make_additive_scrambler_bb(int mask, int seed,
- int len, int count=0);
-
-class digital_additive_scrambler_bb : public gr_sync_block
-{
-};
diff --git a/gr-digital/swig/digital_swig.i b/gr-digital/swig/digital_swig.i
index 191076d75c..92d701c13f 100644
--- a/gr-digital/swig/digital_swig.i
+++ b/gr-digital/swig/digital_swig.i
@@ -19,109 +19,29 @@
* Boston, MA 02110-1301, USA.
*/
+#define DIGITAL_API
+
%include "gnuradio.i"
//load generated python docstrings
%include "digital_swig_doc.i"
-#if SWIGPYTHON
-enum snr_est_type_t {
- SNR_EST_SIMPLE = 0, // Simple estimator (>= 7 dB)
- SNR_EST_SKEW, // Skewness-base est (>= 5 dB)
- SNR_EST_M2M4, // 2nd & 4th moment est (>= 1 dB)
- SNR_EST_SVR // SVR-based est (>= 0dB)
-};
-#endif
-
-%include <gri_control_loop.i>
+//#if SWIGPYTHON
+//enum snr_est_type_t {
+// SNR_EST_SIMPLE = 0, // Simple estimator (>= 7 dB)
+// SNR_EST_SKEW, // Skewness-base est (>= 5 dB)
+// SNR_EST_M2M4, // 2nd & 4th moment est (>= 1 dB)
+// SNR_EST_SVR // SVR-based est (>= 0dB)
+//};
+//#endif
-// Bring in generated blocks
-%include "digital_generated.i"
+//%include <gri_control_loop.i>
%{
-#include "digital_additive_scrambler_bb.h"
-#include "digital_binary_slicer_fb.h"
-#include "digital_bytes_to_syms.h"
-#include "digital_clock_recovery_mm_cc.h"
-#include "digital_clock_recovery_mm_ff.h"
-#include "digital_cma_equalizer_cc.h"
-#include "digital_constellation.h"
-#include "digital_constellation_decoder_cb.h"
-#include "digital_constellation_receiver_cb.h"
-#include "digital_correlate_access_code_bb.h"
-#include "digital_correlate_access_code_tag_bb.h"
-#include "digital_costas_loop_cc.h"
-#include "digital_cpmmod_bc.h"
-#include "digital_crc32.h"
-#include "digital_descrambler_bb.h"
-#include "digital_diff_decoder_bb.h"
-#include "digital_diff_encoder_bb.h"
-#include "digital_diff_phasor_cc.h"
-#include "digital_fll_band_edge_cc.h"
-#include "digital_framer_sink_1.h"
-#include "digital_glfsr_source_b.h"
-#include "digital_glfsr_source_f.h"
-#include "digital_gmskmod_bc.h"
-#include "digital_kurtotic_equalizer_cc.h"
-#include "digital_lms_dd_equalizer_cc.h"
-#include "digital_map_bb.h"
-#include "digital_mpsk_receiver_cc.h"
-#include "digital_mpsk_snr_est_cc.h"
-#include "digital_ofdm_cyclic_prefixer.h"
-#include "digital_ofdm_frame_acquisition.h"
-#include "digital_ofdm_frame_sink.h"
-#include "digital_ofdm_insert_preamble.h"
-#include "digital_ofdm_mapper_bcv.h"
-#include "digital_ofdm_sampler.h"
-#include "digital_packet_sink.h"
-#include "digital_pfb_clock_sync_ccf.h"
-#include "digital_pfb_clock_sync_fff.h"
-#include "digital_pn_correlator_cc.h"
-#include "digital_probe_density_b.h"
-#include "digital_probe_mpsk_snr_est_c.h"
-#include "digital_scrambler_bb.h"
-#include "digital_simple_framer.h"
+#include "digital/additive_scrambler_bb.h"
%}
-%include "digital_additive_scrambler_bb.i"
-%include "digital_bytes_to_syms.i"
-%include "digital_binary_slicer_fb.i"
-%include "digital_clock_recovery_mm_cc.i"
-%include "digital_clock_recovery_mm_ff.i"
-%include "digital_cma_equalizer_cc.i"
-%include "digital_constellation.i"
-%include "digital_constellation_decoder_cb.i"
-%include "digital_constellation_receiver_cb.i"
-%include "digital_correlate_access_code_bb.i"
-%include "digital_correlate_access_code_tag_bb.i"
-%include "digital_costas_loop_cc.i"
-%include "digital_cpmmod_bc.i"
-%include "digital_crc32.i"
-%include "digital_descrambler_bb.i"
-%include "digital_diff_decoder_bb.i"
-%include "digital_diff_encoder_bb.i"
-%include "digital_diff_phasor_cc.i"
-%include "digital_fll_band_edge_cc.i"
-%include "digital_framer_sink_1.i"
-%include "digital_glfsr_source_b.i"
-%include "digital_glfsr_source_f.i"
-%include "digital_gmskmod_bc.i"
-%include "digital_kurtotic_equalizer_cc.i"
-%include "digital_lms_dd_equalizer_cc.i"
-%include "digital_map_bb.i"
-%include "digital_mpsk_receiver_cc.i"
-%include "digital_mpsk_snr_est_cc.i"
-%include "digital_ofdm_cyclic_prefixer.i"
-%include "digital_ofdm_frame_acquisition.i"
-%include "digital_ofdm_frame_sink.i"
-%include "digital_ofdm_insert_preamble.i"
-%include "digital_ofdm_mapper_bcv.i"
-%include "digital_ofdm_sampler.i"
-%include "digital_packet_sink.i"
-%include "digital_pfb_clock_sync_ccf.i"
-%include "digital_pfb_clock_sync_fff.i"
-%include "digital_pn_correlator_cc.i"
-%include "digital_probe_density_b.i"
-%include "digital_probe_mpsk_snr_est_c.i"
-%include "digital_scrambler_bb.i"
-%include "digital_simple_framer.i"
+%include "digital/additive_scrambler_bb.h"
+
+GR_SWIG_BLOCK_MAGIC2(digital, additive_scrambler_bb);
+