Clean up for work-in-progress
[debian/gnuradio] / usrp / host / include / usrp / db_wbxng.h
1 /* -*- c++ -*- */
2 //
3 // Copyright 2009 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 INCLUDED_DB_WBXNG_H
23 #define INCLUDED_DB_WBXNG_H
24
25 #include <usrp/db_base.h>
26 #include <cmath>
27
28 class adf4350;
29
30 class wbxng_base : public db_base
31 {
32 public:
33   wbxng_base(usrp_basic_sptr usrp, int which, int _power_on=0);
34   ~wbxng_base();
35
36   struct freq_result_t set_freq(double freq);
37
38   bool  is_quadrature();
39   double freq_min();
40   double freq_max();
41
42 protected:
43   bool _lock_detect();
44
45   //virtual bool _compute_regs(double freq, int &retR, int &retcontrol, int &retN, double &retfreq);
46   int  _compute_control_reg();
47   int _refclk_divisor();
48   double _refclk_freq();
49
50   bool _set_pga(float pga_gain);
51
52   int power_on() { return d_power_on; }
53   int power_off() { return 0; }
54
55   bool d_first;
56   int  d_spi_format;
57   int  d_spi_enable;
58   int  d_power_on;
59   int  d_PD;
60
61   adf4350 *d_common;
62 };
63
64 // ----------------------------------------------------------------
65
66 class wbxng_base_tx : public wbxng_base
67 {
68 protected:
69   void shutdown();
70
71 public:
72   wbxng_base_tx(usrp_basic_sptr usrp, int which, int _power_on=0);
73   ~wbxng_base_tx();
74
75   float gain_min();
76   float gain_max();
77   float gain_db_per_step();
78
79   bool set_auto_tr(bool on);
80   bool set_enable(bool on);
81   bool set_gain(float gain);
82 };
83
84 class wbxng_base_rx : public wbxng_base
85 {
86 protected:
87   void shutdown();
88   bool _set_attn(float attn);
89
90 public:
91   wbxng_base_rx(usrp_basic_sptr usrp, int which, int _power_on=0);
92   ~wbxng_base_rx();
93
94   bool set_auto_tr(bool on);
95   bool select_rx_antenna(int which_antenna);
96   bool select_rx_antenna(const std::string &which_antenna);
97   bool set_gain(float gain);
98 };
99
100 // ----------------------------------------------------------------
101
102 class db_wbxng_tx : public wbxng_base_tx
103 {
104  public:
105   db_wbxng_tx(usrp_basic_sptr usrp, int which);
106   ~db_wbxng_tx();
107 };
108
109 class db_wbxng_rx : public wbxng_base_rx
110 {
111 public:
112   db_wbxng_rx(usrp_basic_sptr usrp, int which);
113   ~db_wbxng_rx();
114
115   float gain_min();
116   float gain_max();
117   float gain_db_per_step();
118   bool i_and_q_swapped();
119 };
120
121 #endif /* INCLUDED_DB_WBXNG_H */