aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorAshish Chaudhari <ashish@ettus.com>2015-09-30 14:53:35 -0700
committerAshish Chaudhari <ashish@ettus.com>2016-02-16 16:19:01 -0800
commitb26380043719712ef55694076f66bb9429229ef4 (patch)
tree1b1ec471e64f6a1178199a7b8d23c4b3a06ea3e7 /host/lib
parent1fd73de7d40459f231c969f27ef63dc62f2b5e82 (diff)
downloaduhd-b26380043719712ef55694076f66bb9429229ef4.tar.gz
uhd-b26380043719712ef55694076f66bb9429229ef4.tar.bz2
uhd-b26380043719712ef55694076f66bb9429229ef4.zip
dboard: Added restricted dboard registration capability
- Moved dboard iface initialization to dboard_manager - Added a restricted register function. Restricted dboards don't expose their control iface in the property tree
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/usrp/b100/b100_impl.cpp5
-rw-r--r--host/lib/usrp/b100/b100_impl.hpp1
-rw-r--r--host/lib/usrp/dboard_manager.cpp37
-rw-r--r--host/lib/usrp/e100/e100_impl.cpp5
-rw-r--r--host/lib/usrp/e100/e100_impl.hpp1
-rw-r--r--host/lib/usrp/usrp1/usrp1_impl.cpp5
-rw-r--r--host/lib/usrp/usrp1/usrp1_impl.hpp1
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp5
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.hpp1
-rw-r--r--host/lib/usrp/x300/x300_impl.cpp4
-rw-r--r--host/lib/usrp/x300/x300_impl.hpp1
11 files changed, 42 insertions, 24 deletions
diff --git a/host/lib/usrp/b100/b100_impl.cpp b/host/lib/usrp/b100/b100_impl.cpp
index 793387fca..eec9f0e9a 100644
--- a/host/lib/usrp/b100/b100_impl.cpp
+++ b/host/lib/usrp/b100/b100_impl.cpp
@@ -472,11 +472,10 @@ b100_impl::b100_impl(const device_addr_t &device_addr){
.add_coerced_subscriber(boost::bind(&b100_impl::set_db_eeprom, this, "gdb", _1));
//create a new dboard interface and manager
- _dboard_iface = make_b100_dboard_iface(_fifo_ctrl, _fpga_i2c_ctrl, _fifo_ctrl/*spi*/, _clock_ctrl, _codec_ctrl);
- _tree->create<dboard_iface::sptr>(mb_path / "dboards/A/iface").set(_dboard_iface);
_dboard_manager = dboard_manager::make(
rx_db_eeprom.id, tx_db_eeprom.id, gdb_eeprom.id,
- _dboard_iface, _tree->subtree(mb_path / "dboards/A")
+ make_b100_dboard_iface(_fifo_ctrl, _fpga_i2c_ctrl, _fifo_ctrl/*spi*/, _clock_ctrl, _codec_ctrl),
+ _tree->subtree(mb_path / "dboards/A")
);
//bind frontend corrections to the dboard freq props
diff --git a/host/lib/usrp/b100/b100_impl.hpp b/host/lib/usrp/b100/b100_impl.hpp
index 5a8f70d73..7f37030d2 100644
--- a/host/lib/usrp/b100/b100_impl.hpp
+++ b/host/lib/usrp/b100/b100_impl.hpp
@@ -126,7 +126,6 @@ private:
//dboard stuff
uhd::usrp::dboard_manager::sptr _dboard_manager;
- uhd::usrp::dboard_iface::sptr _dboard_iface;
bool _ignore_cal_file;
std::vector<boost::weak_ptr<uhd::rx_streamer> > _rx_streamers;
diff --git a/host/lib/usrp/dboard_manager.cpp b/host/lib/usrp/dboard_manager.cpp
index 340c1d3f9..f904758c5 100644
--- a/host/lib/usrp/dboard_manager.cpp
+++ b/host/lib/usrp/dboard_manager.cpp
@@ -37,11 +37,11 @@ using namespace uhd::usrp;
**********************************************************************/
class dboard_key_t{
public:
- dboard_key_t(const dboard_id_t &id = dboard_id_t::none()):
- _rx_id(id), _tx_id(id), _xcvr(false){}
+ dboard_key_t(const dboard_id_t &id = dboard_id_t::none(), bool restricted = false):
+ _rx_id(id), _tx_id(id), _xcvr(false), _restricted(restricted) {}
- dboard_key_t(const dboard_id_t &rx_id, const dboard_id_t &tx_id):
- _rx_id(rx_id), _tx_id(tx_id), _xcvr(true){}
+ dboard_key_t(const dboard_id_t &rx_id, const dboard_id_t &tx_id, bool restricted = false):
+ _rx_id(rx_id), _tx_id(tx_id), _xcvr(true), _restricted(restricted) {}
dboard_id_t xx_id(void) const{
UHD_ASSERT_THROW(not this->is_xcvr());
@@ -62,9 +62,14 @@ public:
return this->_xcvr;
}
+ bool is_restricted(void) const{
+ return this->_restricted;
+ }
+
private:
dboard_id_t _rx_id, _tx_id;
bool _xcvr;
+ bool _restricted;
};
bool operator==(const dboard_key_t &lhs, const dboard_key_t &rhs){
@@ -125,6 +130,25 @@ void dboard_manager::register_dboard(
register_dboard_key(dboard_key_t(rx_dboard_id, tx_dboard_id), dboard_ctor, name, subdev_names);
}
+void dboard_manager::register_dboard_restricted(
+ const dboard_id_t &dboard_id,
+ dboard_ctor_t dboard_ctor,
+ const std::string &name,
+ const std::vector<std::string> &subdev_names
+){
+ register_dboard_key(dboard_key_t(dboard_id, true), dboard_ctor, name, subdev_names);
+}
+
+void dboard_manager::register_dboard_restricted(
+ const dboard_id_t &rx_dboard_id,
+ const dboard_id_t &tx_dboard_id,
+ dboard_ctor_t dboard_ctor,
+ const std::string &name,
+ const std::vector<std::string> &subdev_names
+){
+ register_dboard_key(dboard_key_t(rx_dboard_id, tx_dboard_id, true), dboard_ctor, name, subdev_names);
+}
+
std::string dboard_id_t::to_cname(void) const{
std::string cname;
BOOST_FOREACH(const dboard_key_t &key, get_id_to_args_map().keys()){
@@ -244,6 +268,11 @@ void dboard_manager_impl::init(
//initialize the gpio pins before creating subdevs
set_nice_dboard_if();
+ //conditionally register the dboard iface in the tree
+ if (not (rx_dboard_key.is_restricted() or tx_dboard_key.is_restricted() or xcvr_dboard_key.is_restricted())) {
+ subtree->create<dboard_iface::sptr>("iface").set(_iface);
+ }
+
//dboard constructor args
dboard_ctor_args_t db_ctor_args;
db_ctor_args.db_iface = _iface;
diff --git a/host/lib/usrp/e100/e100_impl.cpp b/host/lib/usrp/e100/e100_impl.cpp
index 0218e375d..1f8fe84cb 100644
--- a/host/lib/usrp/e100/e100_impl.cpp
+++ b/host/lib/usrp/e100/e100_impl.cpp
@@ -426,11 +426,10 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){
.add_coerced_subscriber(boost::bind(&e100_impl::set_db_eeprom, this, "gdb", _1));
//create a new dboard interface and manager
- _dboard_iface = make_e100_dboard_iface(_fifo_ctrl, _fpga_i2c_ctrl, _fifo_ctrl/*spi*/, _clock_ctrl, _codec_ctrl);
- _tree->create<dboard_iface::sptr>(mb_path / "dboards/A/iface").set(_dboard_iface);
_dboard_manager = dboard_manager::make(
rx_db_eeprom.id, tx_db_eeprom.id, gdb_eeprom.id,
- _dboard_iface, _tree->subtree(mb_path / "dboards/A")
+ make_e100_dboard_iface(_fifo_ctrl, _fpga_i2c_ctrl, _fifo_ctrl/*spi*/, _clock_ctrl, _codec_ctrl),
+ _tree->subtree(mb_path / "dboards/A")
);
//bind frontend corrections to the dboard freq props
diff --git a/host/lib/usrp/e100/e100_impl.hpp b/host/lib/usrp/e100/e100_impl.hpp
index d00668224..b05053f84 100644
--- a/host/lib/usrp/e100/e100_impl.hpp
+++ b/host/lib/usrp/e100/e100_impl.hpp
@@ -111,7 +111,6 @@ private:
//dboard stuff
uhd::usrp::dboard_manager::sptr _dboard_manager;
- uhd::usrp::dboard_iface::sptr _dboard_iface;
bool _ignore_cal_file;
std::vector<boost::weak_ptr<uhd::rx_streamer> > _rx_streamers;
diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp
index cd9b1356f..5e1a70a8f 100644
--- a/host/lib/usrp/usrp1/usrp1_impl.cpp
+++ b/host/lib/usrp/usrp1/usrp1_impl.cpp
@@ -374,15 +374,14 @@ usrp1_impl::usrp1_impl(const device_addr_t &device_addr){
.add_coerced_subscriber(boost::bind(&usrp1_impl::set_db_eeprom, this, db, "gdb", _1));
//create a new dboard interface and manager
- _dbc[db].dboard_iface = make_dboard_iface(
+ dboard_iface::sptr dboard_iface = make_dboard_iface(
_iface, _dbc[db].codec,
(db == "A")? DBOARD_SLOT_A : DBOARD_SLOT_B,
_master_clock_rate, rx_db_eeprom.id
);
- _tree->create<dboard_iface::sptr>(mb_path / "dboards" / db/ "iface").set(_dbc[db].dboard_iface);
_dbc[db].dboard_manager = dboard_manager::make(
rx_db_eeprom.id, tx_db_eeprom.id, gdb_eeprom.id,
- _dbc[db].dboard_iface, _tree->subtree(mb_path / "dboards" / db)
+ dboard_iface, _tree->subtree(mb_path / "dboards" / db)
);
//init the subdev specs if we have a dboard (wont leave this loop empty)
diff --git a/host/lib/usrp/usrp1/usrp1_impl.hpp b/host/lib/usrp/usrp1/usrp1_impl.hpp
index 012bc0794..da901bd6c 100644
--- a/host/lib/usrp/usrp1/usrp1_impl.hpp
+++ b/host/lib/usrp/usrp1/usrp1_impl.hpp
@@ -92,7 +92,6 @@ private:
uhd::transport::usb_zero_copy::sptr _data_transport;
struct db_container_type{
usrp1_codec_ctrl::sptr codec;
- uhd::usrp::dboard_iface::sptr dboard_iface;
uhd::usrp::dboard_manager::sptr dboard_manager;
};
uhd::dict<std::string, db_container_type> _dbc;
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index 938595838..b0c29392c 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -735,11 +735,10 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr) :
.add_coerced_subscriber(boost::bind(&usrp2_impl::set_db_eeprom, this, mb, "gdb", _1));
//create a new dboard interface and manager
- _mbc[mb].dboard_iface = make_usrp2_dboard_iface(_mbc[mb].wbiface, _mbc[mb].iface/*i2c*/, _mbc[mb].spiface, _mbc[mb].clock);
- _tree->create<dboard_iface::sptr>(mb_path / "dboards/A/iface").set(_mbc[mb].dboard_iface);
_mbc[mb].dboard_manager = dboard_manager::make(
rx_db_eeprom.id, tx_db_eeprom.id, gdb_eeprom.id,
- _mbc[mb].dboard_iface, _tree->subtree(mb_path / "dboards/A")
+ make_usrp2_dboard_iface(_mbc[mb].wbiface, _mbc[mb].iface/*i2c*/, _mbc[mb].spiface, _mbc[mb].clock),
+ _tree->subtree(mb_path / "dboards/A")
);
//bind frontend corrections to the dboard freq props
diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp
index 07cd98b4c..47fcec657 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.hpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.hpp
@@ -102,7 +102,6 @@ private:
uhd::transport::zero_copy_if::sptr tx_dsp_xport;
uhd::transport::zero_copy_if::sptr fifo_ctrl_xport;
uhd::usrp::dboard_manager::sptr dboard_manager;
- uhd::usrp::dboard_iface::sptr dboard_iface;
size_t rx_chan_occ, tx_chan_occ;
mb_container_type(void): rx_chan_occ(0), tx_chan_occ(0){}
};
diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp
index fc8e2090b..0491e7274 100644
--- a/host/lib/usrp/x300/x300_impl.cpp
+++ b/host/lib/usrp/x300/x300_impl.cpp
@@ -1075,15 +1075,13 @@ void x300_impl::setup_radio(const size_t mb_i, const std::string &slot_name, con
db_config.which_tx_clk = (slot_name == "A")? X300_CLOCK_WHICH_DB0_TX : X300_CLOCK_WHICH_DB1_TX;
db_config.dboard_slot = (slot_name == "A")? 0 : 1;
db_config.cmd_time_ctrl = perif.ctrl;
- _dboard_ifaces[db_path] = x300_make_dboard_iface(db_config);
//create a new dboard manager
- _tree->create<dboard_iface::sptr>(db_path / "iface").set(_dboard_ifaces[db_path]);
_dboard_managers[db_path] = dboard_manager::make(
mb.db_eeproms[X300_DB0_RX_EEPROM | j].id,
mb.db_eeproms[X300_DB0_TX_EEPROM | j].id,
mb.db_eeproms[X300_DB0_GDB_EEPROM | j].id,
- _dboard_ifaces[db_path],
+ x300_make_dboard_iface(db_config),
_tree->subtree(db_path)
);
diff --git a/host/lib/usrp/x300/x300_impl.hpp b/host/lib/usrp/x300/x300_impl.hpp
index 4de0344bf..c5e3af698 100644
--- a/host/lib/usrp/x300/x300_impl.hpp
+++ b/host/lib/usrp/x300/x300_impl.hpp
@@ -335,7 +335,6 @@ private:
////////////////////////////////////////////////////////////////////
uhd::dict<std::string, uhd::usrp::dboard_manager::sptr> _dboard_managers;
- uhd::dict<std::string, uhd::usrp::dboard_iface::sptr> _dboard_ifaces;
void set_rx_fe_corrections(const uhd::fs_path &mb_path, const std::string &fe_name, const double lo_freq);
void set_tx_fe_corrections(const uhd::fs_path &mb_path, const std::string &fe_name, const double lo_freq);