Statistics
| Branch: | Tag: | Revision:

root / host / lib / usrp / usrp2 / usrp2_iface.hpp @ 3dd244bb

History | View | Annotate | Download (2.66 KB)

1
//
2
// Copyright 2010-2012 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
/*!
32
 * The usrp2 interface class:
33
 * Provides a set of functions to implementation layer.
34
 * Including spi, peek, poke, control...
35
 */
36
class usrp2_iface : public wb_iface, public uhd::spi_iface, public uhd::i2c_iface{
37
public:
38
    typedef boost::shared_ptr<usrp2_iface> sptr;
39
    /*!
40
     * Make a new usrp2 interface with the control transport.
41
     * \param ctrl_transport the udp transport object
42
     * \return a new usrp2 interface object
43
     */
44
    static sptr make(uhd::transport::udp_simple::sptr ctrl_transport);
45

    
46
    //! poke a register in the virtual fw table
47
    virtual void pokefw(wb_addr_type addr, boost::uint32_t data) = 0;
48

    
49
    //! peek a register in the virtual fw table
50
    virtual boost::uint32_t peekfw(wb_addr_type addr) = 0;
51

    
52
    //! The list of possible revision types
53
    enum rev_type {
54
        USRP2_REV3 = 3,
55
        USRP2_REV4 = 4,
56
        USRP_N200 = 200,
57
        USRP_N200_R4 = 201,
58
        USRP_N210 = 210,
59
        USRP_N210_R4 = 211,
60
        USRP_NXXX = 0
61
    };
62

    
63
    //! Get the revision type for this device
64
    virtual rev_type get_rev(void) = 0;
65

    
66
    //! Get the canonical name for this device
67
    virtual const std::string get_cname(void) = 0;
68

    
69
    //! Lock the device to this iface
70
    virtual void lock_device(bool lock) = 0;
71

    
72
    //! Is this device locked?
73
    virtual bool is_device_locked(void) = 0;
74

    
75
    //! A version string for firmware
76
    virtual const std::string get_fw_version_string(void) = 0;
77

    
78
    //! Construct a helpful warning message for images
79
    virtual std::string images_warn_help_message(void) = 0;
80

    
81
    //motherboard eeprom map structure
82
    uhd::usrp::mboard_eeprom_t mb_eeprom;
83
};
84

    
85
#endif /* INCLUDED_USRP2_IFACE_HPP */