Revision 0946176f host/lib/usrp/usrp1/io_impl.cpp
| b/host/lib/usrp/usrp1/io_impl.cpp | ||
|---|---|---|
| 441 | 441 |
|
| 442 | 442 |
double usrp1_impl::update_rx_samp_rate(size_t dspno, const double samp_rate){
|
| 443 | 443 |
|
| 444 |
const size_t div = 2;
|
|
| 444 |
const size_t div = this->has_rx_halfband()? 2 : 1;
|
|
| 445 | 445 |
const size_t rate = uhd::clip<size_t>( |
| 446 | 446 |
boost::math::iround(_master_clock_rate / samp_rate), 4, 256) & ~(div-1); |
| 447 | 447 |
|
| 448 |
if (rate < 8 and this->has_rx_halfband()) UHD_MSG(warning) << |
|
| 449 |
"USRP1 cannot achieve decimations below 8 when the half-band filter is present.\n" |
|
| 450 |
"The usrp1_fpga_4rx.rbf file is a special FPGA image without RX half-band filters.\n" |
|
| 451 |
"To load this image, set the device address key/value pair: fpga=usrp1_fpga_4rx.rbf\n" |
|
| 452 |
<< std::endl; |
|
| 453 |
|
|
| 448 | 454 |
if (dspno == 0){ //only care if dsp0 is set since its homogeneous
|
| 449 | 455 |
bool s = this->disable_rx(); |
| 450 | 456 |
_iface->poke32(FR_RX_SAMPLE_RATE_DIV, div - 1); |
| ... | ... | |
| 464 | 470 |
|
| 465 | 471 |
double usrp1_impl::update_tx_samp_rate(size_t dspno, const double samp_rate){
|
| 466 | 472 |
|
| 467 |
const size_t div = 2;
|
|
| 473 |
const size_t div = this->has_tx_halfband()? 2 : 1;
|
|
| 468 | 474 |
const size_t rate = uhd::clip<size_t>( |
| 469 | 475 |
boost::math::iround(_master_clock_rate / samp_rate), 8, 256) & ~(div-1); |
| 470 | 476 |
|
| ... | ... | |
| 534 | 540 |
/*********************************************************************** |
| 535 | 541 |
* Receive streamer |
| 536 | 542 |
**********************************************************************/ |
| 537 |
rx_streamer::sptr usrp1_impl::get_rx_stream(const uhd::stream_args_t &args){
|
|
| 543 |
rx_streamer::sptr usrp1_impl::get_rx_stream(const uhd::stream_args_t &args_){
|
|
| 544 |
stream_args_t args = args_; |
|
| 545 |
|
|
| 546 |
//setup defaults for unspecified values |
|
| 547 |
args.otw_format = args.otw_format.empty()? "sc16" : args.otw_format; |
|
| 548 |
args.channels = args.channels.empty()? std::vector<size_t>(1, 0) : args.channels; |
|
| 549 |
|
|
| 538 | 550 |
if (args.otw_format == "sc16"){
|
| 539 | 551 |
_iface->poke32(FR_RX_FORMAT, 0 |
| 540 | 552 |
| (0 << bmFR_RX_FORMAT_SHIFT_SHIFT) |
| ... | ... | |
| 553 | 565 |
throw uhd::value_error("USRP1 RX cannot handle requested wire format: " + args.otw_format);
|
| 554 | 566 |
} |
| 555 | 567 |
|
| 556 |
//map an empty channel set to chan0 |
|
| 557 |
const std::vector<size_t> channels = args.channels.empty()? std::vector<size_t>(1, 0) : args.channels; |
|
| 558 |
|
|
| 559 | 568 |
//calculate packet size |
| 560 |
const size_t bpp = _data_transport->get_recv_frame_size()/channels.size(); |
|
| 569 |
const size_t bpp = _data_transport->get_recv_frame_size()/args.channels.size();
|
|
| 561 | 570 |
const size_t spp = bpp/convert::get_bytes_per_item(args.otw_format); |
| 562 | 571 |
|
| 563 | 572 |
//make the new streamer given the samples per packet |
| ... | ... | |
| 580 | 589 |
id.input_markup = args.otw_format + "_item16_usrp1"; |
| 581 | 590 |
id.num_inputs = 1; |
| 582 | 591 |
id.output_markup = args.cpu_format; |
| 583 |
id.num_outputs = channels.size(); |
|
| 592 |
id.num_outputs = args.channels.size();
|
|
| 584 | 593 |
id.args = args.args; |
| 585 | 594 |
my_streamer->set_converter(id); |
| 586 | 595 |
|
| ... | ... | |
| 596 | 605 |
/*********************************************************************** |
| 597 | 606 |
* Transmit streamer |
| 598 | 607 |
**********************************************************************/ |
| 599 |
tx_streamer::sptr usrp1_impl::get_tx_stream(const uhd::stream_args_t &args){
|
|
| 608 |
tx_streamer::sptr usrp1_impl::get_tx_stream(const uhd::stream_args_t &args_){
|
|
| 609 |
stream_args_t args = args_; |
|
| 610 |
|
|
| 611 |
//setup defaults for unspecified values |
|
| 612 |
args.otw_format = args.otw_format.empty()? "sc16" : args.otw_format; |
|
| 613 |
args.channels = args.channels.empty()? std::vector<size_t>(1, 0) : args.channels; |
|
| 614 |
|
|
| 600 | 615 |
if (args.otw_format != "sc16"){
|
| 601 | 616 |
throw uhd::value_error("USRP1 TX cannot handle requested wire format: " + args.otw_format);
|
| 602 | 617 |
} |
| 603 | 618 |
|
| 604 |
//map an empty channel set to chan0 |
|
| 605 |
const std::vector<size_t> channels = args.channels.empty()? std::vector<size_t>(1, 0) : args.channels; |
|
| 619 |
_iface->poke32(FR_TX_FORMAT, bmFR_TX_FORMAT_16_IQ); |
|
| 606 | 620 |
|
| 607 | 621 |
//calculate packet size |
| 608 |
const size_t bpp = _data_transport->get_send_frame_size()/channels.size(); |
|
| 622 |
const size_t bpp = _data_transport->get_send_frame_size()/args.channels.size();
|
|
| 609 | 623 |
const size_t spp = bpp/convert::get_bytes_per_item(args.otw_format); |
| 610 | 624 |
|
| 611 | 625 |
//make the new streamer given the samples per packet |
| ... | ... | |
| 623 | 637 |
//set the converter |
| 624 | 638 |
uhd::convert::id_type id; |
| 625 | 639 |
id.input_markup = args.cpu_format; |
| 626 |
id.num_inputs = channels.size(); |
|
| 640 |
id.num_inputs = args.channels.size();
|
|
| 627 | 641 |
id.output_markup = args.otw_format + "_item16_usrp1"; |
| 628 | 642 |
id.num_outputs = 1; |
| 629 | 643 |
id.args = args.args; |
Also available in: Unified diff