Changeset 9764
- Timestamp:
- 10/09/08 01:03:39
- Files:
-
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/Makefile.am (modified) (2 diffs)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.cc (modified) (5 diffs)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.h (modified) (3 diffs)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base_impl.h (added)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_basic.cc (modified) (1 diff)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_boards.h (modified) (1 diff)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.cc (modified) (1 diff)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.h (modified) (1 diff)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dtt754.cc (modified) (1 diff)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dtt768.cc (modified) (1 diff)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.cc (modified) (1 diff)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf_mimo.cc (modified) (1 diff)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_tv_rx.cc (modified) (1 diff)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_tv_rx.h (modified) (2 diffs)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_util.cc (added)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_util.h (added)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_wbx.cc (modified) (1 diff)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_xcvr2450.cc (modified) (1 diff)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_basic.cc (modified) (5 diffs)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_basic.h (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/Makefile.am
r9752 r9764 115 115 db_xcvr2450.cc \ 116 116 db_dtt754.cc \ 117 db_dtt768.cc 117 db_dtt768.cc \ 118 db_util.cc 118 119 119 120 # db_wbx.cc … … 162 163 noinst_HEADERS = \ 163 164 ad9862.h \ 165 db_base_impl.h \ 166 db_util.h \ 164 167 fusb.h \ 165 168 fusb_darwin.h \ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.cc
r9762 r9764 21 21 22 22 #include <db_base.h> 23 #include < stdexcept>23 #include <db_base_impl.h> 24 24 25 25 tune_result::tune_result(double baseband, double dxc, double residual, bool inv) … … 48 48 49 49 int 50 db_base::dbid() 50 db_base::dbid() const 51 51 { 52 52 return d_usrp->daughterboard_id(d_which); … … 54 54 55 55 std::string 56 db_base::name() 56 db_base::name() const 57 57 { 58 58 return usrp_dbid_to_string(dbid()); … … 60 60 61 61 std::string 62 db_base::side_and_name() 62 db_base::side_and_name() const 63 63 { 64 64 if(d_which == 0) … … 218 218 throw std::runtime_error("_reflck_divisor() called from base class\n");; 219 219 } 220 221 222 std::ostream &operator<<(std::ostream &os, const db_base &x) 223 { 224 os << x.side_and_name(); 225 return os; 226 } 227 228 229 220 230 221 231 #if 0 // FIXME tune shouldn't be a method of db_base gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.h
r9762 r9764 21 21 // 22 22 23 #ifndef DB_BASE_H24 #define DB_BASE_H23 #ifndef INCLUDED_DB_BASE_H 24 #define INCLUDED_DB_BASE_H 25 25 26 #include <fpga_regs_standard.h> 27 #include <fpga_regs_common.h> 28 #include <vector> 29 #include <usrp_prims.h> 30 #include <usrp_spi_defs.h> 31 #include <usrp_standard.h> 26 #include <string> 27 #include <iosfwd> 28 29 class usrp_basic; 32 30 33 31 … … 60 58 virtual ~db_base(); 61 59 62 int dbid() ;63 std::string name() ;64 std::string side_and_name() ;60 int dbid() const; 61 std::string name() const; 62 std::string side_and_name() const; 65 63 66 64 bool bypass_adc_buffers(bool bypass); … … 105 103 }; 106 104 107 #endif108 105 106 std::ostream & operator<<(std::ostream &os, const db_base &x); 109 107 108 #endif /* INCLUDED_DB_BASE_H */ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_basic.cc
r9762 r9764 20 20 21 21 #include <db_basic.h> 22 #include <db_base_impl.h> 22 23 23 24 gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_boards.h
r9744 r9764 26 26 #include <db_base.h> 27 27 #include <usrp_basic.h> 28 #include <vector>29 #include <boost/shared_ptr.hpp>30 31 class db_base;32 typedef boost::shared_ptr<db_base> db_base_sptr;33 28 34 29 std::vector<db_base_sptr> instantiate_dbs(int dbid, usrp_basic *usrp, int which_side); gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.cc
r9762 r9764 20 20 21 21 #include <db_dbs_rx.h> 22 #include <db_tv_rx.h> 23 #include <sstream> 24 #include <assert.h> 25 #include <stdexcept> 22 #include <db_base_impl.h> 26 23 #include <cmath> 27 24 gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.h
r9762 r9764 24 24 25 25 #include <db_base.h> 26 #include <vector> 26 27 27 28 struct bw_t { gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dtt754.cc
r9733 r9764 21 21 22 22 #include <db_dtt754.h> 23 #include <db_ tv_rx.h>23 #include <db_base_impl.h> 24 24 25 25 int gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dtt768.cc
r9733 r9764 21 21 22 22 #include <db_dtt768.h> 23 #include <db_ tv_rx.h>23 #include <db_base_impl.h> 24 24 25 25 int gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.cc
r9762 r9764 20 20 21 21 #include <db_flexrf.h> 22 #include <sstream> 23 #include <assert.h> 24 #include <stdexcept> 22 #include <db_base_impl.h> 25 23 26 24 // d'board i/o pin defs gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf_mimo.cc
r9733 r9764 21 21 22 22 #include <db_flexrf_mimo.h> 23 #include <assert.h> 23 #include <fpga_regs_standard.h> 24 #include <fpga_regs_common.h> 25 #include <usrp_prims.h> 26 #include <usrp_spi_defs.h> 27 24 28 25 29 db_flexrf_2400_tx_mimo_a::db_flexrf_2400_tx_mimo_a(usrp_basic *usrp, int which) gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_tv_rx.cc
r9762 r9764 20 20 21 21 #include <db_tv_rx.h> 22 #include <sstream> 23 #include <assert.h> 22 #include <db_base_impl.h> 24 23 25 24 /*****************************************************************************/ 26 27 std::string28 int_seq_to_str(std::vector<int> &seq)29 {30 //convert a sequence of integers into a string31 32 std::stringstream str;33 std::vector<int>::iterator i;34 for(i = seq.begin(); i != seq.end(); i++) {35 str << char((unsigned int)*i);36 }37 return str.str();38 }39 40 std::vector<int>41 str_to_int_seq(std::string str)42 {43 //convert a string to a list of integers44 std::vector<int> seq;45 std::vector<int>::iterator sitr;46 std::string::iterator i;47 for(i=str.begin(); i != str.end(); i++) {48 int a = (int)(*i);49 seq.push_back(a);50 }51 return seq;52 }53 25 54 26 int gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_tv_rx.h
r9733 r9764 32 32 void _set_pga(float pga_gain); 33 33 34 usrp_basic_rx *d_usrp;35 34 int d_i2c_addr; 36 35 double d_first_IF, d_second_IF; … … 55 54 }; 56 55 57 std::string int_seq_to_str(std::vector<int> &seq);58 std::vector<int> str_to_int_seq(std::string str);59 int control_byte_1(bool fast_tuning_p, int reference_divisor);60 int control_byte_2(double target_freq, bool shutdown_tx_PGA);61 62 56 #endif gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_wbx.cc
r9733 r9764 21 21 22 22 #include <db_wbx.h> 23 #include <fpga_regs_standard.h> 24 #include <fpga_regs_common.h> 25 #include <usrp_prims.h> 26 #include <usrp_spi_defs.h> 23 27 #include <stdexcept> 24 28 #include <cmath> gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_xcvr2450.cc
r9733 r9764 20 20 21 21 #include <db_xcvr2450.h> 22 #include <db_base_impl.h> 22 23 #include <cmath> 23 #include <sstream>24 #include <assert.h>25 24 26 25 gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_basic.cc
r9763 r9764 31 31 #include "fpga_regs_standard.h" 32 32 #include "fusb.h" 33 #include "db_boards.h" 33 34 #include <usb.h> 34 35 #include <stdexcept> … … 112 113 d_usb_data_rate (16000000), // SWAG, see below 113 114 d_bytes_per_poll ((int) (POLLING_INTERVAL * d_usb_data_rate)), 114 d_verbose (false) 115 d_verbose (false), d_db(2) 115 116 { 116 117 /* … … 158 159 usrp_basic::~usrp_basic () 159 160 { 161 d_db.resize(0); // nuke d'boards before we close down USB 162 160 163 if (d_udh) 161 164 usb_close (d_udh); 162 165 } 166 167 /* 168 * We return a vector of weak pointers. d_db should be the only place 169 * in the system that's holding them as shared pointers. 170 */ 171 std::vector<db_base_wptr> 172 usrp_basic::db(int which_side) 173 { 174 which_side &= 0x1; // clamp it to avoid any reporting any errors 175 std::vector<db_base_wptr> r; 176 177 assert(d_db.size() == 2); 178 179 for (unsigned i = 0; i < d_db[which_side].size(); i++) 180 r.push_back(db_base_wptr(d_db[which_side][i])); 181 182 return r; 183 } 184 163 185 164 186 bool … … 742 764 743 765 probe_rx_slots (false); 766 d_db[0] = instantiate_dbs(d_dbid[0], this, 0); 767 d_db[1] = instantiate_dbs(d_dbid[1], this, 1); 744 768 745 769 // check fusb buffering parameters … … 1146 1170 1147 1171 probe_tx_slots (false); 1172 d_db[0] = instantiate_dbs(d_dbid[0], this, 0); 1173 d_db[1] = instantiate_dbs(d_dbid[1], this, 1); 1148 1174 1149 1175 // check fusb buffering parameters gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_basic.h
r9761 r9764 42 42 #include <usrp_slots.h> 43 43 #include <string> 44 #include <vector> 44 45 #include <boost/shared_ptr.hpp> 46 #include <boost/weak_ptr.hpp> 45 47 #include <boost/utility.hpp> 46 47 48 class db_base;49 typedef boost::shared_ptr<db_base> db_base_sptr;50 48 51 49 … … 58 56 C_TX = 1 59 57 }; 58 59 class db_base; 60 typedef boost::shared_ptr<db_base> db_base_sptr; 61 typedef boost::weak_ptr<db_base> db_base_wptr; 60 62 61 63 … … 74 76 unsigned int d_fpga_shadows[MAX_REGS]; 75 77 78 int d_dbid[2]; // daughterboard ID's (side A, side B) 79 80 /*! 81 * Shared pointers to subclasses of db_base. 82 * The outer vector is of length 2 (0 = side A, 1 = side B). The inner vectors 83 * are of length 1 or 2 depending on whether the given daugherboard implements 84 * 1 or 2 subdevices. At this time, only the Basic Rx and LF Rx implement 85 * 2 subdevices. 86 */ 87 std::vector< std::vector<db_base_sptr> > d_db; 88 76 89 usrp_basic (int which_board, 77 90 struct usb_dev_handle *open_interface (struct usb_device *dev), … … 126 139 127 140 /*! 141 * Return a vector of size 1 or 2 that contains weak pointers 142 * to the daughterboard instance(s) associated with the specified side. 143 * 144 * \param which_side [0,1] which daughterboard 145 * 146 * N.B. To ensure proper lifetime management, the caller should 147 * continue to hold these as weak pointers, not shared pointers. 148 * As long as the caller does not attempt to directly use the weak 149 * pointers after this usrp object has been destroyed, everything 150 * will work out fine. 151 */ 152 std::vector<db_base_wptr> db(int which_side); 153 154 /*! 128 155 * \brief return frequency of master oscillator on USRP 129 156 */ … … 194 221 /*! 195 222 * \brief Control ADC input buffer 196 * \param which which ADC[0,3]223 * \param which_adc which ADC[0,3] 197 224 * \param bypass if non-zero, bypass input buffer and connect input 198 225 * directly to switched cap SHA input of RxPGA. … … 717 744 718 745 protected: 719 int d_dbid[2]; // Rx daughterboard ID's720 721 746 /*! 722 747 * \param which_board Which USRP board on usb (not particularly useful; use 0) … … 826 851 827 852 protected: 828 int d_dbid[2]; // Tx daughterboard ID's829 830 853 /*! 831 854 * \param which_board Which USRP board on usb (not particularly useful; use 0)
