aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/include/uhdlib/usrp/common/lmx2592.hpp
blob: 9ee3f944fd58682358b507efd79b225498ade946 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// Copyright 2018 Ettus Research, A National Instruments Company
//
// SPDX-License-Identifier: GPL-3.0-or-later
//

#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 <functional>
#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,
        const bool spur_dodging,
        const double spur_dodging_threshold) = 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