From 337c9c7d1f9168bc3625166a172bc572be682e6f Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Tue, 19 Apr 2022 15:53:00 +0200 Subject: [PATCH] set the FPGA page size to 0x1000 for compatibility with the FPGA IP cores compiled for the ZynqMP --- src/algorithms/acquisition/libs/fpga_acquisition.cc | 4 ++-- src/algorithms/acquisition/libs/fpga_acquisition.h | 2 +- src/algorithms/signal_source/libs/fpga_buffer_monitor.h | 2 +- .../signal_source/libs/fpga_dynamic_bit_selection.h | 2 +- src/algorithms/signal_source/libs/fpga_switch.h | 2 +- src/algorithms/tracking/libs/fpga_multicorrelator.cc | 4 ++-- src/algorithms/tracking/libs/fpga_multicorrelator.h | 2 +- src/core/libs/gnss_sdr_fpga_sample_counter.cc | 4 ++-- src/core/libs/gnss_sdr_fpga_sample_counter.h | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/algorithms/acquisition/libs/fpga_acquisition.cc b/src/algorithms/acquisition/libs/fpga_acquisition.cc index bc58eebfa..667533c08 100644 --- a/src/algorithms/acquisition/libs/fpga_acquisition.cc +++ b/src/algorithms/acquisition/libs/fpga_acquisition.cc @@ -101,7 +101,7 @@ void Fpga_Acquisition::open_device() LOG(WARNING) << "Cannot open deviceio" << d_device_name; std::cout << "Acq: cannot open deviceio" << d_device_name << '\n'; } - d_map_base = reinterpret_cast(mmap(nullptr, PAGE_SIZE_DEFAULT, + d_map_base = reinterpret_cast(mmap(nullptr, FPGA_PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, d_fd, 0)); if (d_map_base == reinterpret_cast(-1)) @@ -227,7 +227,7 @@ void Fpga_Acquisition::read_acquisition_results(uint32_t *max_index, void Fpga_Acquisition::close_device() { auto *aux = const_cast(d_map_base); - if (munmap(static_cast(aux), PAGE_SIZE_DEFAULT) == -1) + if (munmap(static_cast(aux), FPGA_PAGE_SIZE) == -1) { std::cout << "Failed to unmap memory uio\n"; } diff --git a/src/algorithms/acquisition/libs/fpga_acquisition.h b/src/algorithms/acquisition/libs/fpga_acquisition.h index d9d2b31ba..5a0b633f9 100644 --- a/src/algorithms/acquisition/libs/fpga_acquisition.h +++ b/src/algorithms/acquisition/libs/fpga_acquisition.h @@ -142,7 +142,7 @@ public: private: // FPGA register parameters - static const uint32_t PAGE_SIZE_DEFAULT = 0x10000; // default page size for the multicorrelator memory map + static const uint32_t FPGA_PAGE_SIZE = 0x1000; // default page size for the multicorrelator memory map static const uint32_t LAUNCH_ACQUISITION = 1; // command to launch the acquisition process static const uint32_t RESET_ACQUISITION = 2; // command to reset the acquisition and the FPGA Modules static const uint32_t STOP_ACQUISITION = 4; // command to stop the acquisition and the FPGA modules diff --git a/src/algorithms/signal_source/libs/fpga_buffer_monitor.h b/src/algorithms/signal_source/libs/fpga_buffer_monitor.h index a58aa6c31..00b413e30 100644 --- a/src/algorithms/signal_source/libs/fpga_buffer_monitor.h +++ b/src/algorithms/signal_source/libs/fpga_buffer_monitor.h @@ -61,7 +61,7 @@ public: void check_buffer_overflow_and_monitor_buffer_status(); private: - static const size_t FPGA_PAGE_SIZE = 0x10000; + static const size_t FPGA_PAGE_SIZE = 0x1000; static const uint32_t test_register_writeval = 0x55AA; static const uint32_t num_sapmples_per_buffer_element = 2; // write addresses diff --git a/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.h b/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.h index 90109e5d1..500bb182e 100644 --- a/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.h +++ b/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.h @@ -56,7 +56,7 @@ public: void bit_selection(void); private: - static const size_t FPGA_PAGE_SIZE = 0x10000; + static const size_t FPGA_PAGE_SIZE = 0x1000; static const uint32_t Num_bits_ADC = 12; // Number of bits in the ADC static const uint32_t Num_bits_FPGA = 4; // Number of bits after the bit selection diff --git a/src/algorithms/signal_source/libs/fpga_switch.h b/src/algorithms/signal_source/libs/fpga_switch.h index b89442471..3595cf9ce 100644 --- a/src/algorithms/signal_source/libs/fpga_switch.h +++ b/src/algorithms/signal_source/libs/fpga_switch.h @@ -54,7 +54,7 @@ public: void set_switch_position(int32_t switch_position); private: - static const size_t FPGA_PAGE_SIZE = 0x10000; + static const size_t FPGA_PAGE_SIZE = 0x1000; static const uint32_t TEST_REGISTER_TRACK_WRITEVAL = 0x55AA; static const uint32_t MAX_LENGTH_DEVICEIO_NAME = 50; diff --git a/src/algorithms/tracking/libs/fpga_multicorrelator.cc b/src/algorithms/tracking/libs/fpga_multicorrelator.cc index 94825cbb1..0269ed25d 100644 --- a/src/algorithms/tracking/libs/fpga_multicorrelator.cc +++ b/src/algorithms/tracking/libs/fpga_multicorrelator.cc @@ -197,7 +197,7 @@ void Fpga_Multicorrelator_8sc::open_channel(const std::string &device_io_name, u LOG(WARNING) << "Cannot open deviceio" << device_io_name; std::cout << "Cannot open deviceio" << device_io_name << '\n'; } - d_map_base = reinterpret_cast(mmap(nullptr, page_size, + d_map_base = reinterpret_cast(mmap(nullptr, FPGA_PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, d_device_descriptor, 0)); if (d_map_base == reinterpret_cast(-1)) @@ -402,7 +402,7 @@ void Fpga_Multicorrelator_8sc::unlock_channel() void Fpga_Multicorrelator_8sc::close_device() { auto *aux = const_cast(d_map_base); - if (munmap(static_cast(aux), page_size) == -1) + if (munmap(static_cast(aux), FPGA_PAGE_SIZE) == -1) { std::cout << "Failed to unmap memory uio\n"; } diff --git a/src/algorithms/tracking/libs/fpga_multicorrelator.h b/src/algorithms/tracking/libs/fpga_multicorrelator.h index 19a8a3859..4d8257201 100644 --- a/src/algorithms/tracking/libs/fpga_multicorrelator.h +++ b/src/algorithms/tracking/libs/fpga_multicorrelator.h @@ -186,7 +186,7 @@ private: static const uint32_t drop_samples = 1; // bit 0 of drop_samples_reg_addr static const uint32_t enable_secondary_code = 2; // bit 1 of drop_samples_reg_addr static const uint32_t init_secondary_code_addresses = 4; // bit 2 of drop_samples_reg_addr - static const uint32_t page_size = 0x10000; + static const uint32_t FPGA_PAGE_SIZE = 0x1000; static const uint32_t max_code_resampler_counter = 1 << 31; // 2^(number of bits of precision of the code resampler) static const uint32_t local_code_fpga_clear_address_counter = 0x10000000; static const uint32_t test_register_track_writeval = 0x55AA; diff --git a/src/core/libs/gnss_sdr_fpga_sample_counter.cc b/src/core/libs/gnss_sdr_fpga_sample_counter.cc index a36540e92..a54fd6270 100644 --- a/src/core/libs/gnss_sdr_fpga_sample_counter.cc +++ b/src/core/libs/gnss_sdr_fpga_sample_counter.cc @@ -146,7 +146,7 @@ void gnss_sdr_fpga_sample_counter::open_device() LOG(WARNING) << "Cannot open deviceio" << device_io_name; std::cout << "Counter-Intr: cannot open deviceio" << device_io_name << '\n'; } - map_base = reinterpret_cast(mmap(nullptr, page_size, + map_base = reinterpret_cast(mmap(nullptr, FPGA_PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)); if (map_base == reinterpret_cast(-1)) @@ -176,7 +176,7 @@ void gnss_sdr_fpga_sample_counter::close_device() map_base[2] = 0; // disable the generation of the interrupt in the device auto *aux = const_cast(map_base); - if (munmap(static_cast(aux), page_size) == -1) + if (munmap(static_cast(aux), FPGA_PAGE_SIZE) == -1) { std::cout << "Failed to unmap memory uio\n"; } diff --git a/src/core/libs/gnss_sdr_fpga_sample_counter.h b/src/core/libs/gnss_sdr_fpga_sample_counter.h index 5ace34391..984e1e5b8 100644 --- a/src/core/libs/gnss_sdr_fpga_sample_counter.h +++ b/src/core/libs/gnss_sdr_fpga_sample_counter.h @@ -49,7 +49,7 @@ public: private: const std::string device_name = "counter"; // UIO device name - static const uint32_t page_size = 0x10000; // default page size for the multicorrelator memory map + static const uint32_t FPGA_PAGE_SIZE = 0x1000; // default page size for the multicorrelator memory map static const uint32_t test_reg_sanity_check = 0x55AA; // value to check the presence of the test register (to detect the hw) friend gnss_sdr_fpga_sample_counter_sptr gnss_sdr_make_fpga_sample_counter(double _fs, int32_t _interval_ms);