commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: eb
Subject: [Commit-gnuradio] r9762 - gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy
Date: Wed, 8 Oct 2008 23:00:08 -0600 (MDT)

Author: eb
Date: 2008-10-08 23:00:06 -0600 (Wed, 08 Oct 2008)
New Revision: 9762

Modified:
   gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.cc
   gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.h
   gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_basic.cc
   gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.cc
   gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.h
   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
   gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_tv_rx.cc
Log:
Use new usrp_basic methods in db_* code.  
Removed all uses of d_tx and d_slot.


Modified: 
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.cc
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.cc   
2008-10-09 04:22:38 UTC (rev 9761)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.cc   
2008-10-09 05:00:06 UTC (rev 9762)
@@ -36,19 +36,9 @@
 /*****************************************************************************/
 
 
-db_base::db_base(usrp_basic *usrp, int which, bool tx)
-  : d_usrp(usrp), d_which(which), d_tx(tx),
-    d_lo_offset(0.0)
+db_base::db_base(usrp_basic *usrp, int which)
+  : d_usrp(usrp), d_which(which), d_lo_offset(0.0)
 {
-  if(d_tx) {
-    d_slot = d_which * 2;
-  }
-  else {
-    d_slot = d_which * 2 + 1;
-  }
-   
-  int refclktable[4] = {FR_TX_A_REFCLK, FR_RX_A_REFCLK, FR_TX_B_REFCLK, 
FR_RX_B_REFCLK};
-  d_refclk_reg = refclktable[d_slot];
 }
 
 
@@ -83,13 +73,12 @@
 bool
 db_base::bypass_adc_buffers(bool bypass)
 {
-  if(d_tx) {
-    throw  std::runtime_error("TX Board has no adc buffers\n");
-  }
+  //if(d_tx) {
+  //  throw  std::runtime_error("TX Board has no adc buffers\n");
+  //}
 
   bool ok = true;
   if(d_which==0) {
-    
     ok &= d_usrp->set_adc_buffer_bypass(0, bypass);
     ok &= d_usrp->set_adc_buffer_bypass(1, bypass);
   }
@@ -104,21 +93,21 @@
 db_base::set_atr_mask(int v)
 {
   // Set Auto T/R mask.
-  return d_usrp->_write_fpga_reg(FR_ATR_MASK_0 + 3 * d_slot, v);
+  return d_usrp->write_atr_mask(d_which, v);
 }
 
 bool 
 db_base::set_atr_txval(int v)
 {
   // Set Auto T/R register value to be used when transmitting.
-  return d_usrp->_write_fpga_reg(FR_ATR_TXVAL_0 + 3 * d_slot, v);
+  return d_usrp->write_atr_txval(d_which, v);
 }
   
 bool 
 db_base::set_atr_rxval(int v)
 {
   // Set Auto T/R register value to be used when receiving.
-  return d_usrp->_write_fpga_reg(FR_ATR_RXVAL_0 + 3 * d_slot, v);
+  return d_usrp->write_atr_rxval(d_which, v);
 }
   
 bool 
@@ -126,7 +115,7 @@
 {
   // Set Auto T/R delay (in clock ticks) from when Tx fifo gets data to 
   // when T/R switches.
-  return d_usrp->_write_fpga_reg(FR_ATR_TX_DELAY, v);
+  return d_usrp->write_atr_tx_delay(v);
 }
 
 bool 
@@ -134,35 +123,9 @@
 {
   // Set Auto T/R delay (in clock ticks) from when Tx fifo goes empty to 
   // when T/R switches.
-  return d_usrp->_write_fpga_reg(FR_ATR_RX_DELAY, v);
+  return d_usrp->write_atr_rx_delay(v);
 }
 
-double 
-db_base::freq_min()
-{
-  throw std::runtime_error("freq_min() called from base class\n");
-}
-
-double
-db_base::freq_max()
-{
-  throw std::runtime_error("freq_max() called from base class\n");
-}
-
-struct freq_result_t
-db_base::set_freq(double target_freq)
-{
-  // Set the frequency.
-  //
-  // @param freq:  target RF frequency in Hz
-  // @type freq:   double
-  // 
-  // @returns (ok, actual_baseband_freq) where:
-  //   ok is True or False and indicates success or failure,
-  //   actual_baseband_freq is RF frequency that corresponds to DC in the IF.
-  throw std::runtime_error("set_freq() called from base class\n");
-}
-
 bool
 db_base::i_and_q_swapped()
 {
@@ -241,12 +204,10 @@
 
   if(enable) {
     d_usrp->_write_oe(d_which, CLOCK_OUT, CLOCK_OUT); // output enable
-    d_usrp->_write_fpga_reg(d_refclk_reg,
-                           ((_refclk_divisor() & REFCLK_DIVISOR_MASK)
-                            | REFCLK_ENABLE));
+    d_usrp->write_refclk(d_which, (_refclk_divisor() & REFCLK_DIVISOR_MASK) | 
REFCLK_ENABLE);
   }
   else {
-    d_usrp->_write_fpga_reg(d_refclk_reg, 0);
+    d_usrp->write_refclk(d_which, 0);
   }
 }
 

Modified: 
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.h
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.h    
2008-10-09 04:22:38 UTC (rev 9761)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.h    
2008-10-09 05:00:06 UTC (rev 9762)
@@ -56,7 +56,7 @@
 class db_base
 {
  public:
-  db_base(usrp_basic *usrp, int which, bool tx=true);
+  db_base(usrp_basic *usrp, int which);
   virtual ~db_base();
 
   int dbid();
@@ -101,9 +101,6 @@
 
   usrp_basic   *d_usrp;
   int          d_which;
-  bool         d_tx;
-  int          d_slot;
-  int          d_refclk_reg;
   double       d_lo_offset;
 };
 

Modified: 
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_basic.cc
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_basic.cc  
2008-10-09 04:22:38 UTC (rev 9761)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_basic.cc  
2008-10-09 05:00:06 UTC (rev 9762)
@@ -24,19 +24,14 @@
 
/******************************************************************************/
 
 db_basic_tx::db_basic_tx(usrp_basic *usrp, int which)
-  : db_base(usrp, which, true)
+  : db_base(usrp, which)
 {
   // Handler for Basic Tx daughterboards.
   // 
   // @param usrp: instance of usrp.source_c
   // @param which: which side: 0 or 1 corresponding to TX_A or TX_B 
respectively
 
-  d_tx = true;
-
-  if(0) {
-    // Doing this would give us a different default than the historical 
values...
-    set_gain(float(gain_min() + gain_max()) / 2);         // initialize gain
-  }
+  set_gain((gain_min() + gain_max()) / 2);         // initialize gain
 }
 
 db_basic_tx::~db_basic_tx()
@@ -117,7 +112,7 @@
 
 
 db_basic_rx::db_basic_rx(usrp_basic *usrp, int which, int subdev)
-  : db_base(usrp, which, false)
+  : db_base(usrp, which)
 {
   // Handler for Basic Rx daughterboards.
   // 

Modified: 
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.cc
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.cc 
2008-10-09 04:22:38 UTC (rev 9761)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.cc 
2008-10-09 05:00:06 UTC (rev 9762)
@@ -30,16 +30,13 @@
 
 
 db_dbs_rx::db_dbs_rx(usrp_basic *usrp, int which)
-  : db_base(usrp, which, false)
+  : db_base(usrp, which)
 {
   // Control DBS receiver based USRP daughterboard.
   // 
   // @param usrp: instance of usrp.source_c
   // @param which: which side: 0, 1 corresponding to RX_A or RX_B respectively
 
-  d_usrp = (usrp_basic_rx*)usrp;
-  d_tx = false; // FIXME: this should be redundant
-
   d_usrp->_write_oe(d_which, 0x0001, 0x0001);
   if(which == 0) {
     d_i2c_addr = 0x67;

Modified: 
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.h
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.h  
2008-10-09 04:22:38 UTC (rev 9761)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.h  
2008-10-09 05:00:06 UTC (rev 9762)
@@ -33,7 +33,6 @@
 class db_dbs_rx : public db_base
 {
 private:
-  usrp_basic_rx *d_usrp;
   int d_osc, d_cp, d_n, d_div2, d_r, d_r_int;
   int d_fdac, d_m, d_dl, d_ade, d_adl, d_gc1, d_gc2, d_diag;
   int d_i2c_addr;

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-09 04:22:38 UTC (rev 9761)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.cc 
2008-10-09 05:00:06 UTC (rev 9762)
@@ -36,8 +36,8 @@
 #define AUX_SDO   (1 << 1)
 #define CLOCK_OUT (1 << 0)
 
-flexrf_base::flexrf_base(usrp_basic *usrp, int which, bool tx, int _power_on)
-  : db_base(usrp, which, tx), d_power_on(_power_on)
+flexrf_base::flexrf_base(usrp_basic *usrp, int which, int _power_on)
+  : db_base(usrp, which), d_power_on(_power_on)
 {
   /*
     @param usrp: instance of usrp.source_c
@@ -56,10 +56,6 @@
 
 flexrf_base::~flexrf_base()
 {
-  // turn off power to board
-  d_usrp->common_write_io((d_tx ? C_TX : C_RX), 
-                         d_which, power_off(), POWER_UP);
-
   delete d_common;
 }
 
@@ -257,7 +253,7 @@
 // ----------------------------------------------------------------
 
 flexrf_base_tx::flexrf_base_tx(usrp_basic *usrp, int which, int _power_on)
-  : flexrf_base(usrp, which, true, _power_on)
+  : flexrf_base(usrp, which, _power_on)
 {
   /*
     @param usrp: instance of usrp.sink_c
@@ -362,7 +358,7 @@
 
 
 flexrf_base_rx::flexrf_base_rx(usrp_basic *usrp, int which, int _power_on)
-  : flexrf_base(usrp, which, false, _power_on)
+  : flexrf_base(usrp, which, _power_on)
 {
   /*
     @param usrp: instance of usrp.source_c

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-09 04:22:38 UTC (rev 9761)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.h  
2008-10-09 05:00:06 UTC (rev 9762)
@@ -33,7 +33,7 @@
 class flexrf_base : public db_base
 {
 public:
-  flexrf_base(usrp_basic *usrp, int which, bool tx, int _power_on=0);
+  flexrf_base(usrp_basic *usrp, int which, int _power_on=0);
   ~flexrf_base();
 
   struct freq_result_t set_freq(double freq);

Modified: 
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_tv_rx.cc
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_tv_rx.cc  
2008-10-09 04:22:38 UTC (rev 9761)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_tv_rx.cc  
2008-10-09 05:00:06 UTC (rev 9762)
@@ -102,16 +102,13 @@
 
 db_tv_rx::db_tv_rx(usrp_basic *usrp, int which,
                   double first_IF, double second_IF)
-  : db_base(usrp, which, false)
+  : db_base(usrp, which)
 {
   // Handler for Tv Rx daughterboards.
   // 
   // @param usrp: instance of usrp.source_c
   // @param which: which side: 0, 1 corresponding to RX_A or RX_B respectively
 
-  d_usrp = (usrp_basic_rx*)usrp;
-  d_tx = false; // FIXME: this should be redundant
-
   if(which == 0) {
     d_i2c_addr = 0x60;
   }





reply via email to

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