Updated FSF address in all files. Fixes ticket:51
[debian/gnuradio] / gr-atsc / src / lib / GrAtscBitTimingLoop.h
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2002 Free Software Foundation, Inc.
4  * 
5  * This file is part of GNU Radio
6  * 
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  * 
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING.  If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22
23 #ifndef _GRATSCBITTIMINGLOOP_H_
24 #define _GRATSCBITTIMINGLOOP_H_
25
26 #include <gr_nco.h>
27 #include <VrSigProc.h>
28 #include <VrHistoryProc.h>
29 #include <VrDecimatingSigProc.h>
30 #include <interleaver_fifo.h>
31 #include <gr_single_pole_iir.h>
32 #include <gr_mmse_fir_interpolator.h>
33 #include <atsci_slicer_agc.h>
34 #include <stdio.h>
35 #include <atsci_diag_output.h>
36
37
38 /*!
39  * \brief ATSC BitTimingLoop
40  *
41  * This class accepts a single real input and produces a single real output
42  */
43
44 class GrAtscBitTimingLoop : public VrDecimatingSigProc<float,float> {
45
46  public:
47
48   GrAtscBitTimingLoop ();
49   virtual ~GrAtscBitTimingLoop () { };
50
51   virtual const char *name () { return "GrAtscBitTimingLoop"; }
52
53   virtual int forecast (VrSampleRange output,
54                         VrSampleRange inputs[]);
55
56   virtual int work (VrSampleRange output, void *o[],
57                     VrSampleRange inputs[], void *i[]);
58
59   // debug
60   void set_mu (double a_mu) { mu = a_mu; }
61   void set_no_update (bool a_no_update) { debug_no_update = a_no_update; }
62   void set_loop_filter_tap (double tap)  { loop.set_taps (tap); }
63   void set_timing_rate (double rate)     { d_timing_rate = rate; }
64
65  protected:
66
67   typedef float iType;
68   typedef float oType;
69
70   iType produce_sample (const iType *in, unsigned int &index);
71   double filter_error (double e);
72
73   VrSampleIndex                         next_input;
74   gr_mmse_fir_interpolator              intr;
75   double                                w;              // timing control word
76   double                                mu;             // fractional delay
77   iType                                 last_right;     // last right hand sample
78   gr_single_pole_iir<double,double,double>      loop;
79   bool                                  debug_no_update;// debug
80
81   double                                d_loop_filter_tap;
82   double                                d_timing_rate;
83   
84 #ifdef _BT_DIAG_OUTPUT_
85   FILE                                  *fp_loop;
86   FILE                                  *fp_ps;
87 #endif
88 };
89
90 #endif // _GRATSCBITTIMINGLOOP_H_