Statistics
| Branch: | Tag: | Revision:

root / host / lib / usrp2 / usrp2_iface.hpp @ d9630428

History | View | Annotate | Download (2.53 KB)

1 d9630428 Josh Blum
//
2
// Copyright 2010-2011 Ettus Research LLC
3
//
4
// This program is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
//
17
18
#ifndef INCLUDED_USRP2_IFACE_HPP
19
#define INCLUDED_USRP2_IFACE_HPP
20
21
#include <uhd/transport/udp_simple.hpp>
22
#include <uhd/types/serial.hpp>
23
#include <uhd/usrp/mboard_eeprom.hpp>
24
#include <boost/shared_ptr.hpp>
25
#include <boost/utility.hpp>
26
#include <boost/function.hpp>
27
#include "usrp2_regs.hpp"
28
#include "wb_iface.hpp"
29
#include <string>
30
31
//TODO: kill this crap when you have the top level GPS include file
32
typedef boost::function<void(std::string)> gps_send_fn_t;
33
typedef boost::function<std::string(void)> gps_recv_fn_t;
34
35
/*!
36
 * The usrp2 interface class:
37
 * Provides a set of functions to implementation layer.
38
 * Including spi, peek, poke, control...
39
 */
40
class usrp2_iface : public wb_iface, public uhd::spi_iface, public uhd::i2c_iface, public uhd::uart_iface{
41
public:
42
    typedef boost::shared_ptr<usrp2_iface> sptr;
43
    /*!
44
     * Make a new usrp2 interface with the control transport.
45
     * \param ctrl_transport the udp transport object
46
     * \return a new usrp2 interface object
47
     */
48
    static sptr make(uhd::transport::udp_simple::sptr ctrl_transport);
49
50
    virtual gps_recv_fn_t get_gps_read_fn(void) = 0;
51
    virtual gps_send_fn_t get_gps_write_fn(void) = 0;
52
53
    //! The list of possible revision types
54
    enum rev_type {
55
        USRP2_REV3 = 3,
56
        USRP2_REV4 = 4,
57
        USRP_N200 = 200,
58
        USRP_N200_R4 = 201,
59
        USRP_N210 = 210,
60
        USRP_N210_R4 = 211,
61
        USRP_NXXX = 0
62
    };
63
64
    //! Get the revision type for this device
65
    virtual rev_type get_rev(void) = 0;
66
67
    //! Get the canonical name for this device
68
    virtual const std::string get_cname(void) = 0;
69
70
    //! Lock the device to this iface
71
    virtual void lock_device(bool lock) = 0;
72
73
    //! Is this device locked?
74
    virtual bool is_device_locked(void) = 0;
75
76
    //motherboard eeprom map structure
77
    uhd::usrp::mboard_eeprom_t mb_eeprom;
78
};
79
80
#endif /* INCLUDED_USRP2_IFACE_HPP */