/* -*- c++ -*- */ /* * Copyright 2002 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #include #include #include #include #include static const int DEC = 2; // nominal decimation factor static const unsigned AVG_WINDOW_LEN = 256; static const float TIMING_RATE_CONST = 1e-5; // FIXME document interaction with AGC GrAtscBitTimingLoop2::GrAtscBitTimingLoop2 () : VrDecimatingSigProc (1, DEC), next_input(0), dc (0.0002), mu (0.0), last_right(0), use_right_p (true) { history = 100; // spare input samples in case we need them. #ifdef _BT_DIAG_OUTPUT_ fp_loop = fopen ("loop.out", "w"); if (fp_loop == 0){ perror ("loop.out"); exit (1); } fp_ps = fopen ("ps.out", "w"); if (fp_ps == 0){ perror ("ps.out"); exit (1); } #endif } // // We are nominally a 2x decimator, but our actual rate varies slightly // depending on the difference between the transmitter and receiver // sampling clocks. Hence, we need to compute our input ranges // explictly. int GrAtscBitTimingLoop2::forecast(VrSampleRange output, VrSampleRange inputs[]) { /* dec:1 ratio with history */ for(unsigned int i=0;i