Imported Upstream version 3.2.2
[debian/gnuradio] / usrp / host / lib / legacy / db_dbs_rx.h
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 asversion 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 #ifndef DB_DBS_RX_H
23 #define DB_DBS_RX_H
24
25 #include <db_base.h>
26 #include <vector>
27
28 #if 0
29 struct bw_t {
30   int m;
31   int fdac;
32   float div;
33 };
34 #endif
35
36 class db_dbs_rx : public db_base
37 {
38 private:
39   int d_osc, d_cp, d_n, d_div2, d_r, d_r_int;
40   int d_fdac, d_m, d_dl, d_ade, d_adl, d_gc1, d_gc2, d_diag;
41   int d_i2c_addr;
42   
43   // Internal gain functions
44   void _write_reg(int regno, int v);
45   void _write_regs(int starting_regno, const std::vector<int> &vals);
46   std::vector<int> _read_status();
47   void _send_reg(int regno);
48   void _set_m(int m);
49   void _set_fdac(int fdac);
50   void _set_dl(int dl);
51   void _set_gc2(int gc2);
52   void _set_gc1(int gc1);
53   void _set_pga(int pga_gain);
54
55   // Internal frequency function
56   void _set_osc(int osc);
57   void _set_cp(int cp);
58   void _set_n(int n);
59   void _set_div2(int div2);
60   void _set_r(int r);
61   void _set_ade(int ade);
62
63   int _refclk_divisor();
64
65 protected:
66   void shutdown();
67
68 public:
69   db_dbs_rx(usrp_basic_sptr usrp, int which);
70   ~db_dbs_rx();
71
72   float gain_min();
73   float gain_max();
74   float gain_db_per_step();
75   double freq_min();
76   double freq_max();
77   struct freq_result_t set_freq(double freq);
78   bool  set_gain(float gain);
79   bool  is_quadrature();
80   bool  set_bw(float bw);
81 };
82
83 #endif