Revision 0946176f
| b/host/include/uhd/stream.hpp | ||
|---|---|---|
| 39 | 39 |
|
| 40 | 40 |
//! Convenience constructor for streamer args |
| 41 | 41 |
stream_args_t( |
| 42 |
const std::string &cpu = "fc32",
|
|
| 43 |
const std::string &otw = "sc16"
|
|
| 42 |
const std::string &cpu = "", |
|
| 43 |
const std::string &otw = "" |
|
| 44 | 44 |
){
|
| 45 | 45 |
cpu_format = cpu; |
| 46 | 46 |
otw_format = otw; |
| 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; |
| b/host/lib/usrp/usrp1/usrp1_impl.cpp | ||
|---|---|---|
| 195 | 195 |
_iface->poke32(FR_ADC_OFFSET_2, 0x00000000); |
| 196 | 196 |
_iface->poke32(FR_ADC_OFFSET_3, 0x00000000); |
| 197 | 197 |
|
| 198 |
// Set default for RX format to 16-bit I&Q and no half-band filter bypass |
|
| 199 |
_iface->poke32(FR_RX_FORMAT, 0x00000300); |
|
| 200 |
|
|
| 201 |
// Set default for TX format to 16-bit I&Q |
|
| 202 |
_iface->poke32(FR_TX_FORMAT, 0x00000000); |
|
| 203 |
|
|
| 204 | 198 |
UHD_LOG |
| 205 | 199 |
<< "USRP1 Capabilities" << std::endl |
| 206 | 200 |
<< " number of duc's: " << get_num_ddcs() << std::endl |
| b/host/lib/usrp/usrp2/io_impl.cpp | ||
|---|---|---|
| 366 | 366 |
/*********************************************************************** |
| 367 | 367 |
* Receive streamer |
| 368 | 368 |
**********************************************************************/ |
| 369 |
rx_streamer::sptr usrp2_impl::get_rx_stream(const uhd::stream_args_t &args){
|
|
| 370 |
//map an empty channel set to chan0 |
|
| 371 |
const std::vector<size_t> channels = args.channels.empty()? std::vector<size_t>(1, 0) : args.channels; |
|
| 369 |
rx_streamer::sptr usrp2_impl::get_rx_stream(const uhd::stream_args_t &args_){
|
|
| 370 |
stream_args_t args = args_; |
|
| 371 |
|
|
| 372 |
//setup defaults for unspecified values |
|
| 373 |
args.otw_format = args.otw_format.empty()? "sc16" : args.otw_format; |
|
| 374 |
args.channels = args.channels.empty()? std::vector<size_t>(1, 0) : args.channels; |
|
| 372 | 375 |
|
| 373 | 376 |
//calculate packet size |
| 374 | 377 |
static const size_t hdr_size = 0 |
| ... | ... | |
| 383 | 386 |
boost::shared_ptr<sph::recv_packet_streamer> my_streamer = boost::make_shared<sph::recv_packet_streamer>(spp); |
| 384 | 387 |
|
| 385 | 388 |
//init some streamer stuff |
| 386 |
my_streamer->resize(channels.size()); |
|
| 389 |
my_streamer->resize(args.channels.size());
|
|
| 387 | 390 |
my_streamer->set_vrt_unpacker(&vrt::if_hdr_unpack_be); |
| 388 | 391 |
|
| 389 | 392 |
//set the converter |
| ... | ... | |
| 396 | 399 |
my_streamer->set_converter(id); |
| 397 | 400 |
|
| 398 | 401 |
//bind callbacks for the handler |
| 399 |
for (size_t chan_i = 0; chan_i < channels.size(); chan_i++){
|
|
| 400 |
const size_t chan = channels[chan_i]; |
|
| 402 |
for (size_t chan_i = 0; chan_i < args.channels.size(); chan_i++){
|
|
| 403 |
const size_t chan = args.channels[chan_i];
|
|
| 401 | 404 |
size_t num_chan_so_far = 0; |
| 402 | 405 |
BOOST_FOREACH(const std::string &mb, _mbc.keys()){
|
| 403 | 406 |
num_chan_so_far += _mbc[mb].rx_chan_occ; |
| ... | ... | |
| 427 | 430 |
/*********************************************************************** |
| 428 | 431 |
* Transmit streamer |
| 429 | 432 |
**********************************************************************/ |
| 430 |
tx_streamer::sptr usrp2_impl::get_tx_stream(const uhd::stream_args_t &args){
|
|
| 433 |
tx_streamer::sptr usrp2_impl::get_tx_stream(const uhd::stream_args_t &args_){
|
|
| 434 |
stream_args_t args = args_; |
|
| 435 |
|
|
| 436 |
//setup defaults for unspecified values |
|
| 437 |
args.otw_format = args.otw_format.empty()? "sc16" : args.otw_format; |
|
| 438 |
args.channels = args.channels.empty()? std::vector<size_t>(1, 0) : args.channels; |
|
| 439 |
|
|
| 431 | 440 |
if (args.otw_format != "sc16"){
|
| 432 | 441 |
throw uhd::value_error("USRP TX cannot handle requested wire format: " + args.otw_format);
|
| 433 | 442 |
} |
| 434 | 443 |
|
| 435 |
//map an empty channel set to chan0 |
|
| 436 |
const std::vector<size_t> channels = args.channels.empty()? std::vector<size_t>(1, 0) : args.channels; |
|
| 437 |
|
|
| 438 | 444 |
//calculate packet size |
| 439 | 445 |
static const size_t hdr_size = 0 |
| 440 | 446 |
+ vrt::max_if_hdr_words32*sizeof(boost::uint32_t) |
| ... | ... | |
| 448 | 454 |
boost::shared_ptr<sph::send_packet_streamer> my_streamer = boost::make_shared<sph::send_packet_streamer>(spp); |
| 449 | 455 |
|
| 450 | 456 |
//init some streamer stuff |
| 451 |
my_streamer->resize(channels.size()); |
|
| 457 |
my_streamer->resize(args.channels.size());
|
|
| 452 | 458 |
my_streamer->set_vrt_packer(&vrt::if_hdr_pack_be, vrt_send_header_offset_words32); |
| 453 | 459 |
|
| 454 | 460 |
//set the converter |
| ... | ... | |
| 461 | 467 |
my_streamer->set_converter(id); |
| 462 | 468 |
|
| 463 | 469 |
//bind callbacks for the handler |
| 464 |
for (size_t chan_i = 0; chan_i < channels.size(); chan_i++){
|
|
| 465 |
const size_t chan = channels[chan_i]; |
|
| 470 |
for (size_t chan_i = 0; chan_i < args.channels.size(); chan_i++){
|
|
| 471 |
const size_t chan = args.channels[chan_i];
|
|
| 466 | 472 |
size_t num_chan_so_far = 0; |
| 467 | 473 |
size_t abs = 0; |
| 468 | 474 |
BOOST_FOREACH(const std::string &mb, _mbc.keys()){
|
Also available in: Unified diff