diff options
author | Josh Blum <josh@joshknows.com> | 2013-09-04 14:35:22 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2013-09-04 14:35:22 -0700 |
commit | 91b5557527896998b395f4683914c4bfecad1f8e (patch) | |
tree | 1817747cc4c63a049bc95b4d2c5cb8b173d7f6ef /host/lib/usrp | |
parent | 8814558fcad1e1425d929035a651ab51aad05994 (diff) | |
parent | 8c1b63e1949134ec476b5b43e1caca42ffe017d5 (diff) | |
download | uhd-91b5557527896998b395f4683914c4bfecad1f8e.tar.gz uhd-91b5557527896998b395f4683914c4bfecad1f8e.tar.bz2 uhd-91b5557527896998b395f4683914c4bfecad1f8e.zip |
Merge branch 'master_converter_work'
Diffstat (limited to 'host/lib/usrp')
-rw-r--r-- | host/lib/usrp/b200/b200_impl.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/b200/b200_io_impl.cpp | 22 | ||||
-rw-r--r-- | host/lib/usrp/b200/b200_regs.hpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/cores/radio_ctrl_core_3000.cpp | 13 | ||||
-rw-r--r-- | host/lib/usrp/cores/radio_ctrl_core_3000.hpp | 3 | ||||
-rw-r--r-- | host/lib/usrp/cores/rx_dsp_core_3000.cpp | 17 | ||||
-rw-r--r-- | host/lib/usrp/cores/tx_dsp_core_3000.cpp | 15 |
7 files changed, 44 insertions, 32 deletions
diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index f7ed35e50..09c0d3979 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -252,7 +252,7 @@ b200_impl::b200_impl(const device_addr_t &device_addr) //////////////////////////////////////////////////////////////////// // Local control endpoint //////////////////////////////////////////////////////////////////// - _local_ctrl = radio_ctrl_core_3000::make(vrt::if_packet_info_t::LINK_TYPE_CHDR, _ctrl_transport, zero_copy_if::sptr()/*null*/, B200_LOCAL_CTRL_SID); + _local_ctrl = radio_ctrl_core_3000::make(false/*lilE*/, _ctrl_transport, zero_copy_if::sptr()/*null*/, B200_LOCAL_CTRL_SID); _local_ctrl->hold_task(_async_task); _async_task_data->local_ctrl = _local_ctrl; //weak this->check_fpga_compat(); @@ -488,7 +488,7 @@ void b200_impl::setup_radio(const size_t dspno) // radio control //////////////////////////////////////////////////////////////////// const boost::uint32_t sid = (dspno == 0)? B200_CTRL0_MSG_SID : B200_CTRL1_MSG_SID; - perif.ctrl = radio_ctrl_core_3000::make(vrt::if_packet_info_t::LINK_TYPE_CHDR, _ctrl_transport, zero_copy_if::sptr()/*null*/, sid); + perif.ctrl = radio_ctrl_core_3000::make(false/*lilE*/, _ctrl_transport, zero_copy_if::sptr()/*null*/, sid); perif.ctrl->hold_task(_async_task); _async_task_data->radio_ctrl[dspno] = perif.ctrl; //weak _tree->access<time_spec_t>(mb_path / "time" / "cmd") diff --git a/host/lib/usrp/b200/b200_io_impl.cpp b/host/lib/usrp/b200/b200_io_impl.cpp index 5a588f902..d643ef855 100644 --- a/host/lib/usrp/b200/b200_io_impl.cpp +++ b/host/lib/usrp/b200/b200_io_impl.cpp @@ -214,11 +214,7 @@ rx_streamer::sptr b200_impl::get_rx_stream(const uhd::stream_args_t &args_) stream_args_t args = args_; //setup defaults for unspecified values - if (not args.otw_format.empty() and args.otw_format != "sc16") - { - throw uhd::value_error("b200_impl::get_rx_stream only supports otw_format sc16"); - } - args.otw_format = "sc16"; + if (args.otw_format.empty()) args.otw_format = "sc16"; args.channels = args.channels.empty()? std::vector<size_t>(1, 0) : args.channels; boost::shared_ptr<sph::recv_packet_streamer> my_streamer; @@ -226,6 +222,10 @@ rx_streamer::sptr b200_impl::get_rx_stream(const uhd::stream_args_t &args_) { const size_t chan = args.channels[stream_i]; radio_perifs_t &perif = _radio_perifs[chan]; + if (args.otw_format == "sc16") perif.ctrl->poke32(TOREG(SR_RX_FMT), 0); + if (args.otw_format == "sc12") perif.ctrl->poke32(TOREG(SR_RX_FMT), 1); + if (args.otw_format == "fc32") perif.ctrl->poke32(TOREG(SR_RX_FMT), 2); + if (args.otw_format == "sc8") perif.ctrl->poke32(TOREG(SR_RX_FMT), 3); const boost::uint32_t sid = chan?B200_RX_DATA1_SID:B200_RX_DATA0_SID; //calculate packet size @@ -238,7 +238,7 @@ rx_streamer::sptr b200_impl::get_rx_stream(const uhd::stream_args_t &args_) const size_t bpp = _data_transport->get_recv_frame_size() - hdr_size; const size_t bpi = convert::get_bytes_per_item(args.otw_format); size_t spp = unsigned(args.args.cast<double>("spp", bpp/bpi)); - spp = std::min<size_t>(2041, spp); //magic maximum for framing at full rate + spp = std::min<size_t>(2000, spp); //magic maximum for framing at full rate //make the new streamer given the samples per packet if (not my_streamer) my_streamer = boost::make_shared<sph::recv_packet_streamer>(spp); @@ -316,11 +316,7 @@ tx_streamer::sptr b200_impl::get_tx_stream(const uhd::stream_args_t &args_) stream_args_t args = args_; //setup defaults for unspecified values - if (not args.otw_format.empty() and args.otw_format != "sc16") - { - throw uhd::value_error("b200_impl::get_rx_stream only supports otw_format sc16"); - } - args.otw_format = "sc16"; + if (args.otw_format.empty()) args.otw_format = "sc16"; args.channels = args.channels.empty()? std::vector<size_t>(1, 0) : args.channels; boost::shared_ptr<sph::send_packet_streamer> my_streamer; @@ -328,6 +324,10 @@ tx_streamer::sptr b200_impl::get_tx_stream(const uhd::stream_args_t &args_) { const size_t chan = args.channels[stream_i]; radio_perifs_t &perif = _radio_perifs[chan]; + if (args.otw_format == "sc16") perif.ctrl->poke32(TOREG(SR_TX_FMT), 0); + if (args.otw_format == "sc12") perif.ctrl->poke32(TOREG(SR_TX_FMT), 1); + if (args.otw_format == "fc32") perif.ctrl->poke32(TOREG(SR_TX_FMT), 2); + if (args.otw_format == "sc8") perif.ctrl->poke32(TOREG(SR_TX_FMT), 3); //calculate packet size static const size_t hdr_size = 0 diff --git a/host/lib/usrp/b200/b200_regs.hpp b/host/lib/usrp/b200/b200_regs.hpp index ae39b95b2..c64066b27 100644 --- a/host/lib/usrp/b200/b200_regs.hpp +++ b/host/lib/usrp/b200/b200_regs.hpp @@ -43,6 +43,8 @@ localparam SR_RX_CTRL = 96; localparam SR_RX_DSP = 144; localparam SR_TX_DSP = 184; localparam SR_TIME = 128; +localparam SR_RX_FMT = 136; +localparam SR_TX_FMT = 138; localparam RB32_TEST = 0; localparam RB64_TIME_NOW = 8; diff --git a/host/lib/usrp/cores/radio_ctrl_core_3000.cpp b/host/lib/usrp/cores/radio_ctrl_core_3000.cpp index 616903920..5298fd213 100644 --- a/host/lib/usrp/cores/radio_ctrl_core_3000.cpp +++ b/host/lib/usrp/cores/radio_ctrl_core_3000.cpp @@ -22,6 +22,7 @@ #include <uhd/utils/byteswap.hpp> #include <uhd/utils/safe_call.hpp> #include <uhd/transport/bounded_buffer.hpp> +#include <uhd/transport/vrt_if_packet.hpp> #include <boost/thread/mutex.hpp> #include <boost/thread/thread.hpp> #include <boost/format.hpp> @@ -32,7 +33,7 @@ using namespace uhd; using namespace uhd::usrp; using namespace uhd::transport; -static const double ACK_TIMEOUT = 0.5; +static const double ACK_TIMEOUT = 2.0; //supposed to be worst case practical timeout static const double MASSIVE_TIMEOUT = 10.0; //for when we wait on a timed command static const size_t SR_READBACK = 32; @@ -41,15 +42,15 @@ class radio_ctrl_core_3000_impl : public radio_ctrl_core_3000 public: radio_ctrl_core_3000_impl( - vrt::if_packet_info_t::link_type_t link_type, + const bool big_endian, uhd::transport::zero_copy_if::sptr ctrl_xport, uhd::transport::zero_copy_if::sptr resp_xport, const boost::uint32_t sid, const std::string &name ): - _link_type(link_type), + _link_type(vrt::if_packet_info_t::LINK_TYPE_CHDR), _packet_type(vrt::if_packet_info_t::PACKET_TYPE_CONTEXT), - _bige(link_type == vrt::if_packet_info_t::LINK_TYPE_VRLP), + _bige(big_endian), _ctrl_xport(ctrl_xport), _resp_xport(resp_xport), _sid(sid), @@ -301,12 +302,12 @@ private: radio_ctrl_core_3000::sptr radio_ctrl_core_3000::make( - vrt::if_packet_info_t::link_type_t link_type, + const bool big_endian, zero_copy_if::sptr ctrl_xport, zero_copy_if::sptr resp_xport, const boost::uint32_t sid, const std::string &name ) { - return sptr(new radio_ctrl_core_3000_impl(link_type, ctrl_xport, resp_xport, sid, name)); + return sptr(new radio_ctrl_core_3000_impl(big_endian, ctrl_xport, resp_xport, sid, name)); } diff --git a/host/lib/usrp/cores/radio_ctrl_core_3000.hpp b/host/lib/usrp/cores/radio_ctrl_core_3000.hpp index 6ef484296..8c0548d89 100644 --- a/host/lib/usrp/cores/radio_ctrl_core_3000.hpp +++ b/host/lib/usrp/cores/radio_ctrl_core_3000.hpp @@ -20,7 +20,6 @@ #include <uhd/types/time_spec.hpp> #include <uhd/transport/zero_copy.hpp> -#include <uhd/transport/vrt_if_packet.hpp> #include <boost/shared_ptr.hpp> #include <boost/utility.hpp> #include "wb_iface.hpp" @@ -36,7 +35,7 @@ public: //! Make a new control object static sptr make( - uhd::transport::vrt::if_packet_info_t::link_type_t link_type, + const bool big_endian, uhd::transport::zero_copy_if::sptr ctrl_xport, uhd::transport::zero_copy_if::sptr resp_xport, const boost::uint32_t sid, diff --git a/host/lib/usrp/cores/rx_dsp_core_3000.cpp b/host/lib/usrp/cores/rx_dsp_core_3000.cpp index 36d9af5bc..7b3324f74 100644 --- a/host/lib/usrp/cores/rx_dsp_core_3000.cpp +++ b/host/lib/usrp/cores/rx_dsp_core_3000.cpp @@ -169,21 +169,26 @@ public: void setup(const uhd::stream_args_t &stream_args){ - //unsigned format_word = 0; if (stream_args.otw_format == "sc16"){ - //format_word = 0; _dsp_extra_scaling = 1.0; _host_extra_scaling = 1.0; } - /* else if (stream_args.otw_format == "sc8"){ - format_word = (1 << 0); double peak = stream_args.args.cast<double>("peak", 1.0); peak = std::max(peak, 1.0/256); _host_extra_scaling = peak*256; - _dsp_extra_scaling = peak*256; + _dsp_extra_scaling = peak; + } + else if (stream_args.otw_format == "sc12"){ + double peak = stream_args.args.cast<double>("peak", 1.0); + peak = std::max(peak, 1.0/16); + _host_extra_scaling = peak*16; + _dsp_extra_scaling = peak; + } + else if (stream_args.otw_format == "fc32"){ + _host_extra_scaling = 1.0; + _dsp_extra_scaling = 1.0; } - */ else throw uhd::value_error("USRP RX cannot handle requested wire format: " + stream_args.otw_format); _host_extra_scaling *= stream_args.args.cast<double>("fullscale", 1.0); diff --git a/host/lib/usrp/cores/tx_dsp_core_3000.cpp b/host/lib/usrp/cores/tx_dsp_core_3000.cpp index ff4392a13..feb749cd9 100644 --- a/host/lib/usrp/cores/tx_dsp_core_3000.cpp +++ b/host/lib/usrp/cores/tx_dsp_core_3000.cpp @@ -146,22 +146,27 @@ public: void setup(const uhd::stream_args_t &stream_args){ - //unsigned format_word = 0; if (stream_args.otw_format == "sc16"){ - //format_word = 0; _dsp_extra_scaling = 1.0; _host_extra_scaling = 1.0; } - /* else if (stream_args.otw_format == "sc8"){ - format_word = (1 << 0); double peak = stream_args.args.cast<double>("peak", 1.0); peak = std::max(peak, 1.0/256); _host_extra_scaling = 1.0/peak/256; _dsp_extra_scaling = 1.0/peak; } + else if (stream_args.otw_format == "sc12"){ + double peak = stream_args.args.cast<double>("peak", 1.0); + peak = std::max(peak, 1.0/16); + _host_extra_scaling = 1.0/peak/16; + _dsp_extra_scaling = 1.0/peak; + } + else if (stream_args.otw_format == "fc32"){ + _host_extra_scaling = 1.0; + _dsp_extra_scaling = 1.0; + } else throw uhd::value_error("USRP TX cannot handle requested wire format: " + stream_args.otw_format); - */ _host_extra_scaling /= stream_args.args.cast<double>("fullscale", 1.0); |