| 1 | /**************************************************************************** |
|---|
| 2 | |
|---|
| 3 | Copyright 2005,2006 Virginia Polytechnic Institute and State University |
|---|
| 4 | |
|---|
| 5 | This file is part of the OSSIE USRP Device. |
|---|
| 6 | |
|---|
| 7 | OSSIE USRP Device is free software; you can redistribute it and/or modify |
|---|
| 8 | it under the terms of the GNU General Public License as published by |
|---|
| 9 | the Free Software Foundation; either version 2 of the License, or |
|---|
| 10 | (at your option) any later version. |
|---|
| 11 | |
|---|
| 12 | OSSIE USRP Device is distributed in the hope that it will be useful, |
|---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | GNU General Public License for more details. |
|---|
| 16 | |
|---|
| 17 | You should have received a copy of the GNU General Public License |
|---|
| 18 | along with OSSIE USRP Device; if not, write to the Free Software |
|---|
| 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | ****************************************************************************/ |
|---|
| 23 | |
|---|
| 24 | #include <iostream> |
|---|
| 25 | |
|---|
| 26 | #include <omniORB4/CORBA.h> |
|---|
| 27 | |
|---|
| 28 | #include "ossie/debug.h" |
|---|
| 29 | |
|---|
| 30 | #include "USRP.h" |
|---|
| 31 | #include "flex.h" |
|---|
| 32 | |
|---|
| 33 | USRP_TX_Control_i::USRP_TX_Control_i(USRP_i *_usrp, const char* _name, const char* _domain) : standardInterfaces_i::TX_Control_p(_name, _domain), usrp(_usrp), db_lo_freq(0), db_lo_offset(-8e6), lo_locked(false) |
|---|
| 34 | { |
|---|
| 35 | DEBUG(3, USRP, "TX Control port constructor called") |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | void USRP_TX_Control_i::set_number_of_channels(unsigned long nchan) |
|---|
| 39 | { |
|---|
| 40 | DEBUG(3, USRP, "Setting number of channels to " << nchan); |
|---|
| 41 | omni_mutex_lock l(usrp->tx_control_access); |
|---|
| 42 | usrp->usrp_tx->set_nchannels(nchan); |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | void USRP_TX_Control_i::get_number_of_channels(unsigned long &num) |
|---|
| 46 | { |
|---|
| 47 | omni_mutex_lock l(usrp->tx_control_access); |
|---|
| 48 | num = usrp->usrp_tx->nchannels(); |
|---|
| 49 | } |
|---|
| 50 | |
|---|
| 51 | void USRP_TX_Control_i::get_gain_range(unsigned long channel, float &gmin, float &gmax, float &gstep) |
|---|
| 52 | { |
|---|
| 53 | omni_mutex_lock l(usrp->tx_control_access); |
|---|
| 54 | if (channel == 0) { |
|---|
| 55 | if (usrp->tx_db0_control) |
|---|
| 56 | usrp->tx_db0_control->get_gain_range(gmin, gmax, gstep); |
|---|
| 57 | } else if (channel == 1) { |
|---|
| 58 | if (usrp->tx_db1_control) |
|---|
| 59 | usrp->tx_db1_control->get_gain_range(gmin, gmax, gstep); |
|---|
| 60 | } else { |
|---|
| 61 | return; ///\todo throw bad channel exception |
|---|
| 62 | } |
|---|
| 63 | } |
|---|
| 64 | |
|---|
| 65 | void USRP_TX_Control_i::set_gain(unsigned long channel, float gain) |
|---|
| 66 | { |
|---|
| 67 | omni_mutex_lock l(usrp->tx_control_access); |
|---|
| 68 | if (channel == 0) { |
|---|
| 69 | if (usrp->tx_db0_control) |
|---|
| 70 | usrp->tx_db0_control->set_gain(gain); |
|---|
| 71 | } else if (channel == 1) { |
|---|
| 72 | if (usrp->tx_db1_control) |
|---|
| 73 | usrp->tx_db1_control->set_gain(gain); |
|---|
| 74 | } else { |
|---|
| 75 | return; ///\todo throw bad channel exception |
|---|
| 76 | } |
|---|
| 77 | } |
|---|
| 78 | |
|---|
| 79 | void USRP_TX_Control_i::get_gain(unsigned long channel, float &gain) |
|---|
| 80 | { |
|---|
| 81 | gain = usrp->usrp_tx->pga(channel); |
|---|
| 82 | } |
|---|
| 83 | |
|---|
| 84 | void USRP_TX_Control_i::get_frequency_range(unsigned long channel, float &fmin, float &fmax, float &fstep) |
|---|
| 85 | { |
|---|
| 86 | omni_mutex_lock l(usrp->tx_control_access); |
|---|
| 87 | if (channel == 0) { |
|---|
| 88 | if (usrp->tx_db0_control) |
|---|
| 89 | usrp->tx_db0_control->get_freq_range(fmin, fmax, fstep); |
|---|
| 90 | } else if (channel == 1) { |
|---|
| 91 | if (usrp->tx_db1_control) |
|---|
| 92 | usrp->tx_db1_control->get_freq_range(fmin, fmax, fstep); |
|---|
| 93 | } else { |
|---|
| 94 | return; ///\todo throw bad channel exception |
|---|
| 95 | } |
|---|
| 96 | } |
|---|
| 97 | |
|---|
| 98 | void USRP_TX_Control_i::set_frequency(unsigned long channel, float f) |
|---|
| 99 | { |
|---|
| 100 | /// \todo move this into db code to avoid the test for db have lo (maybe) |
|---|
| 101 | |
|---|
| 102 | class db_base *db(NULL); |
|---|
| 103 | |
|---|
| 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 | } |
|---|
| 114 | |
|---|
| 115 | if (!db) |
|---|
| 116 | return; // No daughter board present |
|---|
| 117 | |
|---|
| 118 | if (db->db_has_lo()) { |
|---|
| 119 | float fmin, fmax, fstep; |
|---|
| 120 | db->get_freq_range(fmin, fmax, fstep); |
|---|
| 121 | if ((f < fmin) || (f > fmax)) |
|---|
| 122 | return; /// \todo throw exception |
|---|
| 123 | |
|---|
| 124 | if (!lo_locked) { |
|---|
| 125 | float db_lo_freq_set = f + db_lo_offset; |
|---|
| 126 | if (db_lo_freq_set < fmin) |
|---|
| 127 | db_lo_freq_set = fmin; |
|---|
| 128 | else if (db_lo_freq_set > fmax) |
|---|
| 129 | db_lo_freq_set = fmax; |
|---|
| 130 | |
|---|
| 131 | db->set_db_freq(db_lo_freq_set, db_lo_freq); |
|---|
| 132 | } |
|---|
| 133 | } else |
|---|
| 134 | db_lo_freq = 0.0; |
|---|
| 135 | |
|---|
| 136 | float ddc_freq = f - db_lo_freq; |
|---|
| 137 | if ((ddc_freq < 0.0) || (ddc_freq > 32e6)) |
|---|
| 138 | return; ///\todo throw an exception |
|---|
| 139 | |
|---|
| 140 | usrp->usrp_tx->set_tx_freq(channel, ddc_freq); |
|---|
| 141 | |
|---|
| 142 | } |
|---|
| 143 | |
|---|
| 144 | void USRP_TX_Control_i::get_frequency(unsigned long channel, float &f) |
|---|
| 145 | { |
|---|
| 146 | f = usrp->usrp_tx->tx_freq(channel); |
|---|
| 147 | } |
|---|
| 148 | |
|---|
| 149 | void USRP_TX_Control_i::start(unsigned long channel) |
|---|
| 150 | { |
|---|
| 151 | |
|---|
| 152 | omni_mutex_lock l(usrp->tx_control_access); |
|---|
| 153 | if (channel == 0) { |
|---|
| 154 | if (usrp->tx_db0_control) |
|---|
| 155 | usrp->tx_db0_control->set_enable(true); |
|---|
| 156 | } else if (channel == 1) { |
|---|
| 157 | if (usrp->tx_db1_control) |
|---|
| 158 | usrp->tx_db1_control->set_enable(true); |
|---|
| 159 | } else { |
|---|
| 160 | return; /// \todo throw bad channel exception |
|---|
| 161 | } |
|---|
| 162 | |
|---|
| 163 | if (!usrp->tx_active) |
|---|
| 164 | usrp->usrp_tx->start(); |
|---|
| 165 | |
|---|
| 166 | usrp->rx_thread = new omni_thread(USRP_i::do_tx_data_process, ((void *)usrp)); |
|---|
| 167 | usrp->rx_thread->start(); |
|---|
| 168 | |
|---|
| 169 | } |
|---|
| 170 | |
|---|
| 171 | void USRP_TX_Control_i::stop(unsigned long channel) |
|---|
| 172 | { |
|---|
| 173 | |
|---|
| 174 | omni_mutex_lock l(usrp->tx_control_access); |
|---|
| 175 | if (channel == 0) { |
|---|
| 176 | if (usrp->tx_db0_control) |
|---|
| 177 | usrp->tx_db0_control->set_enable(false); |
|---|
| 178 | } else if (channel == 1) { |
|---|
| 179 | if (usrp->tx_db1_control) |
|---|
| 180 | usrp->tx_db1_control->set_enable(false); |
|---|
| 181 | } |
|---|
| 182 | |
|---|
| 183 | if (usrp->tx_active) |
|---|
| 184 | usrp->usrp_tx->stop(); |
|---|
| 185 | usrp->tx_active = false; |
|---|
| 186 | } |
|---|
| 187 | |
|---|
| 188 | void USRP_TX_Control_i::set_values(const CF::Properties &values) |
|---|
| 189 | { |
|---|
| 190 | DEBUG(3, USRP, "USRP TX setting " << values.length() << " values, value[0].id " << values[0].id) |
|---|
| 191 | |
|---|
| 192 | for (unsigned int i =0; i < values.length(); ++i) { |
|---|
| 193 | if (strcmp(values[i].id, "SET_MUX") == 0 ) { |
|---|
| 194 | CORBA::ULong mux; |
|---|
| 195 | values[i].value >>= mux; |
|---|
| 196 | DEBUG(3, USRP, "Setting transmit mux to " << mux) |
|---|
| 197 | omni_mutex_lock l(usrp->tx_control_access); |
|---|
| 198 | usrp->usrp_tx->set_mux(mux); |
|---|
| 199 | } else if (strcmp(values[i].id, "SET_AUTO_TR_1") == 0) { |
|---|
| 200 | CORBA::ULong atx; |
|---|
| 201 | values[i].value >>= atx; |
|---|
| 202 | DEBUG(3, USRP, "Set Auto TX/RX for side 1 to " << atx) |
|---|
| 203 | omni_mutex_lock l(usrp->tx_control_access); |
|---|
| 204 | if (usrp->tx_db0_control && usrp->rx_db0_control) { |
|---|
| 205 | if (atx) { |
|---|
| 206 | usrp->tx_db0_control->set_auto_tr(true); |
|---|
| 207 | usrp->rx_db0_control->set_auto_tr(true); |
|---|
| 208 | } else { |
|---|
| 209 | usrp->tx_db0_control->set_auto_tr(false); |
|---|
| 210 | usrp->rx_db0_control->set_auto_tr(false); |
|---|
| 211 | } |
|---|
| 212 | } |
|---|
| 213 | } |
|---|
| 214 | } |
|---|
| 215 | } |
|---|
| 216 | |
|---|
| 217 | void USRP_TX_Control_i::set_interpolation_rate(unsigned long channel, unsigned long I) |
|---|
| 218 | { |
|---|
| 219 | |
|---|
| 220 | // USRP interpolation rate applies to all channels, ignore channel |
|---|
| 221 | omni_mutex_lock l(usrp->tx_control_access); |
|---|
| 222 | usrp->usrp_tx->set_interp_rate(I); |
|---|
| 223 | } |
|---|
| 224 | |
|---|
| 225 | void USRP_TX_Control_i::get_interpolation_range(unsigned long channel, unsigned long &imin, unsigned long &imax, unsigned long &istep) |
|---|
| 226 | { |
|---|
| 227 | |
|---|
| 228 | imin = 4; |
|---|
| 229 | imax = 512; |
|---|
| 230 | istep = 4; |
|---|
| 231 | } |
|---|
| 232 | |
|---|
| 233 | USRP_RX_Control_i::USRP_RX_Control_i(USRP_i *_usrp, const char* _name, const char* _domain) : standardInterfaces_i::RX_Control_p(_name, _domain), usrp(_usrp), db_lo_freq(0), db_lo_offset(-8e6), lo_locked(false) |
|---|
| 234 | { |
|---|
| 235 | DEBUG(3, USRP, "RX Control port constructor called") |
|---|
| 236 | } |
|---|
| 237 | |
|---|
| 238 | void USRP_RX_Control_i::set_number_of_channels(unsigned long nchan) |
|---|
| 239 | { |
|---|
| 240 | DEBUG(3, USRP, "Setting number of channels to " << nchan) |
|---|
| 241 | omni_mutex_lock l(usrp->rx_control_access); |
|---|
| 242 | usrp->usrp_rx->set_nchannels(nchan); |
|---|
| 243 | } |
|---|
| 244 | |
|---|
| 245 | void USRP_RX_Control_i::get_number_of_channels(unsigned long &num) |
|---|
| 246 | { |
|---|
| 247 | omni_mutex_lock l(usrp->rx_control_access); |
|---|
| 248 | num = usrp->usrp_rx->nchannels(); |
|---|
| 249 | } |
|---|
| 250 | |
|---|
| 251 | void USRP_RX_Control_i::get_gain_range(unsigned long channel, float &gmin, float &gmax, float &gstep) |
|---|
| 252 | { |
|---|
| 253 | omni_mutex_lock l(usrp->rx_control_access); |
|---|
| 254 | if (channel == 0) { |
|---|
| 255 | if (usrp->rx_db0_control) |
|---|
| 256 | usrp->rx_db0_control->get_gain_range(gmin, gmax, gstep); |
|---|
| 257 | } else if (channel == 1) { |
|---|
| 258 | if (usrp->rx_db1_control) |
|---|
| 259 | usrp->rx_db1_control->get_gain_range(gmin, gmax, gstep); |
|---|
| 260 | } else { |
|---|
| 261 | return; ///\todo throw bad channel exception |
|---|
| 262 | } |
|---|
| 263 | } |
|---|
| 264 | |
|---|
| 265 | void USRP_RX_Control_i::set_gain(unsigned long channel, float gain) |
|---|
| 266 | { |
|---|
| 267 | omni_mutex_lock l(usrp->rx_control_access); |
|---|
| 268 | if (channel == 0) { |
|---|
| 269 | if (usrp->rx_db0_control) |
|---|
| 270 | usrp->rx_db0_control->set_gain(gain); |
|---|
| 271 | } else if (channel == 1) { |
|---|
| 272 | if (usrp->rx_db1_control) |
|---|
| 273 | usrp->rx_db1_control->set_gain(gain); |
|---|
| 274 | } else { |
|---|
| 275 | DEBUG(1, USRP, "Attempt to set gain on non-existent db."); |
|---|
| 276 | return; ///\todo throw bad channel exception |
|---|
| 277 | } |
|---|
| 278 | } |
|---|
| 279 | |
|---|
| 280 | void USRP_RX_Control_i::get_gain(unsigned long channel, float &gain) |
|---|
| 281 | { |
|---|
| 282 | int temp_gain, temp_aux; |
|---|
| 283 | temp_gain = (int) usrp->usrp_rx->pga(channel); |
|---|
| 284 | temp_aux = usrp->usrp_rx->read_aux_adc(channel, 0); |
|---|
| 285 | |
|---|
| 286 | // for now adding temp_gain and temp_aux.....PHELPS with fix it |
|---|
| 287 | gain = temp_gain + temp_aux; |
|---|
| 288 | |
|---|
| 289 | } |
|---|
| 290 | |
|---|
| 291 | void USRP_RX_Control_i::get_frequency_range(unsigned long channel, float &fmin, float &fmax, float &fstep) |
|---|
| 292 | { |
|---|
| 293 | omni_mutex_lock l(usrp->rx_control_access); |
|---|
| 294 | if (channel == 0) { |
|---|
| 295 | if (usrp->rx_db0_control) |
|---|
| 296 | usrp->rx_db0_control->get_freq_range(fmin, fmax, fstep); |
|---|
| 297 | } else if (channel == 1) { |
|---|
| 298 | if (usrp->rx_db1_control) |
|---|
| 299 | usrp->rx_db1_control->get_freq_range(fmin, fmax, fstep); |
|---|
| 300 | } else { |
|---|
| 301 | return; ///\todo throw bad channel exception |
|---|
| 302 | } |
|---|
| 303 | } |
|---|
| 304 | |
|---|
| 305 | void USRP_RX_Control_i::get_db_reference(unsigned long channel, db_base *& db) |
|---|
| 306 | { |
|---|
| 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 | omni_mutex_lock l(usrp->rx_control_access); |
|---|
| 317 | if (channel == 0) { |
|---|
| 318 | if (usrp->rx_db0_control) |
|---|
| 319 | db = usrp->rx_db0_control; |
|---|
| 320 | } else if (channel == 1) { |
|---|
| 321 | if (usrp->rx_db1_control) |
|---|
| 322 | db = usrp->rx_db1_control; |
|---|
| 323 | } else { |
|---|
| 324 | std::cerr << "Bad channel specified" << std::endl; |
|---|
| 325 | return; ///\todo throw bad channel exception |
|---|
| 326 | } |
|---|
| 327 | |
|---|
| 328 | if (!db) { |
|---|
| 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; |
|---|
| 335 | } |
|---|
| 336 | |
|---|
| 337 | float fmin, fmax, fstep; |
|---|
| 338 | db->get_freq_range(fmin, fmax, fstep); |
|---|
| 339 | if ((f < fmin) || (f > fmax)) { |
|---|
| 340 | std::cerr << "Frequency setting not in range " << fmin << " < " << f << " < " << fmax << std::endl; |
|---|
| 341 | return; /// \todo throw exception |
|---|
| 342 | } |
|---|
| 343 | |
|---|
| 344 | if (db->db_has_lo()) { |
|---|
| 345 | if (!lo_locked) { |
|---|
| 346 | float db_lo_freq_set = f + db_lo_offset; |
|---|
| 347 | if (db_lo_freq_set < fmin) |
|---|
| 348 | db_lo_freq_set = fmin; |
|---|
| 349 | else if (db_lo_freq_set > fmax) |
|---|
| 350 | db_lo_freq_set = fmax; |
|---|
| 351 | |
|---|
| 352 | bool freq_set = db->set_db_freq(db_lo_freq_set, db_lo_freq); |
|---|
| 353 | if (freq_set) |
|---|
| 354 | DEBUG(3, USRP, "Set db lo to " << (long)db_lo_freq_set << ", Actual setting " << (float) db_lo_freq) |
|---|
| 355 | else |
|---|
| 356 | std::cerr << "Failed to set db lo to " << (float) db_lo_freq_set << std::endl; |
|---|
| 357 | } |
|---|
| 358 | } else |
|---|
| 359 | db_lo_freq = 0.0; |
|---|
| 360 | |
|---|
| 361 | float ddc_freq = f - db_lo_freq; |
|---|
| 362 | if ((ddc_freq < 0e6) || (ddc_freq > 32e6)) { |
|---|
| 363 | std::cerr << "Frequency for DDC not in range 0 < " << ddc_freq << " < 32e6" << std::endl; |
|---|
| 364 | return; ///\todo throw an exception |
|---|
| 365 | } |
|---|
| 366 | |
|---|
| 367 | usrp->usrp_rx->set_rx_freq(channel, ddc_freq); |
|---|
| 368 | DEBUG(3, USRP, "Setting ddc lo to " << (long)ddc_freq << " Actual frequency " << (long)usrp->usrp_rx->rx_freq(channel)) |
|---|
| 369 | |
|---|
| 370 | } |
|---|
| 371 | |
|---|
| 372 | void USRP_RX_Control_i::get_frequency(unsigned long channel, float &f) |
|---|
| 373 | { |
|---|
| 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; |
|---|
| 395 | } |
|---|
| 396 | |
|---|
| 397 | void USRP_RX_Control_i::start(unsigned long channel) |
|---|
| 398 | { |
|---|
| 399 | |
|---|
| 400 | omni_mutex_lock l(usrp->rx_control_access); |
|---|
| 401 | |
|---|
| 402 | usrp->rx_packet_count = usrp->set_rx_packet_count; |
|---|
| 403 | usrp->rx_active = 1; |
|---|
| 404 | |
|---|
| 405 | // Set up RX thread |
|---|
| 406 | usrp->rx_thread = new omni_thread(USRP_i::do_rx_data_process, ((void *)usrp)); |
|---|
| 407 | usrp->rx_thread->start(); |
|---|
| 408 | } |
|---|
| 409 | |
|---|
| 410 | void USRP_RX_Control_i::stop(unsigned long channel) |
|---|
| 411 | { |
|---|
| 412 | omni_mutex_lock l(usrp->rx_control_access); |
|---|
| 413 | |
|---|
| 414 | usrp->rx_active = 0; |
|---|
| 415 | } |
|---|
| 416 | |
|---|
| 417 | void USRP_RX_Control_i::set_values(const CF::Properties &values) |
|---|
| 418 | { |
|---|
| 419 | DEBUG(3, USRP, "USRP RX setting " << values.length() << " values, value[0].id " << values[0].id) |
|---|
| 420 | |
|---|
| 421 | for (unsigned int i =0; i < values.length(); ++i) { |
|---|
| 422 | if (strcmp(values[i].id, "SET_NUM_RX_PACKETS") == 0) { |
|---|
| 423 | CORBA::ULong num_packets; |
|---|
| 424 | values[i].value >>= num_packets; |
|---|
| 425 | DEBUG(3, USRP, "Number of packets to RX = " << num_packets) |
|---|
| 426 | usrp->set_rx_packet_count = num_packets; |
|---|
| 427 | } else if (strcmp(values[i].id, "SET_MUX") == 0 ) { |
|---|
| 428 | CORBA::ULong mux; |
|---|
| 429 | values[i].value >>= mux; |
|---|
| 430 | DEBUG(3, USRP, "Setting receive mux to " << mux) |
|---|
| 431 | omni_mutex_lock l(usrp->rx_control_access); |
|---|
| 432 | usrp->usrp_rx->set_mux(mux); |
|---|
| 433 | } else if (strcmp(values[i].id, "SET_RX_ANT_1") == 0 ) { |
|---|
| 434 | CORBA::ULong ant; |
|---|
| 435 | values[i].value >>= ant; |
|---|
| 436 | DEBUG(3, USRP, "Setting receive antenna to " << ant) |
|---|
| 437 | omni_mutex_lock l(usrp->rx_control_access); |
|---|
| 438 | if (usrp->rx_db0_control) |
|---|
| 439 | usrp->rx_db0_control->select_rx_antenna(ant); |
|---|
| 440 | } |
|---|
| 441 | } |
|---|
| 442 | } |
|---|
| 443 | |
|---|
| 444 | void USRP_RX_Control_i::set_decimation_rate(unsigned long channel, unsigned long D) |
|---|
| 445 | { |
|---|
| 446 | omni_mutex_lock l(usrp->rx_control_access); |
|---|
| 447 | usrp->usrp_rx->set_decim_rate(D); |
|---|
| 448 | } |
|---|
| 449 | |
|---|
| 450 | void USRP_RX_Control_i::get_decimation_range(unsigned long channel, unsigned long &dmin, unsigned long &dmax, unsigned long &dstep) |
|---|
| 451 | { |
|---|
| 452 | dmin = 4; |
|---|
| 453 | dmax = 256; |
|---|
| 454 | dstep = 2; |
|---|
| 455 | } |
|---|
| 456 | |
|---|
| 457 | void USRP_RX_Control_i::set_data_packet_size(unsigned long channel, unsigned long N) |
|---|
| 458 | { |
|---|
| 459 | omni_mutex_lock l(usrp->rx_control_access); |
|---|
| 460 | usrp->rx_packet_size = N; |
|---|
| 461 | } |
|---|