Changeset 9762
- Timestamp:
- 10/08/08 23:00:06
- Files:
-
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.cc (modified) (8 diffs)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.h (modified) (2 diffs)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_basic.cc (modified) (3 diffs)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.cc (modified) (2 diffs)
- 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_flexrf.cc (modified) (4 diffs)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.h (modified) (1 diff)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_tv_rx.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.cc
r9752 r9762 37 37 38 38 39 db_base::db_base(usrp_basic *usrp, int which, bool tx) 40 : d_usrp(usrp), d_which(which), d_tx(tx), 41 d_lo_offset(0.0) 42 { 43 if(d_tx) { 44 d_slot = d_which * 2; 45 } 46 else { 47 d_slot = d_which * 2 + 1; 48 } 49 50 int refclktable[4] = {FR_TX_A_REFCLK, FR_RX_A_REFCLK, FR_TX_B_REFCLK, FR_RX_B_REFCLK}; 51 d_refclk_reg = refclktable[d_slot]; 39 db_base::db_base(usrp_basic *usrp, int which) 40 : d_usrp(usrp), d_which(which), d_lo_offset(0.0) 41 { 52 42 } 53 43 … … 84 74 db_base::bypass_adc_buffers(bool bypass) 85 75 { 86 if(d_tx) {87 throw std::runtime_error("TX Board has no adc buffers\n");88 }76 //if(d_tx) { 77 // throw std::runtime_error("TX Board has no adc buffers\n"); 78 //} 89 79 90 80 bool ok = true; 91 81 if(d_which==0) { 92 93 82 ok &= d_usrp->set_adc_buffer_bypass(0, bypass); 94 83 ok &= d_usrp->set_adc_buffer_bypass(1, bypass); … … 105 94 { 106 95 // Set Auto T/R mask. 107 return d_usrp-> _write_fpga_reg(FR_ATR_MASK_0 + 3 * d_slot, v);96 return d_usrp->write_atr_mask(d_which, v); 108 97 } 109 98 … … 112 101 { 113 102 // Set Auto T/R register value to be used when transmitting. 114 return d_usrp-> _write_fpga_reg(FR_ATR_TXVAL_0 + 3 * d_slot, v);103 return d_usrp->write_atr_txval(d_which, v); 115 104 } 116 105 … … 119 108 { 120 109 // Set Auto T/R register value to be used when receiving. 121 return d_usrp-> _write_fpga_reg(FR_ATR_RXVAL_0 + 3 * d_slot, v);110 return d_usrp->write_atr_rxval(d_which, v); 122 111 } 123 112 … … 127 116 // Set Auto T/R delay (in clock ticks) from when Tx fifo gets data to 128 117 // when T/R switches. 129 return d_usrp-> _write_fpga_reg(FR_ATR_TX_DELAY,v);118 return d_usrp->write_atr_tx_delay(v); 130 119 } 131 120 … … 135 124 // Set Auto T/R delay (in clock ticks) from when Tx fifo goes empty to 136 125 // when T/R switches. 137 return d_usrp->_write_fpga_reg(FR_ATR_RX_DELAY, v); 138 } 139 140 double 141 db_base::freq_min() 142 { 143 throw std::runtime_error("freq_min() called from base class\n"); 144 } 145 146 double 147 db_base::freq_max() 148 { 149 throw std::runtime_error("freq_max() called from base class\n"); 150 } 151 152 struct freq_result_t 153 db_base::set_freq(double target_freq) 154 { 155 // Set the frequency. 156 // 157 // @param freq: target RF frequency in Hz 158 // @type freq: double 159 // 160 // @returns (ok, actual_baseband_freq) where: 161 // ok is True or False and indicates success or failure, 162 // actual_baseband_freq is RF frequency that corresponds to DC in the IF. 163 throw std::runtime_error("set_freq() called from base class\n"); 126 return d_usrp->write_atr_rx_delay(v); 164 127 } 165 128 … … 242 205 if(enable) { 243 206 d_usrp->_write_oe(d_which, CLOCK_OUT, CLOCK_OUT); // output enable 244 d_usrp->_write_fpga_reg(d_refclk_reg, 245 ((_refclk_divisor() & REFCLK_DIVISOR_MASK) 246 | REFCLK_ENABLE)); 247 } 248 else { 249 d_usrp->_write_fpga_reg(d_refclk_reg, 0); 207 d_usrp->write_refclk(d_which, (_refclk_divisor() & REFCLK_DIVISOR_MASK) | REFCLK_ENABLE); 208 } 209 else { 210 d_usrp->write_refclk(d_which, 0); 250 211 } 251 212 } gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.h
r9752 r9762 57 57 { 58 58 public: 59 db_base(usrp_basic *usrp, int which , bool tx=true);59 db_base(usrp_basic *usrp, int which); 60 60 virtual ~db_base(); 61 61 … … 102 102 usrp_basic *d_usrp; 103 103 int d_which; 104 bool d_tx;105 int d_slot;106 int d_refclk_reg;107 104 double d_lo_offset; 108 105 }; gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_basic.cc
r9733 r9762 25 25 26 26 db_basic_tx::db_basic_tx(usrp_basic *usrp, int which) 27 : db_base(usrp, which , true)27 : db_base(usrp, which) 28 28 { 29 29 // Handler for Basic Tx daughterboards. … … 32 32 // @param which: which side: 0 or 1 corresponding to TX_A or TX_B respectively 33 33 34 d_tx = true; 35 36 if(0) { 37 // Doing this would give us a different default than the historical values... 38 set_gain(float(gain_min() + gain_max()) / 2); // initialize gain 39 } 34 set_gain((gain_min() + gain_max()) / 2); // initialize gain 40 35 } 41 36 … … 118 113 119 114 db_basic_rx::db_basic_rx(usrp_basic *usrp, int which, int subdev) 120 : db_base(usrp, which , false)115 : db_base(usrp, which) 121 116 { 122 117 // Handler for Basic Rx daughterboards. gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.cc
r9733 r9762 31 31 32 32 db_dbs_rx::db_dbs_rx(usrp_basic *usrp, int which) 33 : db_base(usrp, which , false)33 : db_base(usrp, which) 34 34 { 35 35 // Control DBS receiver based USRP daughterboard. … … 37 37 // @param usrp: instance of usrp.source_c 38 38 // @param which: which side: 0, 1 corresponding to RX_A or RX_B respectively 39 40 d_usrp = (usrp_basic_rx*)usrp;41 d_tx = false; // FIXME: this should be redundant42 39 43 40 d_usrp->_write_oe(d_which, 0x0001, 0x0001); gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.h
r9733 r9762 34 34 { 35 35 private: 36 usrp_basic_rx *d_usrp;37 36 int d_osc, d_cp, d_n, d_div2, d_r, d_r_int; 38 37 int d_fdac, d_m, d_dl, d_ade, d_adl, d_gc1, d_gc2, d_diag; gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.cc
r9758 r9762 37 37 #define CLOCK_OUT (1 << 0) 38 38 39 flexrf_base::flexrf_base(usrp_basic *usrp, int which, bool tx,int _power_on)40 : db_base(usrp, which , tx), d_power_on(_power_on)39 flexrf_base::flexrf_base(usrp_basic *usrp, int which, int _power_on) 40 : db_base(usrp, which), d_power_on(_power_on) 41 41 { 42 42 /* … … 57 57 flexrf_base::~flexrf_base() 58 58 { 59 // turn off power to board60 d_usrp->common_write_io((d_tx ? C_TX : C_RX),61 d_which, power_off(), POWER_UP);62 63 59 delete d_common; 64 60 } … … 258 254 259 255 flexrf_base_tx::flexrf_base_tx(usrp_basic *usrp, int which, int _power_on) 260 : flexrf_base(usrp, which, true,_power_on)256 : flexrf_base(usrp, which, _power_on) 261 257 { 262 258 /* … … 363 359 364 360 flexrf_base_rx::flexrf_base_rx(usrp_basic *usrp, int which, int _power_on) 365 : flexrf_base(usrp, which, false,_power_on)361 : flexrf_base(usrp, which, _power_on) 366 362 { 367 363 /* gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.h
r9757 r9762 34 34 { 35 35 public: 36 flexrf_base(usrp_basic *usrp, int which, bool tx,int _power_on=0);36 flexrf_base(usrp_basic *usrp, int which, int _power_on=0); 37 37 ~flexrf_base(); 38 38 gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_tv_rx.cc
r9733 r9762 103 103 db_tv_rx::db_tv_rx(usrp_basic *usrp, int which, 104 104 double first_IF, double second_IF) 105 : db_base(usrp, which , false)105 : db_base(usrp, which) 106 106 { 107 107 // Handler for Tv Rx daughterboards. … … 109 109 // @param usrp: instance of usrp.source_c 110 110 // @param which: which side: 0, 1 corresponding to RX_A or RX_B respectively 111 112 d_usrp = (usrp_basic_rx*)usrp;113 d_tx = false; // FIXME: this should be redundant114 111 115 112 if(which == 0) {
