commit-gnuradio
[Top][All Lists]
Advanced

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

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


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

Author: trondeau
Date: 2008-08-10 16:09:26 -0600 (Sun, 10 Aug 2008)
New Revision: 9226

Modified:
   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
Log:
fixing inheritance calls for setting RF frequency. Adding capabilities to all 
RFX boards.

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:08:05 UTC (rev 9225)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.h    
2008-08-10 22:09:26 UTC (rev 9226)
@@ -90,7 +90,7 @@
 
  protected:
   void _enable_refclk(bool enable);
-  float _refclk_freq();
+  virtual float _refclk_freq();
   virtual int _refclk_divisor();
 
   int d_which;

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:08:05 UTC (rev 9225)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.cc 
2008-08-10 22:09:26 UTC (rev 9226)
@@ -45,8 +45,6 @@
   
   set_auto_tr(false);
 
-  printf("here\n");
-
   /*
   std::string title;
   if(debug_using_gui) {
@@ -67,10 +65,7 @@
   // Power down VCO/PLL
   d_PD = 3;
   
-  // FIXME: Where is _compute_control_reg() declared?
-  printf("need to get _compute_control_reg() for this\n");
-  throw 0;
-  //write_control(_compute_control_reg());
+  _write_control(_compute_control_reg());
   _enable_refclk(false);                       // turn off refclk
   set_auto_tr(false);
 }
@@ -168,10 +163,15 @@
   */
   
   //raise NotImplementedError;
-  printf("flexrf_base::_compute_regs\n");
   throw 0;
 }
 
+int
+flexrf_base::_compute_control_reg()
+{
+  throw 0;
+}
+
 float
 flexrf_base::_refclk_freq(flexrf_base *child)
 {
@@ -559,8 +559,6 @@
     @returns: (R, control, N, actual_freq)
     @rtype: tuple(int, int, int, float)
   */
-
-  printf("_AD360_common::_comput_regs\n");
   
   //  Band-specific N-Register Values
   //float phdet_freq = _refclk_freq()/d_R_DIV;
@@ -612,7 +610,6 @@
   /*
     Return value to stick in REFCLK_DIVISOR register
   */
-  printf("_AD4360_common::_refclk_divisor()\n");
   return 1;
 }
     
@@ -633,7 +630,6 @@
 std::vector<float> 
 _AD4360_common::freq_range()
 {
-  printf("AD4360_common::freq_range()\n");
   throw 0;
 }
 
@@ -655,8 +651,6 @@
   d_DIV2 = 0;     // bit 22
   d_CPGAIN = 0;   // bit 21
   d_freq_mult = 1;
-
-  printf("_2400_common::_2400_common\n");
 }
 
 std::vector<float> 
@@ -669,7 +663,6 @@
   return f;
 }
 
-#if 0
 //----------------------------------------------------------------------
 
 _1200_common::_1200_common(bool tx)
@@ -795,14 +788,12 @@
   f[2] = 1e3;
   return f;
 }  
-#endif
 
 //------------------------------------------------------------    
 
 db_flexrf_2400_tx::db_flexrf_2400_tx(usrp_basic *usrp, int which)
   : flexrf_base_tx(usrp, which)
 {
-  printf("flexrf_2400_tx\n");
   d_common = new _2400_common(d_tx);
 
   d_power_on = 0;
@@ -820,12 +811,6 @@
   return d_common->freq_range();
 }
 
-std::vector<float>
-db_flexrf_2400_tx::set_freq(float freq)
-{
-  return flexrf_base::set_freq(freq);
-}
-
 bool
 db_flexrf_2400_tx::_compute_regs(float freq, int &retR, int &retcontrol, int 
&retN, float &retfreq)
 {
@@ -833,10 +818,10 @@
 }
 
 
+
 db_flexrf_2400_rx::db_flexrf_2400_rx(usrp_basic *usrp, int which)
   : flexrf_base_rx(usrp, which)
 {
-  printf("flexrf_2400_rx\n");
   d_common = new _2400_common(false);
   d_power_on = 0;
   d_power_off = 0;   // Powering it off kills the serial bus
@@ -872,47 +857,31 @@
 std::vector<float> 
 db_flexrf_2400_rx::freq_range()
 {
-  return flexrf_base::freq_range();
+  return d_common->freq_range();
 }
 
-std::vector<float>
-db_flexrf_2400_rx::set_freq(float freq)
-{
-  std::vector<float> args(2, 0);
-  freq += d_lo_offset;
-  
-  int R, control, N;
-  float actual_freq;
-  _compute_regs(freq, R, control, N, actual_freq);
-
-  if(R==0) {
-    return args;
-  }
-   
-  _write_all(R, control, N);
-  args[0] = _lock_detect();
-  args[1] = actual_freq;
-  return args;
-}
-
 bool
 db_flexrf_2400_rx::_compute_regs(float freq, int &retR, int &retcontrol, int 
&retN, float &retfreq)
 {
-  printf("flexrf_2400_rx::_compute_regs\n");
   return d_common->_compute_regs(_refclk_freq(this), freq, retR, retcontrol, 
retN, retfreq);
 }
 
 int
+db_flexrf_2400_rx::_compute_control_reg()
+{  
+  return d_common->_compute_control_reg();
+}
+
+int
 db_flexrf_2400_rx::_refclk_divisor()
 {
-  printf("flexrf_2400_rx::_refclk_divisor()\n");
   return d_common->_refclk_divisor();
 }
 
 
-#if 0
 //------------------------------------------------------------    
 
+
 db_flexrf_1200_tx::db_flexrf_1200_tx(usrp_basic *usrp, int which)
   : flexrf_base_tx(usrp, which),
      _1200_common(true)
@@ -921,6 +890,26 @@
   d_power_off = 0;    // powering it off kills the serial bus
 }
 
+db_flexrf_1200_tx::~db_flexrf_1200_tx()
+{
+  delete d_common;
+}
+
+std::vector<float> 
+db_flexrf_1200_tx::freq_range()
+{
+  return d_common->freq_range();
+}
+
+bool
+db_flexrf_1200_tx::_compute_regs(float freq, int &retR, int &retcontrol, int 
&retN, float &retfreq)
+{
+  return d_common->_compute_regs(_refclk_freq(this), freq, retR, retcontrol, 
retN, retfreq);
+}
+
+
+
+
 db_flexrf_1200_rx::db_flexrf_1200_rx(usrp_basic *usrp, int which)
   : flexrf_base_rx(usrp, which),
     _1200_common(false)
@@ -929,6 +918,11 @@
   d_power_off = 0;   // Powering it off kills the serial bus
 }
 
+db_flexrf_1200_rx::~db_flexrf_1200_rx()
+{
+  delete d_common;
+}
+
 std::vector<float> 
 db_flexrf_1200_rx::gain_range()
 {
@@ -951,7 +945,31 @@
   return true;
 }
 
+std::vector<float> 
+db_flexrf_1200_rx::freq_range()
+{
+  return d_common->freq_range();
+}
 
+bool
+db_flexrf_1200_rx::_compute_regs(float freq, int &retR, int &retcontrol, int 
&retN, float &retfreq)
+{
+  return d_common->_compute_regs(_refclk_freq(this), freq, retR, retcontrol, 
retN, retfreq);
+}
+
+int
+db_flexrf_1200_rx::_compute_control_reg()
+{  
+  return d_common->_compute_control_reg();
+}
+
+int
+db_flexrf_1200_rx::_refclk_divisor()
+{
+  return d_common->_refclk_divisor();
+}
+
+
 //------------------------------------------------------------    
 
 
@@ -963,6 +981,25 @@
   d_power_off = 0;    // powering it off kills the serial bus
 }
 
+db_flexrf_1800_tx::~db_flexrf_1800_tx()
+{
+  delete d_common;
+}
+
+std::vector<float> 
+db_flexrf_1800_tx::freq_range()
+{
+  return d_common->freq_range();
+}
+
+bool
+db_flexrf_1800_tx::_compute_regs(float freq, int &retR, int &retcontrol, int 
&retN, float &retfreq)
+{
+  return d_common->_compute_regs(_refclk_freq(this), freq, retR, retcontrol, 
retN, retfreq);
+}
+
+
+
 db_flexrf_1800_rx::db_flexrf_1800_rx(usrp_basic *usrp, int which)
   : flexrf_base_rx(usrp, which),
     _1800_common(false)
@@ -971,6 +1008,12 @@
   d_power_off = 0;   // Powering it off kills the serial bus
 }
 
+db_flexrf_1800_rx::~db_flexrf_1800_rx()
+{
+  delete d_common;
+}
+
+
 std::vector<float> 
 db_flexrf_1800_rx::gain_range()
 {
@@ -993,7 +1036,31 @@
   return true;
 }
 
+std::vector<float> 
+db_flexrf_1800_rx::freq_range()
+{
+  return d_common->freq_range();
+}
 
+bool
+db_flexrf_1800_rx::_compute_regs(float freq, int &retR, int &retcontrol, int 
&retN, float &retfreq)
+{
+  return d_common->_compute_regs(_refclk_freq(this), freq, retR, retcontrol, 
retN, retfreq);
+}
+
+int
+db_flexrf_1800_rx::_compute_control_reg()
+{  
+  return d_common->_compute_control_reg();
+}
+
+int
+db_flexrf_1800_rx::_refclk_divisor()
+{
+  return d_common->_refclk_divisor();
+}
+
+
 //------------------------------------------------------------    
 
 
@@ -1004,6 +1071,25 @@
   d_power_on = 0;
   d_power_off = 0;    // powering it off kills the serial bus
 }
+
+db_flexrf_900_tx::~db_flexrf_900_tx()
+{
+  delete d_common;
+}
+
+std::vector<float> 
+db_flexrf_900_tx::freq_range()
+{
+  return d_common->freq_range();
+}
+
+bool
+db_flexrf_900_tx::_compute_regs(float freq, int &retR, int &retcontrol, int 
&retN, float &retfreq)
+{
+  return d_common->_compute_regs(_refclk_freq(this), freq, retR, retcontrol, 
retN, retfreq);
+}
+
+
 db_flexrf_900_rx::db_flexrf_900_rx(usrp_basic *usrp, int which)
   : flexrf_base_rx(usrp, which),
     _900_common(false)
@@ -1012,6 +1098,11 @@
   d_power_off = 0;   // Powering it off kills the serial bus
 }
 
+db_flexrf_900_rx::~db_flexrf_900_rx()
+{
+  delete d_common;
+}
+
 std::vector<float> 
 db_flexrf_900_rx::gain_range()
 {
@@ -1034,7 +1125,31 @@
   return true;
 }
 
+std::vector<float> 
+db_flexrf_900_rx::freq_range()
+{
+  return d_common->freq_range();
+}
 
+bool
+db_flexrf_900_rx::_compute_regs(float freq, int &retR, int &retcontrol, int 
&retN, float &retfreq)
+{
+  return d_common->_compute_regs(_refclk_freq(this), freq, retR, retcontrol, 
retN, retfreq);
+}
+
+int
+db_flexrf_900_rx::_compute_control_reg()
+{  
+  return d_common->_compute_control_reg();
+}
+
+int
+db_flexrf_900_rx::_refclk_divisor()
+{
+  return d_common->_refclk_divisor();
+}
+
+
 //------------------------------------------------------------    
 
 
@@ -1046,6 +1161,25 @@
   d_power_off = 0;    // powering it off kills the serial bus
 }
 
+db_flexrf_400_tx::~db_flexrf_400_tx()
+{
+  delete d_common;
+}
+
+std::vector<float> 
+db_flexrf_400_tx::freq_range()
+{
+  return d_common->freq_range();
+}
+
+bool
+db_flexrf_400_tx::_compute_regs(float freq, int &retR, int &retcontrol, int 
&retN, float &retfreq)
+{
+  return d_common->_compute_regs(_refclk_freq(this), freq, retR, retcontrol, 
retN, retfreq);
+}
+
+
+
 db_flexrf_400_rx::db_flexrf_400_rx(usrp_basic *usrp, int which)
   : flexrf_base_rx(usrp, which),
     _400_common(false)
@@ -1054,6 +1188,11 @@
   d_power_off = 0;   // Powering it off kills the serial bus
 }
 
+db_flexrf_400_rx::~db_flexrf_400_rx()
+{
+  delete d_common;
+}
+
 std::vector<float> 
 db_flexrf_400_rx::gain_range()
 {
@@ -1075,5 +1214,27 @@
 {
   return true;
 }
-#endif
 
+std::vector<float> 
+db_flexrf_400_rx::freq_range()
+{
+  return d_common->freq_range();
+}
+
+bool
+db_flexrf_400_rx::_compute_regs(float freq, int &retR, int &retcontrol, int 
&retN, float &retfreq)
+{
+  return d_common->_compute_regs(_refclk_freq(this), freq, retR, retcontrol, 
retN, retfreq);
+}
+
+int
+db_flexrf_400_rx::_compute_control_reg()
+{  
+  return d_common->_compute_control_reg();
+}
+
+int
+db_flexrf_400_rx::_refclk_divisor()
+{
+  return d_common->_refclk_divisor();
+}

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:08:05 UTC (rev 9225)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.h  
2008-08-10 22:09:26 UTC (rev 9226)
@@ -62,7 +62,8 @@
   void _write_it(int v);
   bool _lock_detect();
 
-  bool _compute_regs(float freq, int &retR, int &retcontrol, int &retN, float 
&retfreq);
+  virtual bool _compute_regs(float freq, int &retR, int &retcontrol, int 
&retN, float &retfreq);
+  virtual int  _compute_control_reg();
   float _refclk_freq(flexrf_base *child);
 
   bool _set_pga(float pga_gain);
@@ -152,11 +153,11 @@
 
 //----------------------------------------------------------------------
 
-/*
 class _1200_common : public _AD4360_common
 {
 public:
   _1200_common(bool tx);
+  ~_1200_common() {}
 
   std::vector<float> freq_range();
 };
@@ -167,6 +168,7 @@
 {
  public:
   _1800_common(bool tx);
+  ~_1800_common() {}
 
   std::vector<float> freq_range();
 };
@@ -177,6 +179,7 @@
 {
 public:
   _900_common(bool tx);
+  ~_900_common() {}
   
   std::vector<float> freq_range();
 };
@@ -187,11 +190,12 @@
 {
 public:
   _400_common(bool tx);
+  ~_400_common() {}
 
   std::vector<float> freq_range();
-};  
-*/
+};
 
+
 //------------------------------------------------------------    
 
 class db_flexrf_2400_tx : public flexrf_base_tx
@@ -199,9 +203,10 @@
  public:
   db_flexrf_2400_tx(usrp_basic *usrp, int which);
   ~db_flexrf_2400_tx();
+
+  // Wrapper calls to d_common functions
   bool _compute_regs(float freq, int &retR, int &retcontrol, int &retN, float 
&retfreq);
   std::vector<float> freq_range();
-  std::vector<float> set_freq(float freq);
 
 protected:
   _2400_common *d_common;
@@ -217,8 +222,8 @@
   bool i_and_q_swapped();
 
   std::vector<float> freq_range();
-  std::vector<float> set_freq(float freq);
   bool _compute_regs(float freq, int &retR, int &retcontrol, int &retN, float 
&retfreq);
+  int _compute_control_reg();
   int _refclk_divisor();
 
 protected:
@@ -226,20 +231,38 @@
 };
 
 //------------------------------------------------------------    
-/*
+
 class db_flexrf_1200_tx : public flexrf_base_tx, public _1200_common
 {
- public:
+public:
   db_flexrf_1200_tx(usrp_basic *usrp, int which);
+  ~db_flexrf_1200_tx();
+
+  // Wrapper calls to d_common functions
+  bool _compute_regs(float freq, int &retR, int &retcontrol, int &retN, float 
&retfreq);
+  std::vector<float> freq_range();
+
+protected:
+  _1200_common *d_common;
+
 };
 
 class db_flexrf_1200_rx : public flexrf_base_rx, public _1200_common
 {
 public:
   db_flexrf_1200_rx(usrp_basic *usrp, int which);
+  ~db_flexrf_1200_rx();
   
   std::vector<float> gain_range();
   bool i_and_q_swapped();
+
+  std::vector<float> freq_range();
+  bool _compute_regs(float freq, int &retR, int &retcontrol, int &retN, float 
&retfreq);
+  int _compute_control_reg();
+  int _refclk_divisor();
+
+protected:
+  _1200_common *d_common;
 };
 
 //------------------------------------------------------------    
@@ -248,15 +271,32 @@
 {
  public:
   db_flexrf_1800_tx(usrp_basic *usrp, int which);
+  ~db_flexrf_1800_tx();
+
+  // Wrapper calls to d_common functions
+  bool _compute_regs(float freq, int &retR, int &retcontrol, int &retN, float 
&retfreq);
+  std::vector<float> freq_range();
+
+protected:
+  _1800_common *d_common;
 };
 
 class db_flexrf_1800_rx : public flexrf_base_rx, public _1800_common
 {
 public:
   db_flexrf_1800_rx(usrp_basic *usrp, int which);
+  ~db_flexrf_1800_rx();
   
   std::vector<float> gain_range();
   bool i_and_q_swapped();
+
+  std::vector<float> freq_range();
+  bool _compute_regs(float freq, int &retR, int &retcontrol, int &retN, float 
&retfreq);
+  int _compute_control_reg();
+  int _refclk_divisor();
+
+protected:
+  _1800_common *d_common;
 };
 
 //------------------------------------------------------------    
@@ -265,15 +305,32 @@
 {
  public:
   db_flexrf_900_tx(usrp_basic *usrp, int which);
+  ~db_flexrf_900_tx();
+
+  // Wrapper calls to d_common functions
+  bool _compute_regs(float freq, int &retR, int &retcontrol, int &retN, float 
&retfreq);
+  std::vector<float> freq_range();
+
+protected:
+  _900_common *d_common;
 };
 
 class db_flexrf_900_rx : public flexrf_base_rx, public _900_common
 {
 public:
   db_flexrf_900_rx(usrp_basic *usrp, int which);
+  ~db_flexrf_900_rx();
   
   std::vector<float> gain_range();
   bool i_and_q_swapped();
+
+  std::vector<float> freq_range();
+  bool _compute_regs(float freq, int &retR, int &retcontrol, int &retN, float 
&retfreq);
+  int _compute_control_reg();
+  int _refclk_divisor();
+
+protected:
+  _900_common *d_common;
 };
 
 
@@ -283,16 +340,32 @@
 {
  public:
   db_flexrf_400_tx(usrp_basic *usrp, int which);
+  ~db_flexrf_400_tx();
+
+  // Wrapper calls to d_common functions
+  bool _compute_regs(float freq, int &retR, int &retcontrol, int &retN, float 
&retfreq);
+  std::vector<float> freq_range();
+
+protected:
+  _400_common *d_common;
 };
 
 class db_flexrf_400_rx : public flexrf_base_rx, public _400_common
 {
 public:
   db_flexrf_400_rx(usrp_basic *usrp, int which);
+  ~db_flexrf_400_rx();
   
   std::vector<float> gain_range();
   bool i_and_q_swapped();
+
+  std::vector<float> freq_range();
+  bool _compute_regs(float freq, int &retR, int &retcontrol, int &retN, float 
&retfreq);
+  int _compute_control_reg();
+  int _refclk_divisor();
+
+protected:
+  _400_common *d_common;
 };
-*/
 
 #endif





reply via email to

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