aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-06-28 02:52:11 +0100
committerJosh Blum <josh@joshknows.com>2011-06-28 02:52:11 +0100
commit6c48f3a382f0e23a8d7afb1af22fccb256395284 (patch)
tree6fba4c124ac37d2412ddc1fc3b9e7a916cf6514b /host/lib/usrp
parent5b6cce869744d3b643a63f41d13a028b2f85bdcc (diff)
downloaduhd-6c48f3a382f0e23a8d7afb1af22fccb256395284.tar.gz
uhd-6c48f3a382f0e23a8d7afb1af22fccb256395284.tar.bz2
uhd-6c48f3a382f0e23a8d7afb1af22fccb256395284.zip
e100: removed unused files from e100 build dir
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/e100/codec_impl.cpp149
-rw-r--r--host/lib/usrp/e100/dboard_impl.cpp185
-rw-r--r--host/lib/usrp/e100/dsp_impl.cpp217
-rw-r--r--host/lib/usrp/e100/e100_iface.cpp424
-rw-r--r--host/lib/usrp/e100/e100_iface.hpp90
-rw-r--r--host/lib/usrp/e100/mboard_impl.cpp256
6 files changed, 0 insertions, 1321 deletions
diff --git a/host/lib/usrp/e100/codec_impl.cpp b/host/lib/usrp/e100/codec_impl.cpp
deleted file mode 100644
index 26743d173..000000000
--- a/host/lib/usrp/e100/codec_impl.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-//
-// Copyright 2010-2011 Ettus Research LLC
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#include "e100_impl.hpp"
-#include <uhd/exception.hpp>
-#include <uhd/usrp/codec_props.hpp>
-#include <boost/bind.hpp>
-
-using namespace uhd;
-using namespace uhd::usrp;
-
-/***********************************************************************
- * Helper Methods
- **********************************************************************/
-void e100_impl::codec_init(void){
- //make proxies
- _rx_codec_proxy = wax_obj_proxy::make(
- boost::bind(&e100_impl::rx_codec_get, this, _1, _2),
- boost::bind(&e100_impl::rx_codec_set, this, _1, _2)
- );
- _tx_codec_proxy = wax_obj_proxy::make(
- boost::bind(&e100_impl::tx_codec_get, this, _1, _2),
- boost::bind(&e100_impl::tx_codec_set, this, _1, _2)
- );
-}
-
-/***********************************************************************
- * RX Codec Properties
- **********************************************************************/
-static const std::string ad9862_pga_gain_name = "ad9862 pga";
-
-void e100_impl::rx_codec_get(const wax::obj &key_, wax::obj &val){
- named_prop_t key = named_prop_t::extract(key_);
-
- //handle the get request conditioned on the key
- switch(key.as<codec_prop_t>()){
- case CODEC_PROP_NAME:
- val = std::string("usrp-e adc - ad9522");
- return;
-
- case CODEC_PROP_OTHERS:
- val = prop_names_t();
- return;
-
- case CODEC_PROP_GAIN_NAMES:
- val = prop_names_t(1, ad9862_pga_gain_name);
- return;
-
- case CODEC_PROP_GAIN_RANGE:
- UHD_ASSERT_THROW(key.name == ad9862_pga_gain_name);
- val = e100_codec_ctrl::rx_pga_gain_range;
- return;
-
- case CODEC_PROP_GAIN_I:
- UHD_ASSERT_THROW(key.name == ad9862_pga_gain_name);
- val = _codec_ctrl->get_rx_pga_gain('A');
- return;
-
- case CODEC_PROP_GAIN_Q:
- UHD_ASSERT_THROW(key.name == ad9862_pga_gain_name);
- val = _codec_ctrl->get_rx_pga_gain('B');
- return;
-
- default: UHD_THROW_PROP_GET_ERROR();
- }
-}
-
-void e100_impl::rx_codec_set(const wax::obj &key_, const wax::obj &val){
- named_prop_t key = named_prop_t::extract(key_);
-
- //handle the set request conditioned on the key
- switch(key.as<codec_prop_t>()){
- case CODEC_PROP_GAIN_I:
- UHD_ASSERT_THROW(key.name == ad9862_pga_gain_name);
- _codec_ctrl->set_rx_pga_gain(val.as<double>(), 'A');
- return;
-
- case CODEC_PROP_GAIN_Q:
- UHD_ASSERT_THROW(key.name == ad9862_pga_gain_name);
- _codec_ctrl->set_rx_pga_gain(val.as<double>(), 'B');
- return;
-
- default: UHD_THROW_PROP_SET_ERROR();
- }
-}
-
-/***********************************************************************
- * TX Codec Properties
- **********************************************************************/
-void e100_impl::tx_codec_get(const wax::obj &key_, wax::obj &val){
- named_prop_t key = named_prop_t::extract(key_);
-
- //handle the get request conditioned on the key
- switch(key.as<codec_prop_t>()){
- case CODEC_PROP_NAME:
- val = std::string("usrp-e dac - ad9522");
- return;
-
- case CODEC_PROP_OTHERS:
- val = prop_names_t();
- return;
-
- case CODEC_PROP_GAIN_NAMES:
- val = prop_names_t(1, ad9862_pga_gain_name);
- return;
-
- case CODEC_PROP_GAIN_RANGE:
- UHD_ASSERT_THROW(key.name == ad9862_pga_gain_name);
- val = e100_codec_ctrl::tx_pga_gain_range;
- return;
-
- case CODEC_PROP_GAIN_I: //only one gain for I and Q
- case CODEC_PROP_GAIN_Q:
- UHD_ASSERT_THROW(key.name == ad9862_pga_gain_name);
- val = _codec_ctrl->get_tx_pga_gain();
- return;
-
- default: UHD_THROW_PROP_GET_ERROR();
- }
-}
-
-void e100_impl::tx_codec_set(const wax::obj &key_, const wax::obj &val){
- named_prop_t key = named_prop_t::extract(key_);
-
- //handle the set request conditioned on the key
- switch(key.as<codec_prop_t>()){
- case CODEC_PROP_GAIN_I: //only one gain for I and Q
- case CODEC_PROP_GAIN_Q:
- UHD_ASSERT_THROW(key.name == ad9862_pga_gain_name);
- _codec_ctrl->set_tx_pga_gain(val.as<double>());
- return;
-
- default: UHD_THROW_PROP_SET_ERROR();
- }
-}
diff --git a/host/lib/usrp/e100/dboard_impl.cpp b/host/lib/usrp/e100/dboard_impl.cpp
deleted file mode 100644
index 86481e70a..000000000
--- a/host/lib/usrp/e100/dboard_impl.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-//
-// Copyright 2010-2011 Ettus Research LLC
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#include "e100_impl.hpp"
-#include "e100_regs.hpp"
-#include <uhd/exception.hpp>
-#include <uhd/usrp/dboard_props.hpp>
-#include <uhd/usrp/subdev_props.hpp>
-#include <uhd/usrp/misc_utils.hpp>
-#include <boost/bind.hpp>
-#include <iostream>
-
-using namespace uhd;
-using namespace uhd::usrp;
-
-/***********************************************************************
- * Dboard Initialization
- **********************************************************************/
-void e100_impl::dboard_init(void){
- //read the dboard eeprom to extract the dboard ids
- _rx_db_eeprom.load(*_iface, I2C_ADDR_RX_DB);
- _tx_db_eeprom.load(*_iface, I2C_ADDR_TX_DB);
- _gdb_eeprom.load(*_iface, I2C_ADDR_TX_DB ^ 5);
-
- //create a new dboard interface and manager
- _dboard_iface = make_usrp_e100_dboard_iface(
- _iface, _clock_ctrl, _codec_ctrl
- );
- _dboard_manager = dboard_manager::make(
- _rx_db_eeprom.id,
- ((_gdb_eeprom.id == dboard_id_t::none())? _tx_db_eeprom : _gdb_eeprom).id,
- _dboard_iface
- );
-
- //setup the dboard proxies
- _rx_dboard_proxy = wax_obj_proxy::make(
- boost::bind(&e100_impl::rx_dboard_get, this, _1, _2),
- boost::bind(&e100_impl::rx_dboard_set, this, _1, _2)
- );
- _tx_dboard_proxy = wax_obj_proxy::make(
- boost::bind(&e100_impl::tx_dboard_get, this, _1, _2),
- boost::bind(&e100_impl::tx_dboard_set, this, _1, _2)
- );
-}
-
-/***********************************************************************
- * RX Dboard Get
- **********************************************************************/
-void e100_impl::rx_dboard_get(const wax::obj &key_, wax::obj &val){
- named_prop_t key = named_prop_t::extract(key_);
-
- //handle the get request conditioned on the key
- switch(key.as<dboard_prop_t>()){
- case DBOARD_PROP_NAME:
- val = std::string("usrp-e dboard (rx unit)");
- return;
-
- case DBOARD_PROP_SUBDEV:
- val = _dboard_manager->get_rx_subdev(key.name);
- return;
-
- case DBOARD_PROP_SUBDEV_NAMES:
- val = _dboard_manager->get_rx_subdev_names();
- return;
-
- case DBOARD_PROP_DBOARD_EEPROM:
- val = _rx_db_eeprom;
- return;
-
- case DBOARD_PROP_DBOARD_IFACE:
- val = _dboard_iface;
- return;
-
- case DBOARD_PROP_CODEC:
- val = _rx_codec_proxy->get_link();
- return;
-
- case DBOARD_PROP_GAIN_GROUP:
- val = make_gain_group(
- _rx_db_eeprom.id,
- _dboard_manager->get_rx_subdev(key.name),
- _rx_codec_proxy->get_link(),
- GAIN_GROUP_POLICY_RX
- );
- return;
-
- default: UHD_THROW_PROP_GET_ERROR();
- }
-}
-
-/***********************************************************************
- * RX Dboard Set
- **********************************************************************/
-void e100_impl::rx_dboard_set(const wax::obj &key, const wax::obj &val){
- switch(key.as<dboard_prop_t>()){
- case DBOARD_PROP_DBOARD_EEPROM:
- _rx_db_eeprom = val.as<dboard_eeprom_t>();
- _rx_db_eeprom.store(*_iface, I2C_ADDR_RX_DB);
- return;
-
- default: UHD_THROW_PROP_SET_ERROR();
- }
-}
-
-/***********************************************************************
- * TX Dboard Get
- **********************************************************************/
-void e100_impl::tx_dboard_get(const wax::obj &key_, wax::obj &val){
- named_prop_t key = named_prop_t::extract(key_);
-
- //handle the get request conditioned on the key
- switch(key.as<dboard_prop_t>()){
- case DBOARD_PROP_NAME:
- val = std::string("usrp-e dboard (tx unit)");
- return;
-
- case DBOARD_PROP_SUBDEV:
- val = _dboard_manager->get_tx_subdev(key.name);
- return;
-
- case DBOARD_PROP_SUBDEV_NAMES:
- val = _dboard_manager->get_tx_subdev_names();
- return;
-
- case DBOARD_PROP_DBOARD_EEPROM:
- val = _tx_db_eeprom;
- return;
-
- case DBOARD_PROP_GBOARD_EEPROM:
- val = _gdb_eeprom;
- return;
-
- case DBOARD_PROP_DBOARD_IFACE:
- val = _dboard_iface;
- return;
-
- case DBOARD_PROP_CODEC:
- val = _tx_codec_proxy->get_link();
- return;
-
- case DBOARD_PROP_GAIN_GROUP:
- val = make_gain_group(
- _tx_db_eeprom.id,
- _dboard_manager->get_tx_subdev(key.name),
- _tx_codec_proxy->get_link(),
- GAIN_GROUP_POLICY_TX
- );
- return;
-
- default: UHD_THROW_PROP_GET_ERROR();
- }
-}
-
-/***********************************************************************
- * TX Dboard Set
- **********************************************************************/
-void e100_impl::tx_dboard_set(const wax::obj &key, const wax::obj &val){
- switch(key.as<dboard_prop_t>()){
- case DBOARD_PROP_DBOARD_EEPROM:
- _tx_db_eeprom = val.as<dboard_eeprom_t>();
- _tx_db_eeprom.store(*_iface, I2C_ADDR_TX_DB);
- return;
-
- case DBOARD_PROP_GBOARD_EEPROM:
- _gdb_eeprom = val.as<dboard_eeprom_t>();
- _gdb_eeprom.store(*_iface, I2C_ADDR_TX_DB ^ 5);
- return;
-
- default: UHD_THROW_PROP_SET_ERROR();
- }
-}
diff --git a/host/lib/usrp/e100/dsp_impl.cpp b/host/lib/usrp/e100/dsp_impl.cpp
deleted file mode 100644
index fc65609a0..000000000
--- a/host/lib/usrp/e100/dsp_impl.cpp
+++ /dev/null
@@ -1,217 +0,0 @@
-//
-// Copyright 2010-2011 Ettus Research LLC
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#include "e100_impl.hpp"
-#include "e100_regs.hpp"
-#include <uhd/usrp/dsp_utils.hpp>
-#include <uhd/usrp/dsp_props.hpp>
-#include <boost/math/special_functions/round.hpp>
-#include <boost/bind.hpp>
-
-using namespace uhd;
-using namespace uhd::usrp;
-
-/***********************************************************************
- * DSP impl and methods
- **********************************************************************/
-struct e100_impl::dsp_impl{
- uhd::dict<size_t, size_t> ddc_decim;
- uhd::dict<size_t, double> ddc_freq;
- uhd::dict<size_t, size_t> duc_interp;
- uhd::dict<size_t, double> duc_freq;
-};
-
-/***********************************************************************
- * RX DDC Initialization
- **********************************************************************/
-void e100_impl::dsp_init(void){
- //create new dsp impl
- _dsp_impl = UHD_PIMPL_MAKE(dsp_impl, ());
-
- //bind and initialize the rx dsps
- for (size_t i = 0; i < E100_NUM_RX_DSPS; i++){
- _rx_dsp_proxies[str(boost::format("DSP%d")%i)] = wax_obj_proxy::make(
- boost::bind(&e100_impl::ddc_get, this, _1, _2, i),
- boost::bind(&e100_impl::ddc_set, this, _1, _2, i)
- );
-
- //initial config and update
- ddc_set(DSP_PROP_FREQ_SHIFT, double(0), i);
- ddc_set(DSP_PROP_HOST_RATE, double(_clock_ctrl->get_fpga_clock_rate()/16), i);
-
- //setup the rx control registers
- _iface->poke32(E100_REG_RX_CTRL_CLEAR(i), 1); //reset
- _iface->poke32(E100_REG_RX_CTRL_NSAMPS_PP(i), this->get_max_recv_samps_per_packet());
- _iface->poke32(E100_REG_RX_CTRL_NCHANNELS(i), 1);
- _iface->poke32(E100_REG_RX_CTRL_VRT_HDR(i), 0
- | (0x1 << 28) //if data with stream id
- | (0x1 << 26) //has trailer
- | (0x3 << 22) //integer time other
- | (0x1 << 20) //fractional time sample count
- );
- _iface->poke32(E100_REG_RX_CTRL_VRT_SID(i), E100_DSP_SID_BASE + i);
- _iface->poke32(E100_REG_RX_CTRL_VRT_TLR(i), 0);
- _iface->poke32(E100_REG_TIME64_TPS, size_t(_clock_ctrl->get_fpga_clock_rate()));
- }
-
- //bind and initialize the tx dsps
- for (size_t i = 0; i < E100_NUM_TX_DSPS; i++){
- _tx_dsp_proxies[str(boost::format("DSP%d")%i)] = wax_obj_proxy::make(
- boost::bind(&e100_impl::duc_get, this, _1, _2, i),
- boost::bind(&e100_impl::duc_set, this, _1, _2, i)
- );
-
- //initial config and update
- duc_set(DSP_PROP_FREQ_SHIFT, double(0), i);
- duc_set(DSP_PROP_HOST_RATE, double(_clock_ctrl->get_fpga_clock_rate()/16), i);
-
- //init the tx control registers
- _iface->poke32(E100_REG_TX_CTRL_CLEAR_STATE, 1); //reset
- _iface->poke32(E100_REG_TX_CTRL_NUM_CHAN, 0); //1 channel
- _iface->poke32(E100_REG_TX_CTRL_REPORT_SID, E100_ASYNC_SID);
- _iface->poke32(E100_REG_TX_CTRL_POLICY, E100_FLAG_TX_CTRL_POLICY_NEXT_PACKET);
- }
-}
-
-/***********************************************************************
- * RX DDC Get
- **********************************************************************/
-void e100_impl::ddc_get(const wax::obj &key_, wax::obj &val, size_t which_dsp){
- named_prop_t key = named_prop_t::extract(key_);
-
- switch(key.as<dsp_prop_t>()){
- case DSP_PROP_NAME:
- val = str(boost::format("%s ddc%d") % _iface->get_cname() % which_dsp);
- return;
-
- case DSP_PROP_OTHERS:
- val = prop_names_t(); //empty
- return;
-
- case DSP_PROP_FREQ_SHIFT:
- val = _dsp_impl->ddc_freq[which_dsp];
- return;
-
- case DSP_PROP_CODEC_RATE:
- val = _clock_ctrl->get_fpga_clock_rate();
- return;
-
- case DSP_PROP_HOST_RATE:
- val = _clock_ctrl->get_fpga_clock_rate()/_dsp_impl->ddc_decim[which_dsp];
- return;
-
- default: UHD_THROW_PROP_GET_ERROR();
- }
-}
-
-/***********************************************************************
- * RX DDC Set
- **********************************************************************/
-void e100_impl::ddc_set(const wax::obj &key_, const wax::obj &val, size_t which_dsp){
- named_prop_t key = named_prop_t::extract(key_);
-
- switch(key.as<dsp_prop_t>()){
-
- case DSP_PROP_STREAM_CMD:
- issue_ddc_stream_cmd(val.as<stream_cmd_t>(), which_dsp);
- return;
-
- case DSP_PROP_FREQ_SHIFT:{
- double new_freq = val.as<double>();
- _iface->poke32(E100_REG_DSP_RX_FREQ(which_dsp),
- dsp_type1::calc_cordic_word_and_update(new_freq, _clock_ctrl->get_fpga_clock_rate())
- );
- _dsp_impl->ddc_freq[which_dsp] = new_freq; //shadow
- }
- return;
-
- case DSP_PROP_HOST_RATE:{
- _dsp_impl->ddc_decim[which_dsp] = boost::math::iround(_clock_ctrl->get_fpga_clock_rate()/val.as<double>());
-
- //set the decimation
- _iface->poke32(E100_REG_DSP_RX_DECIM(which_dsp), dsp_type1::calc_cic_filter_word(_dsp_impl->ddc_decim[which_dsp]));
- }
- this->update_xport_channel_mapping(); //rate changed -> update
- return;
-
- default: UHD_THROW_PROP_SET_ERROR();
- }
-}
-
-/***********************************************************************
- * TX DUC Get
- **********************************************************************/
-void e100_impl::duc_get(const wax::obj &key_, wax::obj &val, size_t which_dsp){
- named_prop_t key = named_prop_t::extract(key_);
-
- switch(key.as<dsp_prop_t>()){
- case DSP_PROP_NAME:
- val = str(boost::format("%s duc%d") % _iface->get_cname() % which_dsp);
- return;
-
- case DSP_PROP_OTHERS:
- val = prop_names_t(); //empty
- return;
-
- case DSP_PROP_FREQ_SHIFT:
- val = _dsp_impl->duc_freq[which_dsp];
- return;
-
- case DSP_PROP_CODEC_RATE:
- val = _clock_ctrl->get_fpga_clock_rate();
- return;
-
- case DSP_PROP_HOST_RATE:
- val = _clock_ctrl->get_fpga_clock_rate()/_dsp_impl->duc_interp[which_dsp];
- return;
-
- default: UHD_THROW_PROP_GET_ERROR();
- }
-}
-
-/***********************************************************************
- * TX DUC Set
- **********************************************************************/
-void e100_impl::duc_set(const wax::obj &key_, const wax::obj &val, size_t which_dsp){
- named_prop_t key = named_prop_t::extract(key_);
-
- switch(key.as<dsp_prop_t>()){
-
- case DSP_PROP_FREQ_SHIFT:{
- double new_freq = val.as<double>();
- _iface->poke32(E100_REG_DSP_TX_FREQ,
- dsp_type1::calc_cordic_word_and_update(new_freq, _clock_ctrl->get_fpga_clock_rate())
- );
- _dsp_impl->duc_freq[which_dsp] = new_freq; //shadow
- }
- return;
-
- case DSP_PROP_HOST_RATE:{
- _dsp_impl->duc_interp[which_dsp] = boost::math::iround(_clock_ctrl->get_fpga_clock_rate()/val.as<double>());
-
- //set the interpolation
- _iface->poke32(E100_REG_DSP_TX_INTERP_RATE, dsp_type1::calc_cic_filter_word(_dsp_impl->duc_interp[which_dsp]));
-
- //set the scaling
- _iface->poke32(E100_REG_DSP_TX_SCALE_IQ, dsp_type1::calc_iq_scale_word(_dsp_impl->duc_interp[which_dsp]));
- }
- this->update_xport_channel_mapping(); //rate changed -> update
- return;
-
- default: UHD_THROW_PROP_SET_ERROR();
- }
-}
diff --git a/host/lib/usrp/e100/e100_iface.cpp b/host/lib/usrp/e100/e100_iface.cpp
deleted file mode 100644
index 1bf33ae5b..000000000
--- a/host/lib/usrp/e100/e100_iface.cpp
+++ /dev/null
@@ -1,424 +0,0 @@
-//
-// Copyright 2010-2011 Ettus Research LLC
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#include "e100_iface.hpp"
-#include "e100_regs.hpp"
-#include <uhd/exception.hpp>
-#include <uhd/utils/msg.hpp>
-#include <sys/ioctl.h> //ioctl
-#include <fcntl.h> //open, close
-#include <linux/usrp_e.h> //ioctl structures and constants
-#include <boost/thread/thread.hpp> //sleep
-#include <boost/thread/mutex.hpp>
-#include <boost/format.hpp>
-#include <linux/i2c-dev.h>
-#include <linux/i2c.h>
-#include <fstream>
-
-using namespace uhd;
-using namespace uhd::usrp;
-
-/***********************************************************************
- * Sysfs GPIO wrapper class
- **********************************************************************/
-class gpio{
-public:
- gpio(const int num, const std::string &dir) : _num(num){
- this->set_xport("export");
- this->set_dir(dir);
- _value_file.open(str(boost::format("/sys/class/gpio/gpio%d/value") % num).c_str(), std::ios_base::in | std::ios_base::out);
- }
- ~gpio(void){
- _value_file.close();
- this->set_dir("in");
- this->set_xport("unexport");
- }
- void operator()(const int val){
- _value_file << val << std::endl << std::flush;
- }
- int operator()(void){
- std::string val;
- std::getline(_value_file, val);
- _value_file.seekg(0);
- return int(val.at(0) - '0') & 0x1;
- }
-private:
- void set_xport(const std::string &xport){
- std::ofstream export_file(("/sys/class/gpio/" + xport).c_str());
- export_file << _num << std::endl << std::flush;
- export_file.close();
- }
- void set_dir(const std::string &dir){
- std::ofstream dir_file(str(boost::format("/sys/class/gpio/gpio%d/direction") % _num).c_str());
- dir_file << dir << std::endl << std::flush;
- dir_file.close();
- }
- const int _num;
- std::fstream _value_file;
-};
-
-//We only init the gpios when we have to use them (in the aux spi call).
-//This way, the device discovery cannot unexport them from another process.
-struct iface_gpios_type{
- typedef boost::shared_ptr<iface_gpios_type> sptr;
- iface_gpios_type(void):
- spi_sclk_gpio(65, "out"),
- spi_sen_gpio(186, "out"),
- spi_mosi_gpio(145, "out"),
- spi_miso_gpio(147, "in"){}
- gpio spi_sclk_gpio, spi_sen_gpio, spi_mosi_gpio, spi_miso_gpio;
-};
-
-/***********************************************************************
- * I2C device node implementation wrapper
- **********************************************************************/
-class i2c_dev_iface : public i2c_iface{
-public:
- i2c_dev_iface(const std::string &node){
- if ((_node_fd = ::open(node.c_str(), O_RDWR)) < 0){
- throw uhd::io_error("Failed to open " + node);
- }
- }
-
- ~i2c_dev_iface(void){
- ::close(_node_fd);
- }
-
- void write_i2c(boost::uint8_t addr, const byte_vector_t &bytes){
- byte_vector_t rw_bytes(bytes);
-
- //setup the message
- i2c_msg msg;
- msg.addr = addr;
- msg.flags = 0;
- msg.len = bytes.size();
- msg.buf = &rw_bytes.front();
-
- //setup the data
- i2c_rdwr_ioctl_data data;
- data.msgs = &msg;
- data.nmsgs = 1;
-
- //call the ioctl
- UHD_ASSERT_THROW(::ioctl(_node_fd, I2C_RDWR, &data) >= 0);
- }
-
- byte_vector_t read_i2c(boost::uint8_t addr, size_t num_bytes){
- byte_vector_t bytes(num_bytes);
-
- //setup the message
- i2c_msg msg;
- msg.addr = addr;
- msg.flags = I2C_M_RD;
- msg.len = bytes.size();
- msg.buf = &bytes.front();
-
- //setup the data
- i2c_rdwr_ioctl_data data;
- data.msgs = &msg;
- data.nmsgs = 1;
-
- //call the ioctl
- UHD_ASSERT_THROW(::ioctl(_node_fd, I2C_RDWR, &data) >= 0);
-
- return bytes;
- }
-
-private: int _node_fd;
-};
-
-/***********************************************************************
- * USRP-E100 interface implementation
- **********************************************************************/
-class e100_iface_impl : public e100_iface{
-public:
-
- int get_file_descriptor(void){
- return _node_fd;
- }
-
- void open(const std::string &node){
- UHD_MSG(status) << "Opening device node " << node << "..." << std::endl;
-
- //open the device node and check file descriptor
- if ((_node_fd = ::open(node.c_str(), O_RDWR)) < 0){
- throw uhd::io_error("Failed to open " + node);
- }
-
- //check the module compatibility number
- int module_compat_num = ::ioctl(_node_fd, USRP_E_GET_COMPAT_NUMBER, NULL);
- if (module_compat_num != USRP_E_COMPAT_NUMBER){
- throw uhd::runtime_error(str(boost::format(
- "Expected module compatibility number 0x%x, but got 0x%x:\n"
- "The module build is not compatible with the host code build."
- ) % USRP_E_COMPAT_NUMBER % module_compat_num));
- }
-
- //perform a global reset after opening
- this->poke32(E100_REG_GLOBAL_RESET, 0);
-
- //and now is a good time to init the i2c
- this->i2c_init();
- }
-
- void close(void){
- ::close(_node_fd);
- _node_fd = -1;
- }
-
- /*******************************************************************
- * Structors
- ******************************************************************/
- e100_iface_impl(void):
- _node_fd(-1),
- _i2c_dev_iface(i2c_dev_iface("/dev/i2c-3"))
- {
- mb_eeprom = mboard_eeprom_t(get_i2c_dev_iface(), mboard_eeprom_t::MAP_E100);
- }
-
- ~e100_iface_impl(void){
- if (_node_fd >= 0) this->close();
- }
-
- /*******************************************************************
- * IOCTL: provides the communication base for all other calls
- ******************************************************************/
- void ioctl(int request, void *mem){
- boost::mutex::scoped_lock lock(_ioctl_mutex);
-
- if (::ioctl(_node_fd, request, mem) < 0){
- throw uhd::os_error(str(
- boost::format("ioctl failed with request %d") % request
- ));
- }
- }
-
- /*******************************************************************
- * I2C device node interface
- ******************************************************************/
- i2c_iface &get_i2c_dev_iface(void){
- return _i2c_dev_iface;
- }
-
- /*******************************************************************
- * Peek and Poke
- ******************************************************************/
- void poke32(boost::uint32_t addr, boost::uint32_t value){
- //load the data struct
- usrp_e_ctl32 data;
- data.offset = addr;
- data.count = 1;
- data.buf[0] = value;
-
- //call the ioctl
- this->ioctl(USRP_E_WRITE_CTL32, &data);
- }
-
- void poke16(boost::uint32_t addr, boost::uint16_t value){
- //load the data struct
- usrp_e_ctl16 data;
- data.offset = addr;
- data.count = 1;
- data.buf[0] = value;
-
- //call the ioctl
- this->ioctl(USRP_E_WRITE_CTL16, &data);
- }
-
- boost::uint32_t peek32(boost::uint32_t addr){
- //load the data struct
- usrp_e_ctl32 data;
- data.offset = addr;
- data.count = 1;
-
- //call the ioctl
- this->ioctl(USRP_E_READ_CTL32, &data);
-
- return data.buf[0];
- }
-
- boost::uint16_t peek16(boost::uint32_t addr){
- //load the data struct
- usrp_e_ctl16 data;
- data.offset = addr;
- data.count = 1;
-
- //call the ioctl
- this->ioctl(USRP_E_READ_CTL16, &data);
-
- return data.buf[0];
- }
-
- /*******************************************************************
- * I2C
- ******************************************************************/
- static const boost::uint32_t i2c_datarate = 400000;
- static const boost::uint32_t wishbone_clk = 64000000; //FIXME should go somewhere else
-
- void i2c_init(void) {
- //init I2C FPGA interface.
- poke16(E100_REG_I2C_CTRL, 0x0000);
- //set prescalers to operate at 400kHz: WB_CLK is 64MHz...
- boost::uint16_t prescaler = wishbone_clk / (i2c_datarate*5) - 1;
- poke16(E100_REG_I2C_PRESCALER_LO, prescaler & 0xFF);
- poke16(E100_REG_I2C_PRESCALER_HI, (prescaler >> 8) & 0xFF);
- poke16(E100_REG_I2C_CTRL, I2C_CTRL_EN); //enable I2C core
- }
-
- void i2c_wait(void){
- for (size_t i = 0; i < 100; i++){
- if ((this->peek16(E100_REG_I2C_CMD_STATUS) & I2C_ST_TIP) == 0) return;
- boost::this_thread::sleep(boost::posix_time::milliseconds(1));
- }
- UHD_MSG(error) << "i2c_wait: timeout" << std::endl;
- }
-
- bool wait_chk_ack(void){
- i2c_wait();
- return (this->peek16(E100_REG_I2C_CMD_STATUS) & I2C_ST_RXACK) == 0;
- }
-
- void write_i2c(boost::uint8_t addr, const byte_vector_t &bytes){
- poke16(E100_REG_I2C_DATA, (addr << 1) | 0); //addr and read bit (0)
- poke16(E100_REG_I2C_CMD_STATUS, I2C_CMD_WR | I2C_CMD_START | (bytes.size() == 0 ? I2C_CMD_STOP : 0));
-
- //wait for previous transfer to complete
- if(!wait_chk_ack()) {
- poke16(E100_REG_I2C_CMD_STATUS, I2C_CMD_STOP);
- return;
- }
-
- for(size_t i = 0; i < bytes.size(); i++) {
- poke16(E100_REG_I2C_DATA, bytes[i]);
- poke16(E100_REG_I2C_CMD_STATUS, I2C_CMD_WR | ((i == (bytes.size() - 1)) ? I2C_CMD_STOP : 0));
- if(!wait_chk_ack()) {
- poke16(E100_REG_I2C_CMD_STATUS, I2C_CMD_STOP);
- return;
- }
- }
- }
-
- byte_vector_t read_i2c(boost::uint8_t addr, size_t num_bytes){
- byte_vector_t bytes;
- if(num_bytes == 0) return bytes;
-
- while (peek16(E100_REG_I2C_CMD_STATUS) & I2C_ST_BUSY);
-
- poke16(E100_REG_I2C_DATA, (addr << 1) | 1); //addr and read bit (1)
- poke16(E100_REG_I2C_CMD_STATUS, I2C_CMD_WR | I2C_CMD_START);
- //wait for previous transfer to complete
- if(!wait_chk_ack()) {
- poke16(E100_REG_I2C_CMD_STATUS, I2C_CMD_STOP);
- }
- for(; num_bytes > 0; num_bytes--) {
- poke16(E100_REG_I2C_CMD_STATUS, I2C_CMD_RD | ((num_bytes == 1) ? (I2C_CMD_STOP | I2C_CMD_NACK) : 0));
- i2c_wait();
- boost::uint8_t readback = peek16(E100_REG_I2C_DATA) & 0xFF;
- bytes.push_back(readback);
- }
- return bytes;
- }
-
- /*******************************************************************
- * SPI
- ******************************************************************/
- void spi_wait(void) {
- for (size_t i = 0; i < 100; i++){
- if ((this->peek16(E100_REG_SPI_CTRL) & SPI_CTRL_GO_BSY) == 0) return;
- boost::this_thread::sleep(boost::posix_time::milliseconds(1));
- }
- UHD_MSG(error) << "spi_wait: timeout" << std::endl;
- }
-
- boost::uint32_t transact_spi(
- int which_slave,
- const spi_config_t &config,
- boost::uint32_t bits,
- size_t num_bits,
- bool readback
- ){
- if (which_slave == UE_SPI_SS_AD9522) return bitbang_spi(
- bits, num_bits, readback
- );
-
- UHD_ASSERT_THROW(num_bits <= 32 and (num_bits % 8) == 0);
-
- int edge_flags = ((config.miso_edge==spi_config_t::EDGE_FALL) ? SPI_CTRL_RXNEG : 0) |
- ((config.mosi_edge==spi_config_t::EDGE_FALL) ? 0 : SPI_CTRL_TXNEG)
- ;
- boost::uint16_t ctrl = SPI_CTRL_ASS | (SPI_CTRL_CHAR_LEN_MASK & num_bits) | edge_flags;
-
- spi_wait();
- poke16(E100_REG_SPI_DIV, 0x0001); // = fpga_clk / 4
- poke32(E100_REG_SPI_SS, which_slave & 0xFFFF);
- poke32(E100_REG_SPI_TXRX0, bits);
- poke16(E100_REG_SPI_CTRL, ctrl);
- poke16(E100_REG_SPI_CTRL, ctrl | SPI_CTRL_GO_BSY);
-
- if (not readback) return 0;
- spi_wait();
- return peek32(E100_REG_SPI_TXRX0);
- }
-
- boost::uint32_t bitbang_spi(
- boost::uint32_t bits, size_t num_bits, bool readback
- ){
- if (_gpios.get() == NULL) { //init on demand...
- _gpios = iface_gpios_type::sptr(new iface_gpios_type());
- }
-
- boost::uint32_t rb_bits = 0;
- _gpios->spi_sen_gpio(0);
-
- for (size_t i = 0; i < num_bits; i++){
- _gpios->spi_sclk_gpio(0);
- _gpios->spi_mosi_gpio((bits >> (num_bits-i-1)) & 0x1);
- boost::this_thread::sleep(boost::posix_time::microseconds(10));
- if (readback) rb_bits = (rb_bits << 1) | _gpios->spi_miso_gpio();
- _gpios->spi_sclk_gpio(1);
- boost::this_thread::sleep(boost::posix_time::microseconds(10));
- }
-
- _gpios->spi_sen_gpio(1);
- boost::this_thread::sleep(boost::posix_time::microseconds(100));
- return rb_bits;
- }
-
- /*******************************************************************
- * UART
- ******************************************************************/
- void write_uart(boost::uint8_t, const std::string &) {
- throw uhd::not_implemented_error("Unhandled command write_uart()");
- }
-
- std::string read_uart(boost::uint8_t) {
- throw uhd::not_implemented_error("Unhandled command read_uart()");
- }
-
-private:
- int _node_fd;
- i2c_dev_iface _i2c_dev_iface;
- boost::mutex _ioctl_mutex;
- iface_gpios_type::sptr _gpios;
-};
-
-/***********************************************************************
- * Public Make Function
- **********************************************************************/
-e100_iface::sptr e100_iface::make(void){
- return sptr(new e100_iface_impl());
-}
diff --git a/host/lib/usrp/e100/e100_iface.hpp b/host/lib/usrp/e100/e100_iface.hpp
deleted file mode 100644
index a0135a468..000000000
--- a/host/lib/usrp/e100/e100_iface.hpp
+++ /dev/null
@@ -1,90 +0,0 @@
-//
-// Copyright 2010-2011 Ettus Research LLC
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#ifndef INCLUDED_E100_IFACE_HPP
-#define INCLUDED_E100_IFACE_HPP
-
-#include <uhd/transport/udp_simple.hpp>
-#include <uhd/usrp/mboard_eeprom.hpp>
-#include <uhd/types/serial.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/utility.hpp>
-#include <boost/cstdint.hpp>
-#include <uhd/usrp/mboard_iface.hpp>
-
-////////////////////////////////////////////////////////////////////////
-// I2C addresses
-////////////////////////////////////////////////////////////////////////
-#define I2C_DEV_EEPROM 0x50 // 24LC02[45]: 7-bits 1010xxx
-#define I2C_ADDR_MBOARD (I2C_DEV_EEPROM | 0x0)
-#define I2C_ADDR_TX_DB (I2C_DEV_EEPROM | 0x4)
-#define I2C_ADDR_RX_DB (I2C_DEV_EEPROM | 0x5)
-////////////////////////////////////////////////////////////////////////
-
-/*!
- * The usrp-e interface class:
- * Provides a set of functions to implementation layer.
- * Including spi, peek, poke, control...
- */
-class e100_iface : boost::noncopyable, public uhd::usrp::mboard_iface{
-public:
- typedef boost::shared_ptr<e100_iface> sptr;
-
- /*!
- * Make a new usrp-e interface with the control transport.
- * \return a new usrp-e interface object
- */
- static sptr make(void);
-
- //! TODO implement this for multiple hardwares revs in the future
- std::string get_cname(void){
- return "USRP-E100";
- }
-
- /*!
- * Get the underlying file descriptor.
- * \return the file descriptor
- */
- virtual int get_file_descriptor(void) = 0;
-
- /*!
- * Open a device node into this iface.
- * \param node the device node name
- */
- virtual void open(const std::string &node) = 0;
-
- /*!
- * Close the open device node in this iface.
- */
- virtual void close(void) = 0;
-
- /*!
- * Perform an ioctl call on the device node file descriptor.
- * This will throw when the internal ioctl call fails.
- * \param request the control word
- * \param mem pointer to some memory
- */
- virtual void ioctl(int request, void *mem) = 0;
-
- //! Get the I2C interface for the I2C device node
- virtual uhd::i2c_iface &get_i2c_dev_iface(void) = 0;
-
- //motherboard eeprom map structure
- uhd::usrp::mboard_eeprom_t mb_eeprom;
-};
-
-#endif /* INCLUDED_E100_IFACE_HPP */
diff --git a/host/lib/usrp/e100/mboard_impl.cpp b/host/lib/usrp/e100/mboard_impl.cpp
deleted file mode 100644
index e7a46fe8e..000000000
--- a/host/lib/usrp/e100/mboard_impl.cpp
+++ /dev/null
@@ -1,256 +0,0 @@
-//
-// Copyright 2010-2011 Ettus Research LLC
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#include "e100_impl.hpp"
-#include "e100_regs.hpp"
-#include <uhd/utils/msg.hpp>
-#include <uhd/exception.hpp>
-#include <uhd/usrp/dsp_utils.hpp>
-#include <uhd/usrp/misc_utils.hpp>
-#include <uhd/usrp/mboard_props.hpp>
-#include <boost/bind.hpp>
-
-using namespace uhd;
-using namespace uhd::usrp;
-
-/***********************************************************************
- * Mboard Initialization
- **********************************************************************/
-void e100_impl::mboard_init(void){
- _mboard_proxy = wax_obj_proxy::make(
- boost::bind(&e100_impl::mboard_get, this, _1, _2),
- boost::bind(&e100_impl::mboard_set, this, _1, _2)
- );
-
- //init the clock config
- _clock_config = clock_config_t::internal();
- update_clock_config();
-}
-
-void e100_impl::update_clock_config(void){
- boost::uint32_t pps_flags = 0;
-
- //translate pps polarity enums
- switch(_clock_config.pps_polarity){
- case clock_config_t::PPS_POS: pps_flags |= E100_FLAG_TIME64_PPS_POSEDGE; break;
- case clock_config_t::PPS_NEG: pps_flags |= E100_FLAG_TIME64_PPS_NEGEDGE; break;
- default: throw uhd::value_error("unhandled clock configuration pps polarity");
- }
-
- //set the pps flags
- _iface->poke32(E100_REG_TIME64_FLAGS, pps_flags);
-
- //clock source ref 10mhz
- switch(_clock_config.ref_source){
- case clock_config_t::REF_AUTO: _clock_ctrl->use_auto_ref(); break;
- case clock_config_t::REF_INT: _clock_ctrl->use_internal_ref(); break;
- case clock_config_t::REF_SMA: _clock_ctrl->use_auto_ref(); break;
- default: throw uhd::value_error("unhandled clock configuration ref source");
- }
-}
-
-/***********************************************************************
- * Mboard Get
- **********************************************************************/
-void e100_impl::mboard_get(const wax::obj &key_, wax::obj &val){
- named_prop_t key = named_prop_t::extract(key_);
- static const std::string dboard_name = "A";
-
- //handle the get request conditioned on the key
- switch(key.as<mboard_prop_t>()){
- case MBOARD_PROP_NAME:
- val = std::string(_iface->get_cname() + " mboard");
- return;
-
- case MBOARD_PROP_OTHERS:
- val = prop_names_t();
- return;
-
- case MBOARD_PROP_RX_DBOARD:
- UHD_ASSERT_THROW(key.name == dboard_name);
- val = _rx_dboard_proxy->get_link();
- return;
-
- case MBOARD_PROP_RX_DBOARD_NAMES:
- val = prop_names_t(1, dboard_name);
- return;
-
- case MBOARD_PROP_TX_DBOARD:
- UHD_ASSERT_THROW(key.name == dboard_name);
- val = _tx_dboard_proxy->get_link();
- return;
-
- case MBOARD_PROP_TX_DBOARD_NAMES:
- val = prop_names_t(1, dboard_name);
- return;
-
- case MBOARD_PROP_RX_DSP:
- val = _rx_dsp_proxies[key.name]->get_link();
- return;
-
- case MBOARD_PROP_RX_DSP_NAMES:
- val = _rx_dsp_proxies.keys();
- return;
-
- case MBOARD_PROP_TX_DSP:
- val = _tx_dsp_proxies[key.name]->get_link();
- return;
-
- case MBOARD_PROP_TX_DSP_NAMES:
- val = _tx_dsp_proxies.keys();
- return;
-
- case MBOARD_PROP_CLOCK_CONFIG:
- val = _clock_config;
- return;
-
- case MBOARD_PROP_RX_SUBDEV_SPEC:
- val = _rx_subdev_spec;
- return;
-
- case MBOARD_PROP_TX_SUBDEV_SPEC:
- val = _tx_subdev_spec;
- return;
-
- case MBOARD_PROP_EEPROM_MAP:
- val = _iface->mb_eeprom;
- return;
-
- case MBOARD_PROP_TIME_NOW: while(true){
- uint32_t secs = _iface->peek32(E100_REG_RB_TIME_NOW_SECS);
- uint32_t ticks = _iface->peek32(E100_REG_RB_TIME_NOW_TICKS);
- if (secs != _iface->peek32(E100_REG_RB_TIME_NOW_SECS)) continue;
- val = time_spec_t(secs, ticks, _clock_ctrl->get_fpga_clock_rate());
- return;
- }
-
- case MBOARD_PROP_TIME_PPS: while(true){
- uint32_t secs = _iface->peek32(E100_REG_RB_TIME_PPS_SECS);
- uint32_t ticks = _iface->peek32(E100_REG_RB_TIME_PPS_TICKS);
- if (secs != _iface->peek32(E100_REG_RB_TIME_PPS_SECS)) continue;
- val = time_spec_t(secs, ticks, _clock_ctrl->get_fpga_clock_rate());
- return;
- }
-
- case MBOARD_PROP_CLOCK_RATE:
- val = _clock_ctrl->get_fpga_clock_rate();
- return;
-
- default: UHD_THROW_PROP_GET_ERROR();
- }
-}
-
-/***********************************************************************
- * Mboard Set
- **********************************************************************/
-void e100_impl::mboard_set(const wax::obj &key, const wax::obj &val){
- //handle the get request conditioned on the key
- switch(key.as<mboard_prop_t>()){
-
- case MBOARD_PROP_TIME_NOW:
- case MBOARD_PROP_TIME_PPS:{
- time_spec_t time_spec = val.as<time_spec_t>();
- _iface->poke32(E100_REG_TIME64_TICKS, time_spec.get_tick_count(_clock_ctrl->get_fpga_clock_rate()));
- boost::uint32_t imm_flags = (key.as<mboard_prop_t>() == MBOARD_PROP_TIME_NOW)? 1 : 0;
- _iface->poke32(E100_REG_TIME64_IMM, imm_flags);
- _iface->poke32(E100_REG_TIME64_SECS, time_spec.get_full_secs());
- }
- return;
-
- case MBOARD_PROP_RX_SUBDEV_SPEC:{
- _rx_subdev_spec = val.as<subdev_spec_t>();
- verify_rx_subdev_spec(_rx_subdev_spec, _mboard_proxy->get_link());
- //sanity check
- UHD_ASSERT_THROW(_rx_subdev_spec.size() <= E100_NUM_RX_DSPS);
-
- //determine frontend swap IQ from the first channel
- bool fe_swap_iq = false;
- switch(_dboard_manager->get_rx_subdev(_rx_subdev_spec.at(0).sd_name)[SUBDEV_PROP_CONNECTION].as<subdev_conn_t>()){
- case SUBDEV_CONN_COMPLEX_QI:
- case SUBDEV_CONN_REAL_Q:
- fe_swap_iq = true;
- break;
- default: fe_swap_iq = false;
- }
- _iface->poke32(E100_REG_RX_FE_SWAP_IQ, fe_swap_iq? 1 : 0);
-
- //set the dsp mux for each channel
- for (size_t i = 0; i < _rx_subdev_spec.size(); i++){
- bool iq_swap = false, real_mode = false;
- switch(_dboard_manager->get_rx_subdev(_rx_subdev_spec.at(i).sd_name)[SUBDEV_PROP_CONNECTION].as<subdev_conn_t>()){
- case SUBDEV_CONN_COMPLEX_IQ:
- iq_swap = fe_swap_iq;
- real_mode = false;
- break;
- case SUBDEV_CONN_COMPLEX_QI:
- iq_swap = not fe_swap_iq;
- real_mode = false;
- break;
- case SUBDEV_CONN_REAL_I:
- iq_swap = fe_swap_iq;
- real_mode = true;
- break;
- case SUBDEV_CONN_REAL_Q:
- iq_swap = not fe_swap_iq;
- real_mode = true;
- break;
- }
- _iface->poke32(E100_REG_DSP_RX_MUX(i),
- (iq_swap? E100_FLAG_DSP_RX_MUX_SWAP_IQ : 0) |
- (real_mode? E100_FLAG_DSP_RX_MUX_REAL_MODE : 0)
- );
- }
- this->update_xport_channel_mapping();
- }return;
-
- case MBOARD_PROP_TX_SUBDEV_SPEC:
- _tx_subdev_spec = val.as<subdev_spec_t>();
- verify_tx_subdev_spec(_tx_subdev_spec, _mboard_proxy->get_link());
- //sanity check
- UHD_ASSERT_THROW(_tx_subdev_spec.size() <= E100_NUM_TX_DSPS);
- //set the mux
- _iface->poke32(E100_REG_TX_FE_MUX, dsp_type1::calc_tx_mux_word(
- _dboard_manager->get_tx_subdev(_tx_subdev_spec.front().sd_name)[SUBDEV_PROP_CONNECTION].as<subdev_conn_t>()
- ));
- return;
-
- case MBOARD_PROP_EEPROM_MAP:
- // Step1: commit the map, writing only those values set.
- // Step2: readback the entire eeprom map into the iface.
- val.as<mboard_eeprom_t>().commit(_iface->get_i2c_dev_iface(), mboard_eeprom_t::MAP_E100);
- _iface->mb_eeprom = mboard_eeprom_t(_iface->get_i2c_dev_iface(), mboard_eeprom_t::MAP_E100);
- return;
-
- case MBOARD_PROP_CLOCK_CONFIG:
- _clock_config = val.as<clock_config_t>();
- update_clock_config();
- return;
-
- case MBOARD_PROP_CLOCK_RATE:
- UHD_MSG(warning)
- << "I see that you are setting the master clock rate from the API.\n"
- << "You may pass this into the device address as master_clock_rate=<rate>.\n"
- << "This way, the clock rate is guaranteed to be initialized first.\n"
- << "See the application notes for USRP-E1XX for further instructions.\n"
- ;
- _clock_ctrl->set_fpga_clock_rate(val.as<double>());
- this->update_xport_channel_mapping();
- return;
-
- default: UHD_THROW_PROP_SET_ERROR();
- }
-}