aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp1/codec_ctrl.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-08-15 18:49:06 -0700
committerJosh Blum <josh@joshknows.com>2010-08-15 18:49:06 -0700
commit5c0d3d30606b25c72c98785d49c13cc27ad49ec1 (patch)
tree3abc29f89c400fe03551c06b79ffc6973dbc78bb /host/lib/usrp/usrp1/codec_ctrl.cpp
parent2e978d8835b8f954b7c34c42138b64d3a5767f81 (diff)
downloaduhd-5c0d3d30606b25c72c98785d49c13cc27ad49ec1.tar.gz
uhd-5c0d3d30606b25c72c98785d49c13cc27ad49ec1.tar.bz2
uhd-5c0d3d30606b25c72c98785d49c13cc27ad49ec1.zip
usrp1: created daughterboard duality
everything that should have two is now stored into a dictionary of slot to type the set and get functions are now bound with a third argument for dboard slot the dboard iface has yet to be completed with the correct registers for a vs b
Diffstat (limited to 'host/lib/usrp/usrp1/codec_ctrl.cpp')
-rw-r--r--host/lib/usrp/usrp1/codec_ctrl.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/host/lib/usrp/usrp1/codec_ctrl.cpp b/host/lib/usrp/usrp1/codec_ctrl.cpp
index d0576a769..01617de94 100644
--- a/host/lib/usrp/usrp1/codec_ctrl.cpp
+++ b/host/lib/usrp/usrp1/codec_ctrl.cpp
@@ -17,8 +17,6 @@
#include "codec_ctrl.hpp"
#include "usrp_commands.h"
-#include "fpga_regs_standard.h"
-#include "usrp_spi_defs.h"
#include "ad9862_regs.hpp"
#include <uhd/types/dict.hpp>
#include <uhd/utils/assert.hpp>
@@ -45,7 +43,7 @@ const gain_range_t usrp1_codec_ctrl::rx_pga_gain_range(0, 20, 1);
class usrp1_codec_ctrl_impl : public usrp1_codec_ctrl {
public:
//structors
- usrp1_codec_ctrl_impl(usrp1_iface::sptr iface);
+ usrp1_codec_ctrl_impl(usrp1_iface::sptr iface, int spi_slave);
~usrp1_codec_ctrl_impl(void);
//aux adc and dac control
@@ -63,6 +61,7 @@ public:
private:
usrp1_iface::sptr _iface;
+ int _spi_slave;
ad9862_regs_t _ad9862_regs;
aux_adc_t _last_aux_adc_a, _last_aux_adc_b;
void send_reg(boost::uint8_t addr);
@@ -78,9 +77,10 @@ private:
/***********************************************************************
* Codec Control Structors
**********************************************************************/
-usrp1_codec_ctrl_impl::usrp1_codec_ctrl_impl(usrp1_iface::sptr iface)
+usrp1_codec_ctrl_impl::usrp1_codec_ctrl_impl(usrp1_iface::sptr iface, int spi_slave)
{
_iface = iface;
+ _spi_slave = spi_slave;
//soft reset
_ad9862_regs.soft_reset = 1;
@@ -295,7 +295,7 @@ void usrp1_codec_ctrl_impl::send_reg(boost::uint8_t addr)
std::cout << "codec control write reg: 0x";
std::cout << std::setw(8) << std::hex << reg << std::endl;
}
- _iface->transact_spi(SPI_ENABLE_CODEC_A,
+ _iface->transact_spi(_spi_slave,
spi_config_t::EDGE_RISE, reg, 16, false);
}
@@ -309,7 +309,7 @@ void usrp1_codec_ctrl_impl::recv_reg(boost::uint8_t addr)
std::cout << std::setw(8) << std::hex << reg << std::endl;
}
- boost::uint32_t ret = _iface->transact_spi(SPI_ENABLE_CODEC_A,
+ boost::uint32_t ret = _iface->transact_spi(_spi_slave,
spi_config_t::EDGE_RISE, reg, 16, true);
if (codec_debug) {
@@ -435,7 +435,7 @@ bool usrp1_codec_ctrl_impl::set_duc_freq(double freq)
/***********************************************************************
* Codec Control Make
**********************************************************************/
-usrp1_codec_ctrl::sptr usrp1_codec_ctrl::make(usrp1_iface::sptr iface)
+usrp1_codec_ctrl::sptr usrp1_codec_ctrl::make(usrp1_iface::sptr iface, int spi_slave)
{
- return sptr(new usrp1_codec_ctrl_impl(iface));
+ return sptr(new usrp1_codec_ctrl_impl(iface, spi_slave));
}