diff options
Diffstat (limited to 'gr-analog/lib')
-rw-r--r-- | gr-analog/lib/CMakeLists.txt | 28 | ||||
-rw-r--r-- | gr-analog/lib/fastnoise_source_X_impl.cc.t | 144 | ||||
-rw-r--r-- | gr-analog/lib/fastnoise_source_X_impl.h.t (renamed from gr-analog/lib/qa_sincos.h) | 44 | ||||
-rw-r--r-- | gr-analog/lib/noise_source_X_impl.cc.t | 6 | ||||
-rw-r--r-- | gr-analog/lib/plateau_detector_fb_impl.cc | 82 | ||||
-rw-r--r-- | gr-analog/lib/plateau_detector_fb_impl.h | 50 | ||||
-rw-r--r-- | gr-analog/lib/pll_carriertracking_cc_impl.cc | 36 | ||||
-rw-r--r-- | gr-analog/lib/pll_carriertracking_cc_impl.h | 4 | ||||
-rw-r--r-- | gr-analog/lib/pll_freqdet_cf_impl.cc | 34 | ||||
-rw-r--r-- | gr-analog/lib/pll_freqdet_cf_impl.h | 4 | ||||
-rw-r--r-- | gr-analog/lib/pll_refout_cc_impl.cc | 36 | ||||
-rw-r--r-- | gr-analog/lib/pll_refout_cc_impl.h | 4 | ||||
-rw-r--r-- | gr-analog/lib/qa_analog.cc | 5 | ||||
-rw-r--r-- | gr-analog/lib/qa_analog.h | 2 | ||||
-rw-r--r-- | gr-analog/lib/qa_rotator.cc | 81 | ||||
-rw-r--r-- | gr-analog/lib/qa_rotator.h | 45 | ||||
-rw-r--r-- | gr-analog/lib/qa_sincos.cc | 75 | ||||
-rw-r--r-- | gr-analog/lib/sig_source_X_impl.cc.t | 2 | ||||
-rw-r--r-- | gr-analog/lib/sincos.cc | 89 | ||||
-rw-r--r-- | gr-analog/lib/test_gr_analog.cc | 4 |
20 files changed, 249 insertions, 526 deletions
diff --git a/gr-analog/lib/CMakeLists.txt b/gr-analog/lib/CMakeLists.txt index 396ff04654..5719eac7a5 100644 --- a/gr-analog/lib/CMakeLists.txt +++ b/gr-analog/lib/CMakeLists.txt @@ -27,14 +27,19 @@ include_directories( ${GR_ANALOG_INCLUDE_DIRS} ${GR_FILTER_INCLUDE_DIRS} ${GR_FFT_INCLUDE_DIRS} - ${GNURADIO_CORE_INCLUDE_DIRS} + ${GR_BLOCKS_INCLUDE_DIRS} + ${GNURADIO_RUNTIME_INCLUDE_DIRS} ${VOLK_INCLUDE_DIRS} - ${GRUEL_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ) link_directories(${Boost_LIBRARY_DIRS}) +if(ENABLE_GR_CTRLPORT) + ADD_DEFINITIONS(-DGR_CTRLPORT) + include_directories(${ICE_INCLUDE_DIR}) +endif(ENABLE_GR_CTRLPORT) + ######################################################################## # generate helper scripts to expand templated files ######################################################################## @@ -44,7 +49,7 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py " #!${PYTHON_EXECUTABLE} import sys, os, re -sys.path.append('${GR_CORE_PYTHONPATH}') +sys.path.append('${GR_RUNTIME_PYTHONPATH}') os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' os.chdir('${CMAKE_CURRENT_BINARY_DIR}') @@ -100,6 +105,7 @@ endmacro(expand_cc) # Invoke macro to generate various sources ######################################################################## expand_cc(noise_source_X_impl s i f c) +expand_cc(fastnoise_source_X_impl s i f c) expand_cc(sig_source_X_impl s i f c) ######################################################################## @@ -121,7 +127,6 @@ list(APPEND analog_sources fmdet_cf_impl.cc frequency_modulator_fc_impl.cc phase_modulator_fc_impl.cc - plateau_detector_fb_impl.cc pll_carriertracking_cc_impl.cc pll_freqdet_cf_impl.cc pll_refout_cc_impl.cc @@ -133,7 +138,6 @@ list(APPEND analog_sources quadrature_demod_cf_impl.cc rail_ff_impl.cc simple_squelch_cc_impl.cc - sincos.cc ) #Add Windows DLL resource file if using MSVC @@ -153,7 +157,7 @@ ENDIF(MSVC) list(APPEND analog_libs volk - gnuradio-core + gnuradio-runtime gnuradio-filter ${Boost_LIBRARIES} ) @@ -176,15 +180,13 @@ if(ENABLE_TESTING) list(APPEND test_gr_analog_sources ${CMAKE_CURRENT_SOURCE_DIR}/test_gr_analog.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_analog.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_sincos.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_rotator.cc ) add_executable(test-gr-analog ${test_gr_analog_sources}) target_link_libraries( test-gr-analog - gnuradio-core + gnuradio-runtime gnuradio-analog ${Boost_LIBRARIES} ${CPPUNIT_LIBRARIES} @@ -194,11 +196,3 @@ if(ENABLE_TESTING) GR_ADD_TEST(test_gr_analog test-gr-analog) endif(ENABLE_TESTING) - -CHECK_CXX_SOURCE_COMPILES(" - #define _GNU_SOURCE - #include <math.h> - int main(){double x, sin, cos; sincos(x, &sin, &cos); return 0;} - " HAVE_SINCOS -) -GR_ADD_COND_DEF(HAVE_SINCOS) diff --git a/gr-analog/lib/fastnoise_source_X_impl.cc.t b/gr-analog/lib/fastnoise_source_X_impl.cc.t new file mode 100644 index 0000000000..706ddbbf84 --- /dev/null +++ b/gr-analog/lib/fastnoise_source_X_impl.cc.t @@ -0,0 +1,144 @@ +/* -*- c++ -*- */ +/* + * Copyright 2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +/* @WARNING@ */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "@IMPL_NAME@.h" +#include <gr_io_signature.h> +#include <stdexcept> + +namespace gr { + namespace analog { + + @BASE_NAME@::sptr + @BASE_NAME@::make(noise_type_t type, float ampl, long seed, long samples) + { + return gnuradio::get_initial_sptr + (new @IMPL_NAME@(type, ampl, seed, samples)); + } + + @IMPL_NAME@::@IMPL_NAME@(noise_type_t type, float ampl, long seed, long samples) + : gr_sync_block("@BASE_NAME@", + gr_make_io_signature(0, 0, 0), + gr_make_io_signature(1, 1, sizeof(@TYPE@))), + d_type(type), + d_ampl(ampl), + d_rng(seed) + { + d_samples.resize(samples); + generate(); + } + + @IMPL_NAME@::~@IMPL_NAME@() + { + } + + void + @IMPL_NAME@::set_type(noise_type_t type) + { + gr::thread::scoped_lock l(d_setlock); + d_type = type; + generate(); + } + + void + @IMPL_NAME@::set_amplitude(float ampl) + { + gr::thread::scoped_lock l(d_setlock); + d_ampl = ampl; + generate(); + } + + void + @IMPL_NAME@::generate() + { + int noutput_items = d_samples.size(); + switch(d_type){ +#if @IS_COMPLEX@ // complex? + + case GR_UNIFORM: + for(int i = 0; i < noutput_items; i++) + d_samples[i] = gr_complex(d_ampl * ((d_rng.ran1() * 2.0) - 1.0), + d_ampl * ((d_rng.ran1() * 2.0) - 1.0)); + break; + + case GR_GAUSSIAN: + for(int i = 0; i < noutput_items; i++) + d_samples[i] = d_ampl * d_rng.rayleigh_complex(); + break; + +#else // nope... + + case GR_UNIFORM: + for(int i = 0; i < noutput_items; i++) + d_samples[i] = (@TYPE@)(d_ampl * ((d_rng.ran1() * 2.0) - 1.0)); + break; + + case GR_GAUSSIAN: + for(int i = 0; i < noutput_items; i++) + d_samples[i] = (@TYPE@)(d_ampl * d_rng.gasdev()); + break; + + case GR_LAPLACIAN: + for(int i = 0; i < noutput_items; i++) + d_samples[i] = (@TYPE@)(d_ampl * d_rng.laplacian()); + break; + + case GR_IMPULSE: // FIXME changeable impulse settings + for(int i = 0; i < noutput_items; i++) + d_samples[i] = (@TYPE@)(d_ampl * d_rng.impulse(9)); + break; +#endif + + default: + throw std::runtime_error("invalid type"); + } + } + + int + @IMPL_NAME@::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + gr::thread::scoped_lock l(d_setlock); + + @TYPE@ *out = (@TYPE@*)output_items[0]; + + for(int i=0; i<noutput_items; i++) { +#ifdef __USE_GNU + size_t idx = lrand48() % d_samples.size(); +#else + size_t idx = rand() % d_samples.size(); +#endif + out[i] = d_samples[idx]; + } + + return noutput_items; + } + + } /* namespace analog */ +} /* namespace gr */ + diff --git a/gr-analog/lib/qa_sincos.h b/gr-analog/lib/fastnoise_source_X_impl.h.t index f18e879dd8..3c5dc106a2 100644 --- a/gr-analog/lib/qa_sincos.h +++ b/gr-analog/lib/fastnoise_source_X_impl.h.t @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2012 Free Software Foundation, Inc. + * Copyright 2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,28 +20,42 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _QA_ANALOG_SINCOS_H_ -#define _QA_ANALOG_SINCOS_H_ +// @WARNING@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <analog/@BASE_NAME@.h> +#include <gr_random.h> namespace gr { namespace analog { - class qa_sincos : public CppUnit::TestCase + class @IMPL_NAME@ : public @BASE_NAME@ { - CPPUNIT_TEST_SUITE(qa_sincos); - CPPUNIT_TEST(t1); - CPPUNIT_TEST(t2); - CPPUNIT_TEST_SUITE_END(); - private: - void t1(); - void t2(); + noise_type_t d_type; + float d_ampl; + gr_random d_rng; + std::vector<@TYPE@> d_samples; + + public: + @IMPL_NAME@(noise_type_t type, float ampl, long seed, long samples); + ~@IMPL_NAME@(); + + void set_type(noise_type_t type); + void set_amplitude(float ampl); + void generate(); + + noise_type_t type() const { return d_type; } + float amplitude() const { return d_ampl; } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); }; - } /* namespace analog */ + } /* namespace filter */ } /* namespace gr */ -#endif /* _QA_ANALOG_SINCOS_H_ */ +#endif /* @GUARD_NAME@ */ diff --git a/gr-analog/lib/noise_source_X_impl.cc.t b/gr-analog/lib/noise_source_X_impl.cc.t index 40e2517d2e..7f371b2cfd 100644 --- a/gr-analog/lib/noise_source_X_impl.cc.t +++ b/gr-analog/lib/noise_source_X_impl.cc.t @@ -57,14 +57,14 @@ namespace gr { void @IMPL_NAME@::set_type(noise_type_t type) { - gruel::scoped_lock l(d_setlock); + gr::thread::scoped_lock l(d_setlock); d_type = type; } void @IMPL_NAME@::set_amplitude(float ampl) { - gruel::scoped_lock l(d_setlock); + gr::thread::scoped_lock l(d_setlock); d_ampl = ampl; } @@ -73,7 +73,7 @@ namespace gr { gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - gruel::scoped_lock l(d_setlock); + gr::thread::scoped_lock l(d_setlock); @TYPE@ *out = (@TYPE@*)output_items[0]; diff --git a/gr-analog/lib/plateau_detector_fb_impl.cc b/gr-analog/lib/plateau_detector_fb_impl.cc deleted file mode 100644 index 0d2890bc55..0000000000 --- a/gr-analog/lib/plateau_detector_fb_impl.cc +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_io_signature.h> -#include "plateau_detector_fb_impl.h" - -namespace gr { - namespace analog { - -plateau_detector_fb::sptr -plateau_detector_fb::make(int max_len, float threshold) -{ - return gnuradio::get_initial_sptr (new plateau_detector_fb_impl(max_len, threshold)); -} - -plateau_detector_fb_impl::plateau_detector_fb_impl(int max_len, float threshold) - : gr_sync_block("plateau_detector_fb", - gr_make_io_signature(1, 1, sizeof (float)), - gr_make_io_signature(1, 1, sizeof (char))), - d_max_len(max_len), - d_threshold(threshold) -{} - -plateau_detector_fb_impl::~plateau_detector_fb_impl() -{ -} - -int -plateau_detector_fb_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - int flank_start; - - memset((void *) out, 0x00, noutput_items); - int i; - for (i = 0; i < noutput_items; i++) { - if (in[i] >= d_threshold) { - if (noutput_items-i < 2*d_max_len) { // If we can't finish, come back later - break; - } - flank_start = i; - while (i < noutput_items && in[i] >= d_threshold) - i++; - if ((i - flank_start) > 1) { // 1 Sample is not a plateau - out[flank_start + (i-flank_start)/2] = 1; - i = std::min(i+d_max_len, noutput_items-1); - } - } - } - - return i; -} - - } /* namespace analog */ -} /* namespace gr */ - diff --git a/gr-analog/lib/plateau_detector_fb_impl.h b/gr-analog/lib/plateau_detector_fb_impl.h deleted file mode 100644 index daf1dd56d9..0000000000 --- a/gr-analog/lib/plateau_detector_fb_impl.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_ANALOG_PLATEAU_DETECTOR_FB_IMPL_H -#define INCLUDED_ANALOG_PLATEAU_DETECTOR_FB_IMPL_H - -#include <analog/plateau_detector_fb.h> - -namespace gr { - namespace analog { - -class plateau_detector_fb_impl : public plateau_detector_fb -{ - private: - int d_max_len; - float d_threshold; - - public: - plateau_detector_fb_impl(int max_len, float threshold); - ~plateau_detector_fb_impl(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - } // namespace analog -} // namespace gr - -#endif /* INCLUDED_ANALOG_PLATEAU_DETECTOR_FB_IMPL_H */ - diff --git a/gr-analog/lib/pll_carriertracking_cc_impl.cc b/gr-analog/lib/pll_carriertracking_cc_impl.cc index c53e0f4332..9213a5e681 100644 --- a/gr-analog/lib/pll_carriertracking_cc_impl.cc +++ b/gr-analog/lib/pll_carriertracking_cc_impl.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006,2010-2012 Free Software Foundation, Inc. + * Copyright 2006,2010-2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -50,7 +50,7 @@ namespace gr { : gr_sync_block("pll_carriertracking_cc", gr_make_io_signature(1, 1, sizeof(gr_complex)), gr_make_io_signature(1, 1, sizeof(gr_complex))), - gri_control_loop(loop_bw, max_freq, min_freq), + blocks::control_loop(loop_bw, max_freq, min_freq), d_locksig(0), d_lock_threshold(0), d_squelch_enable(false) { } @@ -130,98 +130,98 @@ namespace gr { void pll_carriertracking_cc_impl::set_loop_bandwidth(float bw) { - gri_control_loop::set_loop_bandwidth(bw); + blocks::control_loop::set_loop_bandwidth(bw); } void pll_carriertracking_cc_impl::set_damping_factor(float df) { - gri_control_loop::set_damping_factor(df); + blocks::control_loop::set_damping_factor(df); } void pll_carriertracking_cc_impl::set_alpha(float alpha) { - gri_control_loop::set_alpha(alpha); + blocks::control_loop::set_alpha(alpha); } void pll_carriertracking_cc_impl::set_beta(float beta) { - gri_control_loop::set_beta(beta); + blocks::control_loop::set_beta(beta); } void pll_carriertracking_cc_impl::set_frequency(float freq) { - gri_control_loop::set_frequency(freq); + blocks::control_loop::set_frequency(freq); } void pll_carriertracking_cc_impl::set_phase(float phase) { - gri_control_loop::set_phase(phase); + blocks::control_loop::set_phase(phase); } void pll_carriertracking_cc_impl::set_min_freq(float freq) { - gri_control_loop::set_min_freq(freq); + blocks::control_loop::set_min_freq(freq); } void pll_carriertracking_cc_impl::set_max_freq(float freq) { - gri_control_loop::set_max_freq(freq); + blocks::control_loop::set_max_freq(freq); } float pll_carriertracking_cc_impl::get_loop_bandwidth() const { - return gri_control_loop::get_loop_bandwidth(); + return blocks::control_loop::get_loop_bandwidth(); } float pll_carriertracking_cc_impl::get_damping_factor() const { - return gri_control_loop::get_damping_factor(); + return blocks::control_loop::get_damping_factor(); } float pll_carriertracking_cc_impl::get_alpha() const { - return gri_control_loop::get_alpha(); + return blocks::control_loop::get_alpha(); } float pll_carriertracking_cc_impl::get_beta() const { - return gri_control_loop::get_beta(); + return blocks::control_loop::get_beta(); } float pll_carriertracking_cc_impl::get_frequency() const { - return gri_control_loop::get_frequency(); + return blocks::control_loop::get_frequency(); } float pll_carriertracking_cc_impl::get_phase() const { - return gri_control_loop::get_phase(); + return blocks::control_loop::get_phase(); } float pll_carriertracking_cc_impl::get_min_freq() const { - return gri_control_loop::get_min_freq(); + return blocks::control_loop::get_min_freq(); } float pll_carriertracking_cc_impl::get_max_freq() const { - return gri_control_loop::get_max_freq(); + return blocks::control_loop::get_max_freq(); } } /* namespace analog */ diff --git a/gr-analog/lib/pll_carriertracking_cc_impl.h b/gr-analog/lib/pll_carriertracking_cc_impl.h index d67223db82..c809736709 100644 --- a/gr-analog/lib/pll_carriertracking_cc_impl.h +++ b/gr-analog/lib/pll_carriertracking_cc_impl.h @@ -24,13 +24,11 @@ #define INCLUDED_ANALOG_PLL_CARRIERTRACKING_CC_IMPL_H #include <analog/pll_carriertracking_cc.h> -#include <gri_control_loop.h> namespace gr { namespace analog { - class pll_carriertracking_cc_impl - : public pll_carriertracking_cc, public gri_control_loop + class pll_carriertracking_cc_impl : public pll_carriertracking_cc { private: float d_locksig,d_lock_threshold; diff --git a/gr-analog/lib/pll_freqdet_cf_impl.cc b/gr-analog/lib/pll_freqdet_cf_impl.cc index 27e8d02aa4..9e55d9bedb 100644 --- a/gr-analog/lib/pll_freqdet_cf_impl.cc +++ b/gr-analog/lib/pll_freqdet_cf_impl.cc @@ -47,7 +47,7 @@ namespace gr { : gr_sync_block("pll_freqdet_cf", gr_make_io_signature(1, 1, sizeof(gr_complex)), gr_make_io_signature(1, 1, sizeof(float))), - gri_control_loop(loop_bw, max_freq, min_freq) + blocks::control_loop(loop_bw, max_freq, min_freq) { } @@ -100,98 +100,98 @@ namespace gr { void pll_freqdet_cf_impl::set_loop_bandwidth(float bw) { - gri_control_loop::set_loop_bandwidth(bw); + blocks::control_loop::set_loop_bandwidth(bw); } void pll_freqdet_cf_impl::set_damping_factor(float df) { - gri_control_loop::set_damping_factor(df); + blocks::control_loop::set_damping_factor(df); } void pll_freqdet_cf_impl::set_alpha(float alpha) { - gri_control_loop::set_alpha(alpha); + blocks::control_loop::set_alpha(alpha); } void pll_freqdet_cf_impl::set_beta(float beta) { - gri_control_loop::set_beta(beta); + blocks::control_loop::set_beta(beta); } void pll_freqdet_cf_impl::set_frequency(float freq) { - gri_control_loop::set_frequency(freq); + blocks::control_loop::set_frequency(freq); } void pll_freqdet_cf_impl::set_phase(float phase) { - gri_control_loop::set_phase(phase); + blocks::control_loop::set_phase(phase); } void pll_freqdet_cf_impl::set_min_freq(float freq) { - gri_control_loop::set_min_freq(freq); + blocks::control_loop::set_min_freq(freq); } void pll_freqdet_cf_impl::set_max_freq(float freq) { - gri_control_loop::set_max_freq(freq); + blocks::control_loop::set_max_freq(freq); } float pll_freqdet_cf_impl::get_loop_bandwidth() const { - return gri_control_loop::get_loop_bandwidth(); + return blocks::control_loop::get_loop_bandwidth(); } float pll_freqdet_cf_impl::get_damping_factor() const { - return gri_control_loop::get_damping_factor(); + return blocks::control_loop::get_damping_factor(); } float pll_freqdet_cf_impl::get_alpha() const { - return gri_control_loop::get_alpha(); + return blocks::control_loop::get_alpha(); } float pll_freqdet_cf_impl::get_beta() const { - return gri_control_loop::get_beta(); + return blocks::control_loop::get_beta(); } float pll_freqdet_cf_impl::get_frequency() const { - return gri_control_loop::get_frequency(); + return blocks::control_loop::get_frequency(); } float pll_freqdet_cf_impl::get_phase() const { - return gri_control_loop::get_phase(); + return blocks::control_loop::get_phase(); } float pll_freqdet_cf_impl::get_min_freq() const { - return gri_control_loop::get_min_freq(); + return blocks::control_loop::get_min_freq(); } float pll_freqdet_cf_impl::get_max_freq() const { - return gri_control_loop::get_max_freq(); + return blocks::control_loop::get_max_freq(); } } /* namespace analog */ diff --git a/gr-analog/lib/pll_freqdet_cf_impl.h b/gr-analog/lib/pll_freqdet_cf_impl.h index 7acf53ebbf..3170d819b6 100644 --- a/gr-analog/lib/pll_freqdet_cf_impl.h +++ b/gr-analog/lib/pll_freqdet_cf_impl.h @@ -24,13 +24,11 @@ #define INCLUDED_ANALOG_PLL_FREQDET_CF_IMPL_H #include <analog/pll_freqdet_cf.h> -#include <gri_control_loop.h> namespace gr { namespace analog { - class pll_freqdet_cf_impl : - public pll_freqdet_cf, public gri_control_loop + class pll_freqdet_cf_impl : public pll_freqdet_cf { private: float phase_detector(gr_complex sample,float ref_phase); diff --git a/gr-analog/lib/pll_refout_cc_impl.cc b/gr-analog/lib/pll_refout_cc_impl.cc index b94e3660a3..3f0ccc7df5 100644 --- a/gr-analog/lib/pll_refout_cc_impl.cc +++ b/gr-analog/lib/pll_refout_cc_impl.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2010-2012 Free Software Foundation, Inc. + * Copyright 2004,2010-2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -48,7 +48,7 @@ namespace gr { : gr_sync_block("pll_refout_cc", gr_make_io_signature(1, 1, sizeof(gr_complex)), gr_make_io_signature(1, 1, sizeof(gr_complex))), - gri_control_loop(loop_bw, max_freq, min_freq) + blocks::control_loop(loop_bw, max_freq, min_freq) { } @@ -103,98 +103,98 @@ namespace gr { void pll_refout_cc_impl::set_loop_bandwidth(float bw) { - gri_control_loop::set_loop_bandwidth(bw); + blocks::control_loop::set_loop_bandwidth(bw); } void pll_refout_cc_impl::set_damping_factor(float df) { - gri_control_loop::set_damping_factor(df); + blocks::control_loop::set_damping_factor(df); } void pll_refout_cc_impl::set_alpha(float alpha) { - gri_control_loop::set_alpha(alpha); + blocks::control_loop::set_alpha(alpha); } void pll_refout_cc_impl::set_beta(float beta) { - gri_control_loop::set_beta(beta); + blocks::control_loop::set_beta(beta); } void pll_refout_cc_impl::set_frequency(float freq) { - gri_control_loop::set_frequency(freq); + blocks::control_loop::set_frequency(freq); } void pll_refout_cc_impl::set_phase(float phase) { - gri_control_loop::set_phase(phase); + blocks::control_loop::set_phase(phase); } void pll_refout_cc_impl::set_min_freq(float freq) { - gri_control_loop::set_min_freq(freq); + blocks::control_loop::set_min_freq(freq); } void pll_refout_cc_impl::set_max_freq(float freq) { - gri_control_loop::set_max_freq(freq); + blocks::control_loop::set_max_freq(freq); } float pll_refout_cc_impl::get_loop_bandwidth() const { - return gri_control_loop::get_loop_bandwidth(); + return blocks::control_loop::get_loop_bandwidth(); } float pll_refout_cc_impl::get_damping_factor() const { - return gri_control_loop::get_damping_factor(); + return blocks::control_loop::get_damping_factor(); } float pll_refout_cc_impl::get_alpha() const { - return gri_control_loop::get_alpha(); + return blocks::control_loop::get_alpha(); } float pll_refout_cc_impl::get_beta() const { - return gri_control_loop::get_beta(); + return blocks::control_loop::get_beta(); } float pll_refout_cc_impl::get_frequency() const { - return gri_control_loop::get_frequency(); + return blocks::control_loop::get_frequency(); } float pll_refout_cc_impl::get_phase() const { - return gri_control_loop::get_phase(); + return blocks::control_loop::get_phase(); } float pll_refout_cc_impl::get_min_freq() const { - return gri_control_loop::get_min_freq(); + return blocks::control_loop::get_min_freq(); } float pll_refout_cc_impl::get_max_freq() const { - return gri_control_loop::get_max_freq(); + return blocks::control_loop::get_max_freq(); } } /* namespace analog */ diff --git a/gr-analog/lib/pll_refout_cc_impl.h b/gr-analog/lib/pll_refout_cc_impl.h index 9e8ae286b1..1734b6e138 100644 --- a/gr-analog/lib/pll_refout_cc_impl.h +++ b/gr-analog/lib/pll_refout_cc_impl.h @@ -24,13 +24,11 @@ #define INCLUDED_ANALOG_PLL_REFOUT_CC_IMPL_H #include <analog/pll_refout_cc.h> -#include <gri_control_loop.h> namespace gr { namespace analog { - class pll_refout_cc_impl - : public pll_refout_cc, public gri_control_loop + class pll_refout_cc_impl : public pll_refout_cc { private: float mod_2pi (float in); diff --git a/gr-analog/lib/qa_analog.cc b/gr-analog/lib/qa_analog.cc index c3d51863bd..c7c975a3e5 100644 --- a/gr-analog/lib/qa_analog.cc +++ b/gr-analog/lib/qa_analog.cc @@ -26,16 +26,11 @@ */ #include <qa_analog.h> -#include <qa_sincos.h> -#include <qa_rotator.h> CppUnit::TestSuite * qa_gr_analog::suite() { CppUnit::TestSuite *s = new CppUnit::TestSuite("gr-analog"); - s->addTest(gr::analog::qa_sincos::suite()); - s->addTest(gr::analog::qa_rotator::suite()); - return s; } diff --git a/gr-analog/lib/qa_analog.h b/gr-analog/lib/qa_analog.h index 458861cc91..b66b62b5fe 100644 --- a/gr-analog/lib/qa_analog.h +++ b/gr-analog/lib/qa_analog.h @@ -23,7 +23,7 @@ #ifndef _QA_GR_ANALOG_H_ #define _QA_GR_ANALOG_H_ -#include <gruel/attributes.h> +#include <attributes.h> #include <cppunit/TestSuite.h> //! collect all the tests for the gr-analog directory diff --git a/gr-analog/lib/qa_rotator.cc b/gr-analog/lib/qa_rotator.cc deleted file mode 100644 index b722f32c43..0000000000 --- a/gr-analog/lib/qa_rotator.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gruel/attributes.h> -#include <cppunit/TestAssert.h> -#include <qa_rotator.h> -#include <analog/rotator.h> -#include <stdio.h> -#include <cmath> -#include <gr_expj.h> - -namespace gr { - namespace analog { - - // error vector magnitude - __GR_ATTR_UNUSED static float - error_vector_mag(gr_complex a, gr_complex b) - { - return abs(a-b); - } - - void - qa_rotator::t1() - { - static const unsigned int N = 100000; - - rotator r; - - double phase_incr = 2*M_PI / 1003; - double phase = 0; - - // Old code: We increment then return the rotated value, thus we - // need to start one tick back - // r.set_phase(gr_complex(1,0) * conj(gr_expj(phase_incr))); - - r.set_phase(gr_complex(1,0)); - r.set_phase_incr(gr_expj(phase_incr)); - - for(unsigned i = 0; i < N; i++) { - gr_complex expected = gr_expj(phase); - gr_complex actual = r.rotate(gr_complex(1, 0)); - -#if 0 - float evm = error_vector_mag(expected, actual); - printf("[%6d] expected: (%8.6f, %8.6f) actual: (%8.6f, %8.6f) evm: %8.6f\n", - i, expected.real(), expected.imag(), actual.real(), actual.imag(), evm); -#endif - - CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected, actual, 0.0001); - - phase += phase_incr; - if(phase >= 2*M_PI) - phase -= 2*M_PI; - } - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/qa_rotator.h b/gr-analog/lib/qa_rotator.h deleted file mode 100644 index a22e41ec26..0000000000 --- a/gr-analog/lib/qa_rotator.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _QA_ANALOG_ROTATOR_H_ -#define _QA_ANALOG_ROTATOR_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -namespace gr { - namespace analog { - - class qa_rotator : public CppUnit::TestCase - { - CPPUNIT_TEST_SUITE(qa_rotator); - CPPUNIT_TEST(t1); - CPPUNIT_TEST_SUITE_END(); - - private: - void t1(); - }; - - } /* namespace analog */ -} /* namespace gr */ - -#endif /* _QA_ANALOG_ROTATOR_H_ */ diff --git a/gr-analog/lib/qa_sincos.cc b/gr-analog/lib/qa_sincos.cc deleted file mode 100644 index 62642c1171..0000000000 --- a/gr-analog/lib/qa_sincos.cc +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <qa_sincos.h> -#include <analog/sincos.h> -#include <gruel/attributes.h> -#include <cppunit/TestAssert.h> -#include <cmath> - -namespace gr { - namespace analog { - - void - qa_sincos::t1() - { - static const unsigned int N = 1000; - double c_sin, c_cos; - double gr_sin, gr_cos; - - for(unsigned i = 0; i < N; i++) { - double x = i/100.0; - c_sin = sin(x); - c_cos = cos(x); - - analog::sincos(x, &gr_sin, &gr_cos); - - CPPUNIT_ASSERT_DOUBLES_EQUAL(c_sin, gr_sin, 0.0001); - CPPUNIT_ASSERT_DOUBLES_EQUAL(c_cos, gr_cos, 0.0001); - } - } - - void - qa_sincos::t2() - { - static const unsigned int N = 1000; - float c_sin, c_cos; - float gr_sin, gr_cos; - - for(unsigned i = 0; i < N; i++) { - float x = i/100.0; - c_sin = sinf(x); - c_cos = cosf(x); - - analog::sincosf(x, &gr_sin, &gr_cos); - - CPPUNIT_ASSERT_DOUBLES_EQUAL(c_sin, gr_sin, 0.0001); - CPPUNIT_ASSERT_DOUBLES_EQUAL(c_cos, gr_cos, 0.0001); - } - } - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/sig_source_X_impl.cc.t b/gr-analog/lib/sig_source_X_impl.cc.t index 60653dc1bb..ad8b7e4b0c 100644 --- a/gr-analog/lib/sig_source_X_impl.cc.t +++ b/gr-analog/lib/sig_source_X_impl.cc.t @@ -211,7 +211,7 @@ namespace gr { #endif default: - throw std::runtime_error("gr_sig_source: invalid waveform"); + throw std::runtime_error("analog::sig_source: invalid waveform"); } return noutput_items; diff --git a/gr-analog/lib/sincos.cc b/gr-analog/lib/sincos.cc deleted file mode 100644 index 14ceeb3a29..0000000000 --- a/gr-analog/lib/sincos.cc +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE // ask for GNU extensions if available -#endif - -#include <analog/sincos.h> -#include <math.h> - -namespace gr { - namespace analog { - -// ---------------------------------------------------------------- - -#if defined (HAVE_SINCOS) - - void - sincos(double x, double *sinx, double *cosx) - { - ::sincos(x, sinx, cosx); - } - -#else - - void - sincos(double x, double *sinx, double *cosx) - { - *sinx = sin(x); - *cosx = cos(x); - } - -#endif - -// ---------------------------------------------------------------- - -#if defined (HAVE_SINCOSF) - - void - sincosf(float x, float *sinx, float *cosx) - { - sincosf(x, sinx, cosx); - } - -#elif defined (HAVE_SINF) && defined (HAVE_COSF) - - void - sincosf(float x, float *sinx, float *cosx) - { - *sinx = sinf(x); - *cosx = cosf(x); - } - -#else - - void - sincosf(float x, float *sinx, float *cosx) - { - *sinx = sin(x); - *cosx = cos(x); - } - -#endif - - } /* namespace analog */ -} /* namespace gr */ diff --git a/gr-analog/lib/test_gr_analog.cc b/gr-analog/lib/test_gr_analog.cc index 00d6242699..95ee3aa8cb 100644 --- a/gr-analog/lib/test_gr_analog.cc +++ b/gr-analog/lib/test_gr_analog.cc @@ -20,6 +20,10 @@ * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <cppunit/TextTestRunner.h> #include <cppunit/XmlOutputter.h> |