aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp1/io_impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/usrp1/io_impl.cpp')
-rw-r--r--host/lib/usrp/usrp1/io_impl.cpp26
1 files changed, 9 insertions, 17 deletions
diff --git a/host/lib/usrp/usrp1/io_impl.cpp b/host/lib/usrp/usrp1/io_impl.cpp
index 9fa1b4f72..88cbab073 100644
--- a/host/lib/usrp/usrp1/io_impl.cpp
+++ b/host/lib/usrp/usrp1/io_impl.cpp
@@ -91,7 +91,6 @@ struct usrp1_impl::io_impl{
void commit_send_buff(offset_send_buffer::sptr, offset_send_buffer::sptr, size_t);
void flush_send_buff(void);
bool get_send_buffs(vrt_packet_handler::managed_send_buffs_t &, double);
- bool transmitting_enb;
};
/*!
@@ -133,6 +132,9 @@ void usrp1_impl::io_impl::flush_send_buff(void){
//calculate the number of bytes to alignment
size_t bytes_to_pad = (-1*curr_buff->offset)%alignment_padding;
+ //send at least alignment_padding to guarantee zeros are sent
+ if (bytes_to_pad == 0) bytes_to_pad = alignment_padding;
+
//get the buffer, clear, and commit (really current buffer)
vrt_packet_handler::managed_send_buffs_t buffs(1);
if (this->get_send_buffs(buffs, 0.1)){
@@ -157,10 +159,8 @@ bool usrp1_impl::io_impl::get_send_buffs(
//calculate the buffer pointer and size given the offset
//references to the buffers are held in the bound function
buffs[0] = managed_send_buffer::make_safe(
- boost::asio::buffer(
- curr_buff->buff->cast<char *>() + curr_buff->offset,
- curr_buff->buff->size() - curr_buff->offset
- ),
+ curr_buff->buff->cast<char *>() + curr_buff->offset,
+ curr_buff->buff->size() - curr_buff->offset,
boost::bind(&usrp1_impl::io_impl::commit_send_buff, this, curr_buff, next_buff, _1)
);
@@ -190,7 +190,7 @@ void usrp1_impl::io_init(void){
);
rx_stream_on_off(false);
- tx_stream_on_off(false);
+ _io_impl->flush_send_buff();
}
void usrp1_impl::rx_stream_on_off(bool enb){
@@ -201,13 +201,6 @@ void usrp1_impl::rx_stream_on_off(bool enb){
}
}
-void usrp1_impl::tx_stream_on_off(bool enb){
- if (not enb) _io_impl->flush_send_buff();
- _codec_ctrls[DBOARD_SLOT_A]->enable_tx_digital(enb);
- _codec_ctrls[DBOARD_SLOT_B]->enable_tx_digital(enb);
- _io_impl->transmitting_enb = enb;
-}
-
/***********************************************************************
* Data send + helper functions
**********************************************************************/
@@ -227,12 +220,11 @@ size_t usrp1_impl::get_max_send_samps_per_packet(void) const {
}
size_t usrp1_impl::send(
- const std::vector<const void *> &buffs, size_t num_samps,
+ const send_buffs_type &buffs, size_t num_samps,
const tx_metadata_t &metadata, const io_type_t &io_type,
send_mode_t send_mode, double timeout
){
if (_soft_time_ctrl->send_pre(metadata, timeout)) return num_samps;
- if (not _io_impl->transmitting_enb) tx_stream_on_off(true);
size_t num_samps_sent = vrt_packet_handler::send(
_io_impl->packet_handler_send_state, //last state of the send handler
@@ -250,7 +242,7 @@ size_t usrp1_impl::send(
//handle eob flag (commit the buffer, disable the DACs)
//check num samps sent to avoid flush on incomplete/timeout
if (metadata.end_of_burst and num_samps_sent == num_samps){
- this->tx_stream_on_off(false);
+ _io_impl->flush_send_buff();
}
//handle the polling for underflow conditions
@@ -306,7 +298,7 @@ size_t usrp1_impl::get_max_recv_samps_per_packet(void) const {
}
size_t usrp1_impl::recv(
- const std::vector<void *> &buffs, size_t num_samps,
+ const recv_buffs_type &buffs, size_t num_samps,
rx_metadata_t &metadata, const io_type_t &io_type,
recv_mode_t recv_mode, double timeout
){