diff options
Diffstat (limited to 'gnuradio-core/src/lib/general')
222 files changed, 1987 insertions, 5680 deletions
diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt new file mode 100644 index 000000000..cd850ca30 --- /dev/null +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -0,0 +1,294 @@ +# Copyright 2010-2011 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. + +######################################################################## +# This file included, use CMake directory variables +######################################################################## + +######################################################################## +# Handle the generated sine table +######################################################################## +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sine_table.h + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gen_sine_table.py + COMMAND ${PYTHON_EXECUTABLE} + ${CMAKE_CURRENT_SOURCE_DIR}/gen_sine_table.py > + ${CMAKE_CURRENT_BINARY_DIR}/sine_table.h +) + +include(AddFileDependencies) +ADD_FILE_DEPENDENCIES(${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt.cc + ${CMAKE_CURRENT_BINARY_DIR}/sine_table.h +) + +######################################################################## +# Handle the generated constants +######################################################################## +execute_process(COMMAND ${PYTHON_EXECUTABLE} -c + "import time;print time.strftime('%a, %d %b %Y %H:%M:%S', time.gmtime())" + OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE +) +message(STATUS "Loading build date ${BUILD_DATE} into gr_constants...") + +message(STATUS "Loading version ${VERSION} into gr_constants...") + +file(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}/${GR_CONF_DIR}" SYSCONFDIR) +file(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}/${GR_PKG_CONF_DIR}" GR_PREFSDIR) + +#double escape for windows backslash path separators +string(REPLACE "\\" "\\\\" prefix ${prefix}) +string(REPLACE "\\" "\\\\" SYSCONFDIR ${SYSCONFDIR}) +string(REPLACE "\\" "\\\\" GR_PREFSDIR ${GR_PREFSDIR}) + +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/gr_constants.cc.in + ${CMAKE_CURRENT_BINARY_DIR}/gr_constants.cc +@ONLY) + +list(APPEND gnuradio_core_sources ${CMAKE_CURRENT_BINARY_DIR}/gr_constants.cc) + +######################################################################## +# Append gnuradio-core library sources +######################################################################## +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_fft_vcc_fftw.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_misc.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_random.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gr_reverse.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_add_const_ss_generic.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_char_to_float.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_control_loop.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_debugger_hook.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_char.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_short.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_uchar.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_glfsr.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_interleaved_short_to_complex.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_short_to_float.cc + ${CMAKE_CURRENT_SOURCE_DIR}/gri_uchar_to_float.cc + ${CMAKE_CURRENT_SOURCE_DIR}/malloc16.c +) + +######################################################################## +# Append gnuradio-core test sources +######################################################################## +list(APPEND test_gnuradio_core_sources + ${CMAKE_CURRENT_SOURCE_DIR}/qa_general.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_circular_file.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_cpm.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_firdes.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fxpt.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fxpt_nco.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fxpt_vco.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_math.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_lfsr.cc +) + +######################################################################## +# Install runtime headers +######################################################################## +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_fft_vcc_fftw.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt_nco.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_fxpt_vco.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_log2_const.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_math.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_misc.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_nco.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_random.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_reverse.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_simple_framer_sync.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_test_types.h + ${CMAKE_CURRENT_SOURCE_DIR}/gr_vco.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_add_const_ss.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_cc.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_ff.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_cc.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_ff.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_char_to_float.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_control_loop.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_debugger_hook.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_char.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_short.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_uchar.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_glfsr.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_interleaved_short_to_complex.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr_15_1_0.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr_32k.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_short_to_float.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_uchar_to_float.h + ${CMAKE_CURRENT_SOURCE_DIR}/malloc16.h + ${CMAKE_CURRENT_SOURCE_DIR}/random.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "core_devel" +) + +######################################################################## +# Install swig headers +######################################################################## +if(ENABLE_PYTHON) +install(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/general.i + ${CMAKE_CURRENT_SOURCE_DIR}/gr_constants.i + ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_cc.i + ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_ff.i + ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_cc.i + ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_ff.i + ${CMAKE_CURRENT_SOURCE_DIR}/gri_control_loop.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "core_swig" +) +endif(ENABLE_PYTHON) + +######################################################################## +# Handle triple-threat files that have cc, h, and i +######################################################################## +set(gr_core_general_triple_threats + complex_vec_test + gr_additive_scrambler_bb + gr_agc_cc + gr_agc_ff + gr_agc2_cc + gr_agc2_ff + gr_align_on_samplenumbers_ss + gr_bin_statistics_f + gr_bytes_to_syms + gr_char_to_float + gr_check_counting_s + gr_check_lfsr_32k_s + gr_complex_to_interleaved_short + gr_complex_to_xxx + gr_conjugate_cc + gr_copy + gr_cpfsk_bc + gr_cpm + gr_ctcss_squelch_ff + gr_decode_ccsds_27_fb + gr_diff_decoder_bb + gr_diff_encoder_bb + gr_diff_phasor_cc + gr_dpll_bb + gr_deinterleave + gr_delay + gr_encode_ccsds_27_bb + gr_fake_channel_coder_pp + gr_feedforward_agc_cc + gr_feval + gr_fft_vcc + gr_fft_vfc + gr_firdes + gr_float_to_char + gr_float_to_complex + gr_float_to_short + gr_float_to_uchar + gr_fmdet_cf + gr_frequency_modulator_fc + gr_framer_sink_1 + gr_glfsr_source_b + gr_glfsr_source_f + gr_head + gr_int_to_float + gr_interleave + gr_interleaved_short_to_complex + gr_iqcomp_cc + gr_keep_one_in_n + gr_kludge_copy + gr_lfsr_32k_source_s + gr_map_bb + gr_nlog10_ff + gr_nop + gr_null_sink + gr_null_source + gr_pa_2x2_phase_combiner + gr_packet_sink + gr_peak_detector2_fb + gr_phase_modulator_fc + gr_pll_carriertracking_cc + gr_pll_freqdet_cf + gr_pll_refout_cc + gr_pn_correlator_cc + gr_prefs + gr_probe_avg_mag_sqrd_c + gr_probe_avg_mag_sqrd_cf + gr_probe_avg_mag_sqrd_f + gr_probe_signal_f + gr_pwr_squelch_cc + gr_pwr_squelch_ff + gr_quadrature_demod_cf + gr_rail_ff + gr_regenerate_bb + gr_remez + gr_rms_cf + gr_rms_ff + gr_repeat + gr_short_to_float + gr_simple_correlator + gr_simple_framer + gr_simple_squelch_cc + gr_skiphead + gr_squash_ff + gr_squelch_base_cc + gr_squelch_base_ff + gr_stream_mux + gr_stream_to_streams + gr_stream_to_vector + gr_streams_to_stream + gr_streams_to_vector + gr_stretch_ff + gr_test + gr_threshold_ff + gr_throttle + gr_transcendental + gr_uchar_to_float + gr_vco_f + gr_vector_to_stream + gr_vector_to_streams + gr_unpack_k_bits_bb + gr_wavelet_ff + gr_wvps_ff + gr_descrambler_bb + gr_scrambler_bb + gr_probe_mpsk_snr_c + gr_probe_density_b + gr_annotator_alltoall + gr_annotator_1to1 + gr_burst_tagger + gr_correlate_access_code_tag_bb +) + +foreach(file_tt ${gr_core_general_triple_threats}) + list(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.cc) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "core_devel") + if(ENABLE_PYTHON) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "core_swig") + endif(ENABLE_PYTHON) +endforeach(file_tt ${gr_core_general_triple_threats}) diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am index 007bedc00..260867931 100644 --- a/gnuradio-core/src/lib/general/Makefile.am +++ b/gnuradio-core/src/lib/general/Makefile.am @@ -44,24 +44,18 @@ libgeneral_la_SOURCES = \ gr_agc2_ff.cc \ gr_align_on_samplenumbers_ss.cc \ gr_bin_statistics_f.cc \ - gr_binary_slicer_fb.cc \ gr_bytes_to_syms.cc \ gr_char_to_float.cc \ gr_check_counting_s.cc \ gr_check_lfsr_32k_s.cc \ gr_circular_file.cc \ - gr_clock_recovery_mm_cc.cc \ - gr_clock_recovery_mm_ff.cc \ gr_complex_to_interleaved_short.cc \ gr_complex_to_xxx.cc \ gr_conjugate_cc.cc \ gr_copy.cc \ - gr_constellation_decoder_cb.cc \ - gr_correlate_access_code_bb.cc \ - gr_costas_loop_cc.cc \ gr_count_bits.cc \ gr_cpfsk_bc.cc \ - gr_crc32.cc \ + gr_cpm.cc \ gr_ctcss_squelch_ff.cc \ gr_decode_ccsds_27_fb.cc \ gr_deinterleave.cc \ @@ -79,7 +73,6 @@ libgeneral_la_SOURCES = \ gr_fft_vcc_fftw.cc \ gr_fft_vfc.cc \ gr_firdes.cc \ - gr_fll_band_edge_cc.cc \ gr_float_to_char.cc \ gr_float_to_complex.cc \ gr_float_to_short.cc \ @@ -97,22 +90,12 @@ libgeneral_la_SOURCES = \ gr_keep_one_in_n.cc \ gr_kludge_copy.cc \ gr_lfsr_32k_source_s.cc \ - gr_lms_dfe_cc.cc \ - gr_lms_dfe_ff.cc \ gr_map_bb.cc \ gr_misc.cc \ - gr_mpsk_receiver_cc.cc \ gr_nlog10_ff.cc \ gr_nop.cc \ gr_null_sink.cc \ gr_null_source.cc \ - gr_ofdm_frame_acquisition.cc \ - gr_ofdm_cyclic_prefixer.cc \ - gr_ofdm_demapper_vcb.cc \ - gr_ofdm_mapper_bcv.cc \ - gr_ofdm_frame_sink.cc \ - gr_ofdm_insert_preamble.cc \ - gr_ofdm_sampler.cc \ gr_pa_2x2_phase_combiner.cc \ gr_packet_sink.cc \ gr_peak_detector2_fb.cc \ @@ -165,6 +148,7 @@ libgeneral_la_SOURCES = \ gr_wvps_ff.cc \ gri_add_const_ss_generic.cc \ gri_char_to_float.cc \ + gri_control_loop.cc \ gri_debugger_hook.cc \ gri_fft.cc \ gri_float_to_char.cc \ @@ -188,6 +172,7 @@ libgeneral_la_SOURCES = \ libgeneral_qa_la_SOURCES = \ qa_general.cc \ qa_gr_circular_file.cc \ + qa_gr_cpm.cc \ qa_gr_firdes.cc \ qa_gr_fxpt.cc \ qa_gr_fxpt_nco.cc \ @@ -196,6 +181,7 @@ libgeneral_qa_la_SOURCES = \ qa_gri_lfsr.cc grinclude_HEADERS = \ + gr_core_api.h \ complex_vec_test.h \ gr_additive_scrambler_bb.h \ gr_agc_cc.h \ @@ -204,24 +190,18 @@ grinclude_HEADERS = \ gr_agc2_ff.h \ gr_align_on_samplenumbers_ss.h \ gr_bin_statistics_f.h \ - gr_binary_slicer_fb.h \ gr_bytes_to_syms.h \ gr_char_to_float.h \ gr_check_counting_s.h \ gr_check_lfsr_32k_s.h \ gr_circular_file.h \ - gr_clock_recovery_mm_cc.h \ - gr_clock_recovery_mm_ff.h \ gr_complex_to_interleaved_short.h \ gr_complex_to_xxx.h \ gr_conjugate_cc.h \ - gr_constellation_decoder_cb.h \ gr_copy.h \ - gr_correlate_access_code_bb.h \ - gr_costas_loop_cc.h \ gr_count_bits.h \ gr_cpfsk_bc.h \ - gr_crc32.h \ + gr_cpm.h \ gr_ctcss_squelch_ff.h \ gr_decode_ccsds_27_fb.h \ gr_diff_decoder_bb.h \ @@ -239,7 +219,6 @@ grinclude_HEADERS = \ gr_fft_vcc_fftw.h \ gr_fft_vfc.h \ gr_firdes.h \ - gr_fll_band_edge_cc.h \ gr_float_to_char.h \ gr_float_to_complex.h \ gr_float_to_short.h \ @@ -259,25 +238,15 @@ grinclude_HEADERS = \ gr_keep_one_in_n.h \ gr_kludge_copy.h \ gr_lfsr_32k_source_s.h \ - gr_lms_dfe_cc.h \ - gr_lms_dfe_ff.h \ gr_log2_const.h \ gr_map_bb.h \ gr_math.h \ gr_misc.h \ - gr_mpsk_receiver_cc.h \ gr_nco.h \ gr_nlog10_ff.h \ gr_nop.h \ gr_null_sink.h \ gr_null_source.h \ - gr_ofdm_frame_acquisition.h \ - gr_ofdm_cyclic_prefixer.h \ - gr_ofdm_demapper_vcb.h \ - gr_ofdm_mapper_bcv.h \ - gr_ofdm_frame_sink.h \ - gr_ofdm_insert_preamble.h \ - gr_ofdm_sampler.h \ gr_pa_2x2_phase_combiner.h \ gr_packet_sink.h \ gr_peak_detector2_fb.h \ @@ -337,6 +306,7 @@ grinclude_HEADERS = \ gri_agc2_cc.h \ gri_agc2_ff.h \ gri_char_to_float.h \ + gri_control_loop.h \ gri_debugger_hook.h \ gri_fft.h \ gri_float_to_char.h \ @@ -364,6 +334,7 @@ grinclude_HEADERS = \ noinst_HEADERS = \ qa_general.h \ qa_gr_circular_file.h \ + qa_gr_cpm.h \ qa_gr_firdes.h \ qa_gr_fxpt.h \ qa_gr_fxpt_nco.h \ @@ -382,22 +353,16 @@ swiginclude_HEADERS = \ gr_agc2_ff.i \ gr_align_on_samplenumbers_ss.i \ gr_bin_statistics_f.i \ - gr_binary_slicer_fb.i \ gr_bytes_to_syms.i \ gr_char_to_float.i \ gr_check_counting_s.i \ gr_check_lfsr_32k_s.i \ - gr_clock_recovery_mm_cc.i \ - gr_clock_recovery_mm_ff.i \ gr_complex_to_interleaved_short.i \ gr_complex_to_xxx.i \ gr_conjugate_cc.i \ - gr_constellation_decoder_cb.i \ gr_copy.i \ - gr_correlate_access_code_bb.i \ - gr_costas_loop_cc.i \ gr_cpfsk_bc.i \ - gr_crc32.i \ + gr_cpm.i \ gr_ctcss_squelch_ff.i \ gr_decode_ccsds_27_fb.i \ gr_diff_decoder_bb.i \ @@ -413,7 +378,6 @@ swiginclude_HEADERS = \ gr_fft_vcc.i \ gr_fft_vfc.i \ gr_firdes.i \ - gr_fll_band_edge_cc.i \ gr_float_to_char.i \ gr_float_to_complex.i \ gr_float_to_short.i \ @@ -431,21 +395,11 @@ swiginclude_HEADERS = \ gr_keep_one_in_n.i \ gr_kludge_copy.i \ gr_lfsr_32k_source_s.i \ - gr_lms_dfe_cc.i \ - gr_lms_dfe_ff.i \ gr_map_bb.i \ - gr_mpsk_receiver_cc.i \ gr_nlog10_ff.i \ gr_nop.i \ gr_null_sink.i \ gr_null_source.i \ - gr_ofdm_frame_acquisition.i \ - gr_ofdm_cyclic_prefixer.i \ - gr_ofdm_demapper_vcb.i \ - gr_ofdm_mapper_bcv.i \ - gr_ofdm_frame_sink.i \ - gr_ofdm_insert_preamble.i \ - gr_ofdm_sampler.i \ gr_pa_2x2_phase_combiner.i \ gr_packet_sink.i \ gr_peak_detector2_fb.i \ @@ -498,6 +452,7 @@ swiginclude_HEADERS = \ gri_agc_ff.i \ gri_agc2_cc.i \ gri_agc2_ff.i \ + gri_control_loop.i \ gr_descrambler_bb.i \ gr_scrambler_bb.i \ gr_probe_mpsk_snr_c.i \ diff --git a/gnuradio-core/src/lib/general/complex_vec_test.h b/gnuradio-core/src/lib/general/complex_vec_test.h index d13dedf63..be4de41fb 100644 --- a/gnuradio-core/src/lib/general/complex_vec_test.h +++ b/gnuradio-core/src/lib/general/complex_vec_test.h @@ -1,27 +1,28 @@ +#include <gr_core_api.h> #include <vector> #include <complex> -std::vector<std::complex<float> > +GR_CORE_API std::vector<std::complex<float> > complex_vec_test0(); -std::vector<std::complex<float> > +GR_CORE_API std::vector<std::complex<float> > complex_vec_test1(const std::vector<std::complex<float> > &input); -std::complex<float> +GR_CORE_API std::complex<float> complex_scalar_test0(); -std::complex<float> +GR_CORE_API std::complex<float> complex_scalar_test1(std::complex<float> input); -std::vector<int> +GR_CORE_API std::vector<int> int_vec_test0(); -std::vector<int> +GR_CORE_API std::vector<int> int_vec_test1(const std::vector<int> &input); -std::vector<float> +GR_CORE_API std::vector<float> float_vec_test0(); -std::vector<float> +GR_CORE_API std::vector<float> float_vec_test1(const std::vector<float> &input); diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index beedeb0a9..0a3200741 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc. + * Copyright 2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -22,6 +22,7 @@ %{ +#include <gri_control_loop.h> #include <gr_nop.h> #include <gr_null_sink.h> #include <gr_null_source.h> @@ -70,7 +71,6 @@ #include <gr_fake_channel_coder_pp.h> #include <gr_throttle.h> #include <gr_transcendental.h> -#include <gr_mpsk_receiver_cc.h> #include <gr_stream_mux.h> #include <gr_stream_to_streams.h> #include <gr_streams_to_stream.h> @@ -78,13 +78,8 @@ #include <gr_vector_to_streams.h> #include <gr_conjugate_cc.h> #include <gr_vco_f.h> -#include <gr_crc32.h> #include <gr_threshold_ff.h> -#include <gr_clock_recovery_mm_ff.h> -#include <gr_clock_recovery_mm_cc.h> #include <gr_packet_sink.h> -#include <gr_lms_dfe_cc.h> -#include <gr_lms_dfe_ff.h> #include <gr_dpll_bb.h> #include <gr_fmdet_cf.h> #include <gr_pll_freqdet_cf.h> @@ -95,14 +90,7 @@ #include <gr_probe_avg_mag_sqrd_cf.h> #include <gr_probe_avg_mag_sqrd_f.h> #include <gr_probe_signal_f.h> -#include <gr_ofdm_frame_acquisition.h> -#include <gr_ofdm_cyclic_prefixer.h> -#include <gr_ofdm_mapper_bcv.h> -#include <gr_ofdm_frame_sink.h> -#include <gr_ofdm_insert_preamble.h> -#include <gr_ofdm_sampler.h> #include <gr_regenerate_bb.h> -#include <gr_costas_loop_cc.h> #include <gr_pa_2x2_phase_combiner.h> #include <gr_kludge_copy.h> #include <gr_prefs.h> @@ -110,10 +98,7 @@ #include <gr_test_types.h> #include <gr_test.h> #include <gr_unpack_k_bits_bb.h> -#include <gr_correlate_access_code_bb.h> #include <gr_diff_phasor_cc.h> -#include <gr_constellation_decoder_cb.h> -#include <gr_binary_slicer_fb.h> #include <gr_diff_encoder_bb.h> #include <gr_diff_decoder_bb.h> #include <gr_framer_sink_1.h> @@ -141,15 +126,16 @@ #include <gr_wavelet_ff.h> #include <gr_wvps_ff.h> #include <gr_copy.h> -#include <gr_fll_band_edge_cc.h> #include <gr_additive_scrambler_bb.h> #include <complex_vec_test.h> #include <gr_annotator_alltoall.h> #include <gr_annotator_1to1.h> #include <gr_burst_tagger.h> +#include <gr_cpm.h> #include <gr_correlate_access_code_tag_bb.h> %} +%include "gri_control_loop.i" %include "gr_nop.i" %include "gr_null_sink.i" %include "gr_null_source.i" @@ -198,7 +184,6 @@ %include "gr_fake_channel_coder_pp.i" %include "gr_throttle.i" %include "gr_transcendental.i" -%include "gr_mpsk_receiver_cc.i" %include "gr_stream_mux.i" %include "gr_stream_to_streams.i" %include "gr_streams_to_stream.i" @@ -206,13 +191,8 @@ %include "gr_vector_to_streams.i" %include "gr_conjugate_cc.i" %include "gr_vco_f.i" -%include "gr_crc32.i" %include "gr_threshold_ff.i" -%include "gr_clock_recovery_mm_ff.i" -%include "gr_clock_recovery_mm_cc.i" %include "gr_packet_sink.i" -%include "gr_lms_dfe_cc.i" -%include "gr_lms_dfe_ff.i" %include "gr_dpll_bb.i" %include "gr_fmdet_cf.i" %include "gr_pll_freqdet_cf.i" @@ -223,14 +203,7 @@ %include "gr_probe_avg_mag_sqrd_cf.i" %include "gr_probe_avg_mag_sqrd_f.i" %include "gr_probe_signal_f.i" -%include "gr_ofdm_frame_acquisition.i" -%include "gr_ofdm_cyclic_prefixer.i" -%include "gr_ofdm_mapper_bcv.i" -%include "gr_ofdm_frame_sink.i" -%include "gr_ofdm_insert_preamble.i" -%include "gr_ofdm_sampler.i" %include "gr_regenerate_bb.i" -%include "gr_costas_loop_cc.i" %include "gr_pa_2x2_phase_combiner.i" %include "gr_kludge_copy.i" %include "gr_prefs.i" @@ -238,10 +211,7 @@ %include "gr_test_types.h" %include "gr_test.i" %include "gr_unpack_k_bits_bb.i" -%include "gr_correlate_access_code_bb.i" %include "gr_diff_phasor_cc.i" -%include "gr_constellation_decoder_cb.i" -%include "gr_binary_slicer_fb.i" %include "gr_diff_encoder_bb.i" %include "gr_diff_decoder_bb.i" %include "gr_framer_sink_1.i" @@ -269,10 +239,10 @@ %include "gr_wavelet_ff.i" %include "gr_wvps_ff.i" %include "gr_copy.i" -%include "gr_fll_band_edge_cc.i" %include "gr_additive_scrambler_bb.i" %include "complex_vec_test.i" %include "gr_annotator_alltoall.i" %include "gr_annotator_1to1.i" %include "gr_burst_tagger.i" +%include "gr_cpm.i" %include "gr_correlate_access_code_tag_bb.i" diff --git a/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.h b/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.h index 6c9493050..4c7c8f87e 100644 --- a/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.h +++ b/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H #define INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include "gri_lfsr.h" class gr_additive_scrambler_bb; typedef boost::shared_ptr<gr_additive_scrambler_bb> gr_additive_scrambler_bb_sptr; -gr_additive_scrambler_bb_sptr gr_make_additive_scrambler_bb(int mask, int seed, int len, int count=0); +GR_CORE_API gr_additive_scrambler_bb_sptr gr_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 @@ -48,9 +49,9 @@ gr_additive_scrambler_bb_sptr gr_make_additive_scrambler_bb(int mask, int seed, * \ingroup coding_blk */ -class gr_additive_scrambler_bb : public gr_sync_block +class GR_CORE_API gr_additive_scrambler_bb : public gr_sync_block { - friend gr_additive_scrambler_bb_sptr gr_make_additive_scrambler_bb(int mask, int seed, int len, int count); + friend GR_CORE_API gr_additive_scrambler_bb_sptr gr_make_additive_scrambler_bb(int mask, int seed, int len, int count); gri_lfsr d_lfsr; int d_count; diff --git a/gnuradio-core/src/lib/general/gr_agc2_cc.h b/gnuradio-core/src/lib/general/gr_agc2_cc.h index 0eb20afb9..6127c3aa7 100644 --- a/gnuradio-core/src/lib/general/gr_agc2_cc.h +++ b/gnuradio-core/src/lib/general/gr_agc2_cc.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_AGC2_CC_H #define INCLUDED_GR_AGC2_CC_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gri_agc2_cc.h> class gr_agc2_cc; typedef boost::shared_ptr<gr_agc2_cc> gr_agc2_cc_sptr; -gr_agc2_cc_sptr +GR_CORE_API gr_agc2_cc_sptr gr_make_agc2_cc (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0, float gain = 1.0, float max_gain = 0.0); /*! @@ -39,9 +40,9 @@ gr_make_agc2_cc (float attack_rate = 1e-1, float decay_rate = 1e-2, float refere * For Power the absolute value of the complex number is used. */ -class gr_agc2_cc : public gr_sync_block, public gri_agc2_cc +class GR_CORE_API gr_agc2_cc : public gr_sync_block, public gri_agc2_cc { - friend gr_agc2_cc_sptr gr_make_agc2_cc (float attack_rate, float decay_rate, float reference, + friend GR_CORE_API gr_agc2_cc_sptr gr_make_agc2_cc (float attack_rate, float decay_rate, float reference, float gain, float max_gain); gr_agc2_cc (float attack_rate, float decay_rate, float reference, float gain, float max_gain); diff --git a/gnuradio-core/src/lib/general/gr_agc2_ff.h b/gnuradio-core/src/lib/general/gr_agc2_ff.h index ef470765f..269d940d4 100644 --- a/gnuradio-core/src/lib/general/gr_agc2_ff.h +++ b/gnuradio-core/src/lib/general/gr_agc2_ff.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_AGC2_FF_H #define INCLUDED_GR_AGC2_FF_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gri_agc2_ff.h> class gr_agc2_ff; typedef boost::shared_ptr<gr_agc2_ff> gr_agc2_ff_sptr; -gr_agc2_ff_sptr +GR_CORE_API gr_agc2_ff_sptr gr_make_agc2_ff (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0, float gain = 1.0, float max_gain = 0.0); /*! @@ -38,9 +39,9 @@ gr_make_agc2_ff (float attack_rate = 1e-1, float decay_rate = 1e-2, float refere * Power is approximated by absolute value */ -class gr_agc2_ff : public gr_sync_block, public gri_agc2_ff +class GR_CORE_API gr_agc2_ff : public gr_sync_block, public gri_agc2_ff { - friend gr_agc2_ff_sptr gr_make_agc2_ff (float attack_rate, float decay_rate, + friend GR_CORE_API gr_agc2_ff_sptr gr_make_agc2_ff (float attack_rate, float decay_rate, float reference, float gain, float max_gain); gr_agc2_ff (float attack_rate, float decay_rate, float reference, float gain, float max_gain); diff --git a/gnuradio-core/src/lib/general/gr_agc_cc.h b/gnuradio-core/src/lib/general/gr_agc_cc.h index 43a5de6c7..f348fff91 100644 --- a/gnuradio-core/src/lib/general/gr_agc_cc.h +++ b/gnuradio-core/src/lib/general/gr_agc_cc.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_AGC_CC_H #define INCLUDED_GR_AGC_CC_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gri_agc_cc.h> class gr_agc_cc; typedef boost::shared_ptr<gr_agc_cc> gr_agc_cc_sptr; -gr_agc_cc_sptr +GR_CORE_API gr_agc_cc_sptr gr_make_agc_cc (float rate = 1e-4, float reference = 1.0, float gain = 1.0, float max_gain = 0.0); /*! @@ -38,9 +39,9 @@ gr_make_agc_cc (float rate = 1e-4, float reference = 1.0, * For Power the absolute value of the complex number is used. */ -class gr_agc_cc : public gr_sync_block, public gri_agc_cc +class GR_CORE_API gr_agc_cc : public gr_sync_block, public gri_agc_cc { - friend gr_agc_cc_sptr gr_make_agc_cc (float rate, float reference, + friend GR_CORE_API gr_agc_cc_sptr gr_make_agc_cc (float rate, float reference, float gain, float max_gain); gr_agc_cc (float rate, float reference, float gain, float max_gain); diff --git a/gnuradio-core/src/lib/general/gr_agc_ff.h b/gnuradio-core/src/lib/general/gr_agc_ff.h index 7cb167fca..94db9eef5 100644 --- a/gnuradio-core/src/lib/general/gr_agc_ff.h +++ b/gnuradio-core/src/lib/general/gr_agc_ff.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_AGC_FF_H #define INCLUDED_GR_AGC_FF_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gri_agc_ff.h> class gr_agc_ff; typedef boost::shared_ptr<gr_agc_ff> gr_agc_ff_sptr; -gr_agc_ff_sptr +GR_CORE_API gr_agc_ff_sptr gr_make_agc_ff (float rate = 1e-4, float reference = 1.0, float gain = 1.0, float max_gain = 0.0); @@ -39,9 +40,9 @@ gr_make_agc_ff (float rate = 1e-4, float reference = 1.0, * Power is approximated by absolute value */ -class gr_agc_ff : public gr_sync_block, public gri_agc_ff +class GR_CORE_API gr_agc_ff : public gr_sync_block, public gri_agc_ff { - friend gr_agc_ff_sptr gr_make_agc_ff (float rate, float reference, + friend GR_CORE_API gr_agc_ff_sptr gr_make_agc_ff (float rate, float reference, float gain, float max_gain); gr_agc_ff (float rate, float reference, float gain, float max_gain); diff --git a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.h b/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.h index 5038e168b..61f70ee96 100644 --- a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.h +++ b/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_ALIGN_ON_SAMPLE_NUMBERS_SS_H #define INCLUDED_GR_ALIGN_ON_SAMPLE_NUMBERS_SS_H +#include <gr_core_api.h> #include <gr_block.h> /*! @@ -45,19 +46,19 @@ class gr_align_on_samplenumbers_ss; typedef boost::shared_ptr<gr_align_on_samplenumbers_ss> gr_align_on_samplenumbers_ss_sptr; -gr_align_on_samplenumbers_ss_sptr gr_make_align_on_samplenumbers_ss (int nchan=2, int align_interval=128); +GR_CORE_API gr_align_on_samplenumbers_ss_sptr gr_make_align_on_samplenumbers_ss (int nchan=2, int align_interval=128); -class gr_align_on_samplenumbers_ss : public gr_block +class GR_CORE_API gr_align_on_samplenumbers_ss : public gr_block { int d_align_interval; int d_sample_counter; int d_nchan; bool d_in_presync; unsigned int d_ninputs; - class align_state { + class GR_CORE_API align_state { public: unsigned int ucounter_end; unsigned int ucounter_begin; @@ -72,7 +73,7 @@ class gr_align_on_samplenumbers_ss : public gr_block }; std::vector<align_state> d_state; - friend gr_align_on_samplenumbers_ss_sptr gr_make_align_on_samplenumbers_ss (int nchan,int align_interval); + friend GR_CORE_API gr_align_on_samplenumbers_ss_sptr gr_make_align_on_samplenumbers_ss (int nchan,int align_interval); gr_align_on_samplenumbers_ss (int nchan,int align_interval); public: diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc index 511b356e5..d12bfbf04 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc @@ -69,10 +69,10 @@ gr_annotator_1to1::work (int noutput_items, for(int i = 0; i < ninputs; i++) { abs_N = nitems_read(i); - std::vector<pmt::pmt_t> all_tags; + std::vector<gr_tag_t> all_tags; get_tags_in_range(all_tags, i, abs_N, abs_N + noutput_items); - std::vector<pmt::pmt_t>::iterator itr; + std::vector<gr_tag_t>::iterator itr; for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { d_stored_tags.push_back(*itr); } diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.h b/gnuradio-core/src/lib/general/gr_annotator_1to1.h index 4abc5b051..a62720224 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.h +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_ANNOTATOR_1TO1_H #define INCLUDED_GR_ANNOTATOR_1TO1_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_annotator_1to1; typedef boost::shared_ptr<gr_annotator_1to1> gr_annotator_1to1_sptr; // public constructor -gr_annotator_1to1_sptr +GR_CORE_API gr_annotator_1to1_sptr gr_make_annotator_1to1 (int when, size_t sizeof_stream_item); /*! @@ -45,7 +46,7 @@ gr_make_annotator_1to1 (int when, size_t sizeof_stream_item); * * This block is only meant for testing and showing how to use the tags. */ -class gr_annotator_1to1 : public gr_sync_block +class GR_CORE_API gr_annotator_1to1 : public gr_sync_block { public: ~gr_annotator_1to1 (); @@ -53,7 +54,7 @@ class gr_annotator_1to1 : public gr_sync_block gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); - std::vector<pmt::pmt_t> data() const + std::vector<gr_tag_t> data() const { return d_stored_tags; } @@ -65,9 +66,9 @@ protected: size_t d_itemsize; uint64_t d_when; uint64_t d_tag_counter; - std::vector<pmt::pmt_t> d_stored_tags; + std::vector<gr_tag_t> d_stored_tags; - friend gr_annotator_1to1_sptr + friend GR_CORE_API gr_annotator_1to1_sptr gr_make_annotator_1to1 (int when, size_t sizeof_stream_item); }; diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.i b/gnuradio-core/src/lib/general/gr_annotator_1to1.i index f29ecbf53..2c8149a3c 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_1to1.i +++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2010 Free Software Foundation, Inc. + * Copyright 2010-2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -22,15 +22,4 @@ GR_SWIG_BLOCK_MAGIC(gr,annotator_1to1); -gr_annotator_1to1_sptr gr_make_annotator_1to1 (int when, - size_t sizeof_stream_item); - -class gr_annotator_1to1 : public gr_sync_block -{ -public: - std::vector<pmt::pmt_t> data() const; - -private: - gr_annotator_1to1 (int when, size_t sizeof_stream_item); -}; - +%include <gr_annotator_1to1.h> diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc index 344fd088b..dd31bff78 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc +++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc @@ -70,10 +70,10 @@ gr_annotator_alltoall::work (int noutput_items, abs_N = nitems_read(i); end_N = abs_N + (uint64_t)(noutput_items); - std::vector<pmt::pmt_t> all_tags; + std::vector<gr_tag_t> all_tags; get_tags_in_range(all_tags, i, abs_N, end_N); - std::vector<pmt::pmt_t>::iterator itr; + std::vector<gr_tag_t>::iterator itr; for(itr = all_tags.begin(); itr != all_tags.end(); itr++) { d_stored_tags.push_back(*itr); } diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.h b/gnuradio-core/src/lib/general/gr_annotator_alltoall.h index e1e51ebf3..fe8b736c2 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.h +++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_ANNOTATOR_ALLTOALL_H #define INCLUDED_GR_ANNOTATOR_ALLTOALL_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_annotator_alltoall; typedef boost::shared_ptr<gr_annotator_alltoall> gr_annotator_alltoall_sptr; // public constructor -gr_annotator_alltoall_sptr +GR_CORE_API gr_annotator_alltoall_sptr gr_make_annotator_alltoall (int when, size_t sizeof_stream_item); /*! @@ -45,7 +46,7 @@ gr_make_annotator_alltoall (int when, size_t sizeof_stream_item); * * This block is only meant for testing and showing how to use the tags. */ -class gr_annotator_alltoall : public gr_sync_block +class GR_CORE_API gr_annotator_alltoall : public gr_sync_block { public: ~gr_annotator_alltoall (); @@ -54,7 +55,7 @@ class gr_annotator_alltoall : public gr_sync_block gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); - std::vector<pmt::pmt_t> data() const + std::vector<gr_tag_t> data() const { return d_stored_tags; } @@ -66,9 +67,9 @@ protected: size_t d_itemsize; uint64_t d_when; uint64_t d_tag_counter; - std::vector<pmt::pmt_t> d_stored_tags; + std::vector<gr_tag_t> d_stored_tags; - friend gr_annotator_alltoall_sptr + friend GR_CORE_API gr_annotator_alltoall_sptr gr_make_annotator_alltoall (int when, size_t sizeof_stream_item); }; diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.i b/gnuradio-core/src/lib/general/gr_annotator_alltoall.i index f9bf6dd9a..49bd1e446 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_alltoall.i +++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2010 Free Software Foundation, Inc. + * Copyright 2010-2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -22,15 +22,4 @@ GR_SWIG_BLOCK_MAGIC(gr,annotator_alltoall); -gr_annotator_alltoall_sptr gr_make_annotator_alltoall (int when, - size_t sizeof_stream_item); - -class gr_annotator_alltoall : public gr_sync_block -{ -public: - std::vector<pmt::pmt_t> data() const; - -private: - gr_annotator_alltoall (int when, size_t sizeof_stream_item); -}; - +%include <gr_annotator_alltoall.h> diff --git a/gnuradio-core/src/lib/general/gr_bin_statistics_f.h b/gnuradio-core/src/lib/general/gr_bin_statistics_f.h index d8c4c2fae..f7eea7d5f 100644 --- a/gnuradio-core/src/lib/general/gr_bin_statistics_f.h +++ b/gnuradio-core/src/lib/general/gr_bin_statistics_f.h @@ -24,6 +24,7 @@ #define INCLUDED_GR_BIN_STATISTICS_F_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_feval.h> #include <gr_message.h> @@ -33,7 +34,7 @@ class gr_bin_statistics_f; typedef boost::shared_ptr<gr_bin_statistics_f> gr_bin_statistics_f_sptr; -gr_bin_statistics_f_sptr +GR_CORE_API gr_bin_statistics_f_sptr gr_make_bin_statistics_f(unsigned int vlen, // vector length gr_msg_queue_sptr msgq, gr_feval_dd *tune, // callback @@ -44,9 +45,9 @@ gr_make_bin_statistics_f(unsigned int vlen, // vector length * \brief control scanning and record frequency domain statistics * \ingroup sink_blk */ -class gr_bin_statistics_f : public gr_sync_block +class GR_CORE_API gr_bin_statistics_f : public gr_sync_block { - friend gr_bin_statistics_f_sptr + friend GR_CORE_API gr_bin_statistics_f_sptr gr_make_bin_statistics_f(unsigned int vlen, // vector length gr_msg_queue_sptr msgq, gr_feval_dd *tune, // callback diff --git a/gnuradio-core/src/lib/general/gr_binary_slicer_fb.cc b/gnuradio-core/src/lib/general/gr_binary_slicer_fb.cc deleted file mode 100644 index ae8903abb..000000000 --- a/gnuradio-core/src/lib/general/gr_binary_slicer_fb.cc +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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_binary_slicer_fb.h> -#include <gr_io_signature.h> -#include <stdexcept> - -gr_binary_slicer_fb_sptr -gr_make_binary_slicer_fb () -{ - return gnuradio::get_initial_sptr(new gr_binary_slicer_fb ()); -} - -gr_binary_slicer_fb::gr_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))) -{ -} - -static inline int -slice(float x) -{ - return x < 0 ? 0 : 1; -} - -int -gr_binary_slicer_fb::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]; - - - for (int i = 0; i < noutput_items; i++){ - out[i] = slice(in[i]); - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_binary_slicer_fb.h b/gnuradio-core/src/lib/general/gr_binary_slicer_fb.h deleted file mode 100644 index 2aa4a0828..000000000 --- a/gnuradio-core/src/lib/general/gr_binary_slicer_fb.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- 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 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_BINARY_SLICER_FB_H -#define INCLUDED_GR_BINARY_SLICER_FB_H - -#include <gr_sync_block.h> - -class gr_binary_slicer_fb; -typedef boost::shared_ptr<gr_binary_slicer_fb> gr_binary_slicer_fb_sptr; - -gr_binary_slicer_fb_sptr gr_make_binary_slicer_fb (); - -/*! - * \brief slice float binary symbol outputting 1 bit output - * \ingroup converter_blk - * - * x < 0 --> 0 - * x >= 0 --> 1 - */ -class gr_binary_slicer_fb : public gr_sync_block -{ - friend gr_binary_slicer_fb_sptr gr_make_binary_slicer_fb (); - gr_binary_slicer_fb (); - - public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_burst_tagger.h b/gnuradio-core/src/lib/general/gr_burst_tagger.h index 8f814bea0..7547ba9cc 100644 --- a/gnuradio-core/src/lib/general/gr_burst_tagger.h +++ b/gnuradio-core/src/lib/general/gr_burst_tagger.h @@ -23,26 +23,27 @@ #ifndef INCLUDED_GR_BURST_TAGGER_H #define INCLUDED_GR_BURST_TAGGER_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_burst_tagger; typedef boost::shared_ptr<gr_burst_tagger> gr_burst_tagger_sptr; -gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize); +GR_CORE_API gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize); /*! * \brief output[i] = input[i] * \ingroup misc_blk * */ -class gr_burst_tagger : public gr_sync_block +class GR_CORE_API gr_burst_tagger : public gr_sync_block { size_t d_itemsize; bool d_state; pmt::pmt_t d_key; pmt::pmt_t d_id; - friend gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize); + friend GR_CORE_API gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize); gr_burst_tagger(size_t itemsize); public: diff --git a/gnuradio-core/src/lib/general/gr_bytes_to_syms.h b/gnuradio-core/src/lib/general/gr_bytes_to_syms.h index 1531de02a..33b98d4fd 100644 --- a/gnuradio-core/src/lib/general/gr_bytes_to_syms.h +++ b/gnuradio-core/src/lib/general/gr_bytes_to_syms.h @@ -22,12 +22,13 @@ #ifndef INCLUDED_GR_BYTES_TO_SYMS_H #define INCLUDED_GR_BYTES_TO_SYMS_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_bytes_to_syms; typedef boost::shared_ptr<gr_bytes_to_syms> gr_bytes_to_syms_sptr; -gr_bytes_to_syms_sptr gr_make_bytes_to_syms (); +GR_CORE_API gr_bytes_to_syms_sptr gr_make_bytes_to_syms (); /*! * \brief Convert stream of bytes to stream of +/- 1 symbols @@ -45,9 +46,9 @@ gr_bytes_to_syms_sptr gr_make_bytes_to_syms (); * \sa gr_packed_to_unpacked_bb, gr_unpacked_to_packed_bb, * \sa gr_chunks_to_symbols_bf, gr_chunks_to_symbols_bc. */ -class gr_bytes_to_syms : public gr_sync_interpolator +class GR_CORE_API gr_bytes_to_syms : public gr_sync_interpolator { - friend gr_bytes_to_syms_sptr gr_make_bytes_to_syms (); + friend GR_CORE_API gr_bytes_to_syms_sptr gr_make_bytes_to_syms (); gr_bytes_to_syms (); diff --git a/gnuradio-core/src/lib/general/gr_char_to_float.h b/gnuradio-core/src/lib/general/gr_char_to_float.h index 482e479d6..b20d2066f 100644 --- a/gnuradio-core/src/lib/general/gr_char_to_float.h +++ b/gnuradio-core/src/lib/general/gr_char_to_float.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_CHAR_TO_FLOAT_H #define INCLUDED_GR_CHAR_TO_FLOAT_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_char_to_float; typedef boost::shared_ptr<gr_char_to_float> gr_char_to_float_sptr; -gr_char_to_float_sptr +GR_CORE_API gr_char_to_float_sptr gr_make_char_to_float (); /*! @@ -36,9 +37,9 @@ gr_make_char_to_float (); * \ingroup converter_blk */ -class gr_char_to_float : public gr_sync_block +class GR_CORE_API gr_char_to_float : public gr_sync_block { - friend gr_char_to_float_sptr gr_make_char_to_float (); + friend GR_CORE_API gr_char_to_float_sptr gr_make_char_to_float (); gr_char_to_float (); public: diff --git a/gnuradio-core/src/lib/general/gr_check_counting_s.h b/gnuradio-core/src/lib/general/gr_check_counting_s.h index da35ab8e2..cd4dcb24e 100644 --- a/gnuradio-core/src/lib/general/gr_check_counting_s.h +++ b/gnuradio-core/src/lib/general/gr_check_counting_s.h @@ -22,12 +22,13 @@ #ifndef INCLUDED_GR_CHECK_COUNTING_S_H #define INCLUDED_GR_CHECK_COUNTING_S_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_check_counting_s; typedef boost::shared_ptr<gr_check_counting_s> gr_check_counting_s_sptr; -gr_check_counting_s_sptr gr_make_check_counting_s (bool do_32bit=false); +GR_CORE_API gr_check_counting_s_sptr gr_make_check_counting_s (bool do_32bit=false); /*! * \brief sink that checks if its input stream consists of a counting sequence. @@ -36,9 +37,9 @@ gr_check_counting_s_sptr gr_make_check_counting_s (bool do_32bit=false); * * This sink is typically used to test the USRP "Counting Mode" or "Counting mode 32 bit". */ -class gr_check_counting_s : public gr_sync_block +class GR_CORE_API gr_check_counting_s : public gr_sync_block { - friend gr_check_counting_s_sptr gr_make_check_counting_s (bool do_32bit); + friend GR_CORE_API gr_check_counting_s_sptr gr_make_check_counting_s (bool do_32bit); enum state { SEARCHING, // searching for synchronization diff --git a/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.h b/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.h index e2bff46d2..939675db8 100644 --- a/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.h +++ b/gnuradio-core/src/lib/general/gr_check_lfsr_32k_s.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_CHECK_LFSR_32K_S_H #define INCLUDED_GR_CHECK_LFSR_32K_S_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gri_lfsr_32k.h> @@ -29,7 +30,7 @@ class gr_check_lfsr_32k_s; typedef boost::shared_ptr<gr_check_lfsr_32k_s> gr_check_lfsr_32k_s_sptr; -gr_check_lfsr_32k_s_sptr gr_make_check_lfsr_32k_s (); +GR_CORE_API gr_check_lfsr_32k_s_sptr gr_make_check_lfsr_32k_s (); /*! * \brief sink that checks if its input stream consists of a lfsr_32k sequence. @@ -38,9 +39,9 @@ gr_check_lfsr_32k_s_sptr gr_make_check_lfsr_32k_s (); * This sink is typically used along with gr_lfsr_32k_source_s to test * the USRP using its digital loopback mode. */ -class gr_check_lfsr_32k_s : public gr_sync_block +class GR_CORE_API gr_check_lfsr_32k_s : public gr_sync_block { - friend gr_check_lfsr_32k_s_sptr gr_make_check_lfsr_32k_s (); + friend GR_CORE_API gr_check_lfsr_32k_s_sptr gr_make_check_lfsr_32k_s (); enum state { SEARCHING, // searching for synchronization diff --git a/gnuradio-core/src/lib/general/gr_circular_file.h b/gnuradio-core/src/lib/general/gr_circular_file.h index 70f4b4b11..3d3f33a8d 100644 --- a/gnuradio-core/src/lib/general/gr_circular_file.h +++ b/gnuradio-core/src/lib/general/gr_circular_file.h @@ -23,6 +23,8 @@ #ifndef _GR_CIRCULAR_FILE_H_ #define _GR_CIRCULAR_FILE_H_ +#include <gr_core_api.h> + /* * writes input data into a circular buffer on disk. * @@ -35,7 +37,7 @@ * current start of data * */ -class gr_circular_file { +class GR_CORE_API gr_circular_file { int d_fd; int *d_header; unsigned char *d_buffer; @@ -55,4 +57,4 @@ public: void reset_read_pointer (); }; -#endif /* _GR_CIRCULAR_FILE_H_ */ +#endif /* _GR_CIRCULAR_FILE_H_ */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.cc b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.cc deleted file mode 100644 index 7c20f7fd9..000000000 --- a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.cc +++ /dev/null @@ -1,215 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,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_io_signature.h> -#include <gr_prefs.h> -#include <gr_clock_recovery_mm_cc.h> -#include <gri_mmse_fir_interpolator_cc.h> -#include <stdexcept> -#include <cstdio> - - -// Public constructor -static const int FUDGE = 16; - -gr_clock_recovery_mm_cc_sptr -gr_make_clock_recovery_mm_cc(float omega, float gain_omega, float mu, float gain_mu, - float omega_relative_limit) -{ - return gnuradio::get_initial_sptr(new gr_clock_recovery_mm_cc (omega, - gain_omega, - mu, - gain_mu, - omega_relative_limit)); -} - -gr_clock_recovery_mm_cc::gr_clock_recovery_mm_cc (float omega, float gain_omega, float mu, - float gain_mu, float omega_relative_limit) - : gr_block ("clock_recovery_mm_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 2, sizeof (gr_complex))), - d_mu (mu), d_omega(omega), d_gain_omega(gain_omega), - d_omega_relative_limit(omega_relative_limit), - d_gain_mu(gain_mu), d_last_sample(0), d_interp(new gri_mmse_fir_interpolator_cc()), - d_verbose(gr_prefs::singleton()->get_bool("clock_recovery_mm_cc", "verbose", false)), - d_p_2T(0), d_p_1T(0), d_p_0T(0), d_c_2T(0), d_c_1T(0), d_c_0T(0) -{ - if (omega <= 0.0) - throw std::out_of_range ("clock rate must be > 0"); - if (gain_mu < 0 || gain_omega < 0) - throw std::out_of_range ("Gains must be non-negative"); - - set_omega(omega); // also sets min and max omega - set_relative_rate (1.0 / omega); - set_history(3); // ensure 2 extra input sample is available -} - -gr_clock_recovery_mm_cc::~gr_clock_recovery_mm_cc () -{ - delete d_interp; -} - -void -gr_clock_recovery_mm_cc::forecast(int noutput_items, gr_vector_int &ninput_items_required) -{ - unsigned ninputs = ninput_items_required.size(); - for (unsigned i=0; i < ninputs; i++) - ninput_items_required[i] = - (int) ceil((noutput_items * d_omega) + d_interp->ntaps()) + FUDGE; -} - -gr_complex -gr_clock_recovery_mm_cc::slicer_0deg (gr_complex sample) -{ - float real=0, imag=0; - - if(sample.real() > 0) - real = 1; - if(sample.imag() > 0) - imag = 1; - return gr_complex(real,imag); -} - -gr_complex -gr_clock_recovery_mm_cc::slicer_45deg (gr_complex sample) -{ - float real= -1, imag = -1; - if(sample.real() > 0) - real=1; - if(sample.imag() > 0) - imag = 1; - return gr_complex(real,imag); -} - -/* - Modified Mueller and Muller clock recovery circuit - Based: - G. R. Danesfahani, T.G. Jeans, "Optimisation of modified Mueller and Muller - algorithm," Electronics Letters, Vol. 31, no. 13, 22 June 1995, pp. 1032 - 1033. -*/ - -int -gr_clock_recovery_mm_cc::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - gr_complex *foptr = (gr_complex *) output_items[1]; - - bool write_foptr = output_items.size() >= 2; - - int ii = 0; // input index - int oo = 0; // output index - int ni = ninput_items[0] - d_interp->ntaps() - FUDGE; // don't use more input than this - - assert(d_mu >= 0.0); - assert(d_mu <= 1.0); - - float mm_val=0; - gr_complex u, x, y; - - // This loop writes the error to the second output, if it exists - if (write_foptr) { - while(oo < noutput_items && ii < ni) { - d_p_2T = d_p_1T; - d_p_1T = d_p_0T; - d_p_0T = d_interp->interpolate (&in[ii], d_mu); - - d_c_2T = d_c_1T; - d_c_1T = d_c_0T; - d_c_0T = slicer_0deg(d_p_0T); - - x = (d_c_0T - d_c_2T) * conj(d_p_1T); - y = (d_p_0T - d_p_2T) * conj(d_c_1T); - u = y - x; - mm_val = u.real(); - out[oo++] = d_p_0T; - - // limit mm_val - mm_val = gr_branchless_clip(mm_val,1.0); - d_omega = d_omega + d_gain_omega * mm_val; - d_omega = d_omega_mid + gr_branchless_clip(d_omega-d_omega_mid, d_omega_relative_limit); // make sure we don't walk away - - d_mu = d_mu + d_omega + d_gain_mu * mm_val; - ii += (int)floor(d_mu); - d_mu -= floor(d_mu); - - // write the error signal to the second output - foptr[oo-1] = gr_complex(d_mu,0); - - if (ii < 0) // clamp it. This should only happen with bogus input - ii = 0; - } - } - // This loop does not write to the second output (ugly, but faster) - else { - while(oo < noutput_items && ii < ni) { - d_p_2T = d_p_1T; - d_p_1T = d_p_0T; - d_p_0T = d_interp->interpolate (&in[ii], d_mu); - - d_c_2T = d_c_1T; - d_c_1T = d_c_0T; - d_c_0T = slicer_0deg(d_p_0T); - - x = (d_c_0T - d_c_2T) * conj(d_p_1T); - y = (d_p_0T - d_p_2T) * conj(d_c_1T); - u = y - x; - mm_val = u.real(); - out[oo++] = d_p_0T; - - // limit mm_val - mm_val = gr_branchless_clip(mm_val,1.0); - - d_omega = d_omega + d_gain_omega * mm_val; - d_omega = d_omega_mid + gr_branchless_clip(d_omega-d_omega_mid, d_omega_relative_limit); // make sure we don't walk away - - d_mu = d_mu + d_omega + d_gain_mu * mm_val; - ii += (int)floor(d_mu); - d_mu -= floor(d_mu); - - if(d_verbose) { - printf("%f\t%f\n", d_omega, d_mu); - } - - if (ii < 0) // clamp it. This should only happen with bogus input - ii = 0; - } - } - - if (ii > 0){ - if (ii > ninput_items[0]){ - fprintf(stderr, "gr_clock_recovery_mm_cc: ii > ninput_items[0] (%d > %d)\n", - ii, ninput_items[0]); - assert(0); - } - consume_each (ii); - } - - return oo; -} diff --git a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.h b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.h deleted file mode 100644 index 04227a145..000000000 --- a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.h +++ /dev/null @@ -1,109 +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_CLOCK_RECOVERY_MM_CC_H -#define INCLUDED_GR_CLOCK_RECOVERY_MM_CC_H - -#include <gr_block.h> -#include <gr_complex.h> -#include <gr_math.h> - -class gri_mmse_fir_interpolator_cc; - -class gr_clock_recovery_mm_cc; -typedef boost::shared_ptr<gr_clock_recovery_mm_cc> gr_clock_recovery_mm_cc_sptr; - -// public constructor -gr_clock_recovery_mm_cc_sptr -gr_make_clock_recovery_mm_cc (float omega, float gain_omega, float mu, float gain_mu, - float omega_relative_limit=0.001); - -/*! - * \brief Mueller and Müller (M&M) based clock recovery block with complex input, complex output. - * \ingroup sync_blk - * - * This implements the Mueller and Müller (M&M) discrete-time error-tracking synchronizer. - * The complex version here is based on: - * Modified Mueller and Muller clock recovery circuit - * Based: - * G. R. Danesfahani, T.G. Jeans, "Optimisation of modified Mueller and Muller - * algorithm," Electronics Letters, Vol. 31, no. 13, 22 June 1995, pp. 1032 - 1033. - */ -class gr_clock_recovery_mm_cc : public gr_block -{ - public: - ~gr_clock_recovery_mm_cc (); - void forecast(int noutput_items, gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - float mu() const { return d_mu;} - float omega() const { return d_omega;} - float gain_mu() const { return d_gain_mu;} - float gain_omega() const { return d_gain_omega;} - void set_verbose (bool verbose) { d_verbose = verbose; } - - void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; } - void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; } - void set_mu (float mu) { d_mu = mu; } - void set_omega (float omega) { - d_omega = omega; - d_min_omega = omega*(1.0 - d_omega_relative_limit); - d_max_omega = omega*(1.0 + d_omega_relative_limit); - d_omega_mid = 0.5*(d_min_omega+d_max_omega); - } - -protected: - gr_clock_recovery_mm_cc (float omega, float gain_omega, float mu, float gain_mu, - float omega_relative_limi); - - private: - float d_mu; - float d_omega; - float d_gain_omega; - float d_min_omega; // minimum allowed omega - float d_max_omega; // maximum allowed omeg - float d_omega_relative_limit; // used to compute min and max omega - float d_omega_mid; - float d_gain_mu; - gr_complex d_last_sample; - gri_mmse_fir_interpolator_cc *d_interp; - bool d_verbose; - - gr_complex d_p_2T; - gr_complex d_p_1T; - gr_complex d_p_0T; - - gr_complex d_c_2T; - gr_complex d_c_1T; - gr_complex d_c_0T; - - gr_complex slicer_0deg (gr_complex sample); - gr_complex slicer_45deg (gr_complex sample); - - friend gr_clock_recovery_mm_cc_sptr - gr_make_clock_recovery_mm_cc (float omega, float gain_omega, float mu, float gain_mu, - float omega_relative_limit); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.i b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.i deleted file mode 100644 index 27eb70b95..000000000 --- a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.i +++ /dev/null @@ -1,50 +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,clock_recovery_mm_cc); - -gr_clock_recovery_mm_cc_sptr -gr_make_clock_recovery_mm_cc (float omega, float gain_omega, - float mu, float gain_mu, - float omega_relative_limit) throw(std::exception); - -class gr_clock_recovery_mm_cc : public gr_sync_block -{ - private: - gr_clock_recovery_mm_cc (float omega, float gain_omega, float mu, - float gain_mu, float omega_relative_limit); - -public: - float mu() const { return d_mu;} - float omega() const { return d_omega;} - float gain_mu() const { return d_gain_mu;} - float gain_omega() const { return d_gain_omega;} - - void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; } - void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; } - void set_mu (float omega) { d_mu = mu; } - void set_omega (float omega) { d_omega = omega; - d_min_omega = omega*(1.0 - d_omega_relative_limit); - d_max_omega = omega*(1.0 + d_omega_relative_limit); - } - void set_verbose (bool verbose) { d_verbose = verbose; } -}; diff --git a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.cc b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.cc deleted file mode 100644 index bb5a27071..000000000 --- a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.cc +++ /dev/null @@ -1,137 +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_io_signature.h> -#include <gr_clock_recovery_mm_ff.h> -#include <gri_mmse_fir_interpolator.h> -#include <stdexcept> - -#define DEBUG_CR_MM_FF 0 // must be defined as 0 or 1 - -// Public constructor - -gr_clock_recovery_mm_ff_sptr -gr_make_clock_recovery_mm_ff(float omega, float gain_omega, float mu, float gain_mu, - float omega_relative_limit) -{ - return gnuradio::get_initial_sptr(new gr_clock_recovery_mm_ff (omega, - gain_omega, - mu, - gain_mu, - omega_relative_limit)); -} - -gr_clock_recovery_mm_ff::gr_clock_recovery_mm_ff (float omega, float gain_omega, float mu, float gain_mu, - float omega_relative_limit) - : gr_block ("clock_recovery_mm_ff", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (float))), - d_mu (mu), d_gain_omega(gain_omega), d_gain_mu(gain_mu), - d_last_sample(0), d_interp(new gri_mmse_fir_interpolator()), - d_logfile(0), d_omega_relative_limit(omega_relative_limit) -{ - if (omega < 1) - throw std::out_of_range ("clock rate must be > 0"); - if (gain_mu < 0 || gain_omega < 0) - throw std::out_of_range ("Gains must be non-negative"); - - set_omega(omega); // also sets min and max omega - set_relative_rate (1.0 / omega); - - if (DEBUG_CR_MM_FF) - d_logfile = fopen("cr_mm_ff.dat", "wb"); -} - -gr_clock_recovery_mm_ff::~gr_clock_recovery_mm_ff () -{ - delete d_interp; - - if (DEBUG_CR_MM_FF && d_logfile){ - fclose(d_logfile); - d_logfile = 0; - } -} - -void -gr_clock_recovery_mm_ff::forecast(int noutput_items, gr_vector_int &ninput_items_required) -{ - unsigned ninputs = ninput_items_required.size(); - for (unsigned i=0; i < ninputs; i++) - ninput_items_required[i] = - (int) ceil((noutput_items * d_omega) + d_interp->ntaps()); -} - -static inline float -slice(float x) -{ - return x < 0 ? -1.0F : 1.0F; -} - -/* - * This implements the Mueller and Müller (M&M) discrete-time error-tracking synchronizer. - * - * See "Digital Communication Receivers: Synchronization, Channel - * Estimation and Signal Processing" by Heinrich Meyr, Marc Moeneclaey, & Stefan Fechtel. - * ISBN 0-471-50275-8. - */ -int -gr_clock_recovery_mm_ff::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]; - float *out = (float *) output_items[0]; - - int ii = 0; // input index - int oo = 0; // output index - int ni = ninput_items[0] - d_interp->ntaps(); // don't use more input than this - float mm_val; - - while (oo < noutput_items && ii < ni ){ - - // produce output sample - out[oo] = d_interp->interpolate (&in[ii], d_mu); - mm_val = slice(d_last_sample) * out[oo] - slice(out[oo]) * d_last_sample; - d_last_sample = out[oo]; - - d_omega = d_omega + d_gain_omega * mm_val; - d_omega = d_omega_mid + gr_branchless_clip(d_omega-d_omega_mid, d_omega_relative_limit); // make sure we don't walk away - d_mu = d_mu + d_omega + d_gain_mu * mm_val; - - ii += (int) floor(d_mu); - d_mu = d_mu - floor(d_mu); - oo++; - - if (DEBUG_CR_MM_FF && d_logfile){ - fwrite(&d_omega, sizeof(d_omega), 1, d_logfile); - } - } - - consume_each (ii); - - return oo; -} diff --git a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.h b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.h deleted file mode 100644 index d2ec6d3e6..000000000 --- a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.h +++ /dev/null @@ -1,96 +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_CLOCK_RECOVERY_MM_FF_H -#define INCLUDED_GR_CLOCK_RECOVERY_MM_FF_H - -#include <gr_block.h> -#include <gr_math.h> -#include <stdio.h> - -class gri_mmse_fir_interpolator; - -class gr_clock_recovery_mm_ff; -typedef boost::shared_ptr<gr_clock_recovery_mm_ff> gr_clock_recovery_mm_ff_sptr; - -// public constructor -gr_clock_recovery_mm_ff_sptr -gr_make_clock_recovery_mm_ff (float omega, float gain_omega, float mu, float gain_mu, - float omega_relative_limit=0.001); - -/*! - * \brief Mueller and Müller (M&M) based clock recovery block with float input, float output. - * \ingroup sync_blk - * - * This implements the Mueller and Müller (M&M) discrete-time error-tracking synchronizer. - * - * See "Digital Communication Receivers: Synchronization, Channel - * Estimation and Signal Processing" by Heinrich Meyr, Marc Moeneclaey, & Stefan Fechtel. - * ISBN 0-471-50275-8. - */ -class gr_clock_recovery_mm_ff : public gr_block -{ - public: - ~gr_clock_recovery_mm_ff (); - void forecast(int noutput_items, gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - float mu() const { return d_mu;} - float omega() const { return d_omega;} - float gain_mu() const { return d_gain_mu;} - float gain_omega() const { return d_gain_omega;} - - void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; } - void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; } - void set_mu (float mu) { d_mu = mu; } - void set_omega (float omega){ - d_omega = omega; - d_min_omega = omega*(1.0 - d_omega_relative_limit); - d_max_omega = omega*(1.0 + d_omega_relative_limit); - d_omega_mid = 0.5*(d_min_omega+d_max_omega); - } - -protected: - gr_clock_recovery_mm_ff (float omega, float gain_omega, float mu, float gain_mu, - float omega_relative_limit); - - private: - float d_mu; // fractional sample position [0.0, 1.0] - float d_omega; // nominal frequency - float d_min_omega; // minimum allowed omega - float d_omega_mid; // average omega - float d_max_omega; // maximum allowed omega - float d_gain_omega; // gain for adjusting omega - float d_gain_mu; // gain for adjusting mu - float d_last_sample; - gri_mmse_fir_interpolator *d_interp; - FILE *d_logfile; - float d_omega_relative_limit; // used to compute min and max omega - - friend gr_clock_recovery_mm_ff_sptr - gr_make_clock_recovery_mm_ff (float omega, float gain_omega, float mu, float gain_mu, - float omega_relative_limit); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.i b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.i deleted file mode 100644 index 1b2437000..000000000 --- a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.i +++ /dev/null @@ -1,46 +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,clock_recovery_mm_ff); - -gr_clock_recovery_mm_ff_sptr -gr_make_clock_recovery_mm_ff (float omega, float gain_omega, - float mu, float gain_mu, - float omega_relative_limit=0.001) throw(std::exception); - -class gr_clock_recovery_mm_ff : public gr_sync_block -{ - private: - gr_clock_recovery_mm_ff (float omega, float gain_omega, float mu, float gain_mu, - float omega_relative_limit); - -public: - float mu() const; - float omega() const; - float gain_mu() const; - float gain_omega() const; - - void set_gain_mu (float gain_mu); - void set_gain_omega (float gain_omega); - void set_mu (float omega); - void set_omega (float omega); -}; diff --git a/gnuradio-core/src/lib/general/gr_complex_to_interleaved_short.h b/gnuradio-core/src/lib/general/gr_complex_to_interleaved_short.h index 0a91eddd6..a3e2d38ad 100644 --- a/gnuradio-core/src/lib/general/gr_complex_to_interleaved_short.h +++ b/gnuradio-core/src/lib/general/gr_complex_to_interleaved_short.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_COMPLEX_TO_INTERLEAVED_SHORT_H #define INCLUDED_GR_COMPLEX_TO_INTERLEAVED_SHORT_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_complex_to_interleaved_short; typedef boost::shared_ptr<gr_complex_to_interleaved_short> gr_complex_to_interleaved_short_sptr; -gr_complex_to_interleaved_short_sptr +GR_CORE_API gr_complex_to_interleaved_short_sptr gr_make_complex_to_interleaved_short (); /*! @@ -37,9 +38,9 @@ gr_make_complex_to_interleaved_short (); * \ingroup converter_blk */ -class gr_complex_to_interleaved_short : public gr_sync_interpolator +class GR_CORE_API gr_complex_to_interleaved_short : public gr_sync_interpolator { - friend gr_complex_to_interleaved_short_sptr gr_make_complex_to_interleaved_short (); + friend GR_CORE_API gr_complex_to_interleaved_short_sptr gr_make_complex_to_interleaved_short (); gr_complex_to_interleaved_short (); public: diff --git a/gnuradio-core/src/lib/general/gr_complex_to_xxx.h b/gnuradio-core/src/lib/general/gr_complex_to_xxx.h index 1851c67d9..166403259 100644 --- a/gnuradio-core/src/lib/general/gr_complex_to_xxx.h +++ b/gnuradio-core/src/lib/general/gr_complex_to_xxx.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_COMPLEX_TO_XXX_H #define INCLUDED_GR_COMPLEX_TO_XXX_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_complex.h> @@ -40,21 +41,21 @@ typedef boost::shared_ptr<gr_complex_to_mag> gr_complex_to_mag_sptr; typedef boost::shared_ptr<gr_complex_to_mag_squared> gr_complex_to_mag_squared_sptr; typedef boost::shared_ptr<gr_complex_to_arg> gr_complex_to_arg_sptr; -gr_complex_to_float_sptr gr_make_complex_to_float (unsigned int vlen=1); -gr_complex_to_real_sptr gr_make_complex_to_real (unsigned int vlen=1); -gr_complex_to_imag_sptr gr_make_complex_to_imag (unsigned int vlen=1); -gr_complex_to_mag_sptr gr_make_complex_to_mag (unsigned int vlen=1); -gr_complex_to_mag_squared_sptr gr_make_complex_to_mag_squared (unsigned int vlen=1); -gr_complex_to_arg_sptr gr_make_complex_to_arg (unsigned int vlen=1); +GR_CORE_API gr_complex_to_float_sptr gr_make_complex_to_float (unsigned int vlen=1); +GR_CORE_API gr_complex_to_real_sptr gr_make_complex_to_real (unsigned int vlen=1); +GR_CORE_API gr_complex_to_imag_sptr gr_make_complex_to_imag (unsigned int vlen=1); +GR_CORE_API gr_complex_to_mag_sptr gr_make_complex_to_mag (unsigned int vlen=1); +GR_CORE_API gr_complex_to_mag_squared_sptr gr_make_complex_to_mag_squared (unsigned int vlen=1); +GR_CORE_API gr_complex_to_arg_sptr gr_make_complex_to_arg (unsigned int vlen=1); /*! * \brief convert a stream of gr_complex to 1 or 2 streams of float * \ingroup converter_blk * \param vlen vector len (default 1) */ -class gr_complex_to_float : public gr_sync_block +class GR_CORE_API gr_complex_to_float : public gr_sync_block { - friend gr_complex_to_float_sptr gr_make_complex_to_float (unsigned int vlen); + friend GR_CORE_API gr_complex_to_float_sptr gr_make_complex_to_float (unsigned int vlen); gr_complex_to_float (unsigned int vlen); unsigned int d_vlen; @@ -70,9 +71,9 @@ class gr_complex_to_float : public gr_sync_block * \ingroup converter_blk * \param vlen vector len (default 1) */ -class gr_complex_to_real : public gr_sync_block +class GR_CORE_API gr_complex_to_real : public gr_sync_block { - friend gr_complex_to_real_sptr gr_make_complex_to_real (unsigned int vlen); + friend GR_CORE_API gr_complex_to_real_sptr gr_make_complex_to_real (unsigned int vlen); gr_complex_to_real (unsigned int vlen); unsigned int d_vlen; @@ -88,9 +89,9 @@ class gr_complex_to_real : public gr_sync_block * \ingroup converter_blk * \param vlen vector len (default 1) */ -class gr_complex_to_imag : public gr_sync_block +class GR_CORE_API gr_complex_to_imag : public gr_sync_block { - friend gr_complex_to_imag_sptr gr_make_complex_to_imag (unsigned int vlen); + friend GR_CORE_API gr_complex_to_imag_sptr gr_make_complex_to_imag (unsigned int vlen); gr_complex_to_imag (unsigned int vlen); unsigned int d_vlen; @@ -106,9 +107,9 @@ class gr_complex_to_imag : public gr_sync_block * \ingroup converter_blk * \param vlen vector len (default 1) */ -class gr_complex_to_mag : public gr_sync_block +class GR_CORE_API gr_complex_to_mag : public gr_sync_block { - friend gr_complex_to_mag_sptr gr_make_complex_to_mag (unsigned int vlen); + friend GR_CORE_API gr_complex_to_mag_sptr gr_make_complex_to_mag (unsigned int vlen); gr_complex_to_mag (unsigned int vlen); unsigned int d_vlen; @@ -124,9 +125,9 @@ class gr_complex_to_mag : public gr_sync_block * \ingroup converter_blk * \param vlen vector len (default 1) */ -class gr_complex_to_mag_squared : public gr_sync_block +class GR_CORE_API gr_complex_to_mag_squared : public gr_sync_block { - friend gr_complex_to_mag_squared_sptr gr_make_complex_to_mag_squared (unsigned int vlen); + friend GR_CORE_API gr_complex_to_mag_squared_sptr gr_make_complex_to_mag_squared (unsigned int vlen); gr_complex_to_mag_squared (unsigned int vlen); unsigned int d_vlen; @@ -142,9 +143,9 @@ class gr_complex_to_mag_squared : public gr_sync_block * \ingroup converter_blk * \param vlen vector len (default 1) */ -class gr_complex_to_arg : public gr_sync_block +class GR_CORE_API gr_complex_to_arg : public gr_sync_block { - friend gr_complex_to_arg_sptr gr_make_complex_to_arg (unsigned int vlen); + friend GR_CORE_API gr_complex_to_arg_sptr gr_make_complex_to_arg (unsigned int vlen); gr_complex_to_arg (unsigned int vlen); unsigned int d_vlen; diff --git a/gnuradio-core/src/lib/general/gr_conjugate_cc.h b/gnuradio-core/src/lib/general/gr_conjugate_cc.h index 783019adb..16e76e153 100644 --- a/gnuradio-core/src/lib/general/gr_conjugate_cc.h +++ b/gnuradio-core/src/lib/general/gr_conjugate_cc.h @@ -25,20 +25,21 @@ #ifndef INCLUDED_GR_CONJUGATE_CC_H #define INCLUDED_GR_CONJUGATE_CC_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_conjugate_cc; typedef boost::shared_ptr<gr_conjugate_cc> gr_conjugate_cc_sptr; -gr_conjugate_cc_sptr gr_make_conjugate_cc (); +GR_CORE_API gr_conjugate_cc_sptr gr_make_conjugate_cc (); /*! * \brief output = complex conjugate of input * \ingroup math_blk */ -class gr_conjugate_cc : public gr_sync_block +class GR_CORE_API gr_conjugate_cc : public gr_sync_block { - friend gr_conjugate_cc_sptr gr_make_conjugate_cc (); + friend GR_CORE_API gr_conjugate_cc_sptr gr_make_conjugate_cc (); gr_conjugate_cc (); diff --git a/gnuradio-core/src/lib/general/gr_constants.h b/gnuradio-core/src/lib/general/gr_constants.h index 449d41c17..3d21fe1d6 100644 --- a/gnuradio-core/src/lib/general/gr_constants.h +++ b/gnuradio-core/src/lib/general/gr_constants.h @@ -22,31 +22,32 @@ #ifndef INCLUDED_GR_CONSTANTS_H #define INCLUDED_GR_CONSTANTS_H +#include <gr_core_api.h> #include <string> /*! * \brief return ./configure --prefix argument. Typically /usr/local */ -const std::string gr_prefix(); +GR_CORE_API const std::string gr_prefix(); /*! * \brief return ./configure --sysconfdir argument. Typically $prefix/etc or /etc */ -const std::string gr_sysconfdir(); +GR_CORE_API const std::string gr_sysconfdir(); /*! * \brief return preferences file directory. Typically $sysconfdir/etc/conf.d */ -const std::string gr_prefsdir(); +GR_CORE_API const std::string gr_prefsdir(); /*! * \brief return date/time of build, as set when 'bootstrap' is run */ -const std::string gr_build_date(); +GR_CORE_API const std::string gr_build_date(); /*! * \brief return version string defined in configure.ac */ -const std::string gr_version(); +GR_CORE_API const std::string gr_version(); #endif /* INCLUDED_GR_CONSTANTS_H */ diff --git a/gnuradio-core/src/lib/general/gr_constellation_decoder_cb.cc b/gnuradio-core/src/lib/general/gr_constellation_decoder_cb.cc deleted file mode 100644 index 5b87f1430..000000000 --- a/gnuradio-core/src/lib/general/gr_constellation_decoder_cb.cc +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- 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 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_constellation_decoder_cb.h> -#include <gr_io_signature.h> -#include <stdexcept> - -#include <cstdio> -#include <iostream> -using std::cout; -using std::endl; - -static const bool compute_EVM = false; - -gr_constellation_decoder_cb_sptr -gr_make_constellation_decoder_cb (const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out) -{ - return gr_constellation_decoder_cb_sptr - (new gr_constellation_decoder_cb(sym_position, sym_value_out)); -} - -gr_constellation_decoder_cb:: -gr_constellation_decoder_cb (const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out) - : gr_sync_block ("constellation_decoder_cb", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (unsigned char))) -{ - if (!set_constellation(sym_position,sym_value_out)) - throw std::invalid_argument("constellation_decoder_cb"); -} - - -gr_constellation_decoder_cb::~gr_constellation_decoder_cb(){} - - -bool -gr_constellation_decoder_cb::set_constellation(const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out) -{ - if (sym_position.size() != sym_value_out.size()) - return false; - - if (sym_position.size()<1) - return false; - - d_sym_position = sym_position; - d_sym_value_out = sym_value_out; - return true; -} - - -int -gr_constellation_decoder_cb::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex const *in = (const gr_complex *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - unsigned int table_size = d_sym_value_out.size(); - unsigned int min_index = 0; - float min_euclid_dist = 0; - float euclid_dist = 0; - double total_error = 0; - - for(int i = 0; i < noutput_items; i++){ - min_euclid_dist = norm(in[i] - d_sym_position[0]); - min_index = 0; - for (unsigned int j = 1; j < table_size; j++){ - euclid_dist = norm(in[i] - d_sym_position[j]); - if (euclid_dist < min_euclid_dist){ - min_euclid_dist = euclid_dist; - min_index = j; - } - } - - out[i] = d_sym_value_out[min_index]; - - if (compute_EVM) - total_error += sqrtf(min_euclid_dist); - } - - if (compute_EVM){ - double mean = total_error / noutput_items; - double rms = sqrt(mean * mean); - fprintf(stderr, "EVM = %8.4f\n", rms); - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_constellation_decoder_cb.h b/gnuradio-core/src/lib/general/gr_constellation_decoder_cb.h deleted file mode 100644 index fd7079c12..000000000 --- a/gnuradio-core/src/lib/general/gr_constellation_decoder_cb.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- 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 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_CONSTELLATION_DECODER_CB_H -#define INCLUDED_GR_CONSTELLATION_DECODER_CB_H - -#include <gr_sync_block.h> -#include <vector> - -class gr_constellation_decoder_cb; -typedef boost::shared_ptr<gr_constellation_decoder_cb> gr_constellation_decoder_cb_sptr; - -gr_constellation_decoder_cb_sptr - gr_make_constellation_decoder_cb (const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out); - -/*! - * \brief Constellation Decoder - * \ingroup coding_blk - * - */ -class gr_constellation_decoder_cb : public gr_sync_block -{ - - private: - std::vector<gr_complex> d_sym_position; - std::vector<unsigned char> d_sym_value_out; - - friend gr_constellation_decoder_cb_sptr - gr_make_constellation_decoder_cb (const std::vector<gr_complex> &sym_position, const std::vector<unsigned char> &sym_value_out); - - gr_constellation_decoder_cb (const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out); //constructor - - public: - bool set_constellation(const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out); - - ~gr_constellation_decoder_cb(); //destructor - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_constellation_decoder_cb.i b/gnuradio-core/src/lib/general/gr_constellation_decoder_cb.i deleted file mode 100644 index 8d9c9b56e..000000000 --- a/gnuradio-core/src/lib/general/gr_constellation_decoder_cb.i +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- 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 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,constellation_decoder_cb) - -gr_constellation_decoder_cb_sptr - gr_make_constellation_decoder_cb (const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out); - -class gr_constellation_decoder_cb : public gr_sync_block -{ - private: - gr_constellation_decoder_cb (const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out); - - friend gr_constellation_decoder_cb_sptr - gr_make_constellation_decoder_cb (const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out); - - public: - int set_constellation(const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out); - ~gr_constellation_decoder_cb(); -}; diff --git a/gnuradio-core/src/lib/general/gr_copy.h b/gnuradio-core/src/lib/general/gr_copy.h index d99aef8b7..7fb13bf68 100644 --- a/gnuradio-core/src/lib/general/gr_copy.h +++ b/gnuradio-core/src/lib/general/gr_copy.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_COPY_H #define INCLUDED_GR_COPY_H +#include <gr_core_api.h> #include <gr_block.h> class gr_copy; typedef boost::shared_ptr<gr_copy> gr_copy_sptr; -gr_copy_sptr gr_make_copy(size_t itemsize); +GR_CORE_API gr_copy_sptr gr_make_copy(size_t itemsize); /*! * \brief output[i] = input[i] @@ -38,12 +39,12 @@ gr_copy_sptr gr_make_copy(size_t itemsize); * When disabled, this block drops its input on the floor. * */ -class gr_copy : public gr_block +class GR_CORE_API gr_copy : public gr_block { size_t d_itemsize; bool d_enabled; - friend gr_copy_sptr gr_make_copy(size_t itemsize); + friend GR_CORE_API gr_copy_sptr gr_make_copy(size_t itemsize); gr_copy(size_t itemsize); public: diff --git a/gnuradio-core/src/lib/general/gr_crc32.i b/gnuradio-core/src/lib/general/gr_core_api.h index 7dca5c6a1..74c802857 100644 --- a/gnuradio-core/src/lib/general/gr_crc32.i +++ b/gnuradio-core/src/lib/general/gr_core_api.h @@ -1,27 +1,33 @@ -/* -*- c++ -*- */ /* - * Copyright 2005 Free Software Foundation, Inc. - * + * Copyright 2010-2011 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. */ -%rename(update_crc32) gr_update_crc32; -%rename(crc32) gr_crc32; +#ifndef INCLUDED_GR_CORE_API_H +#define INCLUDED_GR_CORE_API_H -unsigned int gr_update_crc32(unsigned int crc, const std::string buf); -unsigned int gr_crc32(const std::string buf); +#include <gruel/attributes.h> + +#ifdef gnuradio_core_EXPORTS +# define GR_CORE_API __GR_ATTR_EXPORT +#else +# define GR_CORE_API __GR_ATTR_IMPORT +#endif + +#endif /* INCLUDED_GR_CORE_API_H */ diff --git a/gnuradio-core/src/lib/general/gr_correlate_access_code_bb.cc b/gnuradio-core/src/lib/general/gr_correlate_access_code_bb.cc deleted file mode 100644 index 15f673411..000000000 --- a/gnuradio-core/src/lib/general/gr_correlate_access_code_bb.cc +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,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_correlate_access_code_bb.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <gr_count_bits.h> -#include <cstdio> - - -#define VERBOSE 0 - - -gr_correlate_access_code_bb_sptr -gr_make_correlate_access_code_bb (const std::string &access_code, int threshold) -{ - return gnuradio::get_initial_sptr(new gr_correlate_access_code_bb (access_code, threshold)); -} - - -gr_correlate_access_code_bb::gr_correlate_access_code_bb ( - const std::string &access_code, int threshold) - : gr_sync_block ("correlate_access_code_bb", - gr_make_io_signature (1, 1, sizeof(char)), - gr_make_io_signature (1, 1, sizeof(char))), - d_data_reg(0), d_flag_reg(0), d_flag_bit(0), d_mask(0), - d_threshold(threshold) - -{ - if (!set_access_code(access_code)){ - fprintf(stderr, "gr_correlate_access_code_bb: access_code is > 64 bits\n"); - throw std::out_of_range ("access_code is > 64 bits"); - } -} - -gr_correlate_access_code_bb::~gr_correlate_access_code_bb () -{ -} - -bool -gr_correlate_access_code_bb::set_access_code( - const std::string &access_code) -{ - unsigned len = access_code.length(); // # of bytes in string - if (len > 64) - return false; - - // set len top bits to 1. - d_mask = ((~0ULL) >> (64 - len)) << (64 - len); - - d_flag_bit = 1LL << (64 - len); // Where we or-in new flag values. - // new data always goes in 0x0000000000000001 - d_access_code = 0; - for (unsigned i=0; i < 64; i++){ - d_access_code <<= 1; - if (i < len) - d_access_code |= access_code[i] & 1; // look at LSB only - } - - return true; -} - -int -gr_correlate_access_code_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++){ - - // compute output value - unsigned int t = 0; - - t |= ((d_data_reg >> 63) & 0x1) << 0; - t |= ((d_flag_reg >> 63) & 0x1) << 1; // flag bit - out[i] = t; - - // compute hamming distance between desired access code and current data - unsigned long long wrong_bits = 0; - unsigned int nwrong = d_threshold+1; - int new_flag = 0; - - wrong_bits = (d_data_reg ^ d_access_code) & d_mask; - nwrong = gr_count_bits64(wrong_bits); - - // test for access code with up to threshold errors - new_flag = (nwrong <= d_threshold); - -#if VERBOSE - if(new_flag) { - fprintf(stderr, "access code found: %llx\n", d_access_code); - } - else { - fprintf(stderr, "%llx ==> %llx\n", d_access_code, d_data_reg); - } -#endif - - // shift in new data and new flag - d_data_reg = (d_data_reg << 1) | (in[i] & 0x1); - d_flag_reg = (d_flag_reg << 1); - if (new_flag) { - d_flag_reg |= d_flag_bit; - } - } - - return noutput_items; -} - diff --git a/gnuradio-core/src/lib/general/gr_correlate_access_code_bb.h b/gnuradio-core/src/lib/general/gr_correlate_access_code_bb.h deleted file mode 100644 index 581713c14..000000000 --- a/gnuradio-core/src/lib/general/gr_correlate_access_code_bb.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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 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_CORRELATE_ACCESS_CODE_BB_H -#define INCLUDED_GR_CORRELATE_ACCESS_CODE_BB_H - -#include <gr_sync_block.h> -#include <string> - -class gr_correlate_access_code_bb; -typedef boost::shared_ptr<gr_correlate_access_code_bb> gr_correlate_access_code_bb_sptr; - -/*! - * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100" - * \param threshold maximum number of bits that may be wrong - */ -gr_correlate_access_code_bb_sptr -gr_make_correlate_access_code_bb (const std::string &access_code, int threshold); - -/*! - * \brief Examine input for specified access code, one bit at a time. - * \ingroup sync_blk - * - * input: stream of bits, 1 bit per input byte (data in LSB) - * output: stream of bits, 2 bits per output byte (data in LSB, flag in next higher bit) - * - * Each output byte contains two valid bits, the data bit, and the - * flag bit. The LSB (bit 0) is the data bit, and is the original - * input data, delayed 64 bits. Bit 1 is the - * flag bit and is 1 if the corresponding data bit is the first data - * bit following the access code. Otherwise the flag bit is 0. - */ -class gr_correlate_access_code_bb : public gr_sync_block -{ - friend gr_correlate_access_code_bb_sptr - gr_make_correlate_access_code_bb (const std::string &access_code, int threshold); - private: - unsigned long long d_access_code; // access code to locate start of packet - // access code is left justified in the word - unsigned long long d_data_reg; // used to look for access_code - unsigned long long d_flag_reg; // keep track of decisions - unsigned long long d_flag_bit; // mask containing 1 bit which is location of new flag - unsigned long long d_mask; // masks access_code bits (top N bits are set where - // N is the number of bits in the access code) - unsigned int d_threshold; // how many bits may be wrong in sync vector - - protected: - gr_correlate_access_code_bb(const std::string &access_code, int threshold); - - public: - ~gr_correlate_access_code_bb(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - - /*! - * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100" - */ - bool set_access_code (const std::string &access_code); -}; - -#endif /* INCLUDED_GR_CORRELATE_ACCESS_CODE_BB_H */ diff --git a/gnuradio-core/src/lib/general/gr_correlate_access_code_bb.i b/gnuradio-core/src/lib/general/gr_correlate_access_code_bb.i deleted file mode 100644 index bec4282f1..000000000 --- a/gnuradio-core/src/lib/general/gr_correlate_access_code_bb.i +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- 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 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,correlate_access_code_bb); - -/*! - * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100" - * \param threshold maximum number of bits that may be wrong - */ -gr_correlate_access_code_bb_sptr -gr_make_correlate_access_code_bb (const std::string &access_code, int threshold) - throw(std::out_of_range); - -/*! - * \brief Examine input for specified access code, one bit at a time. - * \ingroup block - * - * input: stream of bits, 1 bit per input byte (data in LSB) - * output: stream of bits, 2 bits per output byte (data in LSB, flag in next higher bit) - * - * Each output byte contains two valid bits, the data bit, and the - * flag bit. The LSB (bit 0) is the data bit, and is the original - * input data, delayed 64 bits. Bit 1 is the - * flag bit and is 1 if the corresponding data bit is the first data - * bit following the access code. Otherwise the flag bit is 0. - */ -class gr_correlate_access_code_bb : public gr_sync_block -{ - friend gr_correlate_access_code_bb_sptr - gr_make_correlate_access_code_bb (const std::string &access_code, int threshold); - protected: - gr_correlate_access_code_bb(const std::string &access_code, int threshold); - - public: - ~gr_correlate_access_code_bb(); - - /*! - * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100" - */ - bool set_access_code (const std::string &access_code); -}; diff --git a/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.h b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.h index 1067bbc56..e543f5cfb 100644 --- a/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.h +++ b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_gr_correlate_access_code_tag_bb_H #define INCLUDED_gr_correlate_access_code_tag_bb_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <string> @@ -34,7 +35,7 @@ typedef boost::shared_ptr<gr_correlate_access_code_tag_bb> gr_correlate_access_c * \param threshold maximum number of bits that may be wrong * \param tag_name key of the tag inserted into the tag stream */ -gr_correlate_access_code_tag_bb_sptr +GR_CORE_API gr_correlate_access_code_tag_bb_sptr gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold, const std::string &tag_name); @@ -49,9 +50,9 @@ gr_make_correlate_access_code_tag_bb (const std::string &access_code, int thresh * name [tag_name], specified in the constructor. Used for searching * an input data stream for preambles, etc. */ -class gr_correlate_access_code_tag_bb : public gr_sync_block +class GR_CORE_API gr_correlate_access_code_tag_bb : public gr_sync_block { - friend gr_correlate_access_code_tag_bb_sptr + friend GR_CORE_API gr_correlate_access_code_tag_bb_sptr gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold, const std::string &tag_name); private: diff --git a/gnuradio-core/src/lib/general/gr_costas_loop_cc.cc b/gnuradio-core/src/lib/general/gr_costas_loop_cc.cc deleted file mode 100644 index f3bfd0951..000000000 --- a/gnuradio-core/src/lib/general/gr_costas_loop_cc.cc +++ /dev/null @@ -1,168 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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_costas_loop_cc.h> -#include <gr_io_signature.h> -#include <gr_expj.h> -#include <gr_sincos.h> -#include <math.h> - -#define M_TWOPI (2*M_PI) - -gr_costas_loop_cc_sptr -gr_make_costas_loop_cc (float alpha, float beta, - float max_freq, float min_freq, - int order - ) throw (std::invalid_argument) -{ - return gnuradio::get_initial_sptr(new gr_costas_loop_cc (alpha, beta, - max_freq, min_freq, - order)); -} - -gr_costas_loop_cc::gr_costas_loop_cc (float alpha, float beta, - float max_freq, float min_freq, - int order - ) throw (std::invalid_argument) - : gr_sync_block ("costas_loop_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 2, sizeof (gr_complex))), - d_alpha(alpha), d_beta(beta), - d_max_freq(max_freq), d_min_freq(min_freq), - d_phase(0), d_freq((max_freq+min_freq)/2), - d_order(order), d_phase_detector(0) -{ - switch(d_order) { - case 2: - d_phase_detector = &gr_costas_loop_cc::phase_detector_2; - break; - - case 4: - d_phase_detector = &gr_costas_loop_cc::phase_detector_4; - break; - - default: - throw std::invalid_argument("order must be 2 or 4"); - break; - } -} - - -float -gr_costas_loop_cc::phase_detector_4(gr_complex sample) const -{ - - return ((sample.real()>0 ? 1.0 : -1.0) * sample.imag() - - (sample.imag()>0 ? 1.0 : -1.0) * sample.real()); -} - -float -gr_costas_loop_cc::phase_detector_2(gr_complex sample) const -{ - return (sample.real()*sample.imag()); -} - -void -gr_costas_loop_cc::set_alpha(float alpha) -{ - d_alpha = alpha; -} - -void -gr_costas_loop_cc::set_beta(float beta) -{ - d_beta = beta; -} - -int -gr_costas_loop_cc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *iptr = (gr_complex *) input_items[0]; - gr_complex *optr = (gr_complex *) output_items[0]; - gr_complex *foptr = (gr_complex *) output_items[1]; - - bool write_foptr = output_items.size() >= 2; - - float error; - gr_complex nco_out; - - if (write_foptr) { - - for (int i = 0; i < noutput_items; i++){ - nco_out = gr_expj(-d_phase); - optr[i] = iptr[i] * nco_out; - - error = (*this.*d_phase_detector)(optr[i]); - if (error > 1) - error = 1; - else if (error < -1) - error = -1; - - d_freq = d_freq + d_beta * error; - d_phase = d_phase + d_freq + d_alpha * error; - - while(d_phase>M_TWOPI) - d_phase -= M_TWOPI; - while(d_phase<-M_TWOPI) - d_phase += M_TWOPI; - - if (d_freq > d_max_freq) - d_freq = d_max_freq; - else if (d_freq < d_min_freq) - d_freq = d_min_freq; - - foptr[i] = gr_complex(d_freq,0); - } - } else { - for (int i = 0; i < noutput_items; i++){ - nco_out = gr_expj(-d_phase); - optr[i] = iptr[i] * nco_out; - - error = (*this.*d_phase_detector)(optr[i]); - if (error > 1) - error = 1; - else if (error < -1) - error = -1; - - d_freq = d_freq + d_beta * error; - d_phase = d_phase + d_freq + d_alpha * error; - - while(d_phase>M_TWOPI) - d_phase -= M_TWOPI; - while(d_phase<-M_TWOPI) - d_phase += M_TWOPI; - - if (d_freq > d_max_freq) - d_freq = d_max_freq; - else if (d_freq < d_min_freq) - d_freq = d_min_freq; - - } - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_costas_loop_cc.h b/gnuradio-core/src/lib/general/gr_costas_loop_cc.h deleted file mode 100644 index 3b4aab86c..000000000 --- a/gnuradio-core/src/lib/general/gr_costas_loop_cc.h +++ /dev/null @@ -1,139 +0,0 @@ -/* -*- 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 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_COSTAS_LOOP_CC_H -#define INCLUDED_GR_COSTAS_LOOP_CC_H - -#include <gr_sync_block.h> -#include <stdexcept> -#include <fstream> - - -/*! \brief A Costas loop carrier recovery module. - * \ingroup sync_blk - * - * The Costas loop locks to the center frequency of a signal and - * downconverts it to baseband. The second (order=2) order loop is - * used for BPSK where the real part of the output signal is the - * baseband BPSK signal and the imaginary part is the error - * signal. When order=4, it can be used for quadrature modulations - * where both I and Q (real and imaginary) are outputted. - * - * More details can be found online: - * - * J. Feigin, "Practical Costas loop design: Designing a simple and inexpensive - * BPSK Costas loop carrier recovery circuit," RF signal processing, pp. 20-36, - * 2002. - * - * http://rfdesign.com/images/archive/0102Feigin20.pdf - * - * \param alpha the loop gain used for phase adjustment - * \param beta the loop gain for frequency adjustments - * \param max_freq the maximum frequency deviation (radians/sample) the loop can handle - * \param min_freq the minimum frequency deviation (radians/sample) the loop can handle - * \param order the loop order, either 2 or 4 - */ -class gr_costas_loop_cc; -typedef boost::shared_ptr<gr_costas_loop_cc> gr_costas_loop_cc_sptr; - - -gr_costas_loop_cc_sptr -gr_make_costas_loop_cc (float alpha, float beta, - float max_freq, float min_freq, - int order - ) throw (std::invalid_argument); - - -/*! - * \brief Carrier tracking PLL for QPSK - * \ingroup sync_blk - * input: complex; output: complex - * <br>The Costas loop can have two output streams: - * stream 1 is the baseband I and Q; - * stream 2 is the normalized frequency of the loop - * - * \p order must be 2 or 4. - */ -class gr_costas_loop_cc : public gr_sync_block -{ - friend gr_costas_loop_cc_sptr gr_make_costas_loop_cc (float alpha, float beta, - float max_freq, float min_freq, - int order - ) throw (std::invalid_argument); - - float d_alpha, d_beta, d_max_freq, d_min_freq, d_phase, d_freq; - int d_order; - - gr_costas_loop_cc (float alpha, float beta, - float max_freq, float min_freq, - int order - ) throw (std::invalid_argument); - - /*! \brief the phase detector circuit for fourth-order loops - * \param sample complex sample - * \return the phase error - */ - float phase_detector_4(gr_complex sample) const; // for QPSK - - /*! \brief the phase detector circuit for second-order loops - * \param sample a complex sample - * \return the phase error - */ - float phase_detector_2(gr_complex sample) const; // for BPSK - - - float (gr_costas_loop_cc::*d_phase_detector)(gr_complex sample) const; - -public: - - /*! \brief set the first order gain - * \param alpha - */ - void set_alpha(float alpha); - - /*! \brief get the first order gain - * - */ - float alpha() const { return d_alpha; } - - /*! \brief set the second order gain - * \param beta - */ - void set_beta(float beta); - - /*! \brief get the second order gain - * - */ - float beta() const { return d_beta; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - /*! \brief returns the current NCO frequency in radians/sample - * - */ - float freq() const { return d_freq; } -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_costas_loop_cc.i b/gnuradio-core/src/lib/general/gr_costas_loop_cc.i deleted file mode 100644 index 488cab370..000000000 --- a/gnuradio-core/src/lib/general/gr_costas_loop_cc.i +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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 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,costas_loop_cc); - -gr_costas_loop_cc_sptr -gr_make_costas_loop_cc (float alpha, float beta, - float max_freq, float min_freq, - int order - ) throw (std::invalid_argument); - - -class gr_costas_loop_cc : public gr_sync_block -{ - private: - gr_costas_loop_cc (float alpha, float beta, - float max_freq, float min_freq, int order); - - public: - void set_alpha(float alpha); - float alpha(); - void set_beta(float beta); - float beta(); - float freq(); -}; diff --git a/gnuradio-core/src/lib/general/gr_count_bits.h b/gnuradio-core/src/lib/general/gr_count_bits.h index a8b52d3ac..f0cec2a11 100644 --- a/gnuradio-core/src/lib/general/gr_count_bits.h +++ b/gnuradio-core/src/lib/general/gr_count_bits.h @@ -23,9 +23,11 @@ #ifndef _GR_COUNT_BITS_H_ #define _GR_COUNT_BITS_H_ -unsigned int gr_count_bits8(unsigned int x); // return number of set bits in the low 8 bits of x -unsigned int gr_count_bits16(unsigned int x); // return number of set bits in the low 16 bits of x -unsigned int gr_count_bits32(unsigned int x); // return number of set bits in the low 32 bits of x -unsigned int gr_count_bits64(unsigned long long int x); +#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_cpfsk_bc.h b/gnuradio-core/src/lib/general/gr_cpfsk_bc.h index 29bcfed65..4afba4fb4 100644 --- a/gnuradio-core/src/lib/general/gr_cpfsk_bc.h +++ b/gnuradio-core/src/lib/general/gr_cpfsk_bc.h @@ -20,13 +20,14 @@ #ifndef INCLUDED_GR_CPFSK_BC_H #define INCLUDED_GR_CPFSK_BC_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_cpfsk_bc; typedef boost::shared_ptr<gr_cpfsk_bc> gr_cpfsk_bc_sptr; -gr_cpfsk_bc_sptr gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym); +GR_CORE_API gr_cpfsk_bc_sptr gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym); /*! * \brief Perform continuous phase 2-level frequency shift keying modulation @@ -38,10 +39,10 @@ gr_cpfsk_bc_sptr gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym); * \param samples_per_sym number of output samples per input bit */ -class gr_cpfsk_bc : public gr_sync_interpolator +class GR_CORE_API gr_cpfsk_bc : public gr_sync_interpolator { private: - friend gr_cpfsk_bc_sptr gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym); + friend GR_CORE_API gr_cpfsk_bc_sptr gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym); gr_cpfsk_bc(float k, float ampl, int samples_per_sym); diff --git a/gnuradio-core/src/lib/general/gr_cpm.cc b/gnuradio-core/src/lib/general/gr_cpm.cc new file mode 100644 index 000000000..94a428c58 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_cpm.cc @@ -0,0 +1,218 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 Free Software Foundation, Inc. + * + * 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. + */ + +// Calculate the taps for the CPM phase responses + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <cmath> +#include <cfloat> +#include <gr_cpm.h> + +//gives us erf on compilers without it +#include <boost/math/special_functions/erf.hpp> +namespace bm = boost::math; + +#ifndef M_TWOPI +# define M_TWOPI (2*M_PI) +#endif + +//! Normalised sinc function, sinc(x)=sin(pi*x)/pi*x +inline double +sinc(double x) +{ + if (x == 0) { + return 1.0; + } + + return sin(M_PI * x) / (M_PI * x); +} + + +//! Taps for L-RC CPM (Raised cosine of length L symbols) +std::vector<float> +generate_cpm_lrc_taps(unsigned samples_per_sym, unsigned L) +{ + std::vector<float> taps(samples_per_sym * L, 1.0/L/samples_per_sym); + for (unsigned i = 0; i < samples_per_sym * L; i++) { + taps[i] *= 1 - cos(M_TWOPI * i / L / samples_per_sym); + } + + return taps; +} + + +/*! Taps for L-SRC CPM (Spectral raised cosine of length L symbols). + * + * L-SRC has a time-continuous phase response function of + * + * g(t) = 1/LT * sinc(2t/LT) * cos(beta * 2pi t / LT) / (1 - (4beta / LT * t)^2) + * + * which is the Fourier transform of a cos-rolloff function with rolloff + * beta, and looks like a sinc-function, multiplied with a rolloff term. + * We return the main lobe of the sinc, i.e., everything between the + * zero crossings. + * The time-discrete IR is thus + * + * g(k) = 1/Ls * sinc(2k/Ls) * cos(beta * pi k / Ls) / (1 - (4beta / Ls * k)^2) + * where k = 0...Ls-1 + * and s = samples per symbol. + */ +std::vector<float> +generate_cpm_lsrc_taps(unsigned samples_per_sym, unsigned L, double beta) +{ + double Ls = (double) L * samples_per_sym; + std::vector<double> taps_d(L * samples_per_sym, 0.0); + std::vector<float> taps(L * samples_per_sym, 0.0); + + double sum = 0; + for (unsigned i = 0; i < samples_per_sym * L; i++) { + double k = i - Ls/2; // Causal to acausal + + taps_d[i] = 1.0 / Ls * sinc(2.0 * k / Ls); + + // For k = +/-Ls/4*beta, the rolloff term's cos-function becomes zero + // and the whole thing converges to PI/4 (to prove this, use de + // l'hopital's rule). + if (fabs(fabs(k) - Ls/4/beta) < 2*DBL_EPSILON) { + taps_d[i] *= M_PI_4; + } else { + double tmp = 4.0 * beta * k / Ls; + taps_d[i] *= cos(beta * M_TWOPI * k / Ls) / (1 - tmp * tmp); + } + sum += taps_d[i]; + } + for (unsigned i = 0; i < samples_per_sym * L; i++) { + taps[i] = (float) taps_d[i] / sum; + } + + return taps; +} + + +//! Taps for L-REC CPM (Rectangular pulse shape of length L symbols) +std::vector<float> +generate_cpm_lrec_taps(unsigned samples_per_sym, unsigned L) +{ + return std::vector<float>(samples_per_sym * L, 1.0/L/samples_per_sym); +} + + +//! Helper function for TFM +double tfm_g0(double k, double sps) +{ + if (fabs(k) < 2 * DBL_EPSILON) { + return 1.145393004159143; // 1 + pi^2/48 / sqrt(2) + } + + const double pi2_24 = 0.411233516712057; // pi^2/24 + double f = M_PI * k / sps; + return sinc(k/sps) - pi2_24 * (2 * sin(f) - 2*f*cos(f) - f*f*sin(f)) / (f*f*f); +} + + +//! Taps for TFM CPM (Tamed frequency modulation) +// +// See [2, Chapter 2.7.2]. +// +// [2]: Anderson, Aulin and Sundberg; Digital Phase Modulation +std::vector<float> +generate_cpm_tfm_taps(unsigned sps, unsigned L) +{ + unsigned causal_shift = sps * L / 2; + std::vector<double> taps_d(sps * L, 0.0); + std::vector<float> taps(sps * L, 0.0); + + double sum = 0; + for (unsigned i = 0; i < sps * L; i++) { + double k = (double)(((int)i) - ((int)causal_shift)); // Causal to acausal + + taps_d[i] = tfm_g0(k - sps, sps) + + 2 * tfm_g0(k, sps) + + tfm_g0(k + sps, sps); + sum += taps_d[i]; + } + for (unsigned i = 0; i < sps * L; i++) { + taps[i] = (float) taps_d[i] / sum; + } + + return taps; +} + + +//! Taps for Gaussian CPM. Phase response is truncated after \p L symbols. +// \p bt sets the 3dB-time-bandwidth product. +// +// Note: for h = 0.5, this is the phase response for GMSK. +// +// This C99-compatible formula for the taps is taken straight +// from [1, Chapter 9.2.3]. +// A version in Q-notation can be found in [2, Chapter 2.7.2]. +// +// [1]: Karl-Dirk Kammeyer; Nachrichtenübertragung, 4th Edition. +// [2]: Anderson, Aulin and Sundberg; Digital Phase Modulation +// +std::vector<float> +generate_cpm_gaussian_taps(unsigned samples_per_sym, unsigned L, double bt) +{ + double Ls = (double) L * samples_per_sym; + std::vector<double> taps_d(L * samples_per_sym, 0.0); + std::vector<float> taps(L * samples_per_sym, 0.0); + + // alpha = sqrt(2/ln(2)) * pi * BT + double alpha = 5.336446256636997 * bt; + for (unsigned i = 0; i < samples_per_sym * L; i++) { + double k = i - Ls/2; // Causal to acausal + taps_d[i] = (bm::erf(alpha * (k / samples_per_sym + 0.5)) - + bm::erf(alpha * (k / samples_per_sym - 0.5))) + * 0.5 / samples_per_sym; + taps[i] = (float) taps_d[i]; + } + + return taps; +} + + +std::vector<float> +gr_cpm::phase_response(cpm_type type, unsigned samples_per_sym, unsigned L, double beta) +{ + switch (type) { + case LRC: + return generate_cpm_lrc_taps(samples_per_sym, L); + + case LSRC: + return generate_cpm_lsrc_taps(samples_per_sym, L, beta); + + case LREC: + return generate_cpm_lrec_taps(samples_per_sym, L); + + case TFM: + return generate_cpm_tfm_taps(samples_per_sym, L); + + case GAUSSIAN: + return generate_cpm_gaussian_taps(samples_per_sym, L, beta); + + default: + return generate_cpm_lrec_taps(samples_per_sym, 1); + } +} + diff --git a/gnuradio-core/src/lib/general/gr_cpm.h b/gnuradio-core/src/lib/general/gr_cpm.h new file mode 100644 index 000000000..ef2ff8414 --- /dev/null +++ b/gnuradio-core/src/lib/general/gr_cpm.h @@ -0,0 +1,81 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010 Free Software Foundation, Inc. + * + * 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_CPM_H +#define INCLUDED_GR_CPM_H + +#include <gr_core_api.h> +#include <vector> + +class GR_CORE_API gr_cpm +{ + public: + enum cpm_type { + LRC, + LSRC, + LREC, + TFM, + GAUSSIAN, + GENERIC = 999 + }; + + /*! \brief Return the taps for an interpolating FIR filter (gr_interp_fir_filter_fff). + * + * These taps represent the phase response \f$g(k)\f$ for use in a CPM modulator, + * see also gr_cpmmod_bc. + * + * \param type The CPM type (Rectangular, Raised Cosine, Spectral Raised Cosine, + * Tamed FM or Gaussian). + * \param samples_per_sym Samples per symbol. + * \param L The length of the phase response in symbols. + * \param beta For Spectral Raised Cosine, this is the rolloff factor. For Gaussian + * phase responses, this the 3dB-time-bandwidth product. For all other + * cases, it is ignored. + * + * Output: returns a vector of length \a K = \p samples_per_sym x \p L. + * This can be used directly in an interpolating FIR filter such as + * gr_interp_fir_filter_fff with interpolation factor \p samples_per_sym. + * + * All phase responses are normalised s.t. \f$ \sum_{k=0}^{K-1} g(k) = 1\f$; this will cause + * a maximum phase change of \f$ h \cdot \pi\f$ between two symbols, where \a h is the + * modulation index. + * + * The following phase responses can be generated: + * - LREC: Rectangular phase response. + * - LRC: Raised cosine phase response, looks like 1 - cos(x). + * - LSRC: Spectral raised cosine. This requires a rolloff factor beta. + * The phase response is the Fourier transform of raised cosine + * function. + * - TFM: Tamed frequency modulation. This scheme minimizes phase change for + * rapidly varying input symbols. + * - GAUSSIAN: A Gaussian phase response. For a modulation index h = 1/2, this + * results in GMSK. + * + * A short description of all these phase responses can be found in [1]. + * + * [1]: Anderson, Aulin and Sundberg; Digital Phase Modulation + */ + static std::vector<float> + phase_response(cpm_type type, unsigned samples_per_sym, unsigned L, double beta=0.3); +}; + +#endif /* INCLUDED_GR_CPM_H */ + diff --git a/gnuradio-core/src/lib/general/gr_binary_slicer_fb.i b/gnuradio-core/src/lib/general/gr_cpm.i index b6f4e9312..f01aba34e 100644 --- a/gnuradio-core/src/lib/general/gr_binary_slicer_fb.i +++ b/gnuradio-core/src/lib/general/gr_cpm.i @@ -1,6 +1,6 @@ -/* -*- c++ -*- */ +/* -*- C++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,14 +20,21 @@ * Boston, MA 02110-1301, USA. */ -GR_SWIG_BLOCK_MAGIC(gr,binary_slicer_fb); +%rename(cpm) gr_cpm; -gr_binary_slicer_fb_sptr gr_make_binary_slicer_fb (); - -class gr_binary_slicer_fb : public gr_sync_block +class gr_cpm { - private: - gr_binary_slicer_fb (); - public: + enum cpm_type { + LRC, + LSRC, + LREC, + TFM, + GAUSSIAN, + GENERIC = 999 + }; + + static std::vector<float> + phase_response(cpm_type type, unsigned samples_per_sym, unsigned L, double beta=0.3); }; + diff --git a/gnuradio-core/src/lib/general/gr_crc32.cc b/gnuradio-core/src/lib/general/gr_crc32.cc deleted file mode 100644 index d4e843528..000000000 --- a/gnuradio-core/src/lib/general/gr_crc32.cc +++ /dev/null @@ -1,130 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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. - */ - -/* - * See also ISO 3309 [ISO-3309] or ITU-T V.42 [ITU-V42] for a formal specification. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_crc32.h> - - -// Automatically generated CRC function -// polynomial: 0x104C11DB7 -unsigned int -gr_update_crc32(unsigned int crc, const unsigned char *data, size_t len) -{ - static const unsigned int table[256] = { - 0x00000000U,0x04C11DB7U,0x09823B6EU,0x0D4326D9U, - 0x130476DCU,0x17C56B6BU,0x1A864DB2U,0x1E475005U, - 0x2608EDB8U,0x22C9F00FU,0x2F8AD6D6U,0x2B4BCB61U, - 0x350C9B64U,0x31CD86D3U,0x3C8EA00AU,0x384FBDBDU, - 0x4C11DB70U,0x48D0C6C7U,0x4593E01EU,0x4152FDA9U, - 0x5F15ADACU,0x5BD4B01BU,0x569796C2U,0x52568B75U, - 0x6A1936C8U,0x6ED82B7FU,0x639B0DA6U,0x675A1011U, - 0x791D4014U,0x7DDC5DA3U,0x709F7B7AU,0x745E66CDU, - 0x9823B6E0U,0x9CE2AB57U,0x91A18D8EU,0x95609039U, - 0x8B27C03CU,0x8FE6DD8BU,0x82A5FB52U,0x8664E6E5U, - 0xBE2B5B58U,0xBAEA46EFU,0xB7A96036U,0xB3687D81U, - 0xAD2F2D84U,0xA9EE3033U,0xA4AD16EAU,0xA06C0B5DU, - 0xD4326D90U,0xD0F37027U,0xDDB056FEU,0xD9714B49U, - 0xC7361B4CU,0xC3F706FBU,0xCEB42022U,0xCA753D95U, - 0xF23A8028U,0xF6FB9D9FU,0xFBB8BB46U,0xFF79A6F1U, - 0xE13EF6F4U,0xE5FFEB43U,0xE8BCCD9AU,0xEC7DD02DU, - 0x34867077U,0x30476DC0U,0x3D044B19U,0x39C556AEU, - 0x278206ABU,0x23431B1CU,0x2E003DC5U,0x2AC12072U, - 0x128E9DCFU,0x164F8078U,0x1B0CA6A1U,0x1FCDBB16U, - 0x018AEB13U,0x054BF6A4U,0x0808D07DU,0x0CC9CDCAU, - 0x7897AB07U,0x7C56B6B0U,0x71159069U,0x75D48DDEU, - 0x6B93DDDBU,0x6F52C06CU,0x6211E6B5U,0x66D0FB02U, - 0x5E9F46BFU,0x5A5E5B08U,0x571D7DD1U,0x53DC6066U, - 0x4D9B3063U,0x495A2DD4U,0x44190B0DU,0x40D816BAU, - 0xACA5C697U,0xA864DB20U,0xA527FDF9U,0xA1E6E04EU, - 0xBFA1B04BU,0xBB60ADFCU,0xB6238B25U,0xB2E29692U, - 0x8AAD2B2FU,0x8E6C3698U,0x832F1041U,0x87EE0DF6U, - 0x99A95DF3U,0x9D684044U,0x902B669DU,0x94EA7B2AU, - 0xE0B41DE7U,0xE4750050U,0xE9362689U,0xEDF73B3EU, - 0xF3B06B3BU,0xF771768CU,0xFA325055U,0xFEF34DE2U, - 0xC6BCF05FU,0xC27DEDE8U,0xCF3ECB31U,0xCBFFD686U, - 0xD5B88683U,0xD1799B34U,0xDC3ABDEDU,0xD8FBA05AU, - 0x690CE0EEU,0x6DCDFD59U,0x608EDB80U,0x644FC637U, - 0x7A089632U,0x7EC98B85U,0x738AAD5CU,0x774BB0EBU, - 0x4F040D56U,0x4BC510E1U,0x46863638U,0x42472B8FU, - 0x5C007B8AU,0x58C1663DU,0x558240E4U,0x51435D53U, - 0x251D3B9EU,0x21DC2629U,0x2C9F00F0U,0x285E1D47U, - 0x36194D42U,0x32D850F5U,0x3F9B762CU,0x3B5A6B9BU, - 0x0315D626U,0x07D4CB91U,0x0A97ED48U,0x0E56F0FFU, - 0x1011A0FAU,0x14D0BD4DU,0x19939B94U,0x1D528623U, - 0xF12F560EU,0xF5EE4BB9U,0xF8AD6D60U,0xFC6C70D7U, - 0xE22B20D2U,0xE6EA3D65U,0xEBA91BBCU,0xEF68060BU, - 0xD727BBB6U,0xD3E6A601U,0xDEA580D8U,0xDA649D6FU, - 0xC423CD6AU,0xC0E2D0DDU,0xCDA1F604U,0xC960EBB3U, - 0xBD3E8D7EU,0xB9FF90C9U,0xB4BCB610U,0xB07DABA7U, - 0xAE3AFBA2U,0xAAFBE615U,0xA7B8C0CCU,0xA379DD7BU, - 0x9B3660C6U,0x9FF77D71U,0x92B45BA8U,0x9675461FU, - 0x8832161AU,0x8CF30BADU,0x81B02D74U,0x857130C3U, - 0x5D8A9099U,0x594B8D2EU,0x5408ABF7U,0x50C9B640U, - 0x4E8EE645U,0x4A4FFBF2U,0x470CDD2BU,0x43CDC09CU, - 0x7B827D21U,0x7F436096U,0x7200464FU,0x76C15BF8U, - 0x68860BFDU,0x6C47164AU,0x61043093U,0x65C52D24U, - 0x119B4BE9U,0x155A565EU,0x18197087U,0x1CD86D30U, - 0x029F3D35U,0x065E2082U,0x0B1D065BU,0x0FDC1BECU, - 0x3793A651U,0x3352BBE6U,0x3E119D3FU,0x3AD08088U, - 0x2497D08DU,0x2056CD3AU,0x2D15EBE3U,0x29D4F654U, - 0xC5A92679U,0xC1683BCEU,0xCC2B1D17U,0xC8EA00A0U, - 0xD6AD50A5U,0xD26C4D12U,0xDF2F6BCBU,0xDBEE767CU, - 0xE3A1CBC1U,0xE760D676U,0xEA23F0AFU,0xEEE2ED18U, - 0xF0A5BD1DU,0xF464A0AAU,0xF9278673U,0xFDE69BC4U, - 0x89B8FD09U,0x8D79E0BEU,0x803AC667U,0x84FBDBD0U, - 0x9ABC8BD5U,0x9E7D9662U,0x933EB0BBU,0x97FFAD0CU, - 0xAFB010B1U,0xAB710D06U,0xA6322BDFU,0xA2F33668U, - 0xBCB4666DU,0xB8757BDAU,0xB5365D03U,0xB1F740B4U, - }; - - while (len > 0) - { - crc = table[*data ^ ((crc >> 24) & 0xff)] ^ (crc << 8); - data++; - len--; - } - return crc; -} - -unsigned int -gr_update_crc32(unsigned int crc, const std::string s) -{ - return gr_update_crc32(crc, (const unsigned char *) s.data(), s.size()); -} - -unsigned int -gr_crc32(const unsigned char *buf, size_t len) -{ - return gr_update_crc32(0xffffffff, buf, len) ^ 0xffffffff; -} - -unsigned int -gr_crc32(const std::string s) -{ - return gr_crc32((const unsigned char *) s.data(), s.size()); -} diff --git a/gnuradio-core/src/lib/general/gr_crc32.h b/gnuradio-core/src/lib/general/gr_crc32.h deleted file mode 100644 index 87a8d15f2..000000000 --- a/gnuradio-core/src/lib/general/gr_crc32.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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_CRC32_H -#define INCLUDED_GR_CRC32_H - -#include <string> -#include <gr_types.h> - -/*! - * \brief update running CRC-32 - * \ingroup misc - * - * Update a running CRC with the bytes buf[0..len-1] The CRC should be - * initialized to all 1's, and the transmitted value is the 1's - * complement of the final running CRC. The resulting CRC should be - * transmitted in big endian order. - */ -unsigned int -gr_update_crc32(unsigned int crc, const unsigned char *buf, size_t len); - -unsigned int -gr_update_crc32(unsigned int crc, const std::string buf); - -unsigned int -gr_crc32(const unsigned char *buf, size_t len); - -unsigned int -gr_crc32(const std::string buf); - -#endif /* INCLUDED_CRC32_H */ diff --git a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.h b/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.h index 49df785ff..664c40846 100644 --- a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.h +++ b/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.h @@ -23,20 +23,21 @@ #ifndef INCLUDED_GR_CTCSS_SQUELCH_FF_H #define INCLUDED_GR_CTCSS_SQUELCH_FF_H +#include <gr_core_api.h> #include <gr_squelch_base_ff.h> #include <gri_goertzel.h> class gr_ctcss_squelch_ff; typedef boost::shared_ptr<gr_ctcss_squelch_ff> gr_ctcss_squelch_ff_sptr; -gr_ctcss_squelch_ff_sptr +GR_CORE_API gr_ctcss_squelch_ff_sptr gr_make_ctcss_squelch_ff(int rate, float freq, float level=0.01, int len=0, int ramp=0, bool gate=false); /*! * \brief gate or zero output if ctcss tone not present * \ingroup level_blk */ -class gr_ctcss_squelch_ff : public gr_squelch_base_ff +class GR_CORE_API gr_ctcss_squelch_ff : public gr_squelch_base_ff { private: float d_freq; @@ -48,7 +49,7 @@ private: gri_goertzel d_goertzel_c; gri_goertzel d_goertzel_r; - friend gr_ctcss_squelch_ff_sptr gr_make_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate); + friend GR_CORE_API gr_ctcss_squelch_ff_sptr gr_make_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate); gr_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate); int find_tone(float freq); diff --git a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.h b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.h index 50a6c9d89..3db250101 100644 --- a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.h +++ b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.h @@ -20,17 +20,18 @@ #ifndef INCLUDED_GR_DECODE_CCSDS_27_FB_H #define INCLUDED_GR_DECODE_CCSDS_27_FB_H +#include <gr_core_api.h> #include <gr_sync_decimator.h> extern "C" { -#include "../viterbi/viterbi.h" +#include <viterbi.h> } class gr_decode_ccsds_27_fb; typedef boost::shared_ptr<gr_decode_ccsds_27_fb> gr_decode_ccsds_27_fb_sptr; -gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb(); +GR_CORE_API gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb(); /*! \brief A rate 1/2, k=7 convolutional decoder for the CCSDS standard * \ingroup ecc @@ -51,10 +52,10 @@ gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb(); * from the corresponding inputs. */ -class gr_decode_ccsds_27_fb : public gr_sync_decimator +class GR_CORE_API gr_decode_ccsds_27_fb : public gr_sync_decimator { private: - friend gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb(); + friend GR_CORE_API gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb(); gr_decode_ccsds_27_fb(); diff --git a/gnuradio-core/src/lib/general/gr_deinterleave.h b/gnuradio-core/src/lib/general/gr_deinterleave.h index 59c310bdc..3dd913911 100644 --- a/gnuradio-core/src/lib/general/gr_deinterleave.h +++ b/gnuradio-core/src/lib/general/gr_deinterleave.h @@ -23,20 +23,21 @@ #ifndef INCLUDED_GR_DEINTERLEAVE_H #define INCLUDED_GR_DEINTERLEAVE_H +#include <gr_core_api.h> #include <gr_sync_decimator.h> class gr_deinterleave; typedef boost::shared_ptr<gr_deinterleave> gr_deinterleave_sptr; -gr_deinterleave_sptr gr_make_deinterleave (size_t itemsize); +GR_CORE_API gr_deinterleave_sptr gr_make_deinterleave (size_t itemsize); /*! * \brief deinterleave a single input into N outputs * \ingroup slicedice_blk */ -class gr_deinterleave : public gr_sync_decimator +class GR_CORE_API gr_deinterleave : public gr_sync_decimator { - friend gr_deinterleave_sptr gr_make_deinterleave (size_t itemsize); + friend GR_CORE_API gr_deinterleave_sptr gr_make_deinterleave (size_t itemsize); size_t d_itemsize; diff --git a/gnuradio-core/src/lib/general/gr_delay.h b/gnuradio-core/src/lib/general/gr_delay.h index d7e8252a2..14de9af1f 100644 --- a/gnuradio-core/src/lib/general/gr_delay.h +++ b/gnuradio-core/src/lib/general/gr_delay.h @@ -23,20 +23,21 @@ #ifndef INCLUDED_GR_DELAY_H #define INCLUDED_GR_DELAY_H +#include <gr_core_api.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); +GR_CORE_API gr_delay_sptr gr_make_delay (size_t itemsize, int delay); /*! * \brief delay the input by a certain number of samples * \ingroup misc_blk */ -class gr_delay : public gr_sync_block +class GR_CORE_API gr_delay : public gr_sync_block { - friend gr_delay_sptr gr_make_delay (size_t itemsize, int delay); + friend GR_CORE_API gr_delay_sptr gr_make_delay (size_t itemsize, int delay); gr_delay (size_t itemsize, int delay); diff --git a/gnuradio-core/src/lib/general/gr_descrambler_bb.h b/gnuradio-core/src/lib/general/gr_descrambler_bb.h index 19787690c..d7a49b5f1 100644 --- a/gnuradio-core/src/lib/general/gr_descrambler_bb.h +++ b/gnuradio-core/src/lib/general/gr_descrambler_bb.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_GR_DESCRAMBLER_BB_H #define INCLUDED_GR_DESCRAMBLER_BB_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include "gri_lfsr.h" class gr_descrambler_bb; typedef boost::shared_ptr<gr_descrambler_bb> gr_descrambler_bb_sptr; -gr_descrambler_bb_sptr gr_make_descrambler_bb(int mask, int seed, int len); +GR_CORE_API gr_descrambler_bb_sptr gr_make_descrambler_bb(int mask, int seed, int len); /*! * Descramble an input stream using an LFSR. This block works on the LSB only @@ -42,9 +43,9 @@ gr_descrambler_bb_sptr gr_make_descrambler_bb(int mask, int seed, int len); * \ingroup coding_blk */ -class gr_descrambler_bb : public gr_sync_block +class GR_CORE_API gr_descrambler_bb : public gr_sync_block { - friend gr_descrambler_bb_sptr gr_make_descrambler_bb(int mask, int seed, int len); + friend GR_CORE_API gr_descrambler_bb_sptr gr_make_descrambler_bb(int mask, int seed, int len); gri_lfsr d_lfsr; diff --git a/gnuradio-core/src/lib/general/gr_diff_decoder_bb.h b/gnuradio-core/src/lib/general/gr_diff_decoder_bb.h index 6fd08ec4b..0337c3dbd 100644 --- a/gnuradio-core/src/lib/general/gr_diff_decoder_bb.h +++ b/gnuradio-core/src/lib/general/gr_diff_decoder_bb.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_DIFF_DECODER_BB_H #define INCLUDED_GR_DIFF_DECODER_BB_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_diff_decoder_bb; typedef boost::shared_ptr<gr_diff_decoder_bb> gr_diff_decoder_bb_sptr; -gr_diff_decoder_bb_sptr gr_make_diff_decoder_bb (unsigned int modulus); +GR_CORE_API gr_diff_decoder_bb_sptr gr_make_diff_decoder_bb (unsigned int modulus); /*! * \brief y[0] = (x[0] - x[-1]) % M @@ -36,9 +37,9 @@ gr_diff_decoder_bb_sptr gr_make_diff_decoder_bb (unsigned int modulus); * * Differential decoder */ -class gr_diff_decoder_bb : public gr_sync_block +class GR_CORE_API gr_diff_decoder_bb : public gr_sync_block { - friend gr_diff_decoder_bb_sptr gr_make_diff_decoder_bb (unsigned int modulus); + friend GR_CORE_API gr_diff_decoder_bb_sptr gr_make_diff_decoder_bb (unsigned int modulus); gr_diff_decoder_bb(unsigned int modulus); unsigned int d_modulus; diff --git a/gnuradio-core/src/lib/general/gr_diff_encoder_bb.h b/gnuradio-core/src/lib/general/gr_diff_encoder_bb.h index 50aff73cf..c99e226da 100644 --- a/gnuradio-core/src/lib/general/gr_diff_encoder_bb.h +++ b/gnuradio-core/src/lib/general/gr_diff_encoder_bb.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_DIFF_ENCODER_BB_H #define INCLUDED_GR_DIFF_ENCODER_BB_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_diff_encoder_bb; typedef boost::shared_ptr<gr_diff_encoder_bb> gr_diff_encoder_bb_sptr; -gr_diff_encoder_bb_sptr gr_make_diff_encoder_bb (unsigned int modulus); +GR_CORE_API gr_diff_encoder_bb_sptr gr_make_diff_encoder_bb (unsigned int modulus); /*! * \brief y[0] = (x[0] + y[-1]) % M @@ -36,9 +37,9 @@ gr_diff_encoder_bb_sptr gr_make_diff_encoder_bb (unsigned int modulus); * * Differential encoder */ -class gr_diff_encoder_bb : public gr_sync_block +class GR_CORE_API gr_diff_encoder_bb : public gr_sync_block { - friend gr_diff_encoder_bb_sptr gr_make_diff_encoder_bb (unsigned int modulus); + friend GR_CORE_API gr_diff_encoder_bb_sptr gr_make_diff_encoder_bb (unsigned int modulus); gr_diff_encoder_bb(unsigned int modulus); unsigned int d_last_out; diff --git a/gnuradio-core/src/lib/general/gr_diff_phasor_cc.h b/gnuradio-core/src/lib/general/gr_diff_phasor_cc.h index 1070ba183..8af2699a7 100644 --- a/gnuradio-core/src/lib/general/gr_diff_phasor_cc.h +++ b/gnuradio-core/src/lib/general/gr_diff_phasor_cc.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_DIFF_PHASOR_CC_H #define INCLUDED_GR_DIFF_PHASOR_CC_H +#include <gr_core_api.h> #include <gr_sync_block.h> /*! @@ -32,12 +33,12 @@ class gr_diff_phasor_cc; typedef boost::shared_ptr<gr_diff_phasor_cc> gr_diff_phasor_cc_sptr; -gr_diff_phasor_cc_sptr gr_make_diff_phasor_cc (); +GR_CORE_API gr_diff_phasor_cc_sptr gr_make_diff_phasor_cc (); -class gr_diff_phasor_cc : public gr_sync_block +class GR_CORE_API gr_diff_phasor_cc : public gr_sync_block { - friend gr_diff_phasor_cc_sptr gr_make_diff_phasor_cc (); + friend GR_CORE_API gr_diff_phasor_cc_sptr gr_make_diff_phasor_cc (); gr_diff_phasor_cc (); //constructor diff --git a/gnuradio-core/src/lib/general/gr_dpll_bb.h b/gnuradio-core/src/lib/general/gr_dpll_bb.h index e6b5fc0fa..8e748dddb 100644 --- a/gnuradio-core/src/lib/general/gr_dpll_bb.h +++ b/gnuradio-core/src/lib/general/gr_dpll_bb.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_DPLL_BB_H #define INCLUDED_GR_DPLL_BB_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_dpll_bb; typedef boost::shared_ptr<gr_dpll_bb> gr_dpll_bb_sptr; -gr_dpll_bb_sptr gr_make_dpll_bb (float period, float gain); +GR_CORE_API gr_dpll_bb_sptr gr_make_dpll_bb (float period, float gain); /*! * \brief Detect the peak of a signal @@ -37,9 +38,9 @@ gr_dpll_bb_sptr gr_make_dpll_bb (float period, float gain); * If a peak is detected, this block outputs a 1, * or it outputs 0's. */ -class gr_dpll_bb : public gr_sync_block +class GR_CORE_API gr_dpll_bb : public gr_sync_block { - friend gr_dpll_bb_sptr gr_make_dpll_bb (float period, float gain); + friend GR_CORE_API gr_dpll_bb_sptr gr_make_dpll_bb (float period, float gain); gr_dpll_bb (float period, float gain); diff --git a/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.h b/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.h index 86832ee05..e24ae9151 100644 --- a/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.h +++ b/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.h @@ -20,13 +20,14 @@ #ifndef INCLUDED_GR_ENCODE_CCSDS_27_BB_H #define INCLUDED_GR_ENCODE_CCSDS_27_BB_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_encode_ccsds_27_bb; typedef boost::shared_ptr<gr_encode_ccsds_27_bb> gr_encode_ccsds_27_bb_sptr; -gr_encode_ccsds_27_bb_sptr gr_make_encode_ccsds_27_bb(); +GR_CORE_API gr_encode_ccsds_27_bb_sptr gr_make_encode_ccsds_27_bb(); /*! \brief A rate 1/2, k=7 convolutional encoder for the CCSDS standard * \ingroup ecc @@ -44,10 +45,10 @@ gr_encode_ccsds_27_bb_sptr gr_make_encode_ccsds_27_bb(); * There is no provision to "flush" the encoder. */ -class gr_encode_ccsds_27_bb : public gr_sync_interpolator +class GR_CORE_API gr_encode_ccsds_27_bb : public gr_sync_interpolator { private: - friend gr_encode_ccsds_27_bb_sptr gr_make_encode_ccsds_27_bb(); + friend GR_CORE_API gr_encode_ccsds_27_bb_sptr gr_make_encode_ccsds_27_bb(); gr_encode_ccsds_27_bb(); unsigned char d_encstate; diff --git a/gnuradio-core/src/lib/general/gr_expj.h b/gnuradio-core/src/lib/general/gr_expj.h index 7adf3a0c6..6f1d56eb3 100644 --- a/gnuradio-core/src/lib/general/gr_expj.h +++ b/gnuradio-core/src/lib/general/gr_expj.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_EXPJ_H #define INCLUDED_GR_EXPJ_H +#include <gr_core_api.h> #include <gr_sincos.h> #include <gr_types.h> diff --git a/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.h b/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.h index 480fb8e78..2560c6105 100644 --- a/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.h +++ b/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_FAKE_CHANNEL_CODER_PP_H #define INCLUDED_GR_FAKE_CHANNEL_CODER_PP_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_fake_channel_encoder_pp; typedef boost::shared_ptr<gr_fake_channel_encoder_pp> gr_fake_channel_encoder_pp_sptr; -gr_fake_channel_encoder_pp_sptr +GR_CORE_API gr_fake_channel_encoder_pp_sptr gr_make_fake_channel_encoder_pp(int input_vlen, int output_vlen); /*! @@ -37,14 +38,14 @@ gr_make_fake_channel_encoder_pp(int input_vlen, int output_vlen); * * input: stream of byte vectors; output: stream of byte vectors */ -class gr_fake_channel_encoder_pp : public gr_sync_block +class GR_CORE_API gr_fake_channel_encoder_pp : public gr_sync_block { int d_input_vlen; int d_output_vlen; gr_fake_channel_encoder_pp(int input_vlen, int output_vlen); - friend gr_fake_channel_encoder_pp_sptr + friend GR_CORE_API gr_fake_channel_encoder_pp_sptr gr_make_fake_channel_encoder_pp(int input_vlen, int output_vlen); public: @@ -60,7 +61,7 @@ public: class gr_fake_channel_decoder_pp; typedef boost::shared_ptr<gr_fake_channel_decoder_pp> gr_fake_channel_decoder_pp_sptr; -gr_fake_channel_decoder_pp_sptr +GR_CORE_API gr_fake_channel_decoder_pp_sptr gr_make_fake_channel_decoder_pp(int input_vlen, int output_vlen); /*! @@ -69,14 +70,14 @@ gr_make_fake_channel_decoder_pp(int input_vlen, int output_vlen); * * input: stream of byte vectors; output: stream of byte vectors */ -class gr_fake_channel_decoder_pp : public gr_sync_block +class GR_CORE_API gr_fake_channel_decoder_pp : public gr_sync_block { int d_input_vlen; int d_output_vlen; gr_fake_channel_decoder_pp(int input_vlen, int output_vlen); - friend gr_fake_channel_decoder_pp_sptr + friend GR_CORE_API gr_fake_channel_decoder_pp_sptr gr_make_fake_channel_decoder_pp(int input_vlen, int output_vlen); public: diff --git a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.h b/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.h index 8c600d3d1..a97dbd958 100644 --- a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.h +++ b/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.h @@ -23,21 +23,22 @@ #ifndef INCLUDED_GR_FEEDFORWARD_AGC_CC_H #define INCLUDED_GR_FEEDFORWARD_AGC_CC_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_feedforward_agc_cc; typedef boost::shared_ptr<gr_feedforward_agc_cc> gr_feedforward_agc_cc_sptr; -gr_feedforward_agc_cc_sptr +GR_CORE_API gr_feedforward_agc_cc_sptr gr_make_feedforward_agc_cc(int nsamples, float reference = 1.0); /*! * \brief Non-causal AGC which computes required gain based on max absolute value over nsamples * \ingroup level_blk */ -class gr_feedforward_agc_cc : public gr_sync_block +class GR_CORE_API gr_feedforward_agc_cc : public gr_sync_block { - friend gr_feedforward_agc_cc_sptr + friend GR_CORE_API gr_feedforward_agc_cc_sptr gr_make_feedforward_agc_cc(int nsamples, float reference); int d_nsamples; diff --git a/gnuradio-core/src/lib/general/gr_feval.h b/gnuradio-core/src/lib/general/gr_feval.h index cc4209af0..a0e448ebf 100644 --- a/gnuradio-core/src/lib/general/gr_feval.h +++ b/gnuradio-core/src/lib/general/gr_feval.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_FEVAL_H #define INCLUDED_GR_FEVAL_H +#include <gr_core_api.h> #include <gr_complex.h> /*! @@ -37,7 +38,7 @@ * Use calleval to invoke eval (this kludge is required to allow a * python specific "shim" to be inserted. */ -class gr_feval_dd +class GR_CORE_API gr_feval_dd { protected: /*! @@ -65,7 +66,7 @@ public: * Use calleval to invoke eval (this kludge is required to allow a * python specific "shim" to be inserted. */ -class gr_feval_cc +class GR_CORE_API gr_feval_cc { protected: /*! @@ -93,7 +94,7 @@ public: * Use calleval to invoke eval (this kludge is required to allow a * python specific "shim" to be inserted. */ -class gr_feval_ll +class GR_CORE_API gr_feval_ll { protected: /*! @@ -121,7 +122,7 @@ public: * Use calleval to invoke eval (this kludge is required to allow a * python specific "shim" to be inserted. */ -class gr_feval +class GR_CORE_API gr_feval { protected: /*! @@ -139,9 +140,9 @@ public: /*! * \brief trivial examples / test cases showing C++ calling Python code */ -double gr_feval_dd_example(gr_feval_dd *f, double x); -gr_complex gr_feval_cc_example(gr_feval_cc *f, gr_complex x); -long gr_feval_ll_example(gr_feval_ll *f, long x); -void gr_feval_example(gr_feval *f); +GR_CORE_API double gr_feval_dd_example(gr_feval_dd *f, double x); +GR_CORE_API gr_complex gr_feval_cc_example(gr_feval_cc *f, gr_complex x); +GR_CORE_API long gr_feval_ll_example(gr_feval_ll *f, long x); +GR_CORE_API void gr_feval_example(gr_feval *f); #endif /* INCLUDED_GR_FEVAL_H */ diff --git a/gnuradio-core/src/lib/general/gr_fft_vcc.h b/gnuradio-core/src/lib/general/gr_fft_vcc.h index 2ab9241ec..a7c8e1162 100644 --- a/gnuradio-core/src/lib/general/gr_fft_vcc.h +++ b/gnuradio-core/src/lib/general/gr_fft_vcc.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_FFT_VCC_H #define INCLUDED_GR_FFT_VCC_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_fft_vcc; typedef boost::shared_ptr<gr_fft_vcc> gr_fft_vcc_sptr; -gr_fft_vcc_sptr +GR_CORE_API gr_fft_vcc_sptr gr_make_fft_vcc (int fft_size, bool forward, const std::vector<float> &window, bool shift=false); /*! @@ -37,10 +38,10 @@ gr_make_fft_vcc (int fft_size, bool forward, const std::vector<float> &window, b * * Abstract base class */ -class gr_fft_vcc : public gr_sync_block +class GR_CORE_API gr_fft_vcc : public gr_sync_block { protected: - friend gr_fft_vcc_sptr + friend GR_CORE_API gr_fft_vcc_sptr gr_make_fft_vcc (int fft_size, bool forward, const std::vector<float> &window, bool shift); unsigned int d_fft_size; diff --git a/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.h b/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.h index c026162ee..8535d133c 100644 --- a/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.h +++ b/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.h @@ -23,11 +23,12 @@ #ifndef INCLUDED_GR_FFT_VCC_FFTW_H #define INCLUDED_GR_FFT_VCC_FFTW_H +#include <gr_core_api.h> #include <gr_fft_vcc.h> class gri_fft_complex; -gr_fft_vcc_sptr +GR_CORE_API gr_fft_vcc_sptr gr_make_fft_vcc_fftw (int fft_size, bool forward, const std::vector<float> &window, bool shift=false); /*! @@ -36,9 +37,9 @@ gr_make_fft_vcc_fftw (int fft_size, bool forward, const std::vector<float> &wind * * Concrete class that uses FFTW. */ -class gr_fft_vcc_fftw : public gr_fft_vcc +class GR_CORE_API gr_fft_vcc_fftw : public gr_fft_vcc { - friend gr_fft_vcc_sptr + friend GR_CORE_API gr_fft_vcc_sptr gr_make_fft_vcc_fftw (int fft_size, bool forward, const std::vector<float> &window, bool shift); gri_fft_complex *d_fft; diff --git a/gnuradio-core/src/lib/general/gr_fft_vfc.h b/gnuradio-core/src/lib/general/gr_fft_vfc.h index 074574477..6cf6b9037 100644 --- a/gnuradio-core/src/lib/general/gr_fft_vfc.h +++ b/gnuradio-core/src/lib/general/gr_fft_vfc.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_FFT_VFC_H #define INCLUDED_GR_FFT_VFC_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gri_fft_complex; @@ -30,7 +31,7 @@ class gri_fft_complex; class gr_fft_vfc; typedef boost::shared_ptr<gr_fft_vfc> gr_fft_vfc_sptr; -gr_fft_vfc_sptr +GR_CORE_API gr_fft_vfc_sptr gr_make_fft_vfc (int fft_size, bool forward, const std::vector<float> &window); /*! @@ -38,9 +39,9 @@ gr_make_fft_vfc (int fft_size, bool forward, const std::vector<float> &window); * \ingroup dft_blk */ -class gr_fft_vfc : public gr_sync_block +class GR_CORE_API gr_fft_vfc : public gr_sync_block { - friend gr_fft_vfc_sptr + friend GR_CORE_API gr_fft_vfc_sptr gr_make_fft_vfc (int fft_size, bool forward, const std::vector<float> &window); unsigned int d_fft_size; diff --git a/gnuradio-core/src/lib/general/gr_firdes.h b/gnuradio-core/src/lib/general/gr_firdes.h index de775bd07..83fa7e119 100644 --- a/gnuradio-core/src/lib/general/gr_firdes.h +++ b/gnuradio-core/src/lib/general/gr_firdes.h @@ -23,6 +23,7 @@ #ifndef _GR_FIRDES_H_ #define _GR_FIRDES_H_ +#include <gr_core_api.h> #include <vector> #include <cmath> #include <gr_complex.h> @@ -32,7 +33,7 @@ * \ingroup filter_design */ -class gr_firdes { +class GR_CORE_API gr_firdes { public: enum win_type { diff --git a/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.cc b/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.cc deleted file mode 100644 index c32398e6d..000000000 --- a/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.cc +++ /dev/null @@ -1,214 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009,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_fll_band_edge_cc.h> -#include <gr_fir_ccc.h> -#include <gr_fir_util.h> -#include <gri_fft.h> -#include <gr_io_signature.h> -#include <gr_expj.h> -#include <gr_math.h> -#include <cstdio> - -#define M_TWOPI (2*M_PI) - -float sinc(float x) -{ - if(x == 0) - return 1; - else - return sin(M_PI*x)/(M_PI*x); -} - - - -gr_fll_band_edge_cc_sptr gr_make_fll_band_edge_cc (float samps_per_sym, float rolloff, - int filter_size, float gain_alpha, float gain_beta) -{ - return gnuradio::get_initial_sptr(new gr_fll_band_edge_cc (samps_per_sym, rolloff, - filter_size, gain_alpha, gain_beta)); -} - - -static int ios[] = {sizeof(gr_complex), sizeof(float), sizeof(float), sizeof(gr_complex)}; -static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int)); -gr_fll_band_edge_cc::gr_fll_band_edge_cc (float samps_per_sym, float rolloff, - int filter_size, float alpha, float beta) - : gr_sync_block ("fll_band_edge_cc", - gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signaturev (1, 4, iosig)), - d_alpha(alpha), d_beta(beta), d_updated (false) -{ - // base this on the number of samples per symbol - d_max_freq = M_TWOPI * (2.0/samps_per_sym); - d_min_freq = -M_TWOPI * (2.0/samps_per_sym); - - d_freq = 0; - d_phase = 0; - - set_alpha(alpha); - - design_filter(samps_per_sym, rolloff, filter_size); -} - -gr_fll_band_edge_cc::~gr_fll_band_edge_cc () -{ - delete d_filter_lower; - delete d_filter_upper; -} - -void -gr_fll_band_edge_cc::set_alpha(float alpha) -{ - //float eta = sqrt(2.0)/2.0; - //float theta = alpha; - //d_alpha = (4*eta*theta) / (1.0 + 2.0*eta*theta + theta*theta); - //d_beta = (4*theta*theta) / (1.0 + 2.0*eta*theta + theta*theta); - d_alpha = alpha; -} - -void -gr_fll_band_edge_cc::design_filter(float samps_per_sym, float rolloff, int filter_size) -{ - int M = rint(filter_size / samps_per_sym); - float power = 0; - std::vector<float> bb_taps; - for(int i = 0; i < filter_size; i++) { - float k = -M + i*2.0/samps_per_sym; - float tap = sinc(rolloff*k - 0.5) + sinc(rolloff*k + 0.5); - power += tap; - - bb_taps.push_back(tap); - } - - int N = (bb_taps.size() - 1.0)/2.0; - std::vector<gr_complex> taps_lower; - std::vector<gr_complex> taps_upper; - for(unsigned int i = 0; i < bb_taps.size(); i++) { - float tap = bb_taps[i] / power; - - float k = (-N + (int)i)/(2.0*samps_per_sym); - - gr_complex t1 = tap * gr_expj(-2*M_PI*(1+rolloff)*k); - gr_complex t2 = tap * gr_expj(2*M_PI*(1+rolloff)*k); - - taps_lower.push_back(t1); - taps_upper.push_back(t2); - } - - std::vector<gr_complex> vtaps(0, taps_lower.size()); - d_filter_upper = gr_fir_util::create_gr_fir_ccc(vtaps); - d_filter_lower = gr_fir_util::create_gr_fir_ccc(vtaps); - - d_filter_lower->set_taps(taps_lower); - d_filter_upper->set_taps(taps_upper); - - d_updated = true; - - // Set the history to ensure enough input items for each filter - set_history(filter_size+1); - -} - -void -gr_fll_band_edge_cc::print_taps() -{ - unsigned int i; - std::vector<gr_complex> taps_upper = d_filter_upper->get_taps(); - std::vector<gr_complex> taps_lower = d_filter_lower->get_taps(); - - printf("Upper Band-edge: ["); - for(i = 0; i < taps_upper.size(); i++) { - printf(" %.4e + %.4ej,", taps_upper[i].real(), taps_upper[i].imag()); - } - printf("]\n\n"); - - printf("Lower Band-edge: ["); - for(i = 0; i < taps_lower.size(); i++) { - printf(" %.4e + %.4ej,", taps_lower[i].real(), taps_lower[i].imag()); - } - printf("]\n\n"); -} - -int -gr_fll_band_edge_cc::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]; - gr_complex *out = (gr_complex *) output_items[0]; - - float *frq = NULL; - float *phs = NULL; - gr_complex *err = NULL; - if(output_items.size() > 2) { - frq = (float *) output_items[1]; - phs = (float *) output_items[2]; - err = (gr_complex *) output_items[3]; - } - - if (d_updated) { - d_updated = false; - return 0; // history requirements may have changed. - } - - int i; - gr_complex nco_out; - gr_complex out_upper, out_lower; - float error; - float avg_k = 0.1; - for(i = 0; i < noutput_items; i++) { - nco_out = gr_expj(d_phase); - out[i] = in[i] * nco_out; - - out_upper = (d_filter_upper->filter(&out[i])); - out_lower = (d_filter_lower->filter(&out[i])); - error = -real((out_upper + out_lower) * conj(out_upper - out_lower)); - d_error = avg_k*error + avg_k*d_error; // average error - - d_freq = d_freq + d_beta * d_error; - d_phase = d_phase + d_freq + d_alpha * d_error; - - if(d_phase > M_PI) - d_phase -= M_TWOPI; - else if(d_phase < -M_PI) - d_phase += M_TWOPI; - - if (d_freq > d_max_freq) - d_freq = d_max_freq; - else if (d_freq < d_min_freq) - d_freq = d_min_freq; - - if(output_items.size() > 2) { - frq[i] = d_freq; - phs[i] = d_phase; - err[i] = d_error; - } - } - - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.h b/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.h deleted file mode 100644 index db060793e..000000000 --- a/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.h +++ /dev/null @@ -1,139 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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_FLL_BAND_EDGE_CC_H -#define INCLUDED_GR_FLL_BAND_EDGE_CC_H - -#include <gr_sync_block.h> - -class gr_fll_band_edge_cc; -typedef boost::shared_ptr<gr_fll_band_edge_cc> gr_fll_band_edge_cc_sptr; -gr_fll_band_edge_cc_sptr gr_make_fll_band_edge_cc (float samps_per_sym, float rolloff, - int filter_size, float alpha, float beta); - -class gr_fir_ccc; -class gri_fft_complex; - -/*! - * \class gr_fll_band_edge_cc - * \brief Frequency Lock Loop using band-edge filters - * - * \ingroup general - * - * The frequency lock loop derives a band-edge filter that covers the upper and lower bandwidths - * of a digitally-modulated signal. The bandwidth range is determined by the excess bandwidth - * (e.g., rolloff factor) of the modulated signal. The placement in frequency of the band-edges - * is determined by the oversampling ratio (number of samples per symbol) and the excess bandwidth. - * The size of the filters should be fairly large so as to average over a number of symbols. - * - * The FLL works by filtering the upper and lower band edges into x_u(t) and x_l(t), respectively. - * These are combined to form cc(t) = x_u(t) + x_l(t) and ss(t) = x_u(t) - x_l(t). Combining - * these to form the signal e(t) = Re{cc(t) \\times ss(t)^*} (where ^* is the complex conjugate) - * provides an error signal at the DC term that is directly proportional to the carrier frequency. - * We then make a second-order loop using the error signal that is the running average of e(t). - * - * In theory, the band-edge filter is the derivative of the matched filter in frequency, - * (H_be(f) = \\frac{H(f)}{df}. In practice, this comes down to a quarter sine wave at the point - * of the matched filter's rolloff (if it's a raised-cosine, the derivative of a cosine is a sine). - * Extend this sine by another quarter wave to make a half wave around the band-edges is equivalent - * in time to the sum of two sinc functions. The baseband filter fot the band edges is therefore - * derived from this sum of sincs. The band edge filters are then just the baseband signal - * modulated to the correct place in frequency. All of these calculations are done in the - * 'design_filter' function. - * - * Note: We use FIR filters here because the filters have to have a flat phase response over the - * entire frequency range to allow their comparisons to be valid. - */ - -class gr_fll_band_edge_cc : public gr_sync_block -{ - private: - /*! - * Build the FLL - * \param samps_per_sym (float) Number of samples per symbol of signal - * \param rolloff (float) Rolloff factor of signal - * \param filter_size (int) Size (in taps) of the filter - * \param alpha (float) Loop gain 1 - * \param beta (float) Loop gain 2 - */ - friend gr_fll_band_edge_cc_sptr gr_make_fll_band_edge_cc (float samps_per_sym, float rolloff, - int filter_size, float alpha, float beta); - - float d_alpha; - float d_beta; - float d_max_freq; - float d_min_freq; - - gr_fir_ccc* d_filter_upper; - gr_fir_ccc* d_filter_lower; - bool d_updated; - float d_error; - float d_freq; - float d_phase; - - /*! - * Build the FLL - * \param samps_per_sym (float) number of samples per symbol - * \param rolloff (float) Rolloff (excess bandwidth) of signal filter - * \param filter_size (int) number of filter taps to generate - * \param alpha (float) Alpha gain in the control loop - * \param beta (float) Beta gain in the control loop - */ - gr_fll_band_edge_cc(float samps_per_sym, float rolloff, - int filter_size, float alpha, float beta); - -public: - ~gr_fll_band_edge_cc (); - - /*! - * Design the band-edge filter based on the number of samples per symbol, - * filter rolloff factor, and the filter size - * \param samps_per_sym (float) Number of samples per symbol of signal - * \param rolloff (float) Rolloff factor of signal - * \param filter_size (int) Size (in taps) of the filter - */ - void design_filter(float samps_per_sym, float rolloff, int filter_size); - - /*! - * Set the alpha gainvalue - * \param alpha (float) new gain value - */ - void set_alpha(float alpha); - - /*! - * Set the beta gain value - * \param beta (float) new gain value - */ - void set_beta(float beta) { d_beta = beta; } - - /*! - * Print the taps to screen. - */ - void print_taps(); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.i b/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.i deleted file mode 100644 index c9c792c8a..000000000 --- a/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.i +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 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,fll_band_edge_cc); - -gr_fll_band_edge_cc_sptr gr_make_fll_band_edge_cc (float samps_per_sym, float rolloff, - int filter_size, float alpha, float beta); - -class gr_fll_band_edge_cc : public gr_sync_block -{ - private: - gr_fll_band_edge_cc (float samps_per_sym, float rolloff, - int filter_size, float alpha, float beta); - - public: - ~gr_fll_band_edge_cc (); - - void set_alpha (float alpha); - void set_beta (float beta); - void design_filter(float samps_per_sym, float rolloff, int filter_size); - void print_taps(); -}; diff --git a/gnuradio-core/src/lib/general/gr_float_to_char.h b/gnuradio-core/src/lib/general/gr_float_to_char.h index e65072bf0..434e2e9d0 100644 --- a/gnuradio-core/src/lib/general/gr_float_to_char.h +++ b/gnuradio-core/src/lib/general/gr_float_to_char.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_FLOAT_TO_CHAR_H #define INCLUDED_GR_FLOAT_TO_CHAR_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_float_to_char; typedef boost::shared_ptr<gr_float_to_char> gr_float_to_char_sptr; -gr_float_to_char_sptr +GR_CORE_API gr_float_to_char_sptr gr_make_float_to_char (); /*! @@ -36,9 +37,9 @@ gr_make_float_to_char (); * \ingroup converter_blk */ -class gr_float_to_char : public gr_sync_block +class GR_CORE_API gr_float_to_char : public gr_sync_block { - friend gr_float_to_char_sptr gr_make_float_to_char (); + friend GR_CORE_API gr_float_to_char_sptr gr_make_float_to_char (); gr_float_to_char (); public: diff --git a/gnuradio-core/src/lib/general/gr_float_to_complex.h b/gnuradio-core/src/lib/general/gr_float_to_complex.h index f6cc24852..596b595f3 100644 --- a/gnuradio-core/src/lib/general/gr_float_to_complex.h +++ b/gnuradio-core/src/lib/general/gr_float_to_complex.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_FLOAT_TO_COMPLEX_H #define INCLUDED_GR_FLOAT_TO_COMPLEX_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_complex.h> class gr_float_to_complex; typedef boost::shared_ptr<gr_float_to_complex> gr_float_to_complex_sptr; -gr_float_to_complex_sptr +GR_CORE_API gr_float_to_complex_sptr gr_make_float_to_complex (size_t vlen = 1); /*! @@ -37,9 +38,9 @@ gr_make_float_to_complex (size_t vlen = 1); * \ingroup converter_blk */ -class gr_float_to_complex : public gr_sync_block +class GR_CORE_API gr_float_to_complex : public gr_sync_block { - friend gr_float_to_complex_sptr gr_make_float_to_complex (size_t vlen); + friend GR_CORE_API gr_float_to_complex_sptr gr_make_float_to_complex (size_t vlen); gr_float_to_complex (size_t vlen); size_t d_vlen; diff --git a/gnuradio-core/src/lib/general/gr_float_to_short.h b/gnuradio-core/src/lib/general/gr_float_to_short.h index e85343929..010d61141 100644 --- a/gnuradio-core/src/lib/general/gr_float_to_short.h +++ b/gnuradio-core/src/lib/general/gr_float_to_short.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_FLOAT_TO_SHORT_H #define INCLUDED_GR_FLOAT_TO_SHORT_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_float_to_short; typedef boost::shared_ptr<gr_float_to_short> gr_float_to_short_sptr; -gr_float_to_short_sptr +GR_CORE_API gr_float_to_short_sptr gr_make_float_to_short (); /*! @@ -36,9 +37,9 @@ gr_make_float_to_short (); * \ingroup converter_blk */ -class gr_float_to_short : public gr_sync_block +class GR_CORE_API gr_float_to_short : public gr_sync_block { - friend gr_float_to_short_sptr gr_make_float_to_short (); + friend GR_CORE_API gr_float_to_short_sptr gr_make_float_to_short (); gr_float_to_short (); public: diff --git a/gnuradio-core/src/lib/general/gr_float_to_uchar.h b/gnuradio-core/src/lib/general/gr_float_to_uchar.h index 3bca9c555..fca8eb07b 100644 --- a/gnuradio-core/src/lib/general/gr_float_to_uchar.h +++ b/gnuradio-core/src/lib/general/gr_float_to_uchar.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_FLOAT_TO_UCHAR_H #define INCLUDED_GR_FLOAT_TO_UCHAR_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_float_to_uchar; typedef boost::shared_ptr<gr_float_to_uchar> gr_float_to_uchar_sptr; -gr_float_to_uchar_sptr +GR_CORE_API gr_float_to_uchar_sptr gr_make_float_to_uchar (); /*! @@ -36,9 +37,9 @@ gr_make_float_to_uchar (); * \ingroup converter_blk */ -class gr_float_to_uchar : public gr_sync_block +class GR_CORE_API gr_float_to_uchar : public gr_sync_block { - friend gr_float_to_uchar_sptr gr_make_float_to_uchar (); + friend GR_CORE_API gr_float_to_uchar_sptr gr_make_float_to_uchar (); gr_float_to_uchar (); public: diff --git a/gnuradio-core/src/lib/general/gr_fmdet_cf.h b/gnuradio-core/src/lib/general/gr_fmdet_cf.h index 792646bef..7bf3baa3f 100644 --- a/gnuradio-core/src/lib/general/gr_fmdet_cf.h +++ b/gnuradio-core/src/lib/general/gr_fmdet_cf.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_FMDET_CF_H #define INCLUDED_GR_FMDET_CF_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_fmdet_cf; typedef boost::shared_ptr<gr_fmdet_cf> gr_fmdet_cf_sptr; -gr_fmdet_cf_sptr gr_make_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl); +GR_CORE_API gr_fmdet_cf_sptr gr_make_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl); class gr_fir_ccf; @@ -43,9 +44,9 @@ class gr_fir_ccf; * normalization by the magnitude of the sample */ -class gr_fmdet_cf : public gr_sync_block +class GR_CORE_API gr_fmdet_cf : public gr_sync_block { - friend gr_fmdet_cf_sptr gr_make_fmdet_cf (float samplerate, float freq_low, + friend GR_CORE_API gr_fmdet_cf_sptr gr_make_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl); gr_complex d_S1,d_S2,d_S3,d_S4; diff --git a/gnuradio-core/src/lib/general/gr_framer_sink_1.h b/gnuradio-core/src/lib/general/gr_framer_sink_1.h index 3f2e8aa88..95ad6ced7 100644 --- a/gnuradio-core/src/lib/general/gr_framer_sink_1.h +++ b/gnuradio-core/src/lib/general/gr_framer_sink_1.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_FRAMER_SINK_1_H #define INCLUDED_GR_FRAMER_SINK_1_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_msg_queue.h> class gr_framer_sink_1; typedef boost::shared_ptr<gr_framer_sink_1> gr_framer_sink_1_sptr; -gr_framer_sink_1_sptr +GR_CORE_API gr_framer_sink_1_sptr gr_make_framer_sink_1 (gr_msg_queue_sptr target_queue); /*! @@ -50,9 +51,9 @@ gr_make_framer_sink_1 (gr_msg_queue_sptr target_queue); * the first bit of the packet. That is, this bit is the first * one after the access code. */ -class gr_framer_sink_1 : public gr_sync_block +class GR_CORE_API gr_framer_sink_1 : public gr_sync_block { - friend gr_framer_sink_1_sptr + friend GR_CORE_API gr_framer_sink_1_sptr gr_make_framer_sink_1 (gr_msg_queue_sptr target_queue); private: diff --git a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h index 55f8412ce..932e7da36 100644 --- a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h +++ b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_FREQUENCY_MODULATOR_FC_H #define INCLUDED_GR_FREQUENCY_MODULATOR_FC_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_frequency_modulator_fc; typedef boost::shared_ptr<gr_frequency_modulator_fc> gr_frequency_modulator_fc_sptr; -gr_frequency_modulator_fc_sptr gr_make_frequency_modulator_fc (double sensitivity); +GR_CORE_API gr_frequency_modulator_fc_sptr gr_make_frequency_modulator_fc (double sensitivity); /*! * \brief Frequency modulator block @@ -36,19 +37,19 @@ gr_frequency_modulator_fc_sptr gr_make_frequency_modulator_fc (double sensitivit * * float input; complex baseband output */ -class gr_frequency_modulator_fc : public gr_sync_block +class GR_CORE_API gr_frequency_modulator_fc : public gr_sync_block { double d_sensitivity; double d_phase; - friend gr_frequency_modulator_fc_sptr + friend GR_CORE_API gr_frequency_modulator_fc_sptr gr_make_frequency_modulator_fc (double sensitivity); gr_frequency_modulator_fc (double sensitivity); public: void set_sensitivity(float sens) { d_sensitivity = sens; } - float get_sensitivity() { return d_sensitivity; } + float sensitivity() const { return d_sensitivity; } int work (int noutput_items, gr_vector_const_void_star &input_items, diff --git a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i index 04d9a41ba..7dfb82f1f 100644 --- a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i +++ b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i @@ -30,5 +30,5 @@ class gr_frequency_modulator_fc : public gr_sync_block gr_frequency_modulator_fc (double sensitivity); public: void set_sensitivity(float sens) { d_sensitivity = sens; } - float get_sensitivity() { return d_sensitivity; } + float sensitivity() const { return d_sensitivity; } }; diff --git a/gnuradio-core/src/lib/general/gr_fxpt.h b/gnuradio-core/src/lib/general/gr_fxpt.h index c98d31b27..5cf736dfb 100644 --- a/gnuradio-core/src/lib/general/gr_fxpt.h +++ b/gnuradio-core/src/lib/general/gr_fxpt.h @@ -22,10 +22,11 @@ #ifndef INCLUDED_GR_FXPT_H #define INCLUDED_GR_FXPT_H +#include <gr_core_api.h> #include <gr_types.h> /*! - * \brief fixed point sine and cosine and friends. + * \brief fixed point sine and cosine and friend GR_CORE_APIs. * \ingroup misc * * fixed pt radians @@ -35,7 +36,7 @@ * 2**31-1 pi - epsilon * */ -class gr_fxpt +class GR_CORE_API gr_fxpt { static const int WORDBITS = 32; static const int NBITS = 10; diff --git a/gnuradio-core/src/lib/general/gr_fxpt_nco.h b/gnuradio-core/src/lib/general/gr_fxpt_nco.h index ca0d54f02..5597efb4f 100644 --- a/gnuradio-core/src/lib/general/gr_fxpt_nco.h +++ b/gnuradio-core/src/lib/general/gr_fxpt_nco.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_FXPT_NCO_H #define INCLUDED_GR_FXPT_NCO_H +#include <gr_core_api.h> #include <gr_fxpt.h> #include <gr_complex.h> @@ -29,7 +30,7 @@ * \brief Numerically Controlled Oscillator (NCO) * \ingroup misc */ -class gr_fxpt_nco { +class GR_CORE_API gr_fxpt_nco { gr_uint32 d_phase; gr_int32 d_phase_inc; diff --git a/gnuradio-core/src/lib/general/gr_fxpt_vco.h b/gnuradio-core/src/lib/general/gr_fxpt_vco.h index 1ff968b79..a77a31311 100644 --- a/gnuradio-core/src/lib/general/gr_fxpt_vco.h +++ b/gnuradio-core/src/lib/general/gr_fxpt_vco.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_FXPT_VCO_H #define INCLUDED_GR_FXPT_VCO_H +#include <gr_core_api.h> #include <gr_fxpt.h> #include <gr_complex.h> @@ -29,7 +30,7 @@ * \brief Voltage Controlled Oscillator (VCO) * \ingroup misc */ -class gr_fxpt_vco { +class GR_CORE_API gr_fxpt_vco { gr_int32 d_phase; public: diff --git a/gnuradio-core/src/lib/general/gr_glfsr_source_b.h b/gnuradio-core/src/lib/general/gr_glfsr_source_b.h index cff8df11b..bd66912ed 100644 --- a/gnuradio-core/src/lib/general/gr_glfsr_source_b.h +++ b/gnuradio-core/src/lib/general/gr_glfsr_source_b.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_GLFSR_SOURCE_B_H #define INCLUDED_GR_GLFSR_SOURCE_B_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gri_glfsr; @@ -30,16 +31,16 @@ class gri_glfsr; class gr_glfsr_source_b; typedef boost::shared_ptr<gr_glfsr_source_b> gr_glfsr_source_b_sptr; -gr_glfsr_source_b_sptr gr_make_glfsr_source_b(int degree, bool repeat=true, int mask=0, int seed=1); +GR_CORE_API gr_glfsr_source_b_sptr gr_make_glfsr_source_b(int degree, bool repeat=true, int mask=0, int seed=1); /*! * \brief Galois LFSR pseudo-random source * \ingroup source_blk */ -class gr_glfsr_source_b : public gr_sync_block +class GR_CORE_API gr_glfsr_source_b : public gr_sync_block { private: - friend gr_glfsr_source_b_sptr + friend GR_CORE_API gr_glfsr_source_b_sptr gr_make_glfsr_source_b(int degree, bool repeat, int mask, int seed); gri_glfsr *d_glfsr; diff --git a/gnuradio-core/src/lib/general/gr_glfsr_source_f.h b/gnuradio-core/src/lib/general/gr_glfsr_source_f.h index 007970806..2dd09c5ac 100644 --- a/gnuradio-core/src/lib/general/gr_glfsr_source_f.h +++ b/gnuradio-core/src/lib/general/gr_glfsr_source_f.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_GLFSR_SOURCE_F_H #define INCLUDED_GR_GLFSR_SOURCE_F_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gri_glfsr; @@ -30,16 +31,16 @@ class gri_glfsr; class gr_glfsr_source_f; typedef boost::shared_ptr<gr_glfsr_source_f> gr_glfsr_source_f_sptr; -gr_glfsr_source_f_sptr gr_make_glfsr_source_f(int degree, bool repeat=true, int mask=0, int seed=1); +GR_CORE_API gr_glfsr_source_f_sptr gr_make_glfsr_source_f(int degree, bool repeat=true, int mask=0, int seed=1); /*! * \brief Galois LFSR pseudo-random source generating float outputs -1.0 - 1.0 * \ingroup source_blk */ -class gr_glfsr_source_f : public gr_sync_block +class GR_CORE_API gr_glfsr_source_f : public gr_sync_block { private: - friend gr_glfsr_source_f_sptr + friend GR_CORE_API gr_glfsr_source_f_sptr gr_make_glfsr_source_f(int degree, bool repeat, int mask, int seed); gri_glfsr *d_glfsr; diff --git a/gnuradio-core/src/lib/general/gr_head.h b/gnuradio-core/src/lib/general/gr_head.h index f7eee1064..f66d43308 100644 --- a/gnuradio-core/src/lib/general/gr_head.h +++ b/gnuradio-core/src/lib/general/gr_head.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_HEAD_H #define INCLUDED_GR_HEAD_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <stddef.h> // size_t @@ -36,9 +37,9 @@ typedef boost::shared_ptr<gr_head> gr_head_sptr; * Useful for building test cases */ -class gr_head : public gr_sync_block +class GR_CORE_API gr_head : public gr_sync_block { - friend gr_head_sptr gr_make_head (size_t sizeof_stream_item, unsigned long long nitems); + friend GR_CORE_API gr_head_sptr gr_make_head (size_t sizeof_stream_item, unsigned long long nitems); gr_head (size_t sizeof_stream_item, unsigned long long nitems); unsigned long long d_nitems; @@ -52,7 +53,7 @@ class gr_head : public gr_sync_block void reset() { d_ncopied_items = 0; } }; -gr_head_sptr +GR_CORE_API gr_head_sptr gr_make_head (size_t sizeof_stream_item, unsigned long long nitems); diff --git a/gnuradio-core/src/lib/general/gr_int_to_float.h b/gnuradio-core/src/lib/general/gr_int_to_float.h index cf1223be5..9af381ba9 100644 --- a/gnuradio-core/src/lib/general/gr_int_to_float.h +++ b/gnuradio-core/src/lib/general/gr_int_to_float.h @@ -23,22 +23,23 @@ #ifndef INCLUDED_GR_INT_TO_FLOAT_H #define INCLUDED_GR_INT_TO_FLOAT_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_int_to_float; typedef boost::shared_ptr<gr_int_to_float> gr_int_to_float_sptr; -gr_int_to_float_sptr +GR_CORE_API gr_int_to_float_sptr gr_make_int_to_float (); /*! - * \brief Convert stream of short to a stream of float + * \brief Convert stream of int to a stream of float * \ingroup converter_blk */ -class gr_int_to_float : public gr_sync_block +class GR_CORE_API gr_int_to_float : public gr_sync_block { - friend gr_int_to_float_sptr gr_make_int_to_float (); + friend GR_CORE_API gr_int_to_float_sptr gr_make_int_to_float (); gr_int_to_float (); public: diff --git a/gnuradio-core/src/lib/general/gr_interleave.h b/gnuradio-core/src/lib/general/gr_interleave.h index faffdd757..ef7bce07a 100644 --- a/gnuradio-core/src/lib/general/gr_interleave.h +++ b/gnuradio-core/src/lib/general/gr_interleave.h @@ -23,20 +23,21 @@ #ifndef INCLUDED_GR_INTERLEAVE_H #define INCLUDED_GR_INTERLEAVE_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_interleave; typedef boost::shared_ptr<gr_interleave> gr_interleave_sptr; -gr_interleave_sptr gr_make_interleave (size_t itemsize); +GR_CORE_API gr_interleave_sptr gr_make_interleave (size_t itemsize); /*! * \brief interleave N inputs to a single output * \ingroup slicedice_blk */ -class gr_interleave : public gr_sync_interpolator +class GR_CORE_API gr_interleave : public gr_sync_interpolator { - friend gr_interleave_sptr gr_make_interleave (size_t itemsize); + friend GR_CORE_API gr_interleave_sptr gr_make_interleave (size_t itemsize); size_t d_itemsize; diff --git a/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.h b/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.h index c79a9370f..40f1636bd 100644 --- a/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.h +++ b/gnuradio-core/src/lib/general/gr_interleaved_short_to_complex.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_INTERLEAVED_SHORT_TO_COMPLEX_H #define INCLUDED_GR_INTERLEAVED_SHORT_TO_COMPLEX_H +#include <gr_core_api.h> #include <gr_sync_decimator.h> class gr_interleaved_short_to_complex; typedef boost::shared_ptr<gr_interleaved_short_to_complex> gr_interleaved_short_to_complex_sptr; -gr_interleaved_short_to_complex_sptr +GR_CORE_API gr_interleaved_short_to_complex_sptr gr_make_interleaved_short_to_complex (); /*! @@ -37,9 +38,9 @@ gr_make_interleaved_short_to_complex (); * \ingroup converter_blk */ -class gr_interleaved_short_to_complex : public gr_sync_decimator +class GR_CORE_API gr_interleaved_short_to_complex : public gr_sync_decimator { - friend gr_interleaved_short_to_complex_sptr gr_make_interleaved_short_to_complex (); + friend GR_CORE_API gr_interleaved_short_to_complex_sptr gr_make_interleaved_short_to_complex (); gr_interleaved_short_to_complex (); public: diff --git a/gnuradio-core/src/lib/general/gr_iqcomp_cc.h b/gnuradio-core/src/lib/general/gr_iqcomp_cc.h index f4c6cf8ea..c01e2a6ba 100644 --- a/gnuradio-core/src/lib/general/gr_iqcomp_cc.h +++ b/gnuradio-core/src/lib/general/gr_iqcomp_cc.h @@ -24,20 +24,21 @@ #ifndef INCLUDED_GR_IQCOMP_CC_H #define INCLUDED_GR_IQCOMP_CC_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_iqcomp_cc; typedef boost::shared_ptr<gr_iqcomp_cc> gr_iqcomp_cc_sptr; -gr_iqcomp_cc_sptr gr_make_iqcomp_cc (float mu); +GR_CORE_API gr_iqcomp_cc_sptr gr_make_iqcomp_cc (float mu); /*! * \brief * \ingroup misc_blk */ -class gr_iqcomp_cc : public gr_sync_block +class GR_CORE_API gr_iqcomp_cc : public gr_sync_block { - friend gr_iqcomp_cc_sptr gr_make_iqcomp_cc (float mu); + friend GR_CORE_API gr_iqcomp_cc_sptr gr_make_iqcomp_cc (float mu); float d_mu, d_wi, d_wq; gr_iqcomp_cc (float mu); diff --git a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc index 8bccefa95..3f98a003b 100644 --- a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc +++ b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc @@ -91,15 +91,13 @@ gr_keep_one_in_n::general_work (int noutput_items, // Because we have set TPP_DONT, we have to propagate the tags here manually. // Adjustment of the tag sample value is done using the float d_decim_rate. - std::vector<pmt::pmt_t> tags; - std::vector<pmt::pmt_t>::iterator t; + std::vector<gr_tag_t> tags; + std::vector<gr_tag_t>::iterator t; get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0)+ni); for(t = tags.begin(); t != tags.end(); t++) { - uint64_t newcount = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*t, 0)); - add_item_tag(0, newcount * d_decim_rate, - pmt::pmt_tuple_ref(*t, 1), - pmt::pmt_tuple_ref(*t, 2), - pmt::pmt_tuple_ref(*t, 3)); + gr_tag_t new_tag = *t; + new_tag.offset *= d_decim_rate; + add_item_tag(0, new_tag); } consume_each (ni); diff --git a/gnuradio-core/src/lib/general/gr_keep_one_in_n.h b/gnuradio-core/src/lib/general/gr_keep_one_in_n.h index ba573618e..c32ed2a26 100644 --- a/gnuradio-core/src/lib/general/gr_keep_one_in_n.h +++ b/gnuradio-core/src/lib/general/gr_keep_one_in_n.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_KEEP_ONE_IN_N_H #define INCLUDED_GR_KEEP_ONE_IN_N_H +#include <gr_core_api.h> #include <gr_sync_decimator.h> class gr_keep_one_in_n; typedef boost::shared_ptr<gr_keep_one_in_n> gr_keep_one_in_n_sptr; -gr_keep_one_in_n_sptr +GR_CORE_API gr_keep_one_in_n_sptr gr_make_keep_one_in_n (size_t item_size, int n); @@ -36,9 +37,9 @@ gr_make_keep_one_in_n (size_t item_size, int n); * \brief decimate a stream, keeping one item out of every n. * \ingroup slicedice_blk */ -class gr_keep_one_in_n : public gr_block +class GR_CORE_API gr_keep_one_in_n : public gr_block { - friend gr_keep_one_in_n_sptr + friend GR_CORE_API gr_keep_one_in_n_sptr gr_make_keep_one_in_n (size_t item_size, int n); int d_n; diff --git a/gnuradio-core/src/lib/general/gr_kludge_copy.h b/gnuradio-core/src/lib/general/gr_kludge_copy.h index 90fd047df..5c1e461a8 100644 --- a/gnuradio-core/src/lib/general/gr_kludge_copy.h +++ b/gnuradio-core/src/lib/general/gr_kludge_copy.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_KLUDGE_COPY_H #define INCLUDED_GR_KLUDGE_COPY_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_kludge_copy; typedef boost::shared_ptr<gr_kludge_copy> gr_kludge_copy_sptr; -gr_kludge_copy_sptr gr_make_kludge_copy(size_t itemsize); +GR_CORE_API gr_kludge_copy_sptr gr_make_kludge_copy(size_t itemsize); /*! * \brief output[i] = input[i] @@ -36,11 +37,11 @@ gr_kludge_copy_sptr gr_make_kludge_copy(size_t itemsize); * * This is a short term kludge to work around a problem with the hierarchical block impl. */ -class gr_kludge_copy : public gr_sync_block +class GR_CORE_API gr_kludge_copy : public gr_sync_block { size_t d_itemsize; - friend gr_kludge_copy_sptr gr_make_kludge_copy(size_t itemsize); + friend GR_CORE_API gr_kludge_copy_sptr gr_make_kludge_copy(size_t itemsize); gr_kludge_copy(size_t itemsize); public: diff --git a/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.h b/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.h index f8497e4cb..aa7ad7b1f 100644 --- a/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.h +++ b/gnuradio-core/src/lib/general/gr_lfsr_32k_source_s.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_LFSR_32K_SOURCE_S_H #define INCLUDED_GR_LFSR_32K_SOURCE_S_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gri_lfsr_32k.h> class gr_lfsr_32k_source_s; typedef boost::shared_ptr<gr_lfsr_32k_source_s> gr_lfsr_32k_source_s_sptr; -gr_lfsr_32k_source_s_sptr gr_make_lfsr_32k_source_s (); +GR_CORE_API gr_lfsr_32k_source_s_sptr gr_make_lfsr_32k_source_s (); /*! * \brief LFSR pseudo-random source with period of 2^15 bits (2^11 shorts) @@ -38,9 +39,9 @@ gr_lfsr_32k_source_s_sptr gr_make_lfsr_32k_source_s (); * This source is typically used along with gr_check_lfsr_32k_s to test * the USRP using its digital loopback mode. */ -class gr_lfsr_32k_source_s : public gr_sync_block +class GR_CORE_API gr_lfsr_32k_source_s : public gr_sync_block { - friend gr_lfsr_32k_source_s_sptr gr_make_lfsr_32k_source_s (); + friend GR_CORE_API gr_lfsr_32k_source_s_sptr gr_make_lfsr_32k_source_s (); static const int BUFSIZE = 2048 - 1; // ensure pattern isn't packet aligned diff --git a/gnuradio-core/src/lib/general/gr_lms_dfe_cc.cc b/gnuradio-core/src/lib/general/gr_lms_dfe_cc.cc deleted file mode 100644 index 8659386d5..000000000 --- a/gnuradio-core/src/lib/general/gr_lms_dfe_cc.cc +++ /dev/null @@ -1,148 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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_lms_dfe_cc.h> -#include <gr_io_signature.h> -#include <gr_misc.h> -#include <iostream> - -gr_complex -gr_lms_dfe_cc::slicer_0deg (gr_complex sample) -{ - gr_complex out; - if(fabs(real(sample))>fabs(imag(sample))) { - if(real(sample) > 0) - out = gr_complex(1,0); - else - out = gr_complex(-1,0); - } - else { - if(imag(sample) > 0) - out = gr_complex(0,1); - else - out = gr_complex(0,-1); - } - return out; -} - -gr_complex -gr_lms_dfe_cc::slicer_45deg (gr_complex sample) -{ - gr_complex out; - if(real(sample) > 0) - out = gr_complex(1,0); - else - out = gr_complex(-1,0); - if(imag(sample) > 0) - out += gr_complex(0,1); - else - out += gr_complex(0,-1); - return out; -} - -gr_lms_dfe_cc_sptr -gr_make_lms_dfe_cc (float lambda_ff, float lambda_fb, - unsigned int num_fftaps, unsigned int num_fbtaps) -{ - return gnuradio::get_initial_sptr(new gr_lms_dfe_cc (lambda_ff, lambda_fb, - num_fftaps, num_fbtaps)); -} - -gr_lms_dfe_cc::gr_lms_dfe_cc (float lambda_ff, float lambda_fb , - unsigned int num_fftaps, unsigned int num_fbtaps) - : gr_sync_block ("lms_dfe_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (gr_complex))), - d_lambda_ff (lambda_ff), d_lambda_fb (lambda_fb), - d_ff_delayline(gr_rounduppow2(num_fftaps)), - d_fb_delayline(gr_rounduppow2(num_fbtaps)), - d_ff_taps(num_fftaps),d_fb_taps(num_fbtaps), - d_ff_index(0), d_fb_index(0) -{ - gr_zero_vector(d_ff_taps); - d_ff_taps [d_ff_taps.size()/2] = 1; - - gr_zero_vector(d_fb_taps); - gr_zero_vector(d_ff_delayline); - gr_zero_vector(d_fb_delayline); -} - -int -gr_lms_dfe_cc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *iptr = (const gr_complex *) input_items[0]; - gr_complex *optr = (gr_complex *) output_items[0]; - - gr_complex acc, decision, error; - unsigned int i; - - unsigned int ff_mask = d_ff_delayline.size() - 1; // size is power of 2 - unsigned int fb_mask = d_fb_delayline.size() - 1; - - int size = noutput_items; - while (size-- > 0){ - acc = 0; - d_ff_delayline[d_ff_index] = *iptr++; - - // Compute output - for (i=0; i < d_ff_taps.size(); i++) - acc += conj(d_ff_delayline[(i+d_ff_index) & ff_mask]) * d_ff_taps[i]; - - for (i=0; i < d_fb_taps.size(); i++) - acc -= conj(d_fb_delayline[(i+d_fb_index) & fb_mask]) * d_fb_taps[i]; - - decision = slicer_45deg(acc); - error = decision - acc; - - // Update taps - for (i=0; i < d_ff_taps.size(); i++) - d_ff_taps[i] += d_lambda_ff * conj(error) * d_ff_delayline[(i+d_ff_index) & ff_mask]; - - for (i=0; i < d_fb_taps.size(); i++) - d_fb_taps[i] -= d_lambda_fb * conj(error) * d_fb_delayline[(i+d_fb_index) & fb_mask]; - - d_fb_index = (d_fb_index - 1) & fb_mask; // Decrement index - d_ff_index = (d_ff_index - 1) & ff_mask; // Decrement index - - d_fb_delayline[d_fb_index] = decision; // Save decision in feedback - - *optr++ = acc; // Output decision - } - - if (0){ - std::cout << "FF Taps\t"; - for(i=0;i<d_ff_taps.size();i++) - std::cout << d_ff_taps[i] << "\t"; - std::cout << std::endl << "FB Taps\t"; - for(i=0;i<d_fb_taps.size();i++) - std::cout << d_fb_taps[i] << "\t"; - std::cout << std::endl; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_lms_dfe_cc.h b/gnuradio-core/src/lib/general/gr_lms_dfe_cc.h deleted file mode 100644 index 7b3a2c84e..000000000 --- a/gnuradio-core/src/lib/general/gr_lms_dfe_cc.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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_LMS_DFE_CC_H -#define INCLUDED_GR_LMS_DFE_CC_H - -#include <gr_sync_block.h> - -class gr_lms_dfe_cc; -typedef boost::shared_ptr<gr_lms_dfe_cc> gr_lms_dfe_cc_sptr; - -gr_lms_dfe_cc_sptr gr_make_lms_dfe_cc (float lambda_ff, float lambda_fb, - unsigned int num_fftaps, unsigned int num_fbtaps); - -/*! - * \brief Least-Mean-Square Decision Feedback Equalizer (complex in/out) - * \ingroup eq_blk - */ -class gr_lms_dfe_cc : public gr_sync_block -{ - friend gr_lms_dfe_cc_sptr gr_make_lms_dfe_cc (float lambda_ff, float lambda_fb, - unsigned int num_fftaps, unsigned int num_fbtaps); - - float d_lambda_ff; - float d_lambda_fb; - std::vector<gr_complex> d_ff_delayline; - std::vector<gr_complex> d_fb_delayline; - std::vector<gr_complex> d_ff_taps; - std::vector<gr_complex> d_fb_taps; - unsigned int d_ff_index; - unsigned int d_fb_index; - - gr_lms_dfe_cc (float lambda_ff, float lambda_fb, - unsigned int num_fftaps, unsigned int num_fbtaps); - gr_complex slicer_0deg(gr_complex baud); - gr_complex slicer_45deg(gr_complex baud); - - public: - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_lms_dfe_cc.i b/gnuradio-core/src/lib/general/gr_lms_dfe_cc.i deleted file mode 100644 index 9a9f22b6e..000000000 --- a/gnuradio-core/src/lib/general/gr_lms_dfe_cc.i +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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,lms_dfe_cc) - -gr_lms_dfe_cc_sptr gr_make_lms_dfe_cc (float lambda_ff, float lambda_fb, - unsigned int num_fftaps, unsigned int num_fbtaps); - -class gr_lms_dfe_cc : public gr_sync_block -{ - private: - gr_lms_dfe_cc (float lambda_ff, float lambda_fb, - unsigned int num_fftaps, unsigned int num_fbtaps); - gr_complex slicer_0deg(gr_complex baud); - gr_complex slicer_45deg(gr_complex baud); - gr_complex conjg(gr_complex val); -}; diff --git a/gnuradio-core/src/lib/general/gr_lms_dfe_ff.cc b/gnuradio-core/src/lib/general/gr_lms_dfe_ff.cc deleted file mode 100644 index 8a5e22c2f..000000000 --- a/gnuradio-core/src/lib/general/gr_lms_dfe_ff.cc +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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_lms_dfe_ff.h> -#include <gr_io_signature.h> -#include <gr_misc.h> -#include <iostream> - -float -slice(float val) -{ - if (val>0) - return 1; - else - return -1; -} - -gr_lms_dfe_ff_sptr -gr_make_lms_dfe_ff (float lambda_ff, float lambda_fb, - unsigned int num_fftaps, unsigned int num_fbtaps) -{ - return gnuradio::get_initial_sptr(new gr_lms_dfe_ff (lambda_ff,lambda_fb,num_fftaps,num_fbtaps)); -} - -gr_lms_dfe_ff::gr_lms_dfe_ff (float lambda_ff, float lambda_fb , - unsigned int num_fftaps, unsigned int num_fbtaps) - : gr_sync_block ("lms_dfe_ff", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (float))), - d_lambda_ff (lambda_ff), d_lambda_fb (lambda_fb), - d_ff_delayline(gr_rounduppow2(num_fftaps)), - d_fb_delayline(gr_rounduppow2(num_fbtaps)), - d_ff_taps(num_fftaps), d_fb_taps(num_fbtaps), - d_ff_index(0), d_fb_index(0) -{ - gr_zero_vector(d_ff_taps); - d_ff_taps [d_ff_taps.size()/2] = 1; - - gr_zero_vector(d_fb_taps); - gr_zero_vector(d_ff_delayline); - gr_zero_vector(d_fb_delayline); -} - -int -gr_lms_dfe_ff::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *iptr = (const float *) input_items[0]; - float *optr = (float *) output_items[0]; - - float acc, decision, error; - unsigned int i; - - unsigned int ff_mask = d_ff_delayline.size() - 1; // size is power of 2 - unsigned int fb_mask = d_fb_delayline.size() - 1; - - int size = noutput_items; - while(size-- > 0) { - acc = 0; - d_ff_delayline[d_ff_index] = *iptr++; - - // Compute output - for (i=0; i < d_ff_taps.size(); i++) - acc += d_ff_delayline[(i+d_ff_index) & ff_mask] * d_ff_taps[i]; - - for (i=0; i < d_fb_taps.size(); i++) - acc -= d_fb_delayline[(i+d_fb_index) & fb_mask] * d_fb_taps[i]; - - decision = slice(acc); - error = decision - acc; - - // Update taps - for (i=0; i < d_ff_taps.size(); i++) - d_ff_taps[i] += d_lambda_ff * error * d_ff_delayline[(i+d_ff_index) & ff_mask]; - - for (i=0; i < d_fb_taps.size(); i++) - d_fb_taps[i] -= d_lambda_fb * error * d_fb_delayline[(i+d_fb_index) & fb_mask]; - - d_fb_index = (d_fb_index - 1) & fb_mask; // Decrement index - d_ff_index = (d_ff_index - 1) & ff_mask; // Decrement index - - d_fb_delayline[d_fb_index] = decision; // Save decision in feedback - - *optr++ = acc; // Output decision - } - - if (0){ - std::cout << "FF Taps\t"; - for(i=0;i<d_ff_taps.size();i++) - std::cout << d_ff_taps[i] << "\t"; - std::cout << std::endl << "FB Taps\t"; - for(i=0;i<d_fb_taps.size();i++) - std::cout << d_fb_taps[i] << "\t"; - std::cout << std::endl; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_lms_dfe_ff.h b/gnuradio-core/src/lib/general/gr_lms_dfe_ff.h deleted file mode 100644 index dd610c470..000000000 --- a/gnuradio-core/src/lib/general/gr_lms_dfe_ff.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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_LMS_DFE_FF_H -#define INCLUDED_GR_LMS_DFE_FF_H - -#include <gr_sync_block.h> - -class gr_lms_dfe_ff; -typedef boost::shared_ptr<gr_lms_dfe_ff> gr_lms_dfe_ff_sptr; - -gr_lms_dfe_ff_sptr gr_make_lms_dfe_ff (float lambda_ff, float lambda_fb, - unsigned int num_fftaps, unsigned int num_fbtaps); - -/*! - * \brief Least-Mean-Square Decision Feedback Equalizer (float in/out) - * \ingroup eq_blk - */ -class gr_lms_dfe_ff : public gr_sync_block -{ - friend gr_lms_dfe_ff_sptr gr_make_lms_dfe_ff (float lambda_ff, float lambda_fb, - unsigned int num_fftaps, unsigned int num_fbtaps); - - float d_lambda_ff; - float d_lambda_fb; - std::vector<float> d_ff_delayline; - std::vector<float> d_fb_delayline; - std::vector<float> d_ff_taps; - std::vector<float> d_fb_taps; - unsigned int d_ff_index; - unsigned int d_fb_index; - - gr_lms_dfe_ff (float lambda_ff, float lambda_fb, - unsigned int num_fftaps, unsigned int num_fbtaps); - - public: - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_log2_const.h b/gnuradio-core/src/lib/general/gr_log2_const.h index 4ea420920..8e4a0860b 100644 --- a/gnuradio-core/src/lib/general/gr_log2_const.h +++ b/gnuradio-core/src/lib/general/gr_log2_const.h @@ -27,6 +27,7 @@ #ifndef INCLUDED_GR_LOG2_CONST_H #define INCLUDED_GR_LOG2_CONST_H +#include <gr_core_api.h> #include <assert.h> template<unsigned int k> static inline int gr_log2_const() { assert(0); return 0; } diff --git a/gnuradio-core/src/lib/general/gr_map_bb.h b/gnuradio-core/src/lib/general/gr_map_bb.h index 4986ab181..0820c6a16 100644 --- a/gnuradio-core/src/lib/general/gr_map_bb.h +++ b/gnuradio-core/src/lib/general/gr_map_bb.h @@ -22,21 +22,22 @@ #ifndef INCLUDED_GR_MAP_BB_H #define INCLUDED_GR_MAP_BB_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_map_bb; typedef boost::shared_ptr<gr_map_bb> gr_map_bb_sptr; -gr_map_bb_sptr gr_make_map_bb(const std::vector<int> &map); +GR_CORE_API gr_map_bb_sptr gr_make_map_bb(const std::vector<int> &map); /*! * \brief output[i] = map[input[i]] * \ingroup coding_blk */ -class gr_map_bb : public gr_sync_block +class GR_CORE_API gr_map_bb : public gr_sync_block { - friend gr_map_bb_sptr gr_make_map_bb(const std::vector<int> &map); + friend GR_CORE_API gr_map_bb_sptr gr_make_map_bb(const std::vector<int> &map); unsigned char d_map[0x100]; diff --git a/gnuradio-core/src/lib/general/gr_math.h b/gnuradio-core/src/lib/general/gr_math.h index f5935c1da..9c61942cd 100644 --- a/gnuradio-core/src/lib/general/gr_math.h +++ b/gnuradio-core/src/lib/general/gr_math.h @@ -27,6 +27,7 @@ #ifndef _GR_MATH_H_ #define _GR_MATH_H_ +#include <gr_core_api.h> #include <gr_complex.h> static inline bool @@ -51,7 +52,7 @@ gr_is_power_of_2(long x) * to zero. This routine calculates the arc tangent with an average * error of +/- 0.045 degrees. */ -float gr_fast_atan2f(float y, float x); +GR_CORE_API float gr_fast_atan2f(float y, float x); static inline float gr_fast_atan2f(gr_complex z) { diff --git a/gnuradio-core/src/lib/general/gr_misc.h b/gnuradio-core/src/lib/general/gr_misc.h index 55cc7eda6..78f7e18ac 100644 --- a/gnuradio-core/src/lib/general/gr_misc.h +++ b/gnuradio-core/src/lib/general/gr_misc.h @@ -23,16 +23,17 @@ #ifndef INCLUDED_GR_MISC_H #define INCLUDED_GR_MISC_H +#include <gr_core_api.h> #include <gr_types.h> unsigned int gr_rounduppow2(unsigned int n); // FIXME should be template -void gr_zero_vector(std::vector<float> &v); -void gr_zero_vector(std::vector<double> &v); -void gr_zero_vector(std::vector<int> &v); -void gr_zero_vector(std::vector<gr_complex> &v); +GR_CORE_API void gr_zero_vector(std::vector<float> &v); +GR_CORE_API void gr_zero_vector(std::vector<double> &v); +GR_CORE_API void gr_zero_vector(std::vector<int> &v); +GR_CORE_API void gr_zero_vector(std::vector<gr_complex> &v); #endif /* INCLUDED_GR_MISC_H */ diff --git a/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.cc b/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.cc deleted file mode 100644 index bc51c6769..000000000 --- a/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.cc +++ /dev/null @@ -1,322 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,2007,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_io_signature.h> -#include <gr_prefs.h> -#include <gr_mpsk_receiver_cc.h> -#include <stdexcept> -#include <gr_math.h> -#include <gr_expj.h> -#include <gri_mmse_fir_interpolator_cc.h> - - -#define M_TWOPI (2*M_PI) -#define VERBOSE_MM 0 // Used for debugging symbol timing loop -#define VERBOSE_COSTAS 0 // Used for debugging phase and frequency tracking - -// Public constructor - -gr_mpsk_receiver_cc_sptr -gr_make_mpsk_receiver_cc(unsigned int M, float theta, - float alpha, float beta, - float fmin, float fmax, - float mu, float gain_mu, - float omega, float gain_omega, float omega_rel) -{ - return gnuradio::get_initial_sptr(new gr_mpsk_receiver_cc (M, theta, - alpha, beta, - fmin, fmax, - mu, gain_mu, - omega, gain_omega, omega_rel)); -} - -gr_mpsk_receiver_cc::gr_mpsk_receiver_cc (unsigned int M, float theta, - float alpha, float beta, - float fmin, float fmax, - float mu, float gain_mu, - float omega, float gain_omega, float omega_rel) - : gr_block ("mpsk_receiver_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (gr_complex))), - d_M(M), d_theta(theta), - d_alpha(alpha), d_beta(beta), d_freq(0), d_max_freq(fmax), d_min_freq(fmin), d_phase(0), - d_current_const_point(0), - d_mu(mu), d_gain_mu(gain_mu), d_gain_omega(gain_omega), - d_omega_rel(omega_rel), d_max_omega(0), d_min_omega(0), - d_p_2T(0), d_p_1T(0), d_p_0T(0), d_c_2T(0), d_c_1T(0), d_c_0T(0) -{ - d_interp = new gri_mmse_fir_interpolator_cc(); - d_dl_idx = 0; - - set_omega(omega); - - if (omega <= 0.0) - throw std::out_of_range ("clock rate must be > 0"); - if (gain_mu < 0 || gain_omega < 0) - throw std::out_of_range ("Gains must be non-negative"); - - assert(d_interp->ntaps() <= DLLEN); - - // zero double length delay line. - for (unsigned int i = 0; i < 2 * DLLEN; i++) - d_dl[i] = gr_complex(0.0,0.0); - - // build the constellation vector from M - make_constellation(); - - // Select a phase detector and a decision maker for the modulation order - switch(d_M) { - case 2: // optimized algorithms for BPSK - d_phase_error_detector = &gr_mpsk_receiver_cc::phase_error_detector_bpsk; //bpsk; - d_decision = &gr_mpsk_receiver_cc::decision_bpsk; - break; - - case 4: // optimized algorithms for QPSK - d_phase_error_detector = &gr_mpsk_receiver_cc::phase_error_detector_qpsk; //qpsk; - d_decision = &gr_mpsk_receiver_cc::decision_qpsk; - break; - - default: // generic algorithms for any M (power of 2?) but not pretty - d_phase_error_detector = &gr_mpsk_receiver_cc::phase_error_detector_generic; - d_decision = &gr_mpsk_receiver_cc::decision_generic; - break; - } -} - -gr_mpsk_receiver_cc::~gr_mpsk_receiver_cc () -{ - delete d_interp; -} - -void -gr_mpsk_receiver_cc::forecast(int noutput_items, gr_vector_int &ninput_items_required) -{ - unsigned ninputs = ninput_items_required.size(); - for (unsigned i=0; i < ninputs; i++) - ninput_items_required[i] = (int) ceil((noutput_items * d_omega) + d_interp->ntaps()); -} - -// FIXME add these back in an test difference in performance -float -gr_mpsk_receiver_cc::phase_error_detector_qpsk(gr_complex sample) const -{ - float phase_error = 0; - if(fabsf(sample.real()) > fabsf(sample.imag())) { - if(sample.real() > 0) - phase_error = -sample.imag(); - else - phase_error = sample.imag(); - } - else { - if(sample.imag() > 0) - phase_error = sample.real(); - else - phase_error = -sample.real(); - } - - return phase_error; -} - -float -gr_mpsk_receiver_cc::phase_error_detector_bpsk(gr_complex sample) const -{ - return -(sample.real()*sample.imag()); -} - -float gr_mpsk_receiver_cc::phase_error_detector_generic(gr_complex sample) const -{ - //return gr_fast_atan2f(sample*conj(d_constellation[d_current_const_point])); - return -arg(sample*conj(d_constellation[d_current_const_point])); -} - -unsigned int -gr_mpsk_receiver_cc::decision_bpsk(gr_complex sample) const -{ - return (gr_branchless_binary_slicer(sample.real()) ^ 1); - //return gr_binary_slicer(sample.real()) ^ 1; -} - -unsigned int -gr_mpsk_receiver_cc::decision_qpsk(gr_complex sample) const -{ - unsigned int index; - - //index = gr_branchless_quad_0deg_slicer(sample); - index = gr_quad_0deg_slicer(sample); - return index; -} - -unsigned int -gr_mpsk_receiver_cc::decision_generic(gr_complex sample) const -{ - unsigned int min_m = 0; - float min_s = 65535; - - // Develop all possible constellation points and find the one that minimizes - // the Euclidean distance (error) with the sample - for(unsigned int m=0; m < d_M; m++) { - gr_complex diff = norm(d_constellation[m] - sample); - - if(fabs(diff.real()) < min_s) { - min_s = fabs(diff.real()); - min_m = m; - } - } - // Return the index of the constellation point that minimizes the error - return min_m; -} - - -void -gr_mpsk_receiver_cc::make_constellation() -{ - for(unsigned int m=0; m < d_M; m++) { - d_constellation.push_back(gr_expj((M_TWOPI/d_M)*m)); - } -} - -void -gr_mpsk_receiver_cc::mm_sampler(const gr_complex symbol) -{ - gr_complex sample, nco; - - d_mu--; // skip a number of symbols between sampling - d_phase += d_freq; // increment the phase based on the frequency of the rotation - - // Keep phase clamped and not walk to infinity - while(d_phase > M_TWOPI) - d_phase -= M_TWOPI; - while(d_phase < -M_TWOPI) - d_phase += M_TWOPI; - - nco = gr_expj(d_phase+d_theta); // get the NCO value for derotating the current sample - sample = nco*symbol; // get the downconverted symbol - - // Fill up the delay line for the interpolator - d_dl[d_dl_idx] = sample; - d_dl[(d_dl_idx + DLLEN)] = sample; // put this in the second half of the buffer for overflows - d_dl_idx = (d_dl_idx+1) % DLLEN; // Keep the delay line index in bounds -} - -void -gr_mpsk_receiver_cc::mm_error_tracking(gr_complex sample) -{ - gr_complex u, x, y; - float mm_error = 0; - - // Make sample timing corrections - - // set the delayed samples - d_p_2T = d_p_1T; - d_p_1T = d_p_0T; - d_p_0T = sample; - d_c_2T = d_c_1T; - d_c_1T = d_c_0T; - - d_current_const_point = (*this.*d_decision)(d_p_0T); // make a decision on the sample value - d_c_0T = d_constellation[d_current_const_point]; - - x = (d_c_0T - d_c_2T) * conj(d_p_1T); - y = (d_p_0T - d_p_2T) * conj(d_c_1T); - u = y - x; - mm_error = u.real(); // the error signal is in the real part - mm_error = gr_branchless_clip(mm_error, 1.0); // limit mm_val - - d_omega = d_omega + d_gain_omega * mm_error; // update omega based on loop error - d_omega = d_omega_mid + gr_branchless_clip(d_omega-d_omega_mid, d_omega_rel); // make sure we don't walk away - - d_mu += d_omega + d_gain_mu * mm_error; // update mu based on loop error - -#if VERBOSE_MM - printf("mm: mu: %f omega: %f mm_error: %f sample: %f+j%f constellation: %f+j%f\n", - d_mu, d_omega, mm_error, sample.real(), sample.imag(), - d_constellation[d_current_const_point].real(), d_constellation[d_current_const_point].imag()); -#endif -} - - -void -gr_mpsk_receiver_cc::phase_error_tracking(gr_complex sample) -{ - float phase_error = 0; - - // Make phase and frequency corrections based on sampled value - phase_error = (*this.*d_phase_error_detector)(sample); - - d_freq += d_beta*phase_error; // adjust frequency based on error - d_phase += d_freq + d_alpha*phase_error; // adjust phase based on error - - // Make sure we stay within +-2pi - while(d_phase > M_TWOPI) - d_phase -= M_TWOPI; - while(d_phase < -M_TWOPI) - d_phase += M_TWOPI; - - // Limit the frequency range - d_freq = gr_branchless_clip(d_freq, d_max_freq); - -#if VERBOSE_COSTAS - printf("cl: phase_error: %f phase: %f freq: %f sample: %f+j%f constellation: %f+j%f\n", - phase_error, d_phase, d_freq, sample.real(), sample.imag(), - d_constellation[d_current_const_point].real(), d_constellation[d_current_const_point].imag()); -#endif -} - -int -gr_mpsk_receiver_cc::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - - int i=0, o=0; - - while((o < noutput_items) && (i < ninput_items[0])) { - while((d_mu > 1) && (i < ninput_items[0])) { - mm_sampler(in[i]); // puts symbols into a buffer and adjusts d_mu - i++; - } - - if(i < ninput_items[0]) { - gr_complex interp_sample = d_interp->interpolate(&d_dl[d_dl_idx], d_mu); - - mm_error_tracking(interp_sample); // corrects M&M sample time - phase_error_tracking(interp_sample); // corrects phase and frequency offsets - - out[o++] = interp_sample; - } - } - - #if 0 - printf("ninput_items: %d noutput_items: %d consuming: %d returning: %d\n", - ninput_items[0], noutput_items, i, o); - #endif - - consume_each(i); - return o; -} diff --git a/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.h b/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.h deleted file mode 100644 index f17b68aa0..000000000 --- a/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.h +++ /dev/null @@ -1,316 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2007 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_MPSK_RECEIVER_CC_H -#define INCLUDED_GR_MPSK_RECEIVER_CC_H - -#include <gruel/attributes.h> -#include <gr_block.h> -#include <gr_complex.h> -#include <fstream> - -class gri_mmse_fir_interpolator_cc; - -class gr_mpsk_receiver_cc; -typedef boost::shared_ptr<gr_mpsk_receiver_cc> gr_mpsk_receiver_cc_sptr; - -// public constructor -gr_mpsk_receiver_cc_sptr -gr_make_mpsk_receiver_cc (unsigned int M, float theta, - float alpha, float beta, - float fmin, float fmax, - float mu, float gain_mu, - float omega, float gain_omega, float omega_rel); - -/*! - * \brief This block takes care of receiving M-PSK modulated signals through phase, frequency, and symbol - * synchronization. - * \ingroup sync_blk - * \ingroup demod_blk - * - * This block takes care of receiving M-PSK modulated signals through phase, frequency, and symbol - * synchronization. It performs carrier frequency and phase locking as well as symbol timing recovery. - * It works with (D)BPSK, (D)QPSK, and (D)8PSK as tested currently. It should also work for OQPSK and - * PI/4 DQPSK. - * - * The phase and frequency synchronization are based on a Costas loop that finds the error of the incoming - * signal point compared to its nearest constellation point. The frequency and phase of the NCO are - * updated according to this error. There are optimized phase error detectors for BPSK and QPSK, but 8PSK - * is done using a brute-force computation of the constellation points to find the minimum. - * - * The symbol synchronization is done using a modified Mueller and Muller circuit from the paper: - * - * G. R. Danesfahani, T.G. Jeans, "Optimisation of modified Mueller and Muller - * algorithm," Electronics Letters, Vol. 31, no. 13, 22 June 1995, pp. 1032 - 1033. - * - * This circuit interpolates the downconverted sample (using the NCO developed by the Costas loop) - * every mu samples, then it finds the sampling error based on this and the past symbols and the decision - * made on the samples. Like the phase error detector, there are optimized decision algorithms for BPSK - * and QPKS, but 8PSK uses another brute force computation against all possible symbols. The modifications - * to the M&M used here reduce self-noise. - * - */ - -class gr_mpsk_receiver_cc : public gr_block -{ - public: - ~gr_mpsk_receiver_cc (); - void forecast(int noutput_items, gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - - // Member functions related to the symbol tracking portion of the receiver - //! (M&M) Returns current value of mu - float mu() const { return d_mu;} - - //! (M&M) Returns current value of omega - float omega() const { return d_omega;} - - //! (M&M) Returns mu gain factor - float gain_mu() const { return d_gain_mu;} - - //! (M&M) Returns omega gain factor - float gain_omega() const { return d_gain_omega;} - - //! (M&M) Sets value of mu - void set_mu (float mu) { d_mu = mu; } - - //! (M&M) Sets value of omega and its min and max values - void set_omega (float omega) { - d_omega = omega; - d_min_omega = omega*(1.0 - d_omega_rel); - d_max_omega = omega*(1.0 + d_omega_rel); - d_omega_mid = 0.5*(d_min_omega+d_max_omega); - } - - //! (M&M) Sets value for mu gain factor - void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; } - - //! (M&M) Sets value for omega gain factor - void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; } - - - - // Member function related to the phase/frequency tracking portion of the receiver - //! (CL) Returns the value for alpha (the phase gain term) - float alpha() const { return d_alpha; } - - //! (CL) Returns the value of beta (the frequency gain term) - float beta() const { return d_beta; } - - //! (CL) Returns the current value of the frequency of the NCO in the Costas loop - float freq() const { return d_freq; } - - //! (CL) Returns the current value of the phase of the NCO in the Costal loop - float phase() const { return d_phase; } - - //! (CL) Sets the value for alpha (the phase gain term) - void set_alpha(float alpha) { d_alpha = alpha; } - - //! (CL) Setss the value of beta (the frequency gain term) - void set_beta(float beta) { d_beta = beta; } - - //! (CL) Sets the current value of the frequency of the NCO in the Costas loop - void set_freq(float freq) { d_freq = freq; } - - //! (CL) Setss the current value of the phase of the NCO in the Costal loop - void set_phase(float phase) { d_phase = phase; } - - -protected: - - /*! - * \brief Constructor to synchronize incoming M-PSK symbols - * - * \param M modulation order of the M-PSK modulation - * \param theta any constant phase rotation from the real axis of the constellation - * \param alpha gain parameter to adjust the phase in the Costas loop (~0.01) - * \param beta gain parameter to adjust the frequency in the Costas loop (~alpha^2/4) - * \param fmin minimum normalized frequency value the loop can achieve - * \param fmax maximum normalized frequency value the loop can achieve - * \param mu initial parameter for the interpolator [0,1] - * \param gain_mu gain parameter of the M&M error signal to adjust mu (~0.05) - * \param omega initial value for the number of symbols between samples (~number of samples/symbol) - * \param gain_omega gain parameter to adjust omega based on the error (~omega^2/4) - * \param omega_rel sets the maximum (omega*(1+omega_rel)) and minimum (omega*(1+omega_rel)) omega (~0.005) - * - * The constructor also chooses which phase detector and decision maker to use in the work loop based on the - * value of M. - */ - gr_mpsk_receiver_cc (unsigned int M, float theta, - float alpha, float beta, - float fmin, float fmax, - float mu, float gain_mu, - float omega, float gain_omega, float omega_rel); - - void make_constellation(); - void mm_sampler(const gr_complex symbol); - void mm_error_tracking(gr_complex sample); - void phase_error_tracking(gr_complex sample); - - -/*! - * \brief Phase error detector for MPSK modulations. - * - * \param sample the I&Q sample from which to determine the phase error - * - * This function determines the phase error for any MPSK signal by creating a set of PSK constellation points - * and doing a brute-force search to see which point minimizes the Euclidean distance. This point is then used - * to derotate the sample to the real-axis and a atan (using the fast approximation function) to determine the - * phase difference between the incoming sample and the real constellation point - * - * This should be cleaned up and made more efficient. - * - * \returns the approximated phase error. - */ - float phase_error_detector_generic(gr_complex sample) const; // generic for M but more costly - - /*! - * \brief Phase error detector for BPSK modulation. - * - * \param sample the I&Q sample from which to determine the phase error - * - * This function determines the phase error using a simple BPSK phase error detector by multiplying the real - * and imaginary (the error signal) components together. As the imaginary part goes to 0, so does this error. - * - * \returns the approximated phase error. - */ - float phase_error_detector_bpsk(gr_complex sample) const; // optimized for BPSK - - /*! - * \brief Phase error detector for QPSK modulation. - * - * \param sample the I&Q sample from which to determine the phase error - * - * This function determines the phase error using the limiter approach in a standard 4th order Costas loop - * - * \returns the approximated phase error. - */ - float phase_error_detector_qpsk(gr_complex sample) const; - - - - /*! - * \brief Decision maker for a generic MPSK constellation. - * - * \param sample the baseband I&Q sample from which to make the decision - * - * This decision maker is a generic implementation that does a brute-force search - * for the constellation point that minimizes the error between it and the incoming signal. - * - * \returns the index to d_constellation that minimizes the error/ - */ - unsigned int decision_generic(gr_complex sample) const; - - - /*! - * \brief Decision maker for BPSK constellation. - * - * \param sample the baseband I&Q sample from which to make the decision - * - * This decision maker is a simple slicer function that makes a decision on the symbol based on its - * placement on the real axis of greater than 0 or less than 0; the quadrature component is always 0. - * - * \returns the index to d_constellation that minimizes the error/ - */ - unsigned int decision_bpsk(gr_complex sample) const; - - - /*! - * \brief Decision maker for QPSK constellation. - * - * \param sample the baseband I&Q sample from which to make the decision - * - * This decision maker is a simple slicer function that makes a decision on the symbol based on its - * placement versus both axes and returns which quadrant the symbol is in. - * - * \returns the index to d_constellation that minimizes the error/ - */ - unsigned int decision_qpsk(gr_complex sample) const; - - private: - unsigned int d_M; - float d_theta; - - // Members related to carrier and phase tracking - float d_alpha; - float d_beta; - float d_freq, d_max_freq, d_min_freq; - float d_phase; - -/*! - * \brief Decision maker function pointer - * - * \param sample the baseband I&Q sample from which to make the decision - * - * This is a function pointer that is set in the constructor to point to the proper decision function - * for the specified constellation order. - * - * \return index into d_constellation point that is the closest to the recieved sample - */ - unsigned int (gr_mpsk_receiver_cc::*d_decision)(gr_complex sample) const; // pointer to decision function - - - std::vector<gr_complex> d_constellation; - unsigned int d_current_const_point; - - // Members related to symbol timing - float d_mu, d_gain_mu; - float d_omega, d_gain_omega, d_omega_rel, d_max_omega, d_min_omega, d_omega_mid; - gr_complex d_p_2T, d_p_1T, d_p_0T; - gr_complex d_c_2T, d_c_1T, d_c_0T; - - /*! - * \brief Phase error detector function pointer - * - * \param sample the I&Q sample from which to determine the phase error - * - * This is a function pointer that is set in the constructor to point to the proper phase error detector - * function for the specified constellation order. - */ - float (gr_mpsk_receiver_cc::*d_phase_error_detector)(gr_complex sample) const; - - - //! get interpolated value - gri_mmse_fir_interpolator_cc *d_interp; - - //! delay line length. - static const unsigned int DLLEN = 8; - - //! delay line plus some length for overflow protection - __GR_ATTR_ALIGNED(8) gr_complex d_dl[2*DLLEN]; - - //! index to delay line - unsigned int d_dl_idx; - - friend gr_mpsk_receiver_cc_sptr - gr_make_mpsk_receiver_cc (unsigned int M, float theta, - float alpha, float beta, - float fmin, float fmax, - float mu, float gain_mu, - float omega, float gain_omega, float omega_rel); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.i b/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.i deleted file mode 100644 index 88cb43e04..000000000 --- a/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.i +++ /dev/null @@ -1,59 +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,mpsk_receiver_cc); - -gr_mpsk_receiver_cc_sptr gr_make_mpsk_receiver_cc (unsigned int M, float theta, - float alpha, float beta, - float fmin, float fmax, - float mu, float gain_mu, - float omega, float gain_omega, float omega_rel); -class gr_mpsk_receiver_cc : public gr_block -{ - private: - gr_mpsk_receiver_cc (unsigned int M,float theta, - float alpha, float beta, - float fmin, float fmax, - float mu, float gain_mu, - float omega, float gain_omega, float omega_rel); -public: - float mu() const { return d_mu;} - float omega() const { return d_omega;} - float gain_mu() const { return d_gain_mu;} - float gain_omega() const { return d_gain_omega;} - void set_mu (float mu) { d_mu = mu; } - void set_omega (float omega) { - d_omega = omega; - d_min_omega = omega*(1.0 - d_omega_rel); - d_max_omega = omega*(1.0 + d_omega_rel); - } - void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; } - void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; } - float alpha() const { return d_alpha; } - float beta() const { return d_beta; } - float freq() const { return d_freq; } - float phase() const { return d_phase; } - void set_alpha(float alpha) { d_alpha = alpha; } - void set_beta(float beta) { d_beta = beta; } - void set_freq(float freq) { d_freq = freq; } - void set_phase(float phase) { d_phase = phase; } -}; diff --git a/gnuradio-core/src/lib/general/gr_nlog10_ff.h b/gnuradio-core/src/lib/general/gr_nlog10_ff.h index 1cb50f3ca..cea56f87e 100644 --- a/gnuradio-core/src/lib/general/gr_nlog10_ff.h +++ b/gnuradio-core/src/lib/general/gr_nlog10_ff.h @@ -22,20 +22,21 @@ #ifndef INCLUDED_GR_NLOG10_FF_H #define INCLUDED_GR_NLOG10_FF_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_nlog10_ff; typedef boost::shared_ptr<gr_nlog10_ff> gr_nlog10_ff_sptr; -gr_nlog10_ff_sptr gr_make_nlog10_ff (float n=1.0, unsigned vlen=1, float k=0); +GR_CORE_API gr_nlog10_ff_sptr gr_make_nlog10_ff (float n=1.0, unsigned vlen=1, float k=0); /*! * \brief output = n*log10(input) + k * \ingroup math_blk */ -class gr_nlog10_ff : public gr_sync_block +class GR_CORE_API gr_nlog10_ff : public gr_sync_block { - friend gr_nlog10_ff_sptr gr_make_nlog10_ff (float n, unsigned vlen, float k); + friend GR_CORE_API gr_nlog10_ff_sptr gr_make_nlog10_ff (float n, unsigned vlen, float k); unsigned int d_vlen; float d_n; diff --git a/gnuradio-core/src/lib/general/gr_nop.h b/gnuradio-core/src/lib/general/gr_nop.h index 354c2f9fc..b8398befc 100644 --- a/gnuradio-core/src/lib/general/gr_nop.h +++ b/gnuradio-core/src/lib/general/gr_nop.h @@ -23,22 +23,23 @@ #ifndef INCLUDED_GR_NOP_H #define INCLUDED_GR_NOP_H +#include <gr_core_api.h> #include <gr_block.h> #include <stddef.h> // size_t class gr_nop; typedef boost::shared_ptr<gr_nop> gr_nop_sptr; -gr_nop_sptr +GR_CORE_API gr_nop_sptr gr_make_nop (size_t sizeof_stream_item); /*! * \brief Does nothing. Used for testing only. * \ingroup misc_blk */ -class gr_nop : public gr_block +class GR_CORE_API gr_nop : public gr_block { - friend gr_nop_sptr gr_make_nop (size_t sizeof_stream_item); + friend GR_CORE_API gr_nop_sptr gr_make_nop (size_t sizeof_stream_item); gr_nop (size_t sizeof_stream_item); protected: diff --git a/gnuradio-core/src/lib/general/gr_null_sink.h b/gnuradio-core/src/lib/general/gr_null_sink.h index 6d00382a5..c6c4f36fb 100644 --- a/gnuradio-core/src/lib/general/gr_null_sink.h +++ b/gnuradio-core/src/lib/general/gr_null_sink.h @@ -23,23 +23,23 @@ #ifndef INCLUDED_GR_NULL_SINK_H #define INCLUDED_GR_NULL_SINK_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <stddef.h> // size_t class gr_null_sink; typedef boost::shared_ptr<gr_null_sink> gr_null_sink_sptr; -gr_null_sink_sptr +GR_CORE_API gr_null_sink_sptr gr_make_null_sink (size_t sizeof_stream_item); - /*! * \brief Bit bucket * \ingroup sink_blk */ -class gr_null_sink : public gr_sync_block +class GR_CORE_API gr_null_sink : public gr_sync_block { - friend gr_null_sink_sptr gr_make_null_sink (size_t sizeof_stream_item); + friend GR_CORE_API gr_null_sink_sptr gr_make_null_sink (size_t sizeof_stream_item); gr_null_sink (size_t sizeof_stream_item); public: diff --git a/gnuradio-core/src/lib/general/gr_null_source.h b/gnuradio-core/src/lib/general/gr_null_source.h index b1a46a195..33687fbaa 100644 --- a/gnuradio-core/src/lib/general/gr_null_source.h +++ b/gnuradio-core/src/lib/general/gr_null_source.h @@ -23,21 +23,22 @@ #ifndef INCLUDED_GR_NULL_SOURCE_H #define INCLUDED_GR_NULL_SOURCE_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_null_source; typedef boost::shared_ptr<gr_null_source> gr_null_source_sptr; -gr_null_source_sptr +GR_CORE_API gr_null_source_sptr gr_make_null_source (size_t sizeof_stream_item); /*! * \brief A source of zeros. * \ingroup source_blk */ -class gr_null_source : public gr_sync_block +class GR_CORE_API gr_null_source : public gr_sync_block { - friend gr_null_source_sptr gr_make_null_source (size_t sizeof_stream_item); + friend GR_CORE_API gr_null_source_sptr gr_make_null_source (size_t sizeof_stream_item); gr_null_source (size_t sizeof_stream_item); diff --git a/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.h b/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.h index 12ae6a8f6..6d532d50f 100644 --- a/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.h +++ b/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.h @@ -24,13 +24,14 @@ #define INCLUDED_GR_OFDM_BPSK_DEMAPPER_H +#include <gr_core_api.h> #include <gr_block.h> #include <vector> class gr_ofdm_bpsk_demapper; typedef boost::shared_ptr<gr_ofdm_bpsk_demapper> gr_ofdm_bpsk_demapper_sptr; -gr_ofdm_bpsk_demapper_sptr +GR_CORE_API gr_ofdm_bpsk_demapper_sptr gr_make_ofdm_bpsk_demapper (unsigned int occupied_carriers); @@ -39,9 +40,9 @@ gr_make_ofdm_bpsk_demapper (unsigned int occupied_carriers); * and demodulate to a stream of bits. Simple BPSK version. * \ingroup ofdm_blk */ -class gr_ofdm_bpsk_demapper : public gr_block +class GR_CORE_API gr_ofdm_bpsk_demapper : public gr_block { - friend gr_ofdm_bpsk_demapper_sptr + friend GR_CORE_API gr_ofdm_bpsk_demapper_sptr gr_make_ofdm_bpsk_demapper (unsigned int occupied_carriers); protected: diff --git a/gnuradio-core/src/lib/general/gr_ofdm_cyclic_prefixer.cc b/gnuradio-core/src/lib/general/gr_ofdm_cyclic_prefixer.cc deleted file mode 100644 index fb40a3035..000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_cyclic_prefixer.cc +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,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_ofdm_cyclic_prefixer.h> -#include <gr_io_signature.h> - -gr_ofdm_cyclic_prefixer_sptr -gr_make_ofdm_cyclic_prefixer (size_t input_size, size_t output_size) -{ - return gnuradio::get_initial_sptr(new gr_ofdm_cyclic_prefixer (input_size, output_size)); -} - -gr_ofdm_cyclic_prefixer::gr_ofdm_cyclic_prefixer (size_t input_size, size_t output_size) - : gr_sync_interpolator ("ofdm_cyclic_prefixer", - gr_make_io_signature (1, 1, input_size*sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(gr_complex)), - output_size), - d_input_size(input_size), - d_output_size(output_size) - -{ -} - -int -gr_ofdm_cyclic_prefixer::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex *in = (gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - size_t cp_size = d_output_size - d_input_size; - unsigned int i=0, j=0; - - j = cp_size; - for(i=0; i < d_input_size; i++,j++) { - out[j] = in[i]; - } - - j = d_input_size - cp_size; - for(i=0; i < cp_size; i++, j++) { - out[i] = in[j]; - } - - return d_output_size; -} diff --git a/gnuradio-core/src/lib/general/gr_ofdm_cyclic_prefixer.h b/gnuradio-core/src/lib/general/gr_ofdm_cyclic_prefixer.h deleted file mode 100644 index eab91cd11..000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_cyclic_prefixer.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2005,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 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_OFDM_CYCLIC_PREFIXER_H -#define INCLUDED_GR_OFDM_CYCLIC_PREFIXER_H - -#include <gr_sync_interpolator.h> -#include <stdio.h> - -class gr_ofdm_cyclic_prefixer; -typedef boost::shared_ptr<gr_ofdm_cyclic_prefixer> gr_ofdm_cyclic_prefixer_sptr; - -gr_ofdm_cyclic_prefixer_sptr -gr_make_ofdm_cyclic_prefixer (size_t input_size, size_t output_size); - - -/*! - * \brief adds a cyclic prefix vector to an input size long ofdm - * symbol(vector) and converts vector to a stream output_size long. - * \ingroup ofdm_blk - */ -class gr_ofdm_cyclic_prefixer : public gr_sync_interpolator -{ - friend gr_ofdm_cyclic_prefixer_sptr - gr_make_ofdm_cyclic_prefixer (size_t input_size, size_t output_size); - - protected: - gr_ofdm_cyclic_prefixer (size_t input_size, size_t output_size); - - public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - private: - size_t d_input_size; - size_t d_output_size; -}; - -#endif /* INCLUDED_GR_OFDM_CYCLIC_PREFIXER_H */ diff --git a/gnuradio-core/src/lib/general/gr_ofdm_cyclic_prefixer.i b/gnuradio-core/src/lib/general/gr_ofdm_cyclic_prefixer.i deleted file mode 100644 index 9fd8521a2..000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_cyclic_prefixer.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2009 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,ofdm_cyclic_prefixer) - -gr_ofdm_cyclic_prefixer_sptr -gr_make_ofdm_cyclic_prefixer (size_t input_size, size_t output_size); - -class gr_ofdm_cyclic_prefixer : public gr_sync_interpolator -{ - protected: - gr_ofdm_cyclic_prefixer (size_t input_size, size_t output_size); - - public: -}; diff --git a/gnuradio-core/src/lib/general/gr_ofdm_demapper_vcb.cc b/gnuradio-core/src/lib/general/gr_ofdm_demapper_vcb.cc deleted file mode 100644 index 4da7690b1..000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_demapper_vcb.cc +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2005 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_ofdm_demapper_vcb.h> -#include <gr_io_signature.h> - -gr_ofdm_demapper_vcb::~gr_ofdm_demapper_vcb(void) -{ -} - -gr_ofdm_demapper_vcb::gr_ofdm_demapper_vcb (unsigned bits_per_symbol,unsigned int vlen) - : gr_sync_decimator ("ofdm_demapper_vcb", - gr_make_io_signature (1, 1, sizeof(gr_complex)*vlen), - gr_make_io_signature (1, 1, sizeof(unsigned char)), - bits_per_symbol) -{ -} - diff --git a/gnuradio-core/src/lib/general/gr_ofdm_demapper_vcb.h b/gnuradio-core/src/lib/general/gr_ofdm_demapper_vcb.h deleted file mode 100644 index 979e1996b..000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_demapper_vcb.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- 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 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_OFDM_DEMAPPER_VCB_H -#define INCLUDED_GR_OFDM_DEMAPPER_VCB_H - -#include <gr_sync_decimator.h> - -class gr_ofdm_demapper_vcb; -typedef boost::shared_ptr<gr_ofdm_demapper_vcb> gr_ofdm_demapper_vcb_sptr; - -gr_ofdm_demapper_vcb_sptr -gr_make_ofdm_demapper_vcb (unsigned int bits_per_symbol, unsigned int vlen); - - -/*! - * \brief take a stream of vectors in from an FFT and demodulate to a stream of - * bits. Abstract class must be subclassed with specific mapping. - * - * \ingroup demodulation_blk - * \ingroup ofdm_blk - */ -class gr_ofdm_demapper_vcb : public gr_sync_decimator -{ - friend gr_ofdm_demapper_vcb_sptr - gr_make_ofdm_demapper_vcb (unsigned int bits_per_symbol, unsigned int vlen); - -protected: - gr_ofdm_demapper_vcb (unsigned int bits_per_symbol, unsigned int vlen); - -public: - ~gr_ofdm_demapper_vcb(void); -}; - - - -#endif diff --git a/gnuradio-core/src/lib/general/gr_ofdm_demapper_vcb.i b/gnuradio-core/src/lib/general/gr_ofdm_demapper_vcb.i deleted file mode 100644 index e786c70f5..000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_demapper_vcb.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- 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 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,ofdm_mapper_bcv) - -gr_ofdm_mapper_bcv_sptr -gr_make_ofdm_mapper_bcv (unsigned int bits_per_symbol, - unsigned int vlen); - -class gr_ofdm_mapper_bcv : public gr_sync_decimator -{ - protected: - gr_ofdm_mapper_bcv (unsigned int bits_per_symbol, - unsigned int vlen); - - public: -}; diff --git a/gnuradio-core/src/lib/general/gr_ofdm_frame_acquisition.cc b/gnuradio-core/src/lib/general/gr_ofdm_frame_acquisition.cc deleted file mode 100644 index 201375597..000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_frame_acquisition.cc +++ /dev/null @@ -1,208 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2007,2008,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_ofdm_frame_acquisition.h> -#include <gr_io_signature.h> -#include <gr_expj.h> -#include <gr_math.h> -#include <cstdio> - -#define VERBOSE 0 -#define M_TWOPI (2*M_PI) -#define MAX_NUM_SYMBOLS 1000 - -gr_ofdm_frame_acquisition_sptr -gr_make_ofdm_frame_acquisition (unsigned int occupied_carriers, unsigned int fft_length, - unsigned int cplen, - const std::vector<gr_complex> &known_symbol, - unsigned int max_fft_shift_len) -{ - return gnuradio::get_initial_sptr(new gr_ofdm_frame_acquisition (occupied_carriers, fft_length, cplen, - known_symbol, max_fft_shift_len)); -} - -gr_ofdm_frame_acquisition::gr_ofdm_frame_acquisition (unsigned occupied_carriers, unsigned int fft_length, - unsigned int cplen, - const std::vector<gr_complex> &known_symbol, - unsigned int max_fft_shift_len) - : gr_block ("ofdm_frame_acquisition", - gr_make_io_signature2 (2, 2, sizeof(gr_complex)*fft_length, sizeof(char)*fft_length), - gr_make_io_signature2 (2, 2, sizeof(gr_complex)*occupied_carriers, sizeof(char))), - d_occupied_carriers(occupied_carriers), - d_fft_length(fft_length), - d_cplen(cplen), - d_freq_shift_len(max_fft_shift_len), - d_known_symbol(known_symbol), - d_coarse_freq(0), - d_phase_count(0) -{ - d_symbol_phase_diff.resize(d_fft_length); - d_known_phase_diff.resize(d_occupied_carriers); - d_hestimate.resize(d_occupied_carriers); - - unsigned int i = 0, j = 0; - - std::fill(d_known_phase_diff.begin(), d_known_phase_diff.end(), 0); - for(i = 0; i < d_known_symbol.size()-2; i+=2) { - d_known_phase_diff[i] = norm(d_known_symbol[i] - d_known_symbol[i+2]); - } - - d_phase_lut = new gr_complex[(2*d_freq_shift_len+1) * MAX_NUM_SYMBOLS]; - for(i = 0; i <= 2*d_freq_shift_len; i++) { - for(j = 0; j < MAX_NUM_SYMBOLS; j++) { - d_phase_lut[j + i*MAX_NUM_SYMBOLS] = gr_expj(-M_TWOPI*d_cplen/d_fft_length*(i-d_freq_shift_len)*j); - } - } -} - -gr_ofdm_frame_acquisition::~gr_ofdm_frame_acquisition(void) -{ - delete [] d_phase_lut; -} - -void -gr_ofdm_frame_acquisition::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - unsigned ninputs = ninput_items_required.size (); - for (unsigned i = 0; i < ninputs; i++) - ninput_items_required[i] = 1; -} - -gr_complex -gr_ofdm_frame_acquisition::coarse_freq_comp(int freq_delta, int symbol_count) -{ - // return gr_complex(cos(-M_TWOPI*freq_delta*d_cplen/d_fft_length*symbol_count), - // sin(-M_TWOPI*freq_delta*d_cplen/d_fft_length*symbol_count)); - - return gr_expj(-M_TWOPI*freq_delta*d_cplen/d_fft_length*symbol_count); - - //return d_phase_lut[MAX_NUM_SYMBOLS * (d_freq_shift_len + freq_delta) + symbol_count]; -} - -void -gr_ofdm_frame_acquisition::correlate(const gr_complex *symbol, int zeros_on_left) -{ - unsigned int i,j; - - std::fill(d_symbol_phase_diff.begin(), d_symbol_phase_diff.end(), 0); - for(i = 0; i < d_fft_length-2; i++) { - d_symbol_phase_diff[i] = norm(symbol[i] - symbol[i+2]); - } - - // sweep through all possible/allowed frequency offsets and select the best - int index = 0; - float max = 0, sum=0; - for(i = zeros_on_left - d_freq_shift_len; i < zeros_on_left + d_freq_shift_len; i++) { - sum = 0; - for(j = 0; j < d_occupied_carriers; j++) { - sum += (d_known_phase_diff[j] * d_symbol_phase_diff[i+j]); - } - if(sum > max) { - max = sum; - index = i; - } - } - - // set the coarse frequency offset relative to the edge of the occupied tones - d_coarse_freq = index - zeros_on_left; -} - -void -gr_ofdm_frame_acquisition::calculate_equalizer(const gr_complex *symbol, int zeros_on_left) -{ - unsigned int i=0; - - // Set first tap of equalizer - d_hestimate[0] = d_known_symbol[0] / - (coarse_freq_comp(d_coarse_freq,1)*symbol[zeros_on_left+d_coarse_freq]); - - // set every even tap based on known symbol - // linearly interpolate between set carriers to set zero-filled carriers - // FIXME: is this the best way to set this? - for(i = 2; i < d_occupied_carriers; i+=2) { - d_hestimate[i] = d_known_symbol[i] / - (coarse_freq_comp(d_coarse_freq,1)*(symbol[i+zeros_on_left+d_coarse_freq])); - d_hestimate[i-1] = (d_hestimate[i] + d_hestimate[i-2]) / gr_complex(2.0, 0.0); - } - - // with even number of carriers; last equalizer tap is wrong - if(!(d_occupied_carriers & 1)) { - d_hestimate[d_occupied_carriers-1] = d_hestimate[d_occupied_carriers-2]; - } - - if(VERBOSE) { - fprintf(stderr, "Equalizer setting:\n"); - for(i = 0; i < d_occupied_carriers; i++) { - gr_complex sym = coarse_freq_comp(d_coarse_freq,1)*symbol[i+zeros_on_left+d_coarse_freq]; - gr_complex output = sym * d_hestimate[i]; - fprintf(stderr, "sym: %+.4f + j%+.4f ks: %+.4f + j%+.4f eq: %+.4f + j%+.4f ==> %+.4f + j%+.4f\n", - sym .real(), sym.imag(), - d_known_symbol[i].real(), d_known_symbol[i].imag(), - d_hestimate[i].real(), d_hestimate[i].imag(), - output.real(), output.imag()); - } - fprintf(stderr, "\n"); - } -} - -int -gr_ofdm_frame_acquisition::general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *symbol = (const gr_complex *)input_items[0]; - const char *signal_in = (const char *)input_items[1]; - - gr_complex *out = (gr_complex *) output_items[0]; - char *signal_out = (char *) output_items[1]; - - int unoccupied_carriers = d_fft_length - d_occupied_carriers; - int zeros_on_left = (int)ceil(unoccupied_carriers/2.0); - - if(signal_in[0]) { - d_phase_count = 1; - correlate(symbol, zeros_on_left); - calculate_equalizer(symbol, zeros_on_left); - signal_out[0] = 1; - } - else { - signal_out[0] = 0; - } - - for(unsigned int i = 0; i < d_occupied_carriers; i++) { - out[i] = d_hestimate[i]*coarse_freq_comp(d_coarse_freq,d_phase_count) - *symbol[i+zeros_on_left+d_coarse_freq]; - } - - d_phase_count++; - if(d_phase_count == MAX_NUM_SYMBOLS) { - d_phase_count = 1; - } - - consume_each(1); - return 1; -} diff --git a/gnuradio-core/src/lib/general/gr_ofdm_frame_acquisition.h b/gnuradio-core/src/lib/general/gr_ofdm_frame_acquisition.h deleted file mode 100644 index 5db8dbb7f..000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_frame_acquisition.h +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006, 2007 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_OFDM_FRAME_ACQUISITION_H -#define INCLUDED_GR_OFDM_FRAME_ACQUISITION_H - - -#include <gr_block.h> -#include <vector> - -class gr_ofdm_frame_acquisition; -typedef boost::shared_ptr<gr_ofdm_frame_acquisition> gr_ofdm_frame_acquisition_sptr; - -gr_ofdm_frame_acquisition_sptr -gr_make_ofdm_frame_acquisition (unsigned int occupied_carriers, unsigned int fft_length, - unsigned int cplen, - const std::vector<gr_complex> &known_symbol, - unsigned int max_fft_shift_len=10); - -/*! - * \brief take a vector of complex constellation points in from an FFT - * and performs a correlation and equalization. - * \ingroup demodulation_blk - * \ingroup ofdm_blk - * - * This block takes the output of an FFT of a received OFDM symbol and finds the - * start of a frame based on two known symbols. It also looks at the surrounding - * bins in the FFT output for the correlation in case there is a large frequency - * shift in the data. This block assumes that the fine frequency shift has already - * been corrected and that the samples fall in the middle of one FFT bin. - * - * It then uses one of those known - * symbols to estimate the channel response over all subcarriers and does a simple - * 1-tap equalization on all subcarriers. This corrects for the phase and amplitude - * distortion caused by the channel. - */ - -class gr_ofdm_frame_acquisition : public gr_block -{ - /*! - * \brief Build an OFDM correlator and equalizer. - * \param occupied_carriers The number of subcarriers with data in the received symbol - * \param fft_length The size of the FFT vector (occupied_carriers + unused carriers) - * \param cplen The length of the cycle prefix - * \param known_symbol A vector of complex numbers representing a known symbol at the - * start of a frame (usually a BPSK PN sequence) - * \param max_fft_shift_len Set's the maximum distance you can look between bins for correlation - */ - friend gr_ofdm_frame_acquisition_sptr - gr_make_ofdm_frame_acquisition (unsigned int occupied_carriers, unsigned int fft_length, - unsigned int cplen, - const std::vector<gr_complex> &known_symbol, - unsigned int max_fft_shift_len); - -protected: - gr_ofdm_frame_acquisition (unsigned int occupied_carriers, unsigned int fft_length, - unsigned int cplen, - const std::vector<gr_complex> &known_symbol, - unsigned int max_fft_shift_len); - - private: - unsigned char slicer(gr_complex x); - void correlate(const gr_complex *symbol, int zeros_on_left); - void calculate_equalizer(const gr_complex *symbol, int zeros_on_left); - gr_complex coarse_freq_comp(int freq_delta, int count); - - unsigned int d_occupied_carriers; // !< \brief number of subcarriers with data - unsigned int d_fft_length; // !< \brief length of FFT vector - unsigned int d_cplen; // !< \brief length of cyclic prefix in samples - unsigned int d_freq_shift_len; // !< \brief number of surrounding bins to look at for correlation - std::vector<gr_complex> d_known_symbol; // !< \brief known symbols at start of frame - std::vector<float> d_known_phase_diff; // !< \brief factor used in correlation from known symbol - std::vector<float> d_symbol_phase_diff; // !< \brief factor used in correlation from received symbol - std::vector<gr_complex> d_hestimate; // !< channel estimate - int d_coarse_freq; // !< \brief search distance in number of bins - unsigned int d_phase_count; // !< \brief accumulator for coarse freq correction - float d_snr_est; // !< an estimation of the signal to noise ratio - - gr_complex *d_phase_lut; // !< look-up table for coarse frequency compensation - - void forecast(int noutput_items, gr_vector_int &ninput_items_required); - - public: - /*! - * \brief Return an estimate of the SNR of the channel - */ - float snr() { return d_snr_est; } - - ~gr_ofdm_frame_acquisition(void); - 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 diff --git a/gnuradio-core/src/lib/general/gr_ofdm_frame_acquisition.i b/gnuradio-core/src/lib/general/gr_ofdm_frame_acquisition.i deleted file mode 100644 index 0fd0bc58b..000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_frame_acquisition.i +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006, 2007 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 <vector> - -GR_SWIG_BLOCK_MAGIC(gr,ofdm_frame_acquisition); - -gr_ofdm_frame_acquisition_sptr -gr_make_ofdm_frame_acquisition (unsigned int occupied_carriers, - unsigned int fft_length, - unsigned int cplen, - const std::vector<gr_complex> &known_symbol, - unsigned int max_fft_shift_len=4); - -class gr_ofdm_frame_acquisition : public gr_sync_decimator -{ - protected: - gr_ofdm_frame_acquisition (unsigned int occupied_carriers, - unsigned int fft_length, - unsigned int cplen, - const std::vector<gr_complex> &known_symbol, - unsigned int max_fft_shift_len); - - public: - float snr() { return d_snr_est; } - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; diff --git a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.cc index 279945766..40574b4e9 100644 --- a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc +++ b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2007,2008,2010 Free Software Foundation, Inc. + * Copyright 2007,2008,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -24,7 +24,7 @@ #include "config.h" #endif -#include <gr_ofdm_frame_sink.h> +#include <gr_ofdm_frame_sink2.h> #include <gr_io_signature.h> #include <gr_expj.h> #include <gr_math.h> @@ -33,11 +33,12 @@ #include <stdexcept> #include <iostream> #include <string.h> +#include <gr_constellation.h> #define VERBOSE 0 inline void -gr_ofdm_frame_sink::enter_search() +gr_ofdm_frame_sink2::enter_search() { if (VERBOSE) fprintf(stderr, "@ enter_search\n"); @@ -47,7 +48,7 @@ gr_ofdm_frame_sink::enter_search() } inline void -gr_ofdm_frame_sink::enter_have_sync() +gr_ofdm_frame_sink2::enter_have_sync() { if (VERBOSE) fprintf(stderr, "@ enter_have_sync\n"); @@ -68,7 +69,7 @@ gr_ofdm_frame_sink::enter_have_sync() } inline void -gr_ofdm_frame_sink::enter_have_header() +gr_ofdm_frame_sink2::enter_have_header() { d_state = STATE_HAVE_HEADER; @@ -85,24 +86,7 @@ gr_ofdm_frame_sink::enter_have_header() } -unsigned char gr_ofdm_frame_sink::slicer(const gr_complex x) -{ - unsigned int table_size = d_sym_value_out.size(); - unsigned int min_index = 0; - float min_euclid_dist = norm(x - d_sym_position[0]); - float euclid_dist = 0; - - for (unsigned int j = 1; j < table_size; j++){ - euclid_dist = norm(x - d_sym_position[j]); - if (euclid_dist < min_euclid_dist){ - min_euclid_dist = euclid_dist; - min_index = j; - } - } - return d_sym_value_out[min_index]; -} - -unsigned int gr_ofdm_frame_sink::demapper(const gr_complex *in, +unsigned int gr_ofdm_frame_sink2::demapper(const gr_complex *in, unsigned char *out) { unsigned int i=0, bytes_produced=0; @@ -129,9 +113,9 @@ unsigned int gr_ofdm_frame_sink::demapper(const gr_complex *in, d_derotated_output[i] = sigrot; } - unsigned char bits = slicer(sigrot); + unsigned char bits = d_constell->decision_maker(&sigrot); - gr_complex closest_sym = d_sym_position[bits]; + gr_complex closest_sym = d_constell->points()[bits]; accum_error += sigrot * conj(closest_sym); @@ -178,30 +162,32 @@ unsigned int gr_ofdm_frame_sink::demapper(const gr_complex *in, } -gr_ofdm_frame_sink_sptr -gr_make_ofdm_frame_sink(const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out, +gr_ofdm_frame_sink2_sptr +gr_make_ofdm_frame_sink2(gr_constellation_sptr constell, gr_msg_queue_sptr target_queue, unsigned int occupied_carriers, float phase_gain, float freq_gain) { - return gnuradio::get_initial_sptr(new gr_ofdm_frame_sink(sym_position, sym_value_out, + return gnuradio::get_initial_sptr(new gr_ofdm_frame_sink2(constell, target_queue, occupied_carriers, phase_gain, freq_gain)); } -gr_ofdm_frame_sink::gr_ofdm_frame_sink(const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out, +gr_ofdm_frame_sink2::gr_ofdm_frame_sink2(gr_constellation_sptr constell, gr_msg_queue_sptr target_queue, unsigned int occupied_carriers, float phase_gain, float freq_gain) - : gr_sync_block ("ofdm_frame_sink", + : gr_sync_block ("ofdm_frame_sink2", gr_make_io_signature2 (2, 2, sizeof(gr_complex)*occupied_carriers, sizeof(char)), gr_make_io_signature (1, 1, sizeof(gr_complex)*occupied_carriers)), + d_constell(constell), d_target_queue(target_queue), d_occupied_carriers(occupied_carriers), d_byte_offset(0), d_partial_byte(0), d_resid(0), d_nresid(0),d_phase(0),d_freq(0),d_phase_gain(phase_gain),d_freq_gain(freq_gain), d_eq_gain(0.05) { + if (d_constell->dimensionality() != 1) + throw std::runtime_error ("This receiver only works with constellations of dimension 1."); + std::string carriers = "FE7F"; // A bit hacky to fill out carriers to occupied_carriers length @@ -259,36 +245,19 @@ gr_ofdm_frame_sink::gr_ofdm_frame_sink(const std::vector<gr_complex> &sym_positi d_dfe.resize(occupied_carriers); fill(d_dfe.begin(), d_dfe.end(), gr_complex(1.0,0.0)); - set_sym_value_out(sym_position, sym_value_out); - + d_nbits = d_constell->bits_per_symbol(); + enter_search(); } -gr_ofdm_frame_sink::~gr_ofdm_frame_sink () +gr_ofdm_frame_sink2::~gr_ofdm_frame_sink2 () { delete [] d_bytes_out; } -bool -gr_ofdm_frame_sink::set_sym_value_out(const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out) -{ - if (sym_position.size() != sym_value_out.size()) - return false; - - if (sym_position.size()<1) - return false; - - d_sym_position = sym_position; - d_sym_value_out = sym_value_out; - d_nbits = (unsigned long)ceil(log10(float(d_sym_value_out.size())) / log10(2.0)); - - return true; -} - int -gr_ofdm_frame_sink::work (int noutput_items, +gr_ofdm_frame_sink2::work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { diff --git a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.h b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.h index c419b8673..9595303b1 100644 --- a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.h +++ b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2007 Free Software Foundation, Inc. + * Copyright 2007,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,18 +20,19 @@ * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_GR_OFDM_FRAME_SINK_H -#define INCLUDED_GR_OFDM_FRAME_SINK_H +#ifndef INCLUDED_GR_OFDM_FRAME_SINK2_H +#define INCLUDED_GR_OFDM_FRAME_SINK2_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_msg_queue.h> +#include <gr_constellation.h> -class gr_ofdm_frame_sink; -typedef boost::shared_ptr<gr_ofdm_frame_sink> gr_ofdm_frame_sink_sptr; +class gr_ofdm_frame_sink2; +typedef boost::shared_ptr<gr_ofdm_frame_sink2> gr_ofdm_frame_sink2_sptr; -gr_ofdm_frame_sink_sptr -gr_make_ofdm_frame_sink (const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out, +GR_CORE_API gr_ofdm_frame_sink2_sptr +gr_make_ofdm_frame_sink2 (gr_constellation_sptr constell, gr_msg_queue_sptr target_queue, unsigned int occupied_tones, float phase_gain=0.25, float freq_gain=0.25*0.25/4.0); @@ -45,11 +46,10 @@ gr_make_ofdm_frame_sink (const std::vector<gr_complex> &sym_position, * we want to be able to pass in a reference to an object to do the demapping and slicing * for a given modulation type. */ -class gr_ofdm_frame_sink : public gr_sync_block +class GR_CORE_API gr_ofdm_frame_sink2 : public gr_sync_block { - friend gr_ofdm_frame_sink_sptr - gr_make_ofdm_frame_sink (const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out, + friend GR_CORE_API gr_ofdm_frame_sink2_sptr + gr_make_ofdm_frame_sink2 (gr_constellation_sptr constell, gr_msg_queue_sptr target_queue, unsigned int occupied_tones, float phase_gain, float freq_gain); @@ -77,8 +77,7 @@ class gr_ofdm_frame_sink : public gr_sync_block gr_complex * d_derotated_output; // Pointer to output stream to send deroated symbols out - std::vector<gr_complex> d_sym_position; - std::vector<unsigned char> d_sym_value_out; + gr_constellation_sptr d_constell; std::vector<gr_complex> d_dfe; unsigned int d_nbits; @@ -93,8 +92,7 @@ class gr_ofdm_frame_sink : public gr_sync_block std::vector<int> d_subcarrier_map; protected: - gr_ofdm_frame_sink(const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out, + gr_ofdm_frame_sink2(gr_constellation_sptr constell, gr_msg_queue_sptr target_queue, unsigned int occupied_tones, float phase_gain, float freq_gain); @@ -112,15 +110,12 @@ class gr_ofdm_frame_sink : public gr_sync_block unsigned int demapper(const gr_complex *in, unsigned char *out); - bool set_sym_value_out(const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out); - public: - ~gr_ofdm_frame_sink(); + ~gr_ofdm_frame_sink2(); int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); }; -#endif /* INCLUDED_GR_OFDM_FRAME_SINK_H */ +#endif /* INCLUDED_GR_OFDM_FRAME_SINK2_H */ diff --git a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.i b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.i index 38ab50e97..8fa320089 100644 --- a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.i +++ b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2007 Free Software Foundation, Inc. + * Copyright 2007,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,22 +20,20 @@ * Boston, MA 02110-1301, USA. */ -GR_SWIG_BLOCK_MAGIC(gr,ofdm_frame_sink); +GR_SWIG_BLOCK_MAGIC(gr,ofdm_frame_sink2); -gr_ofdm_frame_sink_sptr -gr_make_ofdm_frame_sink(const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out, +gr_ofdm_frame_sink2_sptr +gr_make_ofdm_frame_sink2(gr_constellation_sptr constell, gr_msg_queue_sptr target_queue, unsigned int occupied_tones, float phase_gain=0.25, float freq_gain=0.25*0.25/4); -class gr_ofdm_frame_sink : public gr_sync_block +class gr_ofdm_frame_sink2 : public gr_sync_block { protected: - gr_ofdm_frame_sink(const std::vector<gr_complex> &sym_position, - const std::vector<unsigned char> &sym_value_out, + gr_ofdm_frame_sink2(gr_constellation_sptr constell, gr_msg_queue_sptr target_queue, unsigned int occupied_tones, float phase_gain, float freq_gain); public: - ~gr_ofdm_frame_sink(); + ~gr_ofdm_frame_sink2(); }; diff --git a/gnuradio-core/src/lib/general/gr_ofdm_insert_preamble.cc b/gnuradio-core/src/lib/general/gr_ofdm_insert_preamble.cc deleted file mode 100644 index ed10c94a8..000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_insert_preamble.cc +++ /dev/null @@ -1,187 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_ofdm_insert_preamble.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <iostream> -#include <string.h> - -gr_ofdm_insert_preamble_sptr -gr_make_ofdm_insert_preamble(int fft_length, - const std::vector<std::vector<gr_complex> > &preamble) -{ - return gnuradio::get_initial_sptr(new gr_ofdm_insert_preamble(fft_length, - preamble)); -} - -gr_ofdm_insert_preamble::gr_ofdm_insert_preamble - (int fft_length, - const std::vector<std::vector<gr_complex> > &preamble) - : gr_block("ofdm_insert_preamble", - gr_make_io_signature2(2, 2, - sizeof(gr_complex)*fft_length, - sizeof(char)), - gr_make_io_signature2(1, 2, - sizeof(gr_complex)*fft_length, - sizeof(char))), - d_fft_length(fft_length), - d_preamble(preamble), - d_state(ST_IDLE), - d_nsymbols_output(0), - d_pending_flag(0) -{ - // sanity check preamble symbols - for (size_t i = 0; i < d_preamble.size(); i++){ - if (d_preamble[i].size() != (size_t) d_fft_length) - throw std::invalid_argument("gr_ofdm_insert_preamble: invalid length for preamble symbol"); - } - - enter_idle(); -} - - -gr_ofdm_insert_preamble::~gr_ofdm_insert_preamble() -{ -} - -int -gr_ofdm_insert_preamble::general_work (int noutput_items, - gr_vector_int &ninput_items_v, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - int ninput_items = std::min(ninput_items_v[0], ninput_items_v[1]); - const gr_complex *in_sym = (const gr_complex *) input_items[0]; - const unsigned char *in_flag = (const unsigned char *) input_items[1]; - - gr_complex *out_sym = (gr_complex *) output_items[0]; - unsigned char *out_flag = 0; - if (output_items.size() == 2) - out_flag = (unsigned char *) output_items[1]; - - - int no = 0; // number items output - int ni = 0; // number items read from input - - -#define write_out_flag() \ - do { if (out_flag) \ - out_flag[no] = d_pending_flag; \ - d_pending_flag = 0; \ - } while(0) - - - while (no < noutput_items && ni < ninput_items){ - switch(d_state){ - case ST_IDLE: - if (in_flag[ni] & 0x1) // this is first symbol of new payload - enter_preamble(); - else - ni++; // eat one input symbol - break; - - case ST_PREAMBLE: - assert(in_flag[ni] & 0x1); - if (d_nsymbols_output >= (int) d_preamble.size()){ - // we've output all the preamble - enter_first_payload(); - } - else { - memcpy(&out_sym[no * d_fft_length], - &d_preamble[d_nsymbols_output][0], - d_fft_length*sizeof(gr_complex)); - - write_out_flag(); - no++; - d_nsymbols_output++; - } - break; - - case ST_FIRST_PAYLOAD: - // copy first payload symbol from input to output - memcpy(&out_sym[no * d_fft_length], - &in_sym[ni * d_fft_length], - d_fft_length * sizeof(gr_complex)); - - write_out_flag(); - no++; - ni++; - enter_payload(); - break; - - case ST_PAYLOAD: - if (in_flag[ni] & 0x1){ // this is first symbol of a new payload - enter_preamble(); - break; - } - - // copy a symbol from input to output - memcpy(&out_sym[no * d_fft_length], - &in_sym[ni * d_fft_length], - d_fft_length * sizeof(gr_complex)); - - write_out_flag(); - no++; - ni++; - break; - - default: - std::cerr << "gr_ofdm_insert_preamble: (can't happen) invalid state, resetting\n"; - enter_idle(); - } - } - - consume_each(ni); - return no; -} - -void -gr_ofdm_insert_preamble::enter_idle() -{ - d_state = ST_IDLE; - d_nsymbols_output = 0; - d_pending_flag = 0; -} - -void -gr_ofdm_insert_preamble::enter_preamble() -{ - d_state = ST_PREAMBLE; - d_nsymbols_output = 0; - d_pending_flag = 1; -} - -void -gr_ofdm_insert_preamble::enter_first_payload() -{ - d_state = ST_FIRST_PAYLOAD; -} - -void -gr_ofdm_insert_preamble::enter_payload() -{ - d_state = ST_PAYLOAD; -} diff --git a/gnuradio-core/src/lib/general/gr_ofdm_insert_preamble.h b/gnuradio-core/src/lib/general/gr_ofdm_insert_preamble.h deleted file mode 100644 index 57c1af013..000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_insert_preamble.h +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef INCLUDED_GR_OFDM_INSERT_PREAMBLE_H -#define INCLUDED_GR_OFDM_INSERT_PREAMBLE_H - -#include <gr_block.h> -#include <vector> - -class gr_ofdm_insert_preamble; -typedef boost::shared_ptr<gr_ofdm_insert_preamble> gr_ofdm_insert_preamble_sptr; - -gr_ofdm_insert_preamble_sptr -gr_make_ofdm_insert_preamble(int fft_length, - const std::vector<std::vector<gr_complex> > &preamble); - -/*! - * \brief insert "pre-modulated" preamble symbols before each payload. - * \ingroup sync_blk - * \ingroup ofdm_blk - * - * <pre> - * input 1: stream of vectors of gr_complex [fft_length] - * These are the modulated symbols of the payload. - * - * input 2: stream of char. The LSB indicates whether the corresponding - * symbol on input 1 is the first symbol of the payload or not. - * It's a 1 if the corresponding symbol is the first symbol, - * otherwise 0. - * - * N.B., this implies that there must be at least 1 symbol in the payload. - * - * - * output 1: stream of vectors of gr_complex [fft_length] - * These include the preamble symbols and the payload symbols. - * - * output 2: stream of char. The LSB indicates whether the corresponding - * symbol on input 1 is the first symbol of a packet (i.e., the - * first symbol of the preamble.) It's a 1 if the corresponding - * symbol is the first symbol, otherwise 0. - * </pre> - * - * \param fft_length length of each symbol in samples. - * \param preamble vector of symbols that represent the pre-modulated preamble. - */ - -class gr_ofdm_insert_preamble : public gr_block -{ - friend gr_ofdm_insert_preamble_sptr - gr_make_ofdm_insert_preamble(int fft_length, - const std::vector<std::vector<gr_complex> > &preamble); - -protected: - gr_ofdm_insert_preamble(int fft_length, - const std::vector<std::vector<gr_complex> > &preamble); - -private: - enum state_t { - ST_IDLE, - ST_PREAMBLE, - ST_FIRST_PAYLOAD, - ST_PAYLOAD - }; - - int d_fft_length; - const std::vector<std::vector<gr_complex> > d_preamble; - state_t d_state; - int d_nsymbols_output; - int d_pending_flag; - - void enter_idle(); - void enter_preamble(); - void enter_first_payload(); - void enter_payload(); - - -public: - ~gr_ofdm_insert_preamble(); - - 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_OFDM_INSERT_PREAMBLE_H */ diff --git a/gnuradio-core/src/lib/general/gr_ofdm_insert_preamble.i b/gnuradio-core/src/lib/general/gr_ofdm_insert_preamble.i deleted file mode 100644 index e33bd63a0..000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_insert_preamble.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 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,ofdm_insert_preamble); - -gr_ofdm_insert_preamble_sptr -gr_make_ofdm_insert_preamble(int fft_length, - const std::vector<std::vector<gr_complex> > &preamble); - - -class gr_ofdm_insert_preamble : public gr_block -{ - protected: - gr_ofdm_insert_preamble(int fft_length, - const std::vector<std::vector<gr_complex> > &preamble); -}; diff --git a/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc b/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc deleted file mode 100644 index cc4aba0cb..000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc +++ /dev/null @@ -1,241 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2007,2008,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_ofdm_mapper_bcv.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <string.h> - -gr_ofdm_mapper_bcv_sptr -gr_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned int msgq_limit, - unsigned int occupied_carriers, unsigned int fft_length) -{ - return gnuradio::get_initial_sptr(new gr_ofdm_mapper_bcv (constellation, msgq_limit, - occupied_carriers, fft_length)); -} - -// Consumes 1 packet and produces as many OFDM symbols of fft_length to hold the full packet -gr_ofdm_mapper_bcv::gr_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned int msgq_limit, - unsigned int occupied_carriers, unsigned int fft_length) - : gr_sync_block ("ofdm_mapper_bcv", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature2 (1, 2, sizeof(gr_complex)*fft_length, sizeof(char))), - d_constellation(constellation), - d_msgq(gr_make_msg_queue(msgq_limit)), d_msg_offset(0), d_eof(false), - d_occupied_carriers(occupied_carriers), - d_fft_length(fft_length), - d_bit_offset(0), - d_pending_flag(0), - d_resid(0), - d_nresid(0) -{ - if (!(d_occupied_carriers <= d_fft_length)) - throw std::invalid_argument("gr_ofdm_mapper_bcv: occupied carriers must be <= fft_length"); - - // this is not the final form of this solution since we still use the occupied_tones concept, - // which would get us into trouble if the number of carriers we seek is greater than the occupied carriers. - // Eventually, we will get rid of the occupied_carriers concept. - std::string carriers = "FE7F"; - - // A bit hacky to fill out carriers to occupied_carriers length - int diff = (d_occupied_carriers - 4*carriers.length()); - while(diff > 7) { - carriers.insert(0, "f"); - carriers.insert(carriers.length(), "f"); - diff -= 8; - } - - // if there's extras left to be processed - // divide remaining to put on either side of current map - // all of this is done to stick with the concept of a carrier map string that - // can be later passed by the user, even though it'd be cleaner to just do this - // on the carrier map itself - int diff_left=0; - int diff_right=0; - - // dictionary to convert from integers to ascii hex representation - char abc[16] = {'0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; - if(diff > 0) { - char c[2] = {0,0}; - - diff_left = (int)ceil((float)diff/2.0f); // number of carriers to put on the left side - c[0] = abc[(1 << diff_left) - 1]; // convert to bits and move to ASCI integer - carriers.insert(0, c); - - diff_right = diff - diff_left; // number of carriers to put on the right side - c[0] = abc[0xF^((1 << diff_right) - 1)]; // convert to bits and move to ASCI integer - carriers.insert(carriers.length(), c); - } - - // find out how many zeros to pad on the sides; the difference between the fft length and the subcarrier - // mapping size in chunks of four. This is the number to pack on the left and this number plus any - // residual nulls (if odd) will be packed on the right. - diff = (d_fft_length/4 - carriers.length())/2; - - unsigned int i,j,k; - for(i = 0; i < carriers.length(); i++) { - char c = carriers[i]; // get the current hex character from the string - for(j = 0; j < 4; j++) { // walk through all four bits - k = (strtol(&c, NULL, 16) >> (3-j)) & 0x1; // convert to int and extract next bit - if(k) { // if bit is a 1, - d_subcarrier_map.push_back(4*(i+diff) + j); // use this subcarrier - } - } - } - - // make sure we stay in the limit currently imposed by the occupied_carriers - if(d_subcarrier_map.size() > d_occupied_carriers) { - throw std::invalid_argument("gr_ofdm_mapper_bcv: subcarriers allocated exceeds size of occupied carriers"); - } - - d_nbits = (unsigned long)ceil(log10(float(d_constellation.size())) / log10(2.0)); -} - -gr_ofdm_mapper_bcv::~gr_ofdm_mapper_bcv(void) -{ -} - -int gr_ofdm_mapper_bcv::randsym() -{ - return (rand() % d_constellation.size()); -} - -int -gr_ofdm_mapper_bcv::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex *out = (gr_complex *)output_items[0]; - - unsigned int i=0; - - //printf("OFDM BPSK Mapper: ninput_items: %d noutput_items: %d\n", ninput_items[0], noutput_items); - - if(d_eof) { - return -1; - } - - if(!d_msg) { - d_msg = d_msgq->delete_head(); // block, waiting for a message - d_msg_offset = 0; - d_bit_offset = 0; - d_pending_flag = 1; // new packet, write start of packet flag - - if((d_msg->length() == 0) && (d_msg->type() == 1)) { - d_msg.reset(); - return -1; // We're done; no more messages coming. - } - } - - char *out_flag = 0; - if(output_items.size() == 2) - out_flag = (char *) output_items[1]; - - - // Build a single symbol: - // Initialize all bins to 0 to set unused carriers - memset(out, 0, d_fft_length*sizeof(gr_complex)); - - i = 0; - unsigned char bits = 0; - //while((d_msg_offset < d_msg->length()) && (i < d_occupied_carriers)) { - while((d_msg_offset < d_msg->length()) && (i < d_subcarrier_map.size())) { - - // need new data to process - if(d_bit_offset == 0) { - d_msgbytes = d_msg->msg()[d_msg_offset]; - //printf("mod message byte: %x\n", d_msgbytes); - } - - if(d_nresid > 0) { - // take the residual bits, fill out nbits with info from the new byte, and put them in the symbol - d_resid |= (((1 << d_nresid)-1) & d_msgbytes) << (d_nbits - d_nresid); - bits = d_resid; - - out[d_subcarrier_map[i]] = d_constellation[bits]; - i++; - - d_bit_offset += d_nresid; - d_nresid = 0; - d_resid = 0; - //printf("mod bit(r): %x resid: %x nresid: %d bit_offset: %d\n", - // bits, d_resid, d_nresid, d_bit_offset); - } - else { - if((8 - d_bit_offset) >= d_nbits) { // test to make sure we can fit nbits - // take the nbits number of bits at a time from the byte to add to the symbol - bits = ((1 << d_nbits)-1) & (d_msgbytes >> d_bit_offset); - d_bit_offset += d_nbits; - - out[d_subcarrier_map[i]] = d_constellation[bits]; - i++; - } - else { // if we can't fit nbits, store them for the next - // saves d_nresid bits of this message where d_nresid < d_nbits - unsigned int extra = 8-d_bit_offset; - d_resid = ((1 << extra)-1) & (d_msgbytes >> d_bit_offset); - d_bit_offset += extra; - d_nresid = d_nbits - extra; - } - - } - - if(d_bit_offset == 8) { - d_bit_offset = 0; - d_msg_offset++; - } - } - - // Ran out of data to put in symbol - if (d_msg_offset == d_msg->length()) { - if(d_nresid > 0) { - d_resid |= 0x00; - bits = d_resid; - d_nresid = 0; - d_resid = 0; - } - - //while(i < d_occupied_carriers) { // finish filling out the symbol - while(i < d_subcarrier_map.size()) { // finish filling out the symbol - out[d_subcarrier_map[i]] = d_constellation[randsym()]; - - i++; - } - - if (d_msg->type() == 1) // type == 1 sets EOF - d_eof = true; - d_msg.reset(); // finished packet, free message - assert(d_bit_offset == 0); - } - - if (out_flag) - out_flag[0] = d_pending_flag; - d_pending_flag = 0; - - return 1; // produced symbol -} diff --git a/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.h b/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.h deleted file mode 100644 index 5a21b90af..000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2007 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_OFDM_MAPPER_BCV_H -#define INCLUDED_GR_OFDM_MAPPER_BCV_H - -#include <gr_sync_block.h> -#include <gr_message.h> -#include <gr_msg_queue.h> - -class gr_ofdm_mapper_bcv; -typedef boost::shared_ptr<gr_ofdm_mapper_bcv> gr_ofdm_mapper_bcv_sptr; - -gr_ofdm_mapper_bcv_sptr -gr_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned msgq_limit, - unsigned occupied_carriers, unsigned int fft_length); - -/*! - * \brief take a stream of bytes in and map to a vector of complex - * constellation points suitable for IFFT input to be used in an ofdm - * modulator. Abstract class must be subclassed with specific mapping. - * \ingroup modulation_blk - * \ingroup ofdm_blk - */ - -class gr_ofdm_mapper_bcv : public gr_sync_block -{ - friend gr_ofdm_mapper_bcv_sptr - gr_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned msgq_limit, - unsigned occupied_carriers, unsigned int fft_length); - protected: - gr_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned msgq_limit, - unsigned occupied_carriers, unsigned int fft_length); - - private: - std::vector<gr_complex> d_constellation; - gr_msg_queue_sptr d_msgq; - gr_message_sptr d_msg; - unsigned d_msg_offset; - bool d_eof; - - unsigned int d_occupied_carriers; - unsigned int d_fft_length; - unsigned int d_bit_offset; - int d_pending_flag; - - unsigned long d_nbits; - unsigned char d_msgbytes; - - unsigned char d_resid; - unsigned int d_nresid; - - std::vector<int> d_subcarrier_map; - - int randsym(); - - public: - ~gr_ofdm_mapper_bcv(void); - - gr_msg_queue_sptr msgq() const { return d_msgq; } - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.i b/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.i deleted file mode 100644 index 3850220ba..000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.i +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2007 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,ofdm_mapper_bcv); - -gr_ofdm_mapper_bcv_sptr -gr_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, - unsigned int msgq_limit, - unsigned int bits_per_symbol, - unsigned int fft_length) throw(std::exception); - - -class gr_ofdm_mapper_bcv : public gr_sync_block -{ - protected: - gr_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, - unsigned int msgq_limit, - unsigned int bits_per_symbol, - unsigned int fft_length); - - public: - gr_msg_queue_sptr msgq(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; diff --git a/gnuradio-core/src/lib/general/gr_ofdm_sampler.cc b/gnuradio-core/src/lib/general/gr_ofdm_sampler.cc deleted file mode 100644 index f9a53c87f..000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_sampler.cc +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008,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_ofdm_sampler.h> -#include <gr_io_signature.h> -#include <gr_expj.h> -#include <cstdio> - -gr_ofdm_sampler_sptr -gr_make_ofdm_sampler (unsigned int fft_length, - unsigned int symbol_length, - unsigned int timeout) -{ - return gnuradio::get_initial_sptr(new gr_ofdm_sampler (fft_length, symbol_length, timeout)); -} - -gr_ofdm_sampler::gr_ofdm_sampler (unsigned int fft_length, - unsigned int symbol_length, - unsigned int timeout) - : gr_block ("ofdm_sampler", - gr_make_io_signature2 (2, 2, sizeof (gr_complex), sizeof(char)), - gr_make_io_signature2 (2, 2, sizeof (gr_complex)*fft_length, sizeof(char)*fft_length)), - d_state(STATE_NO_SIG), d_timeout_max(timeout), d_fft_length(fft_length), d_symbol_length(symbol_length) -{ - set_relative_rate(1.0/(double) fft_length); // buffer allocator hint -} - -void -gr_ofdm_sampler::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - // FIXME do we need more - //int nreqd = (noutput_items-1) * d_symbol_length + d_fft_length; - int nreqd = d_symbol_length + d_fft_length; - unsigned ninputs = ninput_items_required.size (); - for (unsigned i = 0; i < ninputs; i++) - ninput_items_required[i] = nreqd; -} - - -int -gr_ofdm_sampler::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *iptr = (const gr_complex *) input_items[0]; - const char *trigger = (const char *) input_items[1]; - - gr_complex *optr = (gr_complex *) output_items[0]; - char *outsig = (char *) output_items[1]; - - //FIXME: we only process a single OFDM symbol at a time; after the preamble, we can - // process a few at a time as long as we always look out for the next preamble. - - unsigned int index=d_fft_length; // start one fft length into the input so we can always look back this far - - outsig[0] = 0; // set output to no signal by default - - // Search for a preamble trigger signal during the next symbol length - while((d_state != STATE_PREAMBLE) && (index <= (d_symbol_length+d_fft_length))) { - if(trigger[index]) { - outsig[0] = 1; // tell the next block there is a preamble coming - d_state = STATE_PREAMBLE; - } - else - index++; - } - - unsigned int i, pos, ret; - switch(d_state) { - case(STATE_PREAMBLE): - // When we found a preamble trigger, get it and set the symbol boundary here - for(i = (index - d_fft_length + 1); i <= index; i++) { - *optr++ = iptr[i]; - } - - d_timeout = d_timeout_max; // tell the system to expect at least this many symbols for a frame - d_state = STATE_FRAME; - consume_each(index - d_fft_length + 1); // consume up to one fft_length away to keep the history - ret = 1; - break; - - case(STATE_FRAME): - // use this state when we have processed a preamble and are getting the rest of the frames - //FIXME: we could also have a power squelch system here to enter STATE_NO_SIG if no power is received - - // skip over fft length history and cyclic prefix - pos = d_symbol_length; // keeps track of where we are in the input buffer - while(pos < d_symbol_length + d_fft_length) { - *optr++ = iptr[pos++]; - } - - if(d_timeout-- == 0) { - printf("TIMEOUT\n"); - d_state = STATE_NO_SIG; - } - - consume_each(d_symbol_length); // jump up by 1 fft length and the cyclic prefix length - ret = 1; - break; - - case(STATE_NO_SIG): - default: - consume_each(index-d_fft_length); // consume everything we've gone through so far leaving the fft length history - ret = 0; - break; - } - - return ret; -} diff --git a/gnuradio-core/src/lib/general/gr_ofdm_sampler.h b/gnuradio-core/src/lib/general/gr_ofdm_sampler.h deleted file mode 100644 index d059636ed..000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_sampler.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 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_OFDM_SAMPLER_H -#define INCLUDED_GR_OFDM_SAMPLER_H - -#include <gr_sync_block.h> - -class gr_ofdm_sampler; -typedef boost::shared_ptr<gr_ofdm_sampler> gr_ofdm_sampler_sptr; - -gr_ofdm_sampler_sptr gr_make_ofdm_sampler (unsigned int fft_length, - unsigned int symbol_length, - unsigned int timeout=1000); - -/*! - * \brief does the rest of the OFDM stuff - * \ingroup ofdm_blk - */ -class gr_ofdm_sampler : public gr_block -{ - friend gr_ofdm_sampler_sptr gr_make_ofdm_sampler (unsigned int fft_length, - unsigned int symbol_length, - unsigned int timeout); - - gr_ofdm_sampler (unsigned int fft_length, - unsigned int symbol_length, - unsigned int timeout); - - private: - enum state_t {STATE_NO_SIG, STATE_PREAMBLE, STATE_FRAME}; - - state_t d_state; - unsigned int d_timeout_max; - unsigned int d_timeout; - unsigned int d_fft_length; - unsigned int d_symbol_length; - - public: - void forecast (int noutput_items, gr_vector_int &ninput_items_required); - - 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 diff --git a/gnuradio-core/src/lib/general/gr_ofdm_sampler.i b/gnuradio-core/src/lib/general/gr_ofdm_sampler.i deleted file mode 100644 index 601330b07..000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_sampler.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 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,ofdm_sampler) - - gr_ofdm_sampler_sptr gr_make_ofdm_sampler (unsigned int fft_length, - unsigned int symbol_length, - unsigned int timeout=1000); - -class gr_ofdm_sampler : public gr_sync_block -{ - private: - gr_ofdm_sampler (unsigned int fft_length, - unsigned int symbol_length, - unsigned int timeout); -}; diff --git a/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.h b/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.h index ec163911a..abb23e002 100644 --- a/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.h +++ b/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.h @@ -22,12 +22,13 @@ #ifndef INCLUDED_GR_PA_2X2_PHASE_COMBINER_H #define INCLUDED_GR_PA_2X2_PHASE_COMBINER_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_pa_2x2_phase_combiner; typedef boost::shared_ptr<gr_pa_2x2_phase_combiner> gr_pa_2x2_phase_combiner_sptr; -gr_pa_2x2_phase_combiner_sptr gr_make_pa_2x2_phase_combiner (); +GR_CORE_API gr_pa_2x2_phase_combiner_sptr gr_make_pa_2x2_phase_combiner (); /*! * \brief pa_2x2 phase combiner @@ -40,7 +41,7 @@ gr_pa_2x2_phase_combiner_sptr gr_make_pa_2x2_phase_combiner (); * * dx and dy are lambda/2. */ -class gr_pa_2x2_phase_combiner : public gr_sync_block +class GR_CORE_API gr_pa_2x2_phase_combiner : public gr_sync_block { static const int NM = 4; @@ -48,7 +49,7 @@ class gr_pa_2x2_phase_combiner : public gr_sync_block gr_complex d_phase[NM]; gr_pa_2x2_phase_combiner (); - friend gr_pa_2x2_phase_combiner_sptr gr_make_pa_2x2_phase_combiner(); + friend GR_CORE_API gr_pa_2x2_phase_combiner_sptr gr_make_pa_2x2_phase_combiner(); public: float theta() const { return d_theta; } diff --git a/gnuradio-core/src/lib/general/gr_packet_sink.h b/gnuradio-core/src/lib/general/gr_packet_sink.h index 73c5d6c52..89a95f3e3 100644 --- a/gnuradio-core/src/lib/general/gr_packet_sink.h +++ b/gnuradio-core/src/lib/general/gr_packet_sink.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_PACKET_SINK_H #define INCLUDED_GR_PACKET_SINK_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_msg_queue.h> class gr_packet_sink; typedef boost::shared_ptr<gr_packet_sink> gr_packet_sink_sptr; -gr_packet_sink_sptr +GR_CORE_API gr_packet_sink_sptr gr_make_packet_sink (const std::vector<unsigned char>& sync_vector, gr_msg_queue_sptr target_queue, int threshold = -1 // -1 -> use default @@ -38,9 +39,9 @@ gr_make_packet_sink (const std::vector<unsigned char>& sync_vector, * \brief process received bits looking for packet sync, header, and process bits into packet * \ingroup sink_blk */ -class gr_packet_sink : public gr_sync_block +class GR_CORE_API gr_packet_sink : public gr_sync_block { - friend gr_packet_sink_sptr + friend GR_CORE_API gr_packet_sink_sptr gr_make_packet_sink (const std::vector<unsigned char>& sync_vector, gr_msg_queue_sptr target_queue, int threshold); diff --git a/gnuradio-core/src/lib/general/gr_peak_detector2_fb.h b/gnuradio-core/src/lib/general/gr_peak_detector2_fb.h index 58a006246..5bb97fc5d 100644 --- a/gnuradio-core/src/lib/general/gr_peak_detector2_fb.h +++ b/gnuradio-core/src/lib/general/gr_peak_detector2_fb.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_gr_peak_detector2_FB_H #define INCLUDED_gr_peak_detector2_FB_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_peak_detector2_fb; typedef boost::shared_ptr<gr_peak_detector2_fb> gr_peak_detector2_fb_sptr; -gr_peak_detector2_fb_sptr gr_make_peak_detector2_fb (float threshold_factor_rise = 7, +GR_CORE_API gr_peak_detector2_fb_sptr gr_make_peak_detector2_fb (float threshold_factor_rise = 7, int look_ahead = 1000, float alpha = 0.001); @@ -49,9 +50,9 @@ gr_peak_detector2_fb_sptr gr_make_peak_detector2_fb (float threshold_factor_rise * \param alpha The gain value of a single-pole moving average filter */ -class gr_peak_detector2_fb : public gr_sync_block +class GR_CORE_API gr_peak_detector2_fb : public gr_sync_block { - friend gr_peak_detector2_fb_sptr + friend GR_CORE_API gr_peak_detector2_fb_sptr gr_make_peak_detector2_fb (float threshold_factor_rise, int look_ahead, float alpha); gr_peak_detector2_fb (float threshold_factor_rise, int look_ahead, float alpha); diff --git a/gnuradio-core/src/lib/general/gr_phase_modulator_fc.h b/gnuradio-core/src/lib/general/gr_phase_modulator_fc.h index 50157534b..dd6e300a8 100644 --- a/gnuradio-core/src/lib/general/gr_phase_modulator_fc.h +++ b/gnuradio-core/src/lib/general/gr_phase_modulator_fc.h @@ -23,24 +23,25 @@ #ifndef INCLUDED_GR_PHASE_MODULATOR_FC_H #define INCLUDED_GR_PHASE_MODULATOR_FC_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_phase_modulator_fc; typedef boost::shared_ptr<gr_phase_modulator_fc> gr_phase_modulator_fc_sptr; -gr_phase_modulator_fc_sptr gr_make_phase_modulator_fc (double sensitivity); +GR_CORE_API gr_phase_modulator_fc_sptr gr_make_phase_modulator_fc (double sensitivity); /*! * \brief Phase modulator block * \ingroup modulation_blk * output=complex(cos(in*sensitivity),sin(in*sensitivity)) */ -class gr_phase_modulator_fc : public gr_sync_block +class GR_CORE_API gr_phase_modulator_fc : public gr_sync_block { double d_sensitivity; double d_phase; - friend gr_phase_modulator_fc_sptr + friend GR_CORE_API gr_phase_modulator_fc_sptr gr_make_phase_modulator_fc (double sensitivity); gr_phase_modulator_fc (double sensitivity); diff --git a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc index 1668f71f0..e8ec1e235 100644 --- a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc +++ b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006,2010 Free Software Foundation, Inc. + * Copyright 2006,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -30,22 +30,24 @@ #include <math.h> #include <gr_math.h> -#define M_TWOPI (2*M_PI) +#ifndef M_TWOPI +#define M_TWOPI (2.0f*M_PI) +#endif gr_pll_carriertracking_cc_sptr -gr_make_pll_carriertracking_cc (float alpha, float beta, float max_freq, float min_freq) +gr_make_pll_carriertracking_cc (float loop_bw, float max_freq, float min_freq) { - return gnuradio::get_initial_sptr(new gr_pll_carriertracking_cc (alpha, beta, max_freq, min_freq)); + return gnuradio::get_initial_sptr(new gr_pll_carriertracking_cc (loop_bw, max_freq, min_freq)); } -gr_pll_carriertracking_cc::gr_pll_carriertracking_cc (float alpha, float beta, float max_freq, float min_freq) +gr_pll_carriertracking_cc::gr_pll_carriertracking_cc (float loop_bw, + float max_freq, + float min_freq) : gr_sync_block ("pll_carriertracking_cc", gr_make_io_signature (1, 1, sizeof (gr_complex)), gr_make_io_signature (1, 1, sizeof (gr_complex))), - d_alpha(alpha), d_beta(beta), - d_max_freq(max_freq), d_min_freq(min_freq), - d_phase(0), d_freq((max_freq+min_freq)/2), - d_locksig(0),d_lock_threshold(0),d_squelch_enable(false) + gri_control_loop(loop_bw, max_freq, min_freq), + d_locksig(0), d_lock_threshold(0), d_squelch_enable(false) { } @@ -72,7 +74,7 @@ gr_pll_carriertracking_cc::phase_detector(gr_complex sample,float ref_phase) bool gr_pll_carriertracking_cc::lock_detector(void) { - return (fabs(d_locksig) > d_lock_threshold); + return (fabsf(d_locksig) > d_lock_threshold); } bool @@ -99,19 +101,16 @@ gr_pll_carriertracking_cc::work (int noutput_items, float t_imag, t_real; for (int i = 0; i < noutput_items; i++){ - gr_sincosf(d_phase,&t_imag,&t_real); - optr[i] = iptr[i] * gr_complex(t_real,-t_imag); + gr_sincosf(d_phase, &t_imag, &t_real); + optr[i] = iptr[i] * gr_complex(t_real, -t_imag); error = phase_detector(iptr[i],d_phase); - - d_freq = d_freq + d_beta * error; - d_phase = mod_2pi(d_phase + d_freq + d_alpha * error); - - if (d_freq > d_max_freq) - d_freq = d_max_freq; - else if (d_freq < d_min_freq) - d_freq = d_min_freq; - d_locksig = d_locksig * (1.0 - d_alpha) + + + advance_loop(error); + phase_wrap(); + frequency_limit(); + + d_locksig = d_locksig * (1.0 - d_alpha) + \ d_alpha*(iptr[i].real() * t_real + iptr[i].imag() * t_imag); if ((d_squelch_enable) && !lock_detector()) diff --git a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.h b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.h index 195f06016..db74bb101 100644 --- a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.h +++ b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,206 Free Software Foundation, Inc. + * Copyright 2004,2006,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,13 +23,16 @@ #ifndef INCLUDED_GR_PLL_CARRIERTRACKING_CC_H #define INCLUDED_GR_PLL_CARRIERTRACKING_CC_H +#include <gr_core_api.h> #include <gr_sync_block.h> +#include <gri_control_loop.h> class gr_pll_carriertracking_cc; typedef boost::shared_ptr<gr_pll_carriertracking_cc> gr_pll_carriertracking_cc_sptr; -gr_pll_carriertracking_cc_sptr gr_make_pll_carriertracking_cc (float alpha, float beta, - float max_freq, float min_freq); +GR_CORE_API gr_pll_carriertracking_cc_sptr gr_make_pll_carriertracking_cc (float loop_bw, + float max_freq, + float min_freq); /*! * \brief Implements a PLL which locks to the input frequency and outputs the * input signal mixed with that carrier. @@ -41,19 +44,20 @@ gr_pll_carriertracking_cc_sptr gr_make_pll_carriertracking_cc (float alpha, floa * the input and outputs that signal, downconverted to DC * * All settings max_freq and min_freq are in terms of radians per sample, - * NOT HERTZ. Alpha is the phase gain (first order, units of radians per radian) - * and beta is the frequency gain (second order, units of radians per sample per radian) + * NOT HERTZ. The loop bandwidth determins the lock range and should be set + * around pi/200 -- 2pi/100. * \sa gr_pll_freqdet_cf, gr_pll_carriertracking_cc */ -class gr_pll_carriertracking_cc : public gr_sync_block +class GR_CORE_API gr_pll_carriertracking_cc : public gr_sync_block, public gri_control_loop { - friend gr_pll_carriertracking_cc_sptr gr_make_pll_carriertracking_cc (float alpha, float beta, - float max_freq, float min_freq); + friend GR_CORE_API gr_pll_carriertracking_cc_sptr gr_make_pll_carriertracking_cc (float loop_bw, + float max_freq, + float min_freq); - float d_alpha,d_beta,d_max_freq,d_min_freq,d_phase,d_freq,d_locksig,d_lock_threshold; + float d_locksig,d_lock_threshold; bool d_squelch_enable; - gr_pll_carriertracking_cc (float alpha, float beta, float max_freq, float min_freq); + gr_pll_carriertracking_cc (float loop_bw, float max_freq, float min_freq); int work (int noutput_items, gr_vector_const_void_star &input_items, diff --git a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.i b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.i index 3e84fccbe..d309111b2 100644 --- a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.i +++ b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005 Free Software Foundation, Inc. + * Copyright 2005,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,13 +23,14 @@ GR_SWIG_BLOCK_MAGIC(gr,pll_carriertracking_cc); gr_pll_carriertracking_cc_sptr -gr_make_pll_carriertracking_cc (float alpha, float beta, - float max_freq, float min_freq); +gr_make_pll_carriertracking_cc (float loop_bw, + float max_freq, + float min_freq); -class gr_pll_carriertracking_cc : public gr_sync_block +class gr_pll_carriertracking_cc : public gr_sync_block, public gri_control_loop { private: - gr_pll_carriertracking_cc (float alpha, float beta, float max_freq, float min_freq); + gr_pll_carriertracking_cc (float loop_bw, float max_freq, float min_freq); public: bool lock_detector(void); bool squelch_enable(bool); diff --git a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc index 997ba4042..aa0d67855 100644 --- a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc +++ b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2010 Free Software Foundation, Inc. + * Copyright 2004,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,8 +20,6 @@ * Boston, MA 02110-1301, USA. */ -// WARNING: this file is machine generated. Edits will be over written - #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -31,21 +29,21 @@ #include <math.h> #include <gr_math.h> -#define M_TWOPI (2*M_PI) +#ifndef M_TWOPI +#define M_TWOPI (2.0f*M_PI) +#endif gr_pll_freqdet_cf_sptr -gr_make_pll_freqdet_cf (float alpha, float beta, float max_freq, float min_freq) +gr_make_pll_freqdet_cf (float loop_bw, float max_freq, float min_freq) { - return gnuradio::get_initial_sptr(new gr_pll_freqdet_cf (alpha, beta, max_freq, min_freq)); + return gnuradio::get_initial_sptr(new gr_pll_freqdet_cf (loop_bw, max_freq, min_freq)); } -gr_pll_freqdet_cf::gr_pll_freqdet_cf (float alpha, float beta, float max_freq, float min_freq) +gr_pll_freqdet_cf::gr_pll_freqdet_cf (float loop_bw, float max_freq, float min_freq) : gr_sync_block ("pll_freqdet_cf", gr_make_io_signature (1, 1, sizeof (gr_complex)), gr_make_io_signature (1, 1, sizeof (float))), - d_alpha(alpha), d_beta(beta), - d_max_freq(max_freq), d_min_freq(min_freq), - d_phase(0), d_freq((max_freq+min_freq)/2) + gri_control_loop(loop_bw, max_freq, min_freq) { } @@ -70,8 +68,8 @@ gr_pll_freqdet_cf::phase_detector(gr_complex sample,float ref_phase) int gr_pll_freqdet_cf::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) { const gr_complex *iptr = (gr_complex *) input_items[0]; float *optr = (float *) output_items[0]; @@ -84,13 +82,9 @@ gr_pll_freqdet_cf::work (int noutput_items, error = phase_detector(*iptr++,d_phase); - d_freq = d_freq + d_beta * error; - d_phase = mod_2pi(d_phase + d_freq + d_alpha * error); - - if (d_freq > d_max_freq) - d_freq = d_max_freq; - else if (d_freq < d_min_freq) - d_freq = d_min_freq; + advance_loop(error); + phase_wrap(); + frequency_limit(); } return noutput_items; } diff --git a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.h b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.h index 0581c8724..336f3fd31 100644 --- a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.h +++ b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,13 +23,16 @@ #ifndef INCLUDED_GR_PLL_FREQDET_CF_H #define INCLUDED_GR_PLL_FREQDET_CF_H +#include <gr_core_api.h> #include <gr_sync_block.h> +#include <gri_control_loop.h> class gr_pll_freqdet_cf; typedef boost::shared_ptr<gr_pll_freqdet_cf> gr_pll_freqdet_cf_sptr; -gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float alpha, float beta, - float max_freq, float min_freq); +GR_CORE_API gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float loop_bw, + float max_freq, + float min_freq); /*! * \brief Implements a PLL which locks to the input frequency and outputs * an estimate of that frequency. Useful for FM Demod. @@ -40,24 +43,24 @@ gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float alpha, float beta, * This PLL locks onto a [possibly noisy] reference carrier on * the input and outputs an estimate of that frequency in radians per sample. * All settings max_freq and min_freq are in terms of radians per sample, - * NOT HERTZ. Alpha is the phase gain (first order, units of radians per radian) - * and beta is the frequency gain (second order, units of radians per sample per radian) + * NOT HERTZ. The loop bandwidth determins the lock range and should be set + * around pi/200 -- 2pi/100. * \sa gr_pll_refout_cc, gr_pll_carriertracking_cc */ -class gr_pll_freqdet_cf : public gr_sync_block +class GR_CORE_API gr_pll_freqdet_cf : public gr_sync_block, public gri_control_loop { - friend gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float alpha, float beta, - float max_freq, float min_freq); + friend GR_CORE_API gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float loop_bw, + float max_freq, + float min_freq); - float d_alpha,d_beta,d_max_freq,d_min_freq,d_phase,d_freq; - gr_pll_freqdet_cf (float alpha, float beta, float max_freq, float min_freq); + float mod_2pi (float in); + gr_pll_freqdet_cf (float loop_bw, float max_freq, float min_freq); int work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); private: - float mod_2pi (float in); float phase_detector(gr_complex sample,float ref_phase); }; diff --git a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.i b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.i index b730f037a..f93e6e37e 100644 --- a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.i +++ b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005 Free Software Foundation, Inc. + * Copyright 2005,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -22,11 +22,12 @@ GR_SWIG_BLOCK_MAGIC(gr,pll_freqdet_cf) - gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float alpha, float beta, - float max_freq, float min_freq); + gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float loop_bw, + float max_freq, + float min_freq); -class gr_pll_freqdet_cf : public gr_sync_block +class gr_pll_freqdet_cf : public gr_sync_block, public gri_control_loop { private: - gr_pll_freqdet_cf (float alpha, float beta, float max_freq, float min_freq); + gr_pll_freqdet_cf (float loop_bw, float max_freq, float min_freq); }; diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc b/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc index d01f28e45..dfd5079da 100644 --- a/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc +++ b/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2010 Free Software Foundation, Inc. + * Copyright 2004,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,8 +20,6 @@ * Boston, MA 02110-1301, USA. */ -// WARNING: this file is machine generated. Edits will be over written - #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -32,21 +30,21 @@ #include <math.h> #include <gr_math.h> -#define M_TWOPI (2*M_PI) +#ifndef M_TWOPI +#define M_TWOPI (2.0f*M_PI) +#endif gr_pll_refout_cc_sptr -gr_make_pll_refout_cc (float alpha, float beta, float max_freq, float min_freq) +gr_make_pll_refout_cc (float loop_bw, float max_freq, float min_freq) { - return gnuradio::get_initial_sptr(new gr_pll_refout_cc (alpha, beta, max_freq, min_freq)); + return gnuradio::get_initial_sptr(new gr_pll_refout_cc (loop_bw, max_freq, min_freq)); } -gr_pll_refout_cc::gr_pll_refout_cc (float alpha, float beta, float max_freq, float min_freq) +gr_pll_refout_cc::gr_pll_refout_cc (float loop_bw, float max_freq, float min_freq) : gr_sync_block ("pll_refout_cc", gr_make_io_signature (1, 1, sizeof (gr_complex)), gr_make_io_signature (1, 1, sizeof (gr_complex))), - d_alpha(alpha), d_beta(beta), - d_max_freq(max_freq), d_min_freq(min_freq), - d_phase(0), d_freq((max_freq+min_freq)/2) + gri_control_loop(loop_bw, max_freq, min_freq) { } @@ -87,13 +85,9 @@ gr_pll_refout_cc::work (int noutput_items, error = phase_detector(*iptr++,d_phase); - d_freq = d_freq + d_beta * error; - d_phase = mod_2pi(d_phase + d_freq + d_alpha * error); - - if (d_freq > d_max_freq) - d_freq = d_max_freq; - else if (d_freq < d_min_freq) - d_freq = d_min_freq; + advance_loop(error); + phase_wrap(); + frequency_limit(); } return noutput_items; } diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.h b/gnuradio-core/src/lib/general/gr_pll_refout_cc.h index 3263c957f..dcbeb1efa 100644 --- a/gnuradio-core/src/lib/general/gr_pll_refout_cc.h +++ b/gnuradio-core/src/lib/general/gr_pll_refout_cc.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,18 +20,18 @@ * Boston, MA 02110-1301, USA. */ - - #ifndef INCLUDED_GR_PLL_REFOUT_CC_H #define INCLUDED_GR_PLL_REFOUT_CC_H +#include <gr_core_api.h> #include <gr_sync_block.h> +#include <gri_control_loop.h> class gr_pll_refout_cc; typedef boost::shared_ptr<gr_pll_refout_cc> gr_pll_refout_cc_sptr; -gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float alpha, float beta, - float max_freq, float min_freq); +GR_CORE_API gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw, + float max_freq, float min_freq); /*! * \brief Implements a PLL which locks to the input frequency and outputs a carrier * \ingroup sync_blk @@ -43,24 +43,23 @@ gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float alpha, float beta, * aligned to it. * * All settings max_freq and min_freq are in terms of radians per sample, - * NOT HERTZ. Alpha is the phase gain (first order, units of radians per radian) - * and beta is the frequency gain (second order, units of radians per sample per radian) + * NOT HERTZ. The loop bandwidth determins the lock range and should be set + * around pi/200 -- 2pi/100. * \sa gr_pll_freqdet_cf, gr_pll_carriertracking_cc */ -class gr_pll_refout_cc : public gr_sync_block +class GR_CORE_API gr_pll_refout_cc : public gr_sync_block, public gri_control_loop { - friend gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float alpha, float beta, - float max_freq, float min_freq); + friend GR_CORE_API gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw, + float max_freq, float min_freq); - float d_alpha,d_beta,d_max_freq,d_min_freq,d_phase,d_freq; - gr_pll_refout_cc (float alpha, float beta, float max_freq, float min_freq); + gr_pll_refout_cc (float loop_bw, float max_freq, float min_freq); int work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); private: float mod_2pi (float in); - float phase_detector(gr_complex sample,float ref_phase); + float phase_detector(gr_complex sample, float ref_phase); }; #endif diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.i b/gnuradio-core/src/lib/general/gr_pll_refout_cc.i index 026a684ed..834ea1e36 100644 --- a/gnuradio-core/src/lib/general/gr_pll_refout_cc.i +++ b/gnuradio-core/src/lib/general/gr_pll_refout_cc.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005 Free Software Foundation, Inc. + * Copyright 2005,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -22,11 +22,11 @@ GR_SWIG_BLOCK_MAGIC(gr,pll_refout_cc) - gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float alpha, float beta, - float max_freq, float min_freq); +gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw, + float max_freq, float min_freq); -class gr_pll_refout_cc : public gr_sync_block +class gr_pll_refout_cc : public gr_sync_block, public gri_control_loop { private: - gr_pll_refout_cc (float alpha, float beta, float max_freq, float min_freq); + gr_pll_refout_cc (float loop_bw, float max_freq, float min_freq); }; diff --git a/gnuradio-core/src/lib/general/gr_pn_correlator_cc.h b/gnuradio-core/src/lib/general/gr_pn_correlator_cc.h index 73bb7aa8c..75e2d1c7b 100644 --- a/gnuradio-core/src/lib/general/gr_pn_correlator_cc.h +++ b/gnuradio-core/src/lib/general/gr_pn_correlator_cc.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_PN_CORRELATOR_CC_H #define INCLUDED_GR_PN_CORRELATOR_CC_H +#include <gr_core_api.h> #include <gr_sync_decimator.h> #include <gri_glfsr.h> class gr_pn_correlator_cc; typedef boost::shared_ptr<gr_pn_correlator_cc> gr_pn_correlator_cc_sptr; -gr_pn_correlator_cc_sptr +GR_CORE_API gr_pn_correlator_cc_sptr gr_make_pn_correlator_cc(int degree, int mask=0, int seed=1); /*! * \brief PN code sequential search correlator @@ -39,9 +40,9 @@ gr_make_pn_correlator_cc(int degree, int mask=0, int seed=1); * reference PN code, one sample per PN code period */ -class gr_pn_correlator_cc : public gr_sync_decimator +class GR_CORE_API gr_pn_correlator_cc : public gr_sync_decimator { - friend gr_pn_correlator_cc_sptr gr_make_pn_correlator_cc(int degree, int mask, int seed); + friend GR_CORE_API gr_pn_correlator_cc_sptr gr_make_pn_correlator_cc(int degree, int mask, int seed); int d_len; float d_pn; diff --git a/gnuradio-core/src/lib/general/gr_prefs.h b/gnuradio-core/src/lib/general/gr_prefs.h index 4396d727c..8ceb5b465 100644 --- a/gnuradio-core/src/lib/general/gr_prefs.h +++ b/gnuradio-core/src/lib/general/gr_prefs.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_PREFS_H #define INCLUDED_GR_PREFS_H +#include <gr_core_api.h> #include <string> /*! @@ -32,7 +33,7 @@ * via the magic of SWIG directors. */ -class gr_prefs +class GR_CORE_API gr_prefs { public: static gr_prefs *singleton(); diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.h b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.h index ee8872010..e857686a8 100644 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.h +++ b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_GR_PROBE_AVG_MAG_SQRD_C_H #define INCLUDED_GR_PROBE_AVG_MAG_SQRD_C_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_single_pole_iir.h> class gr_probe_avg_mag_sqrd_c; typedef boost::shared_ptr<gr_probe_avg_mag_sqrd_c> gr_probe_avg_mag_sqrd_c_sptr; -gr_probe_avg_mag_sqrd_c_sptr +GR_CORE_API gr_probe_avg_mag_sqrd_c_sptr gr_make_probe_avg_mag_sqrd_c (double threshold_db, double alpha = 0.0001); /*! @@ -41,14 +42,14 @@ gr_make_probe_avg_mag_sqrd_c (double threshold_db, double alpha = 0.0001); * The level and indication as to whether the level exceeds threshold * can be retrieved with the level and unmuted accessors. */ -class gr_probe_avg_mag_sqrd_c : public gr_sync_block +class GR_CORE_API gr_probe_avg_mag_sqrd_c : public gr_sync_block { double d_threshold; gr_single_pole_iir<double,double,double> d_iir; bool d_unmuted; double d_level; - friend gr_probe_avg_mag_sqrd_c_sptr + friend GR_CORE_API gr_probe_avg_mag_sqrd_c_sptr gr_make_probe_avg_mag_sqrd_c (double threshold_db, double alpha); gr_probe_avg_mag_sqrd_c (double threshold_db, double alpha); diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.h b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.h index 6c536ca5b..a85afcf3b 100644 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.h +++ b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_GR_PROBE_AVG_MAG_SQRD_CF_H #define INCLUDED_GR_PROBE_AVG_MAG_SQRD_CF_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_single_pole_iir.h> class gr_probe_avg_mag_sqrd_cf; typedef boost::shared_ptr<gr_probe_avg_mag_sqrd_cf> gr_probe_avg_mag_sqrd_cf_sptr; -gr_probe_avg_mag_sqrd_cf_sptr +GR_CORE_API gr_probe_avg_mag_sqrd_cf_sptr gr_make_probe_avg_mag_sqrd_cf (double threshold_db, double alpha = 0.0001); /*! @@ -43,14 +44,14 @@ gr_make_probe_avg_mag_sqrd_cf (double threshold_db, double alpha = 0.0001); * can be retrieved with the level and unmuted accessors. * */ -class gr_probe_avg_mag_sqrd_cf : public gr_sync_block +class GR_CORE_API gr_probe_avg_mag_sqrd_cf : public gr_sync_block { double d_threshold; gr_single_pole_iir<double,double,double> d_iir; bool d_unmuted; double d_level; - friend gr_probe_avg_mag_sqrd_cf_sptr + friend GR_CORE_API gr_probe_avg_mag_sqrd_cf_sptr gr_make_probe_avg_mag_sqrd_cf (double threshold_db, double alpha); gr_probe_avg_mag_sqrd_cf (double threshold_db, double alpha); diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.h b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.h index b31e54f6b..4181ccf46 100644 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.h +++ b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_GR_PROBE_AVG_MAG_SQRD_F_H #define INCLUDED_GR_PROBE_AVG_MAG_SQRD_F_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_single_pole_iir.h> class gr_probe_avg_mag_sqrd_f; typedef boost::shared_ptr<gr_probe_avg_mag_sqrd_f> gr_probe_avg_mag_sqrd_f_sptr; -gr_probe_avg_mag_sqrd_f_sptr +GR_CORE_API gr_probe_avg_mag_sqrd_f_sptr gr_make_probe_avg_mag_sqrd_f (double threshold_db, double alpha = 0.0001); /*! @@ -41,14 +42,14 @@ gr_make_probe_avg_mag_sqrd_f (double threshold_db, double alpha = 0.0001); * The level and indication as to whether the level exceeds threshold * can be retrieved with the level and unmuted accessors. */ -class gr_probe_avg_mag_sqrd_f : public gr_sync_block +class GR_CORE_API gr_probe_avg_mag_sqrd_f : public gr_sync_block { double d_threshold; gr_single_pole_iir<double,double,double> d_iir; bool d_unmuted; double d_level; - friend gr_probe_avg_mag_sqrd_f_sptr + friend GR_CORE_API gr_probe_avg_mag_sqrd_f_sptr gr_make_probe_avg_mag_sqrd_f (double threshold_db, double alpha); gr_probe_avg_mag_sqrd_f (double threshold_db, double alpha); diff --git a/gnuradio-core/src/lib/general/gr_probe_density_b.h b/gnuradio-core/src/lib/general/gr_probe_density_b.h index 92b98d193..0af30c665 100644 --- a/gnuradio-core/src/lib/general/gr_probe_density_b.h +++ b/gnuradio-core/src/lib/general/gr_probe_density_b.h @@ -20,13 +20,14 @@ #ifndef INCLUDED_GR_PROBE_DENSITY_B_H #define INCLUDED_GR_PROBE_DENSITY_B_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_probe_density_b; typedef boost::shared_ptr<gr_probe_density_b> gr_probe_density_b_sptr; -gr_probe_density_b_sptr gr_make_probe_density_b(double alpha); +GR_CORE_API gr_probe_density_b_sptr gr_make_probe_density_b(double alpha); /*! * This block maintains a running average of the input stream and @@ -40,10 +41,10 @@ gr_probe_density_b_sptr gr_make_probe_density_b(double alpha); * */ -class gr_probe_density_b : public gr_sync_block +class GR_CORE_API gr_probe_density_b : public gr_sync_block { private: - friend gr_probe_density_b_sptr gr_make_probe_density_b(double alpha); + friend GR_CORE_API gr_probe_density_b_sptr gr_make_probe_density_b(double alpha); double d_alpha; double d_beta; diff --git a/gnuradio-core/src/lib/general/gr_probe_mpsk_snr_c.h b/gnuradio-core/src/lib/general/gr_probe_mpsk_snr_c.h index 279a4a5b8..870e46701 100644 --- a/gnuradio-core/src/lib/general/gr_probe_mpsk_snr_c.h +++ b/gnuradio-core/src/lib/general/gr_probe_mpsk_snr_c.h @@ -22,12 +22,13 @@ #ifndef INCLUDED_GR_PROBE_MPSK_SNR_C_H #define INCLUDED_GR_PROBE_MPSK_SNR_C_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_probe_mpsk_snr_c; typedef boost::shared_ptr<gr_probe_mpsk_snr_c> gr_probe_mpsk_snr_c_sptr; -gr_probe_mpsk_snr_c_sptr +GR_CORE_API gr_probe_mpsk_snr_c_sptr gr_make_probe_mpsk_snr_c(double alpha = 0.0001); /*! @@ -46,7 +47,7 @@ gr_make_probe_mpsk_snr_c(double alpha = 0.0001); * This SNR estimator is inaccurate below about 7dB SNR. * */ -class gr_probe_mpsk_snr_c : public gr_sync_block +class GR_CORE_API gr_probe_mpsk_snr_c : public gr_sync_block { double d_alpha; double d_beta; @@ -54,7 +55,7 @@ class gr_probe_mpsk_snr_c : public gr_sync_block double d_noise_variance; // Factory function returning shared pointer of this class - friend gr_probe_mpsk_snr_c_sptr + friend GR_CORE_API gr_probe_mpsk_snr_c_sptr gr_make_probe_mpsk_snr_c(double alpha); // Private constructor diff --git a/gnuradio-core/src/lib/general/gr_probe_signal_f.h b/gnuradio-core/src/lib/general/gr_probe_signal_f.h index 9605bb685..b99c76976 100644 --- a/gnuradio-core/src/lib/general/gr_probe_signal_f.h +++ b/gnuradio-core/src/lib/general/gr_probe_signal_f.h @@ -22,23 +22,24 @@ #ifndef INCLUDED_GR_PROBE_SIGNAL_F_H #define INCLUDED_GR_PROBE_SIGNAL_F_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_probe_signal_f; typedef boost::shared_ptr<gr_probe_signal_f> gr_probe_signal_f_sptr; -gr_probe_signal_f_sptr +GR_CORE_API gr_probe_signal_f_sptr gr_make_probe_signal_f (); /*! * \brief Sink that allows a sample to be grabbed from Python. * \ingroup sink_blk */ -class gr_probe_signal_f : public gr_sync_block +class GR_CORE_API gr_probe_signal_f : public gr_sync_block { float d_level; - friend gr_probe_signal_f_sptr + friend GR_CORE_API gr_probe_signal_f_sptr gr_make_probe_signal_f(); gr_probe_signal_f(); diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.h b/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.h index 9c519f383..2a008d92d 100644 --- a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.h +++ b/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_PWR_SQUELCH_CC_H #define INCLUDED_GR_PWR_SQUELCH_CC_H +#include <gr_core_api.h> #include <cmath> #include <gr_squelch_base_cc.h> #include <gr_single_pole_iir.h> @@ -30,21 +31,21 @@ class gr_pwr_squelch_cc; typedef boost::shared_ptr<gr_pwr_squelch_cc> gr_pwr_squelch_cc_sptr; -gr_pwr_squelch_cc_sptr +GR_CORE_API gr_pwr_squelch_cc_sptr gr_make_pwr_squelch_cc(double db, double alpha = 0.0001, int ramp=0, bool gate=false); /*! * \brief gate or zero output when input power below threshold * \ingroup level_blk */ -class gr_pwr_squelch_cc : public gr_squelch_base_cc +class GR_CORE_API gr_pwr_squelch_cc : public gr_squelch_base_cc { private: double d_threshold; double d_pwr; gr_single_pole_iir<double,double,double> d_iir; - friend gr_pwr_squelch_cc_sptr gr_make_pwr_squelch_cc(double db, double alpha, int ramp, bool gate); + friend GR_CORE_API gr_pwr_squelch_cc_sptr gr_make_pwr_squelch_cc(double db, double alpha, int ramp, bool gate); gr_pwr_squelch_cc(double db, double alpha, int ramp, bool gate); protected: diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.h b/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.h index 6952dbce2..27a7306b3 100644 --- a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.h +++ b/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_PWR_SQUELCH_FF_H #define INCLUDED_GR_PWR_SQUELCH_FF_H +#include <gr_core_api.h> #include <cmath> #include <gr_squelch_base_ff.h> #include <gr_single_pole_iir.h> @@ -30,21 +31,21 @@ class gr_pwr_squelch_ff; typedef boost::shared_ptr<gr_pwr_squelch_ff> gr_pwr_squelch_ff_sptr; -gr_pwr_squelch_ff_sptr +GR_CORE_API gr_pwr_squelch_ff_sptr gr_make_pwr_squelch_ff(double db, double alpha = 0.0001, int ramp=0, bool gate=false); /*! * \brief gate or zero output when input power below threshold * \ingroup level_blk */ -class gr_pwr_squelch_ff : public gr_squelch_base_ff +class GR_CORE_API gr_pwr_squelch_ff : public gr_squelch_base_ff { private: double d_threshold; double d_pwr; gr_single_pole_iir<double,double,double> d_iir; - friend gr_pwr_squelch_ff_sptr gr_make_pwr_squelch_ff(double db, double alpha, int ramp, bool gate); + friend GR_CORE_API gr_pwr_squelch_ff_sptr gr_make_pwr_squelch_ff(double db, double alpha, int ramp, bool gate); gr_pwr_squelch_ff(double db, double alpha, int ramp, bool gate); protected: diff --git a/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.h b/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.h index df6de93d5..755f2839a 100644 --- a/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.h +++ b/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.h @@ -23,11 +23,12 @@ #ifndef INCLUDED_GR_QUADRATURE_DEMOD_CF_H #define INCLUDED_GR_QUADRATURE_DEMOD_CF_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_quadrature_demod_cf; typedef boost::shared_ptr<gr_quadrature_demod_cf> gr_quadrature_demod_cf_sptr; -gr_quadrature_demod_cf_sptr gr_make_quadrature_demod_cf (float gain); +GR_CORE_API gr_quadrature_demod_cf_sptr gr_make_quadrature_demod_cf (float gain); /*! * \brief quadrature demodulator: complex in, float out @@ -36,9 +37,9 @@ gr_quadrature_demod_cf_sptr gr_make_quadrature_demod_cf (float gain); * This can be used to demod FM, FSK, GMSK, etc. * The input is complex baseband. */ -class gr_quadrature_demod_cf : public gr_sync_block +class GR_CORE_API gr_quadrature_demod_cf : public gr_sync_block { - friend gr_quadrature_demod_cf_sptr gr_make_quadrature_demod_cf (float gain); + friend GR_CORE_API gr_quadrature_demod_cf_sptr gr_make_quadrature_demod_cf (float gain); gr_quadrature_demod_cf (float gain); float d_gain; diff --git a/gnuradio-core/src/lib/general/gr_rail_ff.h b/gnuradio-core/src/lib/general/gr_rail_ff.h index d9e19a964..225bdf36e 100644 --- a/gnuradio-core/src/lib/general/gr_rail_ff.h +++ b/gnuradio-core/src/lib/general/gr_rail_ff.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_RAIL_FF_H_ # define INCLUDED_GR_RAIL_FF_H_ +#include <gr_core_api.h> #include <gr_sync_block.h> /*! @@ -33,11 +34,11 @@ class gr_rail_ff; typedef boost::shared_ptr<gr_rail_ff> gr_rail_ff_sptr; -gr_rail_ff_sptr gr_make_rail_ff(float lo, float hi); +GR_CORE_API gr_rail_ff_sptr gr_make_rail_ff(float lo, float hi); -class gr_rail_ff : public gr_sync_block +class GR_CORE_API gr_rail_ff : public gr_sync_block { - friend gr_rail_ff_sptr gr_make_rail_ff (float lo, float hi); + friend GR_CORE_API gr_rail_ff_sptr gr_make_rail_ff (float lo, float hi); float d_lo, d_hi; // the constant gr_rail_ff(float lo, float hi); diff --git a/gnuradio-core/src/lib/general/gr_random.h b/gnuradio-core/src/lib/general/gr_random.h index e5002fd33..13dbbfb04 100644 --- a/gnuradio-core/src/lib/general/gr_random.h +++ b/gnuradio-core/src/lib/general/gr_random.h @@ -23,13 +23,14 @@ #ifndef INCLUDED_GR_RANDOM_H #define INCLUDED_GR_RANDOM_H +#include <gr_core_api.h> #include <gr_complex.h> /*! * \brief pseudo random number generator * \ingroup math_blk */ -class gr_random { +class GR_CORE_API gr_random { protected: static const int NTAB = 32; long d_seed; diff --git a/gnuradio-core/src/lib/general/gr_regenerate_bb.h b/gnuradio-core/src/lib/general/gr_regenerate_bb.h index db511b228..67cfedac7 100644 --- a/gnuradio-core/src/lib/general/gr_regenerate_bb.h +++ b/gnuradio-core/src/lib/general/gr_regenerate_bb.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_REGENERATE_BB_H #define INCLUDED_GR_REGENERATE_BB_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_regenerate_bb; typedef boost::shared_ptr<gr_regenerate_bb> gr_regenerate_bb_sptr; -gr_regenerate_bb_sptr gr_make_regenerate_bb (int period, unsigned int max_regen=500); +GR_CORE_API gr_regenerate_bb_sptr gr_make_regenerate_bb (int period, unsigned int max_regen=500); /*! * \brief Detect the peak of a signal and repeat every period samples @@ -40,7 +41,7 @@ gr_regenerate_bb_sptr gr_make_regenerate_bb (int period, unsigned int max_regen= * * Note that if max_regen=(-1)/ULONG_MAX then the regeneration will run forever. */ -class gr_regenerate_bb : public gr_sync_block +class GR_CORE_API gr_regenerate_bb : public gr_sync_block { /*! * \brief Make a regenerate block @@ -48,7 +49,7 @@ class gr_regenerate_bb : public gr_sync_block * \param max_regen The maximum number of regenerations to perform; if set to * ULONG_MAX, it will regenerate continuously. */ - friend gr_regenerate_bb_sptr gr_make_regenerate_bb (int period, unsigned int max_regen); + friend GR_CORE_API gr_regenerate_bb_sptr gr_make_regenerate_bb (int period, unsigned int max_regen); gr_regenerate_bb (int period, unsigned int max_regen); diff --git a/gnuradio-core/src/lib/general/gr_remez.h b/gnuradio-core/src/lib/general/gr_remez.h index 85e1516a5..f7b8a72a3 100644 --- a/gnuradio-core/src/lib/general/gr_remez.h +++ b/gnuradio-core/src/lib/general/gr_remez.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_REMEZ_H #define INCLUDED_GR_REMEZ_H +#include <gr_core_api.h> #include <gr_types.h> #include <string> #include <stdexcept> @@ -51,7 +52,7 @@ * \throws std::runtime_error if args are invalid or calculation fails to converge. */ -std::vector<double> +GR_CORE_API std::vector<double> gr_remez (int order, const std::vector<double> &bands, const std::vector<double> &l, diff --git a/gnuradio-core/src/lib/general/gr_repeat.h b/gnuradio-core/src/lib/general/gr_repeat.h index f323fc375..b90f2f51d 100644 --- a/gnuradio-core/src/lib/general/gr_repeat.h +++ b/gnuradio-core/src/lib/general/gr_repeat.h @@ -22,23 +22,24 @@ #ifndef INCLUDED_GR_REPEAT_H #define INCLUDED_GR_REPEAT_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_repeat; typedef boost::shared_ptr<gr_repeat> gr_repeat_sptr; -gr_repeat_sptr gr_make_repeat(size_t itemsize, int interp); +GR_CORE_API gr_repeat_sptr gr_make_repeat(size_t itemsize, int interp); /*! * \brief Repeat a sample 'interp' times in output stream * \ingroup misc_blk */ -class gr_repeat : public gr_sync_interpolator +class GR_CORE_API gr_repeat : public gr_sync_interpolator { private: - friend gr_repeat_sptr gr_make_repeat(size_t itemsize, int interp); + friend GR_CORE_API gr_repeat_sptr gr_make_repeat(size_t itemsize, int interp); gr_repeat(size_t itemsize, int interp); diff --git a/gnuradio-core/src/lib/general/gr_reverse.h b/gnuradio-core/src/lib/general/gr_reverse.h index d79d34e91..43d84fda7 100644 --- a/gnuradio-core/src/lib/general/gr_reverse.h +++ b/gnuradio-core/src/lib/general/gr_reverse.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_REVERSE_H #define INCLUDED_GR_REVERSE_H +#include <gr_core_api.h> #include <vector> #include <gr_complex.h> diff --git a/gnuradio-core/src/lib/general/gr_rms_cf.h b/gnuradio-core/src/lib/general/gr_rms_cf.h index 86c4bdbac..f1bd9802c 100644 --- a/gnuradio-core/src/lib/general/gr_rms_cf.h +++ b/gnuradio-core/src/lib/general/gr_rms_cf.h @@ -22,25 +22,26 @@ #ifndef INCLUDED_GR_RMS_CF_H #define INCLUDED_GR_RMS_CF_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_single_pole_iir.h> class gr_rms_cf; typedef boost::shared_ptr<gr_rms_cf> gr_rms_cf_sptr; -gr_rms_cf_sptr +GR_CORE_API gr_rms_cf_sptr gr_make_rms_cf (double alpha = 0.0001); /*! * \brief RMS average power * \ingroup math_blk */ -class gr_rms_cf : public gr_sync_block +class GR_CORE_API gr_rms_cf : public gr_sync_block { gr_single_pole_iir<double,double,double> d_iir; bool d_unmuted; - friend gr_rms_cf_sptr + friend GR_CORE_API gr_rms_cf_sptr gr_make_rms_cf (double alpha); gr_rms_cf (double alpha); diff --git a/gnuradio-core/src/lib/general/gr_rms_ff.h b/gnuradio-core/src/lib/general/gr_rms_ff.h index ed1635eb1..0bbd53b70 100644 --- a/gnuradio-core/src/lib/general/gr_rms_ff.h +++ b/gnuradio-core/src/lib/general/gr_rms_ff.h @@ -22,25 +22,26 @@ #ifndef INCLUDED_GR_RMS_FF_H #define INCLUDED_GR_RMS_FF_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_single_pole_iir.h> class gr_rms_ff; typedef boost::shared_ptr<gr_rms_ff> gr_rms_ff_sptr; -gr_rms_ff_sptr +GR_CORE_API gr_rms_ff_sptr gr_make_rms_ff (double alpha = 0.0001); /*! * \brief RMS average power * \ingroup math_blk */ -class gr_rms_ff : public gr_sync_block +class GR_CORE_API gr_rms_ff : public gr_sync_block { gr_single_pole_iir<double,double,double> d_iir; bool d_unmuted; - friend gr_rms_ff_sptr + friend GR_CORE_API gr_rms_ff_sptr gr_make_rms_ff (double alpha); gr_rms_ff (double alpha); diff --git a/gnuradio-core/src/lib/general/gr_scrambler_bb.h b/gnuradio-core/src/lib/general/gr_scrambler_bb.h index 7efe8b598..79905933d 100644 --- a/gnuradio-core/src/lib/general/gr_scrambler_bb.h +++ b/gnuradio-core/src/lib/general/gr_scrambler_bb.h @@ -22,13 +22,14 @@ #ifndef INCLUDED_GR_SCRAMBLER_BB_H #define INCLUDED_GR_SCRAMBLER_BB_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include "gri_lfsr.h" class gr_scrambler_bb; typedef boost::shared_ptr<gr_scrambler_bb> gr_scrambler_bb_sptr; -gr_scrambler_bb_sptr gr_make_scrambler_bb(int mask, int seed, int len); +GR_CORE_API gr_scrambler_bb_sptr gr_make_scrambler_bb(int mask, int seed, int len); /*! * Scramble an input stream using an LFSR. This block works on the LSB only @@ -42,9 +43,9 @@ gr_scrambler_bb_sptr gr_make_scrambler_bb(int mask, int seed, int len); * \ingroup coding_blk */ -class gr_scrambler_bb : public gr_sync_block +class GR_CORE_API gr_scrambler_bb : public gr_sync_block { - friend gr_scrambler_bb_sptr gr_make_scrambler_bb(int mask, int seed, int len); + friend GR_CORE_API gr_scrambler_bb_sptr gr_make_scrambler_bb(int mask, int seed, int len); gri_lfsr d_lfsr; diff --git a/gnuradio-core/src/lib/general/gr_short_to_float.h b/gnuradio-core/src/lib/general/gr_short_to_float.h index ccb19d9f2..b40c966ea 100644 --- a/gnuradio-core/src/lib/general/gr_short_to_float.h +++ b/gnuradio-core/src/lib/general/gr_short_to_float.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_SHORT_TO_FLOAT_H #define INCLUDED_GR_SHORT_TO_FLOAT_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_short_to_float; typedef boost::shared_ptr<gr_short_to_float> gr_short_to_float_sptr; -gr_short_to_float_sptr +GR_CORE_API gr_short_to_float_sptr gr_make_short_to_float (); /*! @@ -36,9 +37,9 @@ gr_make_short_to_float (); * \ingroup converter_blk */ -class gr_short_to_float : public gr_sync_block +class GR_CORE_API gr_short_to_float : public gr_sync_block { - friend gr_short_to_float_sptr gr_make_short_to_float (); + friend GR_CORE_API gr_short_to_float_sptr gr_make_short_to_float (); gr_short_to_float (); public: diff --git a/gnuradio-core/src/lib/general/gr_simple_correlator.cc b/gnuradio-core/src/lib/general/gr_simple_correlator.cc index 01c007122..bdfa73ef3 100644 --- a/gnuradio-core/src/lib/general/gr_simple_correlator.cc +++ b/gnuradio-core/src/lib/general/gr_simple_correlator.cc @@ -50,6 +50,7 @@ gr_simple_correlator::gr_simple_correlator (int 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; @@ -71,6 +72,7 @@ gr_simple_correlator::~gr_simple_correlator () fclose(d_debug_fp); #endif delete [] d_bitbuf; + delete [] d_pktbuf; } @@ -184,10 +186,9 @@ gr_simple_correlator::general_work (int noutput_items, d_bbi++; if (d_bbi >= d_bblen){ // printf ("got whole packet\n"); - unsigned char pktbuf[d_bblen/GRSF_BITS_PER_BYTE]; - packit (pktbuf, d_bitbuf, d_bbi); - printf ("seqno %3d\n", pktbuf[0]); - memcpy (out, &pktbuf[GRSF_PAYLOAD_OVERHEAD], d_payload_bytesize); + 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; diff --git a/gnuradio-core/src/lib/general/gr_simple_correlator.h b/gnuradio-core/src/lib/general/gr_simple_correlator.h index b21d38a04..4c5f060cd 100644 --- a/gnuradio-core/src/lib/general/gr_simple_correlator.h +++ b/gnuradio-core/src/lib/general/gr_simple_correlator.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_SIMPLE_CORRELATOR_H #define INCLUDED_GR_SIMPLE_CORRELATOR_H +#include <gr_core_api.h> #include <gr_block.h> #include <assert.h> @@ -31,13 +32,13 @@ class gr_simple_correlator; typedef boost::shared_ptr<gr_simple_correlator> gr_simple_correlator_sptr; -gr_simple_correlator_sptr gr_make_simple_correlator (int payload_bytesize); +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_simple_correlator : public gr_block +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 }; @@ -50,6 +51,7 @@ class gr_simple_correlator : public gr_block 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) @@ -62,7 +64,7 @@ class gr_simple_correlator : public gr_block FILE *d_debug_fp; // binary log file #endif - friend gr_simple_correlator_sptr gr_make_simple_correlator (int payload_bytesize); + friend GR_CORE_API gr_simple_correlator_sptr gr_make_simple_correlator (int payload_bytesize); gr_simple_correlator (int payload_bytesize); diff --git a/gnuradio-core/src/lib/general/gr_simple_framer.h b/gnuradio-core/src/lib/general/gr_simple_framer.h index d930da33b..15f392e4a 100644 --- a/gnuradio-core/src/lib/general/gr_simple_framer.h +++ b/gnuradio-core/src/lib/general/gr_simple_framer.h @@ -23,25 +23,26 @@ #ifndef INCLUDED_GR_SIMPLE_FRAMER_H #define INCLUDED_GR_SIMPLE_FRAMER_H +#include <gr_core_api.h> #include <gr_block.h> class gr_simple_framer; typedef boost::shared_ptr<gr_simple_framer> gr_simple_framer_sptr; -gr_simple_framer_sptr gr_make_simple_framer (int payload_bytesize); +GR_CORE_API gr_simple_framer_sptr gr_make_simple_framer (int payload_bytesize); /*! * \brief add sync field, seq number and command field to payload * \ingroup sync_blk */ -class gr_simple_framer : public gr_block +class GR_CORE_API gr_simple_framer : public gr_block { int d_seqno; int d_payload_bytesize; int d_input_block_size; // bytes int d_output_block_size; // bytes - friend gr_simple_framer_sptr gr_make_simple_framer (int payload_bytesize); + friend GR_CORE_API gr_simple_framer_sptr gr_make_simple_framer (int payload_bytesize); gr_simple_framer (int payload_bytesize); public: diff --git a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.h b/gnuradio-core/src/lib/general/gr_simple_squelch_cc.h index 30744f6fb..590b86de8 100644 --- a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.h +++ b/gnuradio-core/src/lib/general/gr_simple_squelch_cc.h @@ -22,26 +22,27 @@ #ifndef INCLUDED_GR_SIMPLE_SQUELCH_CC_H #define INCLUDED_GR_SIMPLE_SQUELCH_CC_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_single_pole_iir.h> class gr_simple_squelch_cc; typedef boost::shared_ptr<gr_simple_squelch_cc> gr_simple_squelch_cc_sptr; -gr_simple_squelch_cc_sptr +GR_CORE_API gr_simple_squelch_cc_sptr gr_make_simple_squelch_cc (double threshold_db, double alpha = 0.0001); /*! * \brief simple squelch block based on average signal power and threshold in dB. * \ingroup level_blk */ -class gr_simple_squelch_cc : public gr_sync_block +class GR_CORE_API gr_simple_squelch_cc : public gr_sync_block { double d_threshold; gr_single_pole_iir<double,double,double> d_iir; bool d_unmuted; - friend gr_simple_squelch_cc_sptr + friend GR_CORE_API gr_simple_squelch_cc_sptr gr_make_simple_squelch_cc (double threshold_db, double alpha); gr_simple_squelch_cc (double threshold_db, double alpha); diff --git a/gnuradio-core/src/lib/general/gr_skiphead.h b/gnuradio-core/src/lib/general/gr_skiphead.h index 933c126e3..2beaaeab0 100644 --- a/gnuradio-core/src/lib/general/gr_skiphead.h +++ b/gnuradio-core/src/lib/general/gr_skiphead.h @@ -23,12 +23,16 @@ #ifndef INCLUDED_GR_SKIPHEAD_H #define INCLUDED_GR_SKIPHEAD_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <stddef.h> // size_t class gr_skiphead; typedef boost::shared_ptr<gr_skiphead> gr_skiphead_sptr; +GR_CORE_API gr_skiphead_sptr +gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip); + /*! * \brief skips the first N items, from then on copies items to the output @@ -37,9 +41,9 @@ typedef boost::shared_ptr<gr_skiphead> gr_skiphead_sptr; * Useful for building test cases and sources which have metadata or junk at the start */ -class gr_skiphead : public gr_block +class GR_CORE_API gr_skiphead : public gr_block { - friend gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip); + friend GR_CORE_API gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip); gr_skiphead (size_t itemsize, uint64_t nitems_to_skip); uint64_t d_nitems_to_skip; @@ -53,8 +57,4 @@ class gr_skiphead : public gr_block gr_vector_void_star &output_items); }; -gr_skiphead_sptr -gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip); - - #endif /* INCLUDED_GR_SKIPHEAD_H */ diff --git a/gnuradio-core/src/lib/general/gr_squash_ff.h b/gnuradio-core/src/lib/general/gr_squash_ff.h index ee3426cae..f7fea1648 100644 --- a/gnuradio-core/src/lib/general/gr_squash_ff.h +++ b/gnuradio-core/src/lib/general/gr_squash_ff.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_SQUASH_FF_H_ # define INCLUDED_GR_SQUASH_FF_H_ +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gsl/gsl_errno.h> #include <gsl/gsl_interp.h> @@ -36,12 +37,12 @@ class gr_squash_ff; typedef boost::shared_ptr<gr_squash_ff> gr_squash_ff_sptr; -gr_squash_ff_sptr gr_make_squash_ff(const std::vector<float> &igrid, +GR_CORE_API gr_squash_ff_sptr gr_make_squash_ff(const std::vector<float> &igrid, const std::vector<float> &ogrid); -class gr_squash_ff : public gr_sync_block +class GR_CORE_API gr_squash_ff : public gr_sync_block { - friend gr_squash_ff_sptr gr_make_squash_ff(const std::vector<float> &igrid, + friend GR_CORE_API gr_squash_ff_sptr gr_make_squash_ff(const std::vector<float> &igrid, const std::vector<float> &ogrid); size_t d_inum; diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_cc.h b/gnuradio-core/src/lib/general/gr_squelch_base_cc.h index 51e2e14e5..7c15e0121 100644 --- a/gnuradio-core/src/lib/general/gr_squelch_base_cc.h +++ b/gnuradio-core/src/lib/general/gr_squelch_base_cc.h @@ -23,9 +23,10 @@ #ifndef INCLUDED_GR_SQUELCH_BASE_CC_H #define INCLUDED_GR_SQUELCH_BASE_CC_H +#include <gr_core_api.h> #include <gr_block.h> -class gr_squelch_base_cc : public gr_block +class GR_CORE_API gr_squelch_base_cc : public gr_block { private: int d_ramp; diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_ff.h b/gnuradio-core/src/lib/general/gr_squelch_base_ff.h index 2ca108c75..92a064e63 100644 --- a/gnuradio-core/src/lib/general/gr_squelch_base_ff.h +++ b/gnuradio-core/src/lib/general/gr_squelch_base_ff.h @@ -23,9 +23,10 @@ #ifndef INCLUDED_GR_SQUELCH_BASE_FF_H #define INCLUDED_GR_SQUELCH_BASE_FF_H +#include <gr_core_api.h> #include <gr_block.h> -class gr_squelch_base_ff : public gr_block +class GR_CORE_API gr_squelch_base_ff : public gr_block { private: int d_ramp; diff --git a/gnuradio-core/src/lib/general/gr_stream_mux.h b/gnuradio-core/src/lib/general/gr_stream_mux.h index 29829339e..68415ab1d 100644 --- a/gnuradio-core/src/lib/general/gr_stream_mux.h +++ b/gnuradio-core/src/lib/general/gr_stream_mux.h @@ -24,6 +24,7 @@ #define INCLUDED_GR_STREAM_MUX_H +#include <gr_core_api.h> #include <gr_block.h> #include <vector> @@ -45,7 +46,7 @@ typedef boost::shared_ptr<gr_stream_mux> gr_stream_mux_sptr; -gr_stream_mux_sptr +GR_CORE_API gr_stream_mux_sptr gr_make_stream_mux (size_t itemsize, const std::vector<int> &lengths); @@ -60,9 +61,9 @@ gr_make_stream_mux (size_t itemsize, const std::vector<int> &lengths); * [N0, N1, N2, ..., Nm, N0, N1, ...] */ -class gr_stream_mux : public gr_block +class GR_CORE_API gr_stream_mux : public gr_block { - friend gr_stream_mux_sptr + friend GR_CORE_API gr_stream_mux_sptr gr_make_stream_mux (size_t itemsize, const std::vector<int> &lengths); protected: diff --git a/gnuradio-core/src/lib/general/gr_stream_to_streams.h b/gnuradio-core/src/lib/general/gr_stream_to_streams.h index 2fdd39e4a..905d3c556 100644 --- a/gnuradio-core/src/lib/general/gr_stream_to_streams.h +++ b/gnuradio-core/src/lib/general/gr_stream_to_streams.h @@ -22,12 +22,13 @@ #ifndef INCLUDED_GR_STREAM_TO_STREAMS_H #define INCLUDED_GR_STREAM_TO_STREAMS_H +#include <gr_core_api.h> #include <gr_sync_decimator.h> class gr_stream_to_streams; typedef boost::shared_ptr<gr_stream_to_streams> gr_stream_to_streams_sptr; -gr_stream_to_streams_sptr +GR_CORE_API gr_stream_to_streams_sptr gr_make_stream_to_streams (size_t item_size, size_t nstreams); @@ -38,9 +39,9 @@ gr_make_stream_to_streams (size_t item_size, size_t nstreams); * Converts a stream of N items into N streams of 1 item. * Repeat ad infinitum. */ -class gr_stream_to_streams : public gr_sync_decimator +class GR_CORE_API gr_stream_to_streams : public gr_sync_decimator { - friend gr_stream_to_streams_sptr + friend GR_CORE_API gr_stream_to_streams_sptr gr_make_stream_to_streams (size_t item_size, size_t nstreams); protected: diff --git a/gnuradio-core/src/lib/general/gr_stream_to_vector.h b/gnuradio-core/src/lib/general/gr_stream_to_vector.h index 2cb03f6a8..77272b96b 100644 --- a/gnuradio-core/src/lib/general/gr_stream_to_vector.h +++ b/gnuradio-core/src/lib/general/gr_stream_to_vector.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_STREAM_TO_VECTOR_H #define INCLUDED_GR_STREAM_TO_VECTOR_H +#include <gr_core_api.h> #include <gr_sync_decimator.h> class gr_stream_to_vector; typedef boost::shared_ptr<gr_stream_to_vector> gr_stream_to_vector_sptr; -gr_stream_to_vector_sptr +GR_CORE_API gr_stream_to_vector_sptr gr_make_stream_to_vector (size_t item_size, size_t nitems_per_block); @@ -36,9 +37,9 @@ gr_make_stream_to_vector (size_t item_size, size_t nitems_per_block); * \brief convert a stream of items into a stream of blocks containing nitems_per_block * \ingroup slicedice_blk */ -class gr_stream_to_vector : public gr_sync_decimator +class GR_CORE_API gr_stream_to_vector : public gr_sync_decimator { - friend gr_stream_to_vector_sptr + friend GR_CORE_API gr_stream_to_vector_sptr gr_make_stream_to_vector (size_t item_size, size_t nitems_per_block); protected: diff --git a/gnuradio-core/src/lib/general/gr_streams_to_stream.h b/gnuradio-core/src/lib/general/gr_streams_to_stream.h index 044af6cd2..8207fed42 100644 --- a/gnuradio-core/src/lib/general/gr_streams_to_stream.h +++ b/gnuradio-core/src/lib/general/gr_streams_to_stream.h @@ -22,12 +22,13 @@ #ifndef INCLUDED_GR_STREAMS_TO_STREAM_H #define INCLUDED_GR_STREAMS_TO_STREAM_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_streams_to_stream; typedef boost::shared_ptr<gr_streams_to_stream> gr_streams_to_stream_sptr; -gr_streams_to_stream_sptr +GR_CORE_API gr_streams_to_stream_sptr gr_make_streams_to_stream (size_t item_size, size_t nstreams); @@ -38,9 +39,9 @@ gr_make_streams_to_stream (size_t item_size, size_t nstreams); * Convert N streams of 1 item into 1 stream of N items. * Repeat ad infinitum. */ -class gr_streams_to_stream : public gr_sync_interpolator +class GR_CORE_API gr_streams_to_stream : public gr_sync_interpolator { - friend gr_streams_to_stream_sptr + friend GR_CORE_API gr_streams_to_stream_sptr gr_make_streams_to_stream (size_t item_size, size_t nstreams); protected: diff --git a/gnuradio-core/src/lib/general/gr_streams_to_vector.h b/gnuradio-core/src/lib/general/gr_streams_to_vector.h index 1b2e3ebf7..6a05ac90a 100644 --- a/gnuradio-core/src/lib/general/gr_streams_to_vector.h +++ b/gnuradio-core/src/lib/general/gr_streams_to_vector.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_STREAMS_TO_VECTOR_H #define INCLUDED_GR_STREAMS_TO_VECTOR_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_streams_to_vector; typedef boost::shared_ptr<gr_streams_to_vector> gr_streams_to_vector_sptr; -gr_streams_to_vector_sptr +GR_CORE_API gr_streams_to_vector_sptr gr_make_streams_to_vector (size_t item_size, size_t nstreams); @@ -36,9 +37,9 @@ gr_make_streams_to_vector (size_t item_size, size_t nstreams); * \brief convert N streams of items to 1 stream of vector length N * \ingroup slicedice_blk */ -class gr_streams_to_vector : public gr_sync_block +class GR_CORE_API gr_streams_to_vector : public gr_sync_block { - friend gr_streams_to_vector_sptr + friend GR_CORE_API gr_streams_to_vector_sptr gr_make_streams_to_vector (size_t item_size, size_t nstreams); protected: diff --git a/gnuradio-core/src/lib/general/gr_stretch_ff.h b/gnuradio-core/src/lib/general/gr_stretch_ff.h index e75e1969f..578634dd8 100644 --- a/gnuradio-core/src/lib/general/gr_stretch_ff.h +++ b/gnuradio-core/src/lib/general/gr_stretch_ff.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_STRETCH_FF_H_ # define INCLUDED_GR_STRETCH_FF_H_ +#include <gr_core_api.h> #include <gr_sync_block.h> /*! @@ -36,11 +37,11 @@ class gr_stretch_ff; typedef boost::shared_ptr<gr_stretch_ff> gr_stretch_ff_sptr; -gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen); +GR_CORE_API gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen); -class gr_stretch_ff : public gr_sync_block +class GR_CORE_API gr_stretch_ff : public gr_sync_block { - friend gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen); + friend GR_CORE_API gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen); float d_lo; // the constant size_t d_vlen; diff --git a/gnuradio-core/src/lib/general/gr_test.h b/gnuradio-core/src/lib/general/gr_test.h index 5438ac701..78e39d518 100644 --- a/gnuradio-core/src/lib/general/gr_test.h +++ b/gnuradio-core/src/lib/general/gr_test.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GR_TEST_H #define INCLUDED_GR_TEST_H +#include <gr_core_api.h> #include <gr_block.h> #include <string> #include "gr_test_types.h" @@ -31,7 +32,7 @@ class gr_test; typedef boost::shared_ptr<gr_test> gr_test_sptr; // public constructor -gr_test_sptr gr_make_test (const std::string &name=std::string("gr_test"), +GR_CORE_API gr_test_sptr gr_make_test (const std::string &name=std::string("gr_test"), int min_inputs=1, int max_inputs=1, unsigned int sizeof_input_item=1, int min_outputs=1, int max_outputs=1, unsigned int sizeof_output_item=1, unsigned int history=1,unsigned int output_multiple=1,double relative_rate=1.0, @@ -50,7 +51,7 @@ gr_test_sptr gr_make_test (const std::string &name=std::string("gr_test"), * The runtime system should detect this and create large enough buffers * all through the signal chain. */ -class gr_test : public gr_block { +class GR_CORE_API gr_test : public gr_block { public: @@ -183,7 +184,7 @@ int general_work (int noutput_items, - friend gr_test_sptr gr_make_test (const std::string &name,int min_inputs, int max_inputs, unsigned int sizeof_input_item, + friend GR_CORE_API gr_test_sptr gr_make_test (const std::string &name,int min_inputs, int max_inputs, unsigned int sizeof_input_item, int min_outputs, int max_outputs, unsigned int sizeof_output_item, unsigned int history,unsigned int output_multiple,double relative_rate, bool fixed_rate,gr_consume_type_t cons_type, gr_produce_type_t prod_type); diff --git a/gnuradio-core/src/lib/general/gr_threshold_ff.h b/gnuradio-core/src/lib/general/gr_threshold_ff.h index 65b677a77..3bf3058cd 100644 --- a/gnuradio-core/src/lib/general/gr_threshold_ff.h +++ b/gnuradio-core/src/lib/general/gr_threshold_ff.h @@ -23,20 +23,21 @@ #ifndef INCLUDED_GR_THRESHOLD_FF_H #define INCLUDED_GR_THRESHOLD_FF_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_threshold_ff; typedef boost::shared_ptr<gr_threshold_ff> gr_threshold_ff_sptr; -gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state=0); +GR_CORE_API gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state=0); /*! * \brief Please fix my documentation * \ingroup misc_blk */ -class gr_threshold_ff : public gr_sync_block +class GR_CORE_API gr_threshold_ff : public gr_sync_block { - friend gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state); + friend GR_CORE_API gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state); float d_lo,d_hi; // the constant float d_last_state; diff --git a/gnuradio-core/src/lib/general/gr_throttle.h b/gnuradio-core/src/lib/general/gr_throttle.h index a82821f77..0b6ada995 100644 --- a/gnuradio-core/src/lib/general/gr_throttle.h +++ b/gnuradio-core/src/lib/general/gr_throttle.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_THROTTLE_H #define INCLUDED_GR_THROTTLE_H +#include <gr_core_api.h> #include <gr_sync_block.h> /*! @@ -35,7 +36,7 @@ * controlling the rate of samples. That should be controlled by a * source or sink tied to sample clock. E.g., a USRP or audio card. */ -class gr_throttle : virtual public gr_sync_block +class GR_CORE_API gr_throttle : virtual public gr_sync_block { public: typedef boost::shared_ptr<gr_throttle> sptr; @@ -44,6 +45,6 @@ public: virtual void set_sample_rate(double rate) = 0; }; -gr_throttle::sptr gr_make_throttle(size_t itemsize, double samples_per_sec); +GR_CORE_API gr_throttle::sptr gr_make_throttle(size_t itemsize, double samples_per_sec); #endif /* INCLUDED_GR_THROTTLE_H */ diff --git a/gnuradio-core/src/lib/general/gr_transcendental.h b/gnuradio-core/src/lib/general/gr_transcendental.h index 1b237c44a..25c6eb75d 100644 --- a/gnuradio-core/src/lib/general/gr_transcendental.h +++ b/gnuradio-core/src/lib/general/gr_transcendental.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_TRANSCENDENTAL_H #define INCLUDED_GR_TRANSCENDENTAL_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <string> @@ -35,12 +36,12 @@ * * output[i] = trans_fcn(input[i]) */ -class gr_transcendental : virtual public gr_sync_block{ +class GR_CORE_API gr_transcendental : virtual public gr_sync_block{ public: typedef boost::shared_ptr<gr_transcendental> sptr; }; -gr_transcendental::sptr gr_make_transcendental( +GR_CORE_API gr_transcendental::sptr gr_make_transcendental( const std::string &name, const std::string &type = "float" ); diff --git a/gnuradio-core/src/lib/general/gr_uchar_to_float.h b/gnuradio-core/src/lib/general/gr_uchar_to_float.h index 3b83c893f..8e8836c2c 100644 --- a/gnuradio-core/src/lib/general/gr_uchar_to_float.h +++ b/gnuradio-core/src/lib/general/gr_uchar_to_float.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_UCHAR_TO_FLOAT_H #define INCLUDED_GR_UCHAR_TO_FLOAT_H +#include <gr_core_api.h> #include <gr_sync_block.h> class gr_uchar_to_float; typedef boost::shared_ptr<gr_uchar_to_float> gr_uchar_to_float_sptr; -gr_uchar_to_float_sptr +GR_CORE_API gr_uchar_to_float_sptr gr_make_uchar_to_float (); /*! @@ -36,9 +37,9 @@ gr_make_uchar_to_float (); * \ingroup converter_blk */ -class gr_uchar_to_float : public gr_sync_block +class GR_CORE_API gr_uchar_to_float : public gr_sync_block { - friend gr_uchar_to_float_sptr gr_make_uchar_to_float (); + friend GR_CORE_API gr_uchar_to_float_sptr gr_make_uchar_to_float (); gr_uchar_to_float (); public: diff --git a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h index e2be2c59c..056c69dc1 100644 --- a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h +++ b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h @@ -23,11 +23,12 @@ #ifndef INCLUDED_GR_UNPACK_K_BITS_BB_H #define INCLUDED_GR_UNPACK_K_BITS_BB_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_unpack_k_bits_bb; typedef boost::shared_ptr<gr_unpack_k_bits_bb> gr_unpack_k_bits_bb_sptr; -gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k); +GR_CORE_API gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k); class gr_unpack_k_bits_bb; @@ -35,10 +36,10 @@ class gr_unpack_k_bits_bb; * \brief Converts a byte with k relevent bits to k output bytes with 1 bit in the LSB. * \ingroup converter_blk */ -class gr_unpack_k_bits_bb : public gr_sync_interpolator +class GR_CORE_API gr_unpack_k_bits_bb : public gr_sync_interpolator { private: - friend gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k); + friend GR_CORE_API gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k); gr_unpack_k_bits_bb (unsigned k); diff --git a/gnuradio-core/src/lib/general/gr_vco_f.h b/gnuradio-core/src/lib/general/gr_vco_f.h index 2bdf60899..b7524d581 100644 --- a/gnuradio-core/src/lib/general/gr_vco_f.h +++ b/gnuradio-core/src/lib/general/gr_vco_f.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_VCO_F_H #define INCLUDED_GR_VCO_F_H +#include <gr_core_api.h> #include <gr_sync_block.h> #include <gr_fxpt_vco.h> @@ -37,7 +38,7 @@ class gr_vco_f; typedef boost::shared_ptr<gr_vco_f> gr_vco_f_sptr; -gr_vco_f_sptr gr_make_vco_f(double sampling_rate, double sensitivity, double amplitude); +GR_CORE_API gr_vco_f_sptr gr_make_vco_f(double sampling_rate, double sensitivity, double amplitude); /*! * \brief VCO - Voltage controlled oscillator @@ -45,9 +46,9 @@ gr_vco_f_sptr gr_make_vco_f(double sampling_rate, double sensitivity, double amp * * input: float stream of control voltages; output: float oscillator output */ -class gr_vco_f : public gr_sync_block +class GR_CORE_API gr_vco_f : public gr_sync_block { - friend gr_vco_f_sptr gr_make_vco_f(double sampling_rate, double sensitivity, double amplitude); + friend GR_CORE_API gr_vco_f_sptr gr_make_vco_f(double sampling_rate, double sensitivity, double amplitude); /*! * \brief VCO - Voltage controlled oscillator diff --git a/gnuradio-core/src/lib/general/gr_vector_to_stream.h b/gnuradio-core/src/lib/general/gr_vector_to_stream.h index de6cc2a8b..d2fa8c7ab 100644 --- a/gnuradio-core/src/lib/general/gr_vector_to_stream.h +++ b/gnuradio-core/src/lib/general/gr_vector_to_stream.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_VECTOR_TO_STREAM_H #define INCLUDED_GR_VECTOR_TO_STREAM_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_vector_to_stream; typedef boost::shared_ptr<gr_vector_to_stream> gr_vector_to_stream_sptr; -gr_vector_to_stream_sptr +GR_CORE_API gr_vector_to_stream_sptr gr_make_vector_to_stream (size_t item_size, size_t nitems_per_block); @@ -36,9 +37,9 @@ gr_make_vector_to_stream (size_t item_size, size_t nitems_per_block); * \brief convert a stream of blocks of nitems_per_block items into a stream of items * \ingroup slicedice_blk */ -class gr_vector_to_stream : public gr_sync_interpolator +class GR_CORE_API gr_vector_to_stream : public gr_sync_interpolator { - friend gr_vector_to_stream_sptr + friend GR_CORE_API gr_vector_to_stream_sptr gr_make_vector_to_stream (size_t item_size, size_t nitems_per_block); protected: diff --git a/gnuradio-core/src/lib/general/gr_vector_to_streams.h b/gnuradio-core/src/lib/general/gr_vector_to_streams.h index d5ba7acf9..04ac941a1 100644 --- a/gnuradio-core/src/lib/general/gr_vector_to_streams.h +++ b/gnuradio-core/src/lib/general/gr_vector_to_streams.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_VECTOR_TO_STREAMS_H #define INCLUDED_GR_VECTOR_TO_STREAMS_H +#include <gr_core_api.h> #include <gr_sync_interpolator.h> class gr_vector_to_streams; typedef boost::shared_ptr<gr_vector_to_streams> gr_vector_to_streams_sptr; -gr_vector_to_streams_sptr +GR_CORE_API gr_vector_to_streams_sptr gr_make_vector_to_streams (size_t item_size, size_t nstreams); @@ -36,9 +37,9 @@ gr_make_vector_to_streams (size_t item_size, size_t nstreams); * \brief Convert 1 stream of vectors of length N to N streams of items * \ingroup slicedice_blk */ -class gr_vector_to_streams : public gr_sync_block +class GR_CORE_API gr_vector_to_streams : public gr_sync_block { - friend gr_vector_to_streams_sptr + friend GR_CORE_API gr_vector_to_streams_sptr gr_make_vector_to_streams (size_t item_size, size_t nstreams); protected: diff --git a/gnuradio-core/src/lib/general/gr_wavelet_ff.h b/gnuradio-core/src/lib/general/gr_wavelet_ff.h index dcfb595e5..107a50fe2 100644 --- a/gnuradio-core/src/lib/general/gr_wavelet_ff.h +++ b/gnuradio-core/src/lib/general/gr_wavelet_ff.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GR_WAVELET_FF_H #define INCLUDED_GR_WAVELET_FF_H +#include <gr_core_api.h> #include <iostream> #include <gr_sync_block.h> @@ -31,7 +32,7 @@ class gr_wavelet_ff; typedef boost::shared_ptr<gr_wavelet_ff> gr_wavelet_ff_sptr; -gr_wavelet_ff_sptr +GR_CORE_API gr_wavelet_ff_sptr gr_make_wavelet_ff(int size = 1024, int order = 20, bool forward = true); @@ -41,7 +42,7 @@ gr_make_wavelet_ff(int size = 1024, * \ingroup wavelet_blk */ -class gr_wavelet_ff : public gr_sync_block +class GR_CORE_API gr_wavelet_ff : public gr_sync_block { int d_size; int d_order; @@ -50,7 +51,7 @@ class gr_wavelet_ff : public gr_sync_block gsl_wavelet_workspace *d_workspace; double *d_temp; - friend gr_wavelet_ff_sptr + friend GR_CORE_API gr_wavelet_ff_sptr gr_make_wavelet_ff(int size, int order, bool forward); diff --git a/gnuradio-core/src/lib/general/gr_wvps_ff.h b/gnuradio-core/src/lib/general/gr_wvps_ff.h index af122d0fc..7c8f26066 100644 --- a/gnuradio-core/src/lib/general/gr_wvps_ff.h +++ b/gnuradio-core/src/lib/general/gr_wvps_ff.h @@ -23,12 +23,13 @@ #ifndef INCLUDED_GR_WVPS_FF_H #define INCLUDED_GR_WVPS_FF_H +#include <gr_core_api.h> #include <gr_sync_decimator.h> class gr_wvps_ff; typedef boost::shared_ptr<gr_wvps_ff> gr_wvps_ff_sptr; -gr_wvps_ff_sptr +GR_CORE_API gr_wvps_ff_sptr gr_make_wvps_ff(int ilen); @@ -36,9 +37,9 @@ gr_make_wvps_ff(int ilen); * \brief computes the Wavelet Power Spectrum from a set of wavelet coefficients * \ingroup wavelet_blk */ -class gr_wvps_ff : public gr_sync_block +class GR_CORE_API gr_wvps_ff : public gr_sync_block { - friend gr_wvps_ff_sptr + friend GR_CORE_API gr_wvps_ff_sptr gr_make_wvps_ff(int ilen); int d_ilen; diff --git a/gnuradio-core/src/lib/general/gri_agc2_cc.h b/gnuradio-core/src/lib/general/gri_agc2_cc.h index 441d1e459..b0a027aad 100644 --- a/gnuradio-core/src/lib/general/gri_agc2_cc.h +++ b/gnuradio-core/src/lib/general/gri_agc2_cc.h @@ -23,6 +23,7 @@ #ifndef _GRI_AGC2_CC_H_ #define _GRI_AGC2_CC_H_ +#include <gr_core_api.h> #include <math.h> /*! @@ -30,7 +31,7 @@ * * For Power the absolute value of the complex number is used. */ -class gri_agc2_cc { +class GR_CORE_API gri_agc2_cc { public: gri_agc2_cc (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0, diff --git a/gnuradio-core/src/lib/general/gri_agc2_ff.h b/gnuradio-core/src/lib/general/gri_agc2_ff.h index a06dab78c..ee70c2537 100644 --- a/gnuradio-core/src/lib/general/gri_agc2_ff.h +++ b/gnuradio-core/src/lib/general/gri_agc2_ff.h @@ -23,6 +23,7 @@ #ifndef _GRI_AGC2_FF_H_ #define _GRI_AGC2_FF_H_ +#include <gr_core_api.h> #include <math.h> /*! @@ -31,7 +32,7 @@ * Power is approximated by absolute value */ -class gri_agc2_ff { +class GR_CORE_API gri_agc2_ff { public: gri_agc2_ff (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0, diff --git a/gnuradio-core/src/lib/general/gri_agc_cc.h b/gnuradio-core/src/lib/general/gri_agc_cc.h index bc31d9a3d..74dfdf1dc 100644 --- a/gnuradio-core/src/lib/general/gri_agc_cc.h +++ b/gnuradio-core/src/lib/general/gri_agc_cc.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GRI_AGC_CC_H #define INCLUDED_GRI_AGC_CC_H +#include <gr_core_api.h> #include <math.h> /*! @@ -31,7 +32,7 @@ * For Power the absolute value of the complex number is used. */ -class gri_agc_cc { +class GR_CORE_API gri_agc_cc { public: gri_agc_cc (float rate = 1e-4, float reference = 1.0, diff --git a/gnuradio-core/src/lib/general/gri_agc_ff.h b/gnuradio-core/src/lib/general/gri_agc_ff.h index de609a8d4..753bbe275 100644 --- a/gnuradio-core/src/lib/general/gri_agc_ff.h +++ b/gnuradio-core/src/lib/general/gri_agc_ff.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GRI_AGC_FF_H #define INCLUDED_GRI_AGC_FF_H +#include <gr_core_api.h> #include <math.h> /*! @@ -30,7 +31,7 @@ * * Power is approximated by absolute value */ -class gri_agc_ff { +class GR_CORE_API gri_agc_ff { public: gri_agc_ff (float rate = 1e-4, float reference = 1.0, diff --git a/gnuradio-core/src/lib/general/gri_char_to_float.h b/gnuradio-core/src/lib/general/gri_char_to_float.h index f4703bef7..890d482b5 100644 --- a/gnuradio-core/src/lib/general/gri_char_to_float.h +++ b/gnuradio-core/src/lib/general/gri_char_to_float.h @@ -23,10 +23,12 @@ #ifndef INCLUDED_GRI_CHAR_TO_FLOAT_H #define INCLUDED_GRI_CHAR_TO_FLOAT_H +#include <gr_core_api.h> + /* * convert array of chars to floats */ -void gri_char_to_float (const char *in, float *out, int nsamples); +GR_CORE_API void gri_char_to_float (const char *in, float *out, int nsamples); -#endif /* INCLUDED_GRI_CHAR_TO_FLOAT_H */ +#endif /* INCLUDED_GRI_CHAR_TO_FLOAT_H */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/general/gri_control_loop.cc b/gnuradio-core/src/lib/general/gri_control_loop.cc new file mode 100644 index 000000000..4c64bb922 --- /dev/null +++ b/gnuradio-core/src/lib/general/gri_control_loop.cc @@ -0,0 +1,187 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 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 <gri_control_loop.h> +#include <gr_math.h> +#include <stdexcept> + +#define M_TWOPI (2.0f*M_PI) + +gri_control_loop::gri_control_loop(float loop_bw, + float max_freq, float min_freq) + : d_phase(0), d_freq(0), d_max_freq(max_freq), d_min_freq(min_freq) +{ + // Set the damping factor for a critically damped system + d_damping = sqrtf(2.0f)/2.0f; + + // Set the bandwidth, which will then call update_gains() + set_loop_bandwidth(loop_bw); +} + +gri_control_loop::~gri_control_loop() +{ +} + +void +gri_control_loop::update_gains() +{ + float denom = (1.0 + 2.0*d_damping*d_loop_bw + d_loop_bw*d_loop_bw); + d_alpha = (4*d_damping*d_loop_bw) / denom; + d_beta = (4*d_loop_bw*d_loop_bw) / denom; +} + +void +gri_control_loop::advance_loop(float error) +{ + d_freq = d_freq + d_beta * error; + d_phase = d_phase + d_freq + d_alpha * error; +} + + +void +gri_control_loop::phase_wrap() +{ + while(d_phase>M_TWOPI) + d_phase -= M_TWOPI; + while(d_phase<-M_TWOPI) + d_phase += M_TWOPI; +} + +void +gri_control_loop::frequency_limit() +{ + if (d_freq > d_max_freq) + d_freq = d_max_freq; + else if (d_freq < d_min_freq) + d_freq = d_min_freq; +} + +/******************************************************************* + SET FUNCTIONS +*******************************************************************/ + +void +gri_control_loop::set_loop_bandwidth(float bw) +{ + if(bw < 0) { + throw std::out_of_range ("gri_control_loop: invalid bandwidth. Must be >= 0."); + } + + d_loop_bw = bw; + update_gains(); +} + +void +gri_control_loop::set_damping_factor(float df) +{ + if(df < 0 || df > 1.0) { + throw std::out_of_range ("gri_control_loop: invalid damping factor. Must be in [0,1]."); + } + + d_damping = df; + update_gains(); +} + +void +gri_control_loop::set_alpha(float alpha) +{ + if(alpha < 0 || alpha > 1.0) { + throw std::out_of_range ("gri_control_loop: invalid alpha. Must be in [0,1]."); + } + d_alpha = alpha; +} + +void +gri_control_loop::set_beta(float beta) +{ + if(beta < 0 || beta > 1.0) { + throw std::out_of_range ("gri_control_loop: invalid beta. Must be in [0,1]."); + } + d_beta = beta; +} + +void +gri_control_loop::set_frequency(float freq) +{ + if(freq > d_max_freq) + d_freq = d_min_freq; + else if(freq < d_min_freq) + d_freq = d_max_freq; + else + d_freq = freq; +} + +void +gri_control_loop::set_phase(float phase) +{ + d_phase = phase; + while(d_phase>M_TWOPI) + d_phase -= M_TWOPI; + while(d_phase<-M_TWOPI) + d_phase += M_TWOPI; +} + + +/******************************************************************* + GET FUNCTIONS +*******************************************************************/ + + +float +gri_control_loop::get_loop_bandwidth() const +{ + return d_loop_bw; +} + +float +gri_control_loop::get_damping_factor() const +{ + return d_damping; +} + +float +gri_control_loop::get_alpha() const +{ + return d_alpha; +} + +float +gri_control_loop::get_beta() const +{ + return d_beta; +} + +float +gri_control_loop::get_frequency() const +{ + return d_freq; +} + +float +gri_control_loop::get_phase() const +{ + return d_phase; +} diff --git a/gnuradio-core/src/lib/general/gri_control_loop.h b/gnuradio-core/src/lib/general/gri_control_loop.h new file mode 100644 index 000000000..3aeac58f7 --- /dev/null +++ b/gnuradio-core/src/lib/general/gri_control_loop.h @@ -0,0 +1,203 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 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 GRI_CONTROL_LOOP +#define GRI_CONTROL_LOOP + +#include <gr_core_api.h> + +class GR_CORE_API gri_control_loop +{ + protected: + float d_phase, d_freq; + float d_max_freq, d_min_freq; + float d_damping, d_loop_bw; + float d_alpha, d_beta; + + public: + gri_control_loop(float loop_bw, float max_freq, float min_freq); + virtual ~gri_control_loop(); + + /*! \brief update the system gains from the loop bandwidth and damping factor + * + * This function updates the system gains based on the loop + * bandwidth and damping factor of the system. + * These two factors can be set separately through their own + * set functions. + */ + void update_gains(); + + /*! \brief update the system gains from the loop bandwidth and damping factor + * + * This function updates the system gains based on the loop + * bandwidth and damping factor of the system. + * These two factors can be set separately through their own + * set functions. + */ + void advance_loop(float error); + + /*! \brief Keep the phase between -2pi and 2pi + * + * This function keeps the phase between -2pi and 2pi. If the phase + * is greater than 2pi by d, it wraps around to be -2pi+d; similarly if + * it is less than -2pi by d, it wraps around to 2pi-d. + * + * This function should be called after advance_loop to keep the phase + * in a good operating region. It is set as a separate method in case + * another way is desired as this is fairly heavy-handed. + */ + void phase_wrap(); + + /*! \brief Keep the frequency between d_min_freq and d_max_freq + * + * This function keeps the frequency between d_min_freq and d_max_freq. + * If the frequency is greater than d_max_freq, it is set to d_max_freq. + * If the frequency is less than d_min_freq, it is set to d_min_freq. + * + * This function should be called after advance_loop to keep the frequency + * in the specified region. It is set as a separate method in case + * another way is desired as this is fairly heavy-handed. + */ + void frequency_limit(); + + /******************************************************************* + SET FUNCTIONS + *******************************************************************/ + + /*! + * \brief Set the loop bandwidth + * + * Set the loop filter's bandwidth to \p bw. This should be between + * 2*pi/200 and 2*pi/100 (in rads/samp). It must also be a positive + * number. + * + * When a new damping factor is set, the gains, alpha and beta, of the loop + * are recalculated by a call to update_gains(). + * + * \param bw (float) new bandwidth + * + */ + void set_loop_bandwidth(float bw); + + /*! + * \brief Set the loop damping factor + * + * Set the loop filter's damping factor to \p df. The damping factor + * should be sqrt(2)/2.0 for critically damped systems. + * Set it to anything else only if you know what you are doing. It must + * be a number between 0 and 1. + * + * When a new damping factor is set, the gains, alpha and beta, of the loop + * are recalculated by a call to update_gains(). + * + * \param df (float) new damping factor + * + */ + void set_damping_factor(float df); + + /*! + * \brief Set the loop gain alpha + * + * Set's the loop filter's alpha gain parameter. + * + * This value should really only be set by adjusting the loop bandwidth + * and damping factor. + * + * \param alpha (float) new alpha gain + * + */ + void set_alpha(float alpha); + + /*! + * \brief Set the loop gain beta + * + * Set's the loop filter's beta gain parameter. + * + * This value should really only be set by adjusting the loop bandwidth + * and damping factor. + * + * \param beta (float) new beta gain + * + */ + void set_beta(float beta); + + /*! + * \brief Set the Costas loop's frequency. + * + * Set's the Costas Loop's frequency. While this is normally updated by the + * inner loop of the algorithm, it could be useful to manually initialize, + * set, or reset this under certain circumstances. + * + * \param freq (float) new frequency + * + */ + void set_frequency(float freq); + + /*! + * \brief Set the Costas loop's phase. + * + * Set's the Costas Loop's phase. While this is normally updated by the + * inner loop of the algorithm, it could be useful to manually initialize, + * set, or reset this under certain circumstances. + * + * \param phase (float) new phase + * + */ + void set_phase(float phase); + + + /******************************************************************* + GET FUNCTIONS + *******************************************************************/ + + /*! + * \brief Returns the loop bandwidth + */ + float get_loop_bandwidth() const; + + /*! + * \brief Returns the loop damping factor + */ + float get_damping_factor() const; + + /*! + * \brief Returns the loop gain alpha + */ + float get_alpha() const; + + /*! + * \brief Returns the loop gain beta + */ + float get_beta() const; + + /*! + * \brief Get the Costas loop's frequency estimate + */ + float get_frequency() const; + + /*! + * \brief Get the Costas loop's phase estimate + */ + float get_phase() const; +}; + +#endif /* GRI_CONTROL_LOOP */ diff --git a/gnuradio-core/src/lib/general/gri_control_loop.i b/gnuradio-core/src/lib/general/gri_control_loop.i new file mode 100644 index 000000000..67f8838cb --- /dev/null +++ b/gnuradio-core/src/lib/general/gri_control_loop.i @@ -0,0 +1,57 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011 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. + */ + + +class gri_control_loop +{ + public: + gri_control_loop(float loop_bw, float max_freq, float min_freq); + virtual ~gri_control_loop(); + + void update_gains(); + void advance_loop(float error); + void phase_wrap(); + void frequency_limit(); + + /******************************************************************* + SET FUNCTIONS + *******************************************************************/ + + void set_loop_bandwidth(float bw); + void set_damping_factor(float df); + void set_alpha(float alpha); + void set_beta(float beta); + void set_frequency(float freq); + void set_phase(float phase); + + + /******************************************************************* + GET FUNCTIONS + *******************************************************************/ + + float get_loop_bandwidth() const; + float get_damping_factor() const; + float get_alpha() const; + float get_beta() const; + float get_frequency() const; + float get_phase() const; +}; diff --git a/gnuradio-core/src/lib/general/gri_debugger_hook.h b/gnuradio-core/src/lib/general/gri_debugger_hook.h index 60c90685e..cf227af8f 100644 --- a/gnuradio-core/src/lib/general/gri_debugger_hook.h +++ b/gnuradio-core/src/lib/general/gri_debugger_hook.h @@ -23,6 +23,8 @@ #ifndef INCLUDED_GRI_DEBUGGER_HOOK_H #define INCLUDED_GRI_DEBUGGER_HOOK_H -void gri_debugger_hook (); +#include <gr_core_api.h> -#endif /* INCLUDED_GRI_DEBUGGER_HOOK_H */ +GR_CORE_API void gri_debugger_hook (); + +#endif /* INCLUDED_GRI_DEBUGGER_HOOK_H */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/general/gri_fft.cc b/gnuradio-core/src/lib/general/gri_fft.cc index f20b15ca0..0df1af25d 100644 --- a/gnuradio-core/src/lib/general/gri_fft.cc +++ b/gnuradio-core/src/lib/general/gri_fft.cc @@ -23,6 +23,19 @@ #include <gri_fft.h> #include <gr_sys_paths.h> #include <fftw3.h> + +#ifdef _MSC_VER //http://www.fftw.org/install/windows.html#DLLwisdom +static void my_fftw_write_char(char c, void *f) { fputc(c, (FILE *) f); } +#define fftw_export_wisdom_to_file(f) fftw_export_wisdom(my_fftw_write_char, (void*) (f)) +#define fftwf_export_wisdom_to_file(f) fftwf_export_wisdom(my_fftw_write_char, (void*) (f)) +#define fftwl_export_wisdom_to_file(f) fftwl_export_wisdom(my_fftw_write_char, (void*) (f)) + +static int my_fftw_read_char(void *f) { return fgetc((FILE *) f); } +#define fftw_import_wisdom_from_file(f) fftw_import_wisdom(my_fftw_read_char, (void*) (f)) +#define fftwf_import_wisdom_from_file(f) fftwf_import_wisdom(my_fftw_read_char, (void*) (f)) +#define fftwl_import_wisdom_from_file(f) fftwl_import_wisdom(my_fftw_read_char, (void*) (f)) +#endif //_MSC_VER + #include <gr_complex.h> #include <stdlib.h> #include <string.h> diff --git a/gnuradio-core/src/lib/general/gri_fft.h b/gnuradio-core/src/lib/general/gri_fft.h index 9ffcc5a50..91a82fb55 100644 --- a/gnuradio-core/src/lib/general/gri_fft.h +++ b/gnuradio-core/src/lib/general/gri_fft.h @@ -26,6 +26,7 @@ * Wrappers for FFTW single precision 1d dft */ +#include <gr_core_api.h> #include <gr_complex.h> #include <boost/thread.hpp> @@ -33,7 +34,7 @@ * \brief Export reference to planner mutex for those apps that * want to use FFTW w/o using the gri_fftw* classes. */ -class gri_fft_planner { +class GR_CORE_API gri_fft_planner { public: typedef boost::mutex::scoped_lock scoped_lock; /*! @@ -46,7 +47,7 @@ public: * \brief FFT: complex in, complex out * \ingroup misc */ -class gri_fft_complex { +class GR_CORE_API gri_fft_complex { int d_fft_size; gr_complex *d_inbuf; gr_complex *d_outbuf; @@ -77,7 +78,7 @@ public: * \brief FFT: real in, complex out * \ingroup misc */ -class gri_fft_real_fwd { +class GR_CORE_API gri_fft_real_fwd { int d_fft_size; float *d_inbuf; gr_complex *d_outbuf; @@ -108,7 +109,7 @@ public: * \brief FFT: complex in, float out * \ingroup misc */ -class gri_fft_real_rev { +class GR_CORE_API gri_fft_real_rev { int d_fft_size; gr_complex *d_inbuf; float *d_outbuf; diff --git a/gnuradio-core/src/lib/general/gri_float_to_char.h b/gnuradio-core/src/lib/general/gri_float_to_char.h index 95cc8ea8d..184592a69 100644 --- a/gnuradio-core/src/lib/general/gri_float_to_char.h +++ b/gnuradio-core/src/lib/general/gri_float_to_char.h @@ -23,10 +23,11 @@ #ifndef INCLUDED_GRI_FLOAT_TO_CHAR_H #define INCLUDED_GRI_FLOAT_TO_CHAR_H +#include <gr_core_api.h> + /*! * convert array of floats to chars with rounding and saturation. */ -void gri_float_to_char (const float *in, char *out, int nsamples); +GR_CORE_API void gri_float_to_char (const float *in, char *out, int nsamples); #endif /* INCLUDED_GRI_FLOAT_TO_CHAR_H */ - diff --git a/gnuradio-core/src/lib/general/gri_float_to_short.h b/gnuradio-core/src/lib/general/gri_float_to_short.h index e36e25de6..6d814b2b3 100644 --- a/gnuradio-core/src/lib/general/gri_float_to_short.h +++ b/gnuradio-core/src/lib/general/gri_float_to_short.h @@ -23,10 +23,11 @@ #ifndef INCLUDED_GRI_FLOAT_TO_SHORT_H #define INCLUDED_GRI_FLOAT_TO_SHORT_H +#include <gr_core_api.h> + /*! * convert array of floats to shorts with rounding and saturation. */ -void gri_float_to_short (const float *in, short *out, int nsamples); +GR_CORE_API void gri_float_to_short (const float *in, short *out, int nsamples); #endif /* INCLUDED_GRI_FLOAT_TO_SHORT_H */ - diff --git a/gnuradio-core/src/lib/general/gri_float_to_uchar.h b/gnuradio-core/src/lib/general/gri_float_to_uchar.h index e413e725f..ff549333e 100644 --- a/gnuradio-core/src/lib/general/gri_float_to_uchar.h +++ b/gnuradio-core/src/lib/general/gri_float_to_uchar.h @@ -23,10 +23,11 @@ #ifndef INCLUDED_GRI_FLOAT_TO_UCHAR_H #define INCLUDED_GRI_FLOAT_TO_UCHAR_H +#include <gr_core_api.h> + /*! * convert array of floats to unsigned chars with rounding and saturation. */ -void gri_float_to_uchar (const float *in, unsigned char *out, int nsamples); +GR_CORE_API void gri_float_to_uchar (const float *in, unsigned char *out, int nsamples); #endif /* INCLUDED_GRI_FLOAT_TO_UCHAR_H */ - diff --git a/gnuradio-core/src/lib/general/gri_glfsr.h b/gnuradio-core/src/lib/general/gri_glfsr.h index 7dd5f8660..e6d28cf45 100644 --- a/gnuradio-core/src/lib/general/gri_glfsr.h +++ b/gnuradio-core/src/lib/general/gri_glfsr.h @@ -23,6 +23,8 @@ #ifndef INCLUDED_GRI_GLFSR_H #define INCLUDED_GRI_GLFSR_H +#include <gr_core_api.h> + /*! * \brief Galois Linear Feedback Shift Register using specified polynomial mask * \ingroup misc @@ -30,7 +32,7 @@ * Generates a maximal length pseudo-random sequence of length 2^degree-1 */ -class gri_glfsr +class GR_CORE_API gri_glfsr { private: int d_shift_register; @@ -52,4 +54,4 @@ class gri_glfsr int mask() const { return d_mask; } }; -#endif /* INCLUDED_GRI_GLFSR_H */ +#endif /* INCLUDED_GRI_GLFSR_H */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/general/gri_interleaved_short_to_complex.h b/gnuradio-core/src/lib/general/gri_interleaved_short_to_complex.h index 09d915f7a..107e2f778 100644 --- a/gnuradio-core/src/lib/general/gri_interleaved_short_to_complex.h +++ b/gnuradio-core/src/lib/general/gri_interleaved_short_to_complex.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GRI_INTERLEAVED_SHORT_TO_COMPLEX_H #define INCLUDED_GRI_INTERLEAVED_SHORT_TO_COMPLEX_H +#include <gr_core_api.h> #include <gr_complex.h> /* @@ -30,7 +31,7 @@ * the shorts contains real, imaginary, real, imaginary... * nsamples is the number of shorts; it must be even. */ -void gri_interleaved_short_to_complex (const short *in, gr_complex *out, int nsamples); +GR_CORE_API void gri_interleaved_short_to_complex (const short *in, gr_complex *out, int nsamples); #endif /* INCLUDED_GRI_INTERLEAVED_SHORT_TO_COMPLEX_H */ diff --git a/gnuradio-core/src/lib/general/gri_lfsr.h b/gnuradio-core/src/lib/general/gri_lfsr.h index f691e36ec..dc9358572 100644 --- a/gnuradio-core/src/lib/general/gri_lfsr.h +++ b/gnuradio-core/src/lib/general/gri_lfsr.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GRI_LFSR_H #define INCLUDED_GRI_LFSR_H +#include <gr_core_api.h> #include <stdexcept> #include <stdint.h> @@ -81,7 +82,7 @@ * */ -class gri_lfsr +class GR_CORE_API gri_lfsr { private: uint32_t d_shift_register; diff --git a/gnuradio-core/src/lib/general/gri_lfsr_15_1_0.h b/gnuradio-core/src/lib/general/gri_lfsr_15_1_0.h index 798f2faad..7405ffbaa 100644 --- a/gnuradio-core/src/lib/general/gri_lfsr_15_1_0.h +++ b/gnuradio-core/src/lib/general/gri_lfsr_15_1_0.h @@ -23,6 +23,8 @@ #ifndef INCLUDED_GRI_LFSR_15_1_0_H #define INCLUDED_GRI_LFSR_15_1_0_H +#include <gr_core_api.h> + /*! * \brief Linear Feedback Shift Register using primitive polynomial x^15 + x + 1 * \ingroup misc @@ -30,7 +32,7 @@ * Generates a maximal length pseudo-random sequence of length 2^15 - 1 bits. */ -class gri_lfsr_15_1_0 { +class GR_CORE_API gri_lfsr_15_1_0 { unsigned long d_sr; // shift register public: @@ -55,4 +57,4 @@ class gri_lfsr_15_1_0 { } }; -#endif /* INCLUDED_GRI_LFSR_15_1_0_H */ +#endif /* INCLUDED_GRI_LFSR_15_1_0_H */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/general/gri_lfsr_32k.h b/gnuradio-core/src/lib/general/gri_lfsr_32k.h index 33e7ae3a1..5c0396b50 100644 --- a/gnuradio-core/src/lib/general/gri_lfsr_32k.h +++ b/gnuradio-core/src/lib/general/gri_lfsr_32k.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GRI_LFSR_32k_H #define INCLUDED_GRI_LFSR_32k_H +#include <gr_core_api.h> #include <gri_lfsr_15_1_0.h> /*! @@ -33,7 +34,7 @@ * of the sequence. */ -class gri_lfsr_32k { +class GR_CORE_API gri_lfsr_32k { gri_lfsr_15_1_0 d_lfsr; unsigned int d_count; diff --git a/gnuradio-core/src/lib/general/gri_short_to_float.h b/gnuradio-core/src/lib/general/gri_short_to_float.h index ce4193062..51767efab 100644 --- a/gnuradio-core/src/lib/general/gri_short_to_float.h +++ b/gnuradio-core/src/lib/general/gri_short_to_float.h @@ -23,10 +23,12 @@ #ifndef INCLUDED_GRI_SHORT_TO_FLOAT_H #define INCLUDED_GRI_SHORT_TO_FLOAT_H +#include <gr_core_api.h> + /* * convert array of shorts to floats */ -void gri_short_to_float (const short *in, float *out, int nsamples); +GR_CORE_API void gri_short_to_float (const short *in, float *out, int nsamples); -#endif /* INCLUDED_GRI_SHORT_TO_FLOAT_H */ +#endif /* INCLUDED_GRI_SHORT_TO_FLOAT_H */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/general/gri_uchar_to_float.h b/gnuradio-core/src/lib/general/gri_uchar_to_float.h index 7a9f11ba6..9f342989d 100644 --- a/gnuradio-core/src/lib/general/gri_uchar_to_float.h +++ b/gnuradio-core/src/lib/general/gri_uchar_to_float.h @@ -23,10 +23,12 @@ #ifndef INCLUDED_GRI_UCHAR_TO_FLOAT_H #define INCLUDED_GRI_UCHAR_TO_FLOAT_H +#include <gr_core_api.h> + /* * convert array of unsigned chars to floats */ -void gri_uchar_to_float (const unsigned char *in, float *out, int nsamples); +GR_CORE_API void gri_uchar_to_float (const unsigned char *in, float *out, int nsamples); -#endif /* INCLUDED_GRI_UCHAR_TO_FLOAT_H */ +#endif /* INCLUDED_GRI_UCHAR_TO_FLOAT_H */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/general/malloc16.c b/gnuradio-core/src/lib/general/malloc16.c index 331751499..2cc6135e7 100644 --- a/gnuradio-core/src/lib/general/malloc16.c +++ b/gnuradio-core/src/lib/general/malloc16.c @@ -7,7 +7,6 @@ #include "malloc16.h" #include <string.h> -#include <strings.h> void *malloc16Align(int size){ void *p; diff --git a/gnuradio-core/src/lib/general/malloc16.h b/gnuradio-core/src/lib/general/malloc16.h index fc97f267d..6b1a3fb08 100644 --- a/gnuradio-core/src/lib/general/malloc16.h +++ b/gnuradio-core/src/lib/general/malloc16.h @@ -20,15 +20,17 @@ * Boston, MA 02110-1301, USA. */ +#include <gr_core_api.h> + #ifdef __cplusplus extern "C" { #endif #include <stdlib.h> -void *malloc16Align(int size); -void *calloc16Align(size_t nmemb,size_t size); -void free16Align(void *p); +GR_CORE_API void *malloc16Align(int size); +GR_CORE_API void *calloc16Align(size_t nmemb,size_t size); +GR_CORE_API void free16Align(void *p); #ifdef __cplusplus } diff --git a/gnuradio-core/src/lib/general/qa_general.cc b/gnuradio-core/src/lib/general/qa_general.cc index 6984d798c..b9080f362 100644 --- a/gnuradio-core/src/lib/general/qa_general.cc +++ b/gnuradio-core/src/lib/general/qa_general.cc @@ -28,6 +28,7 @@ #include <qa_general.h> #include <qa_gr_firdes.h> #include <qa_gr_circular_file.h> +#include <qa_gr_cpm.h> #include <qa_gr_fxpt.h> #include <qa_gr_fxpt_nco.h> #include <qa_gr_fxpt_vco.h> @@ -41,6 +42,7 @@ qa_general::suite () s->addTest (qa_gr_firdes::suite ()); s->addTest (qa_gr_circular_file::suite ()); + s->addTest (qa_gr_cpm::suite ()); s->addTest (qa_gr_fxpt::suite ()); s->addTest (qa_gr_fxpt_nco::suite ()); s->addTest (qa_gr_fxpt_vco::suite ()); diff --git a/gnuradio-core/src/lib/general/qa_general.h b/gnuradio-core/src/lib/general/qa_general.h index 577c9d7fb..7da188266 100644 --- a/gnuradio-core/src/lib/general/qa_general.h +++ b/gnuradio-core/src/lib/general/qa_general.h @@ -23,11 +23,12 @@ #ifndef _QA_GENERAL_H_ #define _QA_GENERAL_H_ +#include <gruel/attributes.h> #include <cppunit/TestSuite.h> //! collect all the tests for the gr directory -class qa_general { +class __GR_ATTR_EXPORT qa_general { public: //! return suite of tests for all of gr directory static CppUnit::TestSuite *suite (); diff --git a/gnuradio-core/src/lib/general/qa_gr_cpm.cc b/gnuradio-core/src/lib/general/qa_gr_cpm.cc new file mode 100644 index 000000000..cc32d1117 --- /dev/null +++ b/gnuradio-core/src/lib/general/qa_gr_cpm.cc @@ -0,0 +1,140 @@ +/* -*- c++ -*- */ +/* + * Copyright 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. + */ + +#include <qa_gr_cpm.h> +#include <gr_cpm.h> +#include <cppunit/TestAssert.h> + +const double DELTA = 1e-5; +const int L = 5; +const int samples_per_sym = 4; +const float taps_lrc[20] = { + 0, 0.002447174185242, 0.009549150281253, 0.020610737385376, + 0.034549150281253, 0.050000000000000, 0.065450849718747, 0.079389262614624, + 0.090450849718747, 0.097552825814758, 0.100000000000000, 0.097552825814758, + 0.090450849718747, 0.079389262614624, 0.065450849718747, 0.050000000000000, + 0.034549150281253, 0.020610737385376, 0.009549150281253, 0.002447174185242 +}; + + +const float taps_lsrc[20] = { // beta = 0.2 + 0.000000000000000, 0.009062686687436, 0.019517618142920, 0.030875041875917, + 0.042552315421249, 0.053912556756416, 0.064308860403517, 0.073130584159352, + 0.079847961304114, 0.084051371489937, 0.085482007518284, 0.084051371489937, + 0.079847961304114, 0.073130584159352, 0.064308860403517, 0.053912556756416, + 0.042552315421249, 0.030875041875917, 0.019517618142920, 0.009062686687436 +}; + + +const float taps_tfm[20] = { + -0.003946522220317, -0.005147757690530, -0.003171631690177, 0.003959659609805, + 0.017498721302356, 0.037346982678383, 0.062251889790391, 0.087364237065604, + 0.110049050955117, 0.125677762224511, 0.132288693729399, 0.125677762224511, + 0.110049050955117, 0.087364237065604, 0.062251889790391, 0.037346982678383, + 0.017498721302356, 0.003959659609805, -0.003171631690177, -0.005147757690530 +}; + + +const float taps_gaussian[20] = { // BT = 0.3 + 0.000000743866524, 0.000009286258371, 0.000085441834550, 0.000581664421923, + 0.002945540765422, 0.011178079812344, 0.032117220937421, 0.070841188736816, + 0.122053715366673, 0.167389736919915, 0.185594670675172, 0.167389736919915, + 0.122053715366673, 0.070841188736816, 0.032117220937421, 0.011178079812344, + 0.002945540765422, 0.000581664421923, 0.000085441834550, 0.000009286258371 +}; + + +// Check LREC phase response +void +qa_gr_cpm::t1 () +{ + std::vector<float> taps(gr_cpm::phase_response(gr_cpm::LREC, samples_per_sym, L)); + + for (int i = 0; i < L * samples_per_sym; i++) { + CPPUNIT_ASSERT_DOUBLES_EQUAL(taps[i], 0.05, DELTA); + } +} + + +// Check LRC phase response +void +qa_gr_cpm::t2 () +{ + std::vector<float> taps(gr_cpm::phase_response(gr_cpm::LRC, samples_per_sym, L)); + float sum = 0; + + for (int i = 0; i < L * samples_per_sym; i++) { + CPPUNIT_ASSERT_DOUBLES_EQUAL(taps[i], taps_lrc[i], DELTA); + sum += taps[i]; + } + + CPPUNIT_ASSERT_DOUBLES_EQUAL(sum, 1.0, DELTA); +} + + +// Check LSRC phase response +void +qa_gr_cpm::t3 () +{ + std::vector<float> taps(gr_cpm::phase_response(gr_cpm::LSRC, samples_per_sym, L, 0.2)); + float sum = 0; + + for (int i = 0; i < L * samples_per_sym; i++) { + CPPUNIT_ASSERT_DOUBLES_EQUAL(taps[i], taps_lsrc[i], DELTA); + sum += taps[i]; + } + + CPPUNIT_ASSERT_DOUBLES_EQUAL(sum, 1.0, DELTA); +} + + +// Check the TFM phase response +void +qa_gr_cpm::t4 () +{ + std::vector<float> taps(gr_cpm::phase_response(gr_cpm::TFM, samples_per_sym, L)); + float sum = 0; + + for (int i = 0; i < L * samples_per_sym; i++) { + CPPUNIT_ASSERT_DOUBLES_EQUAL(taps[i], taps_tfm[i], DELTA); + sum += taps[i]; + } + + CPPUNIT_ASSERT_DOUBLES_EQUAL(sum, 1.0, DELTA); +} + + +// Check the Gaussian phase response +void +qa_gr_cpm::t5 () +{ + std::vector<float> taps(gr_cpm::phase_response(gr_cpm::GAUSSIAN, samples_per_sym, L, 0.3)); + float sum = 0; + + for (int i = 0; i < L * samples_per_sym; i++) { + CPPUNIT_ASSERT_DOUBLES_EQUAL(taps[i], taps_gaussian[i], DELTA); + sum += taps[i]; + } + + CPPUNIT_ASSERT_DOUBLES_EQUAL(sum, 1.0, DELTA); +} + diff --git a/gnuradio-core/src/lib/general/gr_lms_dfe_ff.i b/gnuradio-core/src/lib/general/qa_gr_cpm.h index 3ca488b52..741cb2860 100644 --- a/gnuradio-core/src/lib/general/gr_lms_dfe_ff.i +++ b/gnuradio-core/src/lib/general/qa_gr_cpm.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005 Free Software Foundation, Inc. + * Copyright 2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,16 +19,31 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ +#ifndef _QA_GR_CPM_H +#define _QA_GR_CPM_H +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/TestCase.h> -GR_SWIG_BLOCK_MAGIC(gr,lms_dfe_ff) +class qa_gr_cpm : public CppUnit::TestCase { -gr_lms_dfe_ff_sptr gr_make_lms_dfe_ff (float lambda_ff, float lambda_fb, - unsigned int num_fftaps, unsigned int num_fbtaps); + CPPUNIT_TEST_SUITE (qa_gr_cpm); + CPPUNIT_TEST (t1); + CPPUNIT_TEST (t2); + CPPUNIT_TEST (t3); + CPPUNIT_TEST (t4); + CPPUNIT_TEST (t5); + CPPUNIT_TEST_SUITE_END (); -class gr_lms_dfe_ff : public gr_sync_block -{ private: - gr_lms_dfe_ff (float lambda_ff, float lambda_fb, - unsigned int num_fftaps, unsigned int num_fbtaps); + void t1 (); + void t2 (); + void t3 (); + void t4 (); + void t5 (); + }; + + +#endif /* _QA_GR_CPM_H */ + diff --git a/gnuradio-core/src/lib/general/qa_gri_lfsr.cc b/gnuradio-core/src/lib/general/qa_gri_lfsr.cc index 9f8b62dcf..9625071d8 100644 --- a/gnuradio-core/src/lib/general/qa_gri_lfsr.cc +++ b/gnuradio-core/src/lib/general/qa_gri_lfsr.cc @@ -24,6 +24,7 @@ #include <cppunit/TestAssert.h> #include <stdio.h> #include <string.h> +#include <vector> void qa_gri_lfsr::test_lfsr () @@ -90,12 +91,12 @@ qa_gri_lfsr::test_scrambler() 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, }; int len = sizeof(src); - unsigned char actual[len]; + std::vector<unsigned char> actual(len); for (int i = 0; i < len; i++) actual[i] = scrambler.next_bit_scramble(src[i]); - CPPUNIT_ASSERT(memcmp(expected, actual, len) == 0); + CPPUNIT_ASSERT(memcmp(expected, &actual[0], len) == 0); } void @@ -132,10 +133,10 @@ qa_gri_lfsr::test_descrambler() 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int len = sizeof(src); - unsigned char actual[len]; + std::vector<unsigned char> actual(len); for (int i = 0; i < len; i++) actual[i] = descrambler.next_bit_descramble(src[i]); - CPPUNIT_ASSERT(memcmp(expected, actual, len) == 0); + CPPUNIT_ASSERT(memcmp(expected, &actual[0], len) == 0); } |