diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-03-08 09:28:55 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:03:44 -0800 |
commit | 1a4348038d0eb57d53475074dca49e8192aeb2d7 (patch) | |
tree | 04c8e87fa9c95d2702aac410f6fb271461acb9bb /mpm/lib/spi/spi_lock.h | |
parent | fc8cd827f6b16b9c8c354a216889e6a9d7f37456 (diff) | |
download | uhd-1a4348038d0eb57d53475074dca49e8192aeb2d7.tar.gz uhd-1a4348038d0eb57d53475074dca49e8192aeb2d7.tar.bz2 uhd-1a4348038d0eb57d53475074dca49e8192aeb2d7.zip |
Initial commit for N3xx development.
- Creates mpm/ subdirectory
- First pass at hardware daemon/MPM
- New code for LMK04828, AD9371
- spidev integration
Contributions by:
Martin Braun <martin.braun@ettus.com>
Derek Kozel <derek.kozel@ettus.com>
Mark Meserve <mark.meserve@ni.com>
Andrej Rode <andrej.rode@ettus.com>
Diffstat (limited to 'mpm/lib/spi/spi_lock.h')
-rw-r--r-- | mpm/lib/spi/spi_lock.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/mpm/lib/spi/spi_lock.h b/mpm/lib/spi/spi_lock.h new file mode 100644 index 000000000..55ddb0baf --- /dev/null +++ b/mpm/lib/spi/spi_lock.h @@ -0,0 +1,25 @@ +#pragma once + +#include <boost/noncopyable.hpp> +#include <memory> +#include <mutex> + +class spi_lock : public boost::noncopyable +{ +public: + using sptr = std::shared_ptr<spi_lock>; + static sptr make(uint8_t spidev_index); + + spi_lock(uint8_t spidev_index); + + uint8_t get_spidev() const; + +private: + const uint8_t spidev_index; + + // BasicLockable implementation for lock_guard + mutable std::mutex spi_mutex; + friend class std::lock_guard<spi_lock>; + void lock(); + void unlock(); +};
\ No newline at end of file |