Statistics
| Branch: | Tag: | Revision:

root / host / lib / usrp / usrp1 / codec_ctrl.hpp @ 5c0d3d30

History | View | Annotate | Download (2.66 KB)

1
//
2
// Copyright 2010 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_USRP1_CODEC_CTRL_HPP
19
#define INCLUDED_USRP1_CODEC_CTRL_HPP
20

    
21
#include "usrp1_iface.hpp"
22
#include <uhd/types/ranges.hpp>
23
#include <boost/shared_ptr.hpp>
24
#include <boost/utility.hpp>
25

    
26
/*!
27
 * The usrp1 codec control:
28
 * - Init/power down codec.
29
 * - Read aux adc, write aux dac.
30
 */
31
class usrp1_codec_ctrl : boost::noncopyable{
32
public:
33
    typedef boost::shared_ptr<usrp1_codec_ctrl> sptr;
34

    
35
    static const uhd::gain_range_t tx_pga_gain_range;
36
    static const uhd::gain_range_t rx_pga_gain_range;
37

    
38
    /*!
39
     * Make a new clock control object.
40
     * \param iface the usrp1 iface object
41
     * \param spi_slave which spi device
42
     * \return the clock control object
43
     */
44
    static sptr make(usrp1_iface::sptr iface, int spi_slave);
45

    
46
    //! aux adc identifier constants
47
    enum aux_adc_t{
48
        AUX_ADC_A2 = 0xA2,
49
        AUX_ADC_A1 = 0xA1,
50
        AUX_ADC_B2 = 0xB2,
51
        AUX_ADC_B1 = 0xB1
52
    };
53

    
54
    /*!
55
     * Read an auxiliary adc:
56
     * The internals remember which aux adc was read last.
57
     * Therefore, the aux adc switch is only changed as needed.
58
     * \param which which of the 4 adcs
59
     * \return a value in volts
60
     */
61
    virtual float read_aux_adc(aux_adc_t which) = 0;
62

    
63
    //! aux dac identifier constants
64
    enum aux_dac_t{
65
        AUX_DAC_A = 0xA,
66
        AUX_DAC_B = 0xB,
67
        AUX_DAC_C = 0xC,
68
        AUX_DAC_D = 0xD
69
    };
70

    
71
    /*!
72
     * Write an auxiliary dac.
73
     * \param which which of the 4 dacs
74
     * \param volts the level in in volts
75
     */
76
    virtual void write_aux_dac(aux_dac_t which, float volts) = 0;
77

    
78
    //! Set the TX PGA gain
79
    virtual void set_tx_pga_gain(float gain) = 0;
80

    
81
    //! Get the TX PGA gain
82
    virtual float get_tx_pga_gain(void) = 0;
83

    
84
    //! Set the RX PGA gain ('A' or 'B')
85
    virtual void set_rx_pga_gain(float gain, char which) = 0;
86

    
87
    //! Get the RX PGA gain ('A' or 'B')
88
    virtual float get_rx_pga_gain(char which) = 0;
89

    
90
    virtual bool set_duc_freq(double freq) = 0;
91
};
92

    
93
#endif /* INCLUDED_USRP1_CODEC_CTRL_HPP */