Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: Transceiver52M/UHDDevice.cpp
- ===================================================================
- --- Transceiver52M/UHDDevice.cpp (revision 3400)
- +++ Transceiver52M/UHDDevice.cpp (working copy)
- @@ -65,14 +65,12 @@
- */
- uhd::time_spec_t convert_time(TIMESTAMP ticks, double rate)
- {
- - double secs = (double) ticks / rate;
- - return uhd::time_spec_t(secs);
- + return uhd::time_spec_t::from_ticks(ticks, rate);
- }
- TIMESTAMP convert_time(uhd::time_spec_t ts, double rate)
- {
- - TIMESTAMP ticks = ts.get_full_secs() * rate;
- - return ts.get_tick_count(rate) + ticks;
- + return ts.to_ticks(rate);
- }
- /*
- @@ -204,6 +202,8 @@
- private:
- uhd::usrp::multi_usrp::sptr usrp_dev;
- + uhd::tx_streamer::sptr tx_stream;
- + uhd::rx_streamer::sptr rx_stream;
- enum busType bus;
- double desired_smpl_rt, actual_smpl_rt;
- @@ -452,9 +452,14 @@
- set_ref_clk(true);
- #endif
- + //create a TX and RX streamers
- + uhd::stream_args_t stream_args("sc16"); //complex shorts
- + tx_stream = usrp_dev->get_tx_stream(stream_args);
- + rx_stream = usrp_dev->get_rx_stream(stream_args);
- +
- // Number of samples per over-the-wire packet
- - tx_spp = usrp_dev->get_device()->get_max_send_samps_per_packet();
- - rx_spp = usrp_dev->get_device()->get_max_recv_samps_per_packet();
- + tx_spp = tx_stream->get_max_num_samps();
- + rx_spp = rx_stream->get_max_num_samps();
- // Set rates
- actual_smpl_rt = set_rates(desired_smpl_rt);
- @@ -488,13 +493,12 @@
- timeout = .01;
- for (size_t i = 0; i < num_pkts; i++) {
- - num_smpls = usrp_dev->get_device()->recv(
- + num_smpls = rx_stream->recv(
- buff,
- rx_spp,
- md,
- - uhd::io_type_t::COMPLEX_INT16,
- - uhd::device::RECV_MODE_ONE_PACKET,
- - timeout);
- + timeout,
- + true/*one pkt*/);
- if (!num_smpls) {
- switch (md.error_code) {
- @@ -634,12 +638,12 @@
- // Receive samples from the usrp until we have enough
- while (rx_smpl_buf->avail_smpls(timestamp) < len) {
- - size_t num_smpls = usrp_dev->get_device()->recv(
- + size_t num_smpls = rx_stream->recv(
- (void*)pkt_buf,
- rx_spp,
- metadata,
- - uhd::io_type_t::COMPLEX_INT16,
- - uhd::device::RECV_MODE_ONE_PACKET);
- + 0.1 /*timeout secs*/,
- + true /*one pkt*/);
- rx_pkt_cnt++;
- @@ -718,11 +722,7 @@
- }
- }
- - size_t num_smpls = usrp_dev->get_device()->send(buf,
- - len,
- - metadata,
- - uhd::io_type_t::COMPLEX_INT16,
- - uhd::device::SEND_MODE_FULL_BUFF);
- + size_t num_smpls = tx_stream->send(buf, len, metadata);
- if (num_smpls != (unsigned) len) {
- LOG(ALERT) << "UHD: Device send timed out";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement