aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/include/uhdlib/usrp
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2019-06-04 22:54:25 -0700
committerMartin Braun <martin.braun@ettus.com>2019-11-26 11:49:25 -0800
commit7fb8523c935cbcda7fd0dbcbad0ac8c2e6dd1fc7 (patch)
tree43bf48a0c4686c2607d1fbe0d799d9e376231112 /host/lib/include/uhdlib/usrp
parent97b004131ad7cdd1daaac091bce1dcf6fd12ccaa (diff)
downloaduhd-7fb8523c935cbcda7fd0dbcbad0ac8c2e6dd1fc7.tar.gz
uhd-7fb8523c935cbcda7fd0dbcbad0ac8c2e6dd1fc7.tar.bz2
uhd-7fb8523c935cbcda7fd0dbcbad0ac8c2e6dd1fc7.zip
lib: cores: Adapt spi_core_3000 for use with register_iface
Removes the requirement for a wb_iface, and also the requirement for regs to be 4 addresses apart.
Diffstat (limited to 'host/lib/include/uhdlib/usrp')
-rw-r--r--host/lib/include/uhdlib/usrp/cores/spi_core_3000.hpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/host/lib/include/uhdlib/usrp/cores/spi_core_3000.hpp b/host/lib/include/uhdlib/usrp/cores/spi_core_3000.hpp
index 81ea05a37..36486b5a1 100644
--- a/host/lib/include/uhdlib/usrp/cores/spi_core_3000.hpp
+++ b/host/lib/include/uhdlib/usrp/cores/spi_core_3000.hpp
@@ -13,17 +13,28 @@
#include <uhd/utils/noncopyable.hpp>
#include <uhd/types/wb_iface.hpp>
#include <boost/shared_ptr.hpp>
+#include <memory>
+#include <functional>
class spi_core_3000 : uhd::noncopyable, public uhd::spi_iface
{
public:
- typedef boost::shared_ptr<spi_core_3000> sptr;
+ using sptr = boost::shared_ptr<spi_core_3000>;
+ using poke32_fn_t = std::function<void(uint32_t, uint32_t)>;
+ using peek32_fn_t = std::function<uint32_t(uint32_t)>;
virtual ~spi_core_3000(void) = 0;
//! makes a new spi core from iface and slave base
static sptr make(uhd::wb_iface::sptr iface, const size_t base, const size_t readback);
+ //! makes a new spi core from register iface and slave base
+ static sptr make(poke32_fn_t&& poke32_fn,
+ peek32_fn_t&& peek32_fn,
+ const size_t base,
+ const size_t reg_offset,
+ const size_t readback);
+
//! Set the spi clock divider to something usable
virtual void set_divider(const double div) = 0;