/** Do a blocking acquisition search. * Perform an acquisition for one PRN over a defined code and doppler range. * Returns the code phase and carrier frequency of the largest peak in the * search space together with the "SNR" value for that peak defined as * (peak_magnitude - mean) / std_deviation. * * \param prn PRN number - 1 (0..31) to attempt to acquire * (nap_acq_code_wr_blocking must be called prior). * \param cp_min Lower bound for code phase search range in chips. * \param cp_max Upper bound for code phase search range in chips. * \param cf_min Lower bound for carrier freq. search range in Hz. * \param cf_max Upper bound for carrier freq. search range in Hz. * \param cp Pointer to a float where the peak's code phase value will be * stored in chips. * \param cf Pointer to a float where the peak's carrier frequency will be * stored in Hz. * \param snr Pointer to a float where the "SNR" of the peak will be stored. */ void do_acq(u8 prn, float cp_min, float cp_max, float cf_min, float cf_max, float cf_bin_width, float* cp, float* cf, float* snr) { acq_start(prn, cp_min, cp_max, cf_min, cf_max, cf_bin_width); while(acq_state.state == ACQ_RUNNING) { wait_for_nap_exti(); acq_service_irq(); } wait_for_nap_exti(); acq_service_irq(); acq_get_results(cp, cf, snr); }
static void handle_nap_exti(void) { u32 irq = nap_irq_rd_blocking(); if (irq & NAP_IRQ_ACQ_DONE) acq_service_irq(); if (irq & NAP_IRQ_ACQ_LOAD_DONE) acq_service_load_done(); if (irq & NAP_IRQ_TIMING_STROBE) { chBSemReset(&timing_strobe_sem, TRUE); } if (irq & NAP_IRQ_EXT_EVENT) ext_event_service(); /* Mask off everything but tracking irqs. */ irq &= NAP_IRQ_TRACK_MASK; tracking_channels_update(irq); u32 err = nap_error_rd_blocking(); if (err) { log_error("SwiftNAP Error: 0x%08X", (unsigned int)err); tracking_channels_missed_update_error(err); } watchdog_notify(WD_NOTIFY_NAP_ISR); nap_exti_count++; }