summaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
Diffstat (limited to 'host')
-rw-r--r--host/include/uhd/usrp/multi_usrp.hpp8
-rw-r--r--host/include/uhd/usrp/single_usrp.hpp8
-rw-r--r--host/lib/usrp/dboard/db_dbsrx.cpp18
-rw-r--r--host/lib/usrp/dboard/db_xcvr2450.cpp20
-rw-r--r--host/lib/usrp/multi_usrp.cpp20
-rw-r--r--host/lib/usrp/single_usrp.cpp20
6 files changed, 60 insertions, 34 deletions
diff --git a/host/include/uhd/usrp/multi_usrp.hpp b/host/include/uhd/usrp/multi_usrp.hpp
index 65c7e9044..dcec0c515 100644
--- a/host/include/uhd/usrp/multi_usrp.hpp
+++ b/host/include/uhd/usrp/multi_usrp.hpp
@@ -201,6 +201,9 @@ public:
virtual bool get_rx_lo_locked(size_t chan) = 0;
+ virtual void set_rx_bandwidth(double bandwidth, size_t chan) = 0;
+ virtual double get_rx_bandwidth(size_t chan) = 0;
+
/*!
* Read the RSSI value from a usrp device.
* Or throw if the dboard does not support an RSSI readback.
@@ -209,8 +212,6 @@ public:
virtual float read_rssi(size_t chan) = 0;
virtual dboard_iface::sptr get_rx_dboard_iface(size_t chan) = 0;
-
- virtual void set_rx_bandwidth(float bandwidth, size_t chan) = 0;
/*******************************************************************
* TX methods
@@ -251,6 +252,9 @@ public:
virtual bool get_tx_lo_locked(size_t chan) = 0;
+ virtual void set_tx_bandwidth(double bandwidth, size_t chan) = 0;
+ virtual double get_tx_bandwidth(size_t chan) = 0;
+
virtual dboard_iface::sptr get_tx_dboard_iface(size_t chan) = 0;
};
diff --git a/host/include/uhd/usrp/single_usrp.hpp b/host/include/uhd/usrp/single_usrp.hpp
index 2266e7f2c..9b2fd7ccf 100644
--- a/host/include/uhd/usrp/single_usrp.hpp
+++ b/host/include/uhd/usrp/single_usrp.hpp
@@ -144,6 +144,9 @@ public:
virtual bool get_rx_lo_locked(size_t chan = 0) = 0;
+ virtual void set_rx_bandwidth(double bandwidth, size_t chan = 0) = 0;
+ virtual double get_rx_bandwidth(size_t chan = 0) = 0;
+
/*!
* Read the RSSI value from a usrp device.
* Or throw if the dboard does not support an RSSI readback.
@@ -152,8 +155,6 @@ public:
virtual float read_rssi(size_t chan = 0) = 0;
virtual dboard_iface::sptr get_rx_dboard_iface(size_t chan = 0) = 0;
-
- virtual void set_rx_bandwidth(float bandwidth, size_t chan = 0) = 0;
/*******************************************************************
* TX methods
@@ -186,6 +187,9 @@ public:
virtual bool get_tx_lo_locked(size_t chan = 0) = 0;
+ virtual void set_tx_bandwidth(double bandwidth, size_t chan = 0) = 0;
+ virtual double get_tx_bandwidth(size_t chan = 0) = 0;
+
virtual dboard_iface::sptr get_tx_dboard_iface(size_t chan = 0) = 0;
};
diff --git a/host/lib/usrp/dboard/db_dbsrx.cpp b/host/lib/usrp/dboard/db_dbsrx.cpp
index 99137dda3..939a79e58 100644
--- a/host/lib/usrp/dboard/db_dbsrx.cpp
+++ b/host/lib/usrp/dboard/db_dbsrx.cpp
@@ -69,7 +69,7 @@ public:
private:
double _lo_freq;
- float _bandwidth;
+ double _bandwidth;
uhd::dict<std::string, float> _gains;
max2118_write_regs_t _max2118_write_regs;
max2118_read_regs_t _max2118_read_regs;
@@ -79,7 +79,7 @@ private:
void set_lo_freq(double target_freq);
void set_gain(float gain, const std::string &name);
- void set_bandwidth(float bandwidth);
+ void set_bandwidth(double bandwidth);
void send_reg(boost::uint8_t start_reg, boost::uint8_t stop_reg){
start_reg = boost::uint8_t(std::clip(int(start_reg), 0x0, 0x5));
@@ -482,9 +482,9 @@ void dbsrx::set_gain(float gain, const std::string &name){
/***********************************************************************
* Bandwidth Handling
**********************************************************************/
-void dbsrx::set_bandwidth(float bandwidth){
+void dbsrx::set_bandwidth(double bandwidth){
//clip the input
- bandwidth = std::clip<float>(bandwidth, 4e6, 33e6);
+ bandwidth = std::clip<double>(bandwidth, 4e6, 33e6);
double ref_clock = this->get_iface()->get_clock_rate(dboard_iface::UNIT_RX);
@@ -494,7 +494,7 @@ void dbsrx::set_bandwidth(float bandwidth){
_max2118_write_regs.f_dac = std::clip<int>(int((((bandwidth*_max2118_write_regs.m_divider)/ref_clock) - 4)/0.145),0,127);
//determine actual bandwidth
- _bandwidth = float((ref_clock/(_max2118_write_regs.m_divider))*(4+0.145*_max2118_write_regs.f_dac));
+ _bandwidth = double((ref_clock/(_max2118_write_regs.m_divider))*(4+0.145*_max2118_write_regs.f_dac));
if (dbsrx_debug) std::cerr << boost::format(
"DBSRX Filter Bandwidth: %f MHz, m: %d, f_dac: %d\n"
@@ -565,12 +565,6 @@ void dbsrx::rx_get(const wax::obj &key_, wax::obj &val){
val = this->get_locked();
return;
-/*
- case SUBDEV_PROP_RSSI:
- val = this->get_rssi();
- return;
-*/
-
case SUBDEV_PROP_BANDWIDTH:
val = _bandwidth;
return;
@@ -597,7 +591,7 @@ void dbsrx::rx_set(const wax::obj &key_, const wax::obj &val){
return; //always enabled
case SUBDEV_PROP_BANDWIDTH:
- this->set_bandwidth(val.as<float>());
+ this->set_bandwidth(val.as<double>());
return;
default: UHD_THROW_PROP_SET_ERROR();
diff --git a/host/lib/usrp/dboard/db_xcvr2450.cpp b/host/lib/usrp/dboard/db_xcvr2450.cpp
index 314c85a69..99f2a231c 100644
--- a/host/lib/usrp/dboard/db_xcvr2450.cpp
+++ b/host/lib/usrp/dboard/db_xcvr2450.cpp
@@ -102,7 +102,7 @@ public:
private:
double _lo_freq;
- float _rx_bandwidth, _tx_bandwidth;
+ double _rx_bandwidth, _tx_bandwidth;
uhd::dict<std::string, float> _tx_gains, _rx_gains;
std::string _tx_ant, _rx_ant;
int _ad9515div;
@@ -113,8 +113,8 @@ private:
void set_rx_ant(const std::string &ant);
void set_tx_gain(float gain, const std::string &name);
void set_rx_gain(float gain, const std::string &name);
- void set_rx_bandwidth(float bandwidth);
- void set_tx_bandwidth(float bandwidth);
+ void set_rx_bandwidth(double bandwidth);
+ void set_tx_bandwidth(double bandwidth);
void update_atr(void);
void spi_reset(void);
@@ -455,7 +455,7 @@ void xcvr2450::set_rx_gain(float gain, const std::string &name){
/***********************************************************************
* Bandwidth Handling
**********************************************************************/
-static max2829_regs_t::tx_lpf_coarse_adj_t bandwidth_to_tx_lpf_coarse_reg(float &bandwidth){
+static max2829_regs_t::tx_lpf_coarse_adj_t bandwidth_to_tx_lpf_coarse_reg(double &bandwidth){
int reg = std::clip(boost::math::iround((bandwidth-6.0e6)/6.0e6), 1, 3);
switch(reg){
@@ -472,7 +472,7 @@ static max2829_regs_t::tx_lpf_coarse_adj_t bandwidth_to_tx_lpf_coarse_reg(float
UHD_THROW_INVALID_CODE_PATH();
}
-static max2829_regs_t::rx_lpf_fine_adj_t bandwidth_to_rx_lpf_fine_reg(float &bandwidth, float requested_bandwidth){
+static max2829_regs_t::rx_lpf_fine_adj_t bandwidth_to_rx_lpf_fine_reg(double &bandwidth, double requested_bandwidth){
int reg = std::clip(boost::math::iround((requested_bandwidth/bandwidth)/0.05), 18, 22);
switch(reg){
@@ -495,7 +495,7 @@ static max2829_regs_t::rx_lpf_fine_adj_t bandwidth_to_rx_lpf_fine_reg(float &ban
UHD_THROW_INVALID_CODE_PATH();
}
-static max2829_regs_t::rx_lpf_coarse_adj_t bandwidth_to_rx_lpf_coarse_reg(float &bandwidth){
+static max2829_regs_t::rx_lpf_coarse_adj_t bandwidth_to_rx_lpf_coarse_reg(double &bandwidth){
int reg = std::clip(boost::math::iround((bandwidth-7.0e6)/1.0e6), 0, 11);
switch(reg){
@@ -523,7 +523,7 @@ static max2829_regs_t::rx_lpf_coarse_adj_t bandwidth_to_rx_lpf_coarse_reg(float
UHD_THROW_INVALID_CODE_PATH();
}
-void xcvr2450::set_rx_bandwidth(float bandwidth){
+void xcvr2450::set_rx_bandwidth(double bandwidth){
float requested_bandwidth = bandwidth;
//compute coarse low pass cutoff frequency setting
@@ -543,7 +543,7 @@ void xcvr2450::set_rx_bandwidth(float bandwidth){
) % _rx_bandwidth % (int(_max2829_regs.rx_lpf_coarse_adj)) % (int(_max2829_regs.rx_lpf_fine_adj)) << std::endl;
}
-void xcvr2450::set_tx_bandwidth(float bandwidth){
+void xcvr2450::set_tx_bandwidth(double bandwidth){
//compute coarse low pass cutoff frequency setting
_max2829_regs.tx_lpf_coarse_adj = bandwidth_to_tx_lpf_coarse_reg(bandwidth);
@@ -652,7 +652,7 @@ void xcvr2450::rx_set(const wax::obj &key_, const wax::obj &val){
return;
case SUBDEV_PROP_BANDWIDTH:
- this->set_rx_bandwidth(val.as<float>());
+ this->set_rx_bandwidth(val.as<double>());
return;
case SUBDEV_PROP_ENABLED:
@@ -747,7 +747,7 @@ void xcvr2450::tx_set(const wax::obj &key_, const wax::obj &val){
return;
case SUBDEV_PROP_BANDWIDTH:
- this->set_tx_bandwidth(val.as<float>());
+ this->set_tx_bandwidth(val.as<double>());
return;
case SUBDEV_PROP_ANTENNA:
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp
index 6df3afbf8..027530f31 100644
--- a/host/lib/usrp/multi_usrp.cpp
+++ b/host/lib/usrp/multi_usrp.cpp
@@ -256,6 +256,14 @@ public:
return _rx_subdev(chan)[SUBDEV_PROP_LO_LOCKED].as<bool>();
}
+ void set_rx_bandwidth(double bandwidth, size_t chan){
+ _rx_subdev(chan)[SUBDEV_PROP_BANDWIDTH] = bandwidth;
+ }
+
+ double get_rx_bandwidth(size_t chan){
+ return _rx_subdev(chan)[SUBDEV_PROP_BANDWIDTH].as<double>();
+ }
+
float read_rssi(size_t chan){
return _rx_subdev(chan)[SUBDEV_PROP_RSSI].as<float>();
}
@@ -263,10 +271,6 @@ public:
dboard_iface::sptr get_rx_dboard_iface(size_t chan){
return _rx_dboard(chan)[DBOARD_PROP_DBOARD_IFACE].as<dboard_iface::sptr>();
}
-
- void set_rx_bandwidth(float bandwidth, size_t chan) {
- _rx_subdev(chan)[SUBDEV_PROP_BANDWIDTH] = bandwidth;
- }
/*******************************************************************
* TX methods
@@ -352,6 +356,14 @@ public:
return _tx_subdev(chan)[SUBDEV_PROP_LO_LOCKED].as<bool>();
}
+ void set_tx_bandwidth(double bandwidth, size_t chan){
+ _tx_subdev(chan)[SUBDEV_PROP_BANDWIDTH] = bandwidth;
+ }
+
+ double get_tx_bandwidth(size_t chan){
+ return _tx_subdev(chan)[SUBDEV_PROP_BANDWIDTH].as<double>();
+ }
+
dboard_iface::sptr get_tx_dboard_iface(size_t chan){
return _tx_dboard(chan)[DBOARD_PROP_DBOARD_IFACE].as<dboard_iface::sptr>();
}
diff --git a/host/lib/usrp/single_usrp.cpp b/host/lib/usrp/single_usrp.cpp
index 7a4df3eb5..2faa1280c 100644
--- a/host/lib/usrp/single_usrp.cpp
+++ b/host/lib/usrp/single_usrp.cpp
@@ -192,6 +192,14 @@ public:
return _rx_subdev(chan)[SUBDEV_PROP_LO_LOCKED].as<bool>();
}
+ void set_rx_bandwidth(double bandwidth, size_t chan){
+ _rx_subdev(chan)[SUBDEV_PROP_BANDWIDTH] = bandwidth;
+ }
+
+ double get_rx_bandwidth(size_t chan){
+ return _rx_subdev(chan)[SUBDEV_PROP_BANDWIDTH].as<double>();
+ }
+
float read_rssi(size_t chan){
return _rx_subdev(chan)[SUBDEV_PROP_RSSI].as<float>();
}
@@ -199,10 +207,6 @@ public:
dboard_iface::sptr get_rx_dboard_iface(size_t chan){
return _rx_dboard(chan)[DBOARD_PROP_DBOARD_IFACE].as<dboard_iface::sptr>();
}
-
- void set_rx_bandwidth(float bandwidth, size_t chan) {
- _rx_subdev(chan)[SUBDEV_PROP_BANDWIDTH] = bandwidth;
- }
/*******************************************************************
* TX methods
@@ -276,6 +280,14 @@ public:
return _tx_subdev(chan)[SUBDEV_PROP_LO_LOCKED].as<bool>();
}
+ void set_tx_bandwidth(double bandwidth, size_t chan){
+ _tx_subdev(chan)[SUBDEV_PROP_BANDWIDTH] = bandwidth;
+ }
+
+ double get_tx_bandwidth(size_t chan){
+ return _tx_subdev(chan)[SUBDEV_PROP_BANDWIDTH].as<double>();
+ }
+
dboard_iface::sptr get_tx_dboard_iface(size_t chan){
return _tx_dboard(chan)[DBOARD_PROP_DBOARD_IFACE].as<dboard_iface::sptr>();
}