1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-25 22:43:14 +00:00

Merge branch 'mmajoral-fix_fpga_buff_mon' into next

This commit is contained in:
Carles Fernandez 2021-02-18 13:01:53 +01:00
commit 29e3e120be
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
3 changed files with 16 additions and 19 deletions

View File

@ -316,7 +316,7 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *con
}
uint32_t num_freq_bands = (freq_band.compare("L1L2")) ? 1 : 2;
buffer_monitor_fpga = std::make_shared<Fpga_buffer_monitor>(device_io_name_buffer_monitor, num_freq_bands, dump_, dump_filename, queue);
buffer_monitor_fpga = std::make_shared<Fpga_buffer_monitor>(device_io_name_buffer_monitor, num_freq_bands, dump_, dump_filename);
thread_buffer_monitor = std::thread([&] { run_buffer_monitor_process(); });
}

View File

@ -33,12 +33,11 @@
#include <iostream> // for cout
#include <sys/mman.h> // for mmap
Fpga_buffer_monitor::Fpga_buffer_monitor(const std::string &device_name, uint32_t num_freq_bands, bool dump, std::string dump_filename, Concurrent_Queue<pmt::pmt_t> *queue)
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_dump = dump;
d_dump_filename = dump_filename;
d_queue = queue;
// open device descriptor
if ((d_device_descriptor = open(device_name.c_str(), O_RDWR | O_SYNC)) == -1)
@ -89,7 +88,7 @@ Fpga_buffer_monitor::Fpga_buffer_monitor(const std::string &device_name, uint32_
}
if (d_dump_filename.empty())
{
d_dump_filename = "FPGA_buffer_monitor";
d_dump_filename = "FPGA_buffer_monitor_dump";
}
// remove extension if any
if (d_dump_filename.substr(1).find_last_of('.') != std::string::npos)
@ -148,30 +147,31 @@ Fpga_buffer_monitor::~Fpga_buffer_monitor()
void Fpga_buffer_monitor::check_buffer_overflow_and_monitor_buffer_status(void)
{
// check buffer overflow flags
bool overflow_detected = false;
uint32_t buffer_overflow_status = d_map_base[overflow_flags_reg_addr];
if ((buffer_overflow_status & overflow_freq_band_0_bit_pos) != 0)
{
overflow_detected = true;
std::cout << "Buffer overflow in frequency band 0" << std::endl;
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";
}
else
{
std::cout << "FPGA Buffer overflow" << std::endl;
LOG(ERROR) << "FPGA Buffer overflow";
}
}
if (d_num_freq_bands > 1)
{
if ((buffer_overflow_status & overflow_freq_band_1_bit_pos) != 0)
{
overflow_detected = true;
std::cout << "Buffer overflow in frequency band 1" << std::endl;
std::cout << "FPGA Buffer overflow in frequency band 1" << std::endl;
LOG(ERROR) << "FPGA Buffer overflow in frequency band 1";
}
}
if (overflow_detected)
{
LOG(ERROR) << "Stopping receiver, FPGA buffer overflow detected.";
d_queue->push(pmt::make_any(command_event_make(200, 0)));
}
// buffer monitor
if (d_dump == 1)
{

View File

@ -49,8 +49,7 @@ public:
explicit Fpga_buffer_monitor(const std::string& device_name,
uint32_t num_freq_bands,
bool dump,
std::string dump_filename,
Concurrent_Queue<pmt::pmt_t>* queue);
std::string dump_filename);
/*!
* \brief Destructor
@ -94,8 +93,6 @@ private:
bool d_dump;
std::string d_dump_filename;
std::ofstream d_dump_file;
Concurrent_Queue<pmt::pmt_t>* d_queue;
};