aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-06-10 10:10:05 -0700
committerJosh Blum <josh@joshknows.com>2010-06-10 10:10:05 -0700
commit126444c564d30d65116be5f772bdf47594d62884 (patch)
tree13c60f59f937edd34aacd58f69b03f5253f76f1f /host/lib/usrp/usrp2
parentad95e45ab20134657075cd30b989748597c17765 (diff)
downloaduhd-126444c564d30d65116be5f772bdf47594d62884.tar.gz
uhd-126444c564d30d65116be5f772bdf47594d62884.tar.bz2
uhd-126444c564d30d65116be5f772bdf47594d62884.zip
Moved mux calculations into dsp type1 utils.
Fixed error in db basic freq range switcheroo.
Diffstat (limited to 'host/lib/usrp/usrp2')
-rw-r--r--host/lib/usrp/usrp2/dboard_impl.cpp64
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.hpp2
2 files changed, 22 insertions, 44 deletions
diff --git a/host/lib/usrp/usrp2/dboard_impl.cpp b/host/lib/usrp/usrp2/dboard_impl.cpp
index 4a3a70467..fef486771 100644
--- a/host/lib/usrp/usrp2/dboard_impl.cpp
+++ b/host/lib/usrp/usrp2/dboard_impl.cpp
@@ -18,6 +18,7 @@
#include "usrp2_impl.hpp"
#include "usrp2_regs.hpp"
+#include "../dsp_utils.hpp"
#include <uhd/usrp/subdev_props.hpp>
#include <uhd/usrp/dboard_props.hpp>
#include <uhd/utils/assert.hpp>
@@ -54,42 +55,8 @@ void usrp2_impl::dboard_init(void){
);
//init the subdevs in use (use the first subdevice)
- _rx_subdevs_in_use = prop_names_t(1, _dboard_manager->get_rx_subdev_names().at(0));
- update_rx_mux_config();
-
- _tx_subdevs_in_use = prop_names_t(1, _dboard_manager->get_tx_subdev_names().at(0));
- update_tx_mux_config();
-}
-
-void usrp2_impl::update_rx_mux_config(void){
- //calculate the rx mux
- boost::uint32_t rx_mux = 0;
- UHD_ASSERT_THROW(_rx_subdevs_in_use.size() == 1);
- wax::obj rx_subdev = _dboard_manager->get_rx_subdev(_rx_subdevs_in_use.at(0));
- std::cout << "Using: " << rx_subdev[SUBDEV_PROP_NAME].as<std::string>() << std::endl;
- if (rx_subdev[SUBDEV_PROP_QUADRATURE].as<bool>()){
- rx_mux = (0x01 << 2) | (0x00 << 0); //Q=ADC1, I=ADC0
- }else{
- rx_mux = 0x00; //ADC0
- }
- if (rx_subdev[SUBDEV_PROP_IQ_SWAPPED].as<bool>()){
- rx_mux = (((rx_mux >> 0) & 0x3) << 2) | (((rx_mux >> 2) & 0x3) << 0);
- }
-
- _iface->poke32(U2_REG_DSP_RX_MUX, rx_mux);
-}
-
-void usrp2_impl::update_tx_mux_config(void){
- //calculate the tx mux
- boost::uint32_t tx_mux = 0x10;
- UHD_ASSERT_THROW(_tx_subdevs_in_use.size() == 1);
- wax::obj tx_subdev = _dboard_manager->get_tx_subdev(_tx_subdevs_in_use.at(0));
- std::cout << "Using: " << tx_subdev[SUBDEV_PROP_NAME].as<std::string>() << std::endl;
- if (tx_subdev[SUBDEV_PROP_IQ_SWAPPED].as<bool>()){
- tx_mux = (((tx_mux >> 0) & 0xf) << 4) | (((tx_mux >> 4) & 0xf) << 0);
- }
-
- _iface->poke32(U2_REG_DSP_TX_MUX, tx_mux);
+ rx_dboard_set(DBOARD_PROP_USED_SUBDEVS, prop_names_t(1, _dboard_manager->get_rx_subdev_names().at(0)));
+ tx_dboard_set(DBOARD_PROP_USED_SUBDEVS, prop_names_t(1, _dboard_manager->get_tx_subdev_names().at(0)));
}
/***********************************************************************
@@ -131,9 +98,16 @@ void usrp2_impl::rx_dboard_get(const wax::obj &key_, wax::obj &val){
void usrp2_impl::rx_dboard_set(const wax::obj &key, const wax::obj &val){
switch(key.as<dboard_prop_t>()){
- case DBOARD_PROP_USED_SUBDEVS:
- _rx_subdevs_in_use = val.as<prop_names_t>();
- update_rx_mux_config(); //if the val is bad, this will throw
+ case DBOARD_PROP_USED_SUBDEVS:{
+ _rx_subdevs_in_use = val.as<prop_names_t>();
+ UHD_ASSERT_THROW(_rx_subdevs_in_use.size() == 1);
+ wax::obj rx_subdev = _dboard_manager->get_rx_subdev(_rx_subdevs_in_use.at(0));
+ std::cout << "Using: " << rx_subdev[SUBDEV_PROP_NAME].as<std::string>() << std::endl;
+ _iface->poke32(U2_REG_DSP_RX_MUX, dsp_type1::calc_rx_mux_word(
+ rx_subdev[SUBDEV_PROP_QUADRATURE].as<bool>(),
+ rx_subdev[SUBDEV_PROP_IQ_SWAPPED].as<bool>()
+ ));
+ }
return;
case DBOARD_PROP_DBOARD_ID:
@@ -184,9 +158,15 @@ void usrp2_impl::tx_dboard_get(const wax::obj &key_, wax::obj &val){
void usrp2_impl::tx_dboard_set(const wax::obj &key, const wax::obj &val){
switch(key.as<dboard_prop_t>()){
- case DBOARD_PROP_USED_SUBDEVS:
- _tx_subdevs_in_use = val.as<prop_names_t>();
- update_tx_mux_config(); //if the val is bad, this will throw
+ case DBOARD_PROP_USED_SUBDEVS:{
+ _tx_subdevs_in_use = val.as<prop_names_t>();
+ UHD_ASSERT_THROW(_tx_subdevs_in_use.size() == 1);
+ wax::obj tx_subdev = _dboard_manager->get_tx_subdev(_tx_subdevs_in_use.at(0));
+ std::cout << "Using: " << tx_subdev[SUBDEV_PROP_NAME].as<std::string>() << std::endl;
+ _iface->poke32(U2_REG_DSP_TX_MUX, dsp_type1::calc_tx_mux_word(
+ tx_subdev[SUBDEV_PROP_IQ_SWAPPED].as<bool>()
+ ));
+ }
return;
case DBOARD_PROP_DBOARD_ID:
diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp
index 77148ee62..ccc09003e 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.hpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.hpp
@@ -190,8 +190,6 @@ private:
wax_obj_proxy::sptr _tx_dboard_proxy;
uhd::prop_names_t _tx_subdevs_in_use;
uhd::usrp::dboard_eeprom_t _tx_db_eeprom;
- void update_rx_mux_config(void);
- void update_tx_mux_config(void);
//methods and shadows for the ddc dsp
std::vector<size_t> _allowed_decim_and_interp_rates;