summaryrefslogtreecommitdiff
path: root/usrp/host
diff options
context:
space:
mode:
Diffstat (limited to 'usrp/host')
-rw-r--r--usrp/host/lib/legacy/db_base.cc7
-rw-r--r--usrp/host/lib/legacy/db_base.h1
-rw-r--r--usrp/host/lib/legacy/db_base.i1
-rw-r--r--usrp/host/lib/legacy/db_dbs_rx.cc21
-rw-r--r--usrp/host/lib/legacy/db_dbs_rx.h4
-rw-r--r--usrp/host/lib/legacy/db_dtt754.cc4
-rw-r--r--usrp/host/lib/legacy/db_dtt754.h2
-rw-r--r--usrp/host/lib/legacy/db_dtt768.cc4
-rw-r--r--usrp/host/lib/legacy/db_dtt768.h2
9 files changed, 33 insertions, 13 deletions
diff --git a/usrp/host/lib/legacy/db_base.cc b/usrp/host/lib/legacy/db_base.cc
index 9d970435f..80c6d4665 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 ff0a412e7..3448fbc19 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 36bb59a7e..3e567637e 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 5f3b32f92..d98838a4a 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 f3348af8c..723771f15 100644
--- a/usrp/host/lib/legacy/db_dbs_rx.h
+++ b/usrp/host/lib/legacy/db_dbs_rx.h
@@ -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 @@ 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 39f8c3f9e..4a6a1a29b 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 93b9164e9..0c104ac0c 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 c2e9c9821..cae8b7347 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 b5560437b..dd5a59abd 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);