1
1
/* -*- c++ -*- */
2
2
/*
3
3
* Copyright 2006-2008,2010,2011 Free Software Foundation, Inc.
4
- *
4
+ *
5
5
* This file is part of GNU Radio
6
- *
6
+ *
7
7
* GNU Radio is free software; you can redistribute it and/or modify
8
8
* it under the terms of the GNU General Public License as published by
9
9
* the Free Software Foundation; either version 3, or (at your option)
10
10
* any later version.
11
- *
11
+ *
12
12
* GNU Radio is distributed in the hope that it will be useful,
13
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
15
* GNU General Public License for more details.
16
- *
16
+ *
17
17
* You should have received a copy of the GNU General Public License
18
18
* along with GNU Radio; see the file COPYING. If not, write to
19
19
* the Free Software Foundation, Inc., 51 Franklin Street,
32
32
33
33
namespace gr {
34
34
namespace digital {
35
-
35
+
36
36
#define VERBOSE 0
37
37
#define M_TWOPI (2 *M_PI)
38
38
#define MAX_NUM_SYMBOLS 1000
39
39
40
40
ofdm_frame_acquisition::sptr
41
41
ofdm_frame_acquisition::make (unsigned int occupied_carriers,
42
- unsigned int fft_length,
42
+ unsigned int fft_length,
43
43
unsigned int cplen,
44
44
const std::vector<gr_complex> &known_symbol,
45
45
unsigned int max_fft_shift_len)
@@ -50,7 +50,7 @@ namespace gr {
50
50
}
51
51
52
52
ofdm_frame_acquisition_impl::ofdm_frame_acquisition_impl (unsigned occupied_carriers,
53
- unsigned int fft_length,
53
+ unsigned int fft_length,
54
54
unsigned int cplen,
55
55
const std::vector<gr_complex> &known_symbol,
56
56
unsigned int max_fft_shift_len)
@@ -65,6 +65,8 @@ namespace gr {
65
65
d_coarse_freq(0 ),
66
66
d_phase_count(0 )
67
67
{
68
+ GR_LOG_WARN (d_logger, " The gr::digital::ofdm_frame_acquisition block has been deprecated." );
69
+
68
70
d_symbol_phase_diff.resize (d_fft_length);
69
71
d_known_phase_diff.resize (d_occupied_carriers);
70
72
d_hestimate.resize (d_occupied_carriers);
@@ -75,7 +77,7 @@ namespace gr {
75
77
for (i = 0 ; i < d_known_symbol.size ()-2 ; i+=2 ) {
76
78
d_known_phase_diff[i] = norm (d_known_symbol[i] - d_known_symbol[i+2 ]);
77
79
}
78
-
80
+
79
81
d_phase_lut = new gr_complex[(2 *d_freq_shift_len+1 ) * MAX_NUM_SYMBOLS];
80
82
for (i = 0 ; i <= 2 *d_freq_shift_len; i++) {
81
83
for (j = 0 ; j < MAX_NUM_SYMBOLS; j++) {
@@ -112,7 +114,7 @@ namespace gr {
112
114
ofdm_frame_acquisition_impl::correlate (const gr_complex *symbol, int zeros_on_left)
113
115
{
114
116
unsigned int i,j;
115
-
117
+
116
118
std::fill (d_symbol_phase_diff.begin (), d_symbol_phase_diff.end (), 0 );
117
119
for (i = 0 ; i < d_fft_length-2 ; i++) {
118
120
d_symbol_phase_diff[i] = norm (symbol[i] - symbol[i+2 ]);
@@ -142,16 +144,16 @@ namespace gr {
142
144
unsigned int i=0 ;
143
145
144
146
// Set first tap of equalizer
145
- d_hestimate[0 ] = d_known_symbol[0 ] /
147
+ d_hestimate[0 ] = d_known_symbol[0 ] /
146
148
(coarse_freq_comp (d_coarse_freq,1 )*symbol[zeros_on_left+d_coarse_freq]);
147
149
148
150
// set every even tap based on known symbol
149
151
// linearly interpolate between set carriers to set zero-filled carriers
150
152
// FIXME: is this the best way to set this?
151
153
for (i = 2 ; i < d_occupied_carriers; i+=2 ) {
152
- d_hestimate[i] = d_known_symbol[i] /
154
+ d_hestimate[i] = d_known_symbol[i] /
153
155
(coarse_freq_comp (d_coarse_freq,1 )*(symbol[i+zeros_on_left+d_coarse_freq]));
154
- d_hestimate[i-1 ] = (d_hestimate[i] + d_hestimate[i-2 ]) / gr_complex (2.0 , 0.0 );
156
+ d_hestimate[i-1 ] = (d_hestimate[i] + d_hestimate[i-2 ]) / gr_complex (2.0 , 0.0 );
155
157
}
156
158
157
159
// with even number of carriers; last equalizer tap is wrong
@@ -164,7 +166,7 @@ namespace gr {
164
166
for (i = 0 ; i < d_occupied_carriers; i++) {
165
167
gr_complex sym = coarse_freq_comp (d_coarse_freq,1 )*symbol[i+zeros_on_left+d_coarse_freq];
166
168
gr_complex output = sym * d_hestimate[i];
167
- fprintf (stderr, " sym: %+.4f + j%+.4f ks: %+.4f + j%+.4f eq: %+.4f + j%+.4f ==> %+.4f + j%+.4f\n " ,
169
+ fprintf (stderr, " sym: %+.4f + j%+.4f ks: %+.4f + j%+.4f eq: %+.4f + j%+.4f ==> %+.4f + j%+.4f\n " ,
168
170
sym .real (), sym.imag (),
169
171
d_known_symbol[i].real (), d_known_symbol[i].imag (),
170
172
d_hestimate[i].real (), d_hestimate[i].imag (),
@@ -185,7 +187,7 @@ namespace gr {
185
187
186
188
gr_complex *out = (gr_complex *) output_items[0 ];
187
189
char *signal_out = (char *) output_items[1 ];
188
-
190
+
189
191
int unoccupied_carriers = d_fft_length - d_occupied_carriers;
190
192
int zeros_on_left = (int )ceil (unoccupied_carriers/2.0 );
191
193
@@ -203,7 +205,7 @@ namespace gr {
203
205
out[i] = d_hestimate[i]*coarse_freq_comp (d_coarse_freq,d_phase_count)
204
206
*symbol[i+zeros_on_left+d_coarse_freq];
205
207
}
206
-
208
+
207
209
d_phase_count++;
208
210
if (d_phase_count == MAX_NUM_SYMBOLS) {
209
211
d_phase_count = 1 ;
0 commit comments