mirror of
https://github.com/saymrwulf/uhd.git
synced 2026-05-16 21:10:10 +00:00
cores: Added shutdown option to SPI core
This commit is contained in:
parent
560e664199
commit
0433e740bc
2 changed files with 23 additions and 3 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Reference in a new issue