1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 12:10:34 +00:00

do not stop the receiver when buffer overflow is detected.

This commit is contained in:
Marc Majoral 2021-02-18 12:32:44 +01:00
parent 8fe9a74ff2
commit e4de9c54de
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; 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(); }); thread_buffer_monitor = std::thread([&] { run_buffer_monitor_process(); });
} }

View File

@ -33,12 +33,11 @@
#include <iostream> // for cout #include <iostream> // for cout
#include <sys/mman.h> // for mmap #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_num_freq_bands = num_freq_bands;
d_dump = dump; d_dump = dump;
d_dump_filename = dump_filename; d_dump_filename = dump_filename;
d_queue = queue;
// 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)
@ -89,7 +88,7 @@ Fpga_buffer_monitor::Fpga_buffer_monitor(const std::string &device_name, uint32_
} }
if (d_dump_filename.empty()) if (d_dump_filename.empty())
{ {
d_dump_filename = "FPGA_buffer_monitor"; d_dump_filename = "FPGA_buffer_monitor_dump";
} }
// remove extension if any // remove extension if any
if (d_dump_filename.substr(1).find_last_of('.') != std::string::npos) 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) void Fpga_buffer_monitor::check_buffer_overflow_and_monitor_buffer_status(void)
{ {
// check buffer overflow flags // check buffer overflow flags
bool overflow_detected = false;
uint32_t buffer_overflow_status = d_map_base[overflow_flags_reg_addr]; uint32_t buffer_overflow_status = d_map_base[overflow_flags_reg_addr];
if ((buffer_overflow_status & overflow_freq_band_0_bit_pos) != 0) if ((buffer_overflow_status & overflow_freq_band_0_bit_pos) != 0)
{ {
overflow_detected = true; if (d_num_freq_bands > 1)
std::cout << "Buffer overflow in frequency band 0" << std::endl; {
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 (d_num_freq_bands > 1)
{ {
if ((buffer_overflow_status & overflow_freq_band_1_bit_pos) != 0) if ((buffer_overflow_status & overflow_freq_band_1_bit_pos) != 0)
{ {
overflow_detected = true; std::cout << "FPGA Buffer overflow in frequency band 1" << std::endl;
std::cout << "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 // buffer monitor
if (d_dump == 1) if (d_dump == 1)
{ {

View File

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