diff options
Diffstat (limited to 'host/lib/usrp/dboard')
-rw-r--r-- | host/lib/usrp/dboard/db_basic_and_lf.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_dbsrx.cpp | 18 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_dbsrx2.cpp | 14 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_rfx.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_tvrx.cpp | 8 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_unknown.cpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_wbx.cpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_xcvr2450.cpp | 16 |
8 files changed, 35 insertions, 35 deletions
diff --git a/host/lib/usrp/dboard/db_basic_and_lf.cpp b/host/lib/usrp/dboard/db_basic_and_lf.cpp index b319289db..3fffeab0c 100644 --- a/host/lib/usrp/dboard/db_basic_and_lf.cpp +++ b/host/lib/usrp/dboard/db_basic_and_lf.cpp @@ -18,7 +18,7 @@ #include <uhd/usrp/subdev_props.hpp> #include <uhd/types/dict.hpp> #include <uhd/types/ranges.hpp> -#include <uhd/utils/assert.hpp> +#include <uhd/utils/assert_has.hpp> #include <uhd/utils/static.hpp> #include <uhd/utils/warning.hpp> #include <uhd/usrp/dboard_base.hpp> @@ -193,7 +193,7 @@ void basic_rx::rx_set(const wax::obj &key_, const wax::obj &val){ case SUBDEV_PROP_ANTENNA: if (val.as<std::string>().empty()) return; - throw std::runtime_error("no selectable antennas on this board"); + throw uhd::value_error("no selectable antennas on this board"); case SUBDEV_PROP_FREQ: return; // it wont do you much good, but you can set it @@ -300,7 +300,7 @@ void basic_tx::tx_set(const wax::obj &key_, const wax::obj &val){ case SUBDEV_PROP_ANTENNA: if (val.as<std::string>().empty()) return; - throw std::runtime_error("no selectable antennas on this board"); + throw uhd::value_error("no selectable antennas on this board"); case SUBDEV_PROP_FREQ: return; // it wont do you much good, but you can set it diff --git a/host/lib/usrp/dboard/db_dbsrx.cpp b/host/lib/usrp/dboard/db_dbsrx.cpp index 98d9479fc..b984608ca 100644 --- a/host/lib/usrp/dboard/db_dbsrx.cpp +++ b/host/lib/usrp/dboard/db_dbsrx.cpp @@ -21,7 +21,7 @@ #include "max2118_regs.hpp" #include <uhd/utils/static.hpp> -#include <uhd/utils/assert.hpp> +#include <uhd/utils/assert_has.hpp> #include <uhd/utils/algorithm.hpp> #include <uhd/utils/warning.hpp> #include <uhd/types/ranges.hpp> @@ -83,8 +83,8 @@ private: 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)); - stop_reg = boost::uint8_t(std::clip(int(stop_reg), 0x0, 0x5)); + start_reg = boost::uint8_t(uhd::clip(int(start_reg), 0x0, 0x5)); + stop_reg = boost::uint8_t(uhd::clip(int(stop_reg), 0x0, 0x5)); for(boost::uint8_t start_addr=start_reg; start_addr <= stop_reg; start_addr += sizeof(boost::uint32_t) - 1){ int num_bytes = int(stop_reg - start_addr + 1) > int(sizeof(boost::uint32_t)) - 1 ? sizeof(boost::uint32_t) - 1 : stop_reg - start_addr + 1; @@ -112,8 +112,8 @@ private: void read_reg(boost::uint8_t start_reg, boost::uint8_t stop_reg){ static const boost::uint8_t status_addr = 0x0; - start_reg = boost::uint8_t(std::clip(int(start_reg), 0x0, 0x1)); - stop_reg = boost::uint8_t(std::clip(int(stop_reg), 0x0, 0x1)); + start_reg = boost::uint8_t(uhd::clip(int(start_reg), 0x0, 0x1)); + stop_reg = boost::uint8_t(uhd::clip(int(stop_reg), 0x0, 0x1)); for(boost::uint8_t start_addr=start_reg; start_addr <= stop_reg; start_addr += sizeof(boost::uint32_t)){ int num_bytes = int(stop_reg - start_addr + 1) > int(sizeof(boost::uint32_t)) ? sizeof(boost::uint32_t) : stop_reg - start_addr + 1; @@ -237,8 +237,8 @@ void dbsrx::set_lo_freq(double target_freq){ bool update_filter_settings = false; //choose refclock std::vector<double> clock_rates = this->get_iface()->get_clock_rates(dboard_iface::UNIT_RX); - const double max_clock_rate = std::sorted(clock_rates).back(); - BOOST_FOREACH(ref_clock, std::reversed(std::sorted(clock_rates))){ + const double max_clock_rate = uhd::sorted(clock_rates).back(); + BOOST_FOREACH(ref_clock, uhd::reversed(uhd::sorted(clock_rates))){ if (ref_clock > 27.0e6) continue; if (size_t(max_clock_rate/ref_clock)%2 == 1) continue; //reject asymmetric clocks (odd divisors) @@ -485,14 +485,14 @@ void dbsrx::set_gain(double gain, const std::string &name){ **********************************************************************/ void dbsrx::set_bandwidth(double bandwidth){ //clip the input - bandwidth = std::clip<double>(bandwidth, 4e6, 33e6); + bandwidth = uhd::clip<double>(bandwidth, 4e6, 33e6); double ref_clock = this->get_iface()->get_clock_rate(dboard_iface::UNIT_RX); //NOTE: _max2118_write_regs.m_divider set in set_lo_freq //compute f_dac setting - _max2118_write_regs.f_dac = std::clip<int>(int((((bandwidth*_max2118_write_regs.m_divider)/ref_clock) - 4)/0.145),0,127); + _max2118_write_regs.f_dac = uhd::clip<int>(int((((bandwidth*_max2118_write_regs.m_divider)/ref_clock) - 4)/0.145),0,127); //determine actual bandwidth _bandwidth = double((ref_clock/(_max2118_write_regs.m_divider))*(4+0.145*_max2118_write_regs.f_dac)); diff --git a/host/lib/usrp/dboard/db_dbsrx2.cpp b/host/lib/usrp/dboard/db_dbsrx2.cpp index f4b797995..e7b42cb05 100644 --- a/host/lib/usrp/dboard/db_dbsrx2.cpp +++ b/host/lib/usrp/dboard/db_dbsrx2.cpp @@ -19,7 +19,7 @@ #include "max2112_regs.hpp" #include <uhd/utils/static.hpp> -#include <uhd/utils/assert.hpp> +#include <uhd/utils/assert_has.hpp> #include <uhd/utils/algorithm.hpp> #include <uhd/types/ranges.hpp> #include <uhd/types/sensors.hpp> @@ -79,8 +79,8 @@ private: 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, 0xB)); - stop_reg = boost::uint8_t(std::clip(int(stop_reg), 0x0, 0xB)); + start_reg = boost::uint8_t(uhd::clip(int(start_reg), 0x0, 0xB)); + stop_reg = boost::uint8_t(uhd::clip(int(stop_reg), 0x0, 0xB)); for(boost::uint8_t start_addr=start_reg; start_addr <= stop_reg; start_addr += sizeof(boost::uint32_t) - 1){ int num_bytes = int(stop_reg - start_addr + 1) > int(sizeof(boost::uint32_t)) - 1 ? sizeof(boost::uint32_t) - 1 : stop_reg - start_addr + 1; @@ -108,8 +108,8 @@ private: void read_reg(boost::uint8_t start_reg, boost::uint8_t stop_reg){ static const boost::uint8_t status_addr = 0xC; - start_reg = boost::uint8_t(std::clip(int(start_reg), 0x0, 0xD)); - stop_reg = boost::uint8_t(std::clip(int(stop_reg), 0x0, 0xD)); + start_reg = boost::uint8_t(uhd::clip(int(start_reg), 0x0, 0xD)); + stop_reg = boost::uint8_t(uhd::clip(int(stop_reg), 0x0, 0xD)); for(boost::uint8_t start_addr=start_reg; start_addr <= stop_reg; start_addr += sizeof(boost::uint32_t)){ int num_bytes = int(stop_reg - start_addr + 1) > int(sizeof(boost::uint32_t)) ? sizeof(boost::uint32_t) : stop_reg - start_addr + 1; @@ -216,7 +216,7 @@ dbsrx2::~dbsrx2(void){ * Tuning **********************************************************************/ void dbsrx2::set_lo_freq(double target_freq){ - //target_freq = std::clip(target_freq, dbsrx2_freq_range.min, dbsrx2_freq_range.max); + //target_freq = uhd::clip(target_freq, dbsrx2_freq_range.min, dbsrx2_freq_range.max); //variables used in the calculation below int scaler = target_freq > 1125e6 ? 2 : 4; @@ -330,7 +330,7 @@ void dbsrx2::set_gain(double gain, const std::string &name){ **********************************************************************/ void dbsrx2::set_bandwidth(double bandwidth){ //clip the input - bandwidth = std::clip<double>(bandwidth, 4e6, 40e6); + bandwidth = uhd::clip<double>(bandwidth, 4e6, 40e6); _max2112_write_regs.lp = int((bandwidth/1e6 - 4)/0.29 + 12); _bandwidth = double(4 + (_max2112_write_regs.lp - 12) * 0.29)*1e6; diff --git a/host/lib/usrp/dboard/db_rfx.cpp b/host/lib/usrp/dboard/db_rfx.cpp index 3e3cf00f2..4d8222a52 100644 --- a/host/lib/usrp/dboard/db_rfx.cpp +++ b/host/lib/usrp/dboard/db_rfx.cpp @@ -37,7 +37,7 @@ #include <uhd/usrp/subdev_props.hpp> #include <uhd/types/ranges.hpp> #include <uhd/types/sensors.hpp> -#include <uhd/utils/assert.hpp> +#include <uhd/utils/assert_has.hpp> #include <uhd/utils/static.hpp> #include <uhd/utils/algorithm.hpp> #include <uhd/utils/warning.hpp> @@ -245,7 +245,7 @@ static double rx_pga0_gain_to_dac_volts(double &gain, double range){ static const double slope = (max_volts-min_volts)/(range); //calculate the voltage for the aux dac - double dac_volts = std::clip<double>(gain*slope + min_volts, max_volts, min_volts); + double dac_volts = uhd::clip<double>(gain*slope + min_volts, max_volts, min_volts); //the actual gain setting gain = (dac_volts - min_volts)/slope; diff --git a/host/lib/usrp/dboard/db_tvrx.cpp b/host/lib/usrp/dboard/db_tvrx.cpp index 578999432..dc38ef45e 100644 --- a/host/lib/usrp/dboard/db_tvrx.cpp +++ b/host/lib/usrp/dboard/db_tvrx.cpp @@ -28,7 +28,7 @@ //gain range: [0:1dB:115dB] #include <uhd/utils/static.hpp> -#include <uhd/utils/assert.hpp> +#include <uhd/utils/assert_has.hpp> #include <uhd/utils/algorithm.hpp> #include <uhd/utils/warning.hpp> #include <uhd/types/ranges.hpp> @@ -241,7 +241,7 @@ static std::string get_band(double freq) { static double gain_interp(double gain, boost::array<double, 17> db_vector, boost::array<double, 17> volts_vector) { double volts; - gain = std::clip<double>(gain, db_vector.front(), db_vector.back()); //let's not get carried away here + gain = uhd::clip<double>(gain, db_vector.front(), db_vector.back()); //let's not get carried away here boost::uint8_t gain_step = 0; //find which bin we're in @@ -288,7 +288,7 @@ static double rf_gain_to_voltage(double gain, double lo_freq){ //this is the voltage at the USRP DAC output double dac_volts = gain_volts / opamp_gain; - dac_volts = std::clip<double>(dac_volts, 0.0, 3.3); + dac_volts = uhd::clip<double>(dac_volts, 0.0, 3.3); if (tvrx_debug) std::cerr << boost::format( "tvrx RF AGC gain: %f dB, dac_volts: %f V" @@ -311,7 +311,7 @@ static double if_gain_to_voltage(double gain){ double gain_volts = gain_interp(gain, tvrx_if_gains_db, tvrx_gains_volts); double dac_volts = gain_volts / opamp_gain; - dac_volts = std::clip<double>(dac_volts, 0.0, 3.3); + dac_volts = uhd::clip<double>(dac_volts, 0.0, 3.3); if (tvrx_debug) std::cerr << boost::format( "tvrx IF AGC gain: %f dB, dac_volts: %f V" diff --git a/host/lib/usrp/dboard/db_unknown.cpp b/host/lib/usrp/dboard/db_unknown.cpp index f0a4c000e..cef4bee4a 100644 --- a/host/lib/usrp/dboard/db_unknown.cpp +++ b/host/lib/usrp/dboard/db_unknown.cpp @@ -17,7 +17,7 @@ #include <uhd/usrp/subdev_props.hpp> #include <uhd/types/ranges.hpp> -#include <uhd/utils/assert.hpp> +#include <uhd/utils/assert_has.hpp> #include <uhd/utils/static.hpp> #include <uhd/utils/warning.hpp> #include <uhd/usrp/dboard_base.hpp> diff --git a/host/lib/usrp/dboard/db_wbx.cpp b/host/lib/usrp/dboard/db_wbx.cpp index 0bc2d0ca1..2e9a1edc8 100644 --- a/host/lib/usrp/dboard/db_wbx.cpp +++ b/host/lib/usrp/dboard/db_wbx.cpp @@ -69,7 +69,7 @@ #include <uhd/usrp/subdev_props.hpp> #include <uhd/types/ranges.hpp> #include <uhd/types/sensors.hpp> -#include <uhd/utils/assert.hpp> +#include <uhd/utils/assert_has.hpp> #include <uhd/utils/static.hpp> #include <uhd/utils/algorithm.hpp> #include <uhd/utils/warning.hpp> diff --git a/host/lib/usrp/dboard/db_xcvr2450.cpp b/host/lib/usrp/dboard/db_xcvr2450.cpp index f4f74eb86..9d25b30a5 100644 --- a/host/lib/usrp/dboard/db_xcvr2450.cpp +++ b/host/lib/usrp/dboard/db_xcvr2450.cpp @@ -49,7 +49,7 @@ #include "max2829_regs.hpp" #include <uhd/utils/static.hpp> -#include <uhd/utils/assert.hpp> +#include <uhd/utils/assert_has.hpp> #include <uhd/utils/algorithm.hpp> #include <uhd/utils/warning.hpp> #include <uhd/types/ranges.hpp> @@ -358,7 +358,7 @@ void xcvr2450::set_rx_ant(const std::string &ant){ */ 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); + int reg = uhd::clip(boost::math::iround(gain*60/30.0) + 3, 0, 63); //calculate the actual gain value if (reg < 4) gain = 0; @@ -376,7 +376,7 @@ static int gain_to_tx_vga_reg(double &gain){ * \return gain enum value */ 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); + int reg = uhd::clip(boost::math::iround(gain*3/5.0), 0, 3); switch(reg){ case 0: gain = 0; @@ -401,7 +401,7 @@ static max2829_regs_t::tx_baseband_gain_t gain_to_tx_bb_reg(double &gain){ * \return 5 bit the register value */ static int gain_to_rx_vga_reg(double &gain){ - int reg = std::clip(boost::math::iround(gain/2.0), 0, 31); + int reg = uhd::clip(boost::math::iround(gain/2.0), 0, 31); gain = double(reg*2); return reg; } @@ -413,7 +413,7 @@ static int gain_to_rx_vga_reg(double &gain){ * \return 2 bit the register value */ static int gain_to_rx_lna_reg(double &gain){ - int reg = std::clip(boost::math::iround(gain*2/30.5) + 1, 0, 3); + int reg = uhd::clip(boost::math::iround(gain*2/30.5) + 1, 0, 3); switch(reg){ case 0: case 1: gain = 0; break; @@ -456,7 +456,7 @@ void xcvr2450::set_rx_gain(double gain, const std::string &name){ * Bandwidth Handling **********************************************************************/ 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); + int reg = uhd::clip(boost::math::iround((bandwidth-6.0e6)/6.0e6), 1, 3); switch(reg){ case 1: // bandwidth < 15MHz @@ -473,7 +473,7 @@ static max2829_regs_t::tx_lpf_coarse_adj_t bandwidth_to_tx_lpf_coarse_reg(double } 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); + int reg = uhd::clip(boost::math::iround((requested_bandwidth/bandwidth)/0.05), 18, 22); switch(reg){ case 18: // requested_bandwidth < 92.5% @@ -496,7 +496,7 @@ static max2829_regs_t::rx_lpf_fine_adj_t bandwidth_to_rx_lpf_fine_reg(double &ba } 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); + int reg = uhd::clip(boost::math::iround((bandwidth-7.0e6)/1.0e6), 0, 11); switch(reg){ case 0: // bandwidth < 7.5MHz |