summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/usrp2')
-rw-r--r--host/lib/usrp/usrp2/dboard_impl.cpp4
-rw-r--r--host/lib/usrp/usrp2/dboard_interface.cpp28
-rw-r--r--host/lib/usrp/usrp2/dsp_impl.cpp23
-rw-r--r--host/lib/usrp/usrp2/fw_common.h100
-rw-r--r--host/lib/usrp/usrp2/io_impl.cpp65
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.hpp10
6 files changed, 121 insertions, 109 deletions
diff --git a/host/lib/usrp/usrp2/dboard_impl.cpp b/host/lib/usrp/usrp2/dboard_impl.cpp
index 502a7daa0..60622ca47 100644
--- a/host/lib/usrp/usrp2/dboard_impl.cpp
+++ b/host/lib/usrp/usrp2/dboard_impl.cpp
@@ -62,7 +62,7 @@ void usrp2_impl::dboard_init(void){
void usrp2_impl::update_mux_config(void){
//calculate the rx mux
- uint32_t rx_mux = 0;
+ boost::uint32_t rx_mux = 0;
ASSERT_THROW(_rx_subdevs_in_use.size() == 1);
wax::obj rx_subdev = _dboard_manager->get_rx_subdev(_rx_subdevs_in_use.at(0));
std::cout << "Using: " << rx_subdev[SUBDEV_PROP_NAME].as<std::string>() << std::endl;
@@ -76,7 +76,7 @@ void usrp2_impl::update_mux_config(void){
}
//calculate the tx mux
- uint32_t tx_mux = 0x10;
+ boost::uint32_t tx_mux = 0x10;
ASSERT_THROW(_tx_subdevs_in_use.size() == 1);
wax::obj tx_subdev = _dboard_manager->get_tx_subdev(_tx_subdevs_in_use.at(0));
std::cout << "Using: " << tx_subdev[SUBDEV_PROP_NAME].as<std::string>() << std::endl;
diff --git a/host/lib/usrp/usrp2/dboard_interface.cpp b/host/lib/usrp/usrp2/dboard_interface.cpp
index cefd69ba9..d20465147 100644
--- a/host/lib/usrp/usrp2/dboard_interface.cpp
+++ b/host/lib/usrp/usrp2/dboard_interface.cpp
@@ -28,10 +28,10 @@ public:
void write_aux_dac(unit_type_t, int, int);
int read_aux_adc(unit_type_t, int);
- void set_atr_reg(gpio_bank_t, uint16_t, uint16_t, uint16_t);
- void set_gpio_ddr(gpio_bank_t, uint16_t, uint16_t);
- void write_gpio(gpio_bank_t, uint16_t, uint16_t);
- uint16_t read_gpio(gpio_bank_t);
+ void set_atr_reg(gpio_bank_t, boost::uint16_t, boost::uint16_t, boost::uint16_t);
+ void set_gpio_ddr(gpio_bank_t, boost::uint16_t, boost::uint16_t);
+ void write_gpio(gpio_bank_t, boost::uint16_t, boost::uint16_t);
+ boost::uint16_t read_gpio(gpio_bank_t);
void write_i2c(int, const byte_vector_t &);
byte_vector_t read_i2c(int, size_t);
@@ -89,7 +89,7 @@ double usrp2_dboard_interface::get_tx_clock_rate(void){
* \param bank the dboard interface gpio bank enum
* \return an over the wire representation
*/
-static uint8_t gpio_bank_to_otw(dboard_interface::gpio_bank_t bank){
+static boost::uint8_t gpio_bank_to_otw(dboard_interface::gpio_bank_t bank){
switch(bank){
case uhd::usrp::dboard_interface::GPIO_TX_BANK: return USRP2_DIR_TX;
case uhd::usrp::dboard_interface::GPIO_RX_BANK: return USRP2_DIR_RX;
@@ -97,7 +97,7 @@ static uint8_t gpio_bank_to_otw(dboard_interface::gpio_bank_t bank){
throw std::invalid_argument("unknown gpio bank type");
}
-void usrp2_dboard_interface::set_gpio_ddr(gpio_bank_t bank, uint16_t value, uint16_t mask){
+void usrp2_dboard_interface::set_gpio_ddr(gpio_bank_t bank, boost::uint16_t value, boost::uint16_t mask){
//setup the out data
usrp2_ctrl_data_t out_data;
out_data.id = htonl(USRP2_CTRL_ID_USE_THESE_GPIO_DDR_SETTINGS_BRO);
@@ -110,7 +110,7 @@ void usrp2_dboard_interface::set_gpio_ddr(gpio_bank_t bank, uint16_t value, uint
ASSERT_THROW(htonl(in_data.id) == USRP2_CTRL_ID_GOT_THE_GPIO_DDR_SETTINGS_DUDE);
}
-void usrp2_dboard_interface::write_gpio(gpio_bank_t bank, uint16_t value, uint16_t mask){
+void usrp2_dboard_interface::write_gpio(gpio_bank_t bank, boost::uint16_t value, boost::uint16_t mask){
//setup the out data
usrp2_ctrl_data_t out_data;
out_data.id = htonl(USRP2_CTRL_ID_SET_YOUR_GPIO_PIN_OUTS_BRO);
@@ -123,7 +123,7 @@ void usrp2_dboard_interface::write_gpio(gpio_bank_t bank, uint16_t value, uint16
ASSERT_THROW(htonl(in_data.id) == USRP2_CTRL_ID_I_SET_THE_GPIO_PIN_OUTS_DUDE);
}
-uint16_t usrp2_dboard_interface::read_gpio(gpio_bank_t bank){
+boost::uint16_t usrp2_dboard_interface::read_gpio(gpio_bank_t bank){
//setup the out data
usrp2_ctrl_data_t out_data;
out_data.id = htonl(USRP2_CTRL_ID_GIVE_ME_YOUR_GPIO_PIN_VALS_BRO);
@@ -135,7 +135,7 @@ uint16_t usrp2_dboard_interface::read_gpio(gpio_bank_t bank){
return ntohs(in_data.data.gpio_config.value);
}
-void usrp2_dboard_interface::set_atr_reg(gpio_bank_t bank, uint16_t tx_value, uint16_t rx_value, uint16_t mask){
+void usrp2_dboard_interface::set_atr_reg(gpio_bank_t bank, boost::uint16_t tx_value, boost::uint16_t rx_value, boost::uint16_t mask){
//setup the out data
usrp2_ctrl_data_t out_data;
out_data.id = htonl(USRP2_CTRL_ID_USE_THESE_ATR_SETTINGS_BRO);
@@ -158,7 +158,7 @@ void usrp2_dboard_interface::set_atr_reg(gpio_bank_t bank, uint16_t tx_value, ui
* \param dev the dboard interface spi dev enum
* \return an over the wire representation
*/
-static uint8_t spi_dev_to_otw(dboard_interface::spi_dev_t dev){
+static boost::uint8_t spi_dev_to_otw(dboard_interface::spi_dev_t dev){
switch(dev){
case uhd::usrp::dboard_interface::SPI_TX_DEV: return USRP2_DIR_TX;
case uhd::usrp::dboard_interface::SPI_RX_DEV: return USRP2_DIR_RX;
@@ -172,7 +172,7 @@ static uint8_t spi_dev_to_otw(dboard_interface::spi_dev_t dev){
* \param latch the dboard interface spi latch enum
* \return an over the wire representation
*/
-static uint8_t spi_latch_to_otw(dboard_interface::spi_latch_t latch){
+static boost::uint8_t spi_latch_to_otw(dboard_interface::spi_latch_t latch){
switch(latch){
case uhd::usrp::dboard_interface::SPI_LATCH_RISE: return USRP2_CLK_EDGE_RISE;
case uhd::usrp::dboard_interface::SPI_LATCH_FALL: return USRP2_CLK_EDGE_FALL;
@@ -186,7 +186,7 @@ static uint8_t spi_latch_to_otw(dboard_interface::spi_latch_t latch){
* \param push the dboard interface spi push enum
* \return an over the wire representation
*/
-static uint8_t spi_push_to_otw(dboard_interface::spi_push_t push){
+static boost::uint8_t spi_push_to_otw(dboard_interface::spi_push_t push){
switch(push){
case uhd::usrp::dboard_interface::SPI_PUSH_RISE: return USRP2_CLK_EDGE_RISE;
case uhd::usrp::dboard_interface::SPI_PUSH_FALL: return USRP2_CLK_EDGE_FALL;
@@ -286,7 +286,7 @@ dboard_interface::byte_vector_t usrp2_dboard_interface::read_i2c(int i2c_addr, s
* \param unit the dboard interface unit type enum
* \return an over the wire representation
*/
-static uint8_t spi_dev_to_otw(dboard_interface::unit_type_t unit){
+static boost::uint8_t spi_dev_to_otw(dboard_interface::unit_type_t unit){
switch(unit){
case uhd::usrp::dboard_interface::UNIT_TYPE_TX: return USRP2_DIR_TX;
case uhd::usrp::dboard_interface::UNIT_TYPE_RX: return USRP2_DIR_RX;
@@ -300,7 +300,7 @@ void usrp2_dboard_interface::write_aux_dac(dboard_interface::unit_type_t unit, i
out_data.id = htonl(USRP2_CTRL_ID_WRITE_THIS_TO_THE_AUX_DAC_BRO);
out_data.data.aux_args.dir = spi_dev_to_otw(unit);
out_data.data.aux_args.which = which;
- out_data.data.aux_args.dir = htonl(value);
+ out_data.data.aux_args.value = htonl(value);
//send and recv
usrp2_ctrl_data_t in_data = _impl->ctrl_send_and_recv(out_data);
diff --git a/host/lib/usrp/usrp2/dsp_impl.cpp b/host/lib/usrp/usrp2/dsp_impl.cpp
index 7520c1757..54ed45e41 100644
--- a/host/lib/usrp/usrp2/dsp_impl.cpp
+++ b/host/lib/usrp/usrp2/dsp_impl.cpp
@@ -18,6 +18,7 @@
#include <uhd/utils.hpp>
#include <boost/format.hpp>
#include <boost/assign/list_of.hpp>
+#include <boost/math/special_functions/round.hpp>
#include "usrp2_impl.hpp"
using namespace uhd;
@@ -25,14 +26,20 @@ using namespace uhd;
static const size_t default_decim = 16;
static const size_t default_interp = 16;
+#define rint boost::math::iround
+
+template <class T> T log2(T num){
+ return std::log(num)/std::log(T(2));
+}
+
/***********************************************************************
* DDC Helper Methods
**********************************************************************/
-static uint32_t calculate_freq_word_and_update_actual_freq(freq_t &freq, freq_t clock_freq){
- double scale_factor = pow(2.0, 32);
+static boost::uint32_t calculate_freq_word_and_update_actual_freq(freq_t &freq, freq_t clock_freq){
+ double scale_factor = std::pow(2.0, 32);
//calculate the freq register word
- uint32_t freq_word = rint((freq / clock_freq) * scale_factor);
+ boost::uint32_t freq_word = rint((freq / clock_freq) * scale_factor);
//update the actual frequency
freq = (double(freq_word) / scale_factor) * clock_freq;
@@ -40,8 +47,8 @@ static uint32_t calculate_freq_word_and_update_actual_freq(freq_t &freq, freq_t
return freq_word;
}
-static uint32_t calculate_iq_scale_word(int16_t i, int16_t q){
- return (uint16_t(i) << 16) | (uint16_t(q) << 0);
+static boost::uint32_t calculate_iq_scale_word(boost::int16_t i, boost::int16_t q){
+ return (boost::uint16_t(i) << 16) | (boost::uint16_t(q) << 0);
}
void usrp2_impl::init_ddc_config(void){
@@ -69,7 +76,7 @@ void usrp2_impl::update_ddc_config(void){
calculate_freq_word_and_update_actual_freq(_ddc_freq, get_master_clock_freq())
);
out_data.data.ddc_args.decim = htonl(_ddc_decim);
- static const uint32_t default_rx_scale_iq = 1024;
+ static const boost::int16_t default_rx_scale_iq = 1024;
out_data.data.ddc_args.scale_iq = htonl(
calculate_iq_scale_word(default_rx_scale_iq, default_rx_scale_iq)
);
@@ -211,8 +218,8 @@ void usrp2_impl::update_duc_config(void){
while(tmp_interp > 128) tmp_interp /= 2;
// Calculate closest multiplier constant to reverse gain absent scale multipliers
- size_t interp_cubed = pow(tmp_interp, 3);
- size_t scale = rint((4096*pow(2, ceil(log2(interp_cubed))))/(1.65*interp_cubed));
+ double interp_cubed = std::pow(double(tmp_interp), 3);
+ boost::int16_t scale = rint((4096*std::pow(2, ceil(log2(interp_cubed))))/(1.65*interp_cubed));
//setup the out data
usrp2_ctrl_data_t out_data;
diff --git a/host/lib/usrp/usrp2/fw_common.h b/host/lib/usrp/usrp2/fw_common.h
index 03e8d3a37..9740448ee 100644
--- a/host/lib/usrp/usrp2/fw_common.h
+++ b/host/lib/usrp/usrp2/fw_common.h
@@ -24,7 +24,11 @@
* Therefore, this header may only contain valid C code.
*/
#ifdef __cplusplus
+#include <boost/cstdint.hpp>
+#define _SINS_ boost:://stdint namespace when in c++
extern "C" {
+#else
+#include <stdint.h>
#endif
// size of the vrt header and trailer to the host
@@ -128,78 +132,78 @@ typedef enum{
} usrp2_clk_edge_t;
typedef struct{
- uint32_t id;
- uint32_t seq;
+ _SINS_ uint32_t id;
+ _SINS_ uint32_t seq;
union{
- uint32_t ip_addr;
- uint8_t mac_addr[6];
+ _SINS_ uint32_t ip_addr;
+ _SINS_ uint8_t mac_addr[6];
struct {
- uint16_t rx_id;
- uint16_t tx_id;
+ _SINS_ uint16_t rx_id;
+ _SINS_ uint16_t tx_id;
} dboard_ids;
struct {
- uint8_t pps_source;
- uint8_t pps_polarity;
- uint8_t ref_source;
- uint8_t _pad;
+ _SINS_ uint8_t pps_source;
+ _SINS_ uint8_t pps_polarity;
+ _SINS_ uint8_t ref_source;
+ _SINS_ uint8_t _pad;
} clock_config;
struct {
- uint8_t bank;
- uint8_t _pad[3];
- uint16_t value;
- uint16_t mask;
+ _SINS_ uint8_t bank;
+ _SINS_ uint8_t _pad[3];
+ _SINS_ uint16_t value;
+ _SINS_ uint16_t mask;
} gpio_config;
struct {
- uint8_t bank;
- uint8_t _pad[3];
- uint16_t tx_value;
- uint16_t rx_value;
- uint16_t mask;
+ _SINS_ uint8_t bank;
+ _SINS_ uint8_t _pad[3];
+ _SINS_ uint16_t tx_value;
+ _SINS_ uint16_t rx_value;
+ _SINS_ uint16_t mask;
} atr_config;
struct {
- uint8_t dev;
- uint8_t latch;
- uint8_t push;
- uint8_t readback;
- uint8_t bytes;
- uint8_t data[sizeof(uint32_t)];
+ _SINS_ uint8_t dev;
+ _SINS_ uint8_t latch;
+ _SINS_ uint8_t push;
+ _SINS_ uint8_t readback;
+ _SINS_ uint8_t bytes;
+ _SINS_ uint8_t data[sizeof(_SINS_ uint32_t)];
} spi_args;
struct {
- uint8_t addr;
- uint8_t bytes;
- uint8_t data[sizeof(uint32_t)];
+ _SINS_ uint8_t addr;
+ _SINS_ uint8_t bytes;
+ _SINS_ uint8_t data[sizeof(_SINS_ uint32_t)];
} i2c_args;
struct {
- uint8_t dir;
- uint8_t which;
- uint8_t _pad[2];
- uint32_t value;
+ _SINS_ uint8_t dir;
+ _SINS_ uint8_t which;
+ _SINS_ uint8_t _pad[2];
+ _SINS_ uint32_t value;
} aux_args;
struct {
- uint32_t freq_word;
- uint32_t decim;
- uint32_t scale_iq;
+ _SINS_ uint32_t freq_word;
+ _SINS_ uint32_t decim;
+ _SINS_ uint32_t scale_iq;
} ddc_args;
struct {
- uint8_t enabled;
- uint8_t _pad[3];
- uint32_t secs;
- uint32_t ticks;
- uint32_t samples;
+ _SINS_ uint8_t enabled;
+ _SINS_ uint8_t _pad[3];
+ _SINS_ uint32_t secs;
+ _SINS_ uint32_t ticks;
+ _SINS_ uint32_t samples;
} streaming;
struct {
- uint32_t freq_word;
- uint32_t interp;
- uint32_t scale_iq;
+ _SINS_ uint32_t freq_word;
+ _SINS_ uint32_t interp;
+ _SINS_ uint32_t scale_iq;
} duc_args;
struct {
- uint32_t secs;
- uint32_t ticks;
- uint8_t now;
+ _SINS_ uint32_t secs;
+ _SINS_ uint32_t ticks;
+ _SINS_ uint8_t now;
} time_args;
struct {
- uint32_t rx_mux;
- uint32_t tx_mux;
+ _SINS_ uint32_t rx_mux;
+ _SINS_ uint32_t tx_mux;
} mux_args;
} data;
} usrp2_ctrl_data_t;
diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp
index e52c1e576..dc8eea243 100644
--- a/host/lib/usrp/usrp2/io_impl.cpp
+++ b/host/lib/usrp/usrp2/io_impl.cpp
@@ -16,6 +16,7 @@
//
#include <complex>
+#include <algorithm>
#include <boost/format.hpp>
#include "usrp2_impl.hpp"
@@ -27,11 +28,11 @@ namespace asio = boost::asio;
/***********************************************************************
* Constants
**********************************************************************/
-typedef std::complex<float> fc32_t;
-typedef std::complex<int16_t> sc16_t;
+typedef std::complex<float> fc32_t;
+typedef std::complex<boost::int16_t> sc16_t;
-static const float shorts_per_float = pow(2.0, 15);
-static const float floats_per_short = 1.0/shorts_per_float;
+static const float shorts_per_float = float(1 << 15);
+static const float floats_per_short = float(1.0/shorts_per_float);
/***********************************************************************
* Helper Functions
@@ -41,7 +42,7 @@ void usrp2_impl::io_init(void){
_rx_copy_buff = asio::buffer("", 0);
//send a small data packet so the usrp2 knows the udp source port
- uint32_t zero_data = 0;
+ boost::uint32_t zero_data = 0;
_data_transport->send(asio::buffer(&zero_data, sizeof(zero_data)));
}
@@ -66,37 +67,37 @@ static const bool is_big_endian = false;
#endif
static inline void host_floats_to_usrp2_items(
- uint32_t *usrp2_items,
+ boost::uint32_t *usrp2_items,
const fc32_t *host_floats,
size_t num_samps
){
unrolled_loop(i, num_samps,{
- uint16_t real = host_floats[i].real()*shorts_per_float;
- uint16_t imag = host_floats[i].imag()*shorts_per_float;
+ boost::uint16_t real = boost::int16_t(host_floats[i].real()*shorts_per_float);
+ boost::uint16_t imag = boost::int16_t(host_floats[i].imag()*shorts_per_float);
usrp2_items[i] = htonl((real << 16) | (imag << 0));
});
}
static inline void usrp2_items_to_host_floats(
fc32_t *host_floats,
- const uint32_t *usrp2_items,
+ const boost::uint32_t *usrp2_items,
size_t num_samps
){
unrolled_loop(i, num_samps,{
- uint32_t item = ntohl(usrp2_items[i]);
- int16_t real = item >> 16;
- int16_t imag = item >> 0;
- host_floats[i] = fc32_t(real*floats_per_short, imag*floats_per_short);
+ boost::uint32_t item = ntohl(usrp2_items[i]);
+ boost::int16_t real = boost::uint16_t(item >> 16);
+ boost::int16_t imag = boost::uint16_t(item >> 0);
+ host_floats[i] = fc32_t(float(real*floats_per_short), float(imag*floats_per_short));
});
}
static inline void host_items_to_usrp2_items(
- uint32_t *usrp2_items,
- const uint32_t *host_items,
+ boost::uint32_t *usrp2_items,
+ const boost::uint32_t *host_items,
size_t num_samps
){
if (is_big_endian){
- std::memcpy(usrp2_items, host_items, num_samps*sizeof(uint32_t));
+ std::memcpy(usrp2_items, host_items, num_samps*sizeof(boost::uint32_t));
}
else{
unrolled_loop(i, num_samps, usrp2_items[i] = htonl(host_items[i]));
@@ -104,12 +105,12 @@ static inline void host_items_to_usrp2_items(
}
static inline void usrp2_items_to_host_items(
- uint32_t *host_items,
- const uint32_t *usrp2_items,
+ boost::uint32_t *host_items,
+ const boost::uint32_t *usrp2_items,
size_t num_samps
){
if (is_big_endian){
- std::memcpy(host_items, usrp2_items, num_samps*sizeof(uint32_t));
+ std::memcpy(host_items, usrp2_items, num_samps*sizeof(boost::uint32_t));
}
else{
unrolled_loop(i, num_samps, host_items[i] = ntohl(usrp2_items[i]));
@@ -124,12 +125,12 @@ void usrp2_impl::recv_raw(rx_metadata_t &metadata){
_rx_smart_buff = _data_transport->recv();
//unpack the vrt header
- size_t num_packet_words32 = asio::buffer_size(_rx_smart_buff->get())/sizeof(uint32_t);
+ size_t num_packet_words32 = asio::buffer_size(_rx_smart_buff->get())/sizeof(boost::uint32_t);
if (num_packet_words32 == 0){
_rx_copy_buff = boost::asio::buffer("", 0);
return; //must exit here after setting the buffer
}
- const uint32_t *vrt_hdr = asio::buffer_cast<const uint32_t *>(_rx_smart_buff->get());
+ const boost::uint32_t *vrt_hdr = asio::buffer_cast<const boost::uint32_t *>(_rx_smart_buff->get());
size_t num_header_words32_out, num_payload_words32_out, packet_count_out;
try{
vrt::unpack(
@@ -156,7 +157,7 @@ void usrp2_impl::recv_raw(rx_metadata_t &metadata){
//setup the rx buffer to point to the data
_rx_copy_buff = asio::buffer(
vrt_hdr + num_header_words32_out,
- num_payload_words32_out*sizeof(uint32_t)
+ num_payload_words32_out*sizeof(boost::uint32_t)
);
}
@@ -168,8 +169,8 @@ size_t usrp2_impl::send(
const tx_metadata_t &metadata,
const std::string &type
){
- uint32_t tx_mem[_mtu/sizeof(uint32_t)];
- uint32_t *items = tx_mem + vrt::max_header_words32; //offset for data
+ boost::uint32_t tx_mem[_mtu/sizeof(boost::uint32_t)];
+ boost::uint32_t *items = tx_mem + vrt::max_header_words32; //offset for data
size_t num_samps = _max_tx_samples_per_packet;
//calculate the number of samples to be copied
@@ -180,13 +181,13 @@ size_t usrp2_impl::send(
}
else if (type == "16sc"){
num_samps = std::min(asio::buffer_size(buff)/sizeof(sc16_t), num_samps);
- host_items_to_usrp2_items(items, asio::buffer_cast<const uint32_t*>(buff), num_samps);
+ host_items_to_usrp2_items(items, asio::buffer_cast<const boost::uint32_t*>(buff), num_samps);
}
else{
throw std::runtime_error(str(boost::format("usrp2 send: cannot handle type \"%s\"") % type));
}
- uint32_t vrt_hdr[vrt::max_header_words32];
+ boost::uint32_t vrt_hdr[vrt::max_header_words32];
size_t num_header_words32, num_packet_words32;
size_t packet_count = _tx_stream_id_to_packet_seq[metadata.stream_id]++;
@@ -202,10 +203,10 @@ size_t usrp2_impl::send(
//copy in the vrt header (yes we left space)
items -= num_header_words32;
- std::memcpy(items, vrt_hdr, num_header_words32*sizeof(uint32_t));
+ std::memcpy(items, vrt_hdr, num_header_words32*sizeof(boost::uint32_t));
//send and return number of samples
- _data_transport->send(asio::buffer(items, num_packet_words32*sizeof(uint32_t)));
+ _data_transport->send(asio::buffer(items, num_packet_words32*sizeof(boost::uint32_t)));
return num_samps;
}
@@ -231,8 +232,8 @@ size_t usrp2_impl::recv(
//and a pointer into the usrp2 received items memory
size_t bytes_to_copy = asio::buffer_size(_rx_copy_buff);
if (bytes_to_copy == 0) return 0; //nothing to receive
- size_t num_samps = bytes_to_copy/sizeof(uint32_t);
- const uint32_t *items = asio::buffer_cast<const uint32_t*>(_rx_copy_buff);
+ size_t num_samps = bytes_to_copy/sizeof(boost::uint32_t);
+ const boost::uint32_t *items = asio::buffer_cast<const boost::uint32_t*>(_rx_copy_buff);
//calculate the number of samples to be copied
//and copy the samples from the recv buffer
@@ -242,7 +243,7 @@ size_t usrp2_impl::recv(
}
else if (type == "16sc"){
num_samps = std::min(asio::buffer_size(buff)/sizeof(sc16_t), num_samps);
- usrp2_items_to_host_items(asio::buffer_cast<uint32_t*>(buff), items, num_samps);
+ usrp2_items_to_host_items(asio::buffer_cast<boost::uint32_t*>(buff), items, num_samps);
}
else{
throw std::runtime_error(str(boost::format("usrp2 recv: cannot handle type \"%s\"") % type));
@@ -250,7 +251,7 @@ size_t usrp2_impl::recv(
//update the rx copy buffer to reflect the bytes copied
_rx_copy_buff = asio::buffer(
- items + num_samps, bytes_to_copy - num_samps*sizeof(uint32_t)
+ items + num_samps, bytes_to_copy - num_samps*sizeof(boost::uint32_t)
);
return num_samps;
diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp
index 2c6b6f8c9..765c523fe 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.hpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.hpp
@@ -115,17 +115,17 @@ public:
private:
//the raw io interface (samples are in the usrp2 native format)
void recv_raw(uhd::rx_metadata_t &);
- uhd::dict<uint32_t, size_t> _tx_stream_id_to_packet_seq;
- uhd::dict<uint32_t, size_t> _rx_stream_id_to_packet_seq;
+ uhd::dict<boost::uint32_t, size_t> _tx_stream_id_to_packet_seq;
+ uhd::dict<boost::uint32_t, size_t> _rx_stream_id_to_packet_seq;
static const size_t _mtu = 1500; //FIXME we have no idea
static const size_t _hdrs = (2 + 14 + 20 + 8); //size of headers (pad, eth, ip, udp)
static const size_t _max_rx_samples_per_packet =
- (_mtu - _hdrs)/sizeof(uint32_t) -
+ (_mtu - _hdrs)/sizeof(boost::uint32_t) -
USRP2_HOST_RX_VRT_HEADER_WORDS32 -
USRP2_HOST_RX_VRT_TRAILER_WORDS32
;
static const size_t _max_tx_samples_per_packet =
- (_mtu - _hdrs)/sizeof(uint32_t) -
+ (_mtu - _hdrs)/sizeof(boost::uint32_t) -
uhd::transport::vrt::max_header_words32
;
uhd::transport::smart_buffer::sptr _rx_smart_buff;
@@ -137,7 +137,7 @@ private:
uhd::transport::udp_zero_copy::sptr _data_transport;
//private vars for dealing with send/recv control
- uint32_t _ctrl_seq_num;
+ boost::uint32_t _ctrl_seq_num;
boost::mutex _ctrl_mutex;
//methods and shadows for clock configuration