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.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/host/lib/usrp/usrp_e100/codec_ctrl.cpp b/host/lib/usrp/usrp_e100/codec_ctrl.cpp
index a728d7e46..e7fd9792e 100644
--- a/host/lib/usrp/usrp_e100/codec_ctrl.cpp
+++ b/host/lib/usrp/usrp_e100/codec_ctrl.cpp
@@ -23,7 +23,7 @@
#include <boost/cstdint.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/math/special_functions/round.hpp>
-#include "usrp_e_regs.hpp" //spi slave constants
+#include "usrp_e100_regs.hpp" //spi slave constants
#include <boost/assign/list_of.hpp>
#include <iostream>
@@ -31,17 +31,17 @@ using namespace uhd;
static const bool codec_debug = false;
-const gain_range_t usrp_e_codec_ctrl::tx_pga_gain_range(-20, 0, float(0.1));
-const gain_range_t usrp_e_codec_ctrl::rx_pga_gain_range(0, 20, 1);
+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::rx_pga_gain_range(0, 20, 1);
/***********************************************************************
* Codec Control Implementation
**********************************************************************/
-class usrp_e_codec_ctrl_impl : public usrp_e_codec_ctrl{
+class usrp_e100_codec_ctrl_impl : public usrp_e100_codec_ctrl{
public:
//structors
- usrp_e_codec_ctrl_impl(usrp_e_iface::sptr iface);
- ~usrp_e_codec_ctrl_impl(void);
+ usrp_e100_codec_ctrl_impl(usrp_e100_iface::sptr iface);
+ ~usrp_e100_codec_ctrl_impl(void);
//aux adc and dac control
float read_aux_adc(aux_adc_t which);
@@ -54,7 +54,7 @@ public:
float get_rx_pga_gain(char);
private:
- usrp_e_iface::sptr _iface;
+ usrp_e100_iface::sptr _iface;
ad9862_regs_t _ad9862_regs;
aux_adc_t _last_aux_adc_a, _last_aux_adc_b;
void send_reg(boost::uint8_t addr);
@@ -64,7 +64,7 @@ private:
/***********************************************************************
* Codec Control Structors
**********************************************************************/
-usrp_e_codec_ctrl_impl::usrp_e_codec_ctrl_impl(usrp_e_iface::sptr iface){
+usrp_e100_codec_ctrl_impl::usrp_e100_codec_ctrl_impl(usrp_e100_iface::sptr iface){
_iface = iface;
//soft reset
@@ -115,7 +115,7 @@ usrp_e_codec_ctrl_impl::usrp_e_codec_ctrl_impl(usrp_e_iface::sptr iface){
this->send_reg(34);
}
-usrp_e_codec_ctrl_impl::~usrp_e_codec_ctrl_impl(void){
+usrp_e100_codec_ctrl_impl::~usrp_e100_codec_ctrl_impl(void){
//set aux dacs to zero
this->write_aux_dac(AUX_DAC_A, 0);
this->write_aux_dac(AUX_DAC_B, 0);
@@ -135,19 +135,19 @@ usrp_e_codec_ctrl_impl::~usrp_e_codec_ctrl_impl(void){
**********************************************************************/
static const int mtpgw = 255; //maximum tx pga gain word
-void usrp_e_codec_ctrl_impl::set_tx_pga_gain(float gain){
+void usrp_e100_codec_ctrl_impl::set_tx_pga_gain(float gain){
int gain_word = int(mtpgw*(gain - tx_pga_gain_range.min)/(tx_pga_gain_range.max - tx_pga_gain_range.min));
_ad9862_regs.tx_pga_gain = std::clip(gain_word, 0, mtpgw);
this->send_reg(16);
}
-float usrp_e_codec_ctrl_impl::get_tx_pga_gain(void){
+float usrp_e100_codec_ctrl_impl::get_tx_pga_gain(void){
return (_ad9862_regs.tx_pga_gain*(tx_pga_gain_range.max - tx_pga_gain_range.min)/mtpgw) + tx_pga_gain_range.min;
}
static const int mrpgw = 0x14; //maximum rx pga gain word
-void usrp_e_codec_ctrl_impl::set_rx_pga_gain(float gain, char which){
+void usrp_e100_codec_ctrl_impl::set_rx_pga_gain(float gain, char which){
int gain_word = int(mrpgw*(gain - rx_pga_gain_range.min)/(rx_pga_gain_range.max - rx_pga_gain_range.min));
gain_word = std::clip(gain_word, 0, mrpgw);
switch(which){
@@ -163,7 +163,7 @@ void usrp_e_codec_ctrl_impl::set_rx_pga_gain(float gain, char which){
}
}
-float usrp_e_codec_ctrl_impl::get_rx_pga_gain(char which){
+float 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;
@@ -180,7 +180,7 @@ 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;
}
-float usrp_e_codec_ctrl_impl::read_aux_adc(aux_adc_t which){
+float 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_e_codec_ctrl_impl::read_aux_adc(aux_adc_t which){
/***********************************************************************
* Codec Control AUX DAC Methods
**********************************************************************/
-void usrp_e_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, float 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);
@@ -266,7 +266,7 @@ void usrp_e_codec_ctrl_impl::write_aux_dac(aux_dac_t which, float volts){
/***********************************************************************
* Codec Control SPI Methods
**********************************************************************/
-void usrp_e_codec_ctrl_impl::send_reg(boost::uint8_t addr){
+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(
@@ -276,7 +276,7 @@ void usrp_e_codec_ctrl_impl::send_reg(boost::uint8_t addr){
);
}
-void usrp_e_codec_ctrl_impl::recv_reg(boost::uint8_t addr){
+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(
@@ -291,6 +291,6 @@ void usrp_e_codec_ctrl_impl::recv_reg(boost::uint8_t addr){
/***********************************************************************
* Codec Control Make
**********************************************************************/
-usrp_e_codec_ctrl::sptr usrp_e_codec_ctrl::make(usrp_e_iface::sptr iface){
- return sptr(new usrp_e_codec_ctrl_impl(iface));
+usrp_e100_codec_ctrl::sptr usrp_e100_codec_ctrl::make(usrp_e100_iface::sptr iface){
+ return sptr(new usrp_e100_codec_ctrl_impl(iface));
}