mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-23 19:47:40 +00:00
Decouple the FPGA DMA signal source from the AD9361 FPGA signal source.
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "fpga_buffer_monitor.h"
|
||||
#include "gnss_sdr_create_directory.h"
|
||||
#include "gnss_sdr_filesystem.h"
|
||||
#include "uio_fpga.h"
|
||||
#include <ctime> // for time, localtime
|
||||
#include <fcntl.h> // for open, O_RDWR, O_SYNC
|
||||
#include <fstream> // for string, ofstream
|
||||
@@ -40,7 +41,16 @@
|
||||
#endif
|
||||
|
||||
|
||||
Fpga_buffer_monitor::Fpga_buffer_monitor(const std::string &device_name,
|
||||
//Fpga_buffer_monitor::Fpga_buffer_monitor(const std::string &device_name,
|
||||
// uint32_t num_freq_bands,
|
||||
// bool dump,
|
||||
// std::string dump_filename)
|
||||
// : d_dump_filename(std::move(dump_filename)),
|
||||
// d_num_freq_bands(num_freq_bands),
|
||||
// d_max_buff_occ_freq_band_0(0),
|
||||
// d_max_buff_occ_freq_band_1(0),
|
||||
// d_dump(dump)
|
||||
Fpga_buffer_monitor::Fpga_buffer_monitor(
|
||||
uint32_t num_freq_bands,
|
||||
bool dump,
|
||||
std::string dump_filename)
|
||||
@@ -50,10 +60,19 @@ Fpga_buffer_monitor::Fpga_buffer_monitor(const std::string &device_name,
|
||||
d_max_buff_occ_freq_band_1(0),
|
||||
d_dump(dump)
|
||||
{
|
||||
// open device descriptor
|
||||
if ((d_device_descriptor = open(device_name.c_str(), O_RDWR | O_SYNC)) == -1)
|
||||
std::string device_io_name;
|
||||
|
||||
// find the uio device file corresponding to the buffer monitor
|
||||
if (find_uio_dev_file_name(device_io_name, BUFFER_MONITOR_DEVICE_NAME, 0) < 0)
|
||||
{
|
||||
LOG(WARNING) << "Cannot open deviceio" << device_name;
|
||||
std::cerr << "Cannot find the FPGA uio device file corresponding to device name " << BUFFER_MONITOR_DEVICE_NAME << '\n';
|
||||
return;
|
||||
}
|
||||
|
||||
// open device descriptor
|
||||
if ((d_device_descriptor = open(device_io_name.c_str(), O_RDWR | O_SYNC)) == -1)
|
||||
{
|
||||
LOG(WARNING) << "Cannot open deviceio" << device_io_name;
|
||||
}
|
||||
|
||||
// device memory map
|
||||
|
@@ -45,10 +45,13 @@ public:
|
||||
/*!
|
||||
* \brief Constructor
|
||||
*/
|
||||
explicit Fpga_buffer_monitor(const std::string& device_name,
|
||||
uint32_t num_freq_bands,
|
||||
explicit Fpga_buffer_monitor(uint32_t num_freq_bands,
|
||||
bool dump,
|
||||
std::string dump_filename);
|
||||
// explicit Fpga_buffer_monitor(const std::string& device_name,
|
||||
// uint32_t num_freq_bands,
|
||||
// bool dump,
|
||||
// std::string dump_filename);
|
||||
|
||||
/*!
|
||||
* \brief Destructor
|
||||
@@ -61,6 +64,7 @@ public:
|
||||
void check_buffer_overflow_and_monitor_buffer_status();
|
||||
|
||||
private:
|
||||
const std::string BUFFER_MONITOR_DEVICE_NAME = std::string("buffer_monitor"); // buffer monitor device name
|
||||
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;
|
||||
|
@@ -56,7 +56,6 @@ public:
|
||||
void bit_selection(void);
|
||||
|
||||
private:
|
||||
const std::string switch_device_name = std::string("AXIS_Switch_v1_0_0"); // Switch UIO device name
|
||||
const std::string dyn_bit_sel_device_name = std::string("dynamic_bits_selector"); // Switch dhnamic bit selector device name
|
||||
static const size_t FPGA_PAGE_SIZE = 0x1000;
|
||||
static const uint32_t Num_bits_ADC = 12; // Number of bits in the ADC
|
||||
|
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#include "fpga_switch.h"
|
||||
#include "uio_fpga.h"
|
||||
#include <fcntl.h> // for open, O_RDWR, O_SYNC
|
||||
#include <iostream> // for cout
|
||||
#include <sys/mman.h> // for mmap
|
||||
@@ -32,11 +33,19 @@
|
||||
#include <absl/log/log.h>
|
||||
#endif
|
||||
|
||||
Fpga_Switch::Fpga_Switch(const std::string &device_name)
|
||||
Fpga_Switch::Fpga_Switch(void)
|
||||
{
|
||||
if ((d_device_descriptor = open(device_name.c_str(), O_RDWR | O_SYNC)) == -1)
|
||||
std::string device_io_name; // Switch UIO device file
|
||||
// find the uio device file corresponding to the switch.
|
||||
if (find_uio_dev_file_name(device_io_name, SWITCH_DEVICE_NAME, 0) < 0)
|
||||
{
|
||||
LOG(WARNING) << "Cannot open deviceio" << device_name;
|
||||
std::cerr << "Cannot find the FPGA uio device file corresponding to device name " << SWITCH_DEVICE_NAME << '\n';
|
||||
return;
|
||||
}
|
||||
|
||||
if ((d_device_descriptor = open(device_io_name.c_str(), O_RDWR | O_SYNC)) == -1)
|
||||
{
|
||||
LOG(WARNING) << "Cannot open deviceio" << device_io_name;
|
||||
}
|
||||
d_map_base = reinterpret_cast<volatile unsigned *>(mmap(nullptr, FPGA_PAGE_SIZE,
|
||||
PROT_READ | PROT_WRITE, MAP_SHARED, d_device_descriptor, 0));
|
||||
|
@@ -42,8 +42,7 @@ public:
|
||||
/*!
|
||||
* \brief Constructor
|
||||
*/
|
||||
explicit Fpga_Switch(const std::string& device_name);
|
||||
|
||||
explicit Fpga_Switch(void);
|
||||
/*!
|
||||
* \brief Destructor
|
||||
*/
|
||||
@@ -55,6 +54,7 @@ public:
|
||||
void set_switch_position(int32_t switch_position);
|
||||
|
||||
private:
|
||||
const std::string SWITCH_DEVICE_NAME = std::string("AXIS_Switch_v1_0_0"); // Switch UIO device name
|
||||
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;
|
||||
|
Reference in New Issue
Block a user