umtrx: add spi/i2c/wishbone interfaces into the ptree

This commit is contained in:
Josh Blum
2014-06-24 11:05:45 -04:00
parent 1a1f7401ea
commit 4b137310e1
2 changed files with 8 additions and 0 deletions

View File

@@ -146,6 +146,11 @@ umtrx_impl::umtrx_impl(const device_addr_t &device_addr)
_tree->create<std::string>(mb_path / "name").set(_iface->get_cname());
_tree->create<std::string>(mb_path / "fw_version").set(_iface->get_fw_version_string());
//get access to the various interfaces
_tree->create<uhd::wb_iface::sptr>(mb_path / "wb_iface").set(_iface);
_tree->create<uhd::spi_iface::sptr>(mb_path / "spi_iface").set(_iface);
_tree->create<uhd::i2c_iface::sptr>(mb_path / "i2c_iface").set(_iface);
//check the fpga compatibility number
const boost::uint32_t fpga_compat_num = _iface->peek32(U2_REG_COMPAT_NUM_RB);
const boost::uint16_t fpga_major = fpga_compat_num >> 16, fpga_minor = fpga_compat_num & 0xffff;

View File

@@ -172,6 +172,9 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
uhd::usrp::multi_usrp::sptr usrp = uhd::usrp::multi_usrp::make(args);
std::cout << boost::format("Using Device: %s") % usrp->get_pp_string() << std::endl;
//access the i2c interface
uhd::i2c_iface::sptr i2c = usrp->get_device()->get_tree()->access<uhd::i2c_iface::sptr>("/mboards/0/i2c_iface").get();
//set the tx sample rate
std::cout << boost::format("Setting TX Rate: %f Msps...") % (tx_rate/1e6) << std::endl;
usrp->set_tx_rate(tx_rate);