aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
Diffstat (limited to 'host')
-rw-r--r--host/examples/benchmark_rx_rate.cpp20
-rw-r--r--host/lib/transport/vrt_packet_handler.hpp14
-rw-r--r--host/lib/usrp/usrp2/mboard_impl.cpp8
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.hpp1
4 files changed, 27 insertions, 16 deletions
diff --git a/host/examples/benchmark_rx_rate.cpp b/host/examples/benchmark_rx_rate.cpp
index 7a7e9c3e0..a63337b38 100644
--- a/host/examples/benchmark_rx_rate.cpp
+++ b/host/examples/benchmark_rx_rate.cpp
@@ -38,6 +38,15 @@ static inline void test_device(
uhd::rx_metadata_t md;
std::vector<std::complex<float> > buff(dev->get_max_recv_samps_per_packet());
+ //flush the buffers in the recv path
+ while(dev->recv(
+ &buff.front(), buff.size(), md,
+ uhd::io_type_t::COMPLEX_FLOAT32,
+ uhd::device::RECV_MODE_ONE_PACKET
+ )){
+ /* NOP */
+ };
+
//declare status variables
bool got_first_packet = false;
size_t total_recv_packets = 0;
@@ -45,7 +54,7 @@ static inline void test_device(
size_t total_recv_samples = 0;
uhd::time_spec_t initial_time_spec;
uhd::time_spec_t next_expected_time_spec;
-
+
sdev->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
do {
size_t num_rx_samps = dev->recv(
@@ -79,15 +88,6 @@ static inline void test_device(
} while((next_expected_time_spec - initial_time_spec) < uhd::time_spec_t(duration_secs));
sdev->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS);
-
- //flush the buffers
- while(dev->recv(
- &buff.front(), buff.size(), md,
- uhd::io_type_t::COMPLEX_FLOAT32,
- uhd::device::RECV_MODE_ONE_PACKET
- )){
- /* NOP */
- };
//print a summary
std::cout << std::endl; //go to newline, recv may spew SXSYSZ...
diff --git a/host/lib/transport/vrt_packet_handler.hpp b/host/lib/transport/vrt_packet_handler.hpp
index c5c63b089..6623957ac 100644
--- a/host/lib/transport/vrt_packet_handler.hpp
+++ b/host/lib/transport/vrt_packet_handler.hpp
@@ -146,9 +146,6 @@ namespace vrt_packet_handler{
const handle_overrun_t &handle_overrun,
size_t vrt_header_offset_words32
){
- metadata.has_time_spec = false; //false unless set in the helper
- metadata.error_code = uhd::rx_metadata_t::ERROR_CODE_NONE;
-
//perform a receive if no rx data is waiting to be copied
if (state.size_of_copy_buffs == 0){
state.fragment_offset_in_samps = 0;
@@ -169,11 +166,18 @@ namespace vrt_packet_handler{
return 0;
}
}
+ //defaults for the metadata when this is a fragment
+ else{
+ metadata.has_time_spec = false;
+ metadata.start_of_burst = false;
+ metadata.end_of_burst = false;
+ metadata.error_code = uhd::rx_metadata_t::ERROR_CODE_NONE;
+ }
//extract the number of samples available to copy
size_t bytes_per_item = otw_type.get_sample_size();
- size_t bytes_available = state.size_of_copy_buffs;
- size_t nsamps_to_copy = std::min(total_samps, bytes_available/bytes_per_item);
+ size_t nsamps_available = state.size_of_copy_buffs/bytes_per_item;
+ size_t nsamps_to_copy = std::min(total_samps, nsamps_available);
size_t bytes_to_copy = nsamps_to_copy*bytes_per_item;
for (size_t i = 0; i < state.width; i++){
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp
index b46832360..7518d3114 100644
--- a/host/lib/usrp/usrp2/mboard_impl.cpp
+++ b/host/lib/usrp/usrp2/mboard_impl.cpp
@@ -43,6 +43,12 @@ usrp2_mboard_impl::usrp2_mboard_impl(
{
//make a new interface for usrp2 stuff
_iface = usrp2_iface::make(ctrl_transport);
+
+ //extract the mboard rev numbers
+ _rev_lo = _iface->read_eeprom(I2C_ADDR_MBOARD, EE_MBOARD_REV_LSB, 1).at(0);
+ _rev_hi = _iface->read_eeprom(I2C_ADDR_MBOARD, EE_MBOARD_REV_MSB, 1).at(0);
+
+ //contruct the interfaces to mboard perifs
_clock_ctrl = usrp2_clock_ctrl::make(_iface);
_codec_ctrl = usrp2_codec_ctrl::make(_iface);
_serdes_ctrl = usrp2_serdes_ctrl::make(_iface);
@@ -184,7 +190,7 @@ void usrp2_mboard_impl::get(const wax::obj &key_, wax::obj &val){
//handle the get request conditioned on the key
switch(key.as<mboard_prop_t>()){
case MBOARD_PROP_NAME:
- val = str(boost::format("usrp2 mboard %d") % _index);
+ val = str(boost::format("usrp2 mboard%d - rev %d:%d") % _index % _rev_hi % _rev_lo);
return;
case MBOARD_PROP_OTHERS:{
diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp
index 186516447..ab23830c0 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.hpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.hpp
@@ -137,6 +137,7 @@ public:
private:
size_t _index;
+ int _rev_hi, _rev_lo;
const usrp2_io_helper &_io_helper;
//properties for this mboard