1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 04:30:33 +00:00

Do not warn users twice about the overflow

clang-tidy checks applied: modernize-redundant-void-arg, performance-unnecessary-value-param
This commit is contained in:
Carles Fernandez 2021-02-18 13:17:46 +01:00
parent 29e3e120be
commit 8e23c60fca
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 8 additions and 9 deletions

View File

@ -32,12 +32,14 @@
#include <fstream> // for string, ofstream #include <fstream> // for string, ofstream
#include <iostream> // for cout #include <iostream> // for cout
#include <sys/mman.h> // for mmap #include <sys/mman.h> // for mmap
#include <utility> // for move
Fpga_buffer_monitor::Fpga_buffer_monitor(const std::string &device_name, uint32_t num_freq_bands, bool dump, std::string dump_filename) Fpga_buffer_monitor::Fpga_buffer_monitor(const std::string &device_name, uint32_t num_freq_bands, bool dump, std::string dump_filename)
{ {
d_num_freq_bands = num_freq_bands; d_num_freq_bands = num_freq_bands;
d_dump = dump; d_dump = dump;
d_dump_filename = dump_filename; d_dump_filename = std::move(dump_filename);
// open device descriptor // open device descriptor
if ((d_device_descriptor = open(device_name.c_str(), O_RDWR | O_SYNC)) == -1) if ((d_device_descriptor = open(device_name.c_str(), O_RDWR | O_SYNC)) == -1)
@ -144,7 +146,7 @@ Fpga_buffer_monitor::~Fpga_buffer_monitor()
} }
void Fpga_buffer_monitor::check_buffer_overflow_and_monitor_buffer_status(void) void Fpga_buffer_monitor::check_buffer_overflow_and_monitor_buffer_status()
{ {
// check buffer overflow flags // check buffer overflow flags
uint32_t buffer_overflow_status = d_map_base[overflow_flags_reg_addr]; uint32_t buffer_overflow_status = d_map_base[overflow_flags_reg_addr];
@ -153,12 +155,10 @@ void Fpga_buffer_monitor::check_buffer_overflow_and_monitor_buffer_status(void)
{ {
if (d_num_freq_bands > 1) if (d_num_freq_bands > 1)
{ {
std::cout << "FPGA Buffer overflow in frequency band 0" << std::endl;
LOG(ERROR) << "FPGA Buffer overflow in frequency band 0"; LOG(ERROR) << "FPGA Buffer overflow in frequency band 0";
} }
else else
{ {
std::cout << "FPGA Buffer overflow" << std::endl;
LOG(ERROR) << "FPGA Buffer overflow"; LOG(ERROR) << "FPGA Buffer overflow";
} }
} }
@ -167,7 +167,6 @@ void Fpga_buffer_monitor::check_buffer_overflow_and_monitor_buffer_status(void)
{ {
if ((buffer_overflow_status & overflow_freq_band_1_bit_pos) != 0) if ((buffer_overflow_status & overflow_freq_band_1_bit_pos) != 0)
{ {
std::cout << "FPGA Buffer overflow in frequency band 1" << std::endl;
LOG(ERROR) << "FPGA Buffer overflow in frequency band 1"; LOG(ERROR) << "FPGA Buffer overflow in frequency band 1";
} }
} }
@ -232,7 +231,7 @@ void Fpga_buffer_monitor::check_buffer_overflow_and_monitor_buffer_status(void)
} }
int32_t Fpga_buffer_monitor::buffer_monitor_test_register(void) int32_t Fpga_buffer_monitor::buffer_monitor_test_register()
{ {
// write value to test register // write value to test register
d_map_base[test_reg_addr] = test_register_writeval; d_map_base[test_reg_addr] = test_register_writeval;

View File

@ -59,7 +59,7 @@ public:
/*! /*!
* \brief This function checks buffer overflow and monitors the FPGA buffer status * \brief This function checks buffer overflow and monitors the FPGA buffer status
*/ */
void check_buffer_overflow_and_monitor_buffer_status(void); void check_buffer_overflow_and_monitor_buffer_status();
private: private:
static const size_t FPGA_PAGE_SIZE = 0x10000; static const size_t FPGA_PAGE_SIZE = 0x10000;
@ -79,8 +79,8 @@ private:
static const uint32_t overflow_freq_band_0_bit_pos = 1; static const uint32_t overflow_freq_band_0_bit_pos = 1;
static const uint32_t overflow_freq_band_1_bit_pos = 2; static const uint32_t overflow_freq_band_1_bit_pos = 2;
int32_t buffer_monitor_test_register(void); int32_t buffer_monitor_test_register();
void close_device(void); void close_device();
volatile unsigned* d_map_base; // driver memory map corresponding to the FPGA buffer monitor volatile unsigned* d_map_base; // driver memory map corresponding to the FPGA buffer monitor
int d_device_descriptor; // driver descriptor corresponding to the FPGA buffer monitor int d_device_descriptor; // driver descriptor corresponding to the FPGA buffer monitor