00001 // 00002 // Copyright(c) 1993-1996 Tony Kirke 00003 // author="Tony Kirke" * 00004 /* 00005 * SPUC - Signal processing using C++ - A DSP library 00006 * 00007 * This program 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 * This program 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 this program; if not, write to the Free Software 00019 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00020 */ 00021 #ifndef QPSKV 00022 #define QPSKV 00023 #include <stdlib.h> 00024 #include <stdio.h> 00025 #include <string> 00026 #include <math.h> 00027 //#include <limits.h> 00028 #include <time.h> 00029 #include <iostream> 00030 #include <spuc.h> 00031 #include <complex.h> 00032 #include <delay.h> 00033 #include <loop_filter.h> 00034 #include "carrier_nco.h" 00035 #include <a_d.h> 00036 #include <fir.h> 00037 #include <fir_interp.h> 00038 #include <lagrange.h> 00039 #include <cordic.h> 00040 #include <qpsk_discriminators.h> 00041 #include "sum_and_dump.h" 00042 #include "resampler.h" 00043 #include "agc.h" 00044 namespace SPUC { 00051 // 00052 // A QPSK receiver that can operate over a range of non-integer sampling rates 00053 // Symbol timing, frequency control and carrier phase locked loops 00054 // are included. Also contains root-raised cosine matched filter, 00055 // A/D and agc function. 00056 // 00057 class qpsk_variable 00058 { 00059 public: 00060 00061 a_d ADC; 00062 agc sigma_delta; 00063 loop_filter<long> afc_loop_filter; 00064 loop_filter<long> carrier_loop_filter; 00065 loop_filter<long> symbol_loop_filter; 00066 sum_and_dump symbol_lock_detect; 00067 qpsk_discriminators discriminators; 00068 00069 long agc_bit; 00070 long carrier_loop_out,symbol_loop_out; 00071 long symbol_clk; 00072 long symbol_clk_pls; 00073 long sample_clk; 00074 long symbol_x2_clk; 00075 long symbol_x2_clk_pls; 00076 00077 lagrange <complex<double> > interp; 00078 carrier_nco carrier__nco; 00079 cordic cordic_mult; 00080 00081 resampler rate_change; 00082 00083 fir< complex<long> > rcv_sqrt_rc; 00084 fir< complex<long> > fmf; 00085 00086 delay< complex<long> > hard_decision_delay,final_baseband_delay; 00087 delay< complex<long> > timing_disc_delay; 00088 00089 long bpsk; 00090 long resampler_round; 00091 long dec_rate_log; 00092 int sym_dec; 00093 long carrier_error; 00094 long symbol_nco_out; 00095 complex<long> hard_decision_prev,final_baseband_prev; 00096 complex<long> adc_out; 00097 complex<long> baseband; 00098 complex<long> decimated; 00099 complex<long> decimated_baseband; 00100 complex<long> resampled; 00101 complex<long> carrier_in; 00102 complex<long> carrier_nco_out; 00103 complex<long> mf_in; 00104 complex<long> mf_out; 00105 complex<long> fmf_out; 00106 complex<long> final_baseband; 00107 long timing_error; 00108 long nda_timing_error; 00109 long sym_lock; // from lock discriminator 00110 long symbol_locked; // averaged value; 00111 long sym_lock_thres; 00112 long cp_afc,quad_afc; 00113 long afc; 00114 complex<long> hard_decision; 00115 00116 long qpsk_bpsk_reg; 00117 long lock_rate_reg; 00118 long invert_q_reg; 00119 00120 long I_data() { return(re(hard_decision)); } 00121 long Q_data() { return(im(hard_decision)); } 00122 complex<long> data() { return(hard_decision); }; 00123 long carrier_loop() { return(carrier_loop_out); } 00124 long symbol_loop() { return(symbol_loop_out); } 00125 long symclk(void) { return(symbol_clk_pls); } 00126 long agc_out(void) { return(agc_bit); } 00127 void symbol_lock_average(void); 00128 void clock(complex<double>adc_in); 00129 qpsk_variable(void); 00130 00131 }; 00132 } // namespace SPUC 00133 #endif