aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/n230/n230_impl.hpp
blob: b644dd8a37432c5ad3b6f29ab85a2f1078aaff45 (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
//
// Copyright 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_IMPL_HPP
#define INCLUDED_N230_IMPL_HPP

#include <uhd/property_tree.hpp>
#include <uhd/device.hpp>
#include <uhd/usrp/subdev_spec.hpp>

#include "n230_device_args.hpp"
#include "n230_eeprom_manager.hpp"
#include "n230_resource_manager.hpp"
#include "n230_stream_manager.hpp"
#include "recv_packet_demuxer_3000.hpp"

namespace uhd { namespace usrp { namespace n230 {

class n230_impl : public uhd::device
{
public: //Functions
    // ctor and dtor
    n230_impl(const uhd::device_addr_t& device_addr);
    virtual ~n230_impl(void);

    //---------------------------------------------------------------------
    // uhd::device interface
    //
    static sptr make(const uhd::device_addr_t &hint, size_t which = 0);

    //! Make a new receive streamer from the streamer arguments
    virtual uhd::rx_streamer::sptr get_rx_stream(const uhd::stream_args_t &args);

    //! Make a new transmit streamer from the streamer arguments
    virtual uhd::tx_streamer::sptr get_tx_stream(const uhd::stream_args_t &args);

    //!Receive and asynchronous message from the device.
    virtual bool recv_async_msg(uhd::async_metadata_t &async_metadata, double timeout = 0.1);

    //!Registration methods the discovery and factory system.
    //[static void register_device(const find_t &find, const make_t &make)]
    static uhd::device_addrs_t n230_find(const uhd::device_addr_t &hint);
    static uhd::device::sptr n230_make(const uhd::device_addr_t &device_addr);
    //
    //---------------------------------------------------------------------

    typedef uhd::transport::bounded_buffer<uhd::async_metadata_t> async_md_type;

private:    //Functions
    void _initialize_property_tree(const fs_path& mb_path);
    void _initialize_radio_properties(const fs_path& mb_path, size_t instance);

    void _update_rx_subdev_spec(const uhd::usrp::subdev_spec_t &);
    void _update_tx_subdev_spec(const uhd::usrp::subdev_spec_t &);
    void _check_time_source(std::string);
    void _check_clock_source(std::string);

private:    //Classes and Members
    n230_device_args_t                        _dev_args;
    boost::shared_ptr<n230_resource_manager>  _resource_mgr;
    boost::shared_ptr<n230_eeprom_manager>    _eeprom_mgr;
    boost::shared_ptr<n230_stream_manager>    _stream_mgr;
};

}}} //namespace

#endif /* INCLUDED_N230_IMPL_HPP */