aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp1
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/usrp1')
-rw-r--r--host/lib/usrp/usrp1/codec_ctrl.cpp4
-rw-r--r--host/lib/usrp/usrp1/dsp_impl.cpp10
-rw-r--r--host/lib/usrp/usrp1/io_impl.cpp4
-rw-r--r--host/lib/usrp/usrp1/usrp1_ctrl.cpp21
-rw-r--r--host/lib/usrp/usrp1/usrp1_iface.cpp4
-rw-r--r--host/lib/usrp/usrp1/usrp1_impl.cpp2
6 files changed, 22 insertions, 23 deletions
diff --git a/host/lib/usrp/usrp1/codec_ctrl.cpp b/host/lib/usrp/usrp1/codec_ctrl.cpp
index 08f2d2a8e..ad16f6b3a 100644
--- a/host/lib/usrp/usrp1/codec_ctrl.cpp
+++ b/host/lib/usrp/usrp1/codec_ctrl.cpp
@@ -126,7 +126,7 @@ usrp1_codec_ctrl_impl::usrp1_codec_ctrl_impl(usrp1_iface::sptr iface,
_ad9862_regs.clkout2_div_factor = ad9862_regs_t::CLKOUT2_DIV_FACTOR_2;
//write the register settings to the codec
- for (uint8_t addr = 0; addr <= 25; addr++) {
+ for (boost::uint8_t addr = 0; addr <= 25; addr++) {
this->send_reg(addr);
}
@@ -199,7 +199,7 @@ float usrp1_codec_ctrl_impl::get_rx_pga_gain(char which){
**********************************************************************/
static float aux_adc_to_volts(boost::uint8_t high, boost::uint8_t low)
{
- return float((boost::uint16_t(high) << 2) | low)*3.3/0x3ff;
+ return float(((boost::uint16_t(high) << 2) | low)*3.3)/0x3ff;
}
float usrp1_codec_ctrl_impl::read_aux_adc(aux_adc_t which)
diff --git a/host/lib/usrp/usrp1/dsp_impl.cpp b/host/lib/usrp/usrp1/dsp_impl.cpp
index 573bce21f..e9a5e60a6 100644
--- a/host/lib/usrp/usrp1/dsp_impl.cpp
+++ b/host/lib/usrp/usrp1/dsp_impl.cpp
@@ -107,8 +107,7 @@ void usrp1_impl::rx_dsp_set(const wax::obj &key_, const wax::obj &val){
return;
}
case DSP_PROP_HOST_RATE: {
- unsigned int rate =
- _clock_ctrl->get_master_clock_freq() / val.as<double>();
+ size_t rate = size_t(_clock_ctrl->get_master_clock_freq() / val.as<double>());
if ((rate & 0x01) || (rate < 4) || (rate > 256)) {
std::cerr << "Decimation must be even and between 4 and 256"
@@ -118,7 +117,7 @@ void usrp1_impl::rx_dsp_set(const wax::obj &key_, const wax::obj &val){
_rx_dsp_decim = rate;
//TODO Poll every 100ms. Make it selectable?
- _rx_samps_per_poll_interval = 0.1 * _clock_ctrl->get_master_clock_freq() / rate;
+ _rx_samps_per_poll_interval = size_t(0.1 * _clock_ctrl->get_master_clock_freq() / rate);
_iface->poke32(FR_DECIM_RATE, _rx_dsp_decim/2 - 1);
}
@@ -207,8 +206,7 @@ void usrp1_impl::tx_dsp_set(const wax::obj &key_, const wax::obj &val){
}
case DSP_PROP_HOST_RATE: {
- unsigned int rate =
- _clock_ctrl->get_master_clock_freq() * 2 / val.as<double>();
+ size_t rate = size_t(_clock_ctrl->get_master_clock_freq() * 2 / val.as<double>());
if ((rate & 0x01) || (rate < 8) || (rate > 512)) {
std::cerr << "Interpolation rate must be even and between 8 and 512"
@@ -219,7 +217,7 @@ void usrp1_impl::tx_dsp_set(const wax::obj &key_, const wax::obj &val){
_tx_dsp_interp = rate;
//TODO Poll every 100ms. Make it selectable?
- _tx_samps_per_poll_interval = 0.1 * _clock_ctrl->get_master_clock_freq() * 2 / rate;
+ _tx_samps_per_poll_interval = size_t(0.1 * _clock_ctrl->get_master_clock_freq() * 2 / rate);
_iface->poke32(FR_INTERP_RATE, _tx_dsp_interp / 4 - 1);
return;
diff --git a/host/lib/usrp/usrp1/io_impl.cpp b/host/lib/usrp/usrp1/io_impl.cpp
index 146038bd9..73974f2d6 100644
--- a/host/lib/usrp/usrp1/io_impl.cpp
+++ b/host/lib/usrp/usrp1/io_impl.cpp
@@ -184,7 +184,7 @@ bool usrp1_impl::io_impl::get_send_buffs(
));
}
- return buffs[0].get();
+ return buffs[0].get() != NULL;
}
/***********************************************************************
@@ -277,7 +277,7 @@ static bool get_recv_buffs(
){
UHD_ASSERT_THROW(buffs.size() == 1);
buffs[0] = zc_if->get_recv_buff();
- return buffs[0].get();
+ return buffs[0].get() != NULL;
}
size_t usrp1_impl::recv(
diff --git a/host/lib/usrp/usrp1/usrp1_ctrl.cpp b/host/lib/usrp/usrp1/usrp1_ctrl.cpp
index 451129ef5..1dc6e6e25 100644
--- a/host/lib/usrp/usrp1/usrp1_ctrl.cpp
+++ b/host/lib/usrp/usrp1/usrp1_ctrl.cpp
@@ -249,45 +249,46 @@ public:
unsigned char buf[ep0_size];
int ret;
- FILE *fp;
- if ((fp = fopen(filename, "rb")) == NULL) {
+ std::ifstream file;
+ file.open(filename, std::ios::in | std::ios::binary);
+ if (not file.good()) {
std::cerr << "cannot open fpga input file" << std::endl;
- fclose(fp);
+ file.close();
return -1;
}
if (usrp_control_write_cmd(VRQ_FPGA_LOAD, 0, FL_BEGIN) < 0) {
std::cerr << "fpga load error" << std::endl;
- fclose(fp);
+ file.close();
return -1;
}
ssize_t n;
- while ((n = fread(buf, 1, sizeof(buf), fp)) > 0) {
+ while ((n = file.readsome((char *)buf, sizeof(buf))) > 0) {
ret = usrp_control_write(VRQ_FPGA_LOAD, 0, FL_XFER,
buf, n);
if (ret != n) {
std::cerr << "fpga load error " << ret << std::endl;
- fclose(fp);
+ file.close();
return -1;
}
}
if (usrp_control_write_cmd(VRQ_FPGA_LOAD, 0, FL_END) < 0) {
std::cerr << "fpga load error" << std::endl;
- fclose(fp);
+ file.close();
return -1;
}
usrp_set_fpga_hash(hash);
- fclose(fp);
+ file.close();
return 0;
}
int usrp_load_eeprom(std::string filestring)
{
const char *filename = filestring.c_str();
- const uint16_t i2c_addr = 0x50;
+ const boost::uint16_t i2c_addr = 0x50;
//FIXME: verify types
int len;
@@ -416,7 +417,7 @@ public:
}
- int usrp_control_write_cmd(uint8_t request, uint16_t value, uint16_t index)
+ int usrp_control_write_cmd(boost::uint8_t request, boost::uint16_t value, boost::uint16_t index)
{
return usrp_control_write(request, value, index, 0, 0);
}
diff --git a/host/lib/usrp/usrp1/usrp1_iface.cpp b/host/lib/usrp/usrp1/usrp1_iface.cpp
index 4bc18dd16..5fd3987d5 100644
--- a/host/lib/usrp/usrp1/usrp1_iface.cpp
+++ b/host/lib/usrp/usrp1/usrp1_iface.cpp
@@ -80,7 +80,7 @@ public:
boost::uint32_t peek32(boost::uint32_t addr)
{
- uint32_t value_out;
+ boost::uint32_t value_out;
boost::uint8_t w_index_h = SPI_ENABLE_FPGA & 0xff;
boost::uint8_t w_index_l = (SPI_FMT_MSB | SPI_FMT_HDR_1) & 0xff;
@@ -100,7 +100,7 @@ public:
boost::uint16_t peek16(boost::uint32_t addr)
{
- uint32_t val = peek32(addr);
+ boost::uint32_t val = peek32(addr);
return boost::uint16_t(val & 0xff);
}
diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp
index a6806dbc3..627180b11 100644
--- a/host/lib/usrp/usrp1/usrp1_impl.cpp
+++ b/host/lib/usrp/usrp1/usrp1_impl.cpp
@@ -62,7 +62,7 @@ static device_addrs_t usrp1_find(const device_addr_t &hint)
hint.has_key("fw")? hint["fw"] : "usrp1_fw.ihx"
);
}
- catch(const std::exception &e){
+ catch(...){
uhd::print_warning(
"Could not locate USRP1 firmware.\n"
"Please install the images package.\n"