commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r7846 - gnuradio/branches/developers/trondeau/ofdmtimi


From: trondeau
Subject: [Commit-gnuradio] r7846 - gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general
Date: Tue, 26 Feb 2008 13:27:15 -0700 (MST)

Author: trondeau
Date: 2008-02-26 13:27:15 -0700 (Tue, 26 Feb 2008)
New Revision: 7846

Modified:
   
gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general/gr_ofdm_sampler.cc
   
gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general/gr_ofdm_sampler.h
   
gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general/gr_ofdm_sampler.i
Log:
Added a basic timeout option to the ofdm symbol block. If a new preamble (start 
of frame) isn't seen within d_timeout_max number of symbols, it stops trying to 
process frames. This can be set externally if the maximum number of possible 
symbols per frame is known; defaults to 100 and saves a lot of processing power 
when nothing is being transmitted.

Modified: 
gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general/gr_ofdm_sampler.cc
===================================================================
--- 
gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general/gr_ofdm_sampler.cc
   2008-02-26 20:08:16 UTC (rev 7845)
+++ 
gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general/gr_ofdm_sampler.cc
   2008-02-26 20:27:15 UTC (rev 7846)
@@ -30,17 +30,19 @@
 
 gr_ofdm_sampler_sptr
 gr_make_ofdm_sampler (unsigned int fft_length, 
-                     unsigned int symbol_length)
+                     unsigned int symbol_length,
+                     unsigned int timeout)
 {
-  return gr_ofdm_sampler_sptr (new gr_ofdm_sampler (fft_length, 
symbol_length));
+  return gr_ofdm_sampler_sptr (new gr_ofdm_sampler (fft_length, symbol_length, 
timeout));
 }
 
 gr_ofdm_sampler::gr_ofdm_sampler (unsigned int fft_length, 
-                                 unsigned int symbol_length)
+                                 unsigned int symbol_length,
+                                 unsigned int timeout)
   : gr_block ("ofdm_sampler",
              gr_make_io_signature2 (2, 2, sizeof (gr_complex), sizeof(char)),
              gr_make_io_signature2 (2, 2, sizeof (gr_complex)*fft_length, 
sizeof(char)*fft_length)),
-    d_state(STATE_NO_SIG), d_fft_length(fft_length), 
d_symbol_length(symbol_length)
+    d_state(STATE_NO_SIG), d_timeout_max(timeout), d_fft_length(fft_length), 
d_symbol_length(symbol_length)
 {
 }
 
@@ -92,7 +94,8 @@
     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;
@@ -109,6 +112,10 @@
       *optr++ = iptr[pos++];
     }
 
+    if(d_timeout-- == 0) {
+      d_state = STATE_NO_SIG;
+    }
+
     consume_each(d_symbol_length); // jump up by 1 fft length and the cyclic 
prefix length
     ret = 1;
     break;

Modified: 
gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general/gr_ofdm_sampler.h
===================================================================
--- 
gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general/gr_ofdm_sampler.h
    2008-02-26 20:08:16 UTC (rev 7845)
+++ 
gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general/gr_ofdm_sampler.h
    2008-02-26 20:27:15 UTC (rev 7846)
@@ -29,7 +29,8 @@
 typedef boost::shared_ptr<gr_ofdm_sampler> gr_ofdm_sampler_sptr;
 
 gr_ofdm_sampler_sptr gr_make_ofdm_sampler (unsigned int fft_length, 
-                                          unsigned int symbol_length);
+                                          unsigned int symbol_length,
+                                          unsigned int timeout=100);
 
 /*!
  * \brief does the rest of the OFDM stuff
@@ -39,15 +40,19 @@
 class gr_ofdm_sampler : public gr_block
 {
   friend gr_ofdm_sampler_sptr gr_make_ofdm_sampler (unsigned int fft_length, 
-                                                   unsigned int symbol_length);
+                                                   unsigned int symbol_length,
+                                                   unsigned int timeout);
 
   gr_ofdm_sampler (unsigned int fft_length, 
-                  unsigned int symbol_length);
+                  unsigned int symbol_length,
+                  unsigned int timeout);
 
  private:
   enum state_t {STATE_NO_SIG, STATE_PREAMBLE, STATE_FRAME};
 
   state_t d_state;
+  unsigned int d_timeout_max;
+  unsigned int d_timeout;
   unsigned int d_fft_length;
   unsigned int d_symbol_length;
 

Modified: 
gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general/gr_ofdm_sampler.i
===================================================================
--- 
gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general/gr_ofdm_sampler.i
    2008-02-26 20:08:16 UTC (rev 7845)
+++ 
gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general/gr_ofdm_sampler.i
    2008-02-26 20:27:15 UTC (rev 7846)
@@ -22,10 +22,14 @@
 
 GR_SWIG_BLOCK_MAGIC(gr,ofdm_sampler)
 
-gr_ofdm_sampler_sptr gr_make_ofdm_sampler (unsigned int fft_length, unsigned 
int symbol_length);
+  gr_ofdm_sampler_sptr gr_make_ofdm_sampler (unsigned int fft_length, 
+                                            unsigned int symbol_length,
+                                            unsigned int timeout=100);
 
 class gr_ofdm_sampler : public gr_sync_block
 {
  private:
-  gr_ofdm_sampler (unsigned int fft_length, unsigned int symbol_length);
+  gr_ofdm_sampler (unsigned int fft_length,
+                  unsigned int symbol_length,
+                  unsigned int timeout);
 };





reply via email to

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