commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r9231 - gnuradio/branches/developers/trondeau/dbs/usrp


From: trondeau
Subject: [Commit-gnuradio] r9231 - gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy
Date: Sun, 10 Aug 2008 16:45:14 -0600 (MDT)

Author: trondeau
Date: 2008-08-10 16:45:14 -0600 (Sun, 10 Aug 2008)
New Revision: 9231

Modified:
   gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/Makefile.am
   gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.cc
   gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.h
   gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.cc
   gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.h
   gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_tv_rx.cc
   gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_tv_rx.h
Log:
changing set_freq return to a structure instead of kludged vector.

Modified: 
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/Makefile.am
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/Makefile.am  
2008-08-10 22:44:40 UTC (rev 9230)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/Makefile.am  
2008-08-10 22:45:14 UTC (rev 9231)
@@ -107,6 +107,7 @@
        usrp_standard.cc                \
        db_boards.cc                    \
        db_base.cc                      \
+       db_basic.cc                     \
        db_tv_rx.cc                     \
        db_flexrf.cc                    \
        db_flexrf_mimo.cc
@@ -142,6 +143,7 @@
        usrp_standard.h                 \
        db_boards.h                     \
        db_base.h                       \
+       db_basic.h                      \
        db_tv_rx.h                      \
        db_flexrf.h                     \
        db_flexrf_mimo.h

Modified: 
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.cc
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.cc   
2008-08-10 22:44:40 UTC (rev 9230)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.cc   
2008-08-10 22:45:14 UTC (rev 9231)
@@ -130,7 +130,7 @@
   throw 0;
 }
 
-std::vector<float> 
+struct freq_result_t
 db_base::set_freq(float target_freq)
 {
   // Set the frequency.
@@ -141,7 +141,6 @@
   // @returns (ok, actual_baseband_freq) where:
   //   ok is True or False and indicates success or failure,
   //   actual_baseband_freq is the RF frequency that corresponds to DC in the 
IF.
-  printf("db_base::set_freq\n");
   throw 0;
 }
 
@@ -151,7 +150,6 @@
   // 
   // @returns (min_gain, max_gain, step_size)
   //   Where gains are expressed in decibels (your mileage may vary)
-  printf("db_base::set_gain_range\n");
   throw 0;
 }
 
@@ -293,9 +291,9 @@
   // Set the daughterboard frequency
   bool ok=true;
   float baseband_freq;
-  std::vector<float> freq = set_freq(target_freq);
-  ok = (bool)freq[0];
-  baseband_freq = freq[1];
+  struct freq_result_t freq = set_freq(target_freq);
+  ok = freq.ok;
+  baseband_freq = freq.baseband_freq;
 
   struct dxc_freq_t dxc_freq = calc_dxc_freq(target_freq, baseband_freq, 
d_usrp->converter_rate());
 

Modified: 
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.h
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.h    
2008-08-10 22:44:40 UTC (rev 9230)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.h    
2008-08-10 22:45:14 UTC (rev 9231)
@@ -50,6 +50,12 @@
   bool  inverted;
 };
 
+struct freq_result_t
+{
+  bool  ok;
+  float baseband_freq;
+};
+
 
/******************************************************************************/
 
 class db_base
@@ -73,7 +79,7 @@
   // derived classes should override the following methods
 
   virtual std::vector<float> freq_range();
-  virtual std::vector<float> set_freq(float target_freq);
+  virtual struct freq_result_t set_freq(float target_freq);
   virtual std::vector<float> gain_range();
   virtual bool set_gain(float gain);
   virtual bool is_quadrature();

Modified: 
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.cc
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.cc 
2008-08-10 22:44:40 UTC (rev 9230)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.cc 
2008-08-10 22:45:14 UTC (rev 9231)
@@ -180,7 +180,8 @@
   return 64e6/child->_refclk_divisor();
 }
 
-std::vector<float>
+//std::vector<float>
+struct freq_result_t
 flexrf_base::set_freq(float freq)
 {
   /*
@@ -189,8 +190,9 @@
     actual_baseband_freq is the RF frequency that corresponds to DC in the IF.
   */
 
-  std::vector<float> args(2, 0);
-  
+  //std::vector<float> args(2, 0);
+  struct freq_result_t args = {0, 0};
+
   // Offsetting the LO helps get the Tx carrier leakage out of the way.
   // This also ensures that on Rx, we're not getting hosed by the
   // FPGA's DC removal loop's time constant.  We were seeing a
@@ -207,8 +209,8 @@
   }
    
   _write_all(R, control, N);
-  args[0] = _lock_detect();
-  args[1] = actual_freq;
+  args.ok = _lock_detect();
+  args.baseband_freq = actual_freq;
   return args;
 }
 

Modified: 
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.h
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.h  
2008-08-10 22:44:40 UTC (rev 9230)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.h  
2008-08-10 22:45:14 UTC (rev 9231)
@@ -47,7 +47,7 @@
   flexrf_base(usrp_basic *usrp, int which);
   ~flexrf_base();
 
-  std::vector<float> set_freq(float freq);
+  struct freq_result_t set_freq(float freq);
   std::vector<float> gain_range();
   bool  set_gain(float gain);
   bool  is_quadrature();

Modified: 
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_tv_rx.cc
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_tv_rx.cc  
2008-08-10 22:44:40 UTC (rev 9230)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_tv_rx.cc  
2008-08-10 22:45:14 UTC (rev 9231)
@@ -109,7 +109,6 @@
   // @param usrp: instance of usrp.source_c
   // @param which: which side: 0 or 1 corresponding to RX_A or RX_B 
respectively
 
-  // FIXME: This is a kluge
   d_usrp = (usrp_basic_rx*)usrp;
   d_tx = false;
 
@@ -126,14 +125,10 @@
   d_fast_tuning = false;
   d_inverted = false;                     // FIXME get rid of this
         
-  printf("Creating db_tv_rx1\n");
   std::vector<float> g = gain_range();                  // initialize gain
-  printf("Creating db_tv_rx2    usrp: %x\n", d_usrp);
   set_gain(float(g[0]+g[1]) / 2.0);
 
-  printf("Creating db_tv_rx3\n");
   bypass_adc_buffers(false);
-  printf("Creating db_tv_rx4\n");
 }
 
 // Gain setting
@@ -198,7 +193,7 @@
   return f;
 }
 
-std::vector<float>
+struct freq_result_t
 db_tv_rx::set_freq(float target_freq)
 {
   // Set the frequency.
@@ -210,7 +205,7 @@
   //   ok is True or False and indicates success or failure,
   //   actual_baseband_freq is the RF frequency that corresponds to DC in the 
IF.
   
-  std::vector<float> args(2, 0);
+  freq_result_t args = {0, 0};
 
   std::vector<float> r = freq_range();
   if((target_freq < r[0]) || (target_freq > r[1])) {
@@ -235,10 +230,8 @@
   buf[2] = control_byte_1(d_fast_tuning, d_reference_divisor);
   buf[3] = control_byte_2(actual_freq, true);
 
-  bool ok = d_usrp->write_i2c(d_i2c_addr, int_seq_to_str (buf));
-
-  args[0] = 1;
-  args[1] = actual_freq - d_second_IF;
+  args.ok = d_usrp->write_i2c(d_i2c_addr, int_seq_to_str (buf));
+  args.baseband_freq = actual_freq - d_second_IF;
   return args;
 }
 

Modified: 
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_tv_rx.h
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_tv_rx.h   
2008-08-10 22:44:40 UTC (rev 9230)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_tv_rx.h   
2008-08-10 22:45:14 UTC (rev 9231)
@@ -43,7 +43,7 @@
           float first_IF, float second_IF);
 
   std::vector<float> freq_range();
-  std::vector<float> set_freq(float target_freq);
+  struct freq_result_t set_freq(float target_freq);
   std::vector<float> gain_range();
   bool               set_gain(float gain);
   bool               is_quadrature();





reply via email to

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