aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp_e100/codec_ctrl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/usrp_e100/codec_ctrl.cpp')
-rw-r--r--host/lib/usrp/usrp_e100/codec_ctrl.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/host/lib/usrp/usrp_e100/codec_ctrl.cpp b/host/lib/usrp/usrp_e100/codec_ctrl.cpp
index b33c8ae65..50442546a 100644
--- a/host/lib/usrp/usrp_e100/codec_ctrl.cpp
+++ b/host/lib/usrp/usrp_e100/codec_ctrl.cpp
@@ -18,7 +18,7 @@
#include "codec_ctrl.hpp"
#include "ad9862_regs.hpp"
#include <uhd/types/dict.hpp>
-#include <uhd/utils/assert.hpp>
+#include <uhd/exception.hpp>
#include <uhd/utils/algorithm.hpp>
#include <boost/cstdint.hpp>
#include <boost/tuple/tuple.hpp>
@@ -137,7 +137,7 @@ static const int mtpgw = 255; //maximum tx pga gain word
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);
+ _ad9862_regs.tx_pga_gain = uhd::clip(gain_word, 0, mtpgw);
this->send_reg(16);
}
@@ -149,7 +149,7 @@ static const int mrpgw = 0x14; //maximum rx pga gain word
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);
+ gain_word = uhd::clip(gain_word, 0, mrpgw);
switch(which){
case 'A':
_ad9862_regs.rx_pga_a = gain_word;
@@ -227,7 +227,7 @@ double usrp_e100_codec_ctrl_impl::read_aux_adc(aux_adc_t which){
case AUX_ADC_B1: return aux_adc_to_volts(_ad9862_regs.aux_adc_b1_9_2, _ad9862_regs.aux_adc_b1_1_0);
case AUX_ADC_B2: return aux_adc_to_volts(_ad9862_regs.aux_adc_b2_9_2, _ad9862_regs.aux_adc_b2_1_0);
}
- UHD_ASSERT_THROW(false);
+ UHD_THROW_INVALID_CODE_PATH();
}
/***********************************************************************
@@ -236,7 +236,7 @@ double usrp_e100_codec_ctrl_impl::read_aux_adc(aux_adc_t which){
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);
+ boost::uint16_t dac_word = uhd::clip(boost::math::iround(volts*0xfff/3.3), 0, 0xfff);
_ad9862_regs.sig_delt_11_4 = boost::uint8_t(dac_word >> 4);
_ad9862_regs.sig_delt_3_0 = boost::uint8_t(dac_word & 0xf);
this->send_reg(42);
@@ -245,7 +245,7 @@ void usrp_e100_codec_ctrl_impl::write_aux_dac(aux_dac_t which, double volts){
}
//calculate the dac word for aux dac a, b, c
- boost::uint8_t dac_word = std::clip(boost::math::iround(volts*0xff/3.3), 0, 0xff);
+ boost::uint8_t dac_word = uhd::clip(boost::math::iround(volts*0xff/3.3), 0, 0xff);
//setup a lookup table for the aux dac params (reg ref, reg addr)
typedef boost::tuple<boost::uint8_t*, boost::uint8_t> dac_params_t;
@@ -269,20 +269,20 @@ void usrp_e100_codec_ctrl_impl::write_aux_dac(aux_dac_t which, double volts){
void usrp_e100_codec_ctrl_impl::send_reg(boost::uint8_t addr){
boost::uint32_t reg = _ad9862_regs.get_write_reg(addr);
if (codec_debug) std::cout << "codec control write reg: " << std::hex << reg << std::endl;
- _iface->transact_spi(
+ _iface->write_spi(
UE_SPI_SS_AD9862,
spi_config_t::EDGE_RISE,
- reg, 16, false /*no rb*/
+ reg, 16
);
}
void usrp_e100_codec_ctrl_impl::recv_reg(boost::uint8_t addr){
boost::uint32_t reg = _ad9862_regs.get_read_reg(addr);
if (codec_debug) std::cout << "codec control read reg: " << std::hex << reg << std::endl;
- boost::uint32_t ret = _iface->transact_spi(
+ boost::uint32_t ret = _iface->read_spi(
UE_SPI_SS_AD9862,
spi_config_t::EDGE_RISE,
- reg, 16, true /*rb*/
+ reg, 16
);
if (codec_debug) std::cout << "codec control read ret: " << std::hex << ret << std::endl;
_ad9862_regs.set_reg(addr, boost::uint16_t(ret));