summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2016-11-15 11:02:42 -0800
committerJohnathan Corgan <johnathan@corganlabs.com>2016-11-15 11:02:42 -0800
commit0afe21da4895d44533a2effcaf79e5d9e12c72f6 (patch)
tree2081a6b59d4f47426b596da35da501cbb9768fa1
parentcfb2c30f287b9d5de101ea68858217208417de1e (diff)
parentedd02537d4e023a0583a197b9427a562efc588d4 (diff)
Merge branch 'master' into next
-rw-r--r--gr-digital/grc/digital_ofdm_demod.xml1
-rw-r--r--gr-digital/grc/digital_ofdm_frame_acquisition.xml1
-rw-r--r--gr-digital/grc/digital_ofdm_frame_sink.xml1
-rw-r--r--gr-digital/grc/digital_ofdm_insert_preamble.xml1
-rw-r--r--gr-digital/grc/digital_ofdm_mod.xml1
-rw-r--r--gr-digital/grc/digital_ofdm_sampler.xml1
-rw-r--r--gr-digital/grc/digital_ofdm_sync_pn.xml1
-rw-r--r--gr-digital/include/gnuradio/digital/ofdm_frame_acquisition.h1
-rw-r--r--gr-digital/include/gnuradio/digital/ofdm_frame_sink.h1
-rw-r--r--gr-digital/include/gnuradio/digital/ofdm_insert_preamble.h1
-rw-r--r--gr-digital/include/gnuradio/digital/ofdm_mapper_bcv.h1
-rw-r--r--gr-digital/include/gnuradio/digital/ofdm_sampler.h1
-rw-r--r--gr-digital/lib/ofdm_frame_acquisition_impl.cc32
-rw-r--r--gr-digital/lib/ofdm_frame_sink_impl.cc84
-rw-r--r--gr-digital/lib/ofdm_insert_preamble_impl.cc18
-rw-r--r--gr-digital/lib/ofdm_mapper_bcv_impl.cc52
-rw-r--r--gr-digital/lib/ofdm_sampler_impl.cc24
17 files changed, 122 insertions, 100 deletions
diff --git a/gr-digital/grc/digital_ofdm_demod.xml b/gr-digital/grc/digital_ofdm_demod.xml
index 9f3a837157..1a7ce24e18 100644
--- a/gr-digital/grc/digital_ofdm_demod.xml
+++ b/gr-digital/grc/digital_ofdm_demod.xml
@@ -28,6 +28,7 @@
<block>
<name>OFDM Demod</name>
<key>digital_ofdm_demod</key>
+ <category>[Core]/Deprecated</category>
<import>from grc_gnuradio import blks2 as grc_blks2</import>
<import>from gnuradio import digital</import>
<make>grc_blks2.packet_demod_$(type.fcn)(digital.ofdm_demod(
diff --git a/gr-digital/grc/digital_ofdm_frame_acquisition.xml b/gr-digital/grc/digital_ofdm_frame_acquisition.xml
index 2545f18e66..f3fb8d63e4 100644
--- a/gr-digital/grc/digital_ofdm_frame_acquisition.xml
+++ b/gr-digital/grc/digital_ofdm_frame_acquisition.xml
@@ -28,6 +28,7 @@
<block>
<name>OFDM Frame Acquisition</name>
<key>digital_ofdm_frame_acquisition</key>
+ <category>[Core]/Deprecated</category>
<import>from gnuradio import digital</import>
<make>digital.ofdm_frame_acquisition($occupied_carriers, $fft_length, $cplen, $known_symbol, $max_fft_shift_len)</make>
<param>
diff --git a/gr-digital/grc/digital_ofdm_frame_sink.xml b/gr-digital/grc/digital_ofdm_frame_sink.xml
index 64c69ec0ad..b7cc47b97f 100644
--- a/gr-digital/grc/digital_ofdm_frame_sink.xml
+++ b/gr-digital/grc/digital_ofdm_frame_sink.xml
@@ -28,6 +28,7 @@
<block>
<name>OFDM Frame Sink</name>
<key>digital_ofdm_frame_sink</key>
+ <category>[Core]/Deprecated</category>
<import>from gnuradio import digital</import>
<make>digital.ofdm_frame_sink($syms, $vals, $queue, $occ_tones, $ph_gain, $frq_gain)</make>
<param>
diff --git a/gr-digital/grc/digital_ofdm_insert_preamble.xml b/gr-digital/grc/digital_ofdm_insert_preamble.xml
index 9ad8fa793b..593fdbd9b4 100644
--- a/gr-digital/grc/digital_ofdm_insert_preamble.xml
+++ b/gr-digital/grc/digital_ofdm_insert_preamble.xml
@@ -28,6 +28,7 @@
<block>
<name>OFDM Insert Preamble</name>
<key>digital_ofdm_insert_preamble</key>
+ <category>[Core]/Deprecated</category>
<import>from gnuradio import digital</import>
<make>digital.ofdm_insert_preamble($fft_length, $preamble)</make>
<param>
diff --git a/gr-digital/grc/digital_ofdm_mod.xml b/gr-digital/grc/digital_ofdm_mod.xml
index 24cb2aa33c..066f52f2a9 100644
--- a/gr-digital/grc/digital_ofdm_mod.xml
+++ b/gr-digital/grc/digital_ofdm_mod.xml
@@ -28,6 +28,7 @@
<block>
<name>OFDM Mod</name>
<key>digital_ofdm_mod</key>
+ <category>[Core]/Deprecated</category>
<import>from grc_gnuradio import blks2 as grc_blks2</import>
<import>from gnuradio import digital</import>
<make>grc_blks2.packet_mod_$(type.fcn)(digital.ofdm_mod(
diff --git a/gr-digital/grc/digital_ofdm_sampler.xml b/gr-digital/grc/digital_ofdm_sampler.xml
index f3d5c85f39..09a070562b 100644
--- a/gr-digital/grc/digital_ofdm_sampler.xml
+++ b/gr-digital/grc/digital_ofdm_sampler.xml
@@ -28,6 +28,7 @@
<block>
<name>OFDM Sampler</name>
<key>digital_ofdm_sampler</key>
+ <category>[Core]/Deprecated</category>
<import>from gnuradio import digital</import>
<make>digital.ofdm_sampler($fft_length, $symbol_length, $timeout)</make>
<param>
diff --git a/gr-digital/grc/digital_ofdm_sync_pn.xml b/gr-digital/grc/digital_ofdm_sync_pn.xml
index 7a05f394d4..819996cd07 100644
--- a/gr-digital/grc/digital_ofdm_sync_pn.xml
+++ b/gr-digital/grc/digital_ofdm_sync_pn.xml
@@ -28,6 +28,7 @@
<block>
<name>OFDM Sync PN</name>
<key>digital_ofdm_sync_pn</key>
+ <category>[Core]/Deprecated</category>
<import>from gnuradio import digital</import>
<make>digital.ofdm_sync_pn($fft_length, $cp_length, $logging)</make>
<param>
diff --git a/gr-digital/include/gnuradio/digital/ofdm_frame_acquisition.h b/gr-digital/include/gnuradio/digital/ofdm_frame_acquisition.h
index a398e18454..164070e8ca 100644
--- a/gr-digital/include/gnuradio/digital/ofdm_frame_acquisition.h
+++ b/gr-digital/include/gnuradio/digital/ofdm_frame_acquisition.h
@@ -34,6 +34,7 @@ namespace gr {
* \brief take a vector of complex constellation points in from an
* FFT and performs a correlation and equalization.
* \ingroup ofdm_blk
+ * \ingroup deprecated_blk
*
* \details
* This block takes the output of an FFT of a received OFDM symbol
diff --git a/gr-digital/include/gnuradio/digital/ofdm_frame_sink.h b/gr-digital/include/gnuradio/digital/ofdm_frame_sink.h
index 439e1ca135..52839b2acc 100644
--- a/gr-digital/include/gnuradio/digital/ofdm_frame_sink.h
+++ b/gr-digital/include/gnuradio/digital/ofdm_frame_sink.h
@@ -35,6 +35,7 @@ namespace gr {
* 1's, packs them into packets, and sends to to a message queue
* sink.
* \ingroup ofdm_blk
+ * \ingroup deprecated_blk
*
* \details
* NOTE: The mod input parameter simply chooses a pre-defined
diff --git a/gr-digital/include/gnuradio/digital/ofdm_insert_preamble.h b/gr-digital/include/gnuradio/digital/ofdm_insert_preamble.h
index a98e7cf814..c811c9c88a 100644
--- a/gr-digital/include/gnuradio/digital/ofdm_insert_preamble.h
+++ b/gr-digital/include/gnuradio/digital/ofdm_insert_preamble.h
@@ -33,6 +33,7 @@ namespace gr {
* \brief insert "pre-modulated" preamble symbols before each payload.
* \ingroup ofdm_blk
* \ingroup synchronizers_blk
+ * \ingroup deprecated_blk
*
* \details
* <pre>
diff --git a/gr-digital/include/gnuradio/digital/ofdm_mapper_bcv.h b/gr-digital/include/gnuradio/digital/ofdm_mapper_bcv.h
index cdd4a60bc2..392b7730a8 100644
--- a/gr-digital/include/gnuradio/digital/ofdm_mapper_bcv.h
+++ b/gr-digital/include/gnuradio/digital/ofdm_mapper_bcv.h
@@ -35,6 +35,7 @@ namespace gr {
* constellation points suitable for IFFT input to be used in an
* ofdm modulator.
* \ingroup ofdm_blk
+ * \ingroup deprecated_blk
*
* \details
* Abstract class must be subclassed with specific mapping.
diff --git a/gr-digital/include/gnuradio/digital/ofdm_sampler.h b/gr-digital/include/gnuradio/digital/ofdm_sampler.h
index 59bc36a7c2..da4410478b 100644
--- a/gr-digital/include/gnuradio/digital/ofdm_sampler.h
+++ b/gr-digital/include/gnuradio/digital/ofdm_sampler.h
@@ -32,6 +32,7 @@ namespace gr {
/*!
* \brief does the rest of the OFDM stuff
* \ingroup ofdm_blk
+ * \ingroup deprecated_blk
*/
class DIGITAL_API ofdm_sampler : virtual public block
{
diff --git a/gr-digital/lib/ofdm_frame_acquisition_impl.cc b/gr-digital/lib/ofdm_frame_acquisition_impl.cc
index 2c2d6eff7a..02b587c1de 100644
--- a/gr-digital/lib/ofdm_frame_acquisition_impl.cc
+++ b/gr-digital/lib/ofdm_frame_acquisition_impl.cc
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2006-2008,2010,2011 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,
@@ -32,14 +32,14 @@
namespace gr {
namespace digital {
-
+
#define VERBOSE 0
#define M_TWOPI (2*M_PI)
#define MAX_NUM_SYMBOLS 1000
ofdm_frame_acquisition::sptr
ofdm_frame_acquisition::make(unsigned int occupied_carriers,
- unsigned int fft_length,
+ unsigned int fft_length,
unsigned int cplen,
const std::vector<gr_complex> &known_symbol,
unsigned int max_fft_shift_len)
@@ -50,7 +50,7 @@ namespace gr {
}
ofdm_frame_acquisition_impl::ofdm_frame_acquisition_impl(unsigned occupied_carriers,
- unsigned int fft_length,
+ unsigned int fft_length,
unsigned int cplen,
const std::vector<gr_complex> &known_symbol,
unsigned int max_fft_shift_len)
@@ -65,6 +65,8 @@ namespace gr {
d_coarse_freq(0),
d_phase_count(0)
{
+ GR_LOG_WARN(d_logger, "The gr::digital::ofdm_frame_acquisition block has been deprecated.");
+
d_symbol_phase_diff.resize(d_fft_length);
d_known_phase_diff.resize(d_occupied_carriers);
d_hestimate.resize(d_occupied_carriers);
@@ -75,7 +77,7 @@ namespace gr {
for(i = 0; i < d_known_symbol.size()-2; i+=2) {
d_known_phase_diff[i] = norm(d_known_symbol[i] - d_known_symbol[i+2]);
}
-
+
d_phase_lut = new gr_complex[(2*d_freq_shift_len+1) * MAX_NUM_SYMBOLS];
for(i = 0; i <= 2*d_freq_shift_len; i++) {
for(j = 0; j < MAX_NUM_SYMBOLS; j++) {
@@ -112,7 +114,7 @@ namespace gr {
ofdm_frame_acquisition_impl::correlate(const gr_complex *symbol, int zeros_on_left)
{
unsigned int i,j;
-
+
std::fill(d_symbol_phase_diff.begin(), d_symbol_phase_diff.end(), 0);
for(i = 0; i < d_fft_length-2; i++) {
d_symbol_phase_diff[i] = norm(symbol[i] - symbol[i+2]);
@@ -142,16 +144,16 @@ namespace gr {
unsigned int i=0;
// Set first tap of equalizer
- d_hestimate[0] = d_known_symbol[0] /
+ d_hestimate[0] = d_known_symbol[0] /
(coarse_freq_comp(d_coarse_freq,1)*symbol[zeros_on_left+d_coarse_freq]);
// set every even tap based on known symbol
// linearly interpolate between set carriers to set zero-filled carriers
// FIXME: is this the best way to set this?
for(i = 2; i < d_occupied_carriers; i+=2) {
- d_hestimate[i] = d_known_symbol[i] /
+ d_hestimate[i] = d_known_symbol[i] /
(coarse_freq_comp(d_coarse_freq,1)*(symbol[i+zeros_on_left+d_coarse_freq]));
- d_hestimate[i-1] = (d_hestimate[i] + d_hestimate[i-2]) / gr_complex(2.0, 0.0);
+ d_hestimate[i-1] = (d_hestimate[i] + d_hestimate[i-2]) / gr_complex(2.0, 0.0);
}
// with even number of carriers; last equalizer tap is wrong
@@ -164,7 +166,7 @@ namespace gr {
for(i = 0; i < d_occupied_carriers; i++) {
gr_complex sym = coarse_freq_comp(d_coarse_freq,1)*symbol[i+zeros_on_left+d_coarse_freq];
gr_complex output = sym * d_hestimate[i];
- fprintf(stderr, "sym: %+.4f + j%+.4f ks: %+.4f + j%+.4f eq: %+.4f + j%+.4f ==> %+.4f + j%+.4f\n",
+ fprintf(stderr, "sym: %+.4f + j%+.4f ks: %+.4f + j%+.4f eq: %+.4f + j%+.4f ==> %+.4f + j%+.4f\n",
sym .real(), sym.imag(),
d_known_symbol[i].real(), d_known_symbol[i].imag(),
d_hestimate[i].real(), d_hestimate[i].imag(),
@@ -185,7 +187,7 @@ namespace gr {
gr_complex *out = (gr_complex *) output_items[0];
char *signal_out = (char *) output_items[1];
-
+
int unoccupied_carriers = d_fft_length - d_occupied_carriers;
int zeros_on_left = (int)ceil(unoccupied_carriers/2.0);
@@ -203,7 +205,7 @@ namespace gr {
out[i] = d_hestimate[i]*coarse_freq_comp(d_coarse_freq,d_phase_count)
*symbol[i+zeros_on_left+d_coarse_freq];
}
-
+
d_phase_count++;
if(d_phase_count == MAX_NUM_SYMBOLS) {
d_phase_count = 1;
diff --git a/gr-digital/lib/ofdm_frame_sink_impl.cc b/gr-digital/lib/ofdm_frame_sink_impl.cc
index b2e4f44ec9..2493667255 100644
--- a/gr-digital/lib/ofdm_frame_sink_impl.cc
+++ b/gr-digital/lib/ofdm_frame_sink_impl.cc
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2007,2008,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,
@@ -47,7 +47,7 @@ namespace gr {
d_state = STATE_SYNC_SEARCH;
}
-
+
inline void
ofdm_frame_sink_impl::enter_have_sync()
{
@@ -82,7 +82,7 @@ namespace gr {
d_packetlen_cnt = 0;
if(VERBOSE)
- fprintf(stderr, "@ enter_have_header (payload_len = %d) (offset = %d)\n",
+ fprintf(stderr, "@ enter_have_header (payload_len = %d) (offset = %d)\n",
d_packetlen, d_packet_whitener_offset);
}
@@ -93,7 +93,7 @@ namespace gr {
unsigned int min_index = 0;
float min_euclid_dist = norm(x - d_sym_position[0]);
float euclid_dist = 0;
-
+
for(unsigned int j = 1; j < table_size; j++){
euclid_dist = norm(x - d_sym_position[j]);
if(euclid_dist < min_euclid_dist){
@@ -121,26 +121,26 @@ namespace gr {
d_nresid = 0;
d_resid = 0;
}
-
+
//while((d_byte_offset < 8) && (i < d_occupied_carriers)) {
while((d_byte_offset < 8) && (i < d_subcarrier_map.size())) {
//gr_complex sigrot = in[i]*carrier*d_dfe[i];
gr_complex sigrot = in[d_subcarrier_map[i]]*carrier*d_dfe[i];
-
+
if(d_derotated_output != NULL){
d_derotated_output[i] = sigrot;
}
-
+
char bits = slicer(sigrot);
gr_complex closest_sym = d_sym_position[bits];
-
+
accum_error += sigrot * conj(closest_sym);
// FIX THE FOLLOWING STATEMENT
if(norm(sigrot)> 0.001)
d_dfe[i] += d_eq_gain*(closest_sym/sigrot-d_dfe[i]);
-
+
i++;
if((8 - d_byte_offset) >= d_nbits) {
@@ -154,7 +154,7 @@ namespace gr {
d_resid = bits >> (8-d_byte_offset);
d_byte_offset += (d_nbits - d_nresid);
}
- //printf("demod symbol: %.4f + j%.4f bits: %x partial_byte: %x byte_offset: %d resid: %x nresid: %d\n",
+ //printf("demod symbol: %.4f + j%.4f bits: %x partial_byte: %x byte_offset: %d resid: %x nresid: %d\n",
// in[i-1].real(), in[i-1].imag(), bits, d_partial_byte, d_byte_offset, d_resid, d_nresid);
}
@@ -175,16 +175,16 @@ namespace gr {
d_phase -= 2*M_PI;
if(d_phase <0)
d_phase += 2*M_PI;
-
+
//if(VERBOSE)
// std::cerr << angle << "\t" << d_freq << "\t" << d_phase << "\t" << std::endl;
-
+
return bytes_produced;
}
ofdm_frame_sink::sptr
- ofdm_frame_sink::make(const std::vector<gr_complex> &sym_position,
+ ofdm_frame_sink::make(const std::vector<gr_complex> &sym_position,
const std::vector<char> &sym_value_out,
msg_queue::sptr target_queue,
int occupied_carriers,
@@ -196,7 +196,7 @@ namespace gr {
phase_gain, freq_gain));
}
- ofdm_frame_sink_impl::ofdm_frame_sink_impl(const std::vector<gr_complex> &sym_position,
+ ofdm_frame_sink_impl::ofdm_frame_sink_impl(const std::vector<gr_complex> &sym_position,
const std::vector<char> &sym_value_out,
msg_queue::sptr target_queue,
int occupied_carriers,
@@ -204,22 +204,24 @@ namespace gr {
: sync_block("ofdm_frame_sink",
io_signature::make2(2, 2, sizeof(gr_complex)*occupied_carriers, sizeof(char)),
io_signature::make(1, 1, sizeof(gr_complex)*occupied_carriers)),
- d_target_queue(target_queue), d_occupied_carriers(occupied_carriers),
+ d_target_queue(target_queue), d_occupied_carriers(occupied_carriers),
d_byte_offset(0), d_partial_byte(0),
d_resid(0), d_nresid(0),d_phase(0),d_freq(0),
d_phase_gain(phase_gain),d_freq_gain(freq_gain),
d_eq_gain(0.05)
{
+ GR_LOG_WARN(d_logger, "The gr::digital::ofdm_frame_sync block has been deprecated.");
+
std::string carriers = "FE7F";
// A bit hacky to fill out carriers to occupied_carriers length
- int diff = (d_occupied_carriers - 4*carriers.length());
+ int diff = (d_occupied_carriers - 4*carriers.length());
while(diff > 7) {
carriers.insert(0, "f");
carriers.insert(carriers.length(), "f");
diff -= 8;
}
-
+
// if there's extras left to be processed
// divide remaining to put on either side of current map
// all of this is done to stick with the concept of a carrier map string that
@@ -229,7 +231,7 @@ namespace gr {
int diff_right=0;
// dictionary to convert from integers to ascii hex representation
- char abc[16] = {'0', '1', '2', '3', '4', '5', '6', '7',
+ char abc[16] = {'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
if(diff > 0) {
char c[2] = {0,0};
@@ -237,7 +239,7 @@ namespace gr {
diff_left = (int)ceil((float)diff/2.0f); // number of carriers to put on the left side
c[0] = abc[(1 << diff_left) - 1]; // convert to bits and move to ASCI integer
carriers.insert(0, c);
-
+
diff_right = diff - diff_left; // number of carriers to put on the right side
c[0] = abc[0xF^((1 << diff_right) - 1)]; // convert to bits and move to ASCI integer
carriers.insert(carriers.length(), c);
@@ -258,7 +260,7 @@ namespace gr {
}
}
}
-
+
// make sure we stay in the limit currently imposed by the occupied_carriers
if(d_subcarrier_map.size() > (size_t)d_occupied_carriers) {
throw std::invalid_argument("ofdm_frame_sink_impl: subcarriers allocated exceeds size of occupied carriers");
@@ -269,7 +271,7 @@ namespace gr {
fill(d_dfe.begin(), d_dfe.end(), gr_complex(1.0,0.0));
set_sym_value_out(sym_position, sym_value_out);
-
+
enter_search();
}
@@ -279,7 +281,7 @@ namespace gr {
}
bool
- ofdm_frame_sink_impl::set_sym_value_out(const std::vector<gr_complex> &sym_position,
+ ofdm_frame_sink_impl::set_sym_value_out(const std::vector<gr_complex> &sym_position,
const std::vector<char> &sym_value_out)
{
if(sym_position.size() != sym_value_out.size())
@@ -310,7 +312,7 @@ namespace gr {
d_derotated_output = (gr_complex *)output_items[0];
else
d_derotated_output = NULL;
-
+
if(VERBOSE)
fprintf(stderr,">>> Entering state machine\n");
@@ -318,17 +320,17 @@ namespace gr {
case STATE_SYNC_SEARCH: // Look for flag indicating beginning of pkt
if(VERBOSE)
fprintf(stderr,"SYNC Search, noutput=%d\n", noutput_items);
-
+
if(sig[0]) { // Found it, set up for header decode
enter_have_sync();
}
break;
case STATE_HAVE_SYNC:
- // only demod after getting the preamble signal; otherwise, the
+ // only demod after getting the preamble signal; otherwise, the
// equalizer taps will screw with the PLL performance
bytes = demapper(&in[0], d_bytes_out);
-
+
if(VERBOSE) {
if(sig[0])
printf("ERROR -- Found SYNC in HAVE_SYNC\n");
@@ -340,29 +342,29 @@ namespace gr {
while(j < bytes) {
d_header = (d_header << 8) | (d_bytes_out[j] & 0xFF);
j++;
-
+
if(++d_headerbytelen_cnt == HEADERBYTELEN) {
if(VERBOSE)
fprintf(stderr, "got header: 0x%08x\n", d_header);
-
+
// we have a full header, check to see if it has been received properly
if(header_ok()) {
enter_have_header();
-
+
if(VERBOSE)
printf("\nPacket Length: %d\n", d_packetlen);
-
+
while((j < bytes) && (d_packetlen_cnt < d_packetlen)) {
d_packet[d_packetlen_cnt++] = d_bytes_out[j++];
}
-
+
if(d_packetlen_cnt == d_packetlen) {
message::sptr msg =
message::make(0, d_packet_whitener_offset, 0, d_packetlen);
memcpy(msg->msg(), d_packet, d_packetlen_cnt);
d_target_queue->insert_tail(msg); // send it
msg.reset(); // free it up
-
+
enter_search();
}
}
@@ -372,7 +374,7 @@ namespace gr {
}
}
break;
-
+
case STATE_HAVE_HEADER:
bytes = demapper(&in[0], d_bytes_out);
@@ -381,27 +383,27 @@ namespace gr {
printf("ERROR -- Found SYNC in HAVE_HEADER at %d, length of %d\n", d_packetlen_cnt, d_packetlen);
fprintf(stderr,"Packet Build\n");
}
-
+
j = 0;
while(j < bytes) {
d_packet[d_packetlen_cnt++] = d_bytes_out[j++];
-
+
if (d_packetlen_cnt == d_packetlen){ // packet is filled
// build a message
// NOTE: passing header field as arg1 is not scalable
message::sptr msg =
message::make(0, d_packet_whitener_offset, 0, d_packetlen_cnt);
memcpy(msg->msg(), d_packet, d_packetlen_cnt);
-
+
d_target_queue->insert_tail(msg); // send it
msg.reset(); // free it up
-
+
enter_search();
break;
}
}
break;
-
+
default:
assert(0);
} // switch
diff --git a/gr-digital/lib/ofdm_insert_preamble_impl.cc b/gr-digital/lib/ofdm_insert_preamble_impl.cc
index dcc3a900a4..4a617cecb2 100644
--- a/gr-digital/lib/ofdm_insert_preamble_impl.cc
+++ b/gr-digital/lib/ofdm_insert_preamble_impl.cc
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2007,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 this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
@@ -31,7 +31,7 @@
namespace gr {
namespace digital {
-
+
ofdm_insert_preamble::sptr
ofdm_insert_preamble::make(int fft_length,
const std::vector<std::vector<gr_complex> > &preamble)
@@ -55,6 +55,8 @@ namespace gr {
d_pending_flag(0),
d_preamble(preamble)
{
+ GR_LOG_WARN(d_logger, "The gr::digital::ofdm_insert_preamble block has been deprecated.");
+
// sanity check preamble symbols
for(size_t i = 0; i < d_preamble.size(); i++) {
if(d_preamble[i].size() != (size_t) d_fft_length)
@@ -113,7 +115,7 @@ namespace gr {
else
ni++; // eat one input symbol
break;
-
+
case ST_PREAMBLE:
assert(!in_flag || in_flag[ni] & 0x1);
if(d_nsymbols_output >= (int) d_preamble.size()) {
@@ -130,7 +132,7 @@ namespace gr {
d_nsymbols_output++;
}
break;
-
+
case ST_FIRST_PAYLOAD:
// copy first payload symbol from input to output
memcpy(&out_sym[no * d_fft_length],
@@ -142,7 +144,7 @@ namespace gr {
ni++;
enter_payload();
break;
-
+
case ST_PAYLOAD:
if(in_flag && in_flag[ni] & 0x1) { // this is first symbol of a new payload
enter_preamble();
diff --git a/gr-digital/lib/ofdm_mapper_bcv_impl.cc b/gr-digital/lib/ofdm_mapper_bcv_impl.cc
index b241a3be71..c763d2f71b 100644
--- a/gr-digital/lib/ofdm_mapper_bcv_impl.cc
+++ b/gr-digital/lib/ofdm_mapper_bcv_impl.cc
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2006-2008,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,
@@ -34,19 +34,19 @@ namespace gr {
ofdm_mapper_bcv::sptr
ofdm_mapper_bcv::make(const std::vector<gr_complex> &constellation,
- unsigned int msgq_limit,
+ unsigned int msgq_limit,
unsigned int occupied_carriers,
unsigned int fft_length)
{
return gnuradio::get_initial_sptr
- (new ofdm_mapper_bcv_impl(constellation, msgq_limit,
+ (new ofdm_mapper_bcv_impl(constellation, msgq_limit,
occupied_carriers, fft_length));
}
// Consumes 1 packet and produces as many OFDM symbols of
// fft_length to hold the full packet
ofdm_mapper_bcv_impl::ofdm_mapper_bcv_impl(const std::vector<gr_complex> &constellation,
- unsigned int msgq_limit,
+ unsigned int msgq_limit,
unsigned int occupied_carriers,
unsigned int fft_length)
: sync_block("ofdm_mapper_bcv",
@@ -61,6 +61,8 @@ namespace gr {
d_resid(0),
d_nresid(0)
{
+ GR_LOG_WARN(d_logger, "The gr::digital::ofdm_mapper_bcv block has been deprecated.");
+
if(!(d_occupied_carriers <= d_fft_length))
throw std::invalid_argument("ofdm_mapper_bcv_impl: occupied carriers must be <= fft_length");
@@ -72,7 +74,7 @@ namespace gr {
std::string carriers = "FE7F";
// A bit hacky to fill out carriers to occupied_carriers length
- int diff = (d_occupied_carriers - 4*carriers.length());
+ int diff = (d_occupied_carriers - 4*carriers.length());
while(diff > 7) {
carriers.insert(0, "f");
carriers.insert(carriers.length(), "f");
@@ -88,7 +90,7 @@ namespace gr {
int diff_right=0;
// dictionary to convert from integers to ascii hex representation
- char abc[16] = {'0', '1', '2', '3', '4', '5', '6', '7',
+ char abc[16] = {'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
if(diff > 0) {
char c[2] = {0,0};
@@ -96,23 +98,23 @@ namespace gr {
diff_left = (int)ceil((float)diff/2.0f); // number of carriers to put on the left side
c[0] = abc[(1 << diff_left) - 1]; // convert to bits and move to ASCI integer
carriers.insert(0, c);
-
+
diff_right = diff - diff_left; // number of carriers to put on the right side
c[0] = abc[0xF^((1 << diff_right) - 1)]; // convert to bits and move to ASCI integer
carriers.insert(carriers.length(), c);
}
-
+
// find out how many zeros to pad on the sides; the difference between the fft length and the subcarrier
- // mapping size in chunks of four. This is the number to pack on the left and this number plus any
- // residual nulls (if odd) will be packed on the right.
- diff = (d_fft_length/4 - carriers.length())/2;
+ // mapping size in chunks of four. This is the number to pack on the left and this number plus any
+ // residual nulls (if odd) will be packed on the right.
+ diff = (d_fft_length/4 - carriers.length())/2;
unsigned int i,j,k;
for(i = 0; i < carriers.length(); i++) {
char c = carriers[i]; // get the current hex character from the string
for(j = 0; j < 4; j++) { // walk through all four bits
k = (strtol(&c, NULL, 16) >> (3-j)) & 0x1; // convert to int and extract next bit
- if(k) { // if bit is a 1,
+ if(k) { // if bit is a 1,
d_subcarrier_map.push_back(4*(i+diff) + j); // use this subcarrier
}
}
@@ -122,7 +124,7 @@ namespace gr {
if(d_subcarrier_map.size() > d_occupied_carriers) {
throw std::invalid_argument("ofdm_mapper_bcv_impl: subcarriers allocated exceeds size of occupied carriers");
}
-
+
d_nbits = (unsigned long)ceil(log10(float(d_constellation.size())) / log10(2.0));
}
@@ -141,7 +143,7 @@ namespace gr {
gr_vector_void_star &output_items)
{
gr_complex *out = (gr_complex *)output_items[0];
-
+
unsigned int i=0;
//printf("OFDM BPSK Mapper: ninput_items: %d noutput_items: %d\n", ninput_items[0], noutput_items);
@@ -149,13 +151,13 @@ namespace gr {
if(d_eof) {
return -1;
}
-
+
if(!d_msg) {
d_msg = d_msgq->delete_head(); // block, waiting for a message
d_msg_offset = 0;
d_bit_offset = 0;
d_pending_flag = 1; // new packet, write start of packet flag
-
+
if((d_msg->length() == 0) && (d_msg->type() == 1)) {
d_msg.reset();
return -1; // We're done; no more messages coming.
@@ -165,12 +167,12 @@ namespace gr {
char *out_flag = 0;
if(output_items.size() == 2)
out_flag = (char *) output_items[1];
-
+
// Build a single symbol:
// Initialize all bins to 0 to set unused carriers
memset(out, 0, d_fft_length*sizeof(gr_complex));
-
+
i = 0;
unsigned char bits = 0;
//while((d_msg_offset < d_msg->length()) && (i < d_occupied_carriers)) {
@@ -193,7 +195,7 @@ namespace gr {
d_bit_offset += d_nresid;
d_nresid = 0;
d_resid = 0;
- //printf("mod bit(r): %x resid: %x nresid: %d bit_offset: %d\n",
+ //printf("mod bit(r): %x resid: %x nresid: %d bit_offset: %d\n",
// bits, d_resid, d_nresid, d_bit_offset);
}
else {
@@ -201,11 +203,11 @@ namespace gr {
// take the nbits number of bits at a time from the byte to add to the symbol
bits = ((1 << d_nbits)-1) & (d_msgbytes >> d_bit_offset);
d_bit_offset += d_nbits;
-
+
out[d_subcarrier_map[i]] = d_constellation[bits];
i++;
}
- else { // if we can't fit nbits, store them for the next
+ else { // if we can't fit nbits, store them for the next
// saves d_nresid bits of this message where d_nresid < d_nbits
unsigned int extra = 8-d_bit_offset;
d_resid = ((1 << extra)-1) & (d_msgbytes >> d_bit_offset);
@@ -213,7 +215,7 @@ namespace gr {
d_nresid = d_nbits - extra;
}
}
-
+
if(d_bit_offset == 8) {
d_bit_offset = 0;
d_msg_offset++;
diff --git a/gr-digital/lib/ofdm_sampler_impl.cc b/gr-digital/lib/ofdm_sampler_impl.cc
index dd6197dfc7..01fa24d9a9 100644
--- a/gr-digital/lib/ofdm_sampler_impl.cc
+++ b/gr-digital/lib/ofdm_sampler_impl.cc
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2007,2008,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,
@@ -31,9 +31,9 @@
namespace gr {
namespace digital {
-
+
ofdm_sampler::sptr
- ofdm_sampler::make(unsigned int fft_length,
+ ofdm_sampler::make(unsigned int fft_length,
unsigned int symbol_length,
unsigned int timeout)
{
@@ -41,7 +41,7 @@ namespace gr {
(new ofdm_sampler_impl(fft_length, symbol_length, timeout));
}
- ofdm_sampler_impl::ofdm_sampler_impl(unsigned int fft_length,
+ ofdm_sampler_impl::ofdm_sampler_impl(unsigned int fft_length,
unsigned int symbol_length,
unsigned int timeout)
: block("ofdm_sampler",
@@ -50,6 +50,8 @@ namespace gr {
d_state(STATE_NO_SIG), d_timeout_max(timeout),
d_fft_length(fft_length), d_symbol_length(symbol_length)
{
+ GR_LOG_WARN(d_logger, "The gr::digital::ofdm_sampler block has been deprecated.");
+
set_relative_rate(1.0/(double) fft_length); // buffer allocator hint
}
@@ -80,7 +82,7 @@ namespace gr {
gr_complex *optr = (gr_complex*)output_items[0];
char *outsig = (char*)output_items[1];
- //FIXME: we only process a single OFDM symbol at a time; after the preamble, we can
+ //FIXME: we only process a single OFDM symbol at a time; after the preamble, we can
// process a few at a time as long as we always look out for the next preamble.
unsigned int index = d_fft_length; // start one fft length into the input so we can always look back this far
@@ -96,7 +98,7 @@ namespace gr {
else
index++;
}
-
+
unsigned int i, pos, ret;
switch(d_state) {
case(STATE_PREAMBLE):
@@ -104,13 +106,13 @@ namespace gr {
for(i = (index - d_fft_length + 1); i <= index; i++) {
*optr++ = iptr[i];
}
-
+
d_timeout = d_timeout_max; // tell the system to expect at least this many symbols for a frame
d_state = STATE_FRAME;
consume_each(index - d_fft_length + 1); // consume up to one fft_length away to keep the history
ret = 1;
break;
-
+
case(STATE_FRAME):
// use this state when we have processed a preamble and are getting the rest of the frames
//FIXME: we could also have a power squelch system here to enter STATE_NO_SIG if no power is received