mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-06-25 22:52:52 +00:00
Code cleaning
This commit is contained in:
parent
6696e378c5
commit
cc162dac9e
@ -104,6 +104,7 @@ public:
|
|||||||
channel_fsm_ = channel_fsm;
|
channel_fsm_ = channel_fsm;
|
||||||
acquisition_fpga_->set_channel_fsm(channel_fsm);
|
acquisition_fpga_->set_channel_fsm(channel_fsm);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set statistics threshold of PCPS algorithm
|
* \brief Set statistics threshold of PCPS algorithm
|
||||||
*/
|
*/
|
||||||
|
@ -88,6 +88,7 @@ public:
|
|||||||
* tracking blocks
|
* tracking blocks
|
||||||
*/
|
*/
|
||||||
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override;
|
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set acquisition channel unique ID
|
* \brief Set acquisition channel unique ID
|
||||||
*/
|
*/
|
||||||
@ -105,6 +106,7 @@ public:
|
|||||||
channel_fsm_ = channel_fsm;
|
channel_fsm_ = channel_fsm;
|
||||||
acquisition_fpga_->set_channel_fsm(channel_fsm);
|
acquisition_fpga_->set_channel_fsm(channel_fsm);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set statistics threshold of PCPS algorithm
|
* \brief Set statistics threshold of PCPS algorithm
|
||||||
*/
|
*/
|
||||||
|
@ -108,6 +108,7 @@ public:
|
|||||||
channel_fsm_ = channel_fsm;
|
channel_fsm_ = channel_fsm;
|
||||||
acquisition_fpga_->set_channel_fsm(channel_fsm);
|
acquisition_fpga_->set_channel_fsm(channel_fsm);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set statistics threshold of PCPS algorithm
|
* \brief Set statistics threshold of PCPS algorithm
|
||||||
*/
|
*/
|
||||||
|
@ -169,7 +169,6 @@ private:
|
|||||||
unsigned int in_streams_;
|
unsigned int in_streams_;
|
||||||
unsigned int out_streams_;
|
unsigned int out_streams_;
|
||||||
|
|
||||||
//lv_16sc_t* d_all_fft_codes_; // memory that contains all the code ffts
|
|
||||||
uint32_t* d_all_fft_codes_; // memory that contains all the code ffts
|
uint32_t* d_all_fft_codes_; // memory that contains all the code ffts
|
||||||
|
|
||||||
//float calculate_threshold(float pfa);
|
//float calculate_threshold(float pfa);
|
||||||
|
@ -106,6 +106,7 @@ public:
|
|||||||
channel_fsm_ = channel_fsm;
|
channel_fsm_ = channel_fsm;
|
||||||
acquisition_fpga_->set_channel_fsm(channel_fsm);
|
acquisition_fpga_->set_channel_fsm(channel_fsm);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set statistics threshold of PCPS algorithm
|
* \brief Set statistics threshold of PCPS algorithm
|
||||||
*/
|
*/
|
||||||
|
@ -81,7 +81,6 @@ pcps_acquisition_fpga::pcps_acquisition_fpga(pcpsconf_fpga_t conf_)
|
|||||||
d_max_num_acqs = acq_parameters.max_num_acqs;
|
d_max_num_acqs = acq_parameters.max_num_acqs;
|
||||||
|
|
||||||
acquisition_fpga = std::make_shared<Fpga_Acquisition>(acq_parameters.device_name, acq_parameters.code_length, acq_parameters.doppler_max, d_fft_size,
|
acquisition_fpga = std::make_shared<Fpga_Acquisition>(acq_parameters.device_name, acq_parameters.code_length, acq_parameters.doppler_max, d_fft_size,
|
||||||
|
|
||||||
acq_parameters.fs_in, acq_parameters.sampled_ms, acq_parameters.select_queue_Fpga, acq_parameters.all_fft_codes, acq_parameters.excludelimit);
|
acq_parameters.fs_in, acq_parameters.sampled_ms, acq_parameters.select_queue_Fpga, acq_parameters.all_fft_codes, acq_parameters.excludelimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,6 +247,7 @@ void pcps_acquisition_fpga::acquisition_core(uint32_t num_doppler_bins, uint32_t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void pcps_acquisition_fpga::set_active(bool active)
|
void pcps_acquisition_fpga::set_active(bool active)
|
||||||
{
|
{
|
||||||
d_active = active;
|
d_active = active;
|
||||||
@ -264,7 +264,6 @@ void pcps_acquisition_fpga::set_active(bool active)
|
|||||||
// no CFAR algorithm in the FPGA
|
// no CFAR algorithm in the FPGA
|
||||||
<< ", use_CFAR_algorithm_flag: false";
|
<< ", use_CFAR_algorithm_flag: false";
|
||||||
|
|
||||||
|
|
||||||
acquisition_fpga->open_device();
|
acquisition_fpga->open_device();
|
||||||
acquisition_fpga->configure_acquisition();
|
acquisition_fpga->configure_acquisition();
|
||||||
acquisition_fpga->write_local_code();
|
acquisition_fpga->write_local_code();
|
||||||
|
@ -62,8 +62,7 @@ typedef struct
|
|||||||
int32_t code_length;
|
int32_t code_length;
|
||||||
uint32_t select_queue_Fpga;
|
uint32_t select_queue_Fpga;
|
||||||
std::string device_name;
|
std::string device_name;
|
||||||
//lv_16sc_t* all_fft_codes; // memory that contains all the code ffts
|
uint32_t* all_fft_codes; // pointer to memory that contains all the code ffts
|
||||||
uint32_t* all_fft_codes;
|
|
||||||
//float downsampling_factor;
|
//float downsampling_factor;
|
||||||
uint32_t downsampling_factor;
|
uint32_t downsampling_factor;
|
||||||
uint32_t total_block_exp;
|
uint32_t total_block_exp;
|
||||||
@ -188,7 +187,6 @@ public:
|
|||||||
d_channel = channel;
|
d_channel = channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set channel fsm associated to this acquisition instance
|
* \brief Set channel fsm associated to this acquisition instance
|
||||||
*/
|
*/
|
||||||
|
@ -104,7 +104,7 @@ gnss_sdr_fpga_sample_counter::~gnss_sdr_fpga_sample_counter()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Called by gnuradio to enable drivers, etc for i/o devices.
|
// Called by GNU Radio to enable drivers, etc for i/o devices.
|
||||||
bool gnss_sdr_fpga_sample_counter::start()
|
bool gnss_sdr_fpga_sample_counter::start()
|
||||||
{
|
{
|
||||||
// configure the number of samples per output in the FPGA and enable the interrupts
|
// configure the number of samples per output in the FPGA and enable the interrupts
|
||||||
@ -114,6 +114,7 @@ bool gnss_sdr_fpga_sample_counter::start()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Called by GNU Radio to disable drivers, etc for i/o devices.
|
// Called by GNU Radio to disable drivers, etc for i/o devices.
|
||||||
bool gnss_sdr_fpga_sample_counter::stop()
|
bool gnss_sdr_fpga_sample_counter::stop()
|
||||||
{
|
{
|
||||||
@ -188,37 +189,6 @@ void gnss_sdr_fpga_sample_counter::close_device()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//uint32_t gnss_sdr_fpga_sample_counter::wait_for_interrupt_and_read_counter()
|
|
||||||
//{
|
|
||||||
// int32_t irq_count;
|
|
||||||
// ssize_t nb;
|
|
||||||
// int32_t counter;
|
|
||||||
//
|
|
||||||
// // enable interrupts
|
|
||||||
// int32_t reenable = 1;
|
|
||||||
// ssize_t nbytes = TEMP_FAILURE_RETRY(write(fd, reinterpret_cast<void *>(&reenable), sizeof(int32_t)));
|
|
||||||
// if (nbytes != sizeof(int32_t))
|
|
||||||
// {
|
|
||||||
// std::cerr << "Error enabling interruptions in the FPGA." << std::endl;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // wait for interrupt
|
|
||||||
// nb = read(fd, &irq_count, sizeof(irq_count));
|
|
||||||
// if (nb != sizeof(irq_count))
|
|
||||||
// {
|
|
||||||
// std::cout << "FPGA sample counter module read failed to retrieve 4 bytes!" << std::endl;
|
|
||||||
// std::cout << "FPGA sample counter module interrupt number " << irq_count << std::endl;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // it is a rising edge interrupt, the interrupt does not need to be acknowledged
|
|
||||||
// //map_base[1] = 0; // writing anything to reg 1 acknowledges the interrupt
|
|
||||||
//
|
|
||||||
// // add number of passed samples or read the current counter value for more accuracy
|
|
||||||
// counter = samples_per_output; //map_base[0];
|
|
||||||
// return counter;
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
int gnss_sdr_fpga_sample_counter::general_work(int noutput_items __attribute__((unused)),
|
int gnss_sdr_fpga_sample_counter::general_work(int noutput_items __attribute__((unused)),
|
||||||
__attribute__((unused)) gr_vector_int &ninput_items,
|
__attribute__((unused)) gr_vector_int &ninput_items,
|
||||||
__attribute__((unused)) gr_vector_const_void_star &input_items,
|
__attribute__((unused)) gr_vector_const_void_star &input_items,
|
||||||
@ -240,7 +210,6 @@ int gnss_sdr_fpga_sample_counter::general_work(int noutput_items __attribute__((
|
|||||||
out[0].Channel_ID = -1;
|
out[0].Channel_ID = -1;
|
||||||
out[0].fs = fs;
|
out[0].fs = fs;
|
||||||
|
|
||||||
|
|
||||||
if ((sample_counter - last_sample_counter) > samples_per_report)
|
if ((sample_counter - last_sample_counter) > samples_per_report)
|
||||||
{
|
{
|
||||||
last_sample_counter = sample_counter;
|
last_sample_counter = sample_counter;
|
||||||
@ -305,69 +274,8 @@ int gnss_sdr_fpga_sample_counter::general_work(int noutput_items __attribute__((
|
|||||||
current_T_rx_ms = interval_ms * (sample_counter) / samples_per_output;
|
current_T_rx_ms = interval_ms * (sample_counter) / samples_per_output;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
//<<<<<<< HEAD:src/algorithms/libs/gnss_sdr_fpga_sample_counter.cc
|
|
||||||
|
|
||||||
//uint32_t gnss_sdr_fpga_sample_counter::test_register(uint32_t writeval)
|
|
||||||
//{
|
|
||||||
//uint32_t readval;
|
|
||||||
//// write value to test register
|
|
||||||
//map_base[3] = writeval;
|
|
||||||
//// read value from test register
|
|
||||||
//readval = map_base[3];
|
|
||||||
//// return read value
|
|
||||||
//return readval;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//void gnss_sdr_fpga_sample_counter::configure_samples_per_output(uint32_t interval)
|
|
||||||
//{
|
|
||||||
// // note : the counter is a 48-bit value in the HW.
|
|
||||||
// map_base[0] = interval - 1;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//void gnss_sdr_fpga_sample_counter::open_device()
|
|
||||||
//{
|
|
||||||
//// open communication with HW accelerator
|
|
||||||
//if ((fd = open(device_name.c_str(), O_RDWR | O_SYNC)) == -1)
|
|
||||||
//{
|
|
||||||
// LOG(WARNING) << "Cannot open deviceio" << device_name;
|
|
||||||
// std::cout << "Counter-Intr: cannot open deviceio" << device_name << std::endl;
|
|
||||||
//}
|
|
||||||
//map_base = reinterpret_cast<volatile uint32_t *>(mmap(nullptr, PAGE_SIZE,
|
|
||||||
//PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0));
|
|
||||||
//
|
|
||||||
//if (map_base == reinterpret_cast<void *>(-1))
|
|
||||||
//{
|
|
||||||
// LOG(WARNING) << "Cannot map the FPGA acquisition module into user memory";
|
|
||||||
// std::cout << "Counter-Intr: cannot map deviceio" << device_name << std::endl;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//// sanity check : check test register
|
|
||||||
//uint32_t writeval = TEST_REG_SANITY_CHECK;
|
|
||||||
//uint32_t readval;
|
|
||||||
//readval = gnss_sdr_fpga_sample_counter::test_register(writeval);
|
|
||||||
//if (writeval != readval)
|
|
||||||
//{
|
|
||||||
// LOG(WARNING) << "Acquisition test register sanity check failed";
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// LOG(INFO) << "Acquisition test register sanity check success!";
|
|
||||||
//}
|
|
||||||
//}
|
|
||||||
|
|
||||||
//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<uint32_t *>(map_base);
|
|
||||||
//if (munmap(static_cast<void *>(aux), PAGE_SIZE) == -1)
|
|
||||||
//{
|
|
||||||
// std::cout << "Failed to unmap memory uio" << std::endl;
|
|
||||||
//}
|
|
||||||
//close(fd);
|
|
||||||
//}
|
|
||||||
|
|
||||||
////uint32_t gnss_sdr_fpga_sample_counter::wait_for_interrupt_and_read_counter()
|
|
||||||
void gnss_sdr_fpga_sample_counter::wait_for_interrupt()
|
void gnss_sdr_fpga_sample_counter::wait_for_interrupt()
|
||||||
{
|
{
|
||||||
int32_t irq_count;
|
int32_t irq_count;
|
||||||
@ -385,5 +293,3 @@ void gnss_sdr_fpga_sample_counter::wait_for_interrupt()
|
|||||||
std::cout << "fpga sample counter module interrupt number " << irq_count << std::endl;
|
std::cout << "fpga sample counter module interrupt number " << irq_count << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//=======
|
|
||||||
//>>>>>>> b409f1c15efdd3c80fde680f4b5b966a1c18467b:src/core/libs/gnss_sdr_fpga_sample_counter.cc
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user