aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathon Pendlum <jonathon.pendlum@ettus.com>2016-07-29 22:38:20 -0700
committerMartin Braun <martin.braun@ettus.com>2016-08-09 10:21:52 -0700
commit0433e740bcab28e92f386a9af767710c7677a112 (patch)
treeed8d56f276600a5a7660f0f90dcc8387dc689787
parent560e664199c478c8d71861b386ef65c5580e614c (diff)
downloaduhd-0433e740bcab28e92f386a9af767710c7677a112.tar.gz
uhd-0433e740bcab28e92f386a9af767710c7677a112.tar.bz2
uhd-0433e740bcab28e92f386a9af767710c7677a112.zip
cores: Added shutdown option to SPI core
-rw-r--r--host/lib/usrp/cores/spi_core_3000.cpp19
-rw-r--r--host/lib/usrp/cores/spi_core_3000.hpp7
2 files changed, 23 insertions, 3 deletions
diff --git a/host/lib/usrp/cores/spi_core_3000.cpp b/host/lib/usrp/cores/spi_core_3000.cpp
index d33624b0d..01df71cec 100644
--- a/host/lib/usrp/cores/spi_core_3000.cpp
+++ b/host/lib/usrp/cores/spi_core_3000.cpp
@@ -20,9 +20,10 @@
#include <uhd/utils/msg.hpp>
#include <boost/thread/thread.hpp> //sleep
-#define SPI_DIV _base + 0
-#define SPI_CTRL _base + 4
-#define SPI_DATA _base + 8
+#define SPI_DIV _base + 0
+#define SPI_CTRL _base + 4
+#define SPI_DATA _base + 8
+#define SPI_SHUTDOWN _base + 12
using namespace uhd;
@@ -91,6 +92,17 @@ public:
return 0;
}
+ void set_shutdown(const bool shutdown)
+ {
+ _shutdown_cache = shutdown;
+ _iface->poke32(SPI_SHUTDOWN, _shutdown_cache);
+ }
+
+ bool get_shutdown()
+ {
+ return(_shutdown_cache);
+ }
+
void set_divider(const double div)
{
_div = size_t((div/2) - 0.5);
@@ -102,6 +114,7 @@ private:
const size_t _base;
const size_t _readback;
boost::uint32_t _ctrl_word_cache;
+ bool _shutdown_cache;
boost::mutex _mutex;
size_t _div;
size_t _divider_cache;
diff --git a/host/lib/usrp/cores/spi_core_3000.hpp b/host/lib/usrp/cores/spi_core_3000.hpp
index 6a439772e..8d5177196 100644
--- a/host/lib/usrp/cores/spi_core_3000.hpp
+++ b/host/lib/usrp/cores/spi_core_3000.hpp
@@ -36,6 +36,13 @@ public:
//! Set the spi clock divider to something usable
virtual void set_divider(const double div) = 0;
+
+ //! Place SPI core in shutdown mode. All attempted SPI transactions are dropped by
+ // the core.
+ virtual void set_shutdown(const bool shutdown) = 0;
+
+ //! Get state of shutdown register
+ virtual bool get_shutdown() = 0;
};
#endif /* INCLUDED_LIBUHD_USRP_SPI_CORE_3000_HPP */