GNU Radio 3.5.1 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2004,2011 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_DIGITAL_CLOCK_RECOVERY_MM_FF_H 00024 #define INCLUDED_DIGITAL_CLOCK_RECOVERY_MM_FF_H 00025 00026 #include <digital_api.h> 00027 #include <gr_block.h> 00028 #include <gr_math.h> 00029 #include <stdio.h> 00030 00031 class gri_mmse_fir_interpolator; 00032 00033 class digital_clock_recovery_mm_ff; 00034 typedef boost::shared_ptr<digital_clock_recovery_mm_ff> digital_clock_recovery_mm_ff_sptr; 00035 00036 // public constructor 00037 DIGITAL_API digital_clock_recovery_mm_ff_sptr 00038 digital_make_clock_recovery_mm_ff (float omega, float gain_omega, 00039 float mu, float gain_mu, 00040 float omega_relative_limit=0.001); 00041 00042 /*! 00043 * \brief Mueller and Müller (M&M) based clock recovery block with float input, float output. 00044 * \ingroup sync_blk 00045 * \ingroup digital 00046 * 00047 * This implements the Mueller and Müller (M&M) discrete-time error-tracking synchronizer. 00048 * 00049 * See "Digital Communication Receivers: Synchronization, Channel 00050 * Estimation and Signal Processing" by Heinrich Meyr, Marc Moeneclaey, & Stefan Fechtel. 00051 * ISBN 0-471-50275-8. 00052 */ 00053 class DIGITAL_API digital_clock_recovery_mm_ff : public gr_block 00054 { 00055 public: 00056 ~digital_clock_recovery_mm_ff (); 00057 void forecast(int noutput_items, gr_vector_int &ninput_items_required); 00058 int general_work (int noutput_items, 00059 gr_vector_int &ninput_items, 00060 gr_vector_const_void_star &input_items, 00061 gr_vector_void_star &output_items); 00062 float mu() const { return d_mu;} 00063 float omega() const { return d_omega;} 00064 float gain_mu() const { return d_gain_mu;} 00065 float gain_omega() const { return d_gain_omega;} 00066 00067 void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; } 00068 void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; } 00069 void set_mu (float mu) { d_mu = mu; } 00070 void set_omega (float omega){ 00071 d_omega = omega; 00072 d_min_omega = omega*(1.0 - d_omega_relative_limit); 00073 d_max_omega = omega*(1.0 + d_omega_relative_limit); 00074 d_omega_mid = 0.5*(d_min_omega+d_max_omega); 00075 } 00076 00077 protected: 00078 digital_clock_recovery_mm_ff (float omega, float gain_omega, float mu, float gain_mu, 00079 float omega_relative_limit); 00080 00081 private: 00082 float d_mu; // fractional sample position [0.0, 1.0] 00083 float d_omega; // nominal frequency 00084 float d_min_omega; // minimum allowed omega 00085 float d_omega_mid; // average omega 00086 float d_max_omega; // maximum allowed omega 00087 float d_gain_omega; // gain for adjusting omega 00088 float d_gain_mu; // gain for adjusting mu 00089 float d_last_sample; 00090 gri_mmse_fir_interpolator *d_interp; 00091 FILE *d_logfile; 00092 float d_omega_relative_limit; // used to compute min and max omega 00093 00094 friend DIGITAL_API digital_clock_recovery_mm_ff_sptr 00095 digital_make_clock_recovery_mm_ff (float omega, float gain_omega, 00096 float mu, float gain_mu, 00097 float omega_relative_limit); 00098 }; 00099 00100 #endif