Changeset 9762

Show
Ignore:
Timestamp:
10/08/08 23:00:06
Author:
eb
Message:

Use new usrp_basic methods in db_* code.
Removed all uses of d_tx and d_slot.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.cc

    r9752 r9762  
    3737 
    3838 
    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]; 
     39db_base::db_base(usrp_basic *usrp, int which) 
     40  : d_usrp(usrp), d_which(which), d_lo_offset(0.0) 
     41
    5242} 
    5343 
     
    8474db_base::bypass_adc_buffers(bool bypass) 
    8575{ 
    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  //
    8979 
    9080  bool ok = true; 
    9181  if(d_which==0) { 
    92      
    9382    ok &= d_usrp->set_adc_buffer_bypass(0, bypass); 
    9483    ok &= d_usrp->set_adc_buffer_bypass(1, bypass); 
     
    10594{ 
    10695  // 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); 
    10897} 
    10998 
     
    112101{ 
    113102  // 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); 
    115104} 
    116105   
     
    119108{ 
    120109  // 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); 
    122111} 
    123112   
     
    127116  // Set Auto T/R delay (in clock ticks) from when Tx fifo gets data to  
    128117  // 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); 
    130119} 
    131120 
     
    135124  // Set Auto T/R delay (in clock ticks) from when Tx fifo goes empty to  
    136125  // 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); 
    164127} 
    165128 
     
    242205  if(enable) { 
    243206    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); 
    250211  } 
    251212} 
  • gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.h

    r9752 r9762  
    5757{ 
    5858 public: 
    59   db_base(usrp_basic *usrp, int which, bool tx=true); 
     59  db_base(usrp_basic *usrp, int which); 
    6060  virtual ~db_base(); 
    6161 
     
    102102  usrp_basic   *d_usrp; 
    103103  int           d_which; 
    104   bool          d_tx; 
    105   int           d_slot; 
    106   int           d_refclk_reg; 
    107104  double        d_lo_offset; 
    108105}; 
  • gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_basic.cc

    r9733 r9762  
    2525 
    2626db_basic_tx::db_basic_tx(usrp_basic *usrp, int which) 
    27   : db_base(usrp, which, true
     27  : db_base(usrp, which
    2828{ 
    2929  // Handler for Basic Tx daughterboards. 
     
    3232  // @param which: which side: 0 or 1 corresponding to TX_A or TX_B respectively 
    3333 
    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 
    4035} 
    4136 
     
    118113 
    119114db_basic_rx::db_basic_rx(usrp_basic *usrp, int which, int subdev) 
    120   : db_base(usrp, which, false
     115  : db_base(usrp, which
    121116{ 
    122117  // Handler for Basic Rx daughterboards. 
  • gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.cc

    r9733 r9762  
    3131 
    3232db_dbs_rx::db_dbs_rx(usrp_basic *usrp, int which) 
    33   : db_base(usrp, which, false
     33  : db_base(usrp, which
    3434{ 
    3535  // Control DBS receiver based USRP daughterboard. 
     
    3737  // @param usrp: instance of usrp.source_c 
    3838  // @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 redundant 
    4239 
    4340  d_usrp->_write_oe(d_which, 0x0001, 0x0001); 
  • gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.h

    r9733 r9762  
    3434{ 
    3535private: 
    36   usrp_basic_rx *d_usrp; 
    3736  int d_osc, d_cp, d_n, d_div2, d_r, d_r_int; 
    3837  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  
    3737#define CLOCK_OUT (1 << 0) 
    3838 
    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) 
     39flexrf_base::flexrf_base(usrp_basic *usrp, int which, int _power_on) 
     40  : db_base(usrp, which), d_power_on(_power_on) 
    4141{ 
    4242  /* 
     
    5757flexrf_base::~flexrf_base() 
    5858{ 
    59   // turn off power to board 
    60   d_usrp->common_write_io((d_tx ? C_TX : C_RX),  
    61                           d_which, power_off(), POWER_UP); 
    62  
    6359  delete d_common; 
    6460} 
     
    258254 
    259255flexrf_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) 
    261257{ 
    262258  /* 
     
    363359 
    364360flexrf_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) 
    366362{ 
    367363  /* 
  • gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.h

    r9757 r9762  
    3434{ 
    3535public: 
    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); 
    3737  ~flexrf_base(); 
    3838 
  • gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_tv_rx.cc

    r9733 r9762  
    103103db_tv_rx::db_tv_rx(usrp_basic *usrp, int which, 
    104104                   double first_IF, double second_IF) 
    105   : db_base(usrp, which, false
     105  : db_base(usrp, which
    106106{ 
    107107  // Handler for Tv Rx daughterboards. 
     
    109109  // @param usrp: instance of usrp.source_c 
    110110  // @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 redundant 
    114111 
    115112  if(which == 0) {