aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/n310/periph_manager.hpp
blob: 3df9aa72b1cb71a9c26b557c98cc734aec6c52aa (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
//
// Copyright 2017 Ettus Research (National Instruments)
//
// 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/>.
//

#pragma once

#include "mpm/spi/spidev_iface.hpp"
#include "lmk/lmk04828_spi_iface.hpp"
#include <memory>

namespace mpm { namespace n3xx {
        /*
        class dboard_periph_manager
        {
            //....
        };
        */
    /**************************************************************************
     * Daughterboard peripherals
     *************************************************************************/

    /*! Encapsulates all peripherals stored on the regular N300/N310
     *  daughterboard.
     */
    class n3xx_dboard_periph_manager// : public dboard_periph_manager
    {
    public:
        n3xx_dboard_periph_manager(
                uhd::spi_iface::sptr lmk_spi
            //  uhd::spi_iface::sptr myk_spi
            //  uhd::spi_iface::sptr cpld_spi

            );

        /*! Return a reference to the clock chip
         */
        lmk04828_iface::sptr get_clock_gen();

    private:
        //ad937x_ctrl::sptr _rfic;
        //cpld control
        lmk04828_iface::sptr _clock_gen;
        std::shared_ptr<lmk04828_spi_iface> _clock_spi;
    };

    /**************************************************************************
     * Motherboard peripherals
     *************************************************************************/
    class periph_manager
    {
    public:

        periph_manager(std::string spi_path): dboard_A_manager(mpm::spi::spidev_iface::make(spi_path))
        {

        };

        n3xx_dboard_periph_manager get_dboard_A();
        lmk04828_iface::sptr get_clock_gen();

        // virtual void set_clock_source();

    private:
        n3xx_dboard_periph_manager dboard_A_manager;
  //      n3xx_dboard_periph_manager dboard_B_manager;
    };

}}; /* namespace mpm::n310 */