Changeset 4748
- Timestamp:
- 08/17/07 12:44:14 (6 years ago)
- Location:
- platform/USRP/branches/USRP-metadata/src
- Files:
-
- 2 modified
-
USRP.h (modified) (1 diff)
-
port_impl.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
platform/USRP/branches/USRP-metadata/src/USRP.h
r4747 r4748 116 116 USRP_TX_Control_i(const USRP_TX_Control_i &); // No copying 117 117 118 /// return pointer to daughterboard 119 void get_db_reference(unsigned long channel, db_base *& db); 120 118 121 USRP_i *usrp; 119 122 -
platform/USRP/branches/USRP-metadata/src/port_impl.cpp
r4747 r4748 96 96 } 97 97 98 void USRP_TX_Control_i::get_db_reference(unsigned long channel, db_base *& db) 99 { 100 omni_mutex_lock l(usrp->rx_control_access); 101 if (channel == 0) { 102 if (usrp->rx_db0_control) 103 db = usrp->rx_db0_control; 104 } else if (channel == 1) { 105 if (usrp->rx_db1_control) 106 db = usrp->rx_db1_control; 107 } else { 108 std::cerr << "Bad channel specified" << std::endl; 109 return; ///\todo throw bad channel exception 110 } 111 } 112 113 98 114 void USRP_TX_Control_i::set_frequency(unsigned long channel, float f) 99 115 { … … 102 118 class db_base *db(NULL); 103 119 104 omni_mutex_lock l(usrp->tx_control_access); 105 if (channel == 0) { 106 if (usrp->tx_db0_control) 107 db = usrp->tx_db0_control; 108 } else if (channel == 1) { 109 if (usrp->tx_db1_control) 110 db = usrp->tx_db1_control; 111 } else { 112 return; ///\todo throw bad channel exception 113 } 120 // get reference for daughter board on this channel 121 get_db_reference(channel, db); 114 122 115 123 if (!db) … … 144 152 void USRP_TX_Control_i::get_frequency(unsigned long channel, float &f) 145 153 { 146 f = usrp->usrp_tx->tx_freq(channel); 154 float ddc_freq = usrp->usrp_rx->rx_freq(channel); // DDC frequency 155 156 // Get local oscillator frequency on daughterboard (if available) 157 //float lo_freq(0.0f) 158 db_base * db(NULL); 159 get_db_reference(channel, db); 160 if (!db) { 161 // No daughterboard present 162 std::cerr << "ERROR: USRP_RX_Control_i::get_frequency(): " << std::endl 163 << " Attempt to get frequency for slot with no board (channel " 164 << channel << ")" << std::endl; 165 ///\todo: throw better exception 166 throw 0; 167 } 168 169 if (db->db_has_lo()) { 170 // get lo_freq here 171 // db->get_db_freq(lo_freq) 172 } 173 174 f = ddc_freq + db_lo_freq; 147 175 } 148 176 … … 305 333 void USRP_RX_Control_i::get_db_reference(unsigned long channel, db_base *& db) 306 334 { 307 308 }309 310 void USRP_RX_Control_i::set_frequency(unsigned long channel, float f)311 {312 DEBUG(3, USRP, "In RX Control set frequency channel: " << channel << ", frequency: " << f);313 314 class db_base *db(NULL);315 316 335 omni_mutex_lock l(usrp->rx_control_access); 317 336 if (channel == 0) { … … 325 344 return; ///\todo throw bad channel exception 326 345 } 327 346 } 347 348 void USRP_RX_Control_i::set_frequency(unsigned long channel, float f) 349 { 350 DEBUG(3, USRP, "In RX Control set frequency channel: " << channel << ", frequency: " << f); 351 352 class db_base *db(NULL); 353 354 // get reference for daughter board on this channel 355 get_db_reference(channel, db); 356 328 357 if (!db) { 329 358 // No daughterboard present 330 std::cerr << "ERROR: USRP_RX_Control_i:: get_frequency(): " << std::endl359 std::cerr << "ERROR: USRP_RX_Control_i::set_frequency(): " << std::endl 331 360 << " Attempt to set frequency for slot with no board (channel " 332 361 << channel << ")" << std::endl; … … 375 404 376 405 // Get local oscillator frequency on daughterboard (if available) 377 float lo_freq(0.0f);406 //float lo_freq(0.0f) 378 407 db_base * db(NULL); 379 408 get_db_reference(channel, db); … … 392 421 } 393 422 394 f = ddc_freq + lo_freq;423 f = ddc_freq + db_lo_freq; 395 424 } 396 425