diff options
author | Josh Blum <josh@joshknows.com> | 2011-10-10 20:55:01 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-11-03 20:37:11 -0700 |
commit | 0946176f513dd58407869e3b019207ff3eef24f5 (patch) | |
tree | 6011087dab7c3e11cba4f70f0c182d7040f12ecd | |
parent | 861e66848f05001fcaca4fe91dbf67cd186649dc (diff) | |
download | uhd-0946176f513dd58407869e3b019207ff3eef24f5.tar.gz uhd-0946176f513dd58407869e3b019207ff3eef24f5.tar.bz2 uhd-0946176f513dd58407869e3b019207ff3eef24f5.zip |
usrp1: got the 16Msps working (needed non hb-filter image)
-rw-r--r-- | host/include/uhd/stream.hpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/io_impl.cpp | 40 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_impl.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/io_impl.cpp | 32 |
4 files changed, 48 insertions, 34 deletions
diff --git a/host/include/uhd/stream.hpp b/host/include/uhd/stream.hpp index 583dfd1e4..7a3151276 100644 --- a/host/include/uhd/stream.hpp +++ b/host/include/uhd/stream.hpp @@ -39,8 +39,8 @@ struct UHD_API stream_args_t{ //! Convenience constructor for streamer args stream_args_t( - const std::string &cpu = "fc32", - const std::string &otw = "sc16" + const std::string &cpu = "", + const std::string &otw = "" ){ cpu_format = cpu; otw_format = otw; diff --git a/host/lib/usrp/usrp1/io_impl.cpp b/host/lib/usrp/usrp1/io_impl.cpp index eaa6d02b4..c199e4178 100644 --- a/host/lib/usrp/usrp1/io_impl.cpp +++ b/host/lib/usrp/usrp1/io_impl.cpp @@ -441,10 +441,16 @@ void usrp1_impl::update_tx_subdev_spec(const uhd::usrp::subdev_spec_t &spec){ double usrp1_impl::update_rx_samp_rate(size_t dspno, const double samp_rate){ - const size_t div = 2; + const size_t div = this->has_rx_halfband()? 2 : 1; const size_t rate = uhd::clip<size_t>( boost::math::iround(_master_clock_rate / samp_rate), 4, 256) & ~(div-1); + if (rate < 8 and this->has_rx_halfband()) UHD_MSG(warning) << + "USRP1 cannot achieve decimations below 8 when the half-band filter is present.\n" + "The usrp1_fpga_4rx.rbf file is a special FPGA image without RX half-band filters.\n" + "To load this image, set the device address key/value pair: fpga=usrp1_fpga_4rx.rbf\n" + << std::endl; + if (dspno == 0){ //only care if dsp0 is set since its homogeneous bool s = this->disable_rx(); _iface->poke32(FR_RX_SAMPLE_RATE_DIV, div - 1); @@ -464,7 +470,7 @@ double usrp1_impl::update_rx_samp_rate(size_t dspno, const double samp_rate){ double usrp1_impl::update_tx_samp_rate(size_t dspno, const double samp_rate){ - const size_t div = 2; + const size_t div = this->has_tx_halfband()? 2 : 1; const size_t rate = uhd::clip<size_t>( boost::math::iround(_master_clock_rate / samp_rate), 8, 256) & ~(div-1); @@ -534,7 +540,13 @@ bool usrp1_impl::recv_async_msg( /*********************************************************************** * Receive streamer **********************************************************************/ -rx_streamer::sptr usrp1_impl::get_rx_stream(const uhd::stream_args_t &args){ +rx_streamer::sptr usrp1_impl::get_rx_stream(const uhd::stream_args_t &args_){ + stream_args_t args = args_; + + //setup defaults for unspecified values + args.otw_format = args.otw_format.empty()? "sc16" : args.otw_format; + args.channels = args.channels.empty()? std::vector<size_t>(1, 0) : args.channels; + if (args.otw_format == "sc16"){ _iface->poke32(FR_RX_FORMAT, 0 | (0 << bmFR_RX_FORMAT_SHIFT_SHIFT) @@ -553,11 +565,8 @@ rx_streamer::sptr usrp1_impl::get_rx_stream(const uhd::stream_args_t &args){ throw uhd::value_error("USRP1 RX cannot handle requested wire format: " + args.otw_format); } - //map an empty channel set to chan0 - const std::vector<size_t> channels = args.channels.empty()? std::vector<size_t>(1, 0) : args.channels; - //calculate packet size - const size_t bpp = _data_transport->get_recv_frame_size()/channels.size(); + const size_t bpp = _data_transport->get_recv_frame_size()/args.channels.size(); const size_t spp = bpp/convert::get_bytes_per_item(args.otw_format); //make the new streamer given the samples per packet @@ -580,7 +589,7 @@ rx_streamer::sptr usrp1_impl::get_rx_stream(const uhd::stream_args_t &args){ id.input_markup = args.otw_format + "_item16_usrp1"; id.num_inputs = 1; id.output_markup = args.cpu_format; - id.num_outputs = channels.size(); + id.num_outputs = args.channels.size(); id.args = args.args; my_streamer->set_converter(id); @@ -596,16 +605,21 @@ rx_streamer::sptr usrp1_impl::get_rx_stream(const uhd::stream_args_t &args){ /*********************************************************************** * Transmit streamer **********************************************************************/ -tx_streamer::sptr usrp1_impl::get_tx_stream(const uhd::stream_args_t &args){ +tx_streamer::sptr usrp1_impl::get_tx_stream(const uhd::stream_args_t &args_){ + stream_args_t args = args_; + + //setup defaults for unspecified values + args.otw_format = args.otw_format.empty()? "sc16" : args.otw_format; + args.channels = args.channels.empty()? std::vector<size_t>(1, 0) : args.channels; + if (args.otw_format != "sc16"){ throw uhd::value_error("USRP1 TX cannot handle requested wire format: " + args.otw_format); } - //map an empty channel set to chan0 - const std::vector<size_t> channels = args.channels.empty()? std::vector<size_t>(1, 0) : args.channels; + _iface->poke32(FR_TX_FORMAT, bmFR_TX_FORMAT_16_IQ); //calculate packet size - const size_t bpp = _data_transport->get_send_frame_size()/channels.size(); + const size_t bpp = _data_transport->get_send_frame_size()/args.channels.size(); const size_t spp = bpp/convert::get_bytes_per_item(args.otw_format); //make the new streamer given the samples per packet @@ -623,7 +637,7 @@ tx_streamer::sptr usrp1_impl::get_tx_stream(const uhd::stream_args_t &args){ //set the converter uhd::convert::id_type id; id.input_markup = args.cpu_format; - id.num_inputs = channels.size(); + id.num_inputs = args.channels.size(); id.output_markup = args.otw_format + "_item16_usrp1"; id.num_outputs = 1; id.args = args.args; diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp index 108fdc9ac..db652b033 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.cpp +++ b/host/lib/usrp/usrp1/usrp1_impl.cpp @@ -195,12 +195,6 @@ usrp1_impl::usrp1_impl(const device_addr_t &device_addr){ _iface->poke32(FR_ADC_OFFSET_2, 0x00000000); _iface->poke32(FR_ADC_OFFSET_3, 0x00000000); - // Set default for RX format to 16-bit I&Q and no half-band filter bypass - _iface->poke32(FR_RX_FORMAT, 0x00000300); - - // Set default for TX format to 16-bit I&Q - _iface->poke32(FR_TX_FORMAT, 0x00000000); - UHD_LOG << "USRP1 Capabilities" << std::endl << " number of duc's: " << get_num_ddcs() << std::endl diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp index f917a35db..f1d0aee2a 100644 --- a/host/lib/usrp/usrp2/io_impl.cpp +++ b/host/lib/usrp/usrp2/io_impl.cpp @@ -366,9 +366,12 @@ bool usrp2_impl::recv_async_msg( /*********************************************************************** * Receive streamer **********************************************************************/ -rx_streamer::sptr usrp2_impl::get_rx_stream(const uhd::stream_args_t &args){ - //map an empty channel set to chan0 - const std::vector<size_t> channels = args.channels.empty()? std::vector<size_t>(1, 0) : args.channels; +rx_streamer::sptr usrp2_impl::get_rx_stream(const uhd::stream_args_t &args_){ + stream_args_t args = args_; + + //setup defaults for unspecified values + args.otw_format = args.otw_format.empty()? "sc16" : args.otw_format; + args.channels = args.channels.empty()? std::vector<size_t>(1, 0) : args.channels; //calculate packet size static const size_t hdr_size = 0 @@ -383,7 +386,7 @@ rx_streamer::sptr usrp2_impl::get_rx_stream(const uhd::stream_args_t &args){ boost::shared_ptr<sph::recv_packet_streamer> my_streamer = boost::make_shared<sph::recv_packet_streamer>(spp); //init some streamer stuff - my_streamer->resize(channels.size()); + my_streamer->resize(args.channels.size()); my_streamer->set_vrt_unpacker(&vrt::if_hdr_unpack_be); //set the converter @@ -396,8 +399,8 @@ rx_streamer::sptr usrp2_impl::get_rx_stream(const uhd::stream_args_t &args){ my_streamer->set_converter(id); //bind callbacks for the handler - for (size_t chan_i = 0; chan_i < channels.size(); chan_i++){ - const size_t chan = channels[chan_i]; + for (size_t chan_i = 0; chan_i < args.channels.size(); chan_i++){ + const size_t chan = args.channels[chan_i]; size_t num_chan_so_far = 0; BOOST_FOREACH(const std::string &mb, _mbc.keys()){ num_chan_so_far += _mbc[mb].rx_chan_occ; @@ -427,14 +430,17 @@ rx_streamer::sptr usrp2_impl::get_rx_stream(const uhd::stream_args_t &args){ /*********************************************************************** * Transmit streamer **********************************************************************/ -tx_streamer::sptr usrp2_impl::get_tx_stream(const uhd::stream_args_t &args){ +tx_streamer::sptr usrp2_impl::get_tx_stream(const uhd::stream_args_t &args_){ + stream_args_t args = args_; + + //setup defaults for unspecified values + args.otw_format = args.otw_format.empty()? "sc16" : args.otw_format; + args.channels = args.channels.empty()? std::vector<size_t>(1, 0) : args.channels; + if (args.otw_format != "sc16"){ throw uhd::value_error("USRP TX cannot handle requested wire format: " + args.otw_format); } - //map an empty channel set to chan0 - const std::vector<size_t> channels = args.channels.empty()? std::vector<size_t>(1, 0) : args.channels; - //calculate packet size static const size_t hdr_size = 0 + vrt::max_if_hdr_words32*sizeof(boost::uint32_t) @@ -448,7 +454,7 @@ tx_streamer::sptr usrp2_impl::get_tx_stream(const uhd::stream_args_t &args){ boost::shared_ptr<sph::send_packet_streamer> my_streamer = boost::make_shared<sph::send_packet_streamer>(spp); //init some streamer stuff - my_streamer->resize(channels.size()); + my_streamer->resize(args.channels.size()); my_streamer->set_vrt_packer(&vrt::if_hdr_pack_be, vrt_send_header_offset_words32); //set the converter @@ -461,8 +467,8 @@ tx_streamer::sptr usrp2_impl::get_tx_stream(const uhd::stream_args_t &args){ my_streamer->set_converter(id); //bind callbacks for the handler - for (size_t chan_i = 0; chan_i < channels.size(); chan_i++){ - const size_t chan = channels[chan_i]; + for (size_t chan_i = 0; chan_i < args.channels.size(); chan_i++){ + const size_t chan = args.channels[chan_i]; size_t num_chan_so_far = 0; size_t abs = 0; BOOST_FOREACH(const std::string &mb, _mbc.keys()){ |