diff options
author | Derek Kozel <derek.kozel@ettus.com> | 2018-04-30 15:04:35 +0100 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-05-03 11:30:34 -0700 |
commit | 3615873feebe2d86f38e45acafb0265ea7246916 (patch) | |
tree | 732aca8f7ed0aa6a238d80184d4588eb18bda54b /host/lib/include/uhdlib | |
parent | 3a4073799db9cf314b57eb20bb8f8fc085a76631 (diff) | |
download | uhd-3615873feebe2d86f38e45acafb0265ea7246916.tar.gz uhd-3615873feebe2d86f38e45acafb0265ea7246916.tar.bz2 uhd-3615873feebe2d86f38e45acafb0265ea7246916.zip |
uhd: Added LMX2592 driver
Diffstat (limited to 'host/lib/include/uhdlib')
-rw-r--r-- | host/lib/include/uhdlib/usrp/common/lmx2592.hpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/host/lib/include/uhdlib/usrp/common/lmx2592.hpp b/host/lib/include/uhdlib/usrp/common/lmx2592.hpp new file mode 100644 index 000000000..0e86d82aa --- /dev/null +++ b/host/lib/include/uhdlib/usrp/common/lmx2592.hpp @@ -0,0 +1,55 @@ +// +// Copyright 2018 Ettus Research, A National Instruments Company +// +// SPDX-License-Identifier: GPL-3.0 +// + +#ifndef INCLUDED_LMX2592_HPP +#define INCLUDED_LMX2592_HPP + +#include "lmx2592_regs.hpp" +#include <uhd/utils/log.hpp> +#include <uhd/utils/math.hpp> +#include <uhd/utils/safe_call.hpp> +#include <boost/format.hpp> +#include <boost/function.hpp> +#include <boost/math/common_factor_rt.hpp> //gcd +#include <algorithm> +#include <cstdint> +#include <utility> +#include <vector> + +class lmx2592_iface { +public: + typedef std::shared_ptr<lmx2592_iface> sptr; + + //! SPI write functor: Can take a SPI transaction and clock it out + using write_spi_t = std::function<void(uint32_t)>; + + //! SPI read functor: Return SPI + using read_spi_t = std::function<uint32_t(uint32_t)>; + + static sptr make(write_spi_t write, read_spi_t read); + + virtual ~lmx2592_iface() = default; + + enum output_t { RF_OUTPUT_A, RF_OUTPUT_B }; + + enum mash_order_t { INT_N, FIRST, SECOND, THIRD, FOURTH }; + + virtual double set_frequency(double target_freq) = 0; + + virtual void set_mash_order(mash_order_t mash_order) = 0; + + virtual void set_reference_frequency(double ref_freq) = 0; + + virtual void set_output_power(output_t output, unsigned int power) = 0; + + virtual void set_output_enable(output_t output, bool enable) = 0; + + virtual bool get_lock_status() = 0; + + virtual void commit() = 0; +}; + +#endif // INCLUDED_LMX2592_HPP |