From: jcorgan Date: Fri, 26 Dec 2008 19:31:44 +0000 (+0000) Subject: Fix missing set_bw call in new daughterboard API. Reconciled implementations between... X-Git-Url: https://git.gag.com/?a=commitdiff_plain;ds=sidebyside;h=a09700c26a39ebddbeb56b5ecddedf50f0cc7ac4;p=debian%2Fgnuradio Fix missing set_bw call in new daughterboard API. Reconciled implementations between different boards to return true or false (success). git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10168 221aa14e-8319-0410-a670-987f0aec2ac5 --- diff --git a/usrp/host/lib/legacy/db_base.cc b/usrp/host/lib/legacy/db_base.cc index 9d970435..80c6d466 100644 --- a/usrp/host/lib/legacy/db_base.cc +++ b/usrp/host/lib/legacy/db_base.cc @@ -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) { diff --git a/usrp/host/lib/legacy/db_base.h b/usrp/host/lib/legacy/db_base.h index ff0a412e..3448fbc1 100644 --- a/usrp/host/lib/legacy/db_base.h +++ b/usrp/host/lib/legacy/db_base.h @@ -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); }; diff --git a/usrp/host/lib/legacy/db_base.i b/usrp/host/lib/legacy/db_base.i index 36bb59a7..3e567637 100644 --- a/usrp/host/lib/legacy/db_base.i +++ b/usrp/host/lib/legacy/db_base.i @@ -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 diff --git a/usrp/host/lib/legacy/db_dbs_rx.cc b/usrp/host/lib/legacy/db_dbs_rx.cc index 5f3b32f9..d98838a4 100644 --- a/usrp/host/lib/legacy/db_dbs_rx.cc +++ b/usrp/host/lib/legacy/db_dbs_rx.cc @@ -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 diff --git a/usrp/host/lib/legacy/db_dbs_rx.h b/usrp/host/lib/legacy/db_dbs_rx.h index f3348af8..723771f1 100644 --- a/usrp/host/lib/legacy/db_dbs_rx.h +++ b/usrp/host/lib/legacy/db_dbs_rx.h @@ -25,11 +25,13 @@ #include #include +#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 diff --git a/usrp/host/lib/legacy/db_dtt754.cc b/usrp/host/lib/legacy/db_dtt754.cc index 39f8c3f9..4a6a1a29 100644 --- a/usrp/host/lib/legacy/db_dtt754.cc +++ b/usrp/host/lib/legacy/db_dtt754.cc @@ -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 diff --git a/usrp/host/lib/legacy/db_dtt754.h b/usrp/host/lib/legacy/db_dtt754.h index 93b9164e..0c104ac0 100644 --- a/usrp/host/lib/legacy/db_dtt754.h +++ b/usrp/host/lib/legacy/db_dtt754.h @@ -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); diff --git a/usrp/host/lib/legacy/db_dtt768.cc b/usrp/host/lib/legacy/db_dtt768.cc index c2e9c982..cae8b734 100644 --- a/usrp/host/lib/legacy/db_dtt768.cc +++ b/usrp/host/lib/legacy/db_dtt768.cc @@ -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 diff --git a/usrp/host/lib/legacy/db_dtt768.h b/usrp/host/lib/legacy/db_dtt768.h index b5560437..dd5a59ab 100644 --- a/usrp/host/lib/legacy/db_dtt768.h +++ b/usrp/host/lib/legacy/db_dtt768.h @@ -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);