commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r9757 - gnuradio/branches/developers/eb/cppdb-wip/usrp


From: eb
Subject: [Commit-gnuradio] r9757 - gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy
Date: Wed, 8 Oct 2008 17:44:50 -0600 (MDT)

Author: eb
Date: 2008-10-08 17:44:47 -0600 (Wed, 08 Oct 2008)
New Revision: 9757

Modified:
   gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.cc
   gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.h
Log:
cleanup gain initialization

Modified: 
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.cc
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.cc 
2008-10-08 23:22:47 UTC (rev 9756)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.cc 
2008-10-08 23:44:47 UTC (rev 9757)
@@ -51,8 +51,6 @@
   d_usrp->_write_oe(d_which, 0, 0xffff);   // turn off all outputs
   _enable_refclk(false);                // disable refclk
 
-  set_gain(float(gain_min() + gain_max()) / 2.0);  // initialize gain
-  
   set_auto_tr(false);
 }
 
@@ -219,37 +217,7 @@
   return args;
 }
 
-float
-flexrf_base::gain_min()
-{
-  return d_usrp->pga_min();
-}
-
-float
-flexrf_base::gain_max()
-{
-  return d_usrp->pga_max();
-}
-
-float
-flexrf_base::gain_db_per_step()
-{
-  return d_usrp->pga_db_per_step();
-}
-
 bool
-flexrf_base::set_gain(float gain)
-{
-  /*
-    Set the gain.
-    
-    @param gain:  gain in decibels
-    @returns True/False
-  */
-  return _set_pga(gain);
-}
-
-bool
 flexrf_base::_set_pga(float pga_gain)
 {
   if(d_which == 0) {
@@ -307,6 +275,8 @@
   d_usrp->_write_oe(d_which,(POWER_UP|RX_TXN|ENABLE), 0xffff);
   d_usrp->write_io(d_which, (power_on()|RX_TXN), (POWER_UP|RX_TXN|ENABLE));
   set_lo_offset(4e6);
+
+  set_gain(float(gain_min() + gain_max()) / 2.0);  // initialize gain
 }
 
 flexrf_base_tx::~flexrf_base_tx()
@@ -501,6 +471,9 @@
     @returns True/False
   */
   
+  // clamp gain
+  gain = std::max(gain_min(), std::min(gain, gain_max()));
+
   float pga_gain, agc_gain;
   float V_maxgain, V_mingain, V_fullscale, dac_value;
 
@@ -836,6 +809,7 @@
   : flexrf_base_rx(usrp, which)
 {
   d_common = new _2400_common();
+  set_gain((gain_min() + gain_max()) / 2.0);  // initialize gain
 }
 
 db_flexrf_2400_rx::~db_flexrf_2400_rx()
@@ -903,6 +877,7 @@
   : flexrf_base_rx(usrp, which)
 {
   d_common = new _1200_common();
+  set_gain((gain_min() + gain_max()) / 2.0);  // initialize gain
 }
 
 db_flexrf_1200_rx::~db_flexrf_1200_rx()
@@ -969,6 +944,7 @@
   : flexrf_base_rx(usrp, which)
 {
   d_common = new _1800_common();
+  set_gain((gain_min() + gain_max()) / 2.0);  // initialize gain
 }
 
 db_flexrf_1800_rx::~db_flexrf_1800_rx()
@@ -1035,6 +1011,7 @@
   : flexrf_base_rx(usrp, which)
 {
   d_common = new _900_common();
+  set_gain((gain_min() + gain_max()) / 2.0);  // initialize gain
 }
 
 db_flexrf_900_rx::~db_flexrf_900_rx()
@@ -1100,6 +1077,7 @@
   : flexrf_base_rx(usrp, which, POWER_UP)
 {
   d_common = new _400_rx();
+  set_gain((gain_min() + gain_max()) / 2.0);  // initialize gain
 }
 
 db_flexrf_400_rx::~db_flexrf_400_rx()

Modified: 
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.h
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.h  
2008-10-08 23:22:47 UTC (rev 9756)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.h  
2008-10-08 23:44:47 UTC (rev 9757)
@@ -37,10 +37,7 @@
   ~flexrf_base();
 
   struct freq_result_t set_freq(double freq);
-  float gain_min();
-  float gain_max();
-  float gain_db_per_step();
-  bool  set_gain(float gain);
+
   bool  is_quadrature();
   double freq_min();
   double freq_max();
@@ -81,6 +78,7 @@
   flexrf_base_tx(usrp_basic *usrp, int which, int _power_on=0);
   ~flexrf_base_tx();
 
+  // All RFX tx d'boards have fixed gain
   float gain_min();
   float gain_max();
   float gain_db_per_step();





reply via email to

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