GNU Radio 3.4.0 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2004 Free Software Foundation, Inc. 00004 * 00005 * This file is part of GNU Radio 00006 * 00007 * GNU Radio is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 3, or (at your option) 00010 * any later version. 00011 * 00012 * GNU Radio is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with GNU Radio; see the file COPYING. If not, write to 00019 * the Free Software Foundation, Inc., 51 Franklin Street, 00020 * Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #ifndef INCLUDED_GR_CLOCK_RECOVERY_MM_CC_H 00024 #define INCLUDED_GR_CLOCK_RECOVERY_MM_CC_H 00025 00026 #include <gr_block.h> 00027 #include <gr_complex.h> 00028 #include <gr_math.h> 00029 00030 class gri_mmse_fir_interpolator_cc; 00031 00032 class gr_clock_recovery_mm_cc; 00033 typedef boost::shared_ptr<gr_clock_recovery_mm_cc> gr_clock_recovery_mm_cc_sptr; 00034 00035 // public constructor 00036 gr_clock_recovery_mm_cc_sptr 00037 gr_make_clock_recovery_mm_cc (float omega, float gain_omega, float mu, float gain_mu, 00038 float omega_relative_limit=0.001); 00039 00040 /*! 00041 * \brief Mueller and Müller (M&M) based clock recovery block with complex input, complex output. 00042 * \ingroup sync_blk 00043 * 00044 * This implements the Mueller and Müller (M&M) discrete-time error-tracking synchronizer. 00045 * The complex version here is based on: 00046 * Modified Mueller and Muller clock recovery circuit 00047 * Based: 00048 * G. R. Danesfahani, T.G. Jeans, "Optimisation of modified Mueller and Muller 00049 * algorithm," Electronics Letters, Vol. 31, no. 13, 22 June 1995, pp. 1032 - 1033. 00050 */ 00051 class gr_clock_recovery_mm_cc : public gr_block 00052 { 00053 public: 00054 ~gr_clock_recovery_mm_cc (); 00055 void forecast(int noutput_items, gr_vector_int &ninput_items_required); 00056 int general_work (int noutput_items, 00057 gr_vector_int &ninput_items, 00058 gr_vector_const_void_star &input_items, 00059 gr_vector_void_star &output_items); 00060 float mu() const { return d_mu;} 00061 float omega() const { return d_omega;} 00062 float gain_mu() const { return d_gain_mu;} 00063 float gain_omega() const { return d_gain_omega;} 00064 void set_verbose (bool verbose) { d_verbose = verbose; } 00065 00066 void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; } 00067 void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; } 00068 void set_mu (float mu) { d_mu = mu; } 00069 void set_omega (float omega) { 00070 d_omega = omega; 00071 d_min_omega = omega*(1.0 - d_omega_relative_limit); 00072 d_max_omega = omega*(1.0 + d_omega_relative_limit); 00073 d_omega_mid = 0.5*(d_min_omega+d_max_omega); 00074 } 00075 00076 protected: 00077 gr_clock_recovery_mm_cc (float omega, float gain_omega, float mu, float gain_mu, 00078 float omega_relative_limi); 00079 00080 private: 00081 float d_mu; 00082 float d_omega; 00083 float d_gain_omega; 00084 float d_min_omega; // minimum allowed omega 00085 float d_max_omega; // maximum allowed omeg 00086 float d_omega_relative_limit; // used to compute min and max omega 00087 float d_omega_mid; 00088 float d_gain_mu; 00089 gr_complex d_last_sample; 00090 gri_mmse_fir_interpolator_cc *d_interp; 00091 bool d_verbose; 00092 00093 gr_complex d_p_2T; 00094 gr_complex d_p_1T; 00095 gr_complex d_p_0T; 00096 00097 gr_complex d_c_2T; 00098 gr_complex d_c_1T; 00099 gr_complex d_c_0T; 00100 00101 gr_complex slicer_0deg (gr_complex sample); 00102 gr_complex slicer_45deg (gr_complex sample); 00103 00104 friend gr_clock_recovery_mm_cc_sptr 00105 gr_make_clock_recovery_mm_cc (float omega, float gain_omega, float mu, float gain_mu, 00106 float omega_relative_limit); 00107 }; 00108 00109 #endif