diff options
Diffstat (limited to 'host/lib/usrp/usrp_e/dboard_impl.cpp')
-rw-r--r-- | host/lib/usrp/usrp_e/dboard_impl.cpp | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/host/lib/usrp/usrp_e/dboard_impl.cpp b/host/lib/usrp/usrp_e/dboard_impl.cpp index 22c4ac8b7..a384c71a0 100644 --- a/host/lib/usrp/usrp_e/dboard_impl.cpp +++ b/host/lib/usrp/usrp_e/dboard_impl.cpp @@ -15,10 +15,13 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. // -#include <boost/bind.hpp> #include "usrp_e_impl.hpp" +#include "usrp_e_regs.hpp" +#include "../dsp_utils.hpp" #include <uhd/utils/assert.hpp> #include <uhd/usrp/dboard_props.hpp> +#include <uhd/usrp/subdev_props.hpp> +#include <boost/bind.hpp> #include <iostream> using namespace uhd; @@ -31,9 +34,6 @@ void usrp_e_impl::dboard_init(void){ _rx_db_eeprom = dboard_eeprom_t(_iface->read_eeprom(I2C_ADDR_RX_DB, 0, dboard_eeprom_t::num_bytes())); _tx_db_eeprom = dboard_eeprom_t(_iface->read_eeprom(I2C_ADDR_TX_DB, 0, dboard_eeprom_t::num_bytes())); - std::cout << _rx_db_eeprom.id.to_pp_string() << std::endl; - std::cout << _tx_db_eeprom.id.to_pp_string() << std::endl; - //create a new dboard interface and manager _dboard_iface = make_usrp_e_dboard_iface( _iface, _clock_ctrl, _codec_ctrl @@ -53,11 +53,8 @@ void usrp_e_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)); - //TODO update_rx_mux_config(); - - _tx_subdevs_in_use = prop_names_t(1, _dboard_manager->get_tx_subdev_names().at(0)); - //TODO update_tx_mux_config(); + 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))); } /*********************************************************************** @@ -102,9 +99,16 @@ void usrp_e_impl::rx_dboard_get(const wax::obj &key_, wax::obj &val){ **********************************************************************/ void usrp_e_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>(); - //TODO 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(UE_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: @@ -158,9 +162,15 @@ void usrp_e_impl::tx_dboard_get(const wax::obj &key_, wax::obj &val){ **********************************************************************/ void usrp_e_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>(); - //TODO 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(UE_REG_DSP_TX_MUX, dsp_type1::calc_tx_mux_word( + tx_subdev[SUBDEV_PROP_IQ_SWAPPED].as<bool>() + )); + } return; case DBOARD_PROP_DBOARD_ID: |