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

added the enable_DMA_ flag, which is used to stop the DMA when the user quits gnss-sdr, and the receiver is using the FPGA and the receiver is working in post-processing mode.

This commit is contained in:
Marc Majoral 2019-10-01 22:26:30 +02:00
parent d379a3ed6c
commit b932c5ef98
2 changed files with 10 additions and 4 deletions

View File

@ -47,7 +47,7 @@
#include <vector>
void run_DMA_process(const std::string &FreqBand, const std::string &Filename1, const std::string &Filename2)
void run_DMA_process(const std::string &FreqBand, const std::string &Filename1, const std::string &Filename2, const bool &enable_DMA)
{
const int MAX_INPUT_SAMPLES_TOTAL = 8192;
int max_value = 0;
@ -101,7 +101,7 @@ void run_DMA_process(const std::string &FreqBand, const std::string &Filename1,
//**************************************************************************
int nsamples = 0;
while (file_completed == 0)
while ((file_completed == 0) && (enable_DMA == true))
{
unsigned int dma_index = 0;
@ -318,6 +318,7 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface *configura
if (switch_position == 0) // Inject file(s) via DMA
{
enable_DMA_ = true;
std::string empty_string;
filename_rx1 = configuration->property(role + ".filename_rx1", empty_string);
filename_rx2 = configuration->property(role + ".filename_rx2", empty_string);
@ -344,7 +345,7 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface *configura
freq_band = "L1L2";
}
thread_file_to_dma = std::thread([&] { run_DMA_process(freq_band, filename_rx1, filename_rx2); });
thread_file_to_dma = std::thread([&] { run_DMA_process(freq_band, filename_rx1, filename_rx2, enable_DMA_); });
}
if (switch_position == 2) // Real-time via AD9361
{
@ -387,10 +388,13 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface *configura
Ad9361FpgaSignalSource::~Ad9361FpgaSignalSource()
{
/* cleanup and exit */
// std::cout<<"* AD9361 Disabling streaming channels\n";
// std::cout<<"* AD9361 Disabling streaming channels\n";
// if (rx0_i) { iio_channel_disable(rx0_i); }
// if (rx0_q) { iio_channel_disable(rx0_q); }
enable_DMA_ = false; // disable the DMA
if (enable_dds_lo_)
{
try

View File

@ -122,6 +122,8 @@ private:
std::string filename_rx1;
std::string filename_rx2;
std::string freq_band;
bool enable_DMA_;
};
#endif // GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H_