Changeset 9752
- Timestamp:
- 10/08/08 15:53:42
- Files:
-
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/Makefile.am (modified) (1 diff)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.cc (modified) (6 diffs)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.h (modified) (4 diffs)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_boards.cc (modified) (2 diffs)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.cc (modified) (6 diffs)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.h (modified) (4 diffs)
- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_wbx.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/Makefile.am
r9733 r9752 114 114 db_dbs_rx.cc \ 115 115 db_xcvr2450.cc \ 116 db_wbx.cc \117 116 db_dtt754.cc \ 118 117 db_dtt768.cc 118 119 # db_wbx.cc 119 120 120 121 gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.cc
r9748 r9752 38 38 39 39 db_base::db_base(usrp_basic *usrp, int which, bool tx) 40 { 41 d_which = which; 42 d_tx = tx; 43 d_usrp = usrp; 44 40 : d_usrp(usrp), d_which(which), d_tx(tx), 41 d_lo_offset(0.0) 42 { 45 43 if(d_tx) { 46 44 d_slot = d_which * 2; … … 82 80 // Function to bypass ADC buffers. Any board which is DC-coupled 83 81 // should bypass the buffers 84 void 82 83 bool 85 84 db_base::bypass_adc_buffers(bool bypass) 86 85 { … … 88 87 throw std::runtime_error("TX Board has no adc buffers\n"); 89 88 } 89 90 bool ok = true; 90 91 if(d_which==0) { 91 92 92 d_usrp->set_adc_buffer_bypass(0, bypass); 93 d_usrp->set_adc_buffer_bypass(1, bypass); 94 } 95 else { 96 d_usrp->set_adc_buffer_bypass(2, bypass); 97 d_usrp->set_adc_buffer_bypass(3, bypass); 98 } 93 ok &= d_usrp->set_adc_buffer_bypass(0, bypass); 94 ok &= d_usrp->set_adc_buffer_bypass(1, bypass); 95 } 96 else { 97 ok &= d_usrp->set_adc_buffer_bypass(2, bypass); 98 ok &= d_usrp->set_adc_buffer_bypass(3, bypass); 99 } 100 return ok; 99 101 } 100 102 … … 162 164 } 163 165 164 165 float 166 db_base::gain_min() 167 { 168 throw std::runtime_error("gain_min() called from base class\n"); 169 } 170 171 float 172 db_base::gain_max() 173 { 174 throw std::runtime_error("gain_max() called from base class\n"); 175 } 176 177 float 178 db_base::gain_db_per_step() 179 { 180 throw std::runtime_error("gain_db_per_step() called from base class\n"); 181 } 182 183 bool 184 db_base::set_gain(float gain) 185 { 186 // Set the gain. 187 // 188 // @param gain: gain in decibels 189 // @returns True/False 190 throw std::runtime_error("set_gain() called from base class\n"); 191 } 192 193 bool 194 db_base::is_quadrature() 195 { 196 // Return True if this daughterboard does quadrature up or down conversion. 197 // That is, return True if this board requires both I & Q analog channels. 198 // 199 // This bit of info is useful when setting up the USRP Rx mux register. 200 throw std::runtime_error("is_quadrature() called from base class\n"); 201 } 202 203 bool 166 bool 204 167 db_base::i_and_q_swapped() 205 168 { … … 217 180 } 218 181 219 void 182 bool 220 183 db_base::set_enable(bool on) 221 184 { 222 185 // For tx daughterboards, this controls the transmitter enable. 223 } 224 225 void 186 187 return true; // default is nop 188 } 189 190 bool 226 191 db_base::set_auto_tr(bool on) 227 192 { … … 230 195 // Should be overridden in subclasses that care. This will typically 231 196 // set the atr_mask, txval and rxval. 232 } 233 234 void 197 198 return true; 199 } 200 201 bool 235 202 db_base::set_lo_offset(double offset) 236 203 { 237 204 // Set how much LO is offset from requested frequency 238 // 239 // Should be overriden by daughterboards that care. 240 } 241 242 double 243 db_base::lo_offset() 244 { 245 // Get how much LO is offset from requested frequency 246 // 247 // Should be overriden by daughterboards that care. 248 return 0.0; 249 } 250 251 void 205 206 d_lo_offset = offset; 207 return true; 208 } 209 210 bool 252 211 db_base::select_rx_antenna(int which_antenna) 253 212 { 254 213 // Specify which antenna port to use for reception. 255 214 // Should be overriden by daughterboards that care. 215 216 return which_antenna == 0; 256 217 } 257 218 gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.h
r9748 r9752 31 31 #include <usrp_standard.h> 32 32 33 #define NUM_DAUGHTERBOARDS 134 33 35 34 class tune_result … … 65 64 std::string side_and_name(); 66 65 67 voidbypass_adc_buffers(bool bypass);66 bool bypass_adc_buffers(bool bypass); 68 67 bool set_atr_mask(int v); 69 68 bool set_atr_txval(int v); … … 71 70 bool set_atr_tx_delay(int v); 72 71 bool set_atr_rx_delay(int v); 72 bool set_lo_offset(double offset); 73 double lo_offset() { return d_lo_offset; } 73 74 74 75 //////////////////////////////////////////////////////// 75 76 // derived classes should override the following methods 76 77 77 virtual float gain_min() ;78 virtual float gain_max() ;79 virtual float gain_db_per_step() ;80 virtual double freq_min() ;81 virtual double freq_max() ;82 virtual struct freq_result_t set_freq(double target_freq) ;83 virtual bool set_gain(float gain) ;84 virtual bool is_quadrature() ;78 virtual float gain_min() = 0; 79 virtual float gain_max() = 0; 80 virtual float gain_db_per_step() = 0; 81 virtual double freq_min() = 0; 82 virtual double freq_max() = 0; 83 virtual struct freq_result_t set_freq(double target_freq) = 0; 84 virtual bool set_gain(float gain) = 0; 85 virtual bool is_quadrature() = 0; 85 86 virtual bool i_and_q_swapped(); 86 87 virtual bool spectrum_inverted(); 87 virtual void set_enable(bool on); 88 virtual void set_auto_tr(bool on); 89 virtual void set_lo_offset(double offset); 90 virtual double lo_offset(); 91 virtual void select_rx_antenna(int which_antenna); 88 virtual bool set_enable(bool on); 89 virtual bool set_auto_tr(bool on); 90 virtual bool select_rx_antenna(int which_antenna); 92 91 93 92 // FIXME tune shouldn't be a method of db_base … … 104 103 int d_which; 105 104 bool d_tx; 105 int d_slot; 106 106 int d_refclk_reg; 107 int d_slot;107 double d_lo_offset; 108 108 }; 109 109 gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_boards.cc
r9748 r9752 170 170 break; 171 171 172 #if 0 // FIXME wbx doesn't compile 172 173 case(USRP_DBID_WBX_LO_TX): 173 174 db.push_back(db_base_sptr(new db_wbx_lo_tx(usrp, which_side))); … … 176 177 db.push_back(db_base_sptr(new db_wbx_lo_rx(usrp, which_side))); 177 178 break; 179 #endif 178 180 179 181 case(USRP_DBID_DTT754): gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.cc
r9733 r9752 287 287 } 288 288 289 void290 flexrf_base::set_lo_offset(double offset)291 {292 /*293 Set amount by which LO is offset from requested tuning frequency.294 295 @param offset: offset in Hz296 */297 d_lo_offset = offset;298 }299 300 double301 flexrf_base::lo_offset()302 {303 /*304 Get amount by which LO is offset from requested tuning frequency.305 306 @returns Offset in Hz307 */308 return d_lo_offset;309 }310 311 289 // ---------------------------------------------------------------- 312 290 … … 348 326 } 349 327 350 void 328 bool 351 329 flexrf_base_tx::set_auto_tr(bool on) 352 330 { 331 bool ok = true; 353 332 if(on) { 354 set_atr_mask (RX_TXN | ENABLE);355 set_atr_txval(0 | ENABLE);356 set_atr_rxval(RX_TXN | 0);333 ok &= set_atr_mask (RX_TXN | ENABLE); 334 ok &= set_atr_txval(0 | ENABLE); 335 ok &= set_atr_rxval(RX_TXN | 0); 357 336 } 358 337 else { 359 set_atr_mask (0); 360 set_atr_txval(0); 361 set_atr_rxval(0); 362 } 363 } 364 365 void 338 ok &= set_atr_mask (0); 339 ok &= set_atr_txval(0); 340 ok &= set_atr_rxval(0); 341 } 342 return ok; 343 } 344 345 bool 366 346 flexrf_base_tx::set_enable(bool on) 367 347 { … … 378 358 v = RX_TXN; 379 359 } 380 d_usrp->write_io(d_which, v, mask);360 return d_usrp->write_io(d_which, v, mask); 381 361 } 382 362 … … 459 439 460 440 461 462 void 441 bool 463 442 flexrf_base_rx::set_auto_tr(bool on) 464 443 { 444 bool ok = true; 465 445 if(on) { 466 set_atr_mask (ENABLE);467 set_atr_txval( 0);468 set_atr_rxval(ENABLE);446 ok &= set_atr_mask (ENABLE); 447 ok &= set_atr_txval( 0); 448 ok &= set_atr_rxval(ENABLE); 469 449 } 470 450 else { 471 set_atr_mask (0); 472 set_atr_txval(0); 473 set_atr_rxval(0); 474 } 475 } 476 477 void 451 ok &= set_atr_mask (0); 452 ok &= set_atr_txval(0); 453 ok &= set_atr_rxval(0); 454 } 455 return true; 456 } 457 458 bool 478 459 flexrf_base_rx::select_rx_antenna(int which_antenna) 479 460 { … … 490 471 } 491 472 else { 492 throw std::invalid_argument("which_antenna must be either 'TX/RX' or 'RX2'\n"); 493 } 494 } 495 496 void 473 return false; 474 // throw std::invalid_argument("which_antenna must be either 'TX/RX' or 'RX2'\n"); 475 } 476 return true; 477 } 478 479 bool 497 480 flexrf_base_rx::select_rx_antenna(const std::string &which_antenna) 498 481 { … … 509 492 } 510 493 else { 511 throw std::invalid_argument("which_antenna must be either 'TX/RX' or 'RX2'\n"); 512 } 494 // throw std::invalid_argument("which_antenna must be either 'TX/RX' or 'RX2'\n"); 495 return false; 496 } 497 return true; 513 498 } 514 499 gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.h
r9733 r9752 43 43 bool set_gain(float gain); 44 44 bool is_quadrature(); 45 double lo_offset();46 void set_lo_offset(double offset);47 45 48 46 protected: … … 65 63 int power_off() { return 0; } 66 64 67 double d_lo_offset;68 65 bool d_first; 69 66 int d_spi_format; … … 83 80 ~flexrf_base_tx(); 84 81 85 void set_auto_tr(bool on); 86 void set_enable(bool on); 87 float gain_min(); 88 float gain_max(); 89 float gain_db_per_step(); 82 float gain_min(); 83 float gain_max(); 84 float gain_db_per_step(); 85 86 bool set_auto_tr(bool on); 87 bool set_enable(bool on); 90 88 bool set_gain(float gain); 91 89 … … 100 98 ~flexrf_base_rx(); 101 99 102 voidset_auto_tr(bool on);103 voidselect_rx_antenna(int which_antenna);104 voidselect_rx_antenna(const std::string &which_antenna);100 bool set_auto_tr(bool on); 101 bool select_rx_antenna(int which_antenna); 102 bool select_rx_antenna(const std::string &which_antenna); 105 103 bool set_gain(float gain); 106 104 gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_wbx.h
r9733 r9752 88 88 ~wbx_base_tx(); 89 89 90 void set_auto_tr(bool on); 91 void set_enable(bool on); 92 void set_lo_offset(double offset); 93 double lo_offset(); 90 bool set_auto_tr(bool on); 91 bool set_enable(bool on); 94 92 }; 95 93 … … 104 102 ~wbx_base_rx(); 105 103 106 voidset_auto_tr(bool on);107 voidselect_rx_antenna(int which_antenna);108 voidselect_rx_antenna(const std::string &which_antenna);104 bool set_auto_tr(bool on); 105 bool select_rx_antenna(int which_antenna); 106 bool select_rx_antenna(const std::string &which_antenna); 109 107 bool set_gain(float gain); 110 void set_lo_offset(double offset);111 double lo_offset();112 108 bool i_and_q_swapped(); 113 109 };
