fun_ofdm
1.0
802.11a Physical Layer for USRP
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Enumerations
Enumerator
Macros
Pages
fft_symbols.cpp
Go to the documentation of this file.
1
8
#include <fftw3.h>
9
#include <cstring>
10
11
#include "
fft.h
"
12
#include "
fft_symbols.h
"
13
14
namespace
fun
15
{
21
fft_symbols::fft_symbols
() :
22
block
(
"fft_symbols"
),
23
m_offset(0),
24
m_ffft(64)
25
{
26
}
27
33
void
fft_symbols::work
()
34
{
35
if
(
input_buffer
.size() == 0)
return
;
36
output_buffer
.resize(0);
37
38
// Step through the input samples
39
for
(
int
x = 0; x <
input_buffer
.size(); x++)
40
{
41
// Check if this is the start of a new frame
42
if
(
input_buffer
[x].tag ==
LTS1
)
43
{
44
// Push the current vector to the output buffer if
45
// we've written any data to it
46
if
(
m_offset
> 15)
output_buffer
.push_back(
m_current_vector
);
47
48
// Start a new vector
49
m_current_vector
.
tag
=
LTS_START
;
50
m_offset
= 16;
51
}
52
53
if
(
input_buffer
[x].tag ==
LTS2
)
54
{
55
m_offset
= 16;
56
}
57
58
// Copy over samples past the cyclic prefix
59
if
(
m_offset
> 15)
60
{
61
m_current_vector
.
samples
[
m_offset
- 16] =
input_buffer
[x].sample;
62
}
63
64
// Increment the offset and reset if we're at the end of the symbol
65
m_offset
++;
66
if
(
m_offset
== 80)
67
{
68
output_buffer
.push_back(
m_current_vector
);
69
m_current_vector
.
tag
=
NONE
;
70
m_offset
= 0;
71
}
72
}
73
74
// Perform forward FFT
75
for
(
int
x = 0; x <
output_buffer
.size(); x++)
76
{
77
m_ffft
.
forward
(
output_buffer
[x].samples);
78
79
}
80
}
81
}
82
83
src
fft_symbols.cpp
Generated on Mon Oct 20 2014 10:26:27 for fun_ofdm by
1.8.4