diff options
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/usrp/usrp_e/io_impl.cpp | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/host/lib/usrp/usrp_e/io_impl.cpp b/host/lib/usrp/usrp_e/io_impl.cpp index a77a73b38..9ebd55eac 100644 --- a/host/lib/usrp/usrp_e/io_impl.cpp +++ b/host/lib/usrp/usrp_e/io_impl.cpp @@ -17,6 +17,7 @@ #include "usrp_e_impl.hpp" #include "usrp_e_regs.hpp" +#include "../dsp_utils.hpp" #include "../../transport/vrt_packet_handler.hpp" #include <boost/bind.hpp> #include <fcntl.h> //read, write @@ -24,10 +25,10 @@ #include <stddef.h> //offsetof #include <poll.h> #include <boost/format.hpp> -#include <boost/assign.hpp> #include <iostream> using namespace uhd; +using namespace uhd::usrp; /*********************************************************************** * Constants @@ -152,33 +153,9 @@ void usrp_e_impl::io_init(void){ _io_impl = UHD_PIMPL_MAKE(io_impl, (_iface->get_file_descriptor())); } -static boost::uint32_t make_stream_cmd(bool now, bool chain, bool reload, boost::uint32_t nsamps){ - return (((now)? 1 : 0) << 31) | (((chain)? 1 : 0) << 30) | (((reload)? 1 : 0) << 29) | nsamps; -} - void usrp_e_impl::issue_stream_cmd(const stream_cmd_t &stream_cmd){ - UHD_ASSERT_THROW(stream_cmd.num_samps <= 0x3fffffff); - - //setup the mode to instruction flags - typedef boost::tuple<bool, bool, bool> inst_t; - static const uhd::dict<stream_cmd_t::stream_mode_t, inst_t> mode_to_inst = boost::assign::map_list_of - //reload, chain, samps - (stream_cmd_t::STREAM_MODE_START_CONTINUOUS, inst_t(true, true, false)) - (stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS, inst_t(false, false, false)) - (stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE, inst_t(false, false, true)) - (stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_MORE, inst_t(false, true, true)) - ; - - //setup the instruction flag values - bool inst_reload, inst_chain, inst_samps; - boost::tie(inst_reload, inst_chain, inst_samps) = mode_to_inst[stream_cmd.stream_mode]; - - //issue the stream command - _iface->poke32(UE_REG_CTRL_RX_STREAM_CMD, make_stream_cmd( - (inst_samps)? stream_cmd.num_samps : ((inst_chain)? get_max_recv_samps_per_packet() : 1), - (stream_cmd.stream_now)? 1 : 0, - (inst_chain)? 1 : 0, - (inst_reload)? 1 : 0 + _iface->poke32(UE_REG_CTRL_RX_STREAM_CMD, dsp_type1::calc_stream_cmd_word( + stream_cmd, get_max_recv_samps_per_packet() )); _iface->poke32(UE_REG_CTRL_RX_TIME_SECS, boost::uint32_t(stream_cmd.time_spec.get_full_secs())); _iface->poke32(UE_REG_CTRL_RX_TIME_TICKS, stream_cmd.time_spec.get_tick_count(MASTER_CLOCK_RATE)); |