3 * Copyright 2004,2006 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
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)
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.
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.
23 #ifndef INCLUDED_GR_DD_MPSK_SYNC_CC_H
24 #define INCLUDED_GR_DD_MPSK_SYNC_CC_H
26 #include <gr_sync_block.h>
28 class gri_mmse_fir_interpolator_cc;
30 class gr_dd_mpsk_sync_cc;
31 typedef boost::shared_ptr<gr_dd_mpsk_sync_cc> gr_dd_mpsk_sync_cc_sptr;
33 gr_dd_mpsk_sync_cc_sptr
34 gr_make_dd_mpsk_sync_cc (float alpha, float beta,
35 float max_freq, float min_freq, float ref_phase,
36 float omega, float gain_omega, float mu, float gain_mu);
39 * \brief Decision directed M-PSK synchronous demod
40 * This block performs joint carrier tracking and symbol timing recovery.
42 * input: complex baseband; output: properly timed complex samples ready for slicing.
44 * N.B, at this point, it handles only QPSK.
47 class gr_dd_mpsk_sync_cc : public gr_block
49 friend gr_dd_mpsk_sync_cc_sptr gr_make_dd_mpsk_sync_cc (float alpha, float beta,
50 float max_freq, float min_freq, float ref_phase,
51 float omega, float gain_omega, float mu, float gain_mu);
53 ~gr_dd_mpsk_sync_cc ();
54 void forecast(int noutput_items, gr_vector_int &ninput_items_required);
55 float mu() const { return d_mu;}
56 float omega() const { return d_omega;}
57 float gain_mu() const { return d_gain_mu;}
58 float gain_omega() const { return d_gain_omega;}
60 void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; }
61 void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; }
62 void set_mu (float mu) { d_mu = mu; }
63 void set_omega (float omega) { d_omega = omega; }
66 gr_dd_mpsk_sync_cc (float alpha, float beta, float max_freq, float min_freq, float ref_phase,
67 float omega, float gain_omega, float mu, float gain_mu);
69 int general_work (int noutput_items,
70 gr_vector_int &ninput_items,
71 gr_vector_const_void_star &input_items,
72 gr_vector_void_star &output_items);
75 static const unsigned int DLLEN = 8; // delay line length.
77 float d_alpha,d_beta,d_max_freq,d_min_freq,d_ref_phase;
78 float d_omega, d_gain_omega, d_mu, d_gain_mu;
79 float d_phase, d_freq;
80 gr_complex slicer_45deg (gr_complex sample);
81 gr_complex slicer_0deg (gr_complex sample);
82 gr_complex d_last_sample;
83 gri_mmse_fir_interpolator_cc *d_interp;
85 gr_complex d_dl[2 * DLLEN]; // Holds post carrier tracking samples.
86 // double length delay line to avoid wraps.
87 unsigned int d_dl_idx; // indexes oldest sample in delay line.
89 float phase_detector(gr_complex sample,float ref_phase);