1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 20:50:33 +00:00

minor modifications to the Galileo E5a and GPS L5 acquisition adapters. Now the acquisition opens and closes the acquisition HW device every time an acquisition is done, to prevent the acquisition interrupt from interrupting all the acquisition processes at the same time.

This commit is contained in:
Marc Majoral 2018-12-05 11:23:30 +01:00
parent bd90563925
commit e436aadfd9
5 changed files with 84 additions and 30 deletions

View File

@ -115,6 +115,9 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
acq_parameters.samples_per_ms = nsamples_total / sampled_ms;
acq_parameters.samples_per_code = nsamples_total;
acq_parameters.excludelimit = static_cast<unsigned int>(ceil((1.0 / Galileo_E5a_CODE_CHIP_RATE_HZ) * static_cast<float>(acq_parameters.fs_in)));
//vector_length_ = code_length_ * sampled_ms_;
// compute all the GALILEO E5 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
@ -128,7 +131,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
//printf("creating the E5A acquisition CONT");
//printf("nsamples_total = %d\n", nsamples_total);
printf("number of codes = %d\n", Galileo_E5a_NUMBER_OF_CODES);
//printf("number of codes = %d\n", Galileo_E5a_NUMBER_OF_CODES);
for (unsigned int PRN = 1; PRN <= Galileo_E5a_NUMBER_OF_CODES; PRN++)
{

View File

@ -112,7 +112,8 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
acq_parameters.samples_per_ms = nsamples_total/sampled_ms;
acq_parameters.samples_per_code = nsamples_total;
acq_parameters.excludelimit = static_cast<unsigned int>(std::round(static_cast<double>(fs_in) / GPS_L5i_CODE_RATE_HZ));
//acq_parameters.excludelimit = static_cast<unsigned int>(std::round(static_cast<double>(fs_in) / GPS_L5i_CODE_RATE_HZ));
acq_parameters.excludelimit = static_cast<unsigned int>(ceil((1.0 / GPS_L5i_CODE_RATE_HZ) * static_cast<float>(acq_parameters.fs_in)));
//printf("L5 ACQ CLASS MID 01\n");
// 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

View File

@ -315,17 +315,38 @@ void pcps_acquisition_fpga::set_active(bool active)
//read_acquisition_results(&indext, &firstpeak, &secondpeak, &initial_sample, &d_input_power, &d_doppler_index);
//printf("reading results for channel %d\n", (int) d_channel);
acquisition_fpga->read_acquisition_results(&indext, &firstpeak, &secondpeak, &initial_sample, &d_input_power, &d_doppler_index, &total_block_exp);
//printf("returned d_doppler_index = %d\n", d_doppler_index);
//printf("gnuradio block : d_total_block_exp = %d total_block_exp = %d\n", (int) d_total_block_exp, (int) total_block_exp);
//printf("d_fft_size = %d = %d\n", d_fft_size, acq_parameters.samples_per_code);
//printf("indext = %d\n", (int) indext);
//printf("initial_sample = %d\n", (int) initial_sample);
//printf("firstpeak = %d\n", (int) firstpeak);
//printf("secondpeak = %d\n", (int) secondpeak);
//printf("total_block_exp = %d\n", (int) total_block_exp);
// if (total_block_exp == 11)
// {
// printf("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n");
// getchar();
//
// }
// if (total_block_exp > d_total_block_exp)
// {
// usleep(5000000);
// acquisition_fpga->read_acquisition_results(&indext, &firstpeak, &secondpeak, &initial_sample, &d_input_power, &d_doppler_index, &total_block_exp);
// printf("second time d_fft_size = %d = %d", d_fft_size, acq_parameters.samples_per_code);
// printf("second time indext = %d\n", (int) indext);
// printf("second time initial_sample = %d\n", (int) initial_sample);
// printf("second time firstpeak = %d\n", (int) firstpeak);
// printf("second time secondpeak = %d\n", (int) secondpeak);
// printf("second time total_block_exp = %d\n", (int) total_block_exp);
// }
if (total_block_exp > d_total_block_exp)
{
@ -336,14 +357,7 @@ void pcps_acquisition_fpga::set_active(bool active)
}
// // debug
// if (acq_parameters.code_length == 12500)
// {
// doppler = 0;
// d_test_statistics = 0;
// }
// else
// {
//printf("end channel %d -----------------------------------------------------\n", (int) d_channel);
//printf("READ ACQ RESULTS\n");
@ -359,6 +373,8 @@ void pcps_acquisition_fpga::set_active(bool active)
// NEW SATELLITE DETECTION ALGORITHM STARTS HERE ----------------------------------------------------
if (d_single_doppler_flag == false)
{
doppler = -static_cast<int32_t>(acq_parameters.doppler_max) + d_doppler_step * (d_doppler_index - 1);
@ -379,7 +395,7 @@ void pcps_acquisition_fpga::set_active(bool active)
}
// } // debug condition
// // OLD SATELLITE DETECTION ALGORITHM STARTS HERE ----------------------------------------------------
//
@ -419,8 +435,10 @@ void pcps_acquisition_fpga::set_active(bool active)
{
if (d_downsampling_factor > 1)
{
//printf("yes here\n");
d_gnss_synchro->Acq_delay_samples = static_cast<double>(d_downsampling_factor*(indext % acq_parameters.samples_per_code));
//d_gnss_synchro->Acq_delay_samples = static_cast<double>(d_downsampling_factor*(indext % acq_parameters.samples_per_code));
d_gnss_synchro->Acq_delay_samples = static_cast<double>(d_downsampling_factor*(indext));
//d_gnss_synchro->Acq_samplestamp_samples = d_downsampling_factor*d_sample_counter - 81*0.25*d_downsampling_factor; // delay due to the downsampling filter in the acquisition
d_gnss_synchro->Acq_samplestamp_samples = d_downsampling_factor*d_sample_counter - 44; //33; //41; //+ 81*0.5; // delay due to the downsampling filter in the acquisition
//d_gnss_synchro->Acq_samplestamp_samples = d_downsampling_factor*d_sample_counter - 81/d_downsampling_factor; // delay due to the downsampling filter in the acquisition
@ -434,7 +452,8 @@ void pcps_acquisition_fpga::set_active(bool active)
else
{
//printf("xxxxxxxxxxxxxxxx no here\n");
d_gnss_synchro->Acq_delay_samples = static_cast<double>(indext % acq_parameters.samples_per_code);
//d_gnss_synchro->Acq_delay_samples = static_cast<double>(indext % acq_parameters.samples_per_code);
d_gnss_synchro->Acq_delay_samples = static_cast<double>(indext);
d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter; // delay due to the downsampling filter in the acquisition
//d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter - 40; // delay due to the downsampling filter in the acquisition
//d_gnss_synchro->Acq_samplestamp_samples = d_downsampling_factor*d_sample_counter - 81*0.5*d_downsampling_factor;
@ -442,7 +461,8 @@ void pcps_acquisition_fpga::set_active(bool active)
}
else
{
d_gnss_synchro->Acq_delay_samples = static_cast<double>(indext % acq_parameters.samples_per_code);
//d_gnss_synchro->Acq_delay_samples = static_cast<double>(indext % acq_parameters.samples_per_code);
d_gnss_synchro->Acq_delay_samples = static_cast<double>(indext);
d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter; // delay due to the downsampling filter in the acquisition
}
@ -491,10 +511,11 @@ void pcps_acquisition_fpga::set_active(bool active)
send_positive_acquisition();
d_state = 0; // Positive acquisition
//printf("acq d_gnss_synchro->Acq_delay_samples = %f\n: ",d_gnss_synchro->Acq_delay_samples);
//printf("acq d_gnss_synchro->Acq_samplestamp_samples = %d\n", (unsigned int) d_gnss_synchro->Acq_samplestamp_samples);
//printf("acq d_gnss_synchro->Acq_doppler_hz = %f\n", d_gnss_synchro->Acq_doppler_hz);
//printf("acq d_gnss_synchro->PRN = %d\n", (int) d_gnss_synchro->PRN);
//printf("acq POSITIVE ACQ d_fft_size = %d = %d\n", d_fft_size, acq_parameters.samples_per_code);
//printf("acq POSITIVE ACQ d_gnss_synchro->Acq_delay_samples = %f\n: ",d_gnss_synchro->Acq_delay_samples);
//printf("acq POSITIVE ACQ d_gnss_synchro->Acq_samplestamp_samples = %d\n", (unsigned int) d_gnss_synchro->Acq_samplestamp_samples);
//printf("acq POSITIVE ACQ d_gnss_synchro->Acq_doppler_hz = %f\n", d_gnss_synchro->Acq_doppler_hz);
//printf("acq POSITIVE ACQ d_gnss_synchro->PRN = %d\n", (int) d_gnss_synchro->PRN);
}
else
{

View File

@ -175,8 +175,10 @@ fpga_acquisition::fpga_acquisition(std::string device_name,
//std::cout << "Acquisition test register sanity check success!" << std::endl;
}
*/
fpga_acquisition::open_device();
fpga_acquisition::reset_acquisition();
fpga_acquisition::open_device();
fpga_acquisition::fpga_acquisition_test_register();
fpga_acquisition::close_device();
@ -329,9 +331,16 @@ void fpga_acquisition::fpga_configure_acquisition_local_code(lv_16sc_t fft_local
void fpga_acquisition::run_acquisition(void)
{
//uint32_t result_valid = 0;
//while(result_valid == 0)
//{
// read_result_valid(&result_valid); // polling
//}
//printf("acq lib run_acqisition called\n");
// enable interrupts
int32_t reenable = 1;
int32_t disable_int = 0;
//reenable = 1;
write(d_fd, reinterpret_cast<void *>(&reenable), sizeof(int32_t));
@ -345,7 +354,7 @@ void fpga_acquisition::run_acquisition(void)
//uint32_t result_valid = 0;
//usleep(500000);
//usleep(5000000);
//printf("acq lib waiting for result valid\n");
//while(result_valid == 0)
//{
@ -363,6 +372,7 @@ void fpga_acquisition::run_acquisition(void)
}
write(d_fd, reinterpret_cast<void *>(&disable_int), sizeof(int32_t));
}
@ -529,8 +539,9 @@ void fpga_acquisition::configure_acquisition()
fpga_acquisition::open_device();
//printf("acq lib configure acquisition called\n");
//printf("AAA d_select_queue = %d\n", d_select_queue);
d_map_base[0] = d_select_queue;
//printf("AAA d_select_queue = %d\n", d_select_queue);
//d_map_base[0] = 1;
//printf("acq internal writing d_vector_length = %d to d map base 1\n ", d_vector_length);
d_map_base[1] = d_vector_length;
@ -547,20 +558,27 @@ void fpga_acquisition::configure_acquisition()
//void fpga_acquisition::configure_acquisition_debug()
//{
// fpga_acquisition::open_device();
//
// //printf("acq lib configure acquisition called\n");
// // d_map_base[0] = d_select_queue;
// //printf("AAA d_select_queue = %d\n", d_select_queue);
// d_map_base[0] = d_select_queue;
//
// //usleep(500000);
// //d_map_base[0] = 1;
// //printf("acq internal writing d_vector_length = %d to d map base 1\n ", d_vector_length);
// d_map_base[1] = d_vector_length;
///* d_map_base[1] = d_vector_length;
// //printf("acq interal writing d_nsamples = %d to d map base 2\n ", d_nsamples);
// d_map_base[2] = d_nsamples;
// //printf("AAA writing LOG2 d_vector_length = %d to d map base 7\n ", (int)log2((float)d_vector_length));
// d_map_base[7] = static_cast<int32_t>(log2(static_cast<float>(d_vector_length))); // log2 FFTlength
// //printf("AAA writing excludelimit = %d to d map base 12\n", (int) d_excludelimit);
// d_map_base[12] = d_excludelimit;
//
//*/
// //printf("acquisition debug vector length = %d\n", d_vector_length);
// //printf("acquisition debug vector length = %d\n", (int)log2((float)d_vector_length));
//}
@ -600,6 +618,10 @@ void fpga_acquisition::read_acquisition_results(uint32_t *max_index,
float *firstpeak, float *secondpeak, uint64_t *initial_sample, float *power_sum, uint32_t *doppler_index, uint32_t *total_blk_exp)
{
//do
//{
//usleep(500000);
//printf("reading results\n");
@ -651,6 +673,9 @@ void fpga_acquisition::read_acquisition_results(uint32_t *max_index,
readval = d_map_base[15]; // read dummy
//} while (*total_blk_exp == 11);
fpga_acquisition::close_device();
@ -686,8 +711,10 @@ void fpga_acquisition::close_device()
void fpga_acquisition::reset_acquisition(void)
{
fpga_acquisition::open_device();
//printf("acq lib reset acquisition called\n");
d_map_base[8] = RESET_ACQUISITION; // writing a 2 to d_map_base[8] resets the multicorrelator
fpga_acquisition::close_device();
}
// this function is only used for the unit tests

View File

@ -116,6 +116,8 @@ public:
void configure_acquisition(void);
//void configure_acquisition_debug(void);
void close_device();
void open_device();
private:
int64_t d_fs_in;
@ -136,8 +138,8 @@ private:
void fpga_acquisition_test_register(void);
void fpga_configure_acquisition_local_code(lv_16sc_t fft_local_code[]);
//void configure_acquisition();
void close_device();
void open_device();
// void close_device();
// void open_device();
void read_result_valid(uint32_t *result_valid);
// test parameters