Changeset 4747
- Timestamp:
- 08/17/07 12:13:44 (6 years ago)
- Location:
- platform/USRP/branches/USRP-metadata/src
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
platform/USRP/branches/USRP-metadata/src/USRP.cpp
r4522 r4747 79 79 rx_data_2_port = new standardInterfaces_i::complexShort_u("RX_Data_2", "DomainName1"); 80 80 81 // Initialize meta data pointers, objects 82 rx_metadata_1 = new standardInterfaces::MetaData; 83 rx_metadata_2 = new standardInterfaces::MetaData; 84 tx_metadata = new standardInterfaces::MetaData; 85 standardInterfaces::InitializeMetaData( *rx_metadata_1 ); 86 standardInterfaces::InitializeMetaData( *rx_metadata_2 ); 87 standardInterfaces::InitializeMetaData( *tx_metadata ); 88 89 } 90 91 // Destructor 92 USRP_i::~USRP_i() { 93 94 // Delete port instances 95 delete rx_control_port; 96 delete tx_control_port; 97 delete tx_data_port; 98 delete rx_data_1_port; 99 delete rx_data_2_port; 100 101 // Delete metadata objects 102 delete rx_metadata_1; 103 delete rx_metadata_2; 104 delete tx_metadata; 105 81 106 } 82 107 … … 530 555 Q[i/2] = (CORBA::Short) rx_buffer[i+1]; 531 556 } 532 rx_data_1_port->pushPacket(I, Q); 557 // set rx_metadata_1 properties before passing 558 float f; // temporary placeholder for frequency 559 rx_control_port->get_frequency(0, f); 560 rx_metadata_1->carrier_frequency = f; 561 rx_metadata_1->sampling_frequency = 64e6f / float(usrp_rx->decim_rate()); 562 563 // push data to output port 564 rx_data_1_port->pushPacket(I, Q, *rx_metadata_1); 533 565 534 566 if (rx_packet_count != -1) … … 598 630 while (tx_active) { 599 631 600 tx_data_port->getData(I_in, Q_in );632 tx_data_port->getData(I_in, Q_in, tx_metadata); 601 633 602 634 unsigned int data_length(I_in->length()); -
platform/USRP/branches/USRP-metadata/src/USRP.h
r4522 r4747 76 76 USRP_RX_Control_i(); // No default constructor 77 77 USRP_RX_Control_i(const USRP_RX_Control_i &); // No copying 78 79 /// return pointer to daughterboard 80 void get_db_reference(unsigned long channel, db_base *& db); 78 81 79 82 USRP_i *usrp; … … 127 130 ~TX_data_i(); 128 131 129 void pushPacket(const PortTypes::ShortSequence &I, const PortTypes::ShortSequence &Q); 132 void pushPacket( 133 const PortTypes::ShortSequence &I, 134 const PortTypes::ShortSequence &Q, 135 const standardInterfaces::MetaData &packet_data); 130 136 131 137 private: … … 142 148 143 149 // Main USRP device definition 144 void rx_data_process(void *data);145 150 146 151 class USRP_i : public virtual Device_impl … … 150 155 friend class USRP_TX_Control_i; 151 156 152 friend void rx_data_process(void *);153 154 157 public: 155 158 USRP_i(char *id, char *label, char *profile); 159 160 /// Destructor 161 ~USRP_i(); 156 162 157 163 static void do_rx_data_process(void *u) {((USRP_i *)u)->rx_data_process(); }; … … 179 185 USRP_i(const USRP_i&); // No copying 180 186 181 // RX data processing thread182 // static void rx_data_process(void * data); ///\todo verify statis is the online way183 184 187 /// Prints warning about unsupported USRP daughter boards 185 188 void PrintDaughterboardWarning(const char * db_name); … … 191 194 standardInterfaces_i::complexShort_u* rx_data_1_port; 192 195 standardInterfaces_i::complexShort_u* rx_data_2_port; 196 standardInterfaces::MetaData* rx_metadata_1; 197 standardInterfaces::MetaData* rx_metadata_2; 193 198 194 199 standardInterfaces_i::complexShort_p* tx_data_port; 200 standardInterfaces::MetaData* tx_metadata; 195 201 196 202 // usrp variables … … 213 219 omni_thread *tx_thread; 214 220 221 /// Main RX processing thread 215 222 void rx_data_process(); 223 224 /// Main TX processing thread 216 225 void tx_data_process(); 217 226 -
platform/USRP/branches/USRP-metadata/src/port_impl.cpp
r4522 r4747 303 303 } 304 304 305 void USRP_RX_Control_i::get_db_reference(unsigned long channel, db_base *& db) 306 { 307 308 } 309 305 310 void USRP_RX_Control_i::set_frequency(unsigned long channel, float f) 306 311 { … … 322 327 323 328 if (!db) { 324 DEBUG(1, USRP, "Attempt to set frequency for slot with no board."); 325 return; // No daughter board present 329 // No daughterboard present 330 std::cerr << "ERROR: USRP_RX_Control_i::get_frequency(): " << std::endl 331 << " Attempt to set frequency for slot with no board (channel " 332 << channel << ")" << std::endl; 333 ///\todo: throw better exception 334 throw 0; 326 335 } 327 336 … … 363 372 void USRP_RX_Control_i::get_frequency(unsigned long channel, float &f) 364 373 { 365 f = usrp->usrp_rx->rx_freq(channel); 374 float ddc_freq = usrp->usrp_rx->rx_freq(channel); // DDC frequency 375 376 // Get local oscillator frequency on daughterboard (if available) 377 float lo_freq(0.0f); 378 db_base * db(NULL); 379 get_db_reference(channel, db); 380 if (!db) { 381 // No daughterboard present 382 std::cerr << "ERROR: USRP_RX_Control_i::get_frequency(): " << std::endl 383 << " Attempt to get frequency for slot with no board (channel " 384 << channel << ")" << std::endl; 385 ///\todo: throw better exception 386 throw 0; 387 } 388 389 if (db->db_has_lo()) { 390 // get lo_freq here 391 // db->get_db_freq(lo_freq) 392 } 393 394 f = ddc_freq + lo_freq; 366 395 } 367 396