diff options
author | Tom Rondeau <trondeau@vt.edu> | 2012-08-09 20:48:18 -0400 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2012-08-09 20:48:18 -0400 |
commit | 45502b80d28e2051f5f7780e0c386147f0976798 (patch) | |
tree | 2bd7f2b14c074dc354948f514e0e9af679bd09e2 | |
parent | 38069c9ac14b44597ee053486ca00838c758a47c (diff) |
digital: converted binary_slicer_fb to new style.
Also removed bytes_to_syms. This had been deprecated for a while.
-rw-r--r-- | gr-digital/include/digital/CMakeLists.txt | 3 | ||||
-rw-r--r-- | gr-digital/include/digital/additive_scrambler_bb.h | 1 | ||||
-rw-r--r-- | gr-digital/include/digital/binary_slicer_fb.h (renamed from gr-digital/include/digital_binary_slicer_fb.h) | 50 | ||||
-rw-r--r-- | gr-digital/include/digital_bytes_to_syms.h | 62 | ||||
-rw-r--r-- | gr-digital/include/digital_constellation.h | 2 | ||||
-rw-r--r-- | gr-digital/lib/CMakeLists.txt | 85 | ||||
-rw-r--r-- | gr-digital/lib/additive_scrambler_bb_impl.h | 2 | ||||
-rw-r--r-- | gr-digital/lib/binary_slicer_fb_impl.cc (renamed from gr-digital/lib/digital_binary_slicer_fb.cc) | 63 | ||||
-rw-r--r-- | gr-digital/lib/binary_slicer_fb_impl.h (renamed from gr-digital/swig/digital_bytes_to_syms.i) | 36 | ||||
-rw-r--r-- | gr-digital/lib/digital_bytes_to_syms.cc | 74 | ||||
-rw-r--r-- | gr-digital/swig/digital_swig.i | 3 |
11 files changed, 135 insertions, 246 deletions
diff --git a/gr-digital/include/digital/CMakeLists.txt b/gr-digital/include/digital/CMakeLists.txt index c6384ecd6e..8eb5eef883 100644 --- a/gr-digital/include/digital/CMakeLists.txt +++ b/gr-digital/include/digital/CMakeLists.txt @@ -79,8 +79,7 @@ install(FILES # impl_glfsr.h # impl_mpsk_snr_est.h additive_scrambler_bb.h -# binary_slicer_fb.h -# bytes_to_syms.h + binary_slicer_fb.h # clock_recovery_mm_cc.h # clock_recovery_mm_ff.h # cma_equalizer_cc.h diff --git a/gr-digital/include/digital/additive_scrambler_bb.h b/gr-digital/include/digital/additive_scrambler_bb.h index b7322f6a0b..b5689b2744 100644 --- a/gr-digital/include/digital/additive_scrambler_bb.h +++ b/gr-digital/include/digital/additive_scrambler_bb.h @@ -70,5 +70,4 @@ namespace gr { } /* namespace digital */ } /* namespace gr */ - #endif /* INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_H */ diff --git a/gr-digital/include/digital_binary_slicer_fb.h b/gr-digital/include/digital/binary_slicer_fb.h index 35a7380fb9..7a3a1e9a0a 100644 --- a/gr-digital/include/digital_binary_slicer_fb.h +++ b/gr-digital/include/digital/binary_slicer_fb.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006,2011 Free Software Foundation, Inc. + * Copyright 2006,2011,2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,31 +23,33 @@ #ifndef INCLUDED_DIGITAL_BINARY_SLICER_FB_H #define INCLUDED_DIGITAL_BINARY_SLICER_FB_H -#include <digital_api.h> +#include <digital/api.h> #include <gr_sync_block.h> -class digital_binary_slicer_fb; -typedef boost::shared_ptr<digital_binary_slicer_fb> digital_binary_slicer_fb_sptr; +namespace gr { + namespace digital { + + /*! + * \brief slice float binary symbol outputting 1 bit output + * \ingroup converter_blk + * \ingroup digital + * + * x < 0 --> 0 + * x >= 0 --> 1 + */ + class DIGITAL_API binary_slicer_fb : virtual public gr_sync_block + { + public: + // gr::digital::binary_slicer_fb::sptr + typedef boost::shared_ptr<binary_slicer_fb> sptr; -DIGITAL_API digital_binary_slicer_fb_sptr digital_make_binary_slicer_fb (); + /*! + * \brief Make binary symbol slicer block. + */ + sptr make(); + }; -/*! - * \brief slice float binary symbol outputting 1 bit output - * \ingroup converter_blk - * \ingroup digital - * - * x < 0 --> 0 - * x >= 0 --> 1 - */ -class DIGITAL_API digital_binary_slicer_fb : public gr_sync_block -{ - friend DIGITAL_API digital_binary_slicer_fb_sptr digital_make_binary_slicer_fb (); - digital_binary_slicer_fb (); - - public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; + } /* namespace digital */ +} /* namespace gr */ -#endif +#endif /* INCLUDED_DIGITAL_BINARY_SLICER_FB_H */ diff --git a/gr-digital/include/digital_bytes_to_syms.h b/gr-digital/include/digital_bytes_to_syms.h deleted file mode 100644 index c1857c8cf2..0000000000 --- a/gr-digital/include/digital_bytes_to_syms.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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_BYTES_TO_SYMS_H -#define INCLUDED_GR_BYTES_TO_SYMS_H - -#include <digital_api.h> -#include <gr_sync_interpolator.h> - -class digital_bytes_to_syms; -typedef boost::shared_ptr<digital_bytes_to_syms> digital_bytes_to_syms_sptr; - -DIGITAL_API digital_bytes_to_syms_sptr digital_make_bytes_to_syms(); - -/*! - * \brief Convert stream of bytes to stream of +/- 1 symbols - * \ingroup converter_blk - * - * input: stream of bytes; output: stream of float - * - * This block is deprecated. - * - * The combination of gr_packed_to_unpacked_bb followed by - * digital_chunks_to_symbols_bf or digital_chunks_to_symbols_bc handles the - * general case of mapping from a stream of bytes into arbitrary float - * or complex symbols. - * - * \sa gr_packed_to_unpacked_bb, gr_unpacked_to_packed_bb, - * \sa digital_chunks_to_symbols_bf, digital_chunks_to_symbols_bc. - */ -class DIGITAL_API digital_bytes_to_syms : public gr_sync_interpolator -{ - friend DIGITAL_API digital_bytes_to_syms_sptr - digital_make_bytes_to_syms(); - - digital_bytes_to_syms(); - - public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_BYTES_TO_SYMS_H */ diff --git a/gr-digital/include/digital_constellation.h b/gr-digital/include/digital_constellation.h index a72bfb74c5..0e0c817d7a 100644 --- a/gr-digital/include/digital_constellation.h +++ b/gr-digital/include/digital_constellation.h @@ -23,7 +23,7 @@ #ifndef INCLUDED_DIGITAL_CONSTELLATION_H #define INCLUDED_DIGITAL_CONSTELLATION_H -#include <digital_api.h> +#include <digital/api.h> #include <vector> #include <math.h> #include <gr_complex.h> diff --git a/gr-digital/lib/CMakeLists.txt b/gr-digital/lib/CMakeLists.txt index 15107a6ad1..d016570158 100644 --- a/gr-digital/lib/CMakeLists.txt +++ b/gr-digital/lib/CMakeLists.txt @@ -91,50 +91,49 @@ endmacro(expand_cc) ######################################################################## list(APPEND gr_digital_sources ${generated_sources} - #digital_impl_glfsr.cc - #digital_impl_mpsk_snr_est.cc + #impl_glfsr.cc + #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 + binary_slicer_fb_impl.cc + #clock_recovery_mm_cc_impl.cc + #clock_recovery_mm_ff_impl.cc + #cma_equalizer_cc_impl.cc + #constellation_impl.cc + #constellation_receiver_cb_impl.cc + #constellation_decoder_cb_impl.cc + #correlate_access_code_bb_impl.cc + #correlate_access_code_tag_bb_impl.cc + #costas_loop_cc_impl.cc + #cpmmod_bc_impl.cc + #crc32_impl.cc + #descrambler_bb_impl.cc + #diff_decoder_bb_impl.cc + #diff_encoder_bb_impl.cc + #diff_phasor_cc_impl.cc + #fll_band_edge_cc_impl.cc + #framer_sink_1_impl.cc + #glfsr_source_b_impl.cc + #glfsr_source_f_impl.cc + #gmskmod_bc_impl.cc + #lms_dd_equalizer_cc_impl.cc + #kurtotic_equalizer_cc_impl.cc + #map_bb_impl.cc + #mpsk_receiver_cc_impl.cc + #mpsk_snr_est_cc_impl.cc + #ofdm_cyclic_prefixer_impl.cc + #ofdm_frame_acquisition_impl.cc + #ofdm_frame_sink_impl.cc + #ofdm_insert_preamble_impl.cc + #ofdm_mapper_bcv_impl.cc + #ofdm_sampler_impl.cc + #packet_sink_impl.cc + #pfb_clock_sync_ccf_impl.cc + #pfb_clock_sync_fff_impl.cc + #pn_correlator_cc_impl.cc + #probe_density_b_impl.cc + #probe_mpsk_snr_est_c_impl.cc + #scrambler_bb_impl.cc + #simple_framer_impl.cc ) list(APPEND digital_libs diff --git a/gr-digital/lib/additive_scrambler_bb_impl.h b/gr-digital/lib/additive_scrambler_bb_impl.h index 51566fb0e3..f094840bfd 100644 --- a/gr-digital/lib/additive_scrambler_bb_impl.h +++ b/gr-digital/lib/additive_scrambler_bb_impl.h @@ -29,7 +29,7 @@ namespace gr { namespace digital { - class DIGITAL_API additive_scrambler_bb_impl + class additive_scrambler_bb_impl : public additive_scrambler_bb { private: diff --git a/gr-digital/lib/digital_binary_slicer_fb.cc b/gr-digital/lib/binary_slicer_fb_impl.cc index fcdb4291fb..f8a9cf22de 100644 --- a/gr-digital/lib/digital_binary_slicer_fb.cc +++ b/gr-digital/lib/binary_slicer_fb_impl.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006,2010,2011 Free Software Foundation, Inc. + * Copyright 2006,2010-2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -24,36 +24,43 @@ #include "config.h" #endif -#include <digital_binary_slicer_fb.h> +#include "binary_slicer_fb_impl.h" #include <gr_io_signature.h> #include <gr_math.h> -#include <stdexcept> - -digital_binary_slicer_fb_sptr -digital_make_binary_slicer_fb () -{ - return gnuradio::get_initial_sptr(new digital_binary_slicer_fb ()); -} - -digital_binary_slicer_fb::digital_binary_slicer_fb () - : gr_sync_block ("binary_slicer_fb", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (unsigned char))) -{ -} - -int -digital_binary_slicer_fb::work (int noutput_items, + +namespace gr { + namespace digital { + + binary_slicer_fb::sptr binary_slicer_fb::make() + { + return gnuradio::get_initial_sptr(new binary_slicer_fb_impl()); + } + + binary_slicer_fb_impl::binary_slicer_fb_impl() + : gr_sync_block("binary_slicer_fb", + gr_make_io_signature(1, 1, sizeof(float)), + gr_make_io_signature(1, 1, sizeof(unsigned char))) + { + } + + binary_slicer_fb_impl::~binary_slicer_fb_impl() + { + } + + int + binary_slicer_fb_impl::work(int noutput_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]; - + { + const float *in = (const float *)input_items[0]; + unsigned char *out = (unsigned char *)output_items[0]; - for (int i = 0; i < noutput_items; i++){ - out[i] = gr_binary_slicer(in[i]); - } + for(int i = 0; i < noutput_items; i++) { + out[i] = gr_binary_slicer(in[i]); + } - return noutput_items; -} + return noutput_items; + } + + } /* namespace digital */ +} /* namespace gr */ diff --git a/gr-digital/swig/digital_bytes_to_syms.i b/gr-digital/lib/binary_slicer_fb_impl.h index cf23f035c4..7416d9cd52 100644 --- a/gr-digital/swig/digital_bytes_to_syms.i +++ b/gr-digital/lib/binary_slicer_fb_impl.h @@ -1,29 +1,45 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2012 Free Software Foundation, Inc. - * + * Copyright 2006,2011,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,bytes_to_syms); +#ifndef INCLUDED_DIGITAL_BINARY_SLICER_FB_IMPL_H +#define INCLUDED_DIGITAL_BINARY_SLICER_FB_IMPL_H -digital_bytes_to_syms_sptr digital_make_bytes_to_syms(); +#include <digital/binary_slicer_fb.h> -class digital_bytes_to_syms : public gr_sync_interpolator -{ -}; +namespace gr { + namespace digital { + + class binary_slicer_fb_impl : public binary_slicer_fb + { + public: + binary_slicer_fb_impl(); + ~binary_slicer_fb_impl(); + + 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_BINARY_SLICER_FB_IMPL_H */ diff --git a/gr-digital/lib/digital_bytes_to_syms.cc b/gr-digital/lib/digital_bytes_to_syms.cc deleted file mode 100644 index f8bd82d5b8..0000000000 --- a/gr-digital/lib/digital_bytes_to_syms.cc +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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_bytes_to_syms.h> -#include <gr_io_signature.h> -#include <assert.h> - -static const int BITS_PER_BYTE = 8; - -digital_bytes_to_syms_sptr -digital_make_bytes_to_syms () -{ - return gnuradio::get_initial_sptr(new digital_bytes_to_syms ()); -} - -digital_bytes_to_syms::digital_bytes_to_syms () - : gr_sync_interpolator ("bytes_to_syms", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (float)), - BITS_PER_BYTE) -{ -} - -int -digital_bytes_to_syms::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (unsigned char *) input_items[0]; - float *out = (float *) output_items[0]; - - assert (noutput_items % BITS_PER_BYTE == 0); - - for (int i = 0; i < noutput_items / BITS_PER_BYTE; i++) { - int x = in[i]; - - *out++ = (((x >> 7) & 0x1) << 1) - 1; - *out++ = (((x >> 6) & 0x1) << 1) - 1; - *out++ = (((x >> 5) & 0x1) << 1) - 1; - *out++ = (((x >> 4) & 0x1) << 1) - 1; - *out++ = (((x >> 3) & 0x1) << 1) - 1; - *out++ = (((x >> 2) & 0x1) << 1) - 1; - *out++ = (((x >> 1) & 0x1) << 1) - 1; - *out++ = (((x >> 0) & 0x1) << 1) - 1; - } - - return noutput_items; -} - - - diff --git a/gr-digital/swig/digital_swig.i b/gr-digital/swig/digital_swig.i index 92d701c13f..cb6e1c7be6 100644 --- a/gr-digital/swig/digital_swig.i +++ b/gr-digital/swig/digital_swig.i @@ -39,9 +39,12 @@ %{ #include "digital/additive_scrambler_bb.h" +#include "digital/binary_slicer_fb.h" %} %include "digital/additive_scrambler_bb.h" +%include "digital/binary_slicer_fb.h" GR_SWIG_BLOCK_MAGIC2(digital, additive_scrambler_bb); +GR_SWIG_BLOCK_MAGIC2(digital, binary_slicer_fb); |