Fix missing set_bw call in new daughterboard API. Reconciled implementations between...
authorjcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5>
Fri, 26 Dec 2008 19:31:44 +0000 (19:31 +0000)
committerjcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5>
Fri, 26 Dec 2008 19:31:44 +0000 (19:31 +0000)
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10168 221aa14e-8319-0410-a670-987f0aec2ac5

usrp/host/lib/legacy/db_base.cc
usrp/host/lib/legacy/db_base.h
usrp/host/lib/legacy/db_base.i
usrp/host/lib/legacy/db_dbs_rx.cc
usrp/host/lib/legacy/db_dbs_rx.h
usrp/host/lib/legacy/db_dtt754.cc
usrp/host/lib/legacy/db_dtt754.h
usrp/host/lib/legacy/db_dtt768.cc
usrp/host/lib/legacy/db_dtt768.h

index 9d970435f4351194086c082dfc564f888a76d93b..80c6d46655119938ee9a045c3947b06263c1ba7b 100644 (file)
@@ -237,6 +237,13 @@ db_base::_refclk_divisor()
   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)
 {
index ff0a412e756877a77ac68ea8cb21d2cd57d50c20..3448fbc197cdf341da44f134c3f84026219db58f 100644 (file)
@@ -106,6 +106,7 @@ public:
   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);
 };
 
 
index 36bb59a7ee338aaab7ea52164ee80db549b3b27a..3e567637ea1d880b56f5c52377f36b1c35419855 100644 (file)
@@ -82,6 +82,7 @@ class db_base
   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
index 5f3b32f92e4e09d06004e467a2920382558fe3eb..d98838a4aa075c519838210f41b3b73d60029962 100644 (file)
@@ -150,12 +150,15 @@ db_dbs_rx::_set_fdac(int fdac)
   _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 @@ db_dbs_rx::set_bw (float bw)
     _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
index f3348af8cf79e7935f094379caa453e43c4c15d2..723771f1532bff52564fb3557ed7dc5d1130a0cc 100644 (file)
 #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 @@ private:
   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 @@ public:
   struct freq_result_t set_freq(double freq);
   bool  set_gain(float gain);
   bool  is_quadrature();
+  bool  set_bw(float bw);
 };
 
 #endif
index 39f8c3f9e25586cd4e73bac5090723c35f427a4e..4a6a1a29b309558fe52f978ba9675675b5b3f8db 100644 (file)
@@ -266,7 +266,7 @@ db_dtt754::spectrum_inverted()
   return d_inverted;
 }
 
-void
+bool
 db_dtt754::set_bw(float bw)
 {
   /*
@@ -275,6 +275,8 @@ db_dtt754::set_bw(float bw)
 
   d_bw = bw;
   set_freq(d_freq);
+
+  return true; // FIXME: propagate set_freq result
 }
 
 void
index 93b9164e9650f1a62c42267aa1cf2414f31f4f9b..0c104ac0cf7f0fa55eead6a4e38593cb5db715ed 100644 (file)
@@ -42,7 +42,7 @@ public:
   
   bool is_quadrature();
   bool spectrum_inverted();
-  void set_bw(float bw);
+  bool set_bw(float bw);
 
 private:
   void _set_rfagc(float gain);
index c2e9c9821ac0074b949294c2b9784fbe4f27ccd7..cae8b73474d2c7c27cd4cf66272f058ecd54349d 100644 (file)
@@ -239,7 +239,7 @@ db_dtt768::spectrum_inverted()
   return d_inverted;
 }
 
-void
+bool
 db_dtt768::set_bw(float bw)
 {
   /*
@@ -248,6 +248,8 @@ db_dtt768::set_bw(float bw)
 
   d_bw = bw;
   set_freq(d_freq);
+
+  return true; // FIXME: propagate set_freq result
 }
 
 void
index b5560437b355f91a42c147869bb8c9940f406efa..dd5a59abd1415ed89af15ee8e68b3efb2b53eb5f 100644 (file)
@@ -42,7 +42,7 @@ public:
   
   bool is_quadrature();
   bool spectrum_inverted();
-  void set_bw(float bw);
+  bool set_bw(float bw);
 
 private:
   void _set_rfagc(float gain);