commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r10168 - gnuradio/trunk/usrp/host/lib/legacy


From: jcorgan
Subject: [Commit-gnuradio] r10168 - gnuradio/trunk/usrp/host/lib/legacy
Date: Fri, 26 Dec 2008 12:31:45 -0700 (MST)

Author: jcorgan
Date: 2008-12-26 12:31:44 -0700 (Fri, 26 Dec 2008)
New Revision: 10168

Modified:
   gnuradio/trunk/usrp/host/lib/legacy/db_base.cc
   gnuradio/trunk/usrp/host/lib/legacy/db_base.h
   gnuradio/trunk/usrp/host/lib/legacy/db_base.i
   gnuradio/trunk/usrp/host/lib/legacy/db_dbs_rx.cc
   gnuradio/trunk/usrp/host/lib/legacy/db_dbs_rx.h
   gnuradio/trunk/usrp/host/lib/legacy/db_dtt754.cc
   gnuradio/trunk/usrp/host/lib/legacy/db_dtt754.h
   gnuradio/trunk/usrp/host/lib/legacy/db_dtt768.cc
   gnuradio/trunk/usrp/host/lib/legacy/db_dtt768.h
Log:
Fix missing set_bw call in new daughterboard API.  Reconciled implementations 
between different boards to return true or false (success).

Modified: gnuradio/trunk/usrp/host/lib/legacy/db_base.cc
===================================================================
--- gnuradio/trunk/usrp/host/lib/legacy/db_base.cc      2008-12-25 20:03:00 UTC 
(rev 10167)
+++ gnuradio/trunk/usrp/host/lib/legacy/db_base.cc      2008-12-26 19:31:44 UTC 
(rev 10168)
@@ -237,6 +237,13 @@
   throw std::runtime_error("_reflck_divisor() called from base class\n");;
 }
 
+bool
+db_base::set_bw(float bw)
+{
+  // Set baseband bandwidth (board specific)
+  // Should be overriden by boards that implement variable IF filtering (e.g., 
DBSRX)
+  return false;
+}
 
 std::ostream &operator<<(std::ostream &os, db_base &x)
 {

Modified: gnuradio/trunk/usrp/host/lib/legacy/db_base.h
===================================================================
--- gnuradio/trunk/usrp/host/lib/legacy/db_base.h       2008-12-25 20:03:00 UTC 
(rev 10167)
+++ gnuradio/trunk/usrp/host/lib/legacy/db_base.h       2008-12-26 19:31:44 UTC 
(rev 10168)
@@ -106,6 +106,7 @@
   virtual bool set_auto_tr(bool on);
   virtual bool select_rx_antenna(int which_antenna);
   virtual bool select_rx_antenna(const std::string &which_antenna);
+  virtual bool set_bw(float bw);
 };
 
 

Modified: gnuradio/trunk/usrp/host/lib/legacy/db_base.i
===================================================================
--- gnuradio/trunk/usrp/host/lib/legacy/db_base.i       2008-12-25 20:03:00 UTC 
(rev 10167)
+++ gnuradio/trunk/usrp/host/lib/legacy/db_base.i       2008-12-26 19:31:44 UTC 
(rev 10168)
@@ -82,6 +82,7 @@
   virtual bool set_auto_tr(bool on);
   virtual bool select_rx_antenna(int which_antenna);
   virtual bool select_rx_antenna(const std::string &antenna);
+  virtual bool set_bw(float bw);
 };
 
 // Create templates for db's, vectors of db's, and vector of vectors of db's

Modified: gnuradio/trunk/usrp/host/lib/legacy/db_dbs_rx.cc
===================================================================
--- gnuradio/trunk/usrp/host/lib/legacy/db_dbs_rx.cc    2008-12-25 20:03:00 UTC 
(rev 10167)
+++ gnuradio/trunk/usrp/host/lib/legacy/db_dbs_rx.cc    2008-12-26 19:31:44 UTC 
(rev 10168)
@@ -150,12 +150,15 @@
   _send_reg(3);
 }
 
-struct bw_t
+bool
 db_dbs_rx::set_bw (float bw)
 {
-  assert(bw>=1e6 && bw<=33e6);
+  if (bw < 1e6 || bw > 33e6) {
+    fprintf(stderr, "db_dbs_rx::set_bw: bw (=%f) must be between 1e6 and 33e6 
inclusive\n", bw);
+    return false;
+  }
 
-  struct bw_t ret = {0, 0, 0};
+  // struct bw_t ret = {0, 0, 0};
   int m_max, m_min, m_test, fdac_test;
   if(bw >= 4e6)
     m_max = int(std::min(31, (int)floor(_refclk_freq()/1e6)));
@@ -178,14 +181,16 @@
     _set_m(m_test);
     _set_fdac(fdac_test);
 
-    ret.m = d_m;
-    ret.fdac = d_fdac;
-    ret.div = _refclk_freq()/d_m*(4+0.145*d_fdac);
+    //ret.m = d_m;
+    //ret.fdac = d_fdac;
+    //ret.div = _refclk_freq()/d_m*(4+0.145*d_fdac);
   }
   else {
-    fprintf(stderr, "Failed to set bw\n");
+    fprintf(stderr, "db_dbs_rx::set_bw: failed\n");
+    return false;
   }
-  return ret;
+
+  return true;
 }
 
 // Gain setting

Modified: gnuradio/trunk/usrp/host/lib/legacy/db_dbs_rx.h
===================================================================
--- gnuradio/trunk/usrp/host/lib/legacy/db_dbs_rx.h     2008-12-25 20:03:00 UTC 
(rev 10167)
+++ gnuradio/trunk/usrp/host/lib/legacy/db_dbs_rx.h     2008-12-26 19:31:44 UTC 
(rev 10168)
@@ -25,11 +25,13 @@
 #include <db_base.h>
 #include <vector>
 
+#if 0
 struct bw_t {
   int m;
   int fdac;
   float div;
 };
+#endif
 
 class db_dbs_rx : public db_base
 {
@@ -45,7 +47,6 @@
   void _send_reg(int regno);
   void _set_m(int m);
   void _set_fdac(int fdac);
-  bw_t set_bw(float bw);
   void _set_dl(int dl);
   void _set_gc2(int gc2);
   void _set_gc1(int gc1);
@@ -76,6 +77,7 @@
   struct freq_result_t set_freq(double freq);
   bool  set_gain(float gain);
   bool  is_quadrature();
+  bool  set_bw(float bw);
 };
 
 #endif

Modified: gnuradio/trunk/usrp/host/lib/legacy/db_dtt754.cc
===================================================================
--- gnuradio/trunk/usrp/host/lib/legacy/db_dtt754.cc    2008-12-25 20:03:00 UTC 
(rev 10167)
+++ gnuradio/trunk/usrp/host/lib/legacy/db_dtt754.cc    2008-12-26 19:31:44 UTC 
(rev 10168)
@@ -266,7 +266,7 @@
   return d_inverted;
 }
 
-void
+bool
 db_dtt754::set_bw(float bw)
 {
   /*
@@ -275,6 +275,8 @@
 
   d_bw = bw;
   set_freq(d_freq);
+
+  return true; // FIXME: propagate set_freq result
 }
 
 void

Modified: gnuradio/trunk/usrp/host/lib/legacy/db_dtt754.h
===================================================================
--- gnuradio/trunk/usrp/host/lib/legacy/db_dtt754.h     2008-12-25 20:03:00 UTC 
(rev 10167)
+++ gnuradio/trunk/usrp/host/lib/legacy/db_dtt754.h     2008-12-26 19:31:44 UTC 
(rev 10168)
@@ -42,7 +42,7 @@
   
   bool is_quadrature();
   bool spectrum_inverted();
-  void set_bw(float bw);
+  bool set_bw(float bw);
 
 private:
   void _set_rfagc(float gain);

Modified: gnuradio/trunk/usrp/host/lib/legacy/db_dtt768.cc
===================================================================
--- gnuradio/trunk/usrp/host/lib/legacy/db_dtt768.cc    2008-12-25 20:03:00 UTC 
(rev 10167)
+++ gnuradio/trunk/usrp/host/lib/legacy/db_dtt768.cc    2008-12-26 19:31:44 UTC 
(rev 10168)
@@ -239,7 +239,7 @@
   return d_inverted;
 }
 
-void
+bool
 db_dtt768::set_bw(float bw)
 {
   /*
@@ -248,6 +248,8 @@
 
   d_bw = bw;
   set_freq(d_freq);
+
+  return true; // FIXME: propagate set_freq result
 }
 
 void

Modified: gnuradio/trunk/usrp/host/lib/legacy/db_dtt768.h
===================================================================
--- gnuradio/trunk/usrp/host/lib/legacy/db_dtt768.h     2008-12-25 20:03:00 UTC 
(rev 10167)
+++ gnuradio/trunk/usrp/host/lib/legacy/db_dtt768.h     2008-12-26 19:31:44 UTC 
(rev 10168)
@@ -42,7 +42,7 @@
   
   bool is_quadrature();
   bool spectrum_inverted();
-  void set_bw(float bw);
+  bool set_bw(float bw);
 
 private:
   void _set_rfagc(float gain);





reply via email to

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