3 // Copyright 2008 Free Software Foundation, Inc.
5 // This file is part of GNU Radio
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)
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.
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.
23 #ifndef INCLUDED_DB_BASE_H
24 #define INCLUDED_DB_BASE_H
27 #include <boost/shared_ptr.hpp>
28 #include <boost/weak_ptr.hpp>
32 typedef boost::shared_ptr<db_base> db_base_sptr;
35 typedef boost::shared_ptr<usrp_basic> usrp_basic_sptr;
43 /******************************************************************************/
46 * \brief Abstract base class for all USRP daughterboards
53 usrp_basic *d_raw_usrp;
57 void _enable_refclk(bool enable);
58 virtual double _refclk_freq();
59 virtual int _refclk_divisor();
66 db_base(boost::shared_ptr<usrp_basic> usrp, int which);
71 std::string side_and_name();
72 int which() { return d_which; }
74 bool bypass_adc_buffers(bool bypass);
75 bool set_atr_mask(int v);
76 bool set_atr_txval(int v);
77 bool set_atr_rxval(int v);
78 bool set_atr_tx_delay(int v);
79 bool set_atr_rx_delay(int v);
80 bool set_lo_offset(double offset);
81 double lo_offset() { return d_lo_offset; }
84 ////////////////////////////////////////////////////////
85 // derived classes should override the following methods
88 friend class usrp_basic;
91 * Called to shutdown daughterboard. Called from dtor and usrp_basic dtor.
93 * N.B., any class that overrides shutdown MUST call shutdown in its destructor.
95 virtual void shutdown();
99 virtual float gain_min() = 0;
100 virtual float gain_max() = 0;
101 virtual float gain_db_per_step() = 0;
102 virtual double freq_min() = 0;
103 virtual double freq_max() = 0;
104 virtual struct freq_result_t set_freq(double target_freq) = 0;
105 virtual bool set_gain(float gain) = 0;
106 virtual bool is_quadrature() = 0;
107 virtual bool i_and_q_swapped();
108 virtual bool spectrum_inverted();
109 virtual bool set_enable(bool on);
110 virtual bool set_auto_tr(bool on);
111 virtual bool select_rx_antenna(int which_antenna);
112 virtual bool select_rx_antenna(const std::string &which_antenna);
113 virtual bool set_bw(float bw);
117 std::ostream & operator<<(std::ostream &os, db_base &x);
119 #endif /* INCLUDED_DB_BASE_H */