From f4dc4bf74e65d185ef76e48d3cb172bf0a66f24a Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 30 Jun 2011 10:14:14 -0700 Subject: b100: some tweaks (unresolved streaming issues ATM) --- host/lib/usrp/b100/b100_ctrl.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'host/lib/usrp/b100/b100_ctrl.cpp') diff --git a/host/lib/usrp/b100/b100_ctrl.cpp b/host/lib/usrp/b100/b100_ctrl.cpp index be576cc99..22512f413 100644 --- a/host/lib/usrp/b100/b100_ctrl.cpp +++ b/host/lib/usrp/b100/b100_ctrl.cpp @@ -178,11 +178,18 @@ ctrl_data_t b100_ctrl_impl::read(boost::uint32_t addr, size_t len) { pkt.pkt_meta.addr = addr; boost::uint16_t pkt_buff[CTRL_PACKET_LENGTH / sizeof(boost::uint16_t)]; + //flush anything that might be in the queue + while (get_ctrl_data(pkt.data, 0.0)){ + UHD_MSG(error) << "B100: control read found unexpected packet." << std::endl; + } + pack_ctrl_pkt(pkt_buff, pkt); send_pkt(pkt_buff); - //loop around waiting for the response to appear - while(!get_ctrl_data(pkt.data, 0.05)); + //block with timeout waiting for the response to appear + if (not get_ctrl_data(pkt.data, 0.1)) throw uhd::runtime_error( + "B100: timeout waiting for control response packet." + ); return pkt.data; } -- cgit v1.2.3