Imported Upstream version 3.2.2
[debian/gnuradio] / usrp2 / firmware / lib / db_basic.c
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2008,2009 Free Software Foundation, Inc.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18
19
20 #include <db_base.h>
21
22 bool db_basic_init(struct db_base *db);
23 bool db_basic_set_freq(struct db_base *db, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc);
24 bool db_basic_set_gain(struct db_base *db, u2_fxpt_gain_t gain);
25 bool db_basic_set_tx_enable(struct db_base *, bool on);
26
27 struct db_basic {
28   struct db_base        base;
29 };
30
31
32 struct db_basic db_basic_tx = {
33   .base.dbid = 0x0000,
34   .base.is_tx = true,
35   .base.output_enables = 0x0000,
36   .base.used_pins = 0x0000,
37   .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(-90e9),
38   .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(90e9),
39   .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0),
40   .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(0),
41   .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0),
42   .base.is_quadrature = true,
43   .base.i_and_q_swapped = false,
44   .base.spectrum_inverted = false,
45   .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
46   .base.atr_mask =      0,
47   .base.atr_txval =     0,
48   .base.atr_rxval =     0,
49   //.base.atr_tx_delay =        0,
50   //.base.atr_rx_delay =        0,
51
52   .base.init = db_basic_init,
53   .base.set_freq = db_basic_set_freq,
54   .base.set_gain = db_basic_set_gain,
55   .base.set_tx_enable = db_basic_set_tx_enable,
56 };
57
58 struct db_basic db_basic_rx = {
59   .base.dbid = 0x0001,
60   .base.is_tx = false,
61   .base.output_enables = 0x0000,
62   .base.used_pins = 0x0000,
63   .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(-90e9),
64   .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(90e9),
65   .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0),
66   .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(0),
67   .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0),
68   .base.is_quadrature = false,
69   .base.i_and_q_swapped = false,
70   .base.spectrum_inverted = false,
71   .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
72   .base.atr_mask =      0,
73   .base.atr_txval =     0,
74   .base.atr_rxval =     0,
75   //.base.atr_tx_delay =        0,
76   //.base.atr_rx_delay =        0,
77
78   .base.init = db_basic_init,
79   .base.set_freq = db_basic_set_freq,
80   .base.set_gain = db_basic_set_gain,
81   .base.set_tx_enable = db_basic_set_tx_enable,
82 };
83
84 struct db_basic db_lf_tx = {
85   .base.dbid = 0x000e,
86   .base.is_tx = true,
87   .base.output_enables = 0x0000,
88   .base.used_pins = 0x0000,
89   .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(-32e6),
90   .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(32e6),
91   .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0),
92   .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(0),
93   .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0),
94   .base.is_quadrature = true,
95   .base.i_and_q_swapped = false,
96   .base.spectrum_inverted = false,
97   .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
98   .base.atr_mask =      0,
99   .base.atr_txval =     0,
100   .base.atr_rxval =     0,
101   //.base.atr_tx_delay =        0,
102   //.base.atr_rx_delay =        0,
103
104   .base.init = db_basic_init,
105   .base.set_freq = db_basic_set_freq,
106   .base.set_gain = db_basic_set_gain,
107   .base.set_tx_enable = db_basic_set_tx_enable,
108 };
109
110 struct db_basic db_lf_rx = {
111   .base.dbid = 0x000f,
112   .base.is_tx = false,
113   .base.output_enables = 0x0000,
114   .base.used_pins = 0x0000,
115   .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(0),
116   .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(32e6),
117   .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0),
118   .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(0),
119   .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0),
120   .base.is_quadrature = false,
121   .base.i_and_q_swapped = false,
122   .base.spectrum_inverted = false,
123   .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
124   .base.atr_mask =      0,
125   .base.atr_txval =     0,
126   .base.atr_rxval =     0,
127   //.base.atr_tx_delay =        0,
128   //.base.atr_rx_delay =        0,
129
130   .base.init = db_basic_init,
131   .base.set_freq = db_basic_set_freq,
132   .base.set_gain = db_basic_set_gain,
133   .base.set_tx_enable = db_basic_set_tx_enable,
134 };
135
136
137 bool
138 db_basic_init(struct db_base *db)
139 {
140   return true;
141 }
142
143 bool
144 db_basic_set_freq(struct db_base *db, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc)
145 {
146   *dc = 0;
147   return true;
148 }
149
150 bool
151 db_basic_set_gain(struct db_base *db, u2_fxpt_gain_t gain)
152 {
153   return true;
154 }
155
156 bool
157 db_basic_set_tx_enable(struct db_base *db, bool on)
158 {
159   return true;
160 }
161