umsel: device args for enabling umsel2 and verbose

This commit is contained in:
Josh Blum
2015-12-21 15:12:23 -08:00
parent 09f323dc3c
commit f385a4355a
3 changed files with 13 additions and 10 deletions

View File

@@ -22,8 +22,6 @@
#include <cmath> #include <cmath>
#include <map> #include <map>
static const bool verbose = true;
static const int REG0_NVALUE_SHIFT = 4; static const int REG0_NVALUE_SHIFT = 4;
static const int REG0_NVALUE_MASK = 0xffff; static const int REG0_NVALUE_MASK = 0xffff;
static const int REG0_PRESCALER_SHIFT = 20; static const int REG0_PRESCALER_SHIFT = 20;
@@ -108,8 +106,8 @@ class umsel2_ctrl_impl : public umsel2_ctrl
{ {
public: public:
umsel2_ctrl_impl(uhd::wb_iface::sptr ctrl, uhd::spi_iface::sptr spiface, const double ref_clock): umsel2_ctrl_impl(uhd::wb_iface::sptr ctrl, uhd::spi_iface::sptr spiface, const double ref_clock, const bool verbose):
_ctrl(ctrl), _spiface(spiface), _ref_clock(ref_clock) _ctrl(ctrl), _spiface(spiface), _ref_clock(ref_clock), verbose(verbose)
{ {
this->init_synth(SPI_SS_AUX1); this->init_synth(SPI_SS_AUX1);
this->init_synth(SPI_SS_AUX2); this->init_synth(SPI_SS_AUX2);
@@ -471,9 +469,10 @@ private:
uhd::spi_iface::sptr _spiface; uhd::spi_iface::sptr _spiface;
const double _ref_clock; const double _ref_clock;
std::map<int, std::map<int, int> > _regs; std::map<int, std::map<int, int> > _regs;
const bool verbose;
}; };
umsel2_ctrl::sptr umsel2_ctrl::make(uhd::wb_iface::sptr ctrl, uhd::spi_iface::sptr spiface, const double ref_clock) umsel2_ctrl::sptr umsel2_ctrl::make(uhd::wb_iface::sptr ctrl, uhd::spi_iface::sptr spiface, const double ref_clock, const bool verbose)
{ {
return umsel2_ctrl::sptr(new umsel2_ctrl_impl(ctrl, spiface, ref_clock)); return umsel2_ctrl::sptr(new umsel2_ctrl_impl(ctrl, spiface, ref_clock, verbose));
} }

View File

@@ -35,7 +35,7 @@ class umsel2_ctrl
public: public:
typedef boost::shared_ptr<umsel2_ctrl> sptr; typedef boost::shared_ptr<umsel2_ctrl> sptr;
static sptr make(uhd::wb_iface::sptr ctrl, uhd::spi_iface::sptr spiface, const double ref_clock); static sptr make(uhd::wb_iface::sptr ctrl, uhd::spi_iface::sptr spiface, const double ref_clock, const bool verbose);
/*! /*!
* Query the tune range. * Query the tune range.

View File

@@ -273,9 +273,13 @@ umtrx_impl::umtrx_impl(const device_addr_t &device_addr)
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// setup umsel2 control when present // setup umsel2 control when present
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
//TODO delect umsel2 and setup _umsel2 sptr... const std::string detect_umsel = device_addr.get("umsel", "off");
//will be null when not available if (detect_umsel != "off")
_umsel2 = umsel2_ctrl::make(_ctrl/*peek*/, _ctrl/*spi*/, this->get_master_clock_rate()); {
//TODO delect umsel2 automatically with I2C communication
const bool umsel_verbose = device_addr.has_key("umsel_verbose");
_umsel2 = umsel2_ctrl::make(_ctrl/*peek*/, _ctrl/*spi*/, this->get_master_clock_rate(), umsel_verbose);
}
//register lock detect for umsel2 //register lock detect for umsel2
if (_umsel2) if (_umsel2)