Statistics
| Branch: | Tag: | Revision:

root / host / include / uhd / usrp / mboard_iface.hpp @ 1b63cd25

History | View | Annotate | Download (2.48 KB)

1
//
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_UHD_USRP_MBOARD_IFACE_HPP
19
#define INCLUDED_UHD_USRP_MBOARD_IFACE_HPP
20

    
21
#include <uhd/types/serial.hpp>
22
#include <uhd/usrp/mboard_eeprom.hpp>
23
#include <boost/shared_ptr.hpp>
24
#include <boost/utility.hpp>
25
#include <boost/cstdint.hpp>
26
#include <utility>
27
#include <string>
28

    
29
namespace uhd{ namespace usrp{
30

    
31
/*!
32
 * The mboard interface class:
33
 * Provides a set of functions to implementation layer.
34
 * Including spi, peek, poke, control...
35
 */
36
class mboard_iface : public uhd::i2c_iface, public uhd::spi_iface {
37
public:
38
    typedef boost::shared_ptr<mboard_iface> sptr;
39
    /*!
40
     * Write a register (32 bits)
41
     * \param addr the address
42
     * \param data the 32bit data
43
     */
44
    virtual void poke32(boost::uint32_t addr, boost::uint32_t data) = 0;
45

    
46
    /*!
47
     * Read a register (32 bits)
48
     * \param addr the address
49
     * \return the 32bit data
50
     */
51
    virtual boost::uint32_t peek32(boost::uint32_t addr) = 0;
52

    
53
    /*!
54
     * Write a register (16 bits)
55
     * \param addr the address
56
     * \param data the 16bit data
57
     */
58
    virtual void poke16(boost::uint32_t addr, boost::uint16_t data) = 0;
59

    
60
    /*!
61
     * Read a register (16 bits)
62
     * \param addr the address
63
     * \return the 16bit data
64
     */
65
    virtual boost::uint16_t peek16(boost::uint32_t addr) = 0;
66

    
67
    /*!
68
     * Write to a serial port.
69
     * \param dev which UART to write to
70
     * \param buf the data to write
71
     */
72
    virtual void write_uart(boost::uint8_t dev, const std::string &buf) = 0;
73

    
74
    /*!
75
     * Read from a serial port.
76
     * \param dev which UART to read from
77
     * \return the data read from the serial port
78
     */
79
    virtual std::string read_uart(boost::uint8_t dev) = 0;
80

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

    
85
}}
86

    
87
#endif //INCLUDED_UHD_USRP_DBOARD_IFACE_HPP