aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/x300/x300_radio_mbc_iface.hpp
blob: cb0d99306c76c9980dd6411637cab76c2f79d8a1 (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
58
59
60
61
62
63
64
//
// Copyright 2019 Ettus Research, a National Instruments Brand
//
// SPDX-License-Identifier: GPL-3.0-or-later
//

#ifndef INCLUDED_LIBUHD_X300_MBC_IFACE_HPP
#define INCLUDED_LIBUHD_X300_MBC_IFACE_HPP

#include <uhd/types/time_spec.hpp>
#include <cstddef>
#include <string>

namespace uhd { namespace usrp { namespace x300 {

class x300_radio_mbc_iface
{
public:
    virtual ~x300_radio_mbc_iface() {}

    //! Return the current output of the ADC via a register
    virtual uint32_t get_adc_rx_word() = 0;

    //! Set ADC test word (see x300_adc_ctrl::set_test_word())
    virtual void set_adc_test_word(
        const std::string& patterna, const std::string& patternb) = 0;

    //! Enable or disable the ADC checker
    virtual void set_adc_checker_enabled(const bool enb) = 0;

    //! Query ADC checker lock bit
    virtual bool get_adc_checker_locked(const bool I) = 0;

    //! Return current ADC error status
    virtual uint32_t get_adc_checker_error_code(const bool I) = 0;

    /*! Runs some ADC self tests
     *
     * - First, the ADC gets set to produce a constant value and we see if it
     *   reaches the FPGA
     * - Then, the ADC is put into ramp mode, and we see if we read the ramp
     *   with no errors
     *
     * \param ramp_time_ms The duration of the ramp test. Increasing the test
     *                     will increase the probability of a bit error.
     * \throws uhd::runtime_error if one or more bit errors occurred
     */
    virtual void self_test_adc(const uint32_t ramp_time_ms) = 0;

    //! Call sync() on the DAC object
    virtual void sync_dac() = 0;

    //! Set the FRAMEP/N sync pulse. If time is not zero, it will do so at the
    // given time.
    virtual void set_dac_sync(
        const bool enb, const uhd::time_spec_t& time = uhd::time_spec_t(0.0)) = 0;

    //! Call verify_sync() on the DAC object
    virtual void dac_verify_sync() = 0;
};

}}} // namespace uhd::usrp::x300

#endif /* INCLUDED_LIBUHD_X300_MBC_IFACE_HPP */