1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-08-08 06:53:54 +00:00

Fix formatting

This commit is contained in:
Carles Fernandez 2025-04-01 15:52:10 +02:00
parent 9d32e21cb3
commit 98c0465947
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D

View File

@ -19,20 +19,20 @@
* ----------------------------------------------------------------------------- * -----------------------------------------------------------------------------
*/ */
#include "fpga_dynamic_bit_selection.h" #include "fpga_dynamic_bit_selection.h"
#include "uio_fpga.h" #include "uio_fpga.h"
#include <fcntl.h> // for open, O_RDWR, O_SYNC #include <fcntl.h> // for open, O_RDWR, O_SYNC
#include <iostream> // for cout #include <iostream> // for cout
#include <sys/mman.h> // for mmap #include <sys/mman.h> // for mmap
#include <unistd.h> // for close #include <unistd.h> // for close
#if USE_GLOG_AND_GFLAGS #if USE_GLOG_AND_GFLAGS
#include <glog/logging.h> #include <glog/logging.h>
#else #else
#include <absl/log/log.h> #include <absl/log/log.h>
#endif #endif
Fpga_dynamic_bit_selection::Fpga_dynamic_bit_selection(bool enable_rx1_band, bool enable_rx2_band) Fpga_dynamic_bit_selection::Fpga_dynamic_bit_selection(bool enable_rx1_band, bool enable_rx2_band)
: d_map_base_freq_band_1(nullptr), : d_map_base_freq_band_1(nullptr),
d_map_base_freq_band_2(nullptr), d_map_base_freq_band_2(nullptr),
d_dev_descr_freq_band_1(0), d_dev_descr_freq_band_1(0),
@ -41,7 +41,7 @@
d_shift_out_bits_freq_band_2(0), d_shift_out_bits_freq_band_2(0),
d_enable_rx1_band(enable_rx1_band), d_enable_rx1_band(enable_rx1_band),
d_enable_rx2_band(enable_rx2_band) d_enable_rx2_band(enable_rx2_band)
{ {
if (d_enable_rx1_band) if (d_enable_rx1_band)
{ {
open_device(&d_map_base_freq_band_1, d_dev_descr_freq_band_1, 0); open_device(&d_map_base_freq_band_1, d_dev_descr_freq_band_1, 0);
@ -59,11 +59,11 @@
d_map_base_freq_band_2[0] = d_shift_out_bits_freq_band_2; d_map_base_freq_band_2[0] = d_shift_out_bits_freq_band_2;
} }
DLOG(INFO) << "Dynamic bit selection FPGA class created"; DLOG(INFO) << "Dynamic bit selection FPGA class created";
} }
Fpga_dynamic_bit_selection::~Fpga_dynamic_bit_selection() Fpga_dynamic_bit_selection::~Fpga_dynamic_bit_selection()
{ {
if (d_enable_rx1_band) if (d_enable_rx1_band)
{ {
close_device(d_map_base_freq_band_1, d_dev_descr_freq_band_1); close_device(d_map_base_freq_band_1, d_dev_descr_freq_band_1);
@ -72,11 +72,11 @@
{ {
close_device(d_map_base_freq_band_2, d_dev_descr_freq_band_2); close_device(d_map_base_freq_band_2, d_dev_descr_freq_band_2);
} }
} }
void Fpga_dynamic_bit_selection::bit_selection() void Fpga_dynamic_bit_selection::bit_selection()
{ {
if (d_enable_rx1_band) if (d_enable_rx1_band)
{ {
bit_selection_per_rf_band(d_map_base_freq_band_1, d_shift_out_bits_freq_band_1); bit_selection_per_rf_band(d_map_base_freq_band_1, d_shift_out_bits_freq_band_1);
@ -86,11 +86,11 @@
{ {
bit_selection_per_rf_band(d_map_base_freq_band_2, d_shift_out_bits_freq_band_2); bit_selection_per_rf_band(d_map_base_freq_band_2, d_shift_out_bits_freq_band_2);
} }
} }
void Fpga_dynamic_bit_selection::open_device(volatile unsigned **d_map_base, int &d_dev_descr, int freq_band) void Fpga_dynamic_bit_selection::open_device(volatile unsigned **d_map_base, int &d_dev_descr, int freq_band)
{ {
// find the uio device file corresponding to the dynamic bit selector 0 module. // find the uio device file corresponding to the dynamic bit selector 0 module.
std::string device_name; std::string device_name;
if (find_uio_dev_file_name(device_name, dyn_bit_sel_device_name, freq_band) < 0) if (find_uio_dev_file_name(device_name, dyn_bit_sel_device_name, freq_band) < 0)
@ -113,11 +113,11 @@
LOG(WARNING) << "Cannot map the FPGA dynamic bit selection module in frequency band 1 into tracking memory"; LOG(WARNING) << "Cannot map the FPGA dynamic bit selection module in frequency band 1 into tracking memory";
std::cout << "Could not map dynamic bit selection memory corresponding to frequency band 1.\n"; std::cout << "Could not map dynamic bit selection memory corresponding to frequency band 1.\n";
} }
} }
void Fpga_dynamic_bit_selection::bit_selection_per_rf_band(volatile unsigned *d_map_base, uint32_t shift_out_bits) void Fpga_dynamic_bit_selection::bit_selection_per_rf_band(volatile unsigned *d_map_base, uint32_t shift_out_bits)
{ {
// estimated signal power // estimated signal power
uint32_t rx_signal_power = d_map_base[1]; uint32_t rx_signal_power = d_map_base[1];
@ -139,15 +139,15 @@
// update bit selection corresponding to frequency band 1 // update bit selection corresponding to frequency band 1
d_map_base[0] = shift_out_bits; d_map_base[0] = shift_out_bits;
} }
void Fpga_dynamic_bit_selection::close_device(volatile unsigned *d_map_base, int &d_dev_descr) void Fpga_dynamic_bit_selection::close_device(volatile unsigned *d_map_base, int &d_dev_descr)
{ {
auto *aux = const_cast<unsigned *>(d_map_base); auto *aux = const_cast<unsigned *>(d_map_base);
if (munmap(static_cast<void *>(aux), FPGA_PAGE_SIZE) == -1) if (munmap(static_cast<void *>(aux), FPGA_PAGE_SIZE) == -1)
{ {
std::cout << "Failed to unmap memory uio\n"; std::cout << "Failed to unmap memory uio\n";
} }
close(d_dev_descr); close(d_dev_descr);
} }