summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp1
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/usrp1
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/usrp1')
-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
4 files changed, 28 insertions, 28 deletions
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