00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2002 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 2, 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., 59 Temple Place - Suite 330, 00020 * Boston, MA 02111-1307, USA. 00021 */ 00022 00023 #ifndef _GRATSCBITTIMINGLOOP_H_ 00024 #define _GRATSCBITTIMINGLOOP_H_ 00025 00026 #include <gr_nco.h> 00027 #include <VrSigProc.h> 00028 #include <VrHistoryProc.h> 00029 #include <VrDecimatingSigProc.h> 00030 #include <interleaver_fifo.h> 00031 #include <gr_single_pole_iir.h> 00032 #include <gr_mmse_fir_interpolator.h> 00033 #include <atsc_slicer_agc.h> 00034 #include <stdio.h> 00035 #include <atsc_diag_output.h> 00036 00037 00044 class GrAtscBitTimingLoop : public VrDecimatingSigProc<float,float> { 00045 00046 public: 00047 00048 GrAtscBitTimingLoop (); 00049 virtual ~GrAtscBitTimingLoop () { }; 00050 00051 virtual const char *name () { return "GrAtscBitTimingLoop"; } 00052 00053 virtual int forecast (VrSampleRange output, 00054 VrSampleRange inputs[]); 00055 00056 virtual int work (VrSampleRange output, void *o[], 00057 VrSampleRange inputs[], void *i[]); 00058 00059 // debug 00060 void set_mu (double a_mu) { mu = a_mu; } 00061 void set_no_update (bool a_no_update) { debug_no_update = a_no_update; } 00062 void set_loop_filter_tap (double tap) { loop.set_taps (tap); } 00063 void set_timing_rate (double rate) { d_timing_rate = rate; } 00064 00065 protected: 00066 00067 typedef float iType; 00068 typedef float oType; 00069 00070 iType produce_sample (const iType *in, unsigned int &index); 00071 double filter_error (double e); 00072 00073 VrSampleIndex next_input; 00074 gr_mmse_fir_interpolator intr; 00075 double w; // timing control word 00076 double mu; // fractional delay 00077 iType last_right; // last right hand sample 00078 gr_single_pole_iir<double,double,double> loop; 00079 bool debug_no_update;// debug 00080 00081 double d_loop_filter_tap; 00082 double d_timing_rate; 00083 00084 #ifdef _BT_DIAG_OUTPUT_ 00085 FILE *fp_loop; 00086 FILE *fp_ps; 00087 #endif 00088 }; 00089 00090 #endif // _GRATSCBITTIMINGLOOP_H_