diff options
-rw-r--r-- | gr-digital/include/gnuradio/digital/costas_loop_cc.h | 18 | ||||
-rw-r--r-- | gr-digital/include/gnuradio/digital/mpsk_receiver_cc.h | 30 | ||||
-rw-r--r-- | gr-digital/lib/costas_loop_cc_impl.cc | 18 | ||||
-rw-r--r-- | gr-digital/lib/costas_loop_cc_impl.h | 10 | ||||
-rw-r--r-- | gr-digital/lib/mpsk_receiver_cc_impl.cc | 60 | ||||
-rw-r--r-- | gr-digital/lib/mpsk_receiver_cc_impl.h | 24 |
6 files changed, 80 insertions, 80 deletions
diff --git a/gr-digital/include/gnuradio/digital/costas_loop_cc.h b/gr-digital/include/gnuradio/digital/costas_loop_cc.h index 5320d704c3..d924d969b7 100644 --- a/gr-digital/include/gnuradio/digital/costas_loop_cc.h +++ b/gr-digital/include/gnuradio/digital/costas_loop_cc.h @@ -1,19 +1,19 @@ /* -*- c++ -*- */ /* * Copyright 2006,2011,2012 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, @@ -30,7 +30,7 @@ namespace gr { namespace digital { - /*! + /*! * \brief A Costas loop carrier recovery module. * \ingroup synchronizers_blk * @@ -54,20 +54,20 @@ namespace gr { * signal processing, pp. 20-36, 2002. * * http://rfdesign.com/images/archive/0102Feigin20.pdf - * + * * The Costas loop can have two output streams: * \li stream 1 (required) is the baseband I and Q; * \li stream 2 (optional) is the normalized frequency of the loop */ class DIGITAL_API costas_loop_cc - : virtual public sync_block, + : virtual public sync_block, virtual public blocks::control_loop { public: // gr::digital::costas_loop_cc::sptr typedef boost::shared_ptr<costas_loop_cc> sptr; - /*! + /*! * Make a Costas loop carrier recovery block. * * \param loop_bw internal 2nd order loop bandwidth (~ 2pi/100) @@ -75,7 +75,7 @@ namespace gr { */ static sptr make(float loop_bw, int order); - /*! + /*! * Returns the current value of the loop error. */ virtual float error() const = 0; diff --git a/gr-digital/include/gnuradio/digital/mpsk_receiver_cc.h b/gr-digital/include/gnuradio/digital/mpsk_receiver_cc.h index 94e765d4ac..8bc2bceb01 100644 --- a/gr-digital/include/gnuradio/digital/mpsk_receiver_cc.h +++ b/gr-digital/include/gnuradio/digital/mpsk_receiver_cc.h @@ -74,27 +74,27 @@ namespace gr { /*! * \brief Make a M-PSK receiver block. * - * \param M modulation order of the M-PSK modulation - * \param theta any constant phase rotation from the real axis of the constellation - * \param loop_bw Loop bandwidth to set gains of phase/freq tracking loop - * \param fmin minimum normalized frequency value the loop can achieve - * \param fmax maximum normalized frequency value the loop can achieve - * \param mu initial parameter for the interpolator [0,1] - * \param gain_mu gain parameter of the M&M error signal to adjust mu (~0.05) - * \param omega initial value for the number of symbols between samples (~number of samples/symbol) - * \param gain_omega gain parameter to adjust omega based on the error (~omega^2/4) - * \param omega_rel sets the maximum (omega*(1+omega_rel)) and minimum (omega*(1+omega_rel)) omega (~0.005) + * \param M modulation order of the M-PSK modulation + * \param theta any constant phase rotation from the real axis of the constellation + * \param loop_bw Loop bandwidth to set gains of phase/freq tracking loop + * \param fmin minimum normalized frequency value the loop can achieve + * \param fmax maximum normalized frequency value the loop can achieve + * \param mu initial parameter for the interpolator [0,1] + * \param gain_mu gain parameter of the M&M error signal to adjust mu (~0.05) + * \param omega initial value for the number of symbols between samples (~number of samples/symbol) + * \param gain_omega gain parameter to adjust omega based on the error (~omega^2/4) + * \param omega_rel sets the maximum (omega*(1+omega_rel)) and minimum (omega*(1+omega_rel)) omega (~0.005) * * The constructor also chooses which phase detector and * decision maker to use in the work loop based on the value of * M. */ - static sptr make(unsigned int M, float theta, + static sptr make(unsigned int M, float theta, float loop_bw, float fmin, float fmax, - float mu, float gain_mu, + float mu, float gain_mu, float omega, float gain_omega, float omega_rel); - + //! Returns the modulation order (M) currently set virtual float modulation_order() const = 0; @@ -124,8 +124,8 @@ namespace gr { //! Sets value of mu virtual void set_mu(float mu) = 0; - - //! Sets value of omega and its min and max values + + //! Sets value of omega and its min and max values virtual void set_omega(float omega) = 0; //! Sets value for mu gain factor diff --git a/gr-digital/lib/costas_loop_cc_impl.cc b/gr-digital/lib/costas_loop_cc_impl.cc index 36a125b437..36f95ac022 100644 --- a/gr-digital/lib/costas_loop_cc_impl.cc +++ b/gr-digital/lib/costas_loop_cc_impl.cc @@ -1,19 +1,19 @@ /* -*- c++ -*- */ /* * Copyright 2006,2010-2012 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, @@ -62,7 +62,7 @@ namespace gr { d_phase_detector = &costas_loop_cc_impl::phase_detector_8; break; - default: + default: throw std::invalid_argument("order must be 2, 4, or 8"); break; } @@ -145,19 +145,19 @@ namespace gr { tags.erase(tags.begin()); } } - + nco_out = gr_expj(-d_phase); optr[i] = iptr[i] * nco_out; d_error = (*this.*d_phase_detector)(optr[i]); d_error = gr::branchless_clip(d_error, 1.0); - + advance_loop(d_error); phase_wrap(); frequency_limit(); foptr[i] = d_freq; - } + } } else { for(int i = 0; i < noutput_items; i++) { @@ -219,7 +219,7 @@ namespace gr { pmt::mp(0.0f), pmt::mp(2.0f), pmt::mp(0.0f), "", "Loop bandwidth", RPC_PRIVLVL_MIN, DISPTIME | DISPOPTSTRIP))); - + // Setters add_rpc_variable( rpcbasic_sptr(new rpcbasic_register_set<control_loop, float>( diff --git a/gr-digital/lib/costas_loop_cc_impl.h b/gr-digital/lib/costas_loop_cc_impl.h index 0559f907aa..665724236b 100644 --- a/gr-digital/lib/costas_loop_cc_impl.h +++ b/gr-digital/lib/costas_loop_cc_impl.h @@ -1,19 +1,19 @@ /* -*- c++ -*- */ /* * Copyright 2006,2011,2012 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, @@ -62,7 +62,7 @@ namespace gr { float error() const; void setup_rpc(); - + int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); diff --git a/gr-digital/lib/mpsk_receiver_cc_impl.cc b/gr-digital/lib/mpsk_receiver_cc_impl.cc index 0d7464a0fb..d6c2ae6fa3 100644 --- a/gr-digital/lib/mpsk_receiver_cc_impl.cc +++ b/gr-digital/lib/mpsk_receiver_cc_impl.cc @@ -37,35 +37,35 @@ namespace gr { #define VERBOSE_MM 0 // Used for debugging symbol timing loop #define VERBOSE_COSTAS 0 // Used for debugging phase and frequency tracking - mpsk_receiver_cc::sptr + mpsk_receiver_cc::sptr mpsk_receiver_cc::make(unsigned int M, float theta, float loop_bw, float fmin, float fmax, - float mu, float gain_mu, + float mu, float gain_mu, float omega, float gain_omega, float omega_rel) { return gnuradio::get_initial_sptr (new mpsk_receiver_cc_impl(M, theta, loop_bw, fmin, fmax, - mu, gain_mu, - omega, gain_omega, + mu, gain_mu, + omega, gain_omega, omega_rel)); } - mpsk_receiver_cc_impl::mpsk_receiver_cc_impl(unsigned int M, float theta, + mpsk_receiver_cc_impl::mpsk_receiver_cc_impl(unsigned int M, float theta, float loop_bw, float fmin, float fmax, - float mu, float gain_mu, + float mu, float gain_mu, float omega, float gain_omega, float omega_rel) : block("mpsk_receiver_cc", - io_signature::make(1, 1, sizeof(gr_complex)), - io_signature::make(1, 1, sizeof(gr_complex))), - blocks::control_loop(loop_bw, fmax, fmin), - d_M(M), d_theta(theta), + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex))), + blocks::control_loop(loop_bw, fmax, fmin), + d_M(M), d_theta(theta), d_current_const_point(0), - d_mu(mu), d_gain_mu(gain_mu), d_gain_omega(gain_omega), + d_mu(mu), d_gain_mu(gain_mu), d_gain_omega(gain_omega), d_omega_rel(omega_rel), d_max_omega(0), d_min_omega(0), d_p_2T(0), d_p_1T(0), d_p_0T(0), d_c_2T(0), d_c_1T(0), d_c_0T(0) { @@ -78,13 +78,13 @@ namespace gr { throw std::out_of_range("clock rate must be > 0"); if(gain_mu < 0 || gain_omega < 0) throw std::out_of_range("Gains must be non-negative"); - + assert(d_interp->ntaps() <= DLLEN); - + // zero double length delay line. for(unsigned int i = 0; i < 2 * DLLEN; i++) d_dl[i] = gr_complex(0.0,0.0); - + set_modulation_order(d_M); } @@ -98,7 +98,7 @@ namespace gr { { // build the constellation vector from M make_constellation(); - + // Select a phase detector and a decision maker for the modulation order switch(d_M) { case 2: // optimized algorithms for BPSK @@ -150,7 +150,7 @@ namespace gr { else phase_error = -sample.real(); } - + return phase_error; } @@ -193,7 +193,7 @@ namespace gr { // the Euclidean distance (error) with the sample for(unsigned int m = 0; m < d_M; m++) { gr_complex diff = norm(d_constellation[m] - sample); - + if(fabs(diff.real()) < min_s) { min_s = fabs(diff.real()); min_m = m; @@ -224,10 +224,10 @@ namespace gr { d_phase -= M_TWOPI; while(d_phase < -M_TWOPI) d_phase += M_TWOPI; - + nco = gr_expj(d_phase+d_theta); // get the NCO value for derotating the current sample sample = nco*symbol; // get the downconverted symbol - + // Fill up the delay line for the interpolator d_dl[d_dl_idx] = sample; d_dl[(d_dl_idx + DLLEN)] = sample; // put this in the second half of the buffer for overflows @@ -248,24 +248,24 @@ namespace gr { d_p_0T = sample; d_c_2T = d_c_1T; d_c_1T = d_c_0T; - + d_current_const_point = (*this.*d_decision)(d_p_0T); // make a decision on the sample value d_c_0T = d_constellation[d_current_const_point]; - + x = (d_c_0T - d_c_2T) * conj(d_p_1T); y = (d_p_0T - d_p_2T) * conj(d_c_1T); u = y - x; mm_error = u.real(); // the error signal is in the real part mm_error = gr::branchless_clip(mm_error, 1.0); // limit mm_val - + d_omega = d_omega + d_gain_omega * mm_error; // update omega based on loop error d_omega = d_omega_mid + gr::branchless_clip(d_omega-d_omega_mid, d_omega_rel); // make sure we don't walk away - + d_mu += d_omega + d_gain_mu * mm_error; // update mu based on loop error - + #if VERBOSE_MM - printf("mm: mu: %f omega: %f mm_error: %f sample: %f+j%f constellation: %f+j%f\n", - d_mu, d_omega, mm_error, sample.real(), sample.imag(), + printf("mm: mu: %f omega: %f mm_error: %f sample: %f+j%f constellation: %f+j%f\n", + d_mu, d_omega, mm_error, sample.real(), sample.imag(), d_constellation[d_current_const_point].real(), d_constellation[d_current_const_point].imag()); #endif } @@ -278,14 +278,14 @@ namespace gr { // Make phase and frequency corrections based on sampled value phase_error = (*this.*d_phase_error_detector)(sample); - + advance_loop(phase_error); phase_wrap(); frequency_limit(); - + #if VERBOSE_COSTAS printf("cl: phase_error: %f phase: %f freq: %f sample: %f+j%f constellation: %f+j%f\n", - phase_error, d_phase, d_freq, sample.real(), sample.imag(), + phase_error, d_phase, d_freq, sample.real(), sample.imag(), d_constellation[d_current_const_point].real(), d_constellation[d_current_const_point].imag()); #endif } @@ -306,7 +306,7 @@ namespace gr { mm_sampler(in[i]); // puts symbols into a buffer and adjusts d_mu i++; } - + if(i < ninput_items[0]) { gr_complex interp_sample = d_interp->interpolate(&d_dl[d_dl_idx], d_mu); diff --git a/gr-digital/lib/mpsk_receiver_cc_impl.h b/gr-digital/lib/mpsk_receiver_cc_impl.h index f17f88cb98..fc5cc777fd 100644 --- a/gr-digital/lib/mpsk_receiver_cc_impl.h +++ b/gr-digital/lib/mpsk_receiver_cc_impl.h @@ -37,10 +37,10 @@ namespace gr { : public mpsk_receiver_cc, public blocks::control_loop { public: - mpsk_receiver_cc_impl(unsigned int M, float theta, + mpsk_receiver_cc_impl(unsigned int M, float theta, float loop_bw, float fmin, float fmax, - float mu, float gain_mu, + float mu, float gain_mu, float omega, float gain_omega, float omega_rel); ~mpsk_receiver_cc_impl(); @@ -79,9 +79,9 @@ namespace gr { //! Sets value of mu void set_mu(float mu) { d_mu = mu; } - - //! Sets value of omega and its min and max values - void set_omega(float omega) { + + //! Sets value of omega and its min and max values + void set_omega(float omega) { d_omega = omega; d_min_omega = omega*(1.0 - d_omega_rel); d_max_omega = omega*(1.0 + d_omega_rel); @@ -96,7 +96,7 @@ namespace gr { //! Sets the relative omega limit and resets omega min/max values void set_gain_omega_rel(float omega_rel); - + protected: void make_constellation(); void mm_sampler(const gr_complex symbol); @@ -174,7 +174,7 @@ namespace gr { * \returns the index to d_constellation that minimizes the error/ */ unsigned int decision_bpsk(gr_complex sample) const; - + /*! * \brief Decision maker for QPSK constellation. * @@ -193,7 +193,7 @@ namespace gr { float d_theta; /*! - * \brief Decision maker function pointer + * \brief Decision maker function pointer * * \param sample the baseband I&Q sample from which to make the decision * @@ -215,7 +215,7 @@ namespace gr { gr_complex d_c_2T, d_c_1T, d_c_0T; /*! - * \brief Phase error detector function pointer + * \brief Phase error detector function pointer * * \param sample the I&Q sample from which to determine the phase error * @@ -227,13 +227,13 @@ namespace gr { //! get interpolated value gr::filter::mmse_fir_interpolator_cc *d_interp; - + //! delay line length. static const unsigned int DLLEN = 8; - + //! delay line plus some length for overflow protection __GR_ATTR_ALIGNED(8) gr_complex d_dl[2*DLLEN]; - + //! index to delay line unsigned int d_dl_idx; }; |