From 24517fa9226a0da8ca297476ea159b230a06ff56 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 10 Nov 2010 19:41:40 -0800 Subject: dbsrx2: updated code for ranges use --- host/lib/usrp/dboard/db_dbsrx2.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'host/lib/usrp/dboard/db_dbsrx2.cpp') diff --git a/host/lib/usrp/dboard/db_dbsrx2.cpp b/host/lib/usrp/dboard/db_dbsrx2.cpp index 5a65e6123..bf5528688 100644 --- a/host/lib/usrp/dboard/db_dbsrx2.cpp +++ b/host/lib/usrp/dboard/db_dbsrx2.cpp @@ -195,15 +195,15 @@ dbsrx2::dbsrx2(ctor_args_t args) : rx_dboard_base(args){ //for (boost::uint8_t addr=0; addr<=12; addr++) this->send_reg(addr, addr); //set defaults for LO, gains - set_lo_freq(dbsrx2_freq_range.min); + set_lo_freq(dbsrx2_freq_range.start()); BOOST_FOREACH(const std::string &name, dbsrx2_gain_ranges.keys()){ - set_gain(dbsrx2_gain_ranges[name].min, name); + set_gain(dbsrx2_gain_ranges[name].start(), name); } set_bandwidth(40e6); // default bandwidth from datasheet get_locked(); - _max2112_write_regs.bbg = boost::math::iround(std::clip(0, dbsrx2_gain_ranges["BBG"].min, dbsrx2_gain_ranges["BBG"].max)); + _max2112_write_regs.bbg = dbsrx2_gain_ranges["BBG"].start(); send_reg(0x9, 0x9); } @@ -270,7 +270,7 @@ void dbsrx2::set_lo_freq(double target_freq){ * \return 4 bit the register value */ static int gain_to_bbg_vga_reg(float &gain){ - int reg = boost::math::iround(std::clip(gain, dbsrx2_gain_ranges["BBG"].min, dbsrx2_gain_ranges["BBG"].max)); + int reg = boost::math::iround(dbsrx2_gain_ranges["BBG"].clip(gain)); gain = float(reg); @@ -290,11 +290,11 @@ static int gain_to_bbg_vga_reg(float &gain){ */ static float gain_to_gc1_rfvga_dac(float &gain){ //clip the input - gain = std::clip(gain, dbsrx2_gain_ranges["GC1"].min, dbsrx2_gain_ranges["GC1"].max); + 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"].max; + static const float slope = (max_volts-min_volts)/dbsrx2_gain_ranges["GC1"].stop(); //calculate the voltage for the aux dac float dac_volts = gain*slope + min_volts; -- cgit v1.2.3 From b08ac6273fa6dd1e757ecaeb0b316592696099f7 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 11 Nov 2010 19:13:22 -0800 Subject: uhd: removed windows warnings, added string formatting in usrp-n --- host/lib/usrp/dboard/db_dbsrx2.cpp | 2 +- host/lib/usrp/dboard/db_rfx.cpp | 2 +- host/lib/usrp/usrp2/codec_impl.cpp | 14 +++++++------- host/lib/usrp/usrp2/dboard_impl.cpp | 4 ++-- host/lib/usrp/usrp2/dsp_impl.cpp | 4 ++-- host/lib/usrp/usrp2/usrp2_iface.cpp | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) (limited to 'host/lib/usrp/dboard/db_dbsrx2.cpp') diff --git a/host/lib/usrp/dboard/db_dbsrx2.cpp b/host/lib/usrp/dboard/db_dbsrx2.cpp index bf5528688..cdafd6a78 100644 --- a/host/lib/usrp/dboard/db_dbsrx2.cpp +++ b/host/lib/usrp/dboard/db_dbsrx2.cpp @@ -203,7 +203,7 @@ dbsrx2::dbsrx2(ctor_args_t args) : rx_dboard_base(args){ set_bandwidth(40e6); // default bandwidth from datasheet get_locked(); - _max2112_write_regs.bbg = dbsrx2_gain_ranges["BBG"].start(); + _max2112_write_regs.bbg = boost::math::iround(dbsrx2_gain_ranges["BBG"].start()); send_reg(0x9, 0x9); } diff --git a/host/lib/usrp/dboard/db_rfx.cpp b/host/lib/usrp/dboard/db_rfx.cpp index 4e73fb3a3..74a9fb37b 100644 --- a/host/lib/usrp/dboard/db_rfx.cpp +++ b/host/lib/usrp/dboard/db_rfx.cpp @@ -171,7 +171,7 @@ rfx_xcvr::rfx_xcvr( ): xcvr_dboard_base(args), _freq_range(freq_range), - _rx_gain_ranges((this->get_rx_id() == 0x0024)? + _rx_gain_ranges((get_rx_id() == 0x0024)? rfx400_rx_gain_ranges : rfx_rx_gain_ranges ), _div2(map_list_of diff --git a/host/lib/usrp/usrp2/codec_impl.cpp b/host/lib/usrp/usrp2/codec_impl.cpp index 998d55297..e417bc340 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 codec_rx_gain_ranges = map_list_of - ("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)); + ("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))); /*********************************************************************** @@ -62,16 +62,16 @@ void usrp2_mboard_impl::rx_codec_get(const wax::obj &key_, wax::obj &val){ switch(_iface->get_rev()){ case usrp2_iface::USRP_N200: case usrp2_iface::USRP_N210: - val = std::string(_iface->get_cname() + " adc - ads62p44"); + val = _iface->get_cname() + " adc - ads62p44"; break; case usrp2_iface::USRP2_REV3: case usrp2_iface::USRP2_REV4: - val = std::string(_iface->get_cname() + " adc - ltc2284"); + val = _iface->get_cname() + " adc - ltc2284"; break; case usrp2_iface::USRP_NXXX: - val = std::string(_iface->get_cname() + " adc - ??????"); + val = _iface->get_cname() + " adc - ??????"; break; } return; @@ -153,7 +153,7 @@ void usrp2_mboard_impl::tx_codec_get(const wax::obj &key_, wax::obj &val){ //handle the get request conditioned on the key switch(key.as()){ case CODEC_PROP_NAME: - val = std::string(_iface->get_cname() + " dac - ad9777"); + val = _iface->get_cname() + " dac - ad9777"; return; case CODEC_PROP_OTHERS: diff --git a/host/lib/usrp/usrp2/dboard_impl.cpp b/host/lib/usrp/usrp2/dboard_impl.cpp index f839a4058..4192c4f78 100644 --- a/host/lib/usrp/usrp2/dboard_impl.cpp +++ b/host/lib/usrp/usrp2/dboard_impl.cpp @@ -64,7 +64,7 @@ void usrp2_mboard_impl::rx_dboard_get(const wax::obj &key_, wax::obj &val){ //handle the get request conditioned on the key switch(key.as()){ case DBOARD_PROP_NAME: - val = std::string(_iface->get_cname() + " dboard (rx unit)"); + val = _iface->get_cname() + " dboard (rx unit)"; return; case DBOARD_PROP_SUBDEV: @@ -121,7 +121,7 @@ void usrp2_mboard_impl::tx_dboard_get(const wax::obj &key_, wax::obj &val){ //handle the get request conditioned on the key switch(key.as()){ case DBOARD_PROP_NAME: - val = std::string(_iface->get_cname() + " dboard (tx unit)"); + val = _iface->get_cname() + " dboard (tx unit)"; return; case DBOARD_PROP_SUBDEV: diff --git a/host/lib/usrp/usrp2/dsp_impl.cpp b/host/lib/usrp/usrp2/dsp_impl.cpp index 243a8e905..77ed594f5 100644 --- a/host/lib/usrp/usrp2/dsp_impl.cpp +++ b/host/lib/usrp/usrp2/dsp_impl.cpp @@ -61,7 +61,7 @@ void usrp2_mboard_impl::ddc_get(const wax::obj &key_, wax::obj &val){ switch(key.as()){ case DSP_PROP_NAME: - val = std::string(_iface->get_cname() + " ddc0"); + val = _iface->get_cname() + " ddc0"; return; case DSP_PROP_OTHERS: @@ -144,7 +144,7 @@ void usrp2_mboard_impl::duc_get(const wax::obj &key_, wax::obj &val){ switch(key.as()){ case DSP_PROP_NAME: - val = std::string(_iface->get_cname() + " duc0"); + val = _iface->get_cname() + " duc0"; return; case DSP_PROP_OTHERS: diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index 7208a47cf..2b32faffb 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -274,8 +274,8 @@ public: rev_type get_rev(void){ switch (boost::lexical_cast(mb_eeprom["rev"])){ - case 0x0003: return USRP2_REV3; - case 0x0004: return USRP2_REV4; + case 0x0300: return USRP2_REV3; + case 0x0400: return USRP2_REV4; case 0x0A00: return USRP_N200; case 0x0A01: return USRP_N210; } -- cgit v1.2.3