From fd76798927ef50bba8f98e49387d8b36b13109e1 Mon Sep 17 00:00:00 2001 From: Nicholas Corgan Date: Tue, 29 Oct 2013 09:21:12 -0700 Subject: Removed GCC-specific attribute for unused parameters * This broke MSVC builds due to incompatibility * Added new UHD_UNUSED(x) macro in --- host/lib/usrp/b200/b200_iface.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/b200/b200_iface.cpp b/host/lib/usrp/b200/b200_iface.cpp index 457b380b6..d440b105a 100644 --- a/host/lib/usrp/b200/b200_iface.cpp +++ b/host/lib/usrp/b200/b200_iface.cpp @@ -17,6 +17,7 @@ #include "b200_iface.hpp" +#include #include #include #include @@ -217,13 +218,13 @@ public: } - void write_i2c(boost::uint16_t addr __attribute__ ((unused)), const byte_vector_t &bytes __attribute__ ((unused))) + void write_i2c(UHD_UNUSED(boost::uint16_t addr), UHD_UNUSED(const byte_vector_t &bytes)) { throw uhd::not_implemented_error("b200 write i2c"); } - byte_vector_t read_i2c(boost::uint16_t addr __attribute__ ((unused)), size_t num_bytes __attribute__ ((unused))) + byte_vector_t read_i2c(UHD_UNUSED(boost::uint16_t addr), UHD_UNUSED(size_t num_bytes)) { throw uhd::not_implemented_error("b200 read i2c"); } @@ -296,7 +297,7 @@ public: } - void load_firmware(const std::string filestring, bool force __attribute__ ((unused)) = false) + void load_firmware(const std::string filestring, UHD_UNUSED(bool force) = false) { const char *filename = filestring.c_str(); -- cgit v1.2.3 From e48622be4eb994571e107ed9536f7d8658098396 Mon Sep 17 00:00:00 2001 From: Michael West Date: Fri, 1 Nov 2013 16:28:17 -0700 Subject: Readability improvements and typo fix. --- host/lib/usrp/b200/b200_iface.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/b200/b200_iface.cpp b/host/lib/usrp/b200/b200_iface.cpp index d440b105a..bff075536 100644 --- a/host/lib/usrp/b200/b200_iface.cpp +++ b/host/lib/usrp/b200/b200_iface.cpp @@ -159,7 +159,7 @@ bool parse_record(std::string *record, boost::uint16_t &len, \ std::istringstream(record->substr(3, 4)) >> std::hex >> addr; std::istringstream(record->substr(7, 2)) >> std::hex >> type; - if (len >2 * (record->length() - 9)) // sanity check to prevent buffer overrun + if (len > (2 * (record->length() - 9))) // sanity check to prevent buffer overrun return false; for (i = 0; i < len; i++) { @@ -327,7 +327,7 @@ public: std::string record; file >> record; - if (!record.length() > 0) + if (!(record.length() > 0)) continue; /* Check for valid Intel HEX record. */ @@ -427,7 +427,7 @@ public: UHD_THROW_INVALID_CODE_PATH(); // Below is dead code as long as UHD_THROW_INVALID_CODE_PATH(); is declared above. - // It is preservered here in a comment in case it is needed later: + // It is preserved here in a comment in case it is needed later: // fx3_control_write(B200_VREQ_FPGA_RESET, 0x00, 0x00, data, 4); } -- cgit v1.2.3 From fddcf720a16e7caccb132d8c66814c2e7e627dfe Mon Sep 17 00:00:00 2001 From: Michael West Date: Fri, 1 Nov 2013 16:28:49 -0700 Subject: Readability improvements. --- host/lib/usrp/common/fx2_ctrl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/common/fx2_ctrl.cpp b/host/lib/usrp/common/fx2_ctrl.cpp index 1cacc45cf..d68bf6058 100644 --- a/host/lib/usrp/common/fx2_ctrl.cpp +++ b/host/lib/usrp/common/fx2_ctrl.cpp @@ -119,7 +119,7 @@ bool parse_record(std::string *record, unsigned int &len, std::istringstream(record->substr(3, 4)) >> std::hex >> addr; std::istringstream(record->substr(7, 2)) >> std::hex >> type; - if (len >2 * (record->length() - 9)) // sanity check to prevent buffer overrun + if (len > (2 * (record->length() - 9))) // sanity check to prevent buffer overrun return false; for (i = 0; i < len; i++) { @@ -184,7 +184,7 @@ public: std::string record; file >> record; - if (!record.length() > 0) + if (!(record.length() > 0)) continue; //check for valid record -- cgit v1.2.3 From 709db30d12a664b23b7f3695433a7b2d45c2a533 Mon Sep 17 00:00:00 2001 From: Michael West Date: Fri, 1 Nov 2013 16:29:18 -0700 Subject: Readability improvements. --- host/lib/usrp/usrp1/usrp1_iface.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/usrp1/usrp1_iface.cpp b/host/lib/usrp/usrp1/usrp1_iface.cpp index 7c64714b7..6eff9d3ad 100644 --- a/host/lib/usrp/usrp1/usrp1_iface.cpp +++ b/host/lib/usrp/usrp1/usrp1_iface.cpp @@ -141,8 +141,10 @@ public: if (readback) { unsigned char buff[4] = { - (unsigned char)((bits >> 0) & 0xff), (unsigned char)((bits >> 8) & 0xff), - (unsigned char)((bits >> 16) & 0xff), (unsigned char)((bits >> 24) & 0xff) + (unsigned char)(bits & 0xff), + (unsigned char)((bits >> 8) & 0xff), + (unsigned char)((bits >> 16) & 0xff), + (unsigned char)((bits >> 24) & 0xff) }; //conditions where there are two header bytes if (num_bytes >= 3 and buff[num_bytes-1] != 0 and buff[num_bytes-2] != 0 and buff[num_bytes-3] == 0){ -- cgit v1.2.3 From 901434f58941985fe3e00d7dd53ff4538b542244 Mon Sep 17 00:00:00 2001 From: Michael West Date: Fri, 1 Nov 2013 16:29:44 -0700 Subject: Readability improvements. --- host/lib/usrp/usrp2/usrp2_clk_regs.hpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'host/lib') diff --git a/host/lib/usrp/usrp2/usrp2_clk_regs.hpp b/host/lib/usrp/usrp2/usrp2_clk_regs.hpp index 45c0859d8..d5e506d8d 100644 --- a/host/lib/usrp/usrp2/usrp2_clk_regs.hpp +++ b/host/lib/usrp/usrp2/usrp2_clk_regs.hpp @@ -22,7 +22,16 @@ class usrp2_clk_regs_t { public: - usrp2_clk_regs_t(void):test(0),fpga(0),adc(0),dac(0),serdes(0),exp(0),tx_db(0),rx_db(0) { ; } + usrp2_clk_regs_t(void): + test(0), + fpga(0), + adc(0), + dac(0), + serdes(0), + exp(0), + tx_db(0), + rx_db(0) {} + usrp2_clk_regs_t(usrp2_iface::rev_type rev) { fpga = adc = serdes = exp = tx_db = 0; test = 0; -- cgit v1.2.3 From 265e94473130ffefc95d4eb67e8d46ce50982be4 Mon Sep 17 00:00:00 2001 From: Michael West Date: Fri, 1 Nov 2013 17:15:05 -0700 Subject: Restored use of accessor to initialize value in the constructor. --- host/lib/usrp/cores/tx_dsp_core_3000.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'host/lib') diff --git a/host/lib/usrp/cores/tx_dsp_core_3000.cpp b/host/lib/usrp/cores/tx_dsp_core_3000.cpp index 6fde70c5f..93c8702bc 100644 --- a/host/lib/usrp/cores/tx_dsp_core_3000.cpp +++ b/host/lib/usrp/cores/tx_dsp_core_3000.cpp @@ -51,7 +51,7 @@ public: //init to something so update method has reasonable defaults _scaling_adjustment = 1.0; _dsp_extra_scaling = 1.0; - _tick_rate = 1.0; + this->set_tick_rate(1.0); } void set_tick_rate(const double rate){ -- cgit v1.2.3