summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-01-11 19:46:45 -0800
committerJosh Blum <josh@joshknows.com>2011-01-11 19:46:45 -0800
commit395bbbbc1118b061262a10d5c847f17a4fd0c6ae (patch)
tree6347a18702529cfd42dcb94c37ce2866b49b93f4 /host/lib/usrp
parent18defbd9d40a4c11a33025c8684f48fe51f102c5 (diff)
downloaduhd-395bbbbc1118b061262a10d5c847f17a4fd0c6ae.tar.gz
uhd-395bbbbc1118b061262a10d5c847f17a4fd0c6ae.tar.bz2
uhd-395bbbbc1118b061262a10d5c847f17a4fd0c6ae.zip
uhd: replace all the instances of float not pertaining to io types with double, simplifies life
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/dboard/db_basic_and_lf.cpp8
-rw-r--r--host/lib/usrp/dboard/db_dbsrx.cpp22
-rw-r--r--host/lib/usrp/dboard/db_dbsrx2.cpp22
-rw-r--r--host/lib/usrp/dboard/db_rfx.cpp28
-rw-r--r--host/lib/usrp/dboard/db_tvrx.cpp20
-rw-r--r--host/lib/usrp/dboard/db_unknown.cpp8
-rw-r--r--host/lib/usrp/dboard/db_wbx.cpp34
-rw-r--r--host/lib/usrp/dboard/db_xcvr2450.cpp36
-rw-r--r--host/lib/usrp/misc_utils.cpp20
-rw-r--r--host/lib/usrp/multi_usrp.cpp12
-rw-r--r--host/lib/usrp/single_usrp.cpp12
-rw-r--r--host/lib/usrp/usrp1/codec_ctrl.cpp30
-rw-r--r--host/lib/usrp/usrp1/codec_ctrl.hpp12
-rw-r--r--host/lib/usrp/usrp1/codec_impl.cpp6
-rw-r--r--host/lib/usrp/usrp1/dboard_iface.cpp8
-rw-r--r--host/lib/usrp/usrp2/codec_ctrl.cpp4
-rw-r--r--host/lib/usrp/usrp2/codec_ctrl.hpp4
-rw-r--r--host/lib/usrp/usrp2/codec_impl.cpp10
-rw-r--r--host/lib/usrp/usrp2/dboard_iface.cpp10
-rw-r--r--host/lib/usrp/usrp2/mboard_impl.cpp2
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.hpp4
-rw-r--r--host/lib/usrp/usrp_e100/codec_ctrl.cpp30
-rw-r--r--host/lib/usrp/usrp_e100/codec_ctrl.hpp12
-rw-r--r--host/lib/usrp/usrp_e100/codec_impl.cpp6
-rw-r--r--host/lib/usrp/usrp_e100/dboard_iface.cpp8
25 files changed, 184 insertions, 184 deletions
diff --git a/host/lib/usrp/dboard/db_basic_and_lf.cpp b/host/lib/usrp/dboard/db_basic_and_lf.cpp
index f771595b6..745c2d8e6 100644
--- a/host/lib/usrp/dboard/db_basic_and_lf.cpp
+++ b/host/lib/usrp/dboard/db_basic_and_lf.cpp
@@ -134,7 +134,7 @@ void basic_rx::rx_get(const wax::obj &key_, wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- val = float(0);
+ val = double(0);
return;
case SUBDEV_PROP_GAIN_RANGE:
@@ -192,7 +192,7 @@ void basic_rx::rx_set(const wax::obj &key_, const wax::obj &val){
switch(key.as<subdev_prop_t>()){
case SUBDEV_PROP_GAIN:
- UHD_ASSERT_THROW(val.as<float>() == float(0));
+ UHD_ASSERT_THROW(val.as<double>() == double(0));
return;
case SUBDEV_PROP_ANTENNA:
@@ -245,7 +245,7 @@ void basic_tx::tx_get(const wax::obj &key_, wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- val = float(0);
+ val = double(0);
return;
case SUBDEV_PROP_GAIN_RANGE:
@@ -303,7 +303,7 @@ void basic_tx::tx_set(const wax::obj &key_, const wax::obj &val){
switch(key.as<subdev_prop_t>()){
case SUBDEV_PROP_GAIN:
- UHD_ASSERT_THROW(val.as<float>() == float(0));
+ UHD_ASSERT_THROW(val.as<double>() == double(0));
return;
case SUBDEV_PROP_ANTENNA:
diff --git a/host/lib/usrp/dboard/db_dbsrx.cpp b/host/lib/usrp/dboard/db_dbsrx.cpp
index 7250136f5..491c282ad 100644
--- a/host/lib/usrp/dboard/db_dbsrx.cpp
+++ b/host/lib/usrp/dboard/db_dbsrx.cpp
@@ -70,7 +70,7 @@ public:
private:
double _lo_freq;
double _bandwidth;
- uhd::dict<std::string, float> _gains;
+ uhd::dict<std::string, double> _gains;
max2118_write_regs_t _max2118_write_regs;
max2118_read_regs_t _max2118_read_regs;
boost::uint8_t _max2118_addr(void){
@@ -78,7 +78,7 @@ private:
};
void set_lo_freq(double target_freq);
- void set_gain(float gain, const std::string &name);
+ void set_gain(double gain, const std::string &name);
void set_bandwidth(double bandwidth);
void send_reg(boost::uint8_t start_reg, boost::uint8_t stop_reg){
@@ -418,17 +418,17 @@ void dbsrx::set_lo_freq(double target_freq){
* \param gain the requested gain in dB
* \return 5 bit the register value
*/
-static int gain_to_gc2_vga_reg(float &gain){
+static int gain_to_gc2_vga_reg(double &gain){
int reg = 0;
gain = dbsrx_gain_ranges["GC2"].clip(gain);
// Half dB steps from 0-5dB, 1dB steps from 5-24dB
if (gain < 5) {
reg = boost::math::iround(31.0 - gain/0.5);
- gain = float(boost::math::iround(gain) * 0.5);
+ gain = double(boost::math::iround(gain) * 0.5);
} else {
reg = boost::math::iround(22.0 - (gain - 4.0));
- gain = float(boost::math::iround(gain));
+ gain = double(boost::math::iround(gain));
}
if (dbsrx_debug) std::cerr << boost::format(
@@ -444,16 +444,16 @@ static int gain_to_gc2_vga_reg(float &gain){
* \param gain the requested gain in dB
* \return dac voltage value
*/
-static float gain_to_gc1_rfvga_dac(float &gain){
+static double gain_to_gc1_rfvga_dac(double &gain){
//clip the input
gain = dbsrx_gain_ranges["GC1"].clip(gain);
//voltage level constants
- static const float max_volts = float(1.2), min_volts = float(2.7);
- static const float slope = (max_volts-min_volts)/dbsrx_gain_ranges["GC1"].stop();
+ static const double max_volts = 1.2, min_volts = 2.7;
+ static const double slope = (max_volts-min_volts)/dbsrx_gain_ranges["GC1"].stop();
//calculate the voltage for the aux dac
- float dac_volts = gain*slope + min_volts;
+ double dac_volts = gain*slope + min_volts;
if (dbsrx_debug) std::cerr << boost::format(
"DBSRX GC1 Gain: %f dB, dac_volts: %f V"
@@ -465,7 +465,7 @@ static float gain_to_gc1_rfvga_dac(float &gain){
return dac_volts;
}
-void dbsrx::set_gain(float gain, const std::string &name){
+void dbsrx::set_gain(double gain, const std::string &name){
assert_has(dbsrx_gain_ranges.keys(), name, "dbsrx gain name");
if (name == "GC2"){
_max2118_write_regs.gc2 = gain_to_gc2_vga_reg(gain);
@@ -584,7 +584,7 @@ void dbsrx::rx_set(const wax::obj &key_, const wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- this->set_gain(val.as<float>(), key.name);
+ this->set_gain(val.as<double>(), key.name);
return;
case SUBDEV_PROP_ENABLED:
diff --git a/host/lib/usrp/dboard/db_dbsrx2.cpp b/host/lib/usrp/dboard/db_dbsrx2.cpp
index cdafd6a78..1da9b5ff3 100644
--- a/host/lib/usrp/dboard/db_dbsrx2.cpp
+++ b/host/lib/usrp/dboard/db_dbsrx2.cpp
@@ -48,7 +48,7 @@ static const int dbsrx2_ref_divider = 4; // Hitachi HMC426 divider (U7)
static const prop_names_t dbsrx2_antennas = list_of("J3");
static const uhd::dict<std::string, gain_range_t> dbsrx2_gain_ranges = map_list_of
- ("GC1", gain_range_t(0, 73, float(0.05)))
+ ("GC1", gain_range_t(0, 73, 0.05))
("BBG", gain_range_t(0, 15, 1))
;
@@ -66,7 +66,7 @@ public:
private:
double _lo_freq;
double _bandwidth;
- uhd::dict<std::string, float> _gains;
+ uhd::dict<std::string, double> _gains;
max2112_write_regs_t _max2112_write_regs;
max2112_read_regs_t _max2112_read_regs;
boost::uint8_t _max2112_addr(){ //0x60 or 0x61 depending on which side
@@ -74,7 +74,7 @@ private:
}
void set_lo_freq(double target_freq);
- void set_gain(float gain, const std::string &name);
+ void set_gain(double gain, const std::string &name);
void set_bandwidth(double bandwidth);
void send_reg(boost::uint8_t start_reg, boost::uint8_t stop_reg){
@@ -269,10 +269,10 @@ void dbsrx2::set_lo_freq(double target_freq){
* \param gain the requested gain in dB
* \return 4 bit the register value
*/
-static int gain_to_bbg_vga_reg(float &gain){
+static int gain_to_bbg_vga_reg(double &gain){
int reg = boost::math::iround(dbsrx2_gain_ranges["BBG"].clip(gain));
- gain = float(reg);
+ gain = double(reg);
if (dbsrx2_debug) std::cerr
<< boost::format("DBSRX2 BBG Gain:\n")
@@ -288,16 +288,16 @@ static int gain_to_bbg_vga_reg(float &gain){
* \param gain the requested gain in dB
* \return dac voltage value
*/
-static float gain_to_gc1_rfvga_dac(float &gain){
+static double gain_to_gc1_rfvga_dac(double &gain){
//clip the input
gain = dbsrx2_gain_ranges["GC1"].clip(gain);
//voltage level constants
- static const float max_volts = float(0.5), min_volts = float(2.7);
- static const float slope = (max_volts-min_volts)/dbsrx2_gain_ranges["GC1"].stop();
+ static const double max_volts = 0.5, min_volts = 2.7;
+ static const double slope = (max_volts-min_volts)/dbsrx2_gain_ranges["GC1"].stop();
//calculate the voltage for the aux dac
- float dac_volts = gain*slope + min_volts;
+ double dac_volts = gain*slope + min_volts;
if (dbsrx2_debug) std::cerr
<< boost::format("DBSRX2 GC1 Gain:\n")
@@ -310,7 +310,7 @@ static float gain_to_gc1_rfvga_dac(float &gain){
return dac_volts;
}
-void dbsrx2::set_gain(float gain, const std::string &name){
+void dbsrx2::set_gain(double gain, const std::string &name){
assert_has(dbsrx2_gain_ranges.keys(), name, "dbsrx2 gain name");
if (name == "BBG"){
_max2112_write_regs.bbg = gain_to_bbg_vga_reg(gain);
@@ -423,7 +423,7 @@ void dbsrx2::rx_set(const wax::obj &key_, const wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- this->set_gain(val.as<float>(), key.name);
+ this->set_gain(val.as<double>(), key.name);
return;
case SUBDEV_PROP_ENABLED:
diff --git a/host/lib/usrp/dboard/db_rfx.cpp b/host/lib/usrp/dboard/db_rfx.cpp
index 74a9fb37b..3b66b6939 100644
--- a/host/lib/usrp/dboard/db_rfx.cpp
+++ b/host/lib/usrp/dboard/db_rfx.cpp
@@ -67,11 +67,11 @@ static const prop_names_t rfx_rx_antennas = list_of("TX/RX")("RX2");
static const uhd::dict<std::string, gain_range_t> rfx_tx_gain_ranges; //empty
static const uhd::dict<std::string, gain_range_t> rfx_rx_gain_ranges = map_list_of
- ("PGA0", gain_range_t(0, 70, float(0.022)))
+ ("PGA0", gain_range_t(0, 70, 0.022))
;
static const uhd::dict<std::string, gain_range_t> rfx400_rx_gain_ranges = map_list_of
- ("PGA0", gain_range_t(0, 45, float(0.022)))
+ ("PGA0", gain_range_t(0, 45, 0.022))
;
/***********************************************************************
@@ -98,14 +98,14 @@ private:
const uhd::dict<dboard_iface::unit_t, bool> _div2;
double _rx_lo_freq, _tx_lo_freq;
std::string _rx_ant;
- uhd::dict<std::string, float> _rx_gains;
+ uhd::dict<std::string, double> _rx_gains;
void set_rx_lo_freq(double freq);
void set_tx_lo_freq(double freq);
void set_rx_ant(const std::string &ant);
void set_tx_ant(const std::string &ant);
- void set_rx_gain(float gain, const std::string &name);
- void set_tx_gain(float gain, const std::string &name);
+ void set_rx_gain(double gain, const std::string &name);
+ void set_tx_gain(double gain, const std::string &name);
/*!
* Set the LO frequency for the particular dboard unit.
@@ -240,13 +240,13 @@ void rfx_xcvr::set_tx_ant(const std::string &ant){
/***********************************************************************
* Gain Handling
**********************************************************************/
-static float rx_pga0_gain_to_dac_volts(float &gain, float range){
+static double rx_pga0_gain_to_dac_volts(double &gain, double range){
//voltage level constants (negative slope)
- static const float max_volts = float(.2), min_volts = float(1.2);
- static const float slope = (max_volts-min_volts)/(range);
+ static const double max_volts = .2, min_volts = 1.2;
+ static const double slope = (max_volts-min_volts)/(range);
//calculate the voltage for the aux dac
- float dac_volts = std::clip<float>(gain*slope + min_volts, max_volts, min_volts);
+ double dac_volts = std::clip<double>(gain*slope + min_volts, max_volts, min_volts);
//the actual gain setting
gain = (dac_volts - min_volts)/slope;
@@ -254,15 +254,15 @@ static float rx_pga0_gain_to_dac_volts(float &gain, float range){
return dac_volts;
}
-void rfx_xcvr::set_tx_gain(float, const std::string &name){
+void rfx_xcvr::set_tx_gain(double, const std::string &name){
assert_has(rfx_tx_gain_ranges.keys(), name, "rfx tx gain name");
UHD_THROW_INVALID_CODE_PATH(); //no gains to set
}
-void rfx_xcvr::set_rx_gain(float gain, const std::string &name){
+void rfx_xcvr::set_rx_gain(double gain, const std::string &name){
assert_has(_rx_gain_ranges.keys(), name, "rfx rx gain name");
if(name == "PGA0"){
- float dac_volts = rx_pga0_gain_to_dac_volts(gain,
+ double dac_volts = rx_pga0_gain_to_dac_volts(gain,
(_rx_gain_ranges["PGA0"].stop() - _rx_gain_ranges["PGA0"].start()));
_rx_gains[name] = gain;
@@ -474,7 +474,7 @@ void rfx_xcvr::rx_set(const wax::obj &key_, const wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- this->set_rx_gain(val.as<float>(), key.name);
+ this->set_rx_gain(val.as<double>(), key.name);
return;
case SUBDEV_PROP_ANTENNA:
@@ -571,7 +571,7 @@ void rfx_xcvr::tx_set(const wax::obj &key_, const wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- this->set_tx_gain(val.as<float>(), key.name);
+ this->set_tx_gain(val.as<double>(), key.name);
return;
case SUBDEV_PROP_ANTENNA:
diff --git a/host/lib/usrp/dboard/db_tvrx.cpp b/host/lib/usrp/dboard/db_tvrx.cpp
index 2508555d0..f034f0ef6 100644
--- a/host/lib/usrp/dboard/db_tvrx.cpp
+++ b/host/lib/usrp/dboard/db_tvrx.cpp
@@ -119,8 +119,8 @@ static uhd::dict<std::string, gain_range_t> get_tvrx_gain_ranges(void) {
double ifmax = tvrx_if_gains_db.back();
return map_list_of
- ("RF", gain_range_t(float(rfmin), float(rfmax), float((rfmax-rfmin)/4096.0)))
- ("IF", gain_range_t(float(ifmin), float(ifmax), float((ifmax-ifmin)/4096.0)))
+ ("RF", gain_range_t(rfmin, rfmax, (rfmax-rfmin)/4096.0))
+ ("IF", gain_range_t(ifmin, ifmax, (ifmax-ifmin)/4096.0))
;
}
@@ -141,14 +141,14 @@ public:
void rx_set(const wax::obj &key, const wax::obj &val);
private:
- uhd::dict<std::string, float> _gains;
+ uhd::dict<std::string, double> _gains;
double _lo_freq;
tuner_4937di5_regs_t _tuner_4937di5_regs;
boost::uint8_t _tuner_4937di5_addr(void){
return (this->get_iface()->get_special_props().mangle_i2c_addrs)? 0x61 : 0x60; //ok really? we could rename that call
};
- void set_gain(float gain, const std::string &name);
+ void set_gain(double gain, const std::string &name);
void set_freq(double freq);
void update_regs(void){
@@ -275,7 +275,7 @@ static double gain_interp(double gain, boost::array<double, 17> db_vector, boost
* \return dac voltage value
*/
-static float rf_gain_to_voltage(float gain, double lo_freq){
+static double rf_gain_to_voltage(double gain, double lo_freq){
//clip the input
gain = get_tvrx_gain_ranges()["RF"].clip(gain);
@@ -293,7 +293,7 @@ static float rf_gain_to_voltage(float gain, double lo_freq){
"tvrx RF AGC gain: %f dB, dac_volts: %f V"
) % gain % dac_volts << std::endl;
- return float(dac_volts);
+ return dac_volts;
}
/*!
@@ -303,7 +303,7 @@ static float rf_gain_to_voltage(float gain, double lo_freq){
* \return dac voltage value
*/
-static float if_gain_to_voltage(float gain){
+static double if_gain_to_voltage(double gain){
//clip the input
gain = get_tvrx_gain_ranges()["IF"].clip(gain);
@@ -316,10 +316,10 @@ static float if_gain_to_voltage(float gain){
"tvrx IF AGC gain: %f dB, dac_volts: %f V"
) % gain % dac_volts << std::endl;
- return float(dac_volts);
+ return dac_volts;
}
-void tvrx::set_gain(float gain, const std::string &name){
+void tvrx::set_gain(double gain, const std::string &name){
assert_has(get_tvrx_gain_ranges().keys(), name, "tvrx gain name");
if (name == "RF"){
this->get_iface()->write_aux_dac(dboard_iface::UNIT_RX, dboard_iface::AUX_DAC_B, rf_gain_to_voltage(gain, _lo_freq));
@@ -473,7 +473,7 @@ void tvrx::rx_set(const wax::obj &key_, const wax::obj &val){
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
case SUBDEV_PROP_GAIN:
- this->set_gain(val.as<float>(), key.name);
+ this->set_gain(val.as<double>(), key.name);
return;
case SUBDEV_PROP_FREQ:
diff --git a/host/lib/usrp/dboard/db_unknown.cpp b/host/lib/usrp/dboard/db_unknown.cpp
index 168e1971c..ccda93c04 100644
--- a/host/lib/usrp/dboard/db_unknown.cpp
+++ b/host/lib/usrp/dboard/db_unknown.cpp
@@ -115,7 +115,7 @@ void unknown_rx::rx_get(const wax::obj &key_, wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- val = float(0);
+ val = double(0);
return;
case SUBDEV_PROP_GAIN_RANGE:
@@ -173,7 +173,7 @@ void unknown_rx::rx_set(const wax::obj &key_, const wax::obj &val){
switch(key.as<subdev_prop_t>()){
case SUBDEV_PROP_GAIN:
- UHD_ASSERT_THROW(val.as<float>() == float(0));
+ UHD_ASSERT_THROW(val.as<double>() == double(0));
return;
case SUBDEV_PROP_ANTENNA:
@@ -217,7 +217,7 @@ void unknown_tx::tx_get(const wax::obj &key_, wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- val = float(0);
+ val = double(0);
return;
case SUBDEV_PROP_GAIN_RANGE:
@@ -275,7 +275,7 @@ void unknown_tx::tx_set(const wax::obj &key_, const wax::obj &val){
switch(key.as<subdev_prop_t>()){
case SUBDEV_PROP_GAIN:
- UHD_ASSERT_THROW(val.as<float>() == float(0));
+ UHD_ASSERT_THROW(val.as<double>() == double(0));
return;
case SUBDEV_PROP_ANTENNA:
diff --git a/host/lib/usrp/dboard/db_wbx.cpp b/host/lib/usrp/dboard/db_wbx.cpp
index dd5bd600b..cdf23836b 100644
--- a/host/lib/usrp/dboard/db_wbx.cpp
+++ b/host/lib/usrp/dboard/db_wbx.cpp
@@ -94,11 +94,11 @@ static const prop_names_t wbx_tx_antennas = list_of("TX/RX");
static const prop_names_t wbx_rx_antennas = list_of("TX/RX")("RX2");
static const uhd::dict<std::string, gain_range_t> wbx_tx_gain_ranges = map_list_of
- ("PGA0", gain_range_t(0, 25, float(0.05)))
+ ("PGA0", gain_range_t(0, 25, 0.05))
;
static const uhd::dict<std::string, gain_range_t> wbx_rx_gain_ranges = map_list_of
- ("PGA0", gain_range_t(0, 31.5, float(0.5)))
+ ("PGA0", gain_range_t(0, 31.5, 0.5))
;
/***********************************************************************
@@ -116,7 +116,7 @@ public:
void tx_set(const wax::obj &key, const wax::obj &val);
private:
- uhd::dict<std::string, float> _tx_gains, _rx_gains;
+ uhd::dict<std::string, double> _tx_gains, _rx_gains;
double _rx_lo_freq, _tx_lo_freq;
std::string _tx_ant, _rx_ant;
@@ -124,8 +124,8 @@ private:
void set_tx_lo_freq(double freq);
void set_rx_ant(const std::string &ant);
void set_tx_ant(const std::string &ant);
- void set_rx_gain(float gain, const std::string &name);
- void set_tx_gain(float gain, const std::string &name);
+ void set_rx_gain(double gain, const std::string &name);
+ void set_tx_gain(double gain, const std::string &name);
void update_atr(void);
@@ -196,12 +196,12 @@ wbx_xcvr::~wbx_xcvr(void){
/***********************************************************************
* Gain Handling
**********************************************************************/
-static int rx_pga0_gain_to_iobits(float &gain){
+static int rx_pga0_gain_to_iobits(double &gain){
//clip the input
gain = wbx_rx_gain_ranges["PGA0"].clip(gain);
//convert to attenuation and update iobits for atr
- float attn = wbx_rx_gain_ranges["PGA0"].stop() - gain;
+ double attn = wbx_rx_gain_ranges["PGA0"].stop() - gain;
//calculate the attenuation
int attn_code = boost::math::iround(attn*2);
@@ -212,21 +212,21 @@ static int rx_pga0_gain_to_iobits(float &gain){
) % attn % attn_code % (iobits & RX_ATTN_MASK) % RX_ATTN_MASK << std::endl;
//the actual gain setting
- gain = wbx_rx_gain_ranges["PGA0"].stop() - float(attn_code)/2;
+ gain = wbx_rx_gain_ranges["PGA0"].stop() - double(attn_code)/2;
return iobits;
}
-static float tx_pga0_gain_to_dac_volts(float &gain){
+static double tx_pga0_gain_to_dac_volts(double &gain){
//clip the input
gain = wbx_tx_gain_ranges["PGA0"].clip(gain);
//voltage level constants
- static const float max_volts = float(0.5), min_volts = float(1.4);
- static const float slope = (max_volts-min_volts)/wbx_tx_gain_ranges["PGA0"].stop();
+ static const double max_volts = 0.5, min_volts = 1.4;
+ static const double slope = (max_volts-min_volts)/wbx_tx_gain_ranges["PGA0"].stop();
//calculate the voltage for the aux dac
- float dac_volts = gain*slope + min_volts;
+ double dac_volts = gain*slope + min_volts;
if (wbx_debug) std::cerr << boost::format(
"WBX TX Gain: %f dB, dac_volts: %f V"
@@ -238,10 +238,10 @@ static float tx_pga0_gain_to_dac_volts(float &gain){
return dac_volts;
}
-void wbx_xcvr::set_tx_gain(float gain, const std::string &name){
+void wbx_xcvr::set_tx_gain(double gain, const std::string &name){
assert_has(wbx_tx_gain_ranges.keys(), name, "wbx tx gain name");
if(name == "PGA0"){
- float dac_volts = tx_pga0_gain_to_dac_volts(gain);
+ double dac_volts = tx_pga0_gain_to_dac_volts(gain);
_tx_gains[name] = gain;
//write the new voltage to the aux dac
@@ -250,7 +250,7 @@ void wbx_xcvr::set_tx_gain(float gain, const std::string &name){
else UHD_THROW_INVALID_CODE_PATH();
}
-void wbx_xcvr::set_rx_gain(float gain, const std::string &name){
+void wbx_xcvr::set_rx_gain(double gain, const std::string &name){
assert_has(wbx_rx_gain_ranges.keys(), name, "wbx rx gain name");
if(name == "PGA0"){
rx_pga0_gain_to_iobits(gain);
@@ -544,7 +544,7 @@ void wbx_xcvr::rx_set(const wax::obj &key_, const wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- this->set_rx_gain(val.as<float>(), key.name);
+ this->set_rx_gain(val.as<double>(), key.name);
return;
case SUBDEV_PROP_ANTENNA:
@@ -645,7 +645,7 @@ void wbx_xcvr::tx_set(const wax::obj &key_, const wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- this->set_tx_gain(val.as<float>(), key.name);
+ this->set_tx_gain(val.as<double>(), key.name);
return;
case SUBDEV_PROP_ANTENNA:
diff --git a/host/lib/usrp/dboard/db_xcvr2450.cpp b/host/lib/usrp/dboard/db_xcvr2450.cpp
index 78eceff99..6fb5a26a8 100644
--- a/host/lib/usrp/dboard/db_xcvr2450.cpp
+++ b/host/lib/usrp/dboard/db_xcvr2450.cpp
@@ -109,7 +109,7 @@ public:
private:
double _lo_freq;
double _rx_bandwidth, _tx_bandwidth;
- uhd::dict<std::string, float> _tx_gains, _rx_gains;
+ uhd::dict<std::string, double> _tx_gains, _rx_gains;
std::string _tx_ant, _rx_ant;
int _ad9515div;
max2829_regs_t _max2829_regs;
@@ -117,8 +117,8 @@ private:
void set_lo_freq(double target_freq);
void set_tx_ant(const std::string &ant);
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_tx_gain(double gain, const std::string &name);
+ void set_rx_gain(double gain, const std::string &name);
void set_rx_bandwidth(double bandwidth);
void set_tx_bandwidth(double bandwidth);
@@ -150,12 +150,12 @@ private:
* Read the RSSI from the aux adc
* \return the rssi in dB
*/
- float get_rssi(void){
+ double get_rssi(void){
//constants for the rssi calculation
- static const float min_v = float(0.5), max_v = float(2.5);
- static const float rssi_dyn_range = 60;
+ static const double min_v = 0.5, max_v = 2.5;
+ static const double rssi_dyn_range = 60;
//calculate the rssi from the voltage
- float voltage = this->get_iface()->read_aux_adc(dboard_iface::UNIT_RX, dboard_iface::AUX_ADC_B);
+ double voltage = this->get_iface()->read_aux_adc(dboard_iface::UNIT_RX, dboard_iface::AUX_ADC_B);
return rssi_dyn_range*(voltage - min_v)/(max_v - min_v);
}
};
@@ -355,14 +355,14 @@ void xcvr2450::set_rx_ant(const std::string &ant){
* \param gain the requested gain in dB
* \return 6 bit the register value
*/
-static int gain_to_tx_vga_reg(float &gain){
+static int gain_to_tx_vga_reg(double &gain){
//calculate the register value
int reg = std::clip(boost::math::iround(gain*60/30.0) + 3, 0, 63);
//calculate the actual gain value
if (reg < 4) gain = 0;
- else if (reg < 48) gain = float(reg/2 - 1);
- else gain = float(reg/2.0 - 1.5);
+ else if (reg < 48) gain = double(reg/2 - 1);
+ else gain = double(reg/2.0 - 1.5);
//return register value
return reg;
@@ -374,7 +374,7 @@ static int gain_to_tx_vga_reg(float &gain){
* \param gain the requested gain in dB
* \return gain enum value
*/
-static max2829_regs_t::tx_baseband_gain_t gain_to_tx_bb_reg(float &gain){
+static max2829_regs_t::tx_baseband_gain_t gain_to_tx_bb_reg(double &gain){
int reg = std::clip(boost::math::iround(gain*3/5.0), 0, 3);
switch(reg){
case 0:
@@ -399,9 +399,9 @@ static max2829_regs_t::tx_baseband_gain_t gain_to_tx_bb_reg(float &gain){
* \param gain the requested gain in dB
* \return 5 bit the register value
*/
-static int gain_to_rx_vga_reg(float &gain){
+static int gain_to_rx_vga_reg(double &gain){
int reg = std::clip(boost::math::iround(gain/2.0), 0, 31);
- gain = float(reg*2);
+ gain = double(reg*2);
return reg;
}
@@ -411,7 +411,7 @@ static int gain_to_rx_vga_reg(float &gain){
* \param gain the requested gain in dB
* \return 2 bit the register value
*/
-static int gain_to_rx_lna_reg(float &gain){
+static int gain_to_rx_lna_reg(double &gain){
int reg = std::clip(boost::math::iround(gain*2/30.5) + 1, 0, 3);
switch(reg){
case 0:
@@ -422,7 +422,7 @@ static int gain_to_rx_lna_reg(float &gain){
return reg;
}
-void xcvr2450::set_tx_gain(float gain, const std::string &name){
+void xcvr2450::set_tx_gain(double gain, const std::string &name){
assert_has(xcvr_tx_gain_ranges.keys(), name, "xcvr tx gain name");
if (name == "VGA"){
_max2829_regs.tx_vga_gain = gain_to_tx_vga_reg(gain);
@@ -436,7 +436,7 @@ void xcvr2450::set_tx_gain(float gain, const std::string &name){
_tx_gains[name] = gain;
}
-void xcvr2450::set_rx_gain(float gain, const std::string &name){
+void xcvr2450::set_rx_gain(double gain, const std::string &name){
assert_has(xcvr_rx_gain_ranges.keys(), name, "xcvr rx gain name");
if (name == "VGA"){
_max2829_regs.rx_vga_gain = gain_to_rx_vga_reg(gain);
@@ -643,7 +643,7 @@ void xcvr2450::rx_set(const wax::obj &key_, const wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- this->set_rx_gain(val.as<float>(), key.name);
+ this->set_rx_gain(val.as<double>(), key.name);
return;
case SUBDEV_PROP_ANTENNA:
@@ -742,7 +742,7 @@ void xcvr2450::tx_set(const wax::obj &key_, const wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- this->set_tx_gain(val.as<float>(), key.name);
+ this->set_tx_gain(val.as<double>(), key.name);
return;
case SUBDEV_PROP_BANDWIDTH:
diff --git a/host/lib/usrp/misc_utils.cpp b/host/lib/usrp/misc_utils.cpp
index 5856d706f..0385187eb 100644
--- a/host/lib/usrp/misc_utils.cpp
+++ b/host/lib/usrp/misc_utils.cpp
@@ -39,24 +39,24 @@ static gain_range_t get_codec_gain_range(wax::obj codec, const std::string &name
return codec[named_prop_t(CODEC_PROP_GAIN_RANGE, name)].as<gain_range_t>();
}
-static float get_codec_gain_i(wax::obj codec, const std::string &name){
- return codec[named_prop_t(CODEC_PROP_GAIN_I, name)].as<float>();
+static double get_codec_gain_i(wax::obj codec, const std::string &name){
+ return codec[named_prop_t(CODEC_PROP_GAIN_I, name)].as<double>();
}
-static float get_codec_gain_q(wax::obj codec, const std::string &name){
- return codec[named_prop_t(CODEC_PROP_GAIN_Q, name)].as<float>();
+static double get_codec_gain_q(wax::obj codec, const std::string &name){
+ return codec[named_prop_t(CODEC_PROP_GAIN_Q, name)].as<double>();
}
-static void set_codec_gain_both(wax::obj codec, const std::string &name, float gain){
+static void set_codec_gain_both(wax::obj codec, const std::string &name, double gain){
codec[named_prop_t(CODEC_PROP_GAIN_I, name)] = gain;
codec[named_prop_t(CODEC_PROP_GAIN_Q, name)] = gain;
}
-static void set_codec_gain_i(wax::obj codec, const std::string &name, float gain){
+static void set_codec_gain_i(wax::obj codec, const std::string &name, double gain){
codec[named_prop_t(CODEC_PROP_GAIN_I, name)] = gain;
}
-static void set_codec_gain_q(wax::obj codec, const std::string &name, float gain){
+static void set_codec_gain_q(wax::obj codec, const std::string &name, double gain){
codec[named_prop_t(CODEC_PROP_GAIN_Q, name)] = gain;
}
@@ -64,15 +64,15 @@ static void set_codec_gain_q(wax::obj codec, const std::string &name, float gain
* subdev gain group helper functions:
* do this so we dont have to bind a templated function
**********************************************************************/
-static float get_subdev_gain(wax::obj subdev, const std::string &name){
- return subdev[named_prop_t(SUBDEV_PROP_GAIN, name)].as<float>();
+static double get_subdev_gain(wax::obj subdev, const std::string &name){
+ return subdev[named_prop_t(SUBDEV_PROP_GAIN, name)].as<double>();
}
static gain_range_t get_subdev_gain_range(wax::obj subdev, const std::string &name){
return subdev[named_prop_t(SUBDEV_PROP_GAIN_RANGE, name)].as<gain_range_t>();
}
-static void set_subdev_gain(wax::obj subdev, const std::string &name, float gain){
+static void set_subdev_gain(wax::obj subdev, const std::string &name, double gain){
subdev[named_prop_t(SUBDEV_PROP_GAIN, name)] = gain;
}
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp
index baf87ced5..ab78fb4b6 100644
--- a/host/lib/usrp/multi_usrp.cpp
+++ b/host/lib/usrp/multi_usrp.cpp
@@ -239,11 +239,11 @@ public:
return add_dsp_shift(_rx_subdev(chan)[SUBDEV_PROP_FREQ_RANGE].as<freq_range_t>(), _rx_dsp(chan/rx_cpm()));
}
- void set_rx_gain(float gain, const std::string &name, size_t chan){
+ void set_rx_gain(double gain, const std::string &name, size_t chan){
return _rx_gain_group(chan)->set_value(gain, name);
}
- float get_rx_gain(const std::string &name, size_t chan){
+ double get_rx_gain(const std::string &name, size_t chan){
return _rx_gain_group(chan)->get_value(name);
}
@@ -279,8 +279,8 @@ public:
return _rx_subdev(chan)[SUBDEV_PROP_BANDWIDTH].as<double>();
}
- float read_rssi(size_t chan){
- return _rx_subdev(chan)[SUBDEV_PROP_RSSI].as<float>();
+ double read_rssi(size_t chan){
+ return _rx_subdev(chan)[SUBDEV_PROP_RSSI].as<double>();
}
dboard_iface::sptr get_rx_dboard_iface(size_t chan){
@@ -337,11 +337,11 @@ public:
return add_dsp_shift(_tx_subdev(chan)[SUBDEV_PROP_FREQ_RANGE].as<freq_range_t>(), _tx_dsp(chan/tx_cpm()));
}
- void set_tx_gain(float gain, const std::string &name, size_t chan){
+ void set_tx_gain(double gain, const std::string &name, size_t chan){
return _tx_gain_group(chan)->set_value(gain, name);
}
- float get_tx_gain(const std::string &name, size_t chan){
+ double get_tx_gain(const std::string &name, size_t chan){
return _tx_gain_group(chan)->get_value(name);
}
diff --git a/host/lib/usrp/single_usrp.cpp b/host/lib/usrp/single_usrp.cpp
index 12730929a..e63cdaea9 100644
--- a/host/lib/usrp/single_usrp.cpp
+++ b/host/lib/usrp/single_usrp.cpp
@@ -164,11 +164,11 @@ public:
return add_dsp_shift(_rx_subdev(chan)[SUBDEV_PROP_FREQ_RANGE].as<freq_range_t>(), _rx_dsp());
}
- void set_rx_gain(float gain, const std::string &name, size_t chan){
+ void set_rx_gain(double gain, const std::string &name, size_t chan){
return _rx_gain_group(chan)->set_value(gain, name);
}
- float get_rx_gain(const std::string &name, size_t chan){
+ double get_rx_gain(const std::string &name, size_t chan){
return _rx_gain_group(chan)->get_value(name);
}
@@ -204,8 +204,8 @@ public:
return _rx_subdev(chan)[SUBDEV_PROP_BANDWIDTH].as<double>();
}
- float read_rssi(size_t chan){
- return _rx_subdev(chan)[SUBDEV_PROP_RSSI].as<float>();
+ double read_rssi(size_t chan){
+ return _rx_subdev(chan)[SUBDEV_PROP_RSSI].as<double>();
}
dboard_iface::sptr get_rx_dboard_iface(size_t chan){
@@ -250,11 +250,11 @@ public:
return add_dsp_shift(_tx_subdev(chan)[SUBDEV_PROP_FREQ_RANGE].as<freq_range_t>(), _tx_dsp());
}
- void set_tx_gain(float gain, const std::string &name, size_t chan){
+ void set_tx_gain(double gain, const std::string &name, size_t chan){
return _tx_gain_group(chan)->set_value(gain, name);
}
- float get_tx_gain(const std::string &name, size_t chan){
+ double get_tx_gain(const std::string &name, size_t chan){
return _tx_gain_group(chan)->get_value(name);
}
diff --git a/host/lib/usrp/usrp1/codec_ctrl.cpp b/host/lib/usrp/usrp1/codec_ctrl.cpp
index 18f794632..553f78ef8 100644
--- a/host/lib/usrp/usrp1/codec_ctrl.cpp
+++ b/host/lib/usrp/usrp1/codec_ctrl.cpp
@@ -35,7 +35,7 @@ using namespace uhd;
static const bool codec_debug = false;
-const gain_range_t usrp1_codec_ctrl::tx_pga_gain_range(-20, 0, float(0.1));
+const gain_range_t usrp1_codec_ctrl::tx_pga_gain_range(-20, 0, double(0.1));
const gain_range_t usrp1_codec_ctrl::rx_pga_gain_range(0, 20, 1);
/***********************************************************************
@@ -50,17 +50,17 @@ public:
~usrp1_codec_ctrl_impl(void);
//aux adc and dac control
- float read_aux_adc(aux_adc_t which);
- void write_aux_dac(aux_dac_t which, float volts);
+ double read_aux_adc(aux_adc_t which);
+ void write_aux_dac(aux_dac_t which, double volts);
//duc control
void set_duc_freq(double freq);
//pga gain control
- void set_tx_pga_gain(float);
- float get_tx_pga_gain(void);
- void set_rx_pga_gain(float, char);
- float get_rx_pga_gain(char);
+ void set_tx_pga_gain(double);
+ double get_tx_pga_gain(void);
+ void set_rx_pga_gain(double, char);
+ double get_rx_pga_gain(char);
//rx adc buffer control
void bypass_adc_buffers(bool bypass);
@@ -159,19 +159,19 @@ usrp1_codec_ctrl_impl::~usrp1_codec_ctrl_impl(void)
**********************************************************************/
static const int mtpgw = 255; //maximum tx pga gain word
-void usrp1_codec_ctrl_impl::set_tx_pga_gain(float gain){
+void usrp1_codec_ctrl_impl::set_tx_pga_gain(double gain){
int gain_word = int(mtpgw*(gain - tx_pga_gain_range.start())/(tx_pga_gain_range.stop() - tx_pga_gain_range.start()));
_ad9862_regs.tx_pga_gain = std::clip(gain_word, 0, mtpgw);
this->send_reg(16);
}
-float usrp1_codec_ctrl_impl::get_tx_pga_gain(void){
+double usrp1_codec_ctrl_impl::get_tx_pga_gain(void){
return (_ad9862_regs.tx_pga_gain*(tx_pga_gain_range.stop() - tx_pga_gain_range.start())/mtpgw) + tx_pga_gain_range.start();
}
static const int mrpgw = 0x14; //maximum rx pga gain word
-void usrp1_codec_ctrl_impl::set_rx_pga_gain(float gain, char which){
+void usrp1_codec_ctrl_impl::set_rx_pga_gain(double gain, char which){
int gain_word = int(mrpgw*(gain - rx_pga_gain_range.start())/(rx_pga_gain_range.stop() - rx_pga_gain_range.start()));
gain_word = std::clip(gain_word, 0, mrpgw);
switch(which){
@@ -187,7 +187,7 @@ void usrp1_codec_ctrl_impl::set_rx_pga_gain(float gain, char which){
}
}
-float usrp1_codec_ctrl_impl::get_rx_pga_gain(char which){
+double usrp1_codec_ctrl_impl::get_rx_pga_gain(char which){
int gain_word;
switch(which){
case 'A': gain_word = _ad9862_regs.rx_pga_a; break;
@@ -200,12 +200,12 @@ float usrp1_codec_ctrl_impl::get_rx_pga_gain(char which){
/***********************************************************************
* Codec Control AUX ADC Methods
**********************************************************************/
-static float aux_adc_to_volts(boost::uint8_t high, boost::uint8_t low)
+static double aux_adc_to_volts(boost::uint8_t high, boost::uint8_t low)
{
- return float(((boost::uint16_t(high) << 2) | low)*3.3)/0x3ff;
+ return double(((boost::uint16_t(high) << 2) | low)*3.3)/0x3ff;
}
-float usrp1_codec_ctrl_impl::read_aux_adc(aux_adc_t which)
+double usrp1_codec_ctrl_impl::read_aux_adc(aux_adc_t which)
{
//check to see if the switch needs to be set
bool write_switch = false;
@@ -259,7 +259,7 @@ float usrp1_codec_ctrl_impl::read_aux_adc(aux_adc_t which)
/***********************************************************************
* Codec Control AUX DAC Methods
**********************************************************************/
-void usrp1_codec_ctrl_impl::write_aux_dac(aux_dac_t which, float volts)
+void usrp1_codec_ctrl_impl::write_aux_dac(aux_dac_t which, double volts)
{
//special case for aux dac d (aka sigma delta word)
if (which == AUX_DAC_D) {
diff --git a/host/lib/usrp/usrp1/codec_ctrl.hpp b/host/lib/usrp/usrp1/codec_ctrl.hpp
index e2e8a010d..c0f44ebf4 100644
--- a/host/lib/usrp/usrp1/codec_ctrl.hpp
+++ b/host/lib/usrp/usrp1/codec_ctrl.hpp
@@ -61,7 +61,7 @@ public:
* \param which which of the 4 adcs
* \return a value in volts
*/
- virtual float read_aux_adc(aux_adc_t which) = 0;
+ virtual double read_aux_adc(aux_adc_t which) = 0;
//! aux dac identifier constants
enum aux_dac_t{
@@ -76,19 +76,19 @@ public:
* \param which which of the 4 dacs
* \param volts the level in in volts
*/
- virtual void write_aux_dac(aux_dac_t which, float volts) = 0;
+ virtual void write_aux_dac(aux_dac_t which, double volts) = 0;
//! Set the TX PGA gain
- virtual void set_tx_pga_gain(float gain) = 0;
+ virtual void set_tx_pga_gain(double gain) = 0;
//! Get the TX PGA gain
- virtual float get_tx_pga_gain(void) = 0;
+ virtual double get_tx_pga_gain(void) = 0;
//! Set the RX PGA gain ('A' or 'B')
- virtual void set_rx_pga_gain(float gain, char which) = 0;
+ virtual void set_rx_pga_gain(double gain, char which) = 0;
//! Get the RX PGA gain ('A' or 'B')
- virtual float get_rx_pga_gain(char which) = 0;
+ virtual double get_rx_pga_gain(char which) = 0;
//! Set the TX modulator frequency
virtual void set_duc_freq(double freq) = 0;
diff --git a/host/lib/usrp/usrp1/codec_impl.cpp b/host/lib/usrp/usrp1/codec_impl.cpp
index db53be53e..fe60c8b9a 100644
--- a/host/lib/usrp/usrp1/codec_impl.cpp
+++ b/host/lib/usrp/usrp1/codec_impl.cpp
@@ -92,12 +92,12 @@ void usrp1_impl::rx_codec_set(const wax::obj &key_, const wax::obj &val, dboard_
switch(key.as<codec_prop_t>()) {
case CODEC_PROP_GAIN_I:
UHD_ASSERT_THROW(key.name == adc_pga_gain_name);
- _codec_ctrls[dboard_slot]->set_rx_pga_gain(val.as<float>(), 'A');
+ _codec_ctrls[dboard_slot]->set_rx_pga_gain(val.as<double>(), 'A');
return;
case CODEC_PROP_GAIN_Q:
UHD_ASSERT_THROW(key.name == adc_pga_gain_name);
- _codec_ctrls[dboard_slot]->set_rx_pga_gain(val.as<float>(), 'B');
+ _codec_ctrls[dboard_slot]->set_rx_pga_gain(val.as<double>(), 'B');
return;
default: UHD_THROW_PROP_SET_ERROR();
@@ -151,7 +151,7 @@ void usrp1_impl::tx_codec_set(const wax::obj &key_, const wax::obj &val, dboard_
case CODEC_PROP_GAIN_I: //only one gain for I and Q
case CODEC_PROP_GAIN_Q:
UHD_ASSERT_THROW(key.name == dac_pga_gain_name);
- _codec_ctrls[dboard_slot]->set_tx_pga_gain(val.as<float>());
+ _codec_ctrls[dboard_slot]->set_tx_pga_gain(val.as<double>());
return;
default: UHD_THROW_PROP_SET_ERROR();
diff --git a/host/lib/usrp/usrp1/dboard_iface.cpp b/host/lib/usrp/usrp1/dboard_iface.cpp
index 4e47d6bf6..180faf1da 100644
--- a/host/lib/usrp/usrp1/dboard_iface.cpp
+++ b/host/lib/usrp/usrp1/dboard_iface.cpp
@@ -72,8 +72,8 @@ public:
return props;
}
- void write_aux_dac(unit_t, aux_dac_t, float);
- float read_aux_adc(unit_t, aux_adc_t);
+ void write_aux_dac(unit_t, aux_dac_t, double);
+ double read_aux_adc(unit_t, aux_adc_t);
void _set_pin_ctrl(unit_t, boost::uint16_t);
void _set_atr_reg(unit_t, atr_reg_t, boost::uint16_t);
@@ -369,7 +369,7 @@ byte_vector_t usrp1_dboard_iface::read_i2c(boost::uint8_t addr,
* Aux DAX/ADC
**********************************************************************/
void usrp1_dboard_iface::write_aux_dac(dboard_iface::unit_t,
- aux_dac_t which, float value)
+ aux_dac_t which, double value)
{
//same aux dacs for each unit
static const uhd::dict<aux_dac_t, usrp1_codec_ctrl::aux_dac_t>
@@ -382,7 +382,7 @@ void usrp1_dboard_iface::write_aux_dac(dboard_iface::unit_t,
_codec->write_aux_dac(which_to_aux_dac[which], value);
}
-float usrp1_dboard_iface::read_aux_adc(dboard_iface::unit_t unit,
+double usrp1_dboard_iface::read_aux_adc(dboard_iface::unit_t unit,
aux_adc_t which)
{
static const
diff --git a/host/lib/usrp/usrp2/codec_ctrl.cpp b/host/lib/usrp/usrp2/codec_ctrl.cpp
index 4f2cd88bb..7bd19cbe3 100644
--- a/host/lib/usrp/usrp2/codec_ctrl.cpp
+++ b/host/lib/usrp/usrp2/codec_ctrl.cpp
@@ -123,7 +123,7 @@ public:
this->send_ad9777_reg(0x01); //set the register
}
- void set_rx_digital_gain(float gain) { //fine digital gain
+ void set_rx_digital_gain(double gain) { //fine digital gain
switch(_iface->get_rev()){
case usrp2_iface::USRP_N200:
case usrp2_iface::USRP_N210:
@@ -135,7 +135,7 @@ public:
}
}
- void set_rx_digital_fine_gain(float gain) { //gain correction
+ void set_rx_digital_fine_gain(double gain) { //gain correction
switch(_iface->get_rev()){
case usrp2_iface::USRP_N200:
case usrp2_iface::USRP_N210:
diff --git a/host/lib/usrp/usrp2/codec_ctrl.hpp b/host/lib/usrp/usrp2/codec_ctrl.hpp
index c8d977a1f..8ca5b4f42 100644
--- a/host/lib/usrp/usrp2/codec_ctrl.hpp
+++ b/host/lib/usrp/usrp2/codec_ctrl.hpp
@@ -54,14 +54,14 @@ public:
* \param gain from 0-6dB
*/
- virtual void set_rx_digital_gain(float gain) = 0;
+ virtual void set_rx_digital_gain(double gain) = 0;
/*!
* Set the digital gain correction on the USRP2+ ADC (ADS62P44).
* \param gain from 0-0.5dB
*/
- virtual void set_rx_digital_fine_gain(float gain) = 0;
+ virtual void set_rx_digital_fine_gain(double gain) = 0;
};
diff --git a/host/lib/usrp/usrp2/codec_impl.cpp b/host/lib/usrp/usrp2/codec_impl.cpp
index e417bc340..c52f0f46f 100644
--- a/host/lib/usrp/usrp2/codec_impl.cpp
+++ b/host/lib/usrp/usrp2/codec_impl.cpp
@@ -30,9 +30,9 @@ using namespace boost::assign;
//this only applies to USRP2P
static const uhd::dict<std::string, gain_range_t> codec_rx_gain_ranges = map_list_of
- ("analog", gain_range_t(0, float(3.5), float(3.5)))
- ("digital", gain_range_t(0, float(6.0), float(0.5)))
- ("digital-fine", gain_range_t(0, float(0.5), float(0.05)));
+ ("analog", gain_range_t(0, 3.5, 3.5))
+ ("digital", gain_range_t(0, 6.0, 0.5))
+ ("digital-fine", gain_range_t(0, 0.5, 0.05));
/***********************************************************************
@@ -112,7 +112,7 @@ void usrp2_mboard_impl::rx_codec_set(const wax::obj &key_, const wax::obj &val){
switch(key.as<codec_prop_t>()) {
case CODEC_PROP_GAIN_I:
case CODEC_PROP_GAIN_Q:
- this->rx_codec_set_gain(val.as<float>(), key.name);
+ this->rx_codec_set_gain(val.as<double>(), key.name);
return;
default: UHD_THROW_PROP_SET_ERROR();
@@ -123,7 +123,7 @@ void usrp2_mboard_impl::rx_codec_set(const wax::obj &key_, const wax::obj &val){
* Helper function to set RX codec gain
***********************************************************************/
-void usrp2_mboard_impl::rx_codec_set_gain(float gain, const std::string &name){
+void usrp2_mboard_impl::rx_codec_set_gain(double gain, const std::string &name){
assert_has(codec_rx_gain_ranges.keys(), name, "codec rx gain name");
_codec_rx_gains[name] = gain;
diff --git a/host/lib/usrp/usrp2/dboard_iface.cpp b/host/lib/usrp/usrp2/dboard_iface.cpp
index 54c1c735c..16bdd040c 100644
--- a/host/lib/usrp/usrp2/dboard_iface.cpp
+++ b/host/lib/usrp/usrp2/dboard_iface.cpp
@@ -44,8 +44,8 @@ public:
return props;
}
- void write_aux_dac(unit_t, aux_dac_t, float);
- float read_aux_adc(unit_t, aux_adc_t);
+ void write_aux_dac(unit_t, aux_dac_t, double);
+ double read_aux_adc(unit_t, aux_adc_t);
void _set_pin_ctrl(unit_t, boost::uint16_t);
void _set_atr_reg(unit_t, atr_reg_t, boost::uint16_t);
@@ -294,7 +294,7 @@ void usrp2_dboard_iface::_write_aux_dac(unit_t unit){
);
}
-void usrp2_dboard_iface::write_aux_dac(unit_t unit, aux_dac_t which, float value){
+void usrp2_dboard_iface::write_aux_dac(unit_t unit, aux_dac_t which, double value){
_dac_regs[unit].data = boost::math::iround(4095*value/3.3);
_dac_regs[unit].cmd = ad5623_regs_t::CMD_WR_UP_DAC_CHAN_N;
@@ -317,7 +317,7 @@ void usrp2_dboard_iface::write_aux_dac(unit_t unit, aux_dac_t which, float value
this->_write_aux_dac(unit);
}
-float usrp2_dboard_iface::read_aux_adc(unit_t unit, aux_adc_t which){
+double usrp2_dboard_iface::read_aux_adc(unit_t unit, aux_adc_t which){
static const uhd::dict<unit_t, int> unit_to_spi_adc = map_list_of
(UNIT_RX, SPI_SS_RX_ADC)
(UNIT_TX, SPI_SS_TX_ADC)
@@ -346,5 +346,5 @@ float usrp2_dboard_iface::read_aux_adc(unit_t unit, aux_adc_t which){
)));
//convert to voltage and return
- return float(3.3*ad7922_regs.result/4095);
+ return 3.3*ad7922_regs.result/4095;
}
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp
index 6a25a8870..145353c1d 100644
--- a/host/lib/usrp/usrp2/mboard_impl.cpp
+++ b/host/lib/usrp/usrp2/mboard_impl.cpp
@@ -138,7 +138,7 @@ usrp2_mboard_impl::usrp2_mboard_impl(
);
}
else {
- _mimo_clocking_mode_is_master = bool(_iface->peek32(_iface->regs.status) & (1 << 8));
+ _mimo_clocking_mode_is_master = (_iface->peek32(_iface->regs.status) & (1 << 8)) != 0;
}
std::cout << boost::format("mboard%d MIMO %s") % _index %
(_mimo_clocking_mode_is_master?"master":"slave") << std::endl;
diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp
index 3c937327b..4c85db168 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.hpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.hpp
@@ -132,8 +132,8 @@ private:
wax_obj_proxy::sptr _rx_codec_proxy;
wax_obj_proxy::sptr _tx_codec_proxy;
- void rx_codec_set_gain(float, const std::string &);
- uhd::dict<std::string, float> _codec_rx_gains;
+ void rx_codec_set_gain(double, const std::string &);
+ uhd::dict<std::string, double> _codec_rx_gains;
//properties interface for rx dboard
void rx_dboard_get(const wax::obj &, wax::obj &);
diff --git a/host/lib/usrp/usrp_e100/codec_ctrl.cpp b/host/lib/usrp/usrp_e100/codec_ctrl.cpp
index 18d9daca0..062c035a4 100644
--- a/host/lib/usrp/usrp_e100/codec_ctrl.cpp
+++ b/host/lib/usrp/usrp_e100/codec_ctrl.cpp
@@ -31,7 +31,7 @@ using namespace uhd;
static const bool codec_debug = false;
-const gain_range_t usrp_e100_codec_ctrl::tx_pga_gain_range(-20, 0, float(0.1));
+const gain_range_t usrp_e100_codec_ctrl::tx_pga_gain_range(-20, 0, double(0.1));
const gain_range_t usrp_e100_codec_ctrl::rx_pga_gain_range(0, 20, 1);
/***********************************************************************
@@ -44,14 +44,14 @@ public:
~usrp_e100_codec_ctrl_impl(void);
//aux adc and dac control
- float read_aux_adc(aux_adc_t which);
- void write_aux_dac(aux_dac_t which, float volts);
+ double read_aux_adc(aux_adc_t which);
+ void write_aux_dac(aux_dac_t which, double volts);
//pga gain control
- void set_tx_pga_gain(float);
- float get_tx_pga_gain(void);
- void set_rx_pga_gain(float, char);
- float get_rx_pga_gain(char);
+ void set_tx_pga_gain(double);
+ double get_tx_pga_gain(void);
+ void set_rx_pga_gain(double, char);
+ double get_rx_pga_gain(char);
private:
usrp_e100_iface::sptr _iface;
@@ -135,19 +135,19 @@ usrp_e100_codec_ctrl_impl::~usrp_e100_codec_ctrl_impl(void){
**********************************************************************/
static const int mtpgw = 255; //maximum tx pga gain word
-void usrp_e100_codec_ctrl_impl::set_tx_pga_gain(float gain){
+void usrp_e100_codec_ctrl_impl::set_tx_pga_gain(double gain){
int gain_word = int(mtpgw*(gain - tx_pga_gain_range.start())/(tx_pga_gain_range.stop() - tx_pga_gain_range.start()));
_ad9862_regs.tx_pga_gain = std::clip(gain_word, 0, mtpgw);
this->send_reg(16);
}
-float usrp_e100_codec_ctrl_impl::get_tx_pga_gain(void){
+double usrp_e100_codec_ctrl_impl::get_tx_pga_gain(void){
return (_ad9862_regs.tx_pga_gain*(tx_pga_gain_range.stop() - tx_pga_gain_range.start())/mtpgw) + tx_pga_gain_range.start();
}
static const int mrpgw = 0x14; //maximum rx pga gain word
-void usrp_e100_codec_ctrl_impl::set_rx_pga_gain(float gain, char which){
+void usrp_e100_codec_ctrl_impl::set_rx_pga_gain(double gain, char which){
int gain_word = int(mrpgw*(gain - rx_pga_gain_range.start())/(rx_pga_gain_range.stop() - rx_pga_gain_range.start()));
gain_word = std::clip(gain_word, 0, mrpgw);
switch(which){
@@ -163,7 +163,7 @@ void usrp_e100_codec_ctrl_impl::set_rx_pga_gain(float gain, char which){
}
}
-float usrp_e100_codec_ctrl_impl::get_rx_pga_gain(char which){
+double usrp_e100_codec_ctrl_impl::get_rx_pga_gain(char which){
int gain_word;
switch(which){
case 'A': gain_word = _ad9862_regs.rx_pga_a; break;
@@ -176,11 +176,11 @@ float usrp_e100_codec_ctrl_impl::get_rx_pga_gain(char which){
/***********************************************************************
* Codec Control AUX ADC Methods
**********************************************************************/
-static float aux_adc_to_volts(boost::uint8_t high, boost::uint8_t low){
- return float((boost::uint16_t(high) << 2) | low)*3.3/0x3ff;
+static double aux_adc_to_volts(boost::uint8_t high, boost::uint8_t low){
+ return double((boost::uint16_t(high) << 2) | low)*3.3/0x3ff;
}
-float usrp_e100_codec_ctrl_impl::read_aux_adc(aux_adc_t which){
+double usrp_e100_codec_ctrl_impl::read_aux_adc(aux_adc_t which){
//check to see if the switch needs to be set
bool write_switch = false;
switch(which){
@@ -233,7 +233,7 @@ float usrp_e100_codec_ctrl_impl::read_aux_adc(aux_adc_t which){
/***********************************************************************
* Codec Control AUX DAC Methods
**********************************************************************/
-void usrp_e100_codec_ctrl_impl::write_aux_dac(aux_dac_t which, float volts){
+void usrp_e100_codec_ctrl_impl::write_aux_dac(aux_dac_t which, double volts){
//special case for aux dac d (aka sigma delta word)
if (which == AUX_DAC_D){
boost::uint16_t dac_word = std::clip(boost::math::iround(volts*0xfff/3.3), 0, 0xfff);
diff --git a/host/lib/usrp/usrp_e100/codec_ctrl.hpp b/host/lib/usrp/usrp_e100/codec_ctrl.hpp
index 74ce9bd9a..fa66ed983 100644
--- a/host/lib/usrp/usrp_e100/codec_ctrl.hpp
+++ b/host/lib/usrp/usrp_e100/codec_ctrl.hpp
@@ -57,7 +57,7 @@ public:
* \param which which of the 4 adcs
* \return a value in volts
*/
- virtual float read_aux_adc(aux_adc_t which) = 0;
+ virtual double read_aux_adc(aux_adc_t which) = 0;
//! aux dac identifier constants
enum aux_dac_t{
@@ -72,19 +72,19 @@ public:
* \param which which of the 4 dacs
* \param volts the level in in volts
*/
- virtual void write_aux_dac(aux_dac_t which, float volts) = 0;
+ virtual void write_aux_dac(aux_dac_t which, double volts) = 0;
//! Set the TX PGA gain
- virtual void set_tx_pga_gain(float gain) = 0;
+ virtual void set_tx_pga_gain(double gain) = 0;
//! Get the TX PGA gain
- virtual float get_tx_pga_gain(void) = 0;
+ virtual double get_tx_pga_gain(void) = 0;
//! Set the RX PGA gain ('A' or 'B')
- virtual void set_rx_pga_gain(float gain, char which) = 0;
+ virtual void set_rx_pga_gain(double gain, char which) = 0;
//! Get the RX PGA gain ('A' or 'B')
- virtual float get_rx_pga_gain(char which) = 0;
+ virtual double get_rx_pga_gain(char which) = 0;
};
#endif /* INCLUDED_USRP_E100_CODEC_CTRL_HPP */
diff --git a/host/lib/usrp/usrp_e100/codec_impl.cpp b/host/lib/usrp/usrp_e100/codec_impl.cpp
index 6fd44bad3..dde77236c 100644
--- a/host/lib/usrp/usrp_e100/codec_impl.cpp
+++ b/host/lib/usrp/usrp_e100/codec_impl.cpp
@@ -86,12 +86,12 @@ void usrp_e100_impl::rx_codec_set(const wax::obj &key_, const wax::obj &val){
switch(key.as<codec_prop_t>()){
case CODEC_PROP_GAIN_I:
UHD_ASSERT_THROW(key.name == ad9862_pga_gain_name);
- _codec_ctrl->set_rx_pga_gain(val.as<float>(), 'A');
+ _codec_ctrl->set_rx_pga_gain(val.as<double>(), 'A');
return;
case CODEC_PROP_GAIN_Q:
UHD_ASSERT_THROW(key.name == ad9862_pga_gain_name);
- _codec_ctrl->set_rx_pga_gain(val.as<float>(), 'B');
+ _codec_ctrl->set_rx_pga_gain(val.as<double>(), 'B');
return;
default: UHD_THROW_PROP_SET_ERROR();
@@ -141,7 +141,7 @@ void usrp_e100_impl::tx_codec_set(const wax::obj &key_, const wax::obj &val){
case CODEC_PROP_GAIN_I: //only one gain for I and Q
case CODEC_PROP_GAIN_Q:
UHD_ASSERT_THROW(key.name == ad9862_pga_gain_name);
- _codec_ctrl->set_tx_pga_gain(val.as<float>());
+ _codec_ctrl->set_tx_pga_gain(val.as<double>());
return;
default: UHD_THROW_PROP_SET_ERROR();
diff --git a/host/lib/usrp/usrp_e100/dboard_iface.cpp b/host/lib/usrp/usrp_e100/dboard_iface.cpp
index a5032f86f..6969ac718 100644
--- a/host/lib/usrp/usrp_e100/dboard_iface.cpp
+++ b/host/lib/usrp/usrp_e100/dboard_iface.cpp
@@ -60,8 +60,8 @@ public:
return props;
}
- void write_aux_dac(unit_t, aux_dac_t, float);
- float read_aux_adc(unit_t, aux_adc_t);
+ void write_aux_dac(unit_t, aux_dac_t, double);
+ double read_aux_adc(unit_t, aux_adc_t);
void _set_pin_ctrl(unit_t, boost::uint16_t);
void _set_atr_reg(unit_t, atr_reg_t, boost::uint16_t);
@@ -270,7 +270,7 @@ byte_vector_t usrp_e100_dboard_iface::read_i2c(boost::uint8_t addr, size_t num_b
/***********************************************************************
* Aux DAX/ADC
**********************************************************************/
-void usrp_e100_dboard_iface::write_aux_dac(dboard_iface::unit_t, aux_dac_t which, float value){
+void usrp_e100_dboard_iface::write_aux_dac(dboard_iface::unit_t, aux_dac_t which, double value){
//same aux dacs for each unit
static const uhd::dict<aux_dac_t, usrp_e100_codec_ctrl::aux_dac_t> which_to_aux_dac = map_list_of
(AUX_DAC_A, usrp_e100_codec_ctrl::AUX_DAC_A)
@@ -281,7 +281,7 @@ void usrp_e100_dboard_iface::write_aux_dac(dboard_iface::unit_t, aux_dac_t which
_codec->write_aux_dac(which_to_aux_dac[which], value);
}
-float usrp_e100_dboard_iface::read_aux_adc(dboard_iface::unit_t unit, aux_adc_t which){
+double usrp_e100_dboard_iface::read_aux_adc(dboard_iface::unit_t unit, aux_adc_t which){
static const uhd::dict<
unit_t, uhd::dict<aux_adc_t, usrp_e100_codec_ctrl::aux_adc_t>
> unit_to_which_to_aux_adc = map_list_of