Imported Upstream version 3.2.2
[debian/gnuradio] / gr-usrp / src / usrp_base.i
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2008 Free Software Foundation, Inc.
4  * 
5  * This file is part of GNU Radio
6  * 
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  * 
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING.  If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22
23 %{
24 #include "usrp_base.h"
25 %}
26
27 class usrp_base : public gr_sync_block 
28 {
29 protected:
30   usrp_base(const std::string &name,
31             gr_io_signature_sptr input_signature,
32             gr_io_signature_sptr output_signature)
33     : gr_sync_block(name, input_signature, output_signature) {}
34     
35 public:
36   std::vector<std::vector<db_base_sptr> > db();
37   std::vector<db_base_sptr> db(int which_side);
38   db_base_sptr db(int which_side, int which_dev);
39   %rename (_real_selected_subdev) selected_subdev;
40   db_base_sptr selected_subdev(usrp_subdev_spec ss);
41   long fpga_master_clock_freq() const;
42   void set_fpga_master_clock_freq(long master_clock);
43   void set_verbose (bool on);
44   static const int READ_FAILED = -99999;
45   bool write_eeprom (int i2c_addr, int eeprom_offset, const std::string buf);
46   std::string read_eeprom (int i2c_addr, int eeprom_offset, int len);
47   bool write_i2c (int i2c_addr, const std::string buf);
48   std::string read_i2c (int i2c_addr, int len);
49   bool set_adc_offset (int which_adc, int offset);
50   bool set_dac_offset (int which_dac, int offset, int offset_pin);
51   bool set_adc_buffer_bypass (int which_adc, bool bypass);
52   bool set_dc_offset_cl_enable(int bits, int mask);
53   std::string serial_number();
54   virtual int daughterboard_id (int which_side) const;
55   bool write_atr_tx_delay(int value);
56   bool write_atr_rx_delay(int value);
57   bool set_pga (int which_amp, double gain_in_db);
58   double pga (int which_amp) const;
59   double pga_min () const;
60   double pga_max () const;
61   double pga_db_per_step () const;
62   bool _write_oe (int which_side, int value, int mask);
63   bool write_io (int which_side, int value, int mask);
64   int read_io (int which_side);
65   //bool write_refclk(int which_side, int value);
66   bool write_atr_mask(int which_side, int value);
67   bool write_atr_txval(int which_side, int value);
68   bool write_atr_rxval(int which_side, int value);
69   bool write_aux_dac (int which_side, int which_dac, int value);
70   int read_aux_adc (int which_side, int which_adc);
71   long converter_rate() const;
72   bool _set_led (int which_led, bool on);
73   bool _write_fpga_reg (int regno, int value);
74   //bool _read_fpga_reg (int regno, int *value);
75   int  _read_fpga_reg (int regno);
76   bool _write_fpga_reg_masked (int regno, int value, int mask);
77   bool _write_9862 (int which_codec, int regno, unsigned char value);
78   int  _read_9862 (int which_codec, int regno) const;
79   bool _write_spi (int optional_header, int enables, int format, std::string buf);
80   std::string _read_spi (int optional_header, int enables, int format, int len);
81   %rename(_real_pick_subdev) pick_subdev;
82   usrp_subdev_spec pick_subdev(std::vector<int> candidates=std::vector<int>(0))
83     throw (std::runtime_error);
84 };