diff options
Diffstat (limited to 'gr-analog/include/gnuradio/analog')
34 files changed, 2512 insertions, 0 deletions
diff --git a/gr-analog/include/gnuradio/analog/CMakeLists.txt b/gr-analog/include/gnuradio/analog/CMakeLists.txt new file mode 100644 index 0000000000..0343abcd85 --- /dev/null +++ b/gr-analog/include/gnuradio/analog/CMakeLists.txt @@ -0,0 +1,113 @@ +# 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. + +######################################################################## +# generate helper scripts to expand templated files +######################################################################## +include(GrPython) + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py " +#!${PYTHON_EXECUTABLE} + +import sys, os, re +sys.path.append('${GR_RUNTIME_PYTHONPATH}') +os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' +os.chdir('${CMAKE_CURRENT_BINARY_DIR}') + +if __name__ == '__main__': + import build_utils + root, inp = sys.argv[1:3] + for sig in sys.argv[3:]: + name = re.sub ('X+', sig, root) + d = build_utils.standard_dict2(name, sig, 'analog') + build_utils.expand_template(d, inp) + +") + +macro(expand_h root) + #make a list of all the generated files + unset(expanded_files_h) + foreach(sig ${ARGN}) + string(REGEX REPLACE "X+" ${sig} name ${root}) + list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h) + endforeach(sig) + + #create a command to generate the files + add_custom_command( + OUTPUT ${expanded_files_h} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t + COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} + ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py + ${root} ${root}.h.t ${ARGN} + ) + + #install rules for the generated h files + list(APPEND generated_includes ${expanded_files_h}) +endmacro(expand_h) + +######################################################################## +# Invoke macro to generate various sources +####################################################################### +expand_h(noise_source_X s i f c) +expand_h(fastnoise_source_X s i f c) +expand_h(sig_source_X s i f c) + +add_custom_target(analog_generated_includes DEPENDS + ${generated_includes} +) + +######################################################################## +# Install header files +######################################################################## +install(FILES + ${generated_includes} + api.h + cpm.h + noise_type.h + agc.h + agc2.h + noise_type.h + squelch_base_ff.h + agc_cc.h + agc_ff.h + agc2_cc.h + agc2_ff.h + cpfsk_bc.h + ctcss_squelch_ff.h + dpll_bb.h + feedforward_agc_cc.h + fmdet_cf.h + frequency_modulator_fc.h + phase_modulator_fc.h + pll_carriertracking_cc.h + pll_freqdet_cf.h + pll_refout_cc.h + probe_avg_mag_sqrd_c.h + probe_avg_mag_sqrd_cf.h + probe_avg_mag_sqrd_f.h + pwr_squelch_cc.h + pwr_squelch_ff.h + quadrature_demod_cf.h + rail_ff.h + sig_source_waveform.h + simple_squelch_cc.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/analog + COMPONENT "analog_devel" +) + diff --git a/gr-analog/include/gnuradio/analog/agc.h b/gr-analog/include/gnuradio/analog/agc.h new file mode 100644 index 0000000000..ca6125082f --- /dev/null +++ b/gr-analog/include/gnuradio/analog/agc.h @@ -0,0 +1,154 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,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_AGC_H +#define INCLUDED_ANALOG_AGC_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/gr_complex.h> +#include <math.h> + +namespace gr { + namespace analog { + namespace kernel { + + /*! + * \brief high performance Automatic Gain Control class for complex signals. + * \ingroup level_controllers_blk + * + * \details + * For Power the absolute value of the complex number is used. + */ + class ANALOG_API agc_cc + { + public: + /*! + * Construct a complex value AGC loop implementation object. + * + * \param rate the update rate of the loop. + * \param reference reference value to adjust signal power to. + * \param gain initial gain value. + * \param max_gain maximum gain value (0 for unlimited). + */ + agc_cc(float rate = 1e-4, float reference = 1.0, + float gain = 1.0, float max_gain = 0.0) + : _rate(rate), _reference(reference), + _gain(gain), _max_gain(max_gain) {}; + + virtual ~agc_cc() {}; + + float rate() const { return _rate; } + float reference() const { return _reference; } + float gain() const { return _gain; } + float max_gain() const { return _max_gain; } + + void set_rate(float rate) { _rate = rate; } + void set_reference(float reference) { _reference = reference; } + void set_gain(float gain) { _gain = gain; } + void set_max_gain(float max_gain) { _max_gain = max_gain; } + + gr_complex scale(gr_complex input) + { + gr_complex output = input * _gain; + + _gain += _rate * (_reference - sqrt(output.real()*output.real() + + output.imag()*output.imag())); + if(_max_gain > 0.0 && _gain > _max_gain) { + _gain = _max_gain; + } + return output; + } + + void scaleN(gr_complex output[], const gr_complex input[], unsigned n) + { + for(unsigned i = 0; i < n; i++) { + output[i] = scale (input[i]); + } + } + + protected: + float _rate; // adjustment rate + float _reference; // reference value + float _gain; // current gain + float _max_gain; // max allowable gain + }; + + /*! + * \brief high performance Automatic Gain Control class for float signals. + * + * Power is approximated by absolute value + */ + class ANALOG_API agc_ff + { + public: + /*! + * Construct a floating point value AGC loop implementation object. + * + * \param rate the update rate of the loop. + * \param reference reference value to adjust signal power to. + * \param gain initial gain value. + * \param max_gain maximum gain value (0 for unlimited). + */ + agc_ff(float rate = 1e-4, float reference = 1.0, + float gain = 1.0, float max_gain = 0.0) + : _rate(rate), _reference(reference), _gain(gain), + _max_gain(max_gain) {}; + + ~agc_ff() {}; + + float rate () const { return _rate; } + float reference () const { return _reference; } + float gain () const { return _gain; } + float max_gain () const { return _max_gain; } + + void set_rate (float rate) { _rate = rate; } + void set_reference (float reference) { _reference = reference; } + void set_gain (float gain) { _gain = gain; } + void set_max_gain (float max_gain) { _max_gain = max_gain; } + + float scale (float input) + { + float output = input * _gain; + _gain += (_reference - fabsf (output)) * _rate; + if(_max_gain > 0.0 && _gain > _max_gain) + _gain = _max_gain; + return output; + } + + void scaleN(float output[], const float input[], unsigned n) + { + for(unsigned i = 0; i < n; i++) + output[i] = scale (input[i]); + } + + protected: + float _rate; // adjustment rate + float _reference; // reference value + float _gain; // current gain + float _max_gain; // maximum gain + }; + + } /* namespace kernel */ + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_AGC_H */ diff --git a/gr-analog/include/gnuradio/analog/agc2.h b/gr-analog/include/gnuradio/analog/agc2.h new file mode 100644 index 0000000000..225adc4410 --- /dev/null +++ b/gr-analog/include/gnuradio/analog/agc2.h @@ -0,0 +1,180 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,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_AGC2_H +#define INCLUDED_ANALOG_AGC2_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/gr_complex.h> +#include <math.h> + +namespace gr { + namespace analog { + namespace kernel { + + /*! + * \brief high performance Automatic Gain Control class + * \ingroup level_controllers_blk + * + * \details + * For Power the absolute value of the complex number is used. + */ + class ANALOG_API agc2_cc + { + public: + /*! + * Construct a comple value AGC loop implementation object. + * + * \param attack_rate the update rate of the loop when in attack mode. + * \param decay_rate the update rate of the loop when in decay mode. + * \param reference reference value to adjust signal power to. + * \param gain initial gain value. + * \param max_gain maximum gain value (0 for unlimited). + */ + 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) + : _attack_rate(attack_rate), _decay_rate(decay_rate), + _reference(reference), + _gain(gain), _max_gain(max_gain) {}; + + float decay_rate() const { return _decay_rate; } + float attack_rate() const { return _attack_rate; } + float reference() const { return _reference; } + float gain() const { return _gain; } + float max_gain() const { return _max_gain; } + + void set_decay_rate(float rate) { _decay_rate = rate; } + void set_attack_rate(float rate) { _attack_rate = rate; } + void set_reference(float reference) { _reference = reference; } + void set_gain(float gain) { _gain = gain; } + void set_max_gain(float max_gain) { _max_gain = max_gain; } + + gr_complex scale(gr_complex input) + { + gr_complex output = input * _gain; + + float tmp = -_reference + sqrt(output.real()*output.real() + + output.imag()*output.imag()); + float rate = _decay_rate; + if((tmp) > _gain) { + rate = _attack_rate; + } + _gain -= tmp*rate; + + // Not sure about this; will blow up if _gain < 0 (happens + // when rates are too high), but is this the solution? + if(_gain < 0.0) + _gain = 10e-5; + + if(_max_gain > 0.0 && _gain > _max_gain) { + _gain = _max_gain; + } + return output; + } + + void scaleN(gr_complex output[], const gr_complex input[], unsigned n) + { + for(unsigned i = 0; i < n; i++) + output[i] = scale (input[i]); + } + + protected: + float _attack_rate; // attack rate for fast changing signals + float _decay_rate; // decay rate for slow changing signals + float _reference; // reference value + float _gain; // current gain + float _max_gain; // max allowable gain + }; + + + class ANALOG_API agc2_ff + { + public: + /*! + * Construct a floating point value AGC loop implementation object. + * + * \param attack_rate the update rate of the loop when in attack mode. + * \param decay_rate the update rate of the loop when in decay mode. + * \param reference reference value to adjust signal power to. + * \param gain initial gain value. + * \param max_gain maximum gain value (0 for unlimited). + */ + 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) + : _attack_rate(attack_rate), _decay_rate(decay_rate), + _reference(reference), + _gain(gain), _max_gain(max_gain) {}; + + float attack_rate() const { return _attack_rate; } + float decay_rate() const { return _decay_rate; } + float reference() const { return _reference; } + float gain() const { return _gain; } + float max_gain() const { return _max_gain; } + + void set_attack_rate(float rate) { _attack_rate = rate; } + void set_decay_rate(float rate) { _decay_rate = rate; } + void set_reference(float reference) { _reference = reference; } + void set_gain(float gain) { _gain = gain; } + void set_max_gain(float max_gain) { _max_gain = max_gain; } + + float scale(float input) + { + float output = input * _gain; + + float tmp = (fabsf(output)) - _reference; + float rate = _decay_rate; + if(fabsf(tmp) > _gain) { + rate = _attack_rate; + } + _gain -= tmp*rate; + + // Not sure about this + if(_gain < 0.0) + _gain = 10e-5; + + if(_max_gain > 0.0 && _gain > _max_gain) { + _gain = _max_gain; + } + return output; + } + + void scaleN(float output[], const float input[], unsigned n) + { + for(unsigned i = 0; i < n; i++) + output[i] = scale (input[i]); + } + + protected: + float _attack_rate; // attack_rate for fast changing signals + float _decay_rate; // decay rate for slow changing signals + float _reference; // reference value + float _gain; // current gain + float _max_gain; // maximum gain + }; + + } /* namespace kernel */ + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_AGC2_H */ diff --git a/gr-analog/include/gnuradio/analog/agc2_cc.h b/gr-analog/include/gnuradio/analog/agc2_cc.h new file mode 100644 index 0000000000..76a5263183 --- /dev/null +++ b/gr-analog/include/gnuradio/analog/agc2_cc.h @@ -0,0 +1,76 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,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_AGC2_CC_H +#define INCLUDED_ANALOG_AGC2_CC_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/analog/agc2.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief high performance Automatic Gain Control class with + * attack and decay rates. + * \ingroup level_controllers_blk + * + * \details + * For Power the absolute value of the complex number is used. + */ + class ANALOG_API agc2_cc : virtual public sync_block + { + public: + // gr::analog::agc2_cc::sptr + typedef boost::shared_ptr<agc2_cc> sptr; + + /*! + * Build a complex value AGC loop block with attack and decay rates. + * + * \param attack_rate the update rate of the loop when in attack mode. + * \param decay_rate the update rate of the loop when in decay mode. + * \param reference reference value to adjust signal power to. + * \param gain initial gain value. + * \param max_gain maximum gain value (0 for unlimited). + */ + static sptr make(float attack_rate = 1e-1, float decay_rate = 1e-2, + float reference = 1.0, + float gain = 1.0, float max_gain = 0.0); + + virtual float attack_rate() const = 0; + virtual float decay_rate() const = 0; + virtual float reference() const = 0; + virtual float gain() const = 0; + virtual float max_gain() const = 0; + + virtual void set_attack_rate(float rate) = 0; + virtual void set_decay_rate(float rate) = 0; + virtual void set_reference(float reference) = 0; + virtual void set_gain(float gain) = 0; + virtual void set_max_gain(float max_gain) = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_AGC2_CC_H */ diff --git a/gr-analog/include/gnuradio/analog/agc2_ff.h b/gr-analog/include/gnuradio/analog/agc2_ff.h new file mode 100644 index 0000000000..740d795e1d --- /dev/null +++ b/gr-analog/include/gnuradio/analog/agc2_ff.h @@ -0,0 +1,76 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2006,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_AGC2_FF_H +#define INCLUDED_ANALOG_AGC2_FF_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/analog/agc2.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief high performance Automatic Gain Control class with + * attack and decay rates. + * \ingroup level_controllers_blk + * + * \details + * Power is approximated by absolute value + */ + class ANALOG_API agc2_ff : virtual public sync_block + { + public: + // gr::analog::agc2_ff::sptr + typedef boost::shared_ptr<agc2_ff> sptr; + + /*! + * Build a floating point AGC loop block with attack and decay rates. + * + * \param attack_rate the update rate of the loop when in attack mode. + * \param decay_rate the update rate of the loop when in decay mode. + * \param reference reference value to adjust signal power to. + * \param gain initial gain value. + * \param max_gain maximum gain value (0 for unlimited). + */ + static sptr make(float attack_rate = 1e-1, float decay_rate = 1e-2, + float reference = 1.0, + float gain = 1.0, float max_gain = 0.0); + + virtual float attack_rate() const = 0; + virtual float decay_rate() const = 0; + virtual float reference() const = 0; + virtual float gain() const = 0; + virtual float max_gain() const = 0; + + virtual void set_attack_rate(float rate) = 0; + virtual void set_decay_rate(float rate) = 0; + virtual void set_reference(float reference) = 0; + virtual void set_gain(float gain) = 0; + virtual void set_max_gain(float max_gain) = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_AGC2_FF_H */ diff --git a/gr-analog/include/gnuradio/analog/agc_cc.h b/gr-analog/include/gnuradio/analog/agc_cc.h new file mode 100644 index 0000000000..8319995960 --- /dev/null +++ b/gr-analog/include/gnuradio/analog/agc_cc.h @@ -0,0 +1,71 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,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_AGC_CC_H +#define INCLUDED_ANALOG_AGC_CC_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/analog/agc.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief high performance Automatic Gain Control class + * \ingroup level_controllers_blk + * + * \details + * For Power the absolute value of the complex number is used. + */ + class ANALOG_API agc_cc : virtual public sync_block + { + public: + // gr::analog::agc_cc::sptr + typedef boost::shared_ptr<agc_cc> sptr; + + /*! + * Build a complex value AGC loop block. + * + * \param rate the update rate of the loop. + * \param reference reference value to adjust signal power to. + * \param gain initial gain value. + * \param max_gain maximum gain value (0 for unlimited). + */ + static sptr make(float rate = 1e-4, float reference = 1.0, + float gain = 1.0, float max_gain = 0.0); + + virtual float rate() const = 0; + virtual float reference() const = 0; + virtual float gain() const = 0; + virtual float max_gain() const = 0; + + virtual void set_rate(float rate) = 0; + virtual void set_reference(float reference) = 0; + virtual void set_gain(float gain) = 0; + virtual void set_max_gain(float max_gain) = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_AGC_CC_H */ diff --git a/gr-analog/include/gnuradio/analog/agc_ff.h b/gr-analog/include/gnuradio/analog/agc_ff.h new file mode 100644 index 0000000000..d55072889b --- /dev/null +++ b/gr-analog/include/gnuradio/analog/agc_ff.h @@ -0,0 +1,71 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2006,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_AGC_FF_H +#define INCLUDED_ANALOG_AGC_FF_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/analog/agc.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief high performance Automatic Gain Control class + * \ingroup level_controllers_blk + * + * \details + * Power is approximated by absolute value + */ + class ANALOG_API agc_ff : virtual public sync_block + { + public: + // gr::analog::agc_ff::sptr + typedef boost::shared_ptr<agc_ff> sptr; + + /*! + * Build a floating point AGC loop block. + * + * \param rate the update rate of the loop. + * \param reference reference value to adjust signal power to. + * \param gain initial gain value. + * \param max_gain maximum gain value (0 for unlimited). + */ + static sptr make(float rate = 1e-4, float reference = 1.0, + float gain = 1.0, float max_gain = 0.0); + + virtual float rate() const = 0; + virtual float reference() const = 0; + virtual float gain() const = 0; + virtual float max_gain() const = 0; + + virtual void set_rate(float rate) = 0; + virtual void set_reference(float reference) = 0; + virtual void set_gain(float gain) = 0; + virtual void set_max_gain(float max_gain) = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_AGC_FF_H */ diff --git a/gr-analog/include/gnuradio/analog/api.h b/gr-analog/include/gnuradio/analog/api.h new file mode 100644 index 0000000000..01107345e6 --- /dev/null +++ b/gr-analog/include/gnuradio/analog/api.h @@ -0,0 +1,33 @@ +/* + * 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_API_H +#define INCLUDED_ANALOG_API_H + +#include <gnuradio/attributes.h> + +#ifdef gnuradio_analog_EXPORTS +# define ANALOG_API __GR_ATTR_EXPORT +#else +# define ANALOG_API __GR_ATTR_IMPORT +#endif + +#endif /* INCLUDED_ANALOG_API_H */ diff --git a/gr-analog/include/gnuradio/analog/cpfsk_bc.h b/gr-analog/include/gnuradio/analog/cpfsk_bc.h new file mode 100644 index 0000000000..580c387d45 --- /dev/null +++ b/gr-analog/include/gnuradio/analog/cpfsk_bc.h @@ -0,0 +1,59 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2012 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_ANALOG_CPFSK_BC_H +#define INCLUDED_ANALOG_CPFSK_BC_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_interpolator.h> + +namespace gr { + namespace analog { + + /*! + * \brief Perform continuous phase 2-level frequency shift keying modulation + * on an input stream of unpacked bits. + * \ingroup modulators_blk + */ + class ANALOG_API cpfsk_bc : virtual public sync_interpolator + { + public: + // gr::analog::cpfsk_bc::sptr + typedef boost::shared_ptr<cpfsk_bc> sptr; + + /*! + * \brief Make a CPFSK block. + * + * \param k modulation index + * \param ampl output amplitude + * \param samples_per_sym number of output samples per input bit + */ + static sptr make(float k, float ampl, int samples_per_sym); + + virtual void set_amplitude(float amplitude) = 0; + virtual float amplitude() = 0; + virtual float freq() = 0; + virtual float phase() = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_CPFSK_BC_H */ diff --git a/gr-analog/include/gnuradio/analog/cpm.h b/gr-analog/include/gnuradio/analog/cpm.h new file mode 100644 index 0000000000..040f20514a --- /dev/null +++ b/gr-analog/include/gnuradio/analog/cpm.h @@ -0,0 +1,96 @@ +/* -*- c++ -*- */ +/* + * Copyright 2010,2012 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_ANALOG_CPM_H +#define INCLUDED_ANALOG_CPM_H + +#include <gnuradio/analog/api.h> +#include <vector> + +namespace gr { + namespace analog { + + /*! \brief Return the taps for an interpolating FIR filter + * (gr::filter::interp_fir_filter_fff). + */ + class ANALOG_API cpm + { + public: + enum cpm_type { + LRC, + LSRC, + LREC, + TFM, + GAUSSIAN, + GENERIC = 999 + }; + + /*! \brief Return the taps for an interpolating FIR filter + * (gr::filter::interp_fir_filter_fff). + * + * \details + * 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); + }; + } // namespace analog +} // namespace gr + +#endif /* INCLUDED_ANALOG_CPM_H */ + diff --git a/gr-analog/include/gnuradio/analog/ctcss_squelch_ff.h b/gr-analog/include/gnuradio/analog/ctcss_squelch_ff.h new file mode 100644 index 0000000000..f9ecc88a03 --- /dev/null +++ b/gr-analog/include/gnuradio/analog/ctcss_squelch_ff.h @@ -0,0 +1,77 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,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_CTCSS_SQUELCH_FF_H +#define INCLUDED_ANALOG_CTCSS_SQUELCH_FF_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/analog/squelch_base_ff.h> +#include <gnuradio/block.h> + +namespace gr { + namespace analog { + + /*! + * \brief gate or zero output if CTCSS tone not present + * \ingroup level_controllers_blk + */ + class ANALOG_API ctcss_squelch_ff : + public squelch_base_ff, virtual public block + { + protected: + virtual void update_state(const float &in) = 0; + virtual bool mute() const = 0; + + public: + // gr::analog::ctcss_squelch_ff::sptr + typedef boost::shared_ptr<ctcss_squelch_ff> sptr; + + /*! + * \brief Make CTCSS tone squelch block. + * + * \param rate gain of the internal frequency filters. + * \param freq frequency value to use as the squelch tone. + * \param level threshold level for the squelch tone. + * \param len length of the frequency filters. + * \param ramp sets response characteristic. + * \param gate if true, no output if no squelch tone. + * if false, output 0's if no squelch tone. + */ + static sptr make(int rate, float freq, float level, + int len, int ramp, bool gate); + + virtual std::vector<float> squelch_range() const = 0; + virtual float level() const = 0; + virtual void set_level(float level) = 0; + virtual int len() const = 0; + + virtual int ramp() const = 0; + virtual void set_ramp(int ramp) = 0; + virtual bool gate() const = 0; + virtual void set_gate(bool gate) = 0; + virtual bool unmuted() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_CTCSS_SQUELCH_FF_H */ diff --git a/gr-analog/include/gnuradio/analog/dpll_bb.h b/gr-analog/include/gnuradio/analog/dpll_bb.h new file mode 100644 index 0000000000..4f9a6c0dd9 --- /dev/null +++ b/gr-analog/include/gnuradio/analog/dpll_bb.h @@ -0,0 +1,60 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,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_DPLL_BB_H +#define INCLUDED_ANALOG_DPLL_BB_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief Detect the peak of a signal + * \ingroup peak_detectors_blk + * + * \details + * If a peak is detected, this block outputs a 1, + * or it outputs 0's. + */ + class ANALOG_API dpll_bb : virtual public sync_block + { + public: + // gr::analog::dpll_bb::sptr + typedef boost::shared_ptr<dpll_bb> sptr; + + static sptr make(float period, float gain); + + virtual void set_gain(float gain) = 0; + virtual void set_decision_threshold(float thresh) = 0; + + virtual float gain() const = 0; + virtual float freq() const = 0; + virtual float phase() const = 0; + virtual float decision_threshold() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_DPLL_BB_H */ diff --git a/gr-analog/include/gnuradio/analog/fastnoise_source_X.h.t b/gr-analog/include/gnuradio/analog/fastnoise_source_X.h.t new file mode 100644 index 0000000000..c5331fc084 --- /dev/null +++ b/gr-analog/include/gnuradio/analog/fastnoise_source_X.h.t @@ -0,0 +1,70 @@ +/* -*- 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@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/analog/api.h> +#include <gnuradio/analog/noise_type.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief Random number source + * \ingroup source_blk + * + * \details + * Generate random values from different distributions. + * Currently, only Gaussian and uniform are enabled. + */ + class ANALOG_API @BASE_NAME@ : virtual public sync_block + { + public: + // gr::analog::@BASE_NAME@::sptr + typedef boost::shared_ptr<@BASE_NAME@> sptr; + + /*! \brief Make a fast noise source + * \param type the random distribution to use (see gnuradio/analog/noise_type.h) + * \param ampl a scaling factor for the output + * \param seed seed for random generators. Note that for uniform and + * \param samples Number of samples to pre-generate + * Gaussian distributions, this should be a negative number. + */ + static sptr make(noise_type_t type, float ampl, + long seed = 0, long samples=1024*16); + + virtual void set_type(noise_type_t type) = 0; + virtual void set_amplitude(float ampl) = 0; + + virtual noise_type_t type() const = 0; + virtual float amplitude() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + + +#endif /* @GUARD_NAME@ */ diff --git a/gr-analog/include/gnuradio/analog/feedforward_agc_cc.h b/gr-analog/include/gnuradio/analog/feedforward_agc_cc.h new file mode 100644 index 0000000000..5d4abfeedb --- /dev/null +++ b/gr-analog/include/gnuradio/analog/feedforward_agc_cc.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,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_FEEDFORWARD_AGC_CC_H +#define INCLUDED_ANALOG_FEEDFORWARD_AGC_CC_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief Non-causal AGC which computes required gain based on max + * absolute value over nsamples + * \ingroup level_controllers_blk + */ + class ANALOG_API feedforward_agc_cc : virtual public sync_block + { + public: + // gr::analog::feedforward_agc_cc::sptr + typedef boost::shared_ptr<feedforward_agc_cc> sptr; + + /*! + * Build a complex valued feed-forward AGC loop block. + * + * \param nsamples number of samples to look ahead. + * \param reference reference value to adjust signal power to. + */ + static sptr make(int nsamples, float reference); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_FEEDFORWARD_AGC_CC_H */ diff --git a/gr-analog/include/gnuradio/analog/fmdet_cf.h b/gr-analog/include/gnuradio/analog/fmdet_cf.h new file mode 100644 index 0000000000..15749efc4e --- /dev/null +++ b/gr-analog/include/gnuradio/analog/fmdet_cf.h @@ -0,0 +1,71 @@ +/* -*- 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 INCLUDED_ANALOG_FMDET_CF_H +#define INCLUDED_ANALOG_FMDET_CF_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief Implements an IQ slope detector + * + * \details + * input: stream of complex; output: stream of floats + * + * This implements a limiting slope detector. The limiter is in + * the normalization by the magnitude of the sample + */ + class ANALOG_API fmdet_cf : virtual public sync_block + { + public: + // gr::analog::fmdet_cf::sptr + typedef boost::shared_ptr<fmdet_cf> sptr; + + /*! + * \brief Make FM detector block. + * + * \param samplerate sample rate of signal (is not used; to be removed) + * \param freq_low lowest frequency of signal (Hz) + * \param freq_high highest frequency of signal (Hz) + * \param scl scale factor + */ + static sptr make(float samplerate, float freq_low, + float freq_high, float scl); + + virtual void set_scale(float scl) = 0; + virtual void set_freq_range(float freq_low, float freq_high) = 0; + + virtual float freq() const = 0; + virtual float freq_high() const = 0; + virtual float freq_low() const = 0; + virtual float scale() const = 0; + virtual float bias() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_FMDET_CF_H */ diff --git a/gr-analog/include/gnuradio/analog/frequency_modulator_fc.h b/gr-analog/include/gnuradio/analog/frequency_modulator_fc.h new file mode 100644 index 0000000000..d6e2b277fe --- /dev/null +++ b/gr-analog/include/gnuradio/analog/frequency_modulator_fc.h @@ -0,0 +1,59 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_ANALOG_FREQUENCY_MODULATOR_FC_H +#define INCLUDED_ANALOG_FREQUENCY_MODULATOR_FC_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief Frequency modulator block + * \ingroup modulators_blk + * + * \details + * float input; complex baseband output + */ + class ANALOG_API frequency_modulator_fc : virtual public sync_block + { + public: + // gr::analog::frequency_modulator_fc::sptr + typedef boost::shared_ptr<frequency_modulator_fc> sptr; + + /*! + * Build a frequency modulator block. + * + * \param sensitivity radians/sample = amplitude * sensitivity + */ + static sptr make(double sensitivity); + + virtual void set_sensitivity(float sens) = 0; + virtual float sensitivity() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_FREQUENCY_MODULATOR_FC_H */ diff --git a/gr-analog/include/gnuradio/analog/noise_source_X.h.t b/gr-analog/include/gnuradio/analog/noise_source_X.h.t new file mode 100644 index 0000000000..b7b0906c06 --- /dev/null +++ b/gr-analog/include/gnuradio/analog/noise_source_X.h.t @@ -0,0 +1,67 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/analog/api.h> +#include <gnuradio/analog/noise_type.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief Random number source + * \ingroup waveform_generators_blk + * + * \details + * Generate random values from different distributions. + * Currently, only Gaussian and uniform are enabled. + */ + class ANALOG_API @BASE_NAME@ : virtual public sync_block + { + public: + // gr::analog::@BASE_NAME@::sptr + typedef boost::shared_ptr<@BASE_NAME@> sptr; + + /*! Build a noise source + * \param type the random distribution to use (see gnuradio/analog/noise_type.h) + * \param ampl a scaling factor for the output + * \param seed seed for random generators. Note that for uniform and + * Gaussian distributions, this should be a negative number. + */ + static sptr make(noise_type_t type, float ampl, long seed=0); + + virtual void set_type(noise_type_t type) = 0; + virtual void set_amplitude(float ampl) = 0; + + virtual noise_type_t type() const = 0; + virtual float amplitude() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-analog/include/gnuradio/analog/noise_type.h b/gr-analog/include/gnuradio/analog/noise_type.h new file mode 100644 index 0000000000..c3a2146b7e --- /dev/null +++ b/gr-analog/include/gnuradio/analog/noise_type.h @@ -0,0 +1,36 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_ANALOG_NOISE_TYPE_H +#define INCLUDED_ANALOG_NOISE_TYPE_H + +namespace gr { + namespace analog { + + typedef enum { + GR_UNIFORM = 200, GR_GAUSSIAN, GR_LAPLACIAN, GR_IMPULSE + } noise_type_t; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_NOISE_TYPE_H */ diff --git a/gr-analog/include/gnuradio/analog/phase_modulator_fc.h b/gr-analog/include/gnuradio/analog/phase_modulator_fc.h new file mode 100644 index 0000000000..56c39ce3ea --- /dev/null +++ b/gr-analog/include/gnuradio/analog/phase_modulator_fc.h @@ -0,0 +1,64 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2006,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_PHASE_MODULATOR_FC_H +#define INCLUDED_ANALOG_PHASE_MODULATOR_FC_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief Phase modulator block + * \ingroup modulators_blk + * + * \details + * output = complex(cos(in*sensitivity), sin(in*sensitivity)) + * + * Input stream 0: floats + * Ouput stream 0: complex + */ + class ANALOG_API phase_modulator_fc : virtual public sync_block + { + public: + // gr::analog::phase_modulator_fc::sptr + typedef boost::shared_ptr<phase_modulator_fc> sptr; + + /* \brief Make a phase modulator block. + * + * \param sensitivity Phase change sensitivity of input amplitude. + */ + static sptr make(double sensitivity); + + virtual double sensitivity() const = 0; + virtual double phase() const = 0; + + virtual void set_sensitivity(double s) = 0; + virtual void set_phase(double p) = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PHASE_MODULATOR_FC_H */ diff --git a/gr-analog/include/gnuradio/analog/pll_carriertracking_cc.h b/gr-analog/include/gnuradio/analog/pll_carriertracking_cc.h new file mode 100644 index 0000000000..35da29c8af --- /dev/null +++ b/gr-analog/include/gnuradio/analog/pll_carriertracking_cc.h @@ -0,0 +1,92 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2006,2011,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_ANALOG_PLL_CARRIERTRACKING_CC_H +#define INCLUDED_ANALOG_PLL_CARRIERTRACKING_CC_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/blocks/control_loop.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief Implements a PLL which locks to the input frequency and outputs the + * input signal mixed with that carrier. + * \ingroup synchronizers_blk + * + * \details + * Input stream 0: complex + * Output stream 0: complex + * + * This PLL locks onto a [possibly noisy] reference carrier on 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. The loop bandwidth determins the lock range + * and should be set around pi/200 -- 2pi/100. \sa + * pll_freqdet_cf, pll_carriertracking_cc + */ + class ANALOG_API pll_carriertracking_cc + : virtual public sync_block, + virtual public blocks::control_loop + { + public: + // gr::analog::pll_carriertracking_cc::sptr + typedef boost::shared_ptr<pll_carriertracking_cc> sptr; + + /* \brief Make a carrier tracking PLL block. + * + * \param loop_bw: control loop's bandwidth parameter. + * \param max_freq: maximum (normalized) frequency PLL will lock to. + * \param min_freq: minimum (normalized) frequency PLL will lock to. + */ + static sptr make(float loop_bw, float max_freq, float min_freq); + + virtual bool lock_detector(void) = 0; + virtual bool squelch_enable(bool) = 0; + virtual float set_lock_threshold(float) = 0; + + virtual void set_loop_bandwidth(float bw) = 0; + virtual void set_damping_factor(float df) = 0; + virtual void set_alpha(float alpha) = 0; + virtual void set_beta(float beta) = 0; + virtual void set_frequency(float freq) = 0; + virtual void set_phase(float phase) = 0; + virtual void set_min_freq(float freq) = 0; + virtual void set_max_freq(float freq) = 0; + + virtual float get_loop_bandwidth() const = 0; + virtual float get_damping_factor() const = 0; + virtual float get_alpha() const = 0; + virtual float get_beta() const = 0; + virtual float get_frequency() const = 0; + virtual float get_phase() const = 0; + virtual float get_min_freq() const = 0; + virtual float get_max_freq() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PLL_CARRIERTRACKING_CC_H */ diff --git a/gr-analog/include/gnuradio/analog/pll_freqdet_cf.h b/gr-analog/include/gnuradio/analog/pll_freqdet_cf.h new file mode 100644 index 0000000000..1ea7eb97ec --- /dev/null +++ b/gr-analog/include/gnuradio/analog/pll_freqdet_cf.h @@ -0,0 +1,87 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,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 INCLUDED_ANALOG_PLL_FREQDET_CF_H +#define INCLUDED_ANALOG_PLL_FREQDET_CF_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/blocks/control_loop.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief Implements a PLL which locks to the input frequency and outputs + * an estimate of that frequency. Useful for FM Demod. + * \ingroup synchronizers_blk + * + * \details + * Input stream 0: complex + * Output stream 0: float + * + * 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. The loop bandwidth determins the lock range and should be set + * around pi/200 -- 2pi/100. + * \sa pll_refout_cc, pll_carriertracking_cc + */ + class ANALOG_API pll_freqdet_cf + : virtual public sync_block, + virtual public blocks::control_loop + { + public: + // gr::analog::pll_freqdet_cf::sptr + typedef boost::shared_ptr<pll_freqdet_cf> sptr; + + /* \brief Make PLL block that outputs the tracked signal's frequency. + * + * \param loop_bw: control loop's bandwidth parameter. + * \param max_freq: maximum (normalized) frequency PLL will lock to. + * \param min_freq: minimum (normalized) frequency PLL will lock to. + */ + static sptr make(float loop_bw, float max_freq, float min_freq); + + virtual void set_loop_bandwidth(float bw) = 0; + virtual void set_damping_factor(float df) = 0; + virtual void set_alpha(float alpha) = 0; + virtual void set_beta(float beta) = 0; + virtual void set_frequency(float freq) = 0; + virtual void set_phase(float phase) = 0; + virtual void set_min_freq(float freq) = 0; + virtual void set_max_freq(float freq) = 0; + + virtual float get_loop_bandwidth() const = 0; + virtual float get_damping_factor() const = 0; + virtual float get_alpha() const = 0; + virtual float get_beta() const = 0; + virtual float get_frequency() const = 0; + virtual float get_phase() const = 0; + virtual float get_min_freq() const = 0; + virtual float get_max_freq() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PLL_FREQDET_CF_H */ diff --git a/gr-analog/include/gnuradio/analog/pll_refout_cc.h b/gr-analog/include/gnuradio/analog/pll_refout_cc.h new file mode 100644 index 0000000000..29a2f43198 --- /dev/null +++ b/gr-analog/include/gnuradio/analog/pll_refout_cc.h @@ -0,0 +1,70 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2011,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_ANALOG_PLL_REFOUT_CC_H +#define INCLUDED_ANALOG_PLL_REFOUT_CC_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/blocks/control_loop.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief Implements a PLL which locks to the input frequency and outputs a carrier + * \ingroup synchronizers_blk + * + * \details + * Input stream 0: complex + * Output stream 0: complex + * + * This PLL locks onto a [possibly noisy] reference carrier on the + * input and outputs a clean version which is phase and frequency + * aligned to it. + * + * All settings max_freq and min_freq are in terms of radians per + * sample, NOT HERTZ. The loop bandwidth determins the lock range + * and should be set around pi/200 -- 2pi/100. \sa + * pll_freqdet_cf, pll_carriertracking_cc + */ + class ANALOG_API pll_refout_cc + : virtual public sync_block, + virtual public blocks::control_loop + { + public: + // gr::analog::pll_refout_cc::sptr + typedef boost::shared_ptr<pll_refout_cc> sptr; + + /* \brief Make PLL block that outputs the tracked carrier signal. + * + * \param loop_bw: control loop's bandwidth parameter. + * \param max_freq: maximum (normalized) frequency PLL will lock to. + * \param min_freq: minimum (normalized) frequency PLL will lock to. + */ + static sptr make(float loop_bw, float max_freq, float min_freq); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PLL_REFOUT_CC_H */ diff --git a/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_c.h b/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_c.h new file mode 100644 index 0000000000..fe67f3ad59 --- /dev/null +++ b/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_c.h @@ -0,0 +1,68 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2006,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_PROBE_AVG_MAG_SQRD_C_H +#define INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_C_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief compute avg magnitude squared. + * \ingroup measurement_tools_blk + * + * \details + * Input stream 0: complex + * + * Compute a running average of the magnitude squared of the the + * input. The level and indication as to whether the level exceeds + * threshold can be retrieved with the level and unmuted + * accessors. + */ + class ANALOG_API probe_avg_mag_sqrd_c : virtual public sync_block + { + public: + // gr::analog::probe_avg_mag_sqrd_c::sptr + typedef boost::shared_ptr<probe_avg_mag_sqrd_c> sptr; + + /*! + * \brief Make a complex sink that computes avg magnitude squared. + * + * \param threshold_db Threshold for muting. + * \param alpha Gain parameter for the running average filter. + */ + static sptr make(double threshold_db, double alpha = 0.0001); + + virtual bool unmuted() const = 0; + virtual double level() const = 0; + virtual double threshold() const = 0; + + virtual void set_alpha(double alpha) = 0; + virtual void set_threshold(double decibels) = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_C_H */ diff --git a/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_cf.h b/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_cf.h new file mode 100644 index 0000000000..d491321e68 --- /dev/null +++ b/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_cf.h @@ -0,0 +1,70 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2006,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_PROBE_AVG_MAG_SQRD_CF_H +#define INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_CF_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief compute avg magnitude squared. + * \ingroup measurement_tools_blk + * + * \details + * Input stream 0: complex + * Output stream 0: float + * + * Compute a running average of the magnitude squared of the the + * input. The level and indication as to whether the level exceeds + * threshold can be retrieved with the level and unmuted + * accessors. + */ + class ANALOG_API probe_avg_mag_sqrd_cf : virtual public sync_block + { + public: + // gr::analog::probe_avg_mag_sqrd_cf::sptr + typedef boost::shared_ptr<probe_avg_mag_sqrd_cf> sptr; + + /*! + * \brief Make a block that computes avg magnitude squared. + * + * \param threshold_db Threshold for muting. + * \param alpha Gain parameter for the running average filter. + */ + static sptr make(double threshold_db, double alpha = 0.0001); + + virtual bool unmuted() const = 0; + virtual double level() const = 0; + virtual double threshold() const = 0; + + virtual void set_alpha(double alpha) = 0; + virtual void set_threshold(double decibels) = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_CF_H */ diff --git a/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_f.h b/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_f.h new file mode 100644 index 0000000000..960480b962 --- /dev/null +++ b/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_f.h @@ -0,0 +1,70 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,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_PROBE_AVG_MAG_SQRD_F_H +#define INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_F_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief compute avg magnitude squared. + * \ingroup measurement_tools_blk + * + * \details + * input stream 0: float + * + * Compute a running average of the magnitude squared of the the + * input. The level and indication as to whether the level exceeds + * threshold can be retrieved with the level and unmuted + * accessors. + */ + class ANALOG_API probe_avg_mag_sqrd_f : virtual public sync_block + { + public: + // gr::analog::probe_avg_mag_sqrd_f::sptr + typedef boost::shared_ptr<probe_avg_mag_sqrd_f> sptr; + + /*! + * \brief Make a float sink that computes avg magnitude squared. + * + * \param threshold_db Threshold for muting. + * \param alpha Gain parameter for the running average filter. + */ + static sptr make(double threshold_db, double alpha = 0.0001); + + virtual bool unmuted() const = 0; + virtual double level() const = 0; + + virtual double threshold() const = 0; + + virtual void set_alpha (double alpha) = 0; + virtual void set_threshold (double decibels) = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_F_H */ diff --git a/gr-analog/include/gnuradio/analog/pwr_squelch_cc.h b/gr-analog/include/gnuradio/analog/pwr_squelch_cc.h new file mode 100644 index 0000000000..766f76d385 --- /dev/null +++ b/gr-analog/include/gnuradio/analog/pwr_squelch_cc.h @@ -0,0 +1,76 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,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_PWR_SQUELCH_CC_H +#define INCLUDED_ANALOG_PWR_SQUELCH_CC_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/analog/squelch_base_cc.h> +#include <cmath> + +namespace gr { + namespace analog { + + /*! + * \brief gate or zero output when input power below threshold + * \ingroup level_controllers_blk + */ + class ANALOG_API pwr_squelch_cc : + public squelch_base_cc, virtual public block + { + protected: + virtual void update_state(const gr_complex &in) = 0; + virtual bool mute() const = 0; + + public: + // gr::analog::pwr_squelch_cc::sptr + typedef boost::shared_ptr<pwr_squelch_cc> sptr; + + /*! + * \brief Make power-based squelch block. + * + * \param db threshold (in dB) for power squelch + * \param alpha Gain of averaging filter + * \param ramp sets response characteristic. + * \param gate if true, no output if no squelch tone. + * if false, output 0's if no squelch tone. + */ + static sptr make(double db, double alpha=0.0001, + int ramp=0, bool gate=false); + + virtual std::vector<float> squelch_range() const = 0; + + virtual double threshold() const = 0; + virtual void set_threshold(double db) = 0; + virtual void set_alpha(double alpha) = 0; + + virtual int ramp() const = 0; + virtual void set_ramp(int ramp) = 0; + virtual bool gate() const = 0; + virtual void set_gate(bool gate) = 0; + virtual bool unmuted() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PWR_SQUELCH_CC_H */ diff --git a/gr-analog/include/gnuradio/analog/pwr_squelch_ff.h b/gr-analog/include/gnuradio/analog/pwr_squelch_ff.h new file mode 100644 index 0000000000..abff53d5e0 --- /dev/null +++ b/gr-analog/include/gnuradio/analog/pwr_squelch_ff.h @@ -0,0 +1,76 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,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_PWR_SQUELCH_FF_H +#define INCLUDED_ANALOG_PWR_SQUELCH_FF_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/analog/squelch_base_ff.h> +#include <cmath> + +namespace gr { + namespace analog { + + /*! + * \brief gate or zero output when input power below threshold + * \ingroup level_controllers_blk + */ + class ANALOG_API pwr_squelch_ff : + public squelch_base_ff, virtual public block + { + protected: + virtual void update_state(const float &in) = 0; + virtual bool mute() const = 0; + + public: + // gr::analog::pwr_squelch_ff::sptr + typedef boost::shared_ptr<pwr_squelch_ff> sptr; + + /*! + * \brief Make power-based squelch block. + * + * \param db threshold (in dB) for power squelch + * \param alpha Gain of averaging filter + * \param ramp sets response characteristic. + * \param gate if true, no output if no squelch tone. + * if false, output 0's if no squelch tone. + */ + static sptr make(double db, double alpha=0.0001, + int ramp=0, bool gate=false); + + virtual std::vector<float> squelch_range() const = 0; + + virtual double threshold() const = 0; + virtual void set_threshold(double db) = 0; + virtual void set_alpha(double alpha) = 0; + + virtual int ramp() const = 0; + virtual void set_ramp(int ramp) = 0; + virtual bool gate() const = 0; + virtual void set_gate(bool gate) = 0; + virtual bool unmuted() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PWR_SQUELCH_FF_H */ diff --git a/gr-analog/include/gnuradio/analog/quadrature_demod_cf.h b/gr-analog/include/gnuradio/analog/quadrature_demod_cf.h new file mode 100644 index 0000000000..888cb4a20b --- /dev/null +++ b/gr-analog/include/gnuradio/analog/quadrature_demod_cf.h @@ -0,0 +1,61 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_H +#define INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief quadrature demodulator: complex in, float out + * \ingroup modulators_blk + * + * \details + * This can be used to demod FM, FSK, GMSK, etc. + * The input is complex baseband. + */ + class ANALOG_API quadrature_demod_cf : virtual public sync_block + { + public: + // gr::analog::quadrature_demod_cf::sptr + typedef boost::shared_ptr<quadrature_demod_cf> sptr; + + /* \brief Make a quadrature demodulator block. + * + * \param gain Gain setting to adjust the output amplitude. Set + * based on converting the phase difference between + * samples to a nominal output value. + */ + static sptr make(float gain); + + virtual void set_gain(float gain) = 0; + virtual float gain() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_H */ diff --git a/gr-analog/include/gnuradio/analog/rail_ff.h b/gr-analog/include/gnuradio/analog/rail_ff.h new file mode 100644 index 0000000000..29856bbcbc --- /dev/null +++ b/gr-analog/include/gnuradio/analog/rail_ff.h @@ -0,0 +1,60 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_ANALOG_RAIL_FF_H +#define INCLUDED_ANALOG_RAIL_FF_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief clips input values to min, max + * \ingroup level_controllers_blk + */ + class ANALOG_API rail_ff : virtual public sync_block + { + public: + // gr::analog::rail_ff::sptr + typedef boost::shared_ptr<rail_ff> sptr; + + /*! + * Build a rail block. + * + * \param lo the low value to clip to. + * \param hi the high value to clip to. + */ + static sptr make(float lo, float hi); + + virtual float lo() const = 0; + virtual float hi() const = 0; + + virtual void set_lo(float lo) = 0; + virtual void set_hi(float hi) = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_RAIL_FF_H */ diff --git a/gr-analog/include/gnuradio/analog/sig_source_X.h.t b/gr-analog/include/gnuradio/analog/sig_source_X.h.t new file mode 100644 index 0000000000..81c42926cf --- /dev/null +++ b/gr-analog/include/gnuradio/analog/sig_source_X.h.t @@ -0,0 +1,75 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +/* @WARNING@ */ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gnuradio/analog/api.h> +#include <gnuradio/analog/sig_source_waveform.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief signal generator with @TYPE@ output. + * \ingroup waveform_generators_blk + */ + class ANALOG_API @BASE_NAME@ : virtual public sync_block + { + public: + // gr::analog::@BASE_NAME@::sptr + typedef boost::shared_ptr<@BASE_NAME@> sptr; + + /*! + * Build a signal source block. + * + * \param sampling_freq Sampling rate of signal. + * \param waveform wavetform type. + * \param wave_freq Frequency of waveform (relative to sampling_freq). + * \param ampl Signal amplitude. + * \param offset offset of signal. + */ + static sptr make(double sampling_freq, + gr::analog::gr_waveform_t waveform, + double wave_freq, + double ampl, @TYPE@ offset = 0); + + virtual double sampling_freq() const = 0; + virtual gr::analog::gr_waveform_t waveform() const = 0; + virtual double frequency() const = 0; + virtual double amplitude() const = 0; + virtual @TYPE@ offset() const = 0; + + virtual void set_sampling_freq(double sampling_freq) = 0; + virtual void set_waveform(gr::analog::gr_waveform_t waveform) = 0; + virtual void set_frequency(double frequency) = 0; + virtual void set_amplitude(double ampl) = 0; + virtual void set_offset(@TYPE@ offset) = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-analog/include/gnuradio/analog/sig_source_waveform.h b/gr-analog/include/gnuradio/analog/sig_source_waveform.h new file mode 100644 index 0000000000..e3efeb1fbb --- /dev/null +++ b/gr-analog/include/gnuradio/analog/sig_source_waveform.h @@ -0,0 +1,45 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_ANALOG_SIG_SOURCE_WAVEFORM_H +#define INCLUDED_ANALOG_SIG_SOURCE_WAVEFORM_H + +namespace gr { + namespace analog { + + /*! + * \brief Types of signal generator waveforms. + * \ingroup waveform_generators_blk + */ + typedef enum { + GR_CONST_WAVE = 100, + GR_SIN_WAVE, + GR_COS_WAVE, + GR_SQR_WAVE, + GR_TRI_WAVE, + GR_SAW_WAVE + } gr_waveform_t; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_SIG_SOURCE_WAVEFORM_H */ diff --git a/gr-analog/include/gnuradio/analog/simple_squelch_cc.h b/gr-analog/include/gnuradio/analog/simple_squelch_cc.h new file mode 100644 index 0000000000..de6252b288 --- /dev/null +++ b/gr-analog/include/gnuradio/analog/simple_squelch_cc.h @@ -0,0 +1,62 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,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_SIMPLE_SQUELCH_CC_H +#define INCLUDED_ANALOG_SIMPLE_SQUELCH_CC_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief simple squelch block based on average signal power and threshold in dB. + * \ingroup level_controllers_blk + */ + class ANALOG_API simple_squelch_cc : virtual public sync_block + { + public: + // gr::analog::simple_squelch_cc::sptr + typedef boost::shared_ptr<simple_squelch_cc> sptr; + + /*! + * \brief Make a simple squelch block. + * + * \param threshold_db Threshold for muting. + * \param alpha Gain parameter for the running average filter. + */ + static sptr make(double threshold_db, double alpha); + + virtual bool unmuted() const = 0; + + virtual void set_alpha(double alpha) = 0; + virtual void set_threshold(double decibels) = 0; + + virtual double threshold() const = 0; + virtual std::vector<float> squelch_range() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_SIMPLE_SQUELCH_CC_H */ diff --git a/gr-analog/include/gnuradio/analog/squelch_base_cc.h b/gr-analog/include/gnuradio/analog/squelch_base_cc.h new file mode 100644 index 0000000000..63f84cb374 --- /dev/null +++ b/gr-analog/include/gnuradio/analog/squelch_base_cc.h @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,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_SQUELCH_BASE_CC_H +#define INCLUDED_ANALOG_SQUELCH_BASE_CC_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/block.h> + +namespace gr { + namespace analog { + + /*! + * \brief basic squelch block; to be subclassed for other squelches. + * \ingroup level_blk + */ + class ANALOG_API squelch_base_cc : virtual public block + { + protected: + virtual void update_state(const gr_complex &sample) = 0; + virtual bool mute() const = 0; + + public: + squelch_base_cc() {}; + virtual int ramp() const = 0; + virtual void set_ramp(int ramp) = 0; + virtual bool gate() const = 0; + virtual void set_gate(bool gate) = 0; + virtual bool unmuted() const = 0; + + virtual std::vector<float> squelch_range() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_SQUELCH_BASE_CC_H */ diff --git a/gr-analog/include/gnuradio/analog/squelch_base_ff.h b/gr-analog/include/gnuradio/analog/squelch_base_ff.h new file mode 100644 index 0000000000..f68262f015 --- /dev/null +++ b/gr-analog/include/gnuradio/analog/squelch_base_ff.h @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,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_SQUELCH_BASE_FF_H +#define INCLUDED_ANALOG_SQUELCH_BASE_FF_H + +#include <gnuradio/analog/api.h> +#include <gnuradio/block.h> + +namespace gr { + namespace analog { + + /*! + * \brief basic squelch block; to be subclassed for other squelches. + * \ingroup level_blk + */ + class ANALOG_API squelch_base_ff : virtual public block + { + protected: + virtual void update_state(const float &sample) = 0; + virtual bool mute() const = 0; + + public: + squelch_base_ff() {}; + virtual int ramp() const = 0; + virtual void set_ramp(int ramp) = 0; + virtual bool gate() const = 0; + virtual void set_gate(bool gate) = 0; + virtual bool unmuted() const = 0; + + virtual std::vector<float> squelch_range() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_SQUELCH_BASE_FF_H */ |