mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-11-04 01:03:04 +00:00 
			
		
		
		
	Remove delete in FPGA adapters
This commit is contained in:
		@@ -108,12 +108,12 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // compute all the GALILEO E1 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time
 | 
					    // compute all the GALILEO E1 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time
 | 
				
			||||||
    // a channel is assigned)
 | 
					    // a channel is assigned)
 | 
				
			||||||
    auto* fft_if = new gr::fft::fft_complex(nsamples_total, true);  // Direct FFT
 | 
					    auto fft_if = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true));  // Direct FFT
 | 
				
			||||||
    //auto code = std::make_shared<std::complex<float>>(nsamples_total);  // buffer for the local code
 | 
					    std::vector<std::complex<float>> code(nsamples_total);                                                // buffer for the local code
 | 
				
			||||||
    std::vector<std::complex<float>> code(nsamples_total);
 | 
					 | 
				
			||||||
    auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
 | 
					    auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
 | 
				
			||||||
    d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * GALILEO_E1_NUMBER_OF_CODES);  // memory containing all the possible fft codes for PRN 0 to 32
 | 
					    d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * GALILEO_E1_NUMBER_OF_CODES);  // memory containing all the possible fft codes for PRN 0 to 32
 | 
				
			||||||
    float max;                                                                              // temporary maxima search
 | 
					
 | 
				
			||||||
 | 
					    float max;  // temporary maxima search
 | 
				
			||||||
    int32_t tmp, tmp2, local_code, fft_data;
 | 
					    int32_t tmp, tmp2, local_code, fft_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (uint32_t PRN = 1; PRN <= GALILEO_E1_NUMBER_OF_CODES; PRN++)
 | 
					    for (uint32_t PRN = 1; PRN <= GALILEO_E1_NUMBER_OF_CODES; PRN++)
 | 
				
			||||||
@@ -189,8 +189,7 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
 | 
				
			|||||||
    doppler_step_ = 0;
 | 
					    doppler_step_ = 0;
 | 
				
			||||||
    gnss_synchro_ = nullptr;
 | 
					    gnss_synchro_ = nullptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // temporary buffers that we can delete
 | 
					    // temporary buffers that we can release
 | 
				
			||||||
    delete fft_if;
 | 
					 | 
				
			||||||
    volk_gnsssdr_free(fft_codes_padded);
 | 
					    volk_gnsssdr_free(fft_codes_padded);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -109,8 +109,8 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // compute all the GALILEO E5 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time
 | 
					    // compute all the GALILEO E5 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time
 | 
				
			||||||
    // a channel is assigned)
 | 
					    // a channel is assigned)
 | 
				
			||||||
    auto* fft_if = new gr::fft::fft_complex(nsamples_total, true);  // Direct FFT
 | 
					    auto fft_if = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true));  // Direct FFT
 | 
				
			||||||
    std::vector<std::complex<float>> code(nsamples_total);          // buffer for the local code
 | 
					    std::vector<std::complex<float>> code(nsamples_total);                                                // buffer for the local code
 | 
				
			||||||
    auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
 | 
					    auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
 | 
				
			||||||
    d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * GALILEO_E5A_NUMBER_OF_CODES);  // memory containing all the possible fft codes for PRN 0 to 32
 | 
					    d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * GALILEO_E5A_NUMBER_OF_CODES);  // memory containing all the possible fft codes for PRN 0 to 32
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -192,8 +192,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
 | 
				
			|||||||
    doppler_step_ = 0;
 | 
					    doppler_step_ = 0;
 | 
				
			||||||
    gnss_synchro_ = nullptr;
 | 
					    gnss_synchro_ = nullptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // temporary buffers that we can delete
 | 
					    // temporary buffers that we can release
 | 
				
			||||||
    delete fft_if;
 | 
					 | 
				
			||||||
    volk_gnsssdr_free(fft_codes_padded);
 | 
					    volk_gnsssdr_free(fft_codes_padded);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -103,7 +103,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // compute all the GPS L1 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
 | 
					    // compute all the GPS L1 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
 | 
				
			||||||
    // a channel is assigned)
 | 
					    // a channel is assigned)
 | 
				
			||||||
    auto* fft_if = new gr::fft::fft_complex(nsamples_total, true);  // Direct FFT
 | 
					    auto fft_if = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true));
 | 
				
			||||||
    // allocate memory to compute all the PRNs and compute all the possible codes
 | 
					    // allocate memory to compute all the PRNs and compute all the possible codes
 | 
				
			||||||
    std::vector<std::complex<float>> code(nsamples_total);  // buffer for the local code
 | 
					    std::vector<std::complex<float>> code(nsamples_total);  // buffer for the local code
 | 
				
			||||||
    auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
 | 
					    auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
 | 
				
			||||||
@@ -154,7 +154,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //acq_parameters
 | 
					    // acq_parameters
 | 
				
			||||||
    acq_parameters.all_fft_codes = d_all_fft_codes_.data();
 | 
					    acq_parameters.all_fft_codes = d_all_fft_codes_.data();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // reference for the FPGA FFT-IFFT attenuation factor
 | 
					    // reference for the FPGA FFT-IFFT attenuation factor
 | 
				
			||||||
@@ -170,8 +170,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
 | 
				
			|||||||
    doppler_step_ = 0;
 | 
					    doppler_step_ = 0;
 | 
				
			||||||
    gnss_synchro_ = nullptr;
 | 
					    gnss_synchro_ = nullptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // temporary buffers that we can delete
 | 
					    // temporary buffers that we can release
 | 
				
			||||||
    delete fft_if;
 | 
					 | 
				
			||||||
    volk_gnsssdr_free(fft_codes_padded);
 | 
					    volk_gnsssdr_free(fft_codes_padded);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -102,12 +102,13 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // compute all the GPS L2C PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
 | 
					    // compute all the GPS L2C PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
 | 
				
			||||||
    // a channel is assigned)
 | 
					    // a channel is assigned)
 | 
				
			||||||
    auto* fft_if = new gr::fft::fft_complex(vector_length, true);  // Direct FFT
 | 
					    auto fft_if = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true));  // Direct FFT
 | 
				
			||||||
    // allocate memory to compute all the PRNs and compute all the possible codes
 | 
					    // allocate memory to compute all the PRNs and compute all the possible codes
 | 
				
			||||||
    std::vector<std::complex<float>> code(nsamples_total);  // buffer for the local code
 | 
					    std::vector<std::complex<float>> code(nsamples_total);  // buffer for the local code
 | 
				
			||||||
    auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
 | 
					    auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
 | 
				
			||||||
    d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * NUM_PRNs);  // memory containing all the possible fft codes for PRN 0 to 32
 | 
					    d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * NUM_PRNs);  // memory containing all the possible fft codes for PRN 0 to 32
 | 
				
			||||||
    float max;                                                            // temporary maxima search
 | 
					
 | 
				
			||||||
 | 
					    float max;  // temporary maxima search
 | 
				
			||||||
    int32_t tmp, tmp2, local_code, fft_data;
 | 
					    int32_t tmp, tmp2, local_code, fft_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++)
 | 
					    for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++)
 | 
				
			||||||
@@ -150,10 +151,6 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    acq_parameters.all_fft_codes = d_all_fft_codes_.data();
 | 
					    acq_parameters.all_fft_codes = d_all_fft_codes_.data();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // temporary buffers that we can delete
 | 
					 | 
				
			||||||
    delete fft_if;
 | 
					 | 
				
			||||||
    volk_gnsssdr_free(fft_codes_padded);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);
 | 
					    acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    channel_ = 0;
 | 
					    channel_ = 0;
 | 
				
			||||||
@@ -161,6 +158,9 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga(
 | 
				
			|||||||
    gnss_synchro_ = nullptr;
 | 
					    gnss_synchro_ = nullptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    threshold_ = 0.0;
 | 
					    threshold_ = 0.0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // temporary buffers that we can release
 | 
				
			||||||
 | 
					    volk_gnsssdr_free(fft_codes_padded);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -108,7 +108,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // compute all the GPS L5 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
 | 
					    // compute all the GPS L5 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
 | 
				
			||||||
    // a channel is assigned)
 | 
					    // a channel is assigned)
 | 
				
			||||||
    auto* fft_if = new gr::fft::fft_complex(nsamples_total, true);  // Direct FFT
 | 
					    auto fft_if = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true));  // Direct FFT
 | 
				
			||||||
    std::vector<std::complex<float>> code(nsamples_total);
 | 
					    std::vector<std::complex<float>> code(nsamples_total);
 | 
				
			||||||
    auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
 | 
					    auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
 | 
				
			||||||
    d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * NUM_PRNs);  // memory containing all the possible fft codes for PRN 0 to 32
 | 
					    d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * NUM_PRNs);  // memory containing all the possible fft codes for PRN 0 to 32
 | 
				
			||||||
@@ -173,8 +173,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
 | 
				
			|||||||
    doppler_step_ = 0;
 | 
					    doppler_step_ = 0;
 | 
				
			||||||
    gnss_synchro_ = nullptr;
 | 
					    gnss_synchro_ = nullptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // temporary buffers that we can delete
 | 
					    // temporary buffers that we can release
 | 
				
			||||||
    delete fft_if;
 | 
					 | 
				
			||||||
    volk_gnsssdr_free(fft_codes_padded);
 | 
					    volk_gnsssdr_free(fft_codes_padded);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user