aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/n230/n230_clk_pps_ctrl.hpp
blob: 3e0a21e044cc3c13f454d3dd2defed4a703dbd6c (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//
// Copyright 2013-2014 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
//

#ifndef INCLUDED_N230_CLK_PPS_CTRL_HPP
#define INCLUDED_N230_CLK_PPS_CTRL_HPP

#include "time_core_3000.hpp"
#include "ad9361_ctrl.hpp"
#include <uhd/types/sensors.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
#include <vector>
#include "n230_cores.hpp"
#include "n230_fpga_defs.h"

namespace uhd { namespace usrp { namespace n230 {

class n230_clk_pps_ctrl : boost::noncopyable
{
public:
    typedef boost::shared_ptr<n230_clk_pps_ctrl> sptr;

    static sptr make(
        ad9361_ctrl::sptr codec_ctrl,
        n230_ref_pll_ctrl::sptr ref_pll_ctrl,
        fpga::core_misc_reg_t& core_misc_reg,
        fpga::core_pps_sel_reg_t& core_pps_sel_reg,
        fpga::core_status_reg_t& core_status_reg,
        const std::vector<time_core_3000::sptr>& time_cores);

    virtual ~n230_clk_pps_ctrl() {}

    /***********************************************************************
     * Tick Rate
     **********************************************************************/
    /*! Set the master clock rate of the device.
     * \return the clock frequency in Hz
     */
    virtual double set_tick_rate(const double rate) = 0;

    /*! Get the master clock rate of the device.
     * \return the clock frequency in Hz
     */
    virtual double get_tick_rate() = 0;

    /***********************************************************************
     * Reference clock
     **********************************************************************/
    /*! Set the reference clock source of the device.
     */
    virtual void set_clock_source(const std::string &source) = 0;

    /*! Get the reference clock source of the device.
     */
    virtual const std::string& get_clock_source() = 0;

    /*! Get the reference clock lock status.
     */
    virtual uhd::sensor_value_t get_ref_locked() = 0;

    /***********************************************************************
     * Time source
     **********************************************************************/
    /*! Set the time source of the device.
     */
    virtual void set_pps_source(const std::string &source) = 0;

    /*! Get the reference clock source of the device.
     */
    virtual const std::string& get_pps_source() = 0;
};

}}} //namespace

#endif /* INCLUDED_N230_CLK_PPS_CTRL_HPP */