aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-06-16 00:35:55 +0000
committerJosh Blum <josh@joshknows.com>2010-06-16 00:35:55 +0000
commit2a2434d95e2eb10c629f33e7e67a6456bc4f6648 (patch)
tree4aa5acc9dbbbafbfcd4537d8f67a854da4781203 /host/lib/usrp/usrp2
parentb4b80f1f6e59fa02d508af860f1a572c9224b975 (diff)
parentca6417739de4e5344325e96887dcdbf8311e265b (diff)
downloaduhd-2a2434d95e2eb10c629f33e7e67a6456bc4f6648.tar.gz
uhd-2a2434d95e2eb10c629f33e7e67a6456bc4f6648.tar.bz2
uhd-2a2434d95e2eb10c629f33e7e67a6456bc4f6648.zip
Merge branch 'sched' of ettus.sourcerepo.com:ettus/uhdpriv into usrp_e
Diffstat (limited to 'host/lib/usrp/usrp2')
-rw-r--r--host/lib/usrp/usrp2/dboard_iface.cpp39
1 files changed, 25 insertions, 14 deletions
diff --git a/host/lib/usrp/usrp2/dboard_iface.cpp b/host/lib/usrp/usrp2/dboard_iface.cpp
index 9f7c7f9e6..114f83f41 100644
--- a/host/lib/usrp/usrp2/dboard_iface.cpp
+++ b/host/lib/usrp/usrp2/dboard_iface.cpp
@@ -25,7 +25,7 @@
#include <boost/asio.hpp> //htonl and ntohl
#include <boost/math/special_functions/round.hpp>
#include "ad7922_regs.hpp" //aux adc
-#include "ad5624_regs.hpp" //aux dac
+#include "ad5623_regs.hpp" //aux dac
using namespace uhd;
using namespace uhd::usrp;
@@ -72,7 +72,7 @@ private:
boost::uint32_t _ddr_shadow;
boost::uint32_t _gpio_shadow;
- uhd::dict<unit_t, ad5624_regs_t> _dac_regs;
+ uhd::dict<unit_t, ad5623_regs_t> _dac_regs;
void _write_aux_dac(unit_t);
};
@@ -99,12 +99,12 @@ usrp2_dboard_iface::usrp2_dboard_iface(
_gpio_shadow = 0;
//reset the aux dacs
- _dac_regs[UNIT_RX] = ad5624_regs_t();
- _dac_regs[UNIT_TX] = ad5624_regs_t();
+ _dac_regs[UNIT_RX] = ad5623_regs_t();
+ _dac_regs[UNIT_TX] = ad5623_regs_t();
BOOST_FOREACH(unit_t unit, _dac_regs.keys()){
_dac_regs[unit].data = 1;
- _dac_regs[unit].addr = ad5624_regs_t::ADDR_ALL;
- _dac_regs[unit].cmd = ad5624_regs_t::CMD_RESET;
+ _dac_regs[unit].addr = ad5623_regs_t::ADDR_ALL;
+ _dac_regs[unit].cmd = ad5623_regs_t::CMD_RESET;
this->_write_aux_dac(unit);
}
}
@@ -242,14 +242,25 @@ void usrp2_dboard_iface::_write_aux_dac(unit_t unit){
void usrp2_dboard_iface::write_aux_dac(unit_t unit, int which, float value){
_dac_regs[unit].data = boost::math::iround(4095*value/3.3);
- _dac_regs[unit].cmd = ad5624_regs_t::CMD_WR_UP_DAC_CHAN_N;
- switch(which){
- case 0: _dac_regs[unit].addr = ad5624_regs_t::ADDR_DAC_A; break;
- case 1: _dac_regs[unit].addr = ad5624_regs_t::ADDR_DAC_B; break;
- case 2: _dac_regs[unit].addr = ad5624_regs_t::ADDR_DAC_C; break;
- case 3: _dac_regs[unit].addr = ad5624_regs_t::ADDR_DAC_D; break;
- default: throw std::runtime_error("not a possible aux dac, must be 0, 1, 2, or 3");
- }
+ _dac_regs[unit].cmd = ad5623_regs_t::CMD_WR_UP_DAC_CHAN_N;
+ //standardize on USRP1 interface, A=0, B=1, C=2, D=3
+ static const uhd::dict<
+ unit_t, uhd::dict<int, ad5623_regs_t::addr_t>
+ > unit_to_which_to_addr = map_list_of
+ (UNIT_RX, map_list_of
+ (0, ad5623_regs_t::ADDR_DAC_B)
+ (1, ad5623_regs_t::ADDR_DAC_A)
+ (2, ad5623_regs_t::ADDR_DAC_A)
+ (3, ad5623_regs_t::ADDR_DAC_B)
+ )
+ (UNIT_TX, map_list_of
+ (0, ad5623_regs_t::ADDR_DAC_A)
+ (1, ad5623_regs_t::ADDR_DAC_B)
+ (2, ad5623_regs_t::ADDR_DAC_B)
+ (3, ad5623_regs_t::ADDR_DAC_A)
+ )
+ ;
+ _dac_regs[unit].addr = unit_to_which_to_addr[unit][which];
this->_write_aux_dac(unit);
}