commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 03/03: digital: add deprecation warnings to


From: git
Subject: [Commit-gnuradio] [gnuradio] 03/03: digital: add deprecation warnings to appropriate OFDM blocks
Date: Tue, 15 Nov 2016 19:18:50 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch master
in repository gnuradio.

commit edd02537d4e023a0583a197b9427a562efc588d4
Author: Johnathan Corgan <address@hidden>
Date:   Tue Nov 15 11:01:24 2016 -0800

    digital: add deprecation warnings to appropriate OFDM blocks
---
 gr-digital/lib/ofdm_frame_acquisition_impl.cc | 32 +++++-----
 gr-digital/lib/ofdm_frame_sink_impl.cc        | 84 ++++++++++++++-------------
 gr-digital/lib/ofdm_insert_preamble_impl.cc   | 18 +++---
 gr-digital/lib/ofdm_mapper_bcv_impl.cc        | 52 +++++++++--------
 gr-digital/lib/ofdm_sampler_impl.cc           | 24 ++++----
 5 files changed, 110 insertions(+), 100 deletions(-)

diff --git a/gr-digital/lib/ofdm_frame_acquisition_impl.cc 
b/gr-digital/lib/ofdm_frame_acquisition_impl.cc
index 2c2d6ef..02b587c 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 b2e4f44..2493667 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 dcc3a90..4a617ce 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 b241a3b..c763d2f 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 dd6197d..01fa24d 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]