GNU Radio 3.6.5.1 C++ API
digital_costas_loop_cc.h
Go to the documentation of this file.
1
/* -*- c++ -*- */
2
/*
3
* Copyright 2006,2011 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 3, 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
24
#ifndef INCLUDED_DIGITAL_COSTAS_LOOP_CC_H
25
#define INCLUDED_DIGITAL_COSTAS_LOOP_CC_H
26
27
#include <
gr_sync_block.h
>
28
#include <
gri_control_loop.h
>
29
#include <stdexcept>
30
#include <fstream>
31
#include <
digital_api.h
>
32
33
class
digital_costas_loop_cc
;
34
typedef
boost::shared_ptr<digital_costas_loop_cc>
digital_costas_loop_cc_sptr
;
35
36
37
DIGITAL_API
digital_costas_loop_cc_sptr
38
digital_make_costas_loop_cc
(
float
loop_bw,
int
order
39
)
throw
(std::invalid_argument);
40
41
/*!
42
* \brief A Costas loop carrier recovery module.
43
* \ingroup synchronizers_blk
44
*
45
* \details
46
* The Costas loop locks to the center frequency of a signal and
47
* downconverts it to baseband. The second (order=2) order loop is
48
* used for BPSK where the real part of the output signal is the
49
* baseband BPSK signal and the imaginary part is the error
50
* signal. When order=4, it can be used for quadrature modulations
51
* where both I and Q (real and imaginary) are outputted.
52
*
53
* More details can be found online:
54
*
55
* J. Feigin, "Practical Costas loop design: Designing a simple and
56
* inexpensive BPSK Costas loop carrier recovery circuit," RF signal
57
* processing, pp. 20-36, 2002.
58
*
59
* http://rfdesign.com/images/archive/0102Feigin20.pdf
60
*/
61
class
DIGITAL_API
digital_costas_loop_cc
:
public
gr_sync_block
,
public
gri_control_loop
62
{
63
friend
DIGITAL_API
digital_costas_loop_cc_sptr
64
digital_make_costas_loop_cc
(
float
loop_bw,
int
order
65
)
throw
(std::invalid_argument);
66
67
int
d_order;
68
69
/*!
70
* \brief Carrier tracking PLL for QPSK
71
* input: complex; output: complex
72
* <br>The Costas loop can have two output streams:
73
* stream 1 is the baseband I and Q;
74
* stream 2 is the normalized frequency of the loop
75
*
76
* \param loop_bw internal 2nd order loop bandwidth (~ 2pi/100)
77
* \param order the loop order, either 2, 4, or 8
78
*/
79
digital_costas_loop_cc
(
float
loop_bw,
int
order
80
)
throw
(std::invalid_argument);
81
82
/*! \brief the phase detector circuit for 8th-order PSK loops
83
* \param sample complex sample
84
* \return the phase error
85
*/
86
float
phase_detector_8(
gr_complex
sample)
const
;
// for 8PSK
87
88
/*! \brief the phase detector circuit for fourth-order loops
89
* \param sample complex sample
90
* \return the phase error
91
*/
92
float
phase_detector_4(
gr_complex
sample)
const
;
// for QPSK
93
94
/*! \brief the phase detector circuit for second-order loops
95
* \param sample a complex sample
96
* \return the phase error
97
*/
98
float
phase_detector_2(
gr_complex
sample)
const
;
// for BPSK
99
100
101
float (
digital_costas_loop_cc
::*d_phase_detector)(
gr_complex
sample)
const
;
102
103
public
:
104
105
int
work
(
int
noutput_items,
106
gr_vector_const_void_star
&input_items,
107
gr_vector_void_star
&output_items);
108
};
109
110
#endif
gr-digital
include
digital_costas_loop_cc.h
Generated on Mon Aug 19 2013 15:37:30 for GNU Radio 3.6.5.1 C++ API by
1.8.1.2