2 // Copyright 2008 Free Software Foundation, Inc.
4 // This file is part of GNU Radio
6 // GNU Radio is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either asversion 3, or (at your option)
11 // GNU Radio is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with GNU Radio; see the file COPYING. If not, write to
18 // the Free Software Foundation, Inc., 51 Franklin Street,
19 // Boston, MA 02110-1301, USA.
22 #include <db_base_impl.h>
25 db_basic_tx::db_basic_tx(boost::shared_ptr<usrp_basic> usrp, int which)
26 : db_base(usrp, which)
28 // Handler for Basic Tx daughterboards.
30 // @param usrp: instance of usrp.source_c
31 // @param which: which side: 0 or 1 corresponding to TX_A or TX_B respectively
33 set_gain((gain_min() + gain_max()) / 2); // initialize gain
36 db_basic_tx::~db_basic_tx()
41 db_basic_tx::freq_min()
47 db_basic_tx::freq_max()
53 db_basic_tx::set_freq(double target_freq)
57 // @param freq: target RF frequency in Hz
60 // @returns (ok, actual_baseband_freq) where:
61 // ok is True or False and indicates success or failure,
62 // actual_baseband_freq is the RF frequency that corresponds to DC in the IF.
64 struct freq_result_t args = {false, 0};
66 args.baseband_freq = 0.0;
71 db_basic_tx::gain_min()
73 return usrp()->pga_min();
77 db_basic_tx::gain_max()
79 return usrp()->pga_max();
83 db_basic_tx::gain_db_per_step()
85 return usrp()->pga_db_per_step();
89 db_basic_tx::set_gain(float gain)
93 // @param gain: gain in decibels
94 // @returns True/False
96 bool ok = usrp()->set_pga(d_which * 2 + 0, gain);
97 ok = ok && usrp()->set_pga(d_which * 2 + 1, gain);
102 db_basic_tx::is_quadrature()
104 // Return True if this board requires both I & Q analog channels.
110 /******************************************************************************/
113 db_basic_rx::db_basic_rx(usrp_basic_sptr usrp, int which, int subdev)
114 : db_base(usrp, which)
116 // Handler for Basic Rx daughterboards.
118 // @param usrp: instance of usrp.source_c
119 // @param which: which side: 0 or 1 corresponding to TX_A or TX_B respectively
120 // @param subdev: which analog i/o channel: 0 or 1
125 bypass_adc_buffers(true);
127 if(0) { // Doing this would give us a different default than the historical values...
128 set_gain(float(gain_min() + gain_max()) / 2.0); // initialize gain
132 db_basic_rx::~db_basic_rx()
137 db_basic_rx::freq_min()
143 db_basic_rx::freq_max()
149 db_basic_rx::set_freq(double target_freq)
151 // Set the frequency.
153 // @param freq: target RF frequency in Hz
154 // @type freq: double
156 // @returns (ok, actual_baseband_freq) where:
157 // ok is True or False and indicates success or failure,
158 // actual_baseband_freq is the RF frequency that corresponds to DC in the IF.
160 struct freq_result_t args = {true, 0.0};
165 db_basic_rx::gain_min()
167 return usrp()->pga_min();
171 db_basic_rx::gain_max()
173 return usrp()->pga_max();
177 db_basic_rx::gain_db_per_step()
179 return usrp()->pga_db_per_step();
183 db_basic_rx::set_gain(float gain)
187 // @param gain: gain in decibels
188 // @returns True/False
190 return usrp()->set_pga(d_which * 2 + d_subdev, gain);
194 db_basic_rx::is_quadrature()
196 // Return True if this board requires both I & Q analog channels.
198 // This bit of info is useful when setting up the USRP Rx mux register.
200 return (d_subdev == 2);
205 /******************************************************************************/
208 db_lf_tx::db_lf_tx(usrp_basic_sptr usrp, int which)
209 : db_basic_tx(usrp, which)
211 // Handler for Low Freq Tx daughterboards.
213 // @param usrp: instance of usrp.source_c
214 // @param which: which side: 0 or 1 corresponding to RX_A or RX_B respectively
217 db_lf_tx::~db_lf_tx()
233 /******************************************************************************/
236 db_lf_rx::db_lf_rx(usrp_basic_sptr usrp, int which, int subdev)
237 : db_basic_rx(usrp, which, subdev)
239 // Handler for Low Freq Rx daughterboards.
241 // @param usrp: instance of usrp.source_c
242 // @param which: which side: 0 or 1 corresponding to RX_A or RX_B respectively
243 // @param subdev: which analog i/o channel: 0 or 1
247 db_lf_rx::~db_lf_rx()